Merge "Revert "Split out new RefreshSecondaryDataUpdate class""
[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/parsoid
8076 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Cool_%22Gator%22.png" data-parsoid='{"a":{"href":"./File:Cool_%22Gator%22.png"},"sa":{"href":"File:Cool \"Gator\".png"}}'><img resource='./File:Cool_"Gator".png' src="./Special:FilePath/Cool_%22Gator%22.png" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Cool_\"Gator\".png","height":"220","width":"220","src":"./Special:FilePath/Cool_%22Gator%22.png"},"sa":{"resource":"File:Cool \"Gator\".png","src":"./Special:FilePath/Cool_\"Gator\".png"}}'/></a></figure-inline></p>
8077 !! end
8078
8079 !! test
8080 Redirect containing double quotes and spaces
8081 !! wikitext
8082 #REDIRECT [[Cool "Gator"]]
8083 !! html/parsoid
8084 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
8085 !! end
8086
8087 !! test
8088 Link containing double-single-quotes '' in text (T6598 sanity check)
8089 !! wikitext
8090 Some [[Link|pretty ''italics'' and stuff]]!
8091 !! html/php
8092 <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>!
8093 </p>
8094 !! html/parsoid
8095 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8096 !! end
8097
8098 !! test
8099 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8100 !! wikitext
8101 ''Some [[Link|pretty ''italics'' and stuff]]!''
8102 !! html
8103 <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>
8104 </p>
8105 !! end
8106
8107 !! test
8108 Link with double quotes in title part (literal) and alternate part (interpreted)
8109 !! wikitext
8110 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8111
8112 [[''Pentecoste'']]
8113
8114 [[''Pentecoste''|Pentecoste]]
8115
8116 [[''Pentecoste''|''Pentecoste'']]
8117 !! html/php
8118 <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>
8119 </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>
8120 </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>
8121 </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>
8122 </p>
8123 !! html/parsoid
8124 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></figure-inline></p>
8125 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8126 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8127 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8128 !! end
8129
8130 !! test
8131 Broken image links with HTML captions (T41700)
8132 !! wikitext
8133 [[File:Nonexistent|<script></script>]]
8134 [[File:Nonexistent|100x100px|<script></script>]]
8135 [[File:Nonexistent|&lt;]]
8136 [[File:Nonexistent|a<i>b</i>c]]
8137 !! html/php
8138 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8139 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8140 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8141 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8142 </p>
8143 !! html/parsoid
8144 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
8145 <figure-inline typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
8146 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
8147 <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='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline></p>
8148 !! end
8149
8150 !! test
8151 Plain link to URL
8152 !! wikitext
8153 [[http://www.example.com]]
8154 !! html/php
8155 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8156 </p>
8157 !! html/parsoid
8158 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
8159 !! end
8160
8161 !! test
8162 Plain link to URL with link text
8163 !! wikitext
8164 [[http://www.example.com Link text]]
8165 !! html
8166 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8167 </p>
8168 !! end
8169
8170 !! test
8171 Plain link to protocol-relative URL
8172 !! wikitext
8173 [[//www.example.com]]
8174 !! html/php
8175 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8176 </p>
8177 !! html/parsoid
8178 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8179 !! end
8180
8181 !! test
8182 Plain link to protocol-relative URL with link text
8183 !! wikitext
8184 [[//www.example.com Link text]]
8185 !! html
8186 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8187 </p>
8188 !! end
8189
8190 !! test
8191 Plain link to page with question mark in title
8192 !! wikitext
8193 [[A?b]]
8194
8195 [[A?b|Baz]]
8196 !! html
8197 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8198 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8199 </p>
8200 !! end
8201
8202 # I'm fairly sure the expected result here is wrong.
8203 # We want these to be URL links, not pseudo-pages with URLs for titles....
8204 # However the current output is also pretty screwy.
8205 #
8206 # ----
8207 # I'm changing it to match the current output--it arguably makes more
8208 # sense in the light of the test above. Old expected result was:
8209 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8210 #</p>
8211 # But I think this test is bordering on "garbage in, garbage out" anyway.
8212 # -- wtm
8213 !! test
8214 Piped link to URL
8215 !! wikitext
8216 Piped link to URL: [[http://www.example.com|an example URL]]
8217 !! html/php
8218 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8219 </p>
8220 !! html/parsoid
8221 <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>
8222 !! end
8223
8224 !! test
8225 Plain link in template argument
8226 !! options
8227 parsoid=wt2html
8228 !! wikitext
8229 {{echo|[http://www.example.com |123]}}
8230
8231 {{echo|[[http://www.example.com |123]]}}
8232
8233 {{echo|[[http://www.example.com |123]}}
8234
8235 {{echo|[http://www.example.com |123]]}}
8236 !! html/php
8237 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8238 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8239 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8240 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8241 </p>
8242 !! html/parsoid
8243 <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>
8244
8245 <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>
8246
8247 <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>
8248
8249 <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>
8250 !! end
8251
8252 !! test
8253 T2002: [[page|http://url/]] should link to page, not http://url/
8254 !! wikitext
8255 [[Main Page|http://url/]]
8256 !! html/php
8257 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8258 </p>
8259 !! html/parsoid
8260 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8261 !! end
8262
8263 # Parsoid does not mark self-links, by design.
8264 !! test
8265 T2337: Escaped self-links should be bold
8266 !! options
8267 title=[[Bug462]]
8268 !! wikitext
8269 [[Bu&#103;462]] [[Bug462]]
8270 !! html/php+tidy
8271 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8272 </p>
8273 !! html/parsoid
8274 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8275 !! end
8276
8277 !! test
8278 Self-link to section should not be bold
8279 !! options
8280 title=[[Main Page]]
8281 !! wikitext
8282 [[Main Page#section]]
8283 !! html
8284 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8285 </p>
8286 !! end
8287
8288 !! article
8289 00
8290 !! text
8291 This is 00.
8292 !! endarticle
8293
8294 !!test
8295 Self-link to numeric title
8296 !!options
8297 title=[[0]]
8298 !! wikitext
8299 [[0]]
8300 !! html
8301 <p><a class="mw-selflink selflink">0</a>
8302 </p>
8303 !!end
8304
8305 !!test
8306 Link to numeric-equivalent title
8307 !!options
8308 title=[[0]]
8309 !! wikitext
8310 [[00]]
8311 !! html
8312 <p><a href="/wiki/00" title="00">00</a>
8313 </p>
8314 !!end
8315
8316 !! test
8317 <nowiki> inside a link
8318 !! wikitext
8319 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8320 !! html/php+tidy
8321 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8322 </p>
8323 !! html/parsoid
8324 <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>
8325 !! end
8326
8327 ## Parsoid doesn't get this right and even fails wt2html because, when doing the
8328 ## normalization for comparison, the html serialization / re-parse doesn't
8329 ## roundtrip. This is T49963
8330 !! test
8331 <pre> inside a link
8332 !! wikitext
8333 [[Main<pre> Page</pre>]] [[Main Page|the main page <pre>[it's not very good]</pre>]]
8334 !! html/php+tidy
8335 <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>
8336 !! html/parsoid
8337 <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>
8338 !! end
8339
8340 !! test
8341 Non-breaking spaces in title
8342 !! wikitext
8343 [[&nbsp; Main &nbsp; Page &nbsp;]]
8344 !! html
8345 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8346 </p>
8347 !!end
8348
8349 # Add new article for the test below so that it doesn't red-link
8350 !! article
8351 Foo bar baz
8352 !! text
8353 boo
8354 !! endarticle
8355
8356 !! test
8357 Multiple spaces in titles should normalize to a single underscore
8358 !! options
8359 parsoid=wt2html,wt2wt
8360 !! wikitext
8361 [[Foo bar baz|x]]
8362 [[Foo bar baz|x]]
8363 [[Foo bar baz|x]]
8364 !! html/php
8365 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8366 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8367 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8368 </p>
8369 !! html/parsoid
8370 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8371 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8372 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8373 </p>
8374 !! end
8375
8376 !! test
8377 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8378 !! options
8379 language=ca
8380 !! wikitext
8381 '''[[Main Page]]'''
8382 !! html
8383 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8384 </p>
8385 !! end
8386
8387 !! test
8388 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8389 !! options
8390 language=ca
8391 !! wikitext
8392 ''[[Main Page]]''
8393 !! html
8394 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8395 </p>
8396 !! end
8397
8398 !! test
8399 Internal link with en linktrail: no apostrophes (T29473)
8400 !! options
8401 language=en
8402 !! wikitext
8403 [[Something]]'nice
8404 !! html
8405 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8406 </p>
8407 !! end
8408
8409 !! test
8410 Internal link with ca linktrail with apostrophes (T29473)
8411 !! options
8412 language=ca
8413 !! wikitext
8414 [[Something]]'nice
8415 !! html
8416 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8417 </p>
8418 !! end
8419
8420 !! test
8421 Internal link with kaa linktrail with apostrophes (T29473)
8422 !! options
8423 language=kaa
8424 !! wikitext
8425 [[Something]]'nice
8426 !! html
8427 <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>
8428 </p>
8429 !! end
8430
8431 !! test
8432 Link with multiple ":" in a subpage-supporting namespace (T65636)
8433 !! wikitext
8434 [[User:Foo/Test/63636:Bar|Test]]
8435 !! html/php
8436 <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>
8437 </p>
8438 !! html/parsoid
8439 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8440 !! end
8441
8442 ## Mainly a sanity check for Parsoid
8443 !! test
8444 Handle title parsing for subpages
8445 !! options
8446 title=[[/123123]]
8447 subpage
8448 !! wikitext
8449 123
8450 !! html/php
8451 <p>123
8452 </p>
8453 !! html/parsoid
8454 <p>123</p>
8455 !! end
8456
8457 !! article
8458 User:Test/123
8459 !! text
8460 test 123
8461 !! endarticle
8462
8463 !! test
8464 Link to a subpage from a namespace other than main
8465 !! options
8466 title=[[User:Test]]
8467 subpage
8468 !! wikitext
8469 [[/123]]
8470 !! html/php
8471 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8472 </p>
8473 !! html/parsoid
8474 <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>
8475 !! end
8476
8477 !! test
8478 Ensure that transclusion titles are not url-decoded
8479 !! options
8480 subpage title=[[Test]]
8481 parsoid=wt2html
8482 !! wikitext
8483 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8484 !! html/php
8485 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8486 </p>
8487 !! html/parsoid
8488 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8489 !! end
8490
8491 !! test
8492 Purely hash wikilink
8493 !! options
8494 title=[[User:Test/123]]
8495 subpage
8496 !! wikitext
8497 [[#a|b]]
8498 !! html/php
8499 <p><a href="#a">b</a>
8500 </p>
8501 !! html/parsoid
8502 <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>
8503 !! end
8504
8505 !! test
8506 Serialization of purely hash wikilink
8507 !! options
8508 title=[[User:Test/123]]
8509 subpage
8510 parsoid=html2wt
8511 !! html/parsoid
8512 <p><a href="#a">[[</a></p>
8513 !! wikitext
8514 [[#a|<nowiki>[[</nowiki>]]
8515 !! html/php
8516 <p><a href="#a">[[</a>
8517 </p>
8518 !! end
8519
8520 !! test
8521 1. Interaction of linktrail and template encapsulation
8522 !! wikitext
8523 {{echo|[[Foo]]}}l
8524 !! html/php+tidy
8525 <p><a href="/wiki/Foo" title="Foo">Fool</a>
8526 </p>
8527 !! html/parsoid
8528 <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>
8529 !! end
8530
8531 !! test
8532 2. Interaction of linktrail and template encapsulation
8533 !! wikitext
8534 {{echo|Some [[Fool]]}}s
8535 !! html/php+tidy
8536 <p>Some <a href="/index.php?title=Fool&amp;action=edit&amp;redlink=1" class="new" title="Fool (page does not exist)">Fools</a>
8537 </p>
8538 !! html/parsoid
8539 <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>
8540 !! end
8541
8542 !! test
8543 3. Interaction of linktrail and template encapsulation
8544 !! wikitext
8545 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8546 !! html/php+tidy
8547 <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>
8548 </p>
8549 !! html/parsoid
8550 <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>
8551 !! end
8552
8553 !! article
8554 Söfnuður
8555 !! text
8556 Test.
8557 !! endarticle
8558
8559 !! test
8560 Internal link with is link prefix
8561 !! options
8562 language=is
8563 !! wikitext
8564 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8565 !! html
8566 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8567 </p>
8568 !! end
8569
8570 !! article
8571 Mótmælendatrú
8572 !! text
8573 Test.
8574 !! endarticle
8575
8576 !! test
8577 Internal link with is link trail and link prefix
8578 !! options
8579 language=is
8580 !! wikitext
8581 [[mótmælendatrú|xxx]]ar
8582 [[mótmælendatrú]]ar
8583 mótmælenda[[söfnuður]]
8584 mótmælenda[[söfnuður|söfnuðir]]
8585 mótmælenda[[söfnuður|söfnuðir]]xxx
8586 !! html
8587 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8588 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8589 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8590 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8591 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8592 </p>
8593 !! end
8594
8595 !! test
8596 Parsoid link trail escaping
8597 !! options
8598 parsoid=html2wt,html2html
8599 !! html/parsoid
8600 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8601 !! wikitext
8602 [[apple]]<nowiki/>s
8603 !! end
8604
8605 !! test
8606 Parsoid link prefix escaping
8607 !! options
8608 language=is
8609 parsoid=html2wt,html2html
8610 !! html/parsoid
8611 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8612 !! wikitext
8613 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8614 !! end
8615
8616 !! test
8617 Parsoid link bracket escaping
8618 !! options
8619 parsoid=html2wt,html2html
8620 !! html/parsoid
8621 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8622 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8623 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8624 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8625 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8626 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8627 !! wikitext
8628 [[Test]]
8629
8630 [<nowiki/>[[Test]]]
8631
8632 [[[[Test]]]]
8633
8634 [[[<nowiki/>[[Test]]]]]
8635
8636 [[[[[[Test]]]]]]
8637
8638 [[[[[<nowiki/>[[Test]]]]]]]
8639 !! end
8640
8641 !! test
8642 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8643 !! wikitext
8644 [[Foo| bar]]
8645
8646 [[Foo| ''bar'']]
8647
8648 [http://wp.org foo]
8649
8650 [http://wp.org ''foo'']
8651 !! html
8652 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8653 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8654 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8655 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8656 </p>
8657 !! end
8658
8659 !! test
8660 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8661 !! wikitext
8662 [[Foo|{{echo|a}} b {{echo|c}}]]
8663 !! html/parsoid
8664 <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>
8665 !! end
8666
8667 !! test
8668 Link with angle bracket after anchor
8669 !! config
8670 wgFragmentMode=[ 'html5', 'legacy' ]
8671 !! wikitext
8672 [[Foo#<bar>]]
8673 !! html/php
8674 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8675 </p>
8676 !! html/parsoid
8677 <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>
8678 !! end
8679
8680 !! test
8681 Link with angle bracket after anchor (legacy)
8682 !! config
8683 wgFragmentMode=[ 'legacy' ]
8684 !! wikitext
8685 [[Foo#<bar>]]
8686 !! html/php
8687 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8688 </p>
8689 !! end
8690
8691 ###
8692 ### Interwiki links (see maintenance/interwiki.sql)
8693 ###
8694
8695 !! test
8696 Inline interwiki link
8697 !! options
8698 parsoid=wt2html,wt2wt,html2html
8699 !! wikitext
8700 [[MeatBall:SoftSecurity]]
8701 !! html/php
8702 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8703 </p>
8704 !! html/parsoid
8705 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8706 !! end
8707
8708 !! test
8709 Inline interwiki link with empty title (T4372)
8710 !! options
8711 parsoid=wt2html,wt2wt,html2html
8712 !! wikitext
8713 [[MeatBall:]]
8714 !! html/php
8715 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8716 </p>
8717 !! html/parsoid
8718 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8719 !! end
8720
8721 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8722 !! test
8723 Interwiki link encoding conversion (T3636)
8724 !! options
8725 parsoid=wt2html,wt2wt
8726 !! wikitext
8727 *[[Wikipedia:ro:Olteni&#0355;a]]
8728 *[[Wikipedia:ro:Olteni&#355;a]]
8729 !! html/php
8730 <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>
8731 <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>
8732 !! html/php+tidy
8733 <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>
8734 <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>
8735 !! html/parsoid
8736 <ul>
8737 <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>
8738 <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>
8739 </ul>
8740 !! end
8741
8742 !! test
8743 Interwiki link with fragment (T4130)
8744 !! wikitext
8745 [[MeatBall:SoftSecurity#foo]]
8746 !! html
8747 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8748 </p>
8749 !! end
8750
8751 ## The interwiki case here continued to be legacy escaped because of the
8752 ## default setting of $wgExternalInterwikiFragmentMode
8753 !! test
8754 Link scenarios with escaped fragments
8755 !! options
8756 title=[[Main Page]]
8757 !! config
8758 wgFragmentMode=[ 'html5', 'legacy' ]
8759 !! wikitext
8760 [[#Is this great?]]
8761 [[Foo#Is this great?]]
8762 [[meatball:Foo#Is this great?]]
8763 !! html/php
8764 <p><a href="#Is_this_great?">#Is this great?</a>
8765 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8766 <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>
8767 </p>
8768 !! html/parsoid
8769 <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>
8770 <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>
8771 <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>
8772 !! end
8773
8774 !! test
8775 Link scenarios with escaped fragments (legacy)
8776 !! config
8777 wgFragmentMode=[ 'legacy' ]
8778 !! wikitext
8779 [[#Is this great?]]
8780 [[Foo#Is this great?]]
8781 [[meatball:Foo#Is this great?]]
8782 !! html/php
8783 <p><a href="#Is_this_great.3F">#Is this great?</a>
8784 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8785 <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>
8786 </p>
8787 !! end
8788
8789 # Ideally the wikipedia: prefix here should be proto-relative too
8790 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8791 # define the 'en' prefix, and originally the test used 'wikipedia',
8792 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8793 # article.
8794 !! test
8795 Different interwiki prefixes mapping to the same URL
8796 !! wikitext
8797 [[:en:Foo]]
8798
8799 [[:en:Foo|Foo]]
8800
8801 [[wikipedia:Foo]]
8802
8803 [[:wikipedia:Foo|Foo]]
8804
8805 [[wikipedia:en:Foo]]
8806
8807 [[:wikipedia:en:Foo]]
8808
8809 [[ wikiPEdia :Foo]]
8810 !! html/parsoid
8811 <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>
8812
8813 <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>
8814
8815 <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>
8816
8817 <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>
8818
8819 <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>
8820
8821 <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>
8822
8823 <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>
8824 !! end
8825
8826 !! test
8827 Interwiki links that cannot be represented in wiki syntax
8828 !! wikitext
8829 [[meatball:ok]]
8830 [[meatball:ok#foo|ok with fragment]]
8831 [[meatball:ok_as_well?|ok ending with ? mark]]
8832 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8833 [http://de.wikipedia.org/wiki/#foo is just fragment]
8834
8835 !! html/php
8836 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8837 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8838 <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>
8839 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8840 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8841 </p>
8842 !! html/parsoid
8843 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8844 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8845 <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>
8846 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8847 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8848 !! end
8849
8850 !! test
8851 Interwiki links: trail
8852 !! wikitext
8853 [[wikipedia:Foo|Ba]]r
8854 !! html/php
8855 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8856 </p>
8857 !! html/parsoid
8858 <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>
8859 !! end
8860
8861 !! test
8862 Local interwiki link
8863 !! options
8864 parsoid=wt2html,wt2wt,html2html
8865 !! wikitext
8866 [[local:Template:Foo]]
8867 !! html/php
8868 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8869 </p>
8870 !! html/parsoid
8871 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8872 !! end
8873
8874 # Parsoid does not mark self-links, by design.
8875 !! test
8876 Local interwiki link: self-link to current page
8877 !! options
8878 title=[[Main Page]]
8879 parsoid=wt2html,wt2wt,html2html
8880 !! wikitext
8881 [[local:Main Page]]
8882 !! html/php
8883 <p><a class="mw-selflink selflink">local:Main Page</a>
8884 </p>
8885 !! html/parsoid
8886 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8887 !! end
8888
8889 !! test
8890 Local interwiki link: prefix only (T66167)
8891 !! options
8892 parsoid=wt2html,wt2wt,html2html
8893 !! wikitext
8894 [[local:]]
8895 !! html/php
8896 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8897 </p>
8898 !! html/parsoid
8899 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8900 !! end
8901
8902 !! test
8903 Local interwiki link: with additional interwiki prefix (T63357)
8904 !! options
8905 parsoid=wt2html,wt2wt,html2html
8906 !! wikitext
8907 [[local:meatball:Hello]]
8908 !! html/php
8909 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8910 </p>
8911 !! html/parsoid
8912 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8913 !! end
8914
8915 !! test
8916 Multiple local interwiki link prefixes
8917 !! wikitext
8918 [[local:local:local:local:mi:local:Foo]]
8919 !! options
8920 parsoid=wt2html,wt2wt,html2html
8921 !! html/php
8922 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8923 </p>
8924 !! html/parsoid
8925 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8926 !! end
8927
8928 !! test
8929 Interwiki link with percent encoded target
8930 !! wikitext
8931 [[:es:Nueva Guip%C3%BAzcoa|Nueva Guipúzcoa]]
8932 !! html/php
8933 <p><a href="http://es.wikipedia.org/wiki/Nueva_Guip%C3%BAzcoa" class="extiw" title="es:Nueva Guipúzcoa">Nueva Guipúzcoa</a>
8934 </p>
8935 !! html/parsoid
8936 <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>
8937 !! end
8938
8939 ###
8940 ### Interlanguage links
8941 ### Language links (so that searching for '### language' matches..)
8942 ###
8943
8944 !! test
8945 Interlanguage link
8946 !! wikitext
8947 Blah blah blah
8948 [[zh:Chinese]]
8949 !! html/php
8950 <p>Blah blah blah
8951 </p>
8952 !! html/parsoid
8953 <p>Blah blah blah</p>
8954 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8955 !! end
8956
8957 ## parsoid html2wt will lose the space variations
8958 !! test
8959 Interlanguage link with spacing
8960 !! options
8961 parsoid=wt2html,wt2wt,html2html
8962 !! wikitext
8963 Blah blah blah
8964 [[ zh : Chinese ]]
8965 !! html/php
8966 <p>Blah blah blah
8967 </p>
8968 !! html/parsoid
8969 <p>Blah blah blah</p>
8970 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8971 !! end
8972
8973 !! test
8974 Double interlanguage link
8975 !! wikitext
8976 Blah blah blah
8977 [[es:Spanish]]
8978 [[zh:Chinese]]
8979 !! html/php
8980 <p>Blah blah blah
8981 </p>
8982 !! html/parsoid
8983 <p>Blah blah blah</p>
8984 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8985 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8986 !! end
8987
8988 ## parsoid html2wt will lose the space variations
8989 !! test
8990 Interlanguage link variations
8991 !! options
8992 parsoid=wt2html,wt2wt,html2html
8993 !! wikitext
8994 Blah blah blah
8995 [[ es :Spanish]]
8996 [[ ZH :Chinese]]
8997 [[es:Foo_bar]]
8998 !! html/php
8999 <p>Blah blah blah
9000 </p>
9001 !! html/parsoid
9002 <p>Blah blah blah</p>
9003 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
9004 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
9005 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
9006 !! end
9007
9008 !! test
9009 Escaping of interlanguage links (T129218, T156308)
9010 !! wikitext
9011 Blah blah blah
9012 [[:es:Spanish]]
9013 [[ : zh : Chinese ]]
9014 !! html/php
9015 <p>Blah blah blah
9016 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9017 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
9018 </p>
9019 !! html/parsoid
9020 <p>Blah blah blah
9021 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9022 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
9023 !! end
9024
9025 !! test
9026 Multiple colons escaping interlanguage links
9027 !! options
9028 parsoid=wt2html
9029 !! wikitext
9030 [[:es:Spanish]]
9031 [[::es:Spanish]]
9032 [[:::es:Spanish]]
9033 !! html/php
9034 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9035 [[::es:Spanish]]
9036 [[:::es:Spanish]]
9037 </p>
9038 !! html/parsoid
9039 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9040 [[::es:Spanish]]
9041 [[:::es:Spanish]]</p>
9042 !! end
9043
9044 ## parsoid html2wt will normalize the space to _
9045 !! test
9046 Space and question mark encoding in interlanguage links (T95473)
9047 !! options
9048 parsoid=wt2html,wt2wt,html2html
9049 !! wikitext
9050 Blah blah blah
9051 [[es:Foo bar?]]
9052 !! html/php
9053 <p>Blah blah blah
9054 </p>
9055 !! html/parsoid
9056 <p>Blah blah blah</p>
9057 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
9058 !! end
9059
9060 !! test
9061 Interlanguage link, with prefix links
9062 !! options
9063 language=ln
9064 !! wikitext
9065 Blah blah blah
9066 [[zh:Chinese]]
9067 !! html/php
9068 <p>Blah blah blah
9069 </p>
9070 !! html/parsoid
9071 <p>Blah blah blah</p>
9072 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9073 !! end
9074
9075 !! test
9076 Double interlanguage link, with prefix links (T10897)
9077 !! options
9078 language=ln
9079 !! wikitext
9080 Blah blah blah
9081 [[es:Spanish]]
9082 [[zh:Chinese]]
9083 !! html/php
9084 <p>Blah blah blah
9085 </p>
9086 !! html/parsoid
9087 <p>Blah blah blah</p>
9088 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9089 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9090 !! end
9091
9092 !! test
9093 "Extra" interlanguage links (T34189 / gerrit 111390)
9094 !! wikitext
9095 Blah blah blah
9096 [[mul:Article]]
9097 !! html/php
9098 <p>Blah blah blah
9099 </p>
9100 !! html/parsoid
9101 <p>Blah blah blah</p>
9102 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
9103 !! end
9104
9105 ## PHP parser tests script needs an update
9106 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9107 !! test
9108 Language links render as inline links if $wgInterwikiMagic=false
9109 !! options
9110 wgInterwikiMagic=false
9111 parsoid=wt2html,wt2wt,html2html
9112 !! wikitext
9113 Blah blah blah
9114 [[zh:Chinese]]
9115 !! html/parsoid
9116 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9117 !! end
9118
9119 ## PHP parser tests script needs an update
9120 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9121 !! test
9122 Language links render as inline links in the Talk namespace
9123 !! options
9124 title=Talk:Foo
9125 parsoid=wt2html,wt2wt,html2html
9126 !! wikitext
9127 Blah blah blah
9128 [[zh:Chinese]]
9129 !! html/parsoid
9130 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9131 !! end
9132
9133 !! test
9134 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
9135 !! options
9136 language=ln
9137 !! wikitext
9138 [[WW&nbsp;II]]
9139 !! html
9140 <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>
9141 </p>
9142 !! end
9143
9144 !! test
9145 Parsoid T55221: Wikilinks should be properly entity-escaped
9146 !! options
9147 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
9148 !! html/parsoid
9149 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9150 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9151 !! wikitext
9152 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
9153
9154 He&amp;nbsp;llo He&amp;nbsp;llo
9155 !! html/php
9156 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
9157 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
9158 </p>
9159 !! end
9160
9161 # html2wt will fail because of title normalization without data-parsoid
9162 !! test
9163 Parsoid: handle constructor well
9164 !! options
9165 parsoid=wt2html,wt2wt
9166 !! wikitext
9167 [[constructor]]
9168
9169 [[constructor:foo]]
9170 !! html/php
9171 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9172 </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>
9173 </p>
9174 !! html/parsoid
9175 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9176
9177 <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>
9178 !! end
9179
9180 !! test
9181 Template parameter named "constructor"
9182 !! wikitext
9183 {{echo| constructor = |hi}}
9184 !! html/parsoid
9185 <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>
9186 !! end
9187
9188 !! article
9189 ko:
9190 !! text
9191 Test.
9192 !! endarticle
9193
9194 # Note that `ko` isn't a known interlanguage prefix
9195 !! test
9196 Parsoid: recognize interlanguage links without a target page
9197 !! options
9198 ill
9199 !! wikitext
9200 [[es:]]
9201
9202 [[ko:]]
9203 !! html/php
9204 es:
9205 !! html/parsoid
9206 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9207
9208 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9209 !! end
9210
9211 # Note that `ko` isn't a known interwiki prefix
9212 !! test
9213 Parsoid: recognize interwiki links without a target page
9214 !! options
9215 parsoid=wt2html,wt2wt,html2html
9216 !! wikitext
9217 [[:es:]]
9218
9219 [[:ko:]]
9220 !! html/php
9221 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9222 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9223 </p>
9224 !! html/parsoid
9225 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9226 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9227 !! end
9228
9229 !! test
9230 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9231 !! wikitext
9232 [[mi:Foo]]
9233 !! html/php
9234 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9235 </p>
9236 !! html/parsoid
9237 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9238 !! end
9239
9240 !! test
9241 Interlanguage link with preceding local interwiki link (T70085)
9242 !! options
9243 parsoid=wt2html,wt2wt,html2html
9244 !! wikitext
9245 Blah blah blah
9246 [[local:es:Spanish]]
9247 !! html/php
9248 <p>Blah blah blah
9249 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9250 </p>
9251 !! html/parsoid
9252 <p>Blah blah blah
9253 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9254 !! end
9255
9256 !! test
9257 Looks like an interlanguage link, but is actually a local interwiki
9258 !! options
9259 parsoid=wt2html,wt2wt,html2html
9260 !! wikitext
9261 Blah blah blah
9262 [[mi:Template:Foo]]
9263 !! html/php
9264 <p>Blah blah blah
9265 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9266 </p>
9267 !! html/parsoid
9268 <p>Blah blah blah
9269 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9270 !! end
9271
9272 ###
9273 ### Redirects, Parsoid-only
9274 ###
9275
9276 !! test
9277 1. Simple redirect to page
9278 !! wikitext
9279 #REDIRECT [[Main Page]]
9280 !! html/parsoid
9281 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9282 !! end
9283
9284 !! test
9285 2. Other redirect variants
9286 !! wikitext
9287 #REDIRECT [[Main_Page]]
9288 !! html/parsoid
9289 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9290 !! end
9291
9292 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9293 # This tests the Parsoid bail-out code.
9294 !! test
9295 3. Other redirect variants
9296 !! options
9297 parsoid=wt2html
9298 !! wikitext
9299 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9300 !! html/parsoid
9301 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9302 !! end
9303
9304 !! test
9305 4. Redirect to a templated destination
9306 !! wikitext
9307 #REDIRECT [[{{echo|Foo}}bar]]
9308 !! html/parsoid
9309 <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"}]]}'/>
9310 !! end
9311
9312 !! test
9313 Empty redirect
9314 !! options
9315 parsoid=wt2html,wt2wt
9316 !! wikitext
9317 #REDIRECT [[]]
9318 !! html/parsoid
9319 <ol>
9320 <li>REDIRECT [[]]</li></ol>
9321 !! end
9322
9323 !! test
9324 Optional colon in #REDIRECT
9325 !! options
9326 # the colon is archaic syntax. we support it for wt2html, but we
9327 # don't care that it roundtrips back to the modern syntax.
9328 parsoid=wt2html,html2html
9329 !! wikitext
9330 #REDIRECT:[[Main Page]]
9331 !! html/parsoid
9332 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9333 !! end
9334
9335 !! test
9336 Whitespace in #REDIRECT with optional colon
9337 !! options
9338 # the colon and gratuitous whitespace is archaic syntax. we support
9339 # it for wt2html, but we don't care that it roundtrips back to the
9340 # modern syntax (without extra whitespace)
9341 parsoid=wt2html,html2html
9342 !! wikitext
9343
9344 #REDIRECT
9345 :
9346 [[Main Page]]
9347 !! html/parsoid
9348 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9349 !! end
9350
9351 !! test
9352 Piped link in #REDIRECT
9353 !! options
9354 # content after piped link is ignored. we support this syntax,
9355 # but don't care that the piped link is lost when we roundtrip this.
9356 parsoid=wt2html
9357 !! wikitext
9358 #REDIRECT [[Main Page|bar]]
9359 !! html/parsoid
9360 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9361 !! end
9362
9363 !! test
9364 Redirect to category (T104502)
9365 !! options
9366 parsoid=wt2html,wt2wt
9367 !! wikitext
9368 #REDIRECT [[Category:Foo]]
9369 !! html/parsoid
9370 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9371 !! end
9372
9373 !! test
9374 Redirect to category with URL encoding (T104502)
9375 !! options
9376 parsoid=wt2html
9377 !! wikitext
9378 #REDIRECT [[Category%3AFoo]]
9379 !! html/parsoid
9380 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9381 !! end
9382
9383 !! test
9384 Redirect to category page
9385 !! wikitext
9386 #REDIRECT [[:Category:Foo]]
9387 !! html/parsoid
9388 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9389 !! end
9390
9391 !! test
9392 Redirect to image page (1)
9393 !! wikitext
9394 #REDIRECT [[File:Wiki.png]]
9395 !! html/parsoid
9396 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9397 !! end
9398
9399 !! test
9400 Redirect to image page (2)
9401 !! wikitext
9402 #REDIRECT [[Image:Wiki.png]]
9403 !! html/parsoid
9404 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9405 !! end
9406
9407 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9408 # Next test confirms this.
9409 !! test
9410 Redirect to language (1) (T104918)
9411 !! options
9412 parsoid=wt2html,wt2wt,html2html
9413 !! wikitext
9414 #REDIRECT [[en:File:Wiki.png]]
9415 !! html/parsoid
9416 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9417 !! end
9418
9419 !! test
9420 Redirect to language (2) (T104918)
9421 !! wikitext
9422 #REDIRECT [[:en:File:Wiki.png]]
9423 !! html/parsoid
9424 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9425 !! end
9426
9427 !! test
9428 Redirect to interwiki (T104918)
9429 !! wikitext
9430 #REDIRECT [[meatball:File:Wiki.png]]
9431 !! html/parsoid
9432 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9433 !! end
9434
9435 !! test
9436 Non-English #REDIRECT
9437 !! options
9438 language=is
9439 !! wikitext
9440 #TILVÍSUN [[Main Page]]
9441 !! html/parsoid
9442 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9443 !! end
9444
9445 !! test
9446 Redirect syntax under text isn't considered a redirect
9447 !! wikitext
9448 some text
9449
9450 #redirect [[Main Page]]
9451 !! html/parsoid
9452 <p>some text</p>
9453 <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>
9454 !! end
9455
9456 !! test
9457 New redirect
9458 !! options
9459 parsoid=html2wt
9460 !! html/parsoid
9461 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9462 !! wikitext
9463 #REDIRECT [[Foo]]
9464 Foo
9465 !! end
9466
9467 !! test
9468 Redirect followed by block on the same line
9469 !! options
9470 parsoid=wt2html
9471 !! wikitext
9472 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9473 !! html/parsoid
9474 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9475 !! end
9476
9477 !! test
9478 Redirect followed by a newline
9479 !! wikitext
9480 #REDIRECT [[Main Page]]
9481 A newline
9482 !! html/parsoid
9483 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9484 <p>A newline</p>
9485 !! end
9486
9487 !! test
9488 Redirect followed by multiple newlines
9489 !! wikitext
9490 #REDIRECT [[Main Page]]
9491
9492
9493 A newline
9494 !! html/parsoid
9495 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9496
9497 <p><br/>
9498 A newline</p>
9499 !! end
9500
9501 !! test
9502 Drop duplicate redirects
9503 !! options
9504 parsoid=html2wt
9505 !! html/parsoid
9506 <link rel="mw:PageProp/redirect" href="./Foo"/>
9507 <link rel="mw:PageProp/redirect" href="./Bar"/>
9508 <link rel="mw:PageProp/redirect" href="./Baz"/>
9509 !! wikitext
9510 #REDIRECT [[Foo]]
9511 !! end
9512
9513 ##
9514 ## XHTML tidiness
9515 ###
9516
9517 !! test
9518 <br> to <br />
9519 !! wikitext
9520 1<br>2<br />3
9521 !! html
9522 <p>1<br />2<br />3
9523 </p>
9524 !! end
9525
9526 !! test
9527 Broken br tag sanitization
9528 !! wikitext
9529 </br>
9530 !! html/php
9531 <p>&lt;/br&gt;
9532 </p>
9533 !! end
9534
9535 # TODO: Fix html2html mode (T53055)!
9536 !! test
9537 Parsoid: Broken br tag recognition
9538 !! options
9539 parsoid=wt2html
9540 !! wikitext
9541 </br>
9542
9543 <br/ >
9544 !! html+tidy
9545 <p><br />
9546 </p><p><br />
9547 </p>
9548 !! end
9549
9550 !! test
9551 Incorrecly removing closing slashes from correctly formed XHTML
9552 !! wikitext
9553 <br style="clear:both;" />
9554 !! html
9555 <p><br style="clear:both;" />
9556 </p>
9557 !! end
9558
9559 !! test
9560 Failing to transform badly formed HTML into correct XHTML
9561 !! wikitext
9562 <br style="clear: left;">
9563 <br style="clear: right;">
9564 <br style="clear: both;">
9565 !! html
9566 <p><br style="clear: left;" />
9567 <br style="clear: right;" />
9568 <br style="clear: both;" />
9569 </p>
9570 !!end
9571
9572 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9573 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9574 !! test
9575 Handling html with a div self-closing tag
9576 !! wikitext
9577 <div title />
9578 <div title/>
9579 <div title/ >
9580 <div title=bar />
9581 <div title=bar/>
9582 <div title=bar/ >
9583 !! html/php+tidy
9584 <div title=""></div>
9585 <div title=""></div>
9586 <div title="">
9587 <div title="bar"></div>
9588 <div title="bar"></div>
9589 <div title="bar/"></div></div>
9590 !! html/parsoid
9591 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9592 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9593 <div title="" data-parsoid='{"stx":"html","autoInsertedEnd":true}'>
9594 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9595 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9596 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div></div>
9597 !! end
9598
9599 !! test
9600 Elements with solidus in various attribute positions
9601 !! options
9602 parsoid=wt2html,html2html
9603 !! wikitext
9604 <div cla/ss="123">ha</div>
9605
9606 <div / class="123">ha</div>
9607
9608 <div class= / "123">ha</div>
9609 !! html/php+tidy
9610 <div>ha</div>
9611 <div class="123">ha</div>
9612 <div class="/">ha</div>
9613 !! html/parsoid
9614 <div data-parsoid='{"stx":"html","a":{"cla":null,"ss":null},"sa":{"cla":"","ss":"123"}}'>ha</div>
9615
9616 <div class="123" data-parsoid='{"stx":"html"}'>ha</div>
9617
9618 <div class="/" data-parsoid='{"stx":"html","a":{"\"123\"":null},"sa":{"\"123\"":""}}'>ha</div>
9619 !! end
9620
9621 !! test
9622 Handling html with a br self-closing tag
9623 !! wikitext
9624 <br title />
9625 <br title/>
9626 <br title/ >
9627 <br title=bar />
9628 <br title=bar/>
9629 <br title=bar/ >
9630 !! html/php+tidy
9631 <p><br title="" />
9632 <br title="" />
9633 <br title="" />
9634 <br title="bar" />
9635 <br title="bar" />
9636 <br title="bar/" />
9637 </p>
9638 !! html/parsoid
9639 <p><br title="" />
9640 <br title="" />
9641 <br title="" />
9642 <br title="bar" />
9643 <br title="bar" />
9644 <br title="bar/" />
9645 </p>
9646 !! end
9647
9648 !! test
9649 Quoted attributes without spaces
9650 !! options
9651 parsoid=wt2html
9652 !! wikitext
9653 <div class="foo"style="color:red">red</div>
9654 !! html/php+tidy
9655 <div class="foo" style="color:red">red</div>
9656 !! html/parsoid
9657 <div class="foo" style="color:red">red</div>
9658 !! end
9659
9660 !! test
9661 Horizontal ruler (should it add that extra space?)
9662 !! wikitext
9663 <hr>
9664 <hr >
9665 foo <hr
9666 > bar
9667 !! html+tidy
9668 <hr />
9669 <hr /><p>
9670 foo </p><hr /><p> bar</p>
9671 !! end
9672
9673 !! test
9674 Horizontal ruler -- 4+ dashes render hr
9675 !! wikitext
9676 ----
9677 !! html
9678 <hr />
9679 !! end
9680
9681 !! test
9682 Horizontal ruler -- eats additional dashes on the same line
9683 !! wikitext
9684 ---------
9685 !! html
9686 <hr />
9687 !! end
9688
9689 !! test
9690 Horizontal ruler -- does not collapse dashes on consecutive lines
9691 !! wikitext
9692 ----
9693 ----
9694 !! html
9695 <hr />
9696 <hr />
9697 !! end
9698
9699 !! test
9700 Horizontal ruler -- <4 dashes render as plain text
9701 !! wikitext
9702 ---
9703 !! html
9704 <p>---
9705 </p>
9706 !! end
9707
9708 !! test
9709 Horizontal ruler -- Supports content following dashes on same line
9710 !! wikitext
9711 ---- Foo
9712 !! html
9713 <hr /> Foo
9714 !! html+tidy
9715 <hr /><p> Foo</p>
9716 !! end
9717
9718 ###
9719 ### Block-level elements
9720 ###
9721 !! test
9722 Common list
9723 !! wikitext
9724 *Common list
9725 *item 2
9726 *item 3
9727 !! html
9728 <ul><li>Common list</li>
9729 <li>item 2</li>
9730 <li>item 3</li></ul>
9731 !! end
9732
9733 !! test
9734 Numbered list
9735 !! wikitext
9736 #Numbered list
9737 #item 2
9738 #item 3
9739 !! html
9740 <ol><li>Numbered list</li>
9741 <li>item 2</li>
9742 <li>item 3</li></ol>
9743 !! end
9744
9745 # the switch from level 3 to ordered should not introduce a newline between
9746 !! test
9747 Mixed list
9748 !! wikitext
9749 *Mixed list
9750 *#with numbers
9751 **and bullets
9752 *#and numbers
9753 *bullets again
9754 **bullet level 2
9755 ***bullet level 3
9756 ***#Number on level 4
9757 **bullet level 2
9758 **#Number on level 3
9759 **#Number on level 3
9760 *#number level 2
9761 *Level 1
9762 ***Level 3
9763 #**Level 3, but ordered
9764 !! html
9765 <ul><li>Mixed list
9766 <ol><li>with numbers</li></ol>
9767 <ul><li>and bullets</li></ul>
9768 <ol><li>and numbers</li></ol></li>
9769 <li>bullets again
9770 <ul><li>bullet level 2
9771 <ul><li>bullet level 3
9772 <ol><li>Number on level 4</li></ol></li></ul></li>
9773 <li>bullet level 2
9774 <ol><li>Number on level 3</li>
9775 <li>Number on level 3</li></ol></li></ul>
9776 <ol><li>number level 2</li></ol></li>
9777 <li>Level 1
9778 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9779 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9780 !! end
9781
9782 !! test
9783 1. Nested mixed wikitext and html list
9784 !! wikitext
9785 *hi
9786 *<ul><li>ho</li></ul>
9787 *hi
9788 **ho
9789 !! html/php
9790 <ul><li>hi</li>
9791 <li><ul><li>ho</li></ul></li>
9792 <li>hi
9793 <ul><li>ho</li></ul></li></ul>
9794 !! html/parsoid
9795 <ul><li>hi</li>
9796 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9797 <li>hi
9798 <ul><li>ho</li></ul></li></ul>
9799 !! end
9800
9801 !! test
9802 2. Nested mixed wikitext and html list (incompatible)
9803 !! wikitext
9804 ;hi
9805 :{{echo|<li>ho</li>}}
9806 !! html/php
9807 <dl><dt>hi</dt>
9808 <dd><li>ho</li></dd></dl>
9809 !! html/parsoid
9810 <dl><dt>hi</dt>
9811 <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>
9812 !! end
9813
9814 !! test
9815 Nested lists 1
9816 !! wikitext
9817 *foo
9818 **bar
9819 !! html
9820 <ul><li>foo
9821 <ul><li>bar</li></ul></li></ul>
9822 !! end
9823
9824 !! test
9825 Nested lists 2
9826 !! wikitext
9827 **foo
9828 *bar
9829 !! html
9830 <ul><li><ul><li>foo</li></ul></li>
9831 <li>bar</li></ul>
9832 !! end
9833
9834 !! test
9835 Nested lists 3 (first element empty)
9836 !! wikitext
9837 *
9838 **bar
9839 !! html
9840 <ul><li>
9841 <ul><li>bar</li></ul></li></ul>
9842 !! end
9843
9844 !! test
9845 Nested lists 4 (first element empty)
9846 !! wikitext
9847 **
9848 *bar
9849 !! html
9850 <ul><li><ul><li></li></ul></li>
9851 <li>bar</li></ul>
9852 !! end
9853
9854 !! test
9855 Nested lists 5 (both elements empty)
9856 !! wikitext
9857 **
9858 *
9859 !! html
9860 <ul><li><ul><li></li></ul></li>
9861 <li></li></ul>
9862 !! end
9863
9864 !! test
9865 Nested lists 6 (both elements empty)
9866 !! wikitext
9867 *
9868 **
9869 !! html
9870 <ul><li>
9871 <ul><li></li></ul></li></ul>
9872 !! end
9873
9874 !! test
9875 Nested lists 7 (skip initial nesting levels)
9876 !! wikitext
9877 ***foo
9878 !! html
9879 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9880 !! end
9881
9882 !! test
9883 Nested lists 8 (multiple nesting transitions)
9884 !! wikitext
9885 *foo
9886 ***bar
9887 **baz
9888 *boo
9889 !! html
9890 <ul><li>foo
9891 <ul><li><ul><li>bar</li></ul></li>
9892 <li>baz</li></ul></li>
9893 <li>boo</li></ul>
9894 !! end
9895
9896 # XXX this test should be moved to citeParserTests, since it depends
9897 # on the Cite extension, which is "built in" to Parsoid.
9898 !! test
9899 Nested lists 9 (extension interaction)
9900 !! wikitext
9901 *<references />
9902 !! html/php+tidy-DISABLED
9903 <ul><li class="mw-empty-elt"></li></ul>
9904 !! html/parsoid
9905 <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>
9906 !! end
9907
9908 !! test
9909 1. Lists with start-of-line-transparent tokens before bullets: Comments
9910 !! wikitext
9911 *foo
9912 *<!--cmt-->bar
9913 <!--cmt-->*baz
9914 !! html
9915 <ul><li>foo</li>
9916 <li>bar</li>
9917 <li>baz</li></ul>
9918 !! end
9919
9920 !! test
9921 Nested lists 10 (list and span siblings: wt2wt regression)
9922 !! wikitext
9923 *a <span>x</span>
9924 **b <span>y</span>
9925 !! html/parsoid
9926 <ul><li>a <span>x</span>
9927 <ul><li>b <span>y</span></li></ul></li></ul>
9928 !! end
9929
9930 !! test
9931 2. Lists with start-of-line-transparent tokens before bullets: Template close
9932 !! wikitext
9933 *foo {{echo|bar
9934 }}*baz
9935 !! html
9936 <ul><li>foo bar</li>
9937 <li>baz</li></ul>
9938 !! end
9939
9940 !! test
9941 List items are not parsed correctly following a <pre> block (T2785)
9942 !! wikitext
9943 *<pre>foo</pre>
9944 *<pre>bar</pre>
9945 *zar
9946 !! html/php
9947 <ul><li><pre>foo</pre></li>
9948 <li><pre>bar</pre></li>
9949 <li>zar</li></ul>
9950 !! html/parsoid
9951 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9952 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9953 <li>zar</li></ul>
9954 !! end
9955
9956 # FIXME: Might benefit from a html/parsoid since this has a template
9957 !! test
9958 List items from template
9959 !! wikitext
9960
9961 {{inner list}}
9962 *item 2
9963
9964 *item 0
9965 {{inner list}}
9966 *item 2
9967
9968 *item 0
9969 *notSOL{{inner list}}
9970 *item 2
9971 !! html
9972 <ul><li>item 1</li>
9973 <li>item 2</li></ul>
9974 <ul><li>item 0</li>
9975 <li>item 1</li>
9976 <li>item 2</li></ul>
9977 <ul><li>item 0</li>
9978 <li>notSOL</li>
9979 <li>item 1</li>
9980 <li>item 2</li></ul>
9981 !! end
9982
9983 !! test
9984 List interrupted by empty line or heading
9985 !! wikitext
9986 *foo
9987
9988 **bar
9989 ==A heading==
9990 *Another list item
9991 !! html
9992 <ul><li>foo</li></ul>
9993 <ul><li><ul><li>bar</li></ul></li></ul>
9994 <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>
9995 <ul><li>Another list item</li></ul>
9996 !!end
9997
9998 !! test
9999 Multiple list tags generated by templates
10000 !! wikitext
10001 {{echo|<li>}}a
10002 {{echo|<li>}}b
10003 {{echo|<li>}}c
10004 !! html
10005 <li>a
10006 <li>b
10007 <li>c</li>
10008 </li>
10009 </li>
10010
10011 !! html+tidy
10012 <li>a
10013 </li><li>b
10014 </li><li>c</li>
10015 !! html/parsoid
10016 <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>
10017 <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>
10018 <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>
10019 !! end
10020
10021 !! test
10022 Multiple newlines in between HTML list items don't induce paragraph wrapping
10023 !! wikitext
10024 <ul>
10025 <li>hi</li>
10026
10027
10028
10029
10030 <li>ho</li>
10031 </ul>
10032
10033 <dl>
10034 <dt>hi</dt>
10035 <dd>ho<div>123</div>
10036 </dd>
10037
10038
10039 </dl>
10040 !! html/php+tidy
10041 <ul>
10042 <li>hi</li>
10043
10044
10045
10046
10047 <li>ho</li>
10048 </ul>
10049 <dl>
10050 <dt>hi</dt>
10051 <dd>ho<div>123</div>
10052 </dd>
10053
10054
10055 </dl>
10056 !! end
10057
10058 !!test
10059 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
10060 !! wikitext
10061 *a
10062 <!--This line will NOT split the list-->
10063 *b
10064 <!--This line will NOT split the list either-->
10065 *c
10066 <!--foo--> <!----> <!--This line NOT split the list either-->
10067 *d
10068 !! html
10069 <ul><li>a</li>
10070 <li>b</li>
10071 <li>c</li>
10072 <li>d</li></ul>
10073 !!end
10074
10075 !!test
10076 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
10077 !! wikitext
10078 *a
10079 <!--This line will NOT split the list-->
10080 *b
10081 <!--This line will NOT split the list either-->
10082 *c
10083 <!--foo--> <!----> <!--This line NOT split the list
10084 either-->
10085 *d
10086 !! html
10087 <ul><li>a</li>
10088 <li>b</li>
10089 <li>c</li>
10090 <li>d</li></ul>
10091 !!end
10092
10093 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
10094 # That pass could possibly be removed.
10095 !!test
10096 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
10097 !!options
10098 parsoid=wt2html,wt2wt
10099 !! wikitext
10100 *foo
10101 *<li>li-hack
10102 *{{echo|<li>templated li-hack}}
10103 *<!--foo--><li> unsupported li-hack with preceding comments
10104
10105 <ul>
10106 <li><li>not a li-hack
10107 </li>
10108 </ul>
10109 !! html+tidy
10110 <ul><li>foo</li>
10111 <li class="mw-empty-elt"></li><li>li-hack</li>
10112 <li class="mw-empty-elt"></li><li>templated li-hack</li>
10113 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
10114 <ul>
10115 <li class="mw-empty-elt"></li><li>not a li-hack
10116 </li>
10117 </ul>
10118 !! html/parsoid
10119 <ul><li> foo</li>
10120 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
10121 <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>
10122 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
10123
10124 <ul data-parsoid='{"stx":"html"}'>
10125 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
10126 </li>
10127 </ul>
10128 !! end
10129
10130 !! test
10131 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
10132 !! wikitext
10133 #foo
10134 ##bar
10135
10136 *foo
10137 **bar
10138
10139 :foo
10140 ::bar
10141 !! html/php+tidy
10142 <ol><li>foo
10143 <ol><li>bar</li></ol></li></ol>
10144 <ul><li>foo
10145 <ul><li>bar</li></ul></li></ul>
10146 <dl><dd>foo
10147 <dl><dd>bar</dd></dl></dd></dl>
10148 !! html/parsoid
10149 <ol>
10150 <li>foo<ol>
10151 <li>bar</li>
10152 </ol></li>
10153 </ol><ul>
10154 <li>foo<ul>
10155 <li>bar</li>
10156 </ul></li>
10157 </ul><dl>
10158 <dd>foo<dl>
10159 <dd>bar</dd>
10160 </dl></dd>
10161 </dl>
10162 !! end
10163
10164 !! test
10165 Parsoid: Test of whitespace serialization with Templated bullets
10166 !! options
10167 parsoid=wt2html
10168 !! wikitext
10169 * {{bullet}}
10170 !! html/parsoid
10171 <ul>
10172 <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>
10173 </ul>
10174 !! end
10175
10176 # ------------------------------------------------------------------------
10177 # The next set of tests are about Parsoid's ability to handle badly nested
10178 # tags (parse, minimize scope of fixup, and roundtrip back)
10179 # ------------------------------------------------------------------------
10180
10181 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
10182 # Parsoid's list handling is more aware of block structure.
10183 !! test
10184 Unbalanced closing block tags break a list
10185 !! wikitext
10186 <div>
10187 *a</div><div>
10188 *b</div>
10189 !! html+tidy
10190 <div>
10191 <ul><li>a</li></ul></div><div>
10192 <li>b</li></div>
10193 !! html/parsoid
10194 <div><ul>
10195 <li>a</li>
10196 </ul></div>
10197 <div><ul>
10198 <li>b</li>
10199 </ul></div>
10200 !! end
10201
10202 !! test
10203 Unbalanced closing non-block tags don't break a list
10204 !! options
10205 parsoid=wt2html,html2html
10206 !! wikitext
10207 <span>
10208 *a</span><span>
10209 *b</span>
10210 !! html/php+tidy
10211 <p><span>
10212 </span></p>
10213 <ul><li>a<span></span></li>
10214 <li>b</li></ul>
10215 !! html/parsoid
10216 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></p>
10217 <ul><li>a<span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></li>
10218 <li>b</li></ul>
10219 !! end
10220
10221 # Parsoid does some post-dom-building cleanup
10222 # which is why its output differs from Remex.
10223 !! test
10224 Unclosed formatting tags that straddle lists are closed and reopened
10225 !! options
10226 parsoid=wt2html,wt2wt,html2html
10227 !! wikitext
10228 #<s> a
10229 #b </s>
10230 !! html/php+tidy
10231 <ol><li><s> a</s></li><s>
10232 </s><li><s>b </s></li></ol>
10233 !! html/parsoid
10234 <ol><li><s> a</s></li>
10235 <li><s>b </s></li></ol>
10236 !! end
10237
10238 # Output is ugly because of all the misnested tag fixups.
10239 !! test
10240 1. List embedded in a formatting tag
10241 !! wikitext
10242 <small>
10243 *foo
10244 </small>
10245 !! html/php+tidy
10246 <p><small>
10247 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10248 </p>
10249 !! html/parsoid
10250 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
10251 <ul><li data-parsoid='{}'>foo</li></ul></small>
10252 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p>
10253 !! end
10254
10255 # Output is ugly because of all the misnested tag fixups.
10256 !! test
10257 2. List embedded in a formatting tag in a misnested way
10258 !! wikitext
10259 <small>
10260 *a
10261 *b</small>
10262 !! html/php+tidy
10263 <p><small>
10264 </small></p><small></small><ul><small><li>a</li>
10265 </small><li><small>b</small></li></ul>
10266 !! html/parsoid
10267 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10268 <ul><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'><li>a</li></small>
10269 <li><small data-parsoid='{"stx":"html","autoInsertedStart":true}'>b</small></li></ul>
10270 !! end
10271
10272 # Output is ugly because of all the misnested tag fixups.
10273 !! test
10274 3. List embedded in a formatting tag in a misnested way
10275 !! wikitext
10276 <small>
10277
10278 ** 123</small>
10279 !! html/php+tidy
10280 <p><small>
10281 </small></p><small></small><ul><small></small><li><small></small><ul><small></small><li><small>123</small></li></ul></li></ul>
10282 !! html/parsoid
10283 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10284
10285 <ul><li><ul><li data-parsoid='{}'><small data-parsoid='{"stx":"html","autoInsertedStart":true}'> 123</small></li></ul></li></ul>
10286 !! end
10287
10288 ###
10289 ### Magic Words
10290 ###
10291
10292 # Note that the current date is hard-coded as
10293 # 1970-01-01T00:02:03Z (a Thursday)
10294 # when running parser tests. The timezone is also fixed to GMT, so
10295 # local date will be identical to current date.
10296
10297 !! test
10298 Magic Word: {{CURRENTDAY}}
10299 !! wikitext
10300 {{CURRENTDAY}}
10301 !! html
10302 <p>1
10303 </p>
10304 !! end
10305
10306 !! test
10307 Magic Word: {{CURRENTDAY2}}
10308 !! wikitext
10309 {{CURRENTDAY2}}
10310 !! html
10311 <p>01
10312 </p>
10313 !! end
10314
10315 !! test
10316 Magic Word: {{CURRENTDAYNAME}}
10317 !! wikitext
10318 {{CURRENTDAYNAME}}
10319 !! html
10320 <p>Thursday
10321 </p>
10322 !! end
10323
10324 !! test
10325 Magic Word: {{CURRENTDOW}}
10326 !! wikitext
10327 {{CURRENTDOW}}
10328 !! html
10329 <p>4
10330 </p>
10331 !! end
10332
10333 !! test
10334 Magic Word: {{CURRENTMONTH}}
10335 !! wikitext
10336 {{CURRENTMONTH}}
10337 !! html
10338 <p>01
10339 </p>
10340 !! end
10341
10342 !! test
10343 Magic Word: {{CURRENTMONTH1}}
10344 !! wikitext
10345 {{CURRENTMONTH1}}
10346 !! html
10347 <p>1
10348 </p>
10349 !! end
10350
10351 !! test
10352 Magic Word: {{CURRENTMONTHABBREV}}
10353 !! wikitext
10354 {{CURRENTMONTHABBREV}}
10355 !! html
10356 <p>Jan
10357 </p>
10358 !! end
10359
10360 !! test
10361 Magic Word: {{CURRENTMONTHNAME}}
10362 !! wikitext
10363 {{CURRENTMONTHNAME}}
10364 !! html
10365 <p>January
10366 </p>
10367 !! end
10368
10369 !! test
10370 Magic Word: {{CURRENTMONTHNAMEGEN}}
10371 !! wikitext
10372 {{CURRENTMONTHNAMEGEN}}
10373 !! html
10374 <p>January
10375 </p>
10376 !! end
10377
10378 !! test
10379 Magic Word: {{CURRENTTIME}}
10380 !! wikitext
10381 {{CURRENTTIME}}
10382 !! html
10383 <p>00:02
10384 </p>
10385 !! end
10386
10387 !! test
10388 Magic Word: {{CURRENTHOUR}}
10389 !! wikitext
10390 {{CURRENTHOUR}}
10391 !! html
10392 <p>00
10393 </p>
10394 !! end
10395
10396 !! test
10397 Magic Word: {{CURRENTWEEK}} (T6594)
10398 !! wikitext
10399 {{CURRENTWEEK}}
10400 !! html
10401 <p>1
10402 </p>
10403 !! end
10404
10405 !! test
10406 Magic Word: {{CURRENTYEAR}}
10407 !! wikitext
10408 {{CURRENTYEAR}}
10409 !! html
10410 <p>1970
10411 </p>
10412 !! end
10413
10414 !! test
10415 Magic Word: {{CURRENTTIMESTAMP}}
10416 !! wikitext
10417 {{CURRENTTIMESTAMP}}
10418 !! html
10419 <p>19700101000203
10420 </p>
10421 !! end
10422
10423 !! test
10424 Magic Words LOCAL (UTC)
10425 !! wikitext
10426 *{{LOCALMONTH}}
10427 *{{LOCALMONTH1}}
10428 *{{LOCALMONTHNAME}}
10429 *{{LOCALMONTHNAMEGEN}}
10430 *{{LOCALMONTHABBREV}}
10431 *{{LOCALDAY}}
10432 *{{LOCALDAY2}}
10433 *{{LOCALDAYNAME}}
10434 *{{LOCALYEAR}}
10435 *{{LOCALTIME}}
10436 *{{LOCALHOUR}}
10437 *{{LOCALWEEK}}
10438 *{{LOCALDOW}}
10439 *{{LOCALTIMESTAMP}}
10440 !! html
10441 <ul><li>01</li>
10442 <li>1</li>
10443 <li>January</li>
10444 <li>January</li>
10445 <li>Jan</li>
10446 <li>1</li>
10447 <li>01</li>
10448 <li>Thursday</li>
10449 <li>1970</li>
10450 <li>00:02</li>
10451 <li>00</li>
10452 <li>1</li>
10453 <li>4</li>
10454 <li>19700101000203</li></ul>
10455 !! end
10456
10457 !! test
10458 Magic Word: {{FULLPAGENAME}}
10459 !! options
10460 title=[[User:Ævar Arnfjörð Bjarmason]]
10461 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10462 !! wikitext
10463 {{FULLPAGENAME}}
10464 !! html/*
10465 <p>User:Ævar Arnfjörð Bjarmason
10466 </p>
10467 !! end
10468
10469 !! test
10470 Magic Word: {{FULLPAGENAMEE}}
10471 !! options
10472 title=[[User:Ævar Arnfjörð Bjarmason]]
10473 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10474 !! wikitext
10475 {{FULLPAGENAMEE}}
10476 !! html/*
10477 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10478 </p>
10479 !! end
10480
10481 !! test
10482 Magic Word: {{TALKSPACE}}
10483 !! options
10484 title=[[User:Ævar Arnfjörð Bjarmason]]
10485 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10486 !! wikitext
10487 {{TALKSPACE}}
10488 !! html/*
10489 <p>User talk
10490 </p>
10491 !! end
10492
10493 !! test
10494 Magic Word: {{TALKSPACE}}, same namespace
10495 !! options
10496 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10497 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10498 !! wikitext
10499 {{TALKSPACE}}
10500 !! html/*
10501 <p>User talk
10502 </p>
10503 !! end
10504
10505 !! test
10506 Magic Word: {{TALKSPACE}}, main namespace
10507 !! options
10508 title=[[Parser Test]]
10509 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10510 !! wikitext
10511 {{TALKSPACE}}
10512 !! html/*
10513 <p>Talk
10514 </p>
10515 !! end
10516
10517 !! test
10518 Magic Word: {{TALKSPACEE}}
10519 !! options
10520 title=[[User:Ævar Arnfjörð Bjarmason]]
10521 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10522 !! wikitext
10523 {{TALKSPACEE}}
10524 !! html/*
10525 <p>User_talk
10526 </p>
10527 !! end
10528
10529 !! test
10530 Magic Word: {{SUBJECTSPACE}}
10531 !! options
10532 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10533 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10534 !! wikitext
10535 {{SUBJECTSPACE}}
10536 !! html/*
10537 <p>User
10538 </p>
10539 !! end
10540
10541 !! test
10542 Magic Word: {{SUBJECTSPACE}}, same namespace
10543 !! options
10544 title=[[User:Ævar Arnfjörð Bjarmason]]
10545 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10546 !! wikitext
10547 {{SUBJECTSPACE}}
10548 !! html/*
10549 <p>User
10550 </p>
10551 !! end
10552
10553 !! test
10554 Magic Word: {{SUBJECTSPACE}}, main namespace
10555 !! options
10556 title=[[Parser Test]]
10557 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10558 !! wikitext
10559 {{SUBJECTSPACE}}
10560 !! html/*
10561 !! end
10562
10563 !! test
10564 Magic Word: {{SUBJECTSPACEE}}
10565 !! options
10566 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10567 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10568 !! wikitext
10569 {{SUBJECTSPACEE}}
10570 !! html/*
10571 <p>User
10572 </p>
10573 !! end
10574
10575 !! test
10576 Magic Word: {{NAMESPACE}}
10577 !! options
10578 title=[[User:Ævar Arnfjörð Bjarmason]]
10579 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10580 !! wikitext
10581 {{NAMESPACE}}
10582 !! html/*
10583 <p>User
10584 </p>
10585 !! end
10586
10587 !! test
10588 Magic Word: {{NAMESPACEE}}
10589 !! options
10590 title=[[User:Ævar Arnfjörð Bjarmason]]
10591 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10592 !! wikitext
10593 {{NAMESPACEE}}
10594 !! html/*
10595 <p>User
10596 </p>
10597 !! end
10598
10599 !! test
10600 Magic Word: {{NAMESPACENUMBER}}
10601 !! options
10602 title=[[User:Ævar Arnfjörð Bjarmason]]
10603 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10604 !! wikitext
10605 {{NAMESPACENUMBER}}
10606 !! html/*
10607 <p>2
10608 </p>
10609 !! end
10610
10611 !! test
10612 Magic Word: {{SUBPAGENAME}}
10613 !! options
10614 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10615 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10616 !! wikitext
10617 {{SUBPAGENAME}}
10618 !! html/*
10619 <p>sub ö
10620 </p>
10621 !! end
10622
10623 !! test
10624 Magic Word: {{SUBPAGENAMEE}}
10625 !! options
10626 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10627 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10628 !! wikitext
10629 {{SUBPAGENAMEE}}
10630 !! html/*
10631 <p>sub_%C3%B6
10632 </p>
10633 !! end
10634
10635 !! test
10636 Magic Word: {{ROOTPAGENAME}}
10637 !! options
10638 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10639 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10640 !! wikitext
10641 {{ROOTPAGENAME}}
10642 !! html/*
10643 <p>Ævar Arnfjörð Bjarmason
10644 </p>
10645 !! end
10646
10647 !! test
10648 Magic Word: {{ROOTPAGENAMEE}}
10649 !! options
10650 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10651 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10652 !! wikitext
10653 {{ROOTPAGENAMEE}}
10654 !! html/*
10655 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10656 </p>
10657 !! end
10658
10659 !! test
10660 Magic Word: {{BASEPAGENAME}}
10661 !! options
10662 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10663 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10664 !! wikitext
10665 {{BASEPAGENAME}}
10666 !! html/*
10667 <p>Ævar Arnfjörð Bjarmason
10668 </p>
10669 !! end
10670
10671 !! test
10672 Magic Word: {{BASEPAGENAMEE}}
10673 !! options
10674 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10675 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10676 !! wikitext
10677 {{BASEPAGENAMEE}}
10678 !! html/*
10679 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10680 </p>
10681 !! end
10682
10683 !! test
10684 Magic Word: {{TALKPAGENAME}}
10685 !! options
10686 title=[[User:Ævar Arnfjörð Bjarmason]]
10687 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10688 !! wikitext
10689 {{TALKPAGENAME}}
10690 !! html/*
10691 <p>User talk:Ævar Arnfjörð Bjarmason
10692 </p>
10693 !! end
10694
10695 !! test
10696 Magic Word: {{TALKPAGENAMEE}}
10697 !! options
10698 title=[[User:Ævar Arnfjörð Bjarmason]]
10699 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10700 !! wikitext
10701 {{TALKPAGENAMEE}}
10702 !! html/*
10703 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10704 </p>
10705 !! end
10706
10707 !! test
10708 Magic Word: {{SUBJECTPAGENAME}}
10709 !! options
10710 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10711 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10712 !! wikitext
10713 {{SUBJECTPAGENAME}}
10714 !! html/*
10715 <p>User:Ævar Arnfjörð Bjarmason
10716 </p>
10717 !! end
10718
10719 !! test
10720 Magic Word: {{SUBJECTPAGENAMEE}}
10721 !! options
10722 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10723 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10724 !! wikitext
10725 {{SUBJECTPAGENAMEE}}
10726 !! html/*
10727 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10728 </p>
10729 !! end
10730
10731 !! test
10732 Magic Word: {{NUMBEROFFILES}}
10733 !! options
10734 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10735 !! wikitext
10736 {{NUMBEROFFILES}}
10737 !! html/*
10738 <p>7
10739 </p>
10740 !! end
10741
10742 !! test
10743 Magic Word: {{PAGENAME}}
10744 !! options
10745 title=[[User:Ævar Arnfjörð Bjarmason]]
10746 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10747 !! wikitext
10748 {{PAGENAME}}
10749 !! html/*
10750 <p>Ævar Arnfjörð Bjarmason
10751 </p>
10752 !! end
10753
10754 !! test
10755 Magic Word: {{PAGENAME}} with metacharacters
10756 !! options
10757 title=[['foo & bar = baz']]
10758 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10759 !! wikitext
10760 ''{{PAGENAME}}''
10761 !! html+tidy
10762 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10763 </p>
10764 !! end
10765
10766 !! test
10767 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10768 !! options
10769 title=[[*RFC 1234 http://example.com/]]
10770 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10771 !! wikitext
10772 {{PAGENAME}}
10773 !! html+tidy
10774 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10775 </p>
10776 !! end
10777
10778 !! test
10779 Magic Word: {{PAGENAMEE}}
10780 !! options
10781 title=[[User:Ævar Arnfjörð Bjarmason]]
10782 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10783 !! wikitext
10784 {{PAGENAMEE}}
10785 !! html/*
10786 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10787 </p>
10788 !! end
10789
10790 !! test
10791 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10792 !! options
10793 title=[[*RFC 1234 http://example.com/]]
10794 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10795 !! wikitext
10796 {{PAGENAMEE}}
10797 !! html+tidy
10798 <p>&#42;RFC_1234_http&#58;//example.com/
10799 </p>
10800 !! end
10801
10802 !! test
10803 Magic Word: {{REVISIONID}}
10804 !! options
10805 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10806 showflags
10807 !! wikitext
10808 {{REVISIONID}}
10809 !! html/*
10810 <p>1337
10811 </p>
10812 flags=vary-revision-id
10813 !! end
10814
10815 !! test
10816 Magic Word: {{SCRIPTPATH}}
10817 !! options
10818 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10819 !! wikitext
10820 {{SCRIPTPATH}}
10821 !! html/*
10822 !! end
10823
10824 !! test
10825 Magic Word: {{STYLEPATH}}
10826 !! options
10827 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10828 !! wikitext
10829 {{STYLEPATH}}
10830 !! html/*
10831 <p>/skins
10832 </p>
10833 !! end
10834
10835 !! test
10836 Magic Word: {{SERVER}}
10837 !! options
10838 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10839 !! wikitext
10840 {{SERVER}}
10841 !! html/*
10842 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10843 </p>
10844 !! end
10845
10846 !! test
10847 Magic Word: {{SERVERNAME}}
10848 !! options
10849 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10850 !! wikitext
10851 {{SERVERNAME}}
10852 !! html/*
10853 <p>example.org
10854 </p>
10855 !! end
10856
10857 !! test
10858 Magic Word: {{SITENAME}}
10859 !! options
10860 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10861 !! wikitext
10862 {{SITENAME}}
10863 !! html/*
10864 <p>MediaWiki
10865 </p>
10866 !! end
10867
10868 !! test
10869 Magic Word: {{PAGELANGUAGE}}
10870 !! options
10871 language=fr
10872 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10873 !! wikitext
10874 {{PAGELANGUAGE}}
10875 !! html/*
10876 <p>fr
10877 </p>
10878 !! end
10879
10880 !! test
10881 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10882 !! options
10883 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10884 !! wikitext
10885 {{PAGELANGUAGE}}
10886 !! html/*
10887 <p>en
10888 </p>
10889 !! end
10890
10891 !! test
10892 Case-sensitive magic words, when cased differently, should just be template transclusions
10893 !! wikitext
10894 {{CurrentMonth}}
10895 {{currentday}}
10896 {{cURreNTweEK}}
10897 {{currentHour}}
10898 !! html
10899 <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>
10900 <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>
10901 <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>
10902 <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>
10903 </p>
10904 !! end
10905
10906 !! test
10907 Case-insensitive magic words should still work with weird casing.
10908 !! wikitext
10909 {{sErVeRNaMe}}
10910 {{LCFirst:AOEU}}
10911 {{ucFIRST:aoeu}}
10912 {{SERver}}
10913 !! html
10914 <p>example.org
10915 aOEU
10916 Aoeu
10917 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10918 </p>
10919 !! end
10920
10921 # From plwiki:PLOS_ONE
10922 !! test
10923 Parsoid: Page property magic word with magic word contents
10924 !! options
10925 showtitle
10926 !! config
10927 wgAllowDisplayTitle=true
10928 wgRestrictDisplayTitle=false
10929 !! wikitext
10930 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10931 !! html/php+tidy
10932 <i>Parser test</i>
10933
10934 !! html/parsoid
10935 <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>"}]]}'/>
10936 !! end
10937
10938 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10939 # But, this is a limitation of our representation and is documented in
10940 # TemplateHandler.js in processSpecialMagicWord
10941 !! test
10942 Parsoid: Template-generated DISPLAYTITLE
10943 !! wikitext
10944 {{{{echo|DISPLAYTITLE}}:Foo}}
10945 !! options
10946 showtitle
10947 !! config
10948 wgAllowDisplayTitle=true
10949 wgRestrictDisplayTitle=false
10950 !! html/php
10951 Foo
10952
10953 !! html/parsoid
10954 <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"}]]}'/>
10955 !! end
10956
10957 !! test
10958 Namespace 1 {{ns:1}}
10959 !! wikitext
10960 {{ns:1}}
10961 !! html
10962 <p>Talk
10963 </p>
10964 !! end
10965
10966 !! test
10967 Namespace 1 {{ns:01}}
10968 !! wikitext
10969 {{ns:01}}
10970 !! html
10971 <p>Talk
10972 </p>
10973 !! end
10974
10975 !! test
10976 Namespace 0 {{ns:0}} (T6783)
10977 !! wikitext
10978 {{ns:0}}
10979 !! html
10980 !! end
10981
10982 !! test
10983 Namespace 0 {{ns:00}} (T6783)
10984 !! wikitext
10985 {{ns:00}}
10986 !! html
10987 !! end
10988
10989 !! test
10990 Namespace -1 {{ns:-1}}
10991 !! wikitext
10992 {{ns:-1}}
10993 !! html
10994 <p>Special
10995 </p>
10996 !! end
10997
10998 !! test
10999 Namespace User {{ns:User}}
11000 !! wikitext
11001 {{ns:User}}
11002 !! html
11003 <p>User
11004 </p>
11005 !! end
11006
11007 !! test
11008 Namespace User talk {{ns:User_talk}}
11009 !! wikitext
11010 {{ns:User_talk}}
11011 !! html
11012 <p>User talk
11013 </p>
11014 !! end
11015
11016 !! test
11017 Namespace User talk {{ns:uSeR tAlK}}
11018 !! wikitext
11019 {{ns:uSeR tAlK}}
11020 !! html
11021 <p>User talk
11022 </p>
11023 !! end
11024
11025 !! test
11026 Namespace File {{ns:File}}
11027 !! wikitext
11028 {{ns:File}}
11029 !! html
11030 <p>File
11031 </p>
11032 !! end
11033
11034 !! test
11035 Namespace File {{ns:Image}}
11036 !! wikitext
11037 {{ns:Image}}
11038 !! html
11039 <p>File
11040 </p>
11041 !! end
11042
11043 !! test
11044 Namespace (lang=de) Benutzer {{ns:User}}
11045 !! options
11046 language=de
11047 !! wikitext
11048 {{ns:User}}
11049 !! html
11050 <p>Benutzer
11051 </p>
11052 !! end
11053
11054 !! test
11055 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
11056 !! options
11057 language=de
11058 !! wikitext
11059 {{ns:3}}
11060 !! html
11061 <p>Benutzer Diskussion
11062 </p>
11063 !! end
11064
11065 !! test
11066 Urlencode
11067 !! wikitext
11068 {{urlencode:hi world?!}}
11069 {{urlencode:hi world?!|WIKI}}
11070 {{urlencode:hi world?!|PATH}}
11071 {{urlencode:hi world?!|QUERY}}
11072 !! html/php
11073 <p>hi+world%3F%21
11074 hi_world%3F!
11075 hi%20world%3F%21
11076 hi+world%3F%21
11077 </p>
11078 !! end
11079
11080 !! test
11081 Magic Word: prioritize type info over data-parsoid
11082 !! options
11083 parsoid=html2wt
11084 !! html/parsoid
11085 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
11086 !! wikitext
11087 __FORCETOC__
11088 !! end
11089
11090 !! test
11091 Magic Word: serialize on separate line (parsoid)
11092 !! options
11093 parsoid=wt2wt,html2wt
11094 !! wikitext
11095 foo
11096 __NOTOC__
11097 bar
11098 !! html/parsoid
11099 foo<meta property="mw:PageProp/notoc"/>bar
11100 !! end
11101
11102 !! test
11103 Magic Word: rt non-english wikis
11104 !! options
11105 parsoid=wt2wt
11106 language=de
11107 !! wikitext
11108 __NOEDITSECTION__
11109 !! html/parsoid
11110 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
11111 !! end
11112
11113 !!test
11114 __proto__ is treated as normal wikitext (T105997)
11115 !!wikitext
11116 __proto__
11117 !!html
11118 <p>__proto__
11119 </p>
11120 !!end
11121
11122 ###
11123 ### Magic links
11124 ###
11125 !! test
11126 Magic links: internal link to RFC (T2479)
11127 !! wikitext
11128 [[RFC 123]]
11129 !! html/php
11130 <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>
11131 </p>
11132 !! html/parsoid
11133 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
11134 !! end
11135
11136 !! test
11137 Magic links: RFC (T2479)
11138 !! wikitext
11139 RFC 822
11140 !! html/php
11141 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11142 </p>
11143 !! html/parsoid
11144 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
11145 !! end
11146
11147 !! test
11148 Magic links: RFC (T67278)
11149 !! wikitext
11150 This is RFC 822 but thisRFC 822 is not RFC 822linked.
11151 !! html/php
11152 <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.
11153 </p>
11154 !! html/parsoid
11155 <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>
11156 !! end
11157
11158 !! test
11159 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
11160 !! wikitext
11161 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
11162 RFC
11163 822
11164 !! html/php
11165 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11166 RFC
11167 822
11168 </p>
11169 !! html/parsoid
11170 <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>
11171 RFC
11172 822</p>
11173 !! end
11174
11175 !! test
11176 Magic links: ISBN (T3937)
11177 !! wikitext
11178 ISBN 0-306-40615-2
11179 !! html/php
11180 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
11181 </p>
11182 !! html/parsoid
11183 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
11184 !! end
11185
11186 !! test
11187 Magic links: ISBN (T67278)
11188 !! wikitext
11189 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11190 !! html/php
11191 <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.
11192 </p>
11193 !! html/parsoid
11194 <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>
11195 !! end
11196
11197 !! test
11198 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
11199 !! wikitext
11200 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
11201 ISBN
11202 9780316098113
11203 ISBN 978
11204 0316098113
11205 !! html/php
11206 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11207 ISBN
11208 9780316098113
11209 ISBN 978
11210 0316098113
11211 </p>
11212 !! html/parsoid
11213 <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>
11214 ISBN
11215 9780316098113
11216 ISBN 978
11217 0316098113</p>
11218 !! end
11219
11220 !! test
11221 Magic links: PMID incorrectly converts space to underscore
11222 !! wikitext
11223 PMID 1234
11224 !! html/php
11225 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11226 </p>
11227 !! html/parsoid
11228 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
11229 !! end
11230
11231 !! test
11232 Magic links: PMID (T67278)
11233 !! wikitext
11234 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11235 !! html/php
11236 <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.
11237 </p>
11238 !! html/parsoid
11239 <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>
11240 !! end
11241
11242 !! test
11243 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11244 !! wikitext
11245 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11246 PMID
11247 1234
11248 !! html/php
11249 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11250 PMID
11251 1234
11252 </p>
11253 !! html/parsoid
11254 <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>
11255 PMID
11256 1234</p>
11257 !! end
11258
11259 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11260 # since these are ExtLinkText, not MagicLinkText
11261 !! test
11262 Magic links: use appropriate serialization for "almost" magic links.
11263 !! wikitext
11264 X[[Special:BookSources/0978739256|foo]]
11265
11266 X[https://tools.ietf.org/html/rfc1234 foo]
11267 !! html/php
11268 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11269 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11270 </p>
11271 !! html/parsoid
11272 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11273 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11274 !! end
11275
11276 !! test
11277 Magic links: All disabled (T47942)
11278 !! options
11279 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11280 !! wikitext
11281 ISBN 0-306-40615-2
11282 PMID 1234
11283 RFC 4321
11284 !! html/php
11285 <p>ISBN 0-306-40615-2
11286 PMID 1234
11287 RFC 4321
11288 </p>
11289 !! end
11290
11291 ###
11292 ### Templates
11293 ####
11294
11295 !! test
11296 Nonexistent template
11297 !! wikitext
11298 {{thistemplatedoesnotexist}}
11299 !! html
11300 <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>
11301 </p>
11302 !! end
11303
11304 !! test
11305 Template with invalid target containing tags
11306 !! wikitext
11307 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11308 !! html
11309 <p>{{a<b>b</b>|foo|a=b|a = b}}
11310 </p>
11311 !! end
11312
11313 !! test
11314 Template with invalid target containing unclosed tag
11315 !! wikitext
11316 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11317 !! html
11318 <p>{{a<b>|foo|a=b|a = b}}</b>
11319 </p>
11320 !! end
11321
11322 !! test
11323 Template with invalid target containing wikilink
11324 !! wikitext
11325 {{[[Main Page]]}}
11326 !! html/php
11327 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11328 </p>
11329 !! html/parsoid
11330 <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>
11331 !! end
11332
11333 !! test
11334 Template with just whitespace in it, T70421
11335 !! wikitext
11336 {{echo|{{ }}}}
11337 !! html/parsoid
11338 <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>
11339 !! end
11340
11341 !! article
11342 Template:test
11343 !! text
11344 This is a test template
11345 !! endarticle
11346
11347 !! test
11348 Simple template
11349 !! wikitext
11350 {{test}}
11351 !! html
11352 <p>This is a test template
11353 </p>
11354 !! end
11355
11356 !! test
11357 Template with explicit namespace
11358 !! wikitext
11359 {{Template:test}}
11360 !! html
11361 <p>This is a test template
11362 </p>
11363 !! end
11364
11365
11366 !! article
11367 Template:paramtest
11368 !! text
11369 This is a test template with parameter {{{param}}}
11370 !! endarticle
11371
11372 !! test
11373 Template parameter
11374 !! wikitext
11375 {{paramtest|param=foo}}
11376 !! html
11377 <p>This is a test template with parameter foo
11378 </p>
11379 !! end
11380
11381 !! article
11382 Template:paramtestnum
11383 !! text
11384 [[{{{1}}}|{{{2}}}]]
11385 !! endarticle
11386
11387 !! test
11388 Template unnamed parameter
11389 !! wikitext
11390 {{paramtestnum|Main Page|the main page}}
11391 !! html
11392 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11393 </p>
11394 !! end
11395
11396 !! article
11397 Template:templatesimple
11398 !! text
11399 (test)
11400 !! endarticle
11401
11402 !! article
11403 Template:templateredirect
11404 !! text
11405 #redirect [[Template:templatesimple]]
11406 !! endarticle
11407
11408 !! article
11409 Template:templateasargtestnum
11410 !! text
11411 {{{{{1}}}}}
11412 !! endarticle
11413
11414 !! article
11415 Template:templateasargtest
11416 !! text
11417 {{template{{{templ}}}}}
11418 !! endarticle
11419
11420 !! article
11421 Template:templateasargtest2
11422 !! text
11423 {{{{{templ}}}}}
11424 !! endarticle
11425
11426 !! test
11427 Template with template name as unnamed argument
11428 !! wikitext
11429 {{templateasargtestnum|templatesimple}}
11430 !! html
11431 <p>(test)
11432 </p>
11433 !! end
11434
11435 !! test
11436 Template with template name as argument
11437 !! wikitext
11438 {{templateasargtest|templ=simple}}
11439 !! html
11440 <p>(test)
11441 </p>
11442 !! end
11443
11444 !! test
11445 Template with template name as argument (2)
11446 !! wikitext
11447 {{templateasargtest2|templ=templatesimple}}
11448 !! html
11449 <p>(test)
11450 </p>
11451 !! end
11452
11453 !! article
11454 Template:templateasargtestdefault
11455 !! text
11456 {{{{{templ|templatesimple}}}}}
11457 !! endarticle
11458
11459 !! article
11460 Template:templa
11461 !! text
11462 '''templ'''
11463 !! endarticle
11464
11465 !! test
11466 Template with default value
11467 !! wikitext
11468 {{templateasargtestdefault}}
11469 !! html
11470 <p>(test)
11471 </p>
11472 !! end
11473
11474 !! test
11475 Template with default value (value set)
11476 !! wikitext
11477 {{templateasargtestdefault|templ=templa}}
11478 !! html
11479 <p><b>templ</b>
11480 </p>
11481 !! end
11482
11483 !! test
11484 Template redirect
11485 !! wikitext
11486 {{templateredirect}}
11487 !! html/php
11488 <p>(test)
11489 </p>
11490 !! html/parsoid
11491 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11492 !! end
11493
11494 !! test
11495 Template with argument in separate line
11496 !! wikitext
11497 {{ templateasargtest |
11498 templ = simple }}
11499 !! html
11500 <p>(test)
11501 </p>
11502 !! end
11503
11504 !! test
11505 Template with complex template as argument
11506 !! wikitext
11507 {{paramtest|
11508 param ={{ templateasargtest |
11509 templ = simple }}}}
11510 !! html
11511 <p>This is a test template with parameter (test)
11512 </p>
11513 !! end
11514
11515 !! test
11516 Templates with templated name
11517 !! wikitext
11518 {{{{echo|echo}}|foo}}
11519 {{{{echo|inner list}} }}
11520 !! html
11521 <p>foo
11522 </p>
11523 <ul><li>item 1</li></ul>
11524 !! html/parsoid
11525 <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>
11526 <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>
11527 !! end
11528
11529 ## Regression test; the output here isn't really that interesting.
11530 !! test
11531 Templates with templated name and top level template args
11532 !! wikitext
11533 {{1{{2{{{3}}}|4=5}}}}
11534 !! html/parsoid
11535 <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>
11536 !! end
11537
11538 # Parsoid markup is deliberate "broken". This is an edge case.
11539 # See long comment in TemplateHandler.js:convertAttribsToString.
11540 !! test
11541 Templates with invalid templated targets
11542 !! wikitext
11543 {{echo
11544 {{echo|foo}}
11545 }}
11546 !! html/php
11547 <p>{{echo
11548 foo
11549 }}
11550 </p>
11551 !! html/parsoid
11552 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11553 foo }}</p>
11554 !! end
11555
11556 !! test
11557 Template with thumb image (with link in description)
11558 !! wikitext
11559 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11560 !! html/php
11561 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>
11562 !! html+tidy
11563 <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>
11564 !! html/parsoid
11565 <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="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
11566 !! end
11567
11568 !! article
11569 Template:complextemplate
11570 !! text
11571 {{{1}}} {{paramtest|
11572 param ={{{param}}}}}
11573 !! endarticle
11574
11575 !! test
11576 Template with complex arguments
11577 !! wikitext
11578 {{complextemplate|
11579 param ={{ templateasargtest |
11580 templ = simple }}|[[Template:complextemplate|link]]}}
11581 !! html
11582 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11583 </p>
11584 !! end
11585
11586 !! test
11587 T2553: link with two variables in a piped link
11588 !! wikitext
11589 {|
11590 |[[{{{1}}}|{{{2}}}]]
11591 |}
11592 !! html/php
11593 <table>
11594 <tr>
11595 <td>[[{{{1}}}|{{{2}}}]]
11596 </td></tr></table>
11597 !! html/parsoid
11598 <table>
11599 <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>
11600 </tbody></table>
11601 !! end
11602
11603 # See: T2553
11604 !! test
11605 Abort table cell attribute parsing on wikilink
11606 !! wikitext
11607 {|
11608 |testing [[one|two]] |three||four
11609 |testing one two |three||four
11610 |testing="[[one|two]]" |three||four
11611 |}
11612 !! html/php
11613 <table>
11614 <tr>
11615 <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>
11616 <td>four
11617 </td>
11618 <td>three</td>
11619 <td>four
11620 </td>
11621 <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>
11622 <td>four
11623 </td></tr></table>
11624 !! html/parsoid
11625 <table>
11626 <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>
11627 <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>
11628 <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>
11629 </tbody></table>
11630 !! end
11631
11632 !! test
11633 Don't abort table cell attribute parsing if wikilink is found in template arg
11634 !! wikitext
11635 {|
11636 |Test {{#tag:ref|One two "[[three]]" four}}
11637 |}
11638 !! html/parsoid
11639 <table>
11640 <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>
11641 </tbody></table>
11642 !! end
11643
11644 !! test
11645 Magic variable as template parameter
11646 !! wikitext
11647 {{paramtest|param={{SITENAME}}}}
11648 !! html
11649 <p>This is a test template with parameter MediaWiki
11650 </p>
11651 !! end
11652
11653 !! article
11654 Template:linktest
11655 !! text
11656 [[{{{param}}}|link]]
11657 !! endarticle
11658
11659 !! test
11660 Template parameter as link source
11661 !! wikitext
11662 {{linktest|param=Main Page}}
11663 !! html
11664 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11665 </p>
11666 !! end
11667
11668 !!article
11669 Template:paramtest2
11670 !! text
11671 including another template, {{paramtest|param={{{arg}}}}}
11672 !! endarticle
11673
11674 !! test
11675 Template passing argument to another template
11676 !! wikitext
11677 {{paramtest2|arg='hmm'}}
11678 !! html
11679 <p>including another template, This is a test template with parameter 'hmm'
11680 </p>
11681 !! end
11682
11683 !! article
11684 Template:Linktest2
11685 !! text
11686 Main Page
11687 !! endarticle
11688
11689 !! test
11690 Template as link source
11691 !! wikitext
11692 [[{{linktest2}}]]
11693
11694 [[{{linktest2}}|Main Page]]
11695
11696 [[{{linktest2}}]]Page
11697 !! html
11698 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11699 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11700 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11701 </p>
11702 !! end
11703
11704
11705 !! article
11706 Template:loop1
11707 !! text
11708 {{loop2}}
11709 !! endarticle
11710
11711 !! article
11712 Template:loop2
11713 !! text
11714 {{loop1}}
11715 !! endarticle
11716
11717 !! test
11718 Template infinite loop
11719 !! wikitext
11720 {{loop1}}
11721 !! html
11722 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11723 </p>
11724 !! end
11725
11726 !! test
11727 Template from main namespace
11728 !! wikitext
11729 {{:Main Page}}
11730 !! html
11731 <p>blah blah
11732 </p>
11733 !! end
11734
11735 !! test
11736 Template from non-includable namespace
11737 !! options
11738 wgNonincludableNamespaces=10
11739 !! wikitext
11740 {{echo|uh oh!}}
11741 !! html
11742 <p><a href="/wiki/Template:Echo" title="Template:Echo">Template:Echo</a>
11743 </p>
11744 !! end
11745
11746 !! article
11747 Template:table
11748 !! text
11749 {|
11750 | 1 || 2
11751 |-
11752 | 3 || 4
11753 |}
11754 !! endarticle
11755
11756 !! test
11757 T2529: Template with table, not included at beginning of line
11758 !! wikitext
11759 foo {{table}}
11760 !! html
11761 <p>foo
11762 </p>
11763 <table>
11764 <tr>
11765 <td>1</td>
11766 <td>2
11767 </td></tr>
11768 <tr>
11769 <td>3</td>
11770 <td>4
11771 </td></tr></table>
11772 !! end
11773
11774 !! test
11775 T2523: Template shouldn't eat newline (or add an extra one before table)
11776 !! wikitext
11777 foo
11778 {{table}}
11779 !! html
11780 <p>foo
11781 </p>
11782 <table>
11783 <tr>
11784 <td>1</td>
11785 <td>2
11786 </td></tr>
11787 <tr>
11788 <td>3</td>
11789 <td>4
11790 </td></tr></table>
11791 !! end
11792
11793 !! test
11794 T2041: Template parameters shown as broken links
11795 !! wikitext
11796 {{{parameter}}}
11797 !! html
11798 <p>{{{parameter}}}
11799 </p>
11800 !! end
11801
11802 !! test
11803 Template with targets containing wikilinks
11804 !! options
11805 parsoid=wt2html
11806 !! wikitext
11807 {{[[foo]]}}
11808
11809 {{[[{{echo|foo}}]]}}
11810
11811 {{{{echo|[[foo}}]]}}
11812 !! html/php
11813 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11814 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11815 </p><p>{{[[foo}}]]
11816 </p>
11817 !! html/parsoid
11818 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11819 <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>
11820 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11821 !! end
11822
11823 !! article
11824 Template:''
11825 !! text
11826 bar
11827 !! endarticle
11828
11829 !! test
11830 Templates: Double quotes as template target
11831 !! wikitext
11832 foo {{''}} baz
11833 !! html/php
11834 <p>foo bar baz
11835 </p>
11836 !! html/parsoid
11837 <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
11838 </p>
11839 !! end
11840
11841 ## This test is about making sure Parsoid's data-mw is well formed in the
11842 ## face of multiple templates with intersecting and overlapping ranges. The
11843 ## wikitext itself is wretched.
11844 !! test
11845 Templates with intersecting and overlapping ranges
11846 !! wikitext
11847 {|{{echo|
11848 <p>ha</p>}}
11849 {|{{echo|
11850 <p>ho</p>}}
11851 {{echo|{{!}}hi}}
11852 |}
11853 !! html/php+tidy
11854 <p>ha</p><table>
11855
11856 </table><p>ho</p><table>
11857
11858 <tbody><tr>
11859 <td>hi
11860 </td></tr></tbody></table>
11861 !! html/parsoid
11862 <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":""}]]}'>
11863
11864 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11865
11866 <tbody><tr><td>hi</td></tr>
11867 </tbody></table>
11868 !! end
11869
11870 !! article
11871 Template:MSGNW test
11872 !! text
11873 ''None'' of '''this''' should be
11874 * interpreted
11875 but rather passed unmodified
11876 {{test}}
11877 <gallery>
11878 File:Foobar.jpg
11879 </gallery>
11880 <!-- comment -->
11881 !! endarticle
11882
11883 # hmm, fix this or just deprecate msgnw and document its behavior?
11884 !! test
11885 msgnw keyword
11886 !! wikitext
11887 {{msgnw:MSGNW test}}
11888 !! html/php
11889 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11890 &#42; interpreted
11891 &#32;but rather passed unmodified
11892 &#123;&#123;test&#125;&#125;
11893 &#60;gallery&#62;
11894 File:Foobar.jpg
11895 &#60;/gallery&#62;
11896 &#60;!-- comment --&#62;
11897 </p>
11898 !! end
11899
11900 !! test
11901 int keyword
11902 !! wikitext
11903 {{int:youhavenewmessages|lots of money|not!}}
11904 !! html
11905 <p>You have lots of money (not!).
11906 </p>
11907 !! end
11908
11909 !! test
11910 int keyword - non-existing message
11911 !! wikitext
11912 {{int:var}}
11913 !! html
11914 <p>⧼var⧽
11915 </p>
11916 !! end
11917
11918 !! article
11919 Template:Includes
11920 !! text
11921 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11922 !! endarticle
11923
11924 !! test
11925 <includeonly> and <noinclude> being included
11926 !! wikitext
11927 {{Includes}}
11928 !! html
11929 <p>Foobar
11930 </p>
11931 !! end
11932
11933 !! article
11934 Template:Includes2
11935 !! text
11936 <onlyinclude>Foo</onlyinclude>bar
11937 !! endarticle
11938
11939 !! test
11940 <onlyinclude> being included
11941 !! wikitext
11942 {{Includes2}}
11943 !! html
11944 <p>Foo
11945 </p>
11946 !! end
11947
11948
11949 !! article
11950 Template:Includes3
11951 !! text
11952 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11953 !! endarticle
11954
11955 !! test
11956 <onlyinclude> and <includeonly> being included
11957 !! wikitext
11958 {{Includes3}}
11959 !! html
11960 <p>Foo
11961 </p>
11962 !! end
11963
11964 !! test
11965 <includeonly> and <noinclude> on a page
11966 !! wikitext
11967 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11968 !! html
11969 <p>Foozar
11970 </p>
11971 !! end
11972
11973 !! test
11974 Un-closed <noinclude>
11975 !! wikitext
11976 <noinclude>
11977 !! html
11978 !! end
11979
11980 !! test
11981 <onlyinclude> on a page
11982 !! wikitext
11983 <onlyinclude>Foo</onlyinclude>bar
11984 !! html
11985 <p>Foobar
11986 </p>
11987 !! end
11988
11989 !! test
11990 Un-closed <onlyinclude>
11991 !! wikitext
11992 <onlyinclude>
11993 !! html
11994 !! end
11995
11996 !!test
11997 Self-closed noinclude, includeonly, onlyinclude tags
11998 !! wikitext
11999 <noinclude />
12000 <includeonly />
12001 <onlyinclude />
12002 !! html
12003 <p><br />
12004 </p>
12005 !!end
12006
12007 !!test
12008 Unbalanced includeonly and noinclude tags
12009 !! wikitext
12010 {|
12011 |a</noinclude>
12012 |b</noinclude></noinclude>
12013 |c</noinclude></includeonly>
12014 |d</includeonly></includeonly>
12015 |}
12016 !! html
12017 <table>
12018 <tr>
12019 <td>a
12020 </td>
12021 <td>b
12022 </td>
12023 <td>c&lt;/includeonly&gt;
12024 </td>
12025 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
12026 </td></tr></table>
12027 !!end
12028
12029 !! article
12030 Template:Includeonly section
12031 !! text
12032 <includeonly>
12033 ==Includeonly section==
12034 </includeonly>
12035 ==Section T-1==
12036 !!endarticle
12037
12038 !! test
12039 T8563: Edit link generation for section shown by <includeonly>
12040 !! wikitext
12041 {{includeonly section}}
12042 !! html
12043 <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>
12044 <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>
12045 !! end
12046
12047 # Uses same input as the contents of [[Template:Includeonly section]]
12048 !! test
12049 T8563: Section extraction for section shown by <includeonly>
12050 !! options
12051 section=T-2
12052 !! wikitext
12053 <includeonly>
12054 ==Includeonly section==
12055 </includeonly>
12056 ==Section T-2==
12057 !! html
12058 ==Section T-2==
12059 !! end
12060
12061 !! test
12062 T8563: Edit link generation for section suppressed by <includeonly>
12063 !! wikitext
12064 <includeonly>
12065 ==Includeonly section==
12066 </includeonly>
12067 ==Section 1==
12068 !! html
12069 <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>
12070 !! end
12071
12072 !! test
12073 T8563: Section extraction for section suppressed by <includeonly>
12074 !! options
12075 section=1
12076 !! wikitext
12077 <includeonly>
12078 ==Includeonly section==
12079 </includeonly>
12080 ==Section 1==
12081 !! html
12082 ==Section 1==
12083 !! end
12084
12085 !! test
12086 Un-closed <includeonly>
12087 !! wikitext
12088 <includeonly>
12089 !! html/php
12090 !! html/parsoid
12091 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}' data-mw='{"src":"&lt;includeonly>"}'/>
12092 !! end
12093
12094 ## We used to, but no longer wt2wt this test since the default serializer
12095 ## will normalize the include directives to serialize on their own line.
12096 ## Selser will take care of preserving formatting in scenarios where they
12097 ## intermingled with other wikitext.
12098 !! test
12099 Includes and comments at SOL
12100 !! options
12101 parsoid=wt2html,html2html
12102 !! wikitext
12103 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
12104
12105 <noinclude>
12106 some
12107 </noinclude>*stuff
12108 *here
12109
12110 <noinclude>
12111 some</noinclude>* stuff
12112 * here
12113
12114 <includeonly>can have stuff</includeonly>===here===
12115
12116 !! html/php
12117 <h2><span class="mw-headline" id="hu">hu</span></h2>
12118 <p>some
12119 </p>
12120 <ul><li>stuff</li>
12121 <li>here</li></ul>
12122 <p><br />
12123 some* stuff
12124 </p>
12125 <ul><li>here</li></ul>
12126 <h3><span class="mw-headline" id="here">here</span></h3>
12127 !! html/parsoid
12128 <!-- 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>
12129
12130 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12131 <p>some</p>
12132 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
12133 <li>here</li></ul>
12134
12135 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12136 <p>some<meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>* stuff</p>
12137 <ul><li>here</li></ul>
12138
12139 <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>
12140 !! end
12141
12142 # TODO: test with DOM fragment reuse!
12143 !! test
12144 Parsoid: DOM fragment reuse
12145 !! options
12146 parsoid=wt2wt,wt2html
12147 !! wikitext
12148 a{{echo|b<table></table>c}}d
12149
12150 a{{echo|b
12151 <table></table>
12152 c}}d
12153
12154 {{echo|a
12155
12156 <table></table>
12157
12158 b}}
12159 !! html/php+tidy
12160 <p>ab</p><table></table><p>cd
12161 </p><p>ab
12162 </p>
12163 <table></table>
12164 <p>cd
12165 </p><p>a
12166 </p>
12167 <table></table>
12168 <p>b
12169 </p>
12170 !! html/parsoid
12171 <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>
12172
12173 <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">
12174 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
12175 </span><p about="#mwt2">cd</p>
12176
12177 <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">
12178
12179 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
12180
12181 </span><p about="#mwt3">b</p>
12182 !! end
12183
12184 !! test
12185 Parsoid: Merge double tds (T52603)
12186 !! wikitext
12187 {|
12188 |{{echo|{{!}} foo}}
12189 |}
12190 !! html/php+tidy
12191 <table>
12192 <tbody><tr>
12193 <td>foo
12194 </td></tr></tbody></table>
12195 !! html/parsoid
12196 <table><tbody>
12197 <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>
12198 </tbody></table>
12199 !! end
12200
12201 !! test
12202 Parsoid: Merge double tds in nested transclusion content (T52603)
12203 !! wikitext
12204 {{echo|<div>}}
12205 {|
12206 |{{echo|{{!}} foo}}
12207 |}
12208 {{echo|</div>}}
12209 !! html/php+tidy
12210 <div>
12211 <table>
12212 <tbody><tr>
12213 <td>foo
12214 </td></tr></tbody></table>
12215 </div>
12216 !! html/parsoid
12217 <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}}]}'>
12218 <table><tbody>
12219 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
12220 </tbody></table>
12221 </div>
12222 !! end
12223
12224 ###
12225 ### <includeonly> and <noinclude> in attributes
12226 ###
12227 !!test
12228 0. includeonly around the entire attribute
12229 !! wikitext
12230 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12231 !! html
12232 <p><span id="v2">bar</span>
12233 </p>
12234 !!end
12235
12236 !!test
12237 1. includeonly in html attr key
12238 !! wikitext
12239 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12240 !! html
12241 <p><span id="foo">bar</span>
12242 </p>
12243 !!end
12244
12245 !!test
12246 2. includeonly in html attr value
12247 !! wikitext
12248 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12249 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12250 !! html
12251 <p><span id="v1">bar</span>
12252 <span id="v1">bar</span>
12253 </p>
12254 !!end
12255
12256 !!test
12257 3. includeonly in part of an attr value
12258 !! wikitext
12259 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12260 !! html
12261 <p><span style="color:red;">bar</span>
12262 </p>
12263 !!end
12264
12265 !!test
12266 4. includeonly in table attributes
12267 !! wikitext
12268 {|
12269 |- <noinclude>
12270 |-
12271 |a
12272 </noinclude>
12273 |- <includeonly>
12274 |-
12275 |b
12276 </includeonly>
12277 |}
12278 !! html
12279 <table>
12280
12281
12282 <tr>
12283 <td>a
12284 </td></tr>
12285 </table>
12286 !!end
12287
12288 ###
12289 ### Preprocessor precedence tests
12290 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12291 ###
12292 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12293 !! test
12294 Preprocessor precedence 1: link is rightmost opening
12295 !! options
12296 parsoid=wt2html
12297 !! wikitext
12298 {{[[Foo|bar}}]]
12299
12300 But close-brace is not a valid character in a link title:
12301 {{[[Foo}}|bar]]
12302
12303 However, we can still tell this was handled as a link in the preprocessor:
12304 {{echo|[[Foo}}|bar]]|bat}}
12305 !! html/php
12306 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12307 </p><p>But close-brace is not a valid character in a link title:
12308 {{[[Foo}}|bar]]
12309 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12310 [[Foo}}|bar]]
12311 </p>
12312 !! html/parsoid
12313 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12314 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12315 <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>
12316 !! end
12317
12318 !! test
12319 Preprocessor precedence 2: template is rightmost opening
12320 !! options
12321 language=zh
12322 !! wikitext
12323 -{{echo|foo}-}}-
12324 !! html/php
12325 <p>-foo}--
12326 </p>
12327 !! html/parsoid
12328 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12329 !! end
12330
12331 !! test
12332 Preprocessor precedence 3: language converter is rightmost opening
12333 !! options
12334 language=zh
12335 parsoid=wt2html
12336 !! wikitext
12337 {{echo|hi}}
12338
12339 {{-{R|echo|hi}}}-
12340
12341 [[-{R|raw]]}-
12342 !! html/php
12343 <p>hi
12344 </p><p>{{echo|hi}}
12345 </p><p>[[raw]]
12346 </p>
12347 !! html/parsoid
12348 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12349 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12350 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12351 !! end
12352
12353 !! test
12354 Preprocessor precedence 4: left-most angle bracket
12355 !! options
12356 language=zh
12357 !! wikitext
12358 <!--{raw}-->
12359 !! html/php
12360 !! html/parsoid
12361 <!--{raw}-->
12362 !! end
12363
12364 !! article
12365 Template:Precedence5
12366 !! text
12367 {{{{{1}}}}}
12368 !! endarticle
12369
12370 !! test
12371 Preprocessor precedence 5: tplarg takes precedence over template
12372 !! wikitext
12373 {{Precedence5|Bullet}}
12374 !! html/php
12375 <ul><li>Bar</li></ul>
12376 !! html/parsoid
12377 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12378 !! end
12379
12380 !! test
12381 Preprocessor precedence 6: broken link is rightmost opening
12382 !! options
12383 parsoid=wt2html
12384 !! wikitext
12385 {{echo|[[Foo}}
12386
12387 {{echo|[[Foo|bar|bat=baz}}
12388 !! html/php
12389 <p>{{echo|[[Foo}}
12390 </p><p>{{echo|[[Foo|bar|bat=baz}}
12391 </p>
12392 !! html/parsoid
12393 <p>{{echo|[[Foo}}</p>
12394 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12395 !! end
12396
12397 # This next test exposes a difference between PHP and Parsoid:
12398 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12399 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12400 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12401 # outer `[[Foo` extends until the `y]]`
12402 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12403 # intermediate result (after template expansion), and link processing
12404 # happens on this intermediate result, which moves the wikilink
12405 # boundary leftward to `[[Foo|Bar]]`
12406 # 2b) Parsoid works in a single step, so it's going to keep the
12407 # wikilink as extending to the `y]]`
12408 # 3a) Then PHP does linktrail processing which slurps up the trailing
12409 # `xy` inside the link.
12410 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12411 # `z` inside the link.
12412 # This is "correct" behavior. Parsoid's basic worldview is that the
12413 # `]]` inside the template shouldn't be allowed to leak out to affect
12414 # the surrounding wikilink. PHP may match Parsoid (in the future)
12415 # if you use {{#balance}} (T114445).
12416
12417 !! test
12418 Preprocessor precedence 7: broken template is rightmost opening
12419 !! options
12420 parsoid=wt2html
12421 !! wikitext
12422 [[Foo|{{echo|Bar]]
12423
12424 [[Foo|{{echo|Bar]]-x}}-y]]-z
12425
12426 Careful: linktrails can move the end of the wikilink:
12427 [[Foo|{{echo|y']]a}}l]]l
12428 !! html/php
12429 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12430 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12431 </p><p>Careful: linktrails can move the end of the wikilink:
12432 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12433 </p>
12434 !! html/parsoid
12435 <p>[[Foo|{{echo|Bar]]</p>
12436 <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>
12437 <p>Careful: linktrails can move the end of the wikilink:
12438 <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>
12439 !! end
12440
12441 !! test
12442 Preprocessor precedence 8: broken language converter is rightmost opening
12443 !! options
12444 language=zh
12445 !! wikitext
12446 [[Foo-{R|raw]]
12447 !! html
12448 <p>[[Foo-{R|raw]]
12449 </p>
12450 !! end
12451
12452 !! article
12453 Template:Preprocessor_precedence_9
12454 !! text
12455 ;4: {{{{1}}}}
12456 ;5: {{{{{2}}}}}
12457 ;6: {{{{{{3}}}}}}
12458 ;7: {{{{{{{4}}}}}}}
12459 !! endarticle
12460
12461 !! test
12462 Preprocessor precedence 9: groups of braces
12463 !! wikitext
12464 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12465 !! html/php
12466 <dl><dt>4</dt>
12467 <dd>{Four}</dd>
12468 <dt>5</dt>
12469 <dd></dd></dl>
12470 <ul><li>Bar</li></ul>
12471 <dl><dt>6</dt>
12472 <dd>Four</dd>
12473 <dt>7</dt>
12474 <dd>{Bullet}</dd></dl>
12475 !! html/parsoid
12476 <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}}]}'>
12477 <dt>4</dt>
12478 <dd>{Four}</dd>
12479 <dt>5</dt>
12480 <dd></dd>
12481 </dl><ul about="#mwt1">
12482 <li>Bar</li>
12483 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12484 <dt>6</dt>
12485 <dd>Four</dd>
12486 <dt>7</dt>
12487 <dd>{Bullet}</dd>
12488 </dl>
12489 !! end
12490
12491 !! article
12492 Template:Preprocessor_precedence_10
12493 !! text
12494 ;1: -{R|raw}-
12495 ;2: -{{Bullet}}-
12496 ;3: -{{{1}}}-
12497 ;4: -{{{{2}}}}-
12498 ;5: -{{{{{3}}}}}-
12499 ;6: -{{{{{{4}}}}}}-
12500 ;7: -{{{{{{{5}}}}}}}-
12501 !! endarticle
12502
12503 !! test
12504 Preprocessor precedence 10: groups of braces with leading dash
12505 !! options
12506 language=zh
12507 !! wikitext
12508 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12509 !! html/php
12510 <dl><dt>1</dt>
12511 <dd>raw</dd>
12512 <dt>2</dt>
12513 <dd>-</dd></dl>
12514 <ul><li>Bar-</li></ul>
12515 <dl><dt>3</dt>
12516 <dd>-Three-</dd>
12517 <dt>4</dt>
12518 <dd>raw2</dd>
12519 <dt>5</dt>
12520 <dd>-</dd></dl>
12521 <ul><li>Bar-</li></ul>
12522 <dl><dt>6</dt>
12523 <dd>-Three-</dd>
12524 <dt>7</dt>
12525 <dd>raw2</dd></dl>
12526 !! html/parsoid
12527 <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}}]}'>
12528 <dt>1</dt>
12529 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12530 <dt>2</dt>
12531 <dd>-</dd>
12532 </dl><ul about="#mwt1">
12533 <li>Bar-</li>
12534 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12535 <dt>3</dt>
12536 <dd>-Three-</dd>
12537 <dt>4</dt>
12538 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12539 <dt>5</dt>
12540 <dd>-</dd>
12541 </dl><ul about="#mwt1">
12542 <li>Bar-</li>
12543 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12544 <dt>6</dt>
12545 <dd>-Three-</dd>
12546 <dt>7</dt>
12547 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12548 </dl>
12549 !! end
12550
12551 !! test
12552 Preprocessor precedence 11: found during visual diff testing
12553 !! wikitext
12554 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12555
12556 {{echo|-{{echo|-{{echo|x}}}}}}
12557
12558 {{echo|-{{echo|x}}}}
12559 !! html/php
12560 <p><span>-<span>-x</span></span>
12561 </p><p>--x
12562 </p><p>-x
12563 </p>
12564 !! html/parsoid
12565 <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>
12566
12567 <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>
12568
12569 <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>
12570 !! end
12571
12572 !! test
12573 Preprocessor precedence 12: broken language converter closed by brace.
12574 !! options
12575 parsoid=wt2html
12576 !! wikitext
12577 This form breaks the template, which is unfortunate:
12578 *{{echo|foo-{bar}bat}}
12579
12580 But if the broken language converter markup is inside an extension
12581 tag, nothing bad happens:
12582 *<nowiki>foo-{bar}bat</nowiki>
12583 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12584 *<pre>foo-{bar}bat</pre>
12585 *{{echo|<pre>foo-{bar}bat</pre>}}
12586
12587 <tag>foo-{bar}bat</tag>
12588 {{echo|<tag>foo-{bar}bat</tag>}}
12589
12590 !! html/php+tidy
12591 <p>This form breaks the template, which is unfortunate:
12592 </p>
12593 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12594 <p>But if the broken language converter markup is inside an extension
12595 tag, nothing bad happens:
12596 </p>
12597 <ul><li>foo-&#123;bar}bat</li>
12598 <li>foo-&#123;bar}bat</li>
12599 <li><pre>foo-{bar}bat</pre></li>
12600 <li><pre>foo-{bar}bat</pre></li></ul>
12601 <pre>'foo-{bar}bat'
12602 array (
12603 )
12604 </pre>
12605 <pre>'foo-{bar}bat'
12606 array (
12607 )
12608 </pre>
12609 !! html/parsoid
12610 <p>This form breaks the template, which is unfortunate:</p>
12611 <ul>
12612 <li>{{echo|foo-{bar}bat}}</li>
12613 </ul>
12614 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12615 <ul>
12616 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12617 <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>
12618 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12619 <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>
12620 </ul>
12621 <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>
12622 !! end
12623
12624 !! test
12625 Preprocessor precedence 13: broken language converter in external link
12626 !! options
12627 parsoid=wt2html
12628 !! wikitext
12629 *[http://example.com/-{foo Example in URL]
12630 *[http://example.com Example in -{link} description]
12631 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12632 !! html/php+tidy
12633 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12634 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12635 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12636 !! html/parsoid
12637 <ul>
12638 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12639 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12640 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12641 </ul>
12642 !! end
12643
12644 !! test
12645 Preprocessor precedence 14: broken language converter in comment
12646 !! wikitext
12647 *<!--{{foo}}-->...should be ok
12648 *<!---{{foo}}-->...extra dashes
12649 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12650 !! html/php+tidy
12651 <ul><li>...should be ok</li>
12652 <li>...extra dashes</li>
12653 <li>foobat...should be ok</li></ul>
12654 !! html/parsoid
12655 <ul>
12656 <li><!--{{foo}}-->...should be ok</li>
12657 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12658 <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>
12659 </ul>
12660 !! end
12661
12662 !! test
12663 Preprocessor precedence 15: broken brace markup in headings
12664 !! config
12665 wgFragmentMode=[ 'html5', 'legacy' ]
12666 !! options
12667 parsoid=wt2html
12668 !! wikitext
12669 __NOTOC__ __NOEDITSECTION__
12670 ===1 foo[bar 1===
12671 1
12672 ===2 foo[[bar 2===
12673 2
12674 ===3 foo{bar 3===
12675 3
12676 ===4 foo{{bar 4===
12677 4
12678 ===5 foo{{{bar 5===
12679 5
12680 ===6 foo-{bar 6===
12681 6
12682 !! html/php+tidy
12683 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12684 <p>1
12685 </p>
12686 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12687 <p>2
12688 </p>
12689 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12690 <p>3
12691 </p>
12692 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12693 <p>4
12694 </p>
12695 <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>
12696 <p>5
12697 </p>
12698 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12699 <p>6
12700 </p>
12701 !! html/parsoid
12702 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12703 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12704 <p>1</p>
12705 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12706 <p>2</p>
12707 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12708 <p>3</p>
12709 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12710 <p>4</p>
12711 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12712 <p>5</p>
12713 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12714 <p>6</p>
12715 !! end
12716
12717 !! test
12718 Preprocessor precedence 16: matching closing braces to opening braces
12719 !! options
12720 language=zh
12721 parsoid=wt2html
12722 !! wikitext
12723 -{{{echo|foo}}bar}-
12724 !! html/php
12725 <p>foobar
12726 </p>
12727 !! html/parsoid
12728 <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>
12729 !! end
12730
12731 !! test
12732 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12733 !! options
12734 parsoid=wt2html
12735 !! wikitext
12736 {{echo|hi {{}}}}
12737 !! html/php
12738 <p>hi {{}}
12739 </p>
12740 !! html/parsoid
12741 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12742 !! end
12743
12744 # Ensure we're using a language without variants for this test; even
12745 # if $wgUsePigLatinVariant is true. We've picked `de` arbitrarily.
12746 !! test
12747 Preprocessor precedence 18: another rightmost wins scenario
12748 !! options
12749 parsoid=wt2html
12750 language=de
12751 !! wikitext
12752 {{ -{{{{1|tplarg}}} }} }-
12753 !! html/php
12754 <p>{{ -{tplarg }} }-
12755 </p>
12756 !! html/parsoid
12757 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12758 !! end
12759
12760 !! test
12761 Preprocessor precedence 19: break syntax
12762 !! options
12763 parsoid=wt2html
12764 !! wikitext
12765 -{{
12766 !! html/php
12767 <p>-{{
12768 </p>
12769 !! html/parsoid
12770 <p>-{{</p>
12771 !! end
12772
12773 ###
12774 ### Token Stream Patcher tests
12775 ###
12776 ### These tests won't always pass wt2wt and other modes because
12777 ### on serialization, the table will be output on a new line.
12778 ### For now, we are blacklisting them, and using this to test selser.
12779 ###
12780
12781 !!test
12782 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12783 !!options
12784 parsoid=wt2html,wt2wt
12785 !!wikitext
12786 {{echo|}}{| width = '100%'
12787 |foo
12788 |}
12789 !!html/parsoid
12790 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12791 <tbody><tr><td>foo</td></tr>
12792 </tbody></table>
12793 !!end
12794
12795 ## We used to, but no longer wt2wt this test since the default serializer
12796 ## will normalize the include directives to serialize on their own line.
12797 ## Selser will take care of preserving formatting in scenarios where they
12798 ## intermingled with other wikitext.
12799 !!test
12800 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12801 !!options
12802 parsoid=wt2html
12803 !!wikitext
12804 <includeonly>a</includeonly>{| {{{b}}}
12805 |c
12806 |}
12807 !!html/parsoid
12808 <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":""}]]}'>
12809 <tbody><tr><td>c</td></tr>
12810 </tbody></table>
12811 !!end
12812
12813 !! test
12814 Table wikitext syntax outside wiki-tables
12815 !! wikitext
12816 a
12817 |+ not a caption
12818 ! not a table heading
12819 |- not a table row
12820 | not a table cell
12821 | class="foo bar" | baz
12822 b
12823 |}
12824 |-
12825 c
12826 !! html
12827 <p>a
12828 |+ not a caption
12829 ! not a table heading
12830 |- not a table row
12831 | not a table cell
12832 | class="foo bar" | baz
12833 b
12834 |}
12835 |-
12836 c
12837 </p>
12838 !! end
12839
12840 ###
12841 ### Testing parsing of templates where a template arg
12842 ### has the same name as the template itself.
12843 ###
12844
12845 !! article
12846 Template:quote
12847 !! text
12848 {{{quote|{{{1}}}}}}
12849 !! endarticle
12850
12851 !!test
12852 Templates: Template Name/Arg clash: 1. Use of positional param
12853 !! wikitext
12854 {{quote|foo}}
12855 !! html
12856 <p>foo
12857 </p>
12858 !!end
12859
12860 !!test
12861 Templates: Template Name/Arg clash: 2. Use of named param
12862 !! wikitext
12863 {{quote|quote=foo}}
12864 !! html
12865 <p>foo
12866 </p>
12867 !!end
12868
12869 !!test
12870 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12871 !! wikitext
12872 {{quote|quote}}
12873 !! html
12874 <p>quote
12875 </p>
12876 !!end
12877
12878 ###
12879 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12880 ###
12881
12882 !!test
12883 Templates: 1. Simple use
12884 !! wikitext
12885 {{echo|Foo}}
12886 !! html
12887 <p>Foo
12888 </p>
12889 !!end
12890
12891 !!test
12892 Templates: 2. Inside a block tag
12893 !! wikitext
12894 <div>{{echo|Foo}}</div>
12895 <blockquote>{{echo|Foo}}</blockquote>
12896 !! html
12897 <div>Foo</div>
12898 <blockquote>Foo</blockquote>
12899 !! html+tidy
12900 <div>Foo</div>
12901 <blockquote><p>Foo</p></blockquote>
12902 !!end
12903
12904 !!test
12905 Templates: P-wrapping: 1a. Templates on consecutive lines
12906 !! wikitext
12907 {{echo|Foo}}
12908 {{echo|bar}}
12909 !! html
12910 <p>Foo
12911 bar
12912 </p>
12913 !!end
12914
12915 !!test
12916 Templates: P-wrapping: 1b. Templates on consecutive lines
12917 !! wikitext
12918 Foo
12919
12920 {{echo|bar}}
12921 {{echo|baz}}
12922 !! html
12923 <p>Foo
12924 </p><p>bar
12925 baz
12926 </p>
12927 !!end
12928
12929 !!test
12930 Templates: P-wrapping: 1c. Templates on consecutive lines
12931 !! wikitext
12932 {{echo|Foo}}
12933 {{echo|bar}} <div>baz</div>
12934 !! html
12935 <p>Foo
12936 </p>
12937 bar <div>baz</div>
12938 !! html+tidy
12939 <p>Foo
12940 </p><p>
12941 bar </p><div>baz</div>
12942 !! end
12943
12944 !! test
12945 Templates: P-wrapping: 1d. Template preceded by comment-only line
12946 !! wikitext
12947 <!-- foo -->
12948 {{echo|Bar}}
12949 !! html/php+tidy
12950 <p>Bar
12951 </p>
12952 !! html/parsoid
12953 <!-- foo -->
12954
12955 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12956 !!end
12957
12958 !! test
12959 Templates: Scopes should not be expanded unnecessarily
12960 !! options
12961 parsoid=wt2html,wt2wt
12962 !! wikitext
12963 {{echo|<div>a</div>}}b{{echo|
12964 <div>c</div>}}
12965 !! html/php+tidy
12966 <div>a</div><p>b
12967 </p><div>c</div>
12968 !! html/parsoid
12969 <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}}]}'>
12970 </span><div about="#mwt2">c</div>
12971 !! end
12972
12973 !!test
12974 Templates: Inline Text: 1. Multiple template uses
12975 !! wikitext
12976 {{echo|Foo}}bar{{echo|baz}}
12977 !! html
12978 <p>Foobarbaz
12979 </p>
12980 !!end
12981
12982 !!test
12983 Templates: Inline Text: 2. Back-to-back template uses
12984 !! wikitext
12985 {{echo|Foo}}{{echo|bar}}
12986 !! html
12987 <p>Foobar
12988 </p>
12989 !!end
12990
12991 !!test
12992 Templates: Block Tags: 1. Multiple template uses
12993 !! wikitext
12994 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12995 !! html
12996 <div>Foo</div><div>bar</div><div>baz</div>
12997 !!end
12998
12999 !!test
13000 Templates: Block Tags: 2. Back-to-back template uses
13001 !! wikitext
13002 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
13003 !! html
13004 <div>Foo</div><div>bar</div>
13005 !!end
13006
13007 ## Parsoid drops empty elements in templates.
13008 !! test
13009 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
13010 !! wikitext
13011 {{echo|a
13012 b</p>}}
13013 !! html/php+tidy
13014 <p>a
13015 </p><p>
13016 b</p><p class="mw-empty-elt"></p>
13017 !! html/parsoid
13018 <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">
13019 </span><p about="#mwt1">b</p>
13020 !! end
13021
13022 !!test
13023 Templates: Links: 1. Simple example
13024 !! wikitext
13025 {{echo|[[Foo|bar]]}}
13026 !! html
13027 <p><a href="/wiki/Foo" title="Foo">bar</a>
13028 </p>
13029 !!end
13030
13031 !!test
13032 Templates: Links: 2. Generation of link href
13033 !! wikitext
13034 [[{{echo|Foo}}|bar]]
13035 !! html
13036 <p><a href="/wiki/Foo" title="Foo">bar</a>
13037 </p>
13038 !!end
13039
13040 !!test
13041 Templates: Links: 3. Generation of part of a link href
13042 !! wikitext
13043 [[Fo{{echo|o}}|bar]]
13044
13045 [[Foo{{echo|bar}}]]
13046
13047 [[Foo{{echo|bar}}baz]]
13048
13049 [[Foo{{echo|bar}}|bar]]
13050
13051 [[:Foo{{echo|bar}}]]
13052
13053 [[:Foo{{echo|bar}}|bar]]
13054 !! html
13055 <p><a href="/wiki/Foo" title="Foo">bar</a>
13056 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13057 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
13058 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13059 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13060 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13061 </p>
13062 !!end
13063
13064 !!test
13065 Templates: Links: 4. Multiple templates generating link href
13066 !! wikitext
13067 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
13068 !! html
13069 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13070 </p>
13071 !!end
13072
13073 !!test
13074 Templates: Links: 5. Generation of link text
13075 !! wikitext
13076 [[Foo|{{echo|bar}}]]
13077 !! html
13078 <p><a href="/wiki/Foo" title="Foo">bar</a>
13079 </p>
13080 !!end
13081
13082 !!test
13083 Templates: Links: 5. Nested templates (only outermost template should be marked)
13084 !! wikitext
13085 {{echo|[[{{echo|Foo}}|bar]]}}
13086 !! html
13087 <p><a href="/wiki/Foo" title="Foo">bar</a>
13088 </p>
13089 !!end
13090
13091 !!test
13092 Templates: HTML Tag: 1. Generation of HTML attr. key
13093 !! wikitext
13094 <div {{echo|style}}="color:red;">foo</div>
13095 !! html
13096 <div style="color:red;">foo</div>
13097 !!end
13098
13099 !!test
13100 Templates: HTML Tag: 2. Generation of HTML attr. value
13101 !! wikitext
13102 <div style={{echo|'color:red;'}}>foo</div>
13103 !! html
13104 <div style="color:red;">foo</div>
13105 !!end
13106
13107 !!test
13108 Templates: HTML Tag: 3. Generation of HTML attr key and value
13109 !! wikitext
13110 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
13111 !! html
13112 <div style="color:red;">foo</div>
13113 !!end
13114
13115 !!test
13116 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
13117 !! wikitext
13118 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
13119 !! html
13120 <div title="This is a long title with just one piece templated">foo</div>
13121 !!end
13122
13123 !!test
13124 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
13125 !! wikitext
13126 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
13127 !! html
13128 <div title="This is a long title with just one piece templated">foo</div>
13129 !!end
13130
13131 !!test
13132 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
13133 !! wikitext
13134 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
13135 !! html
13136 <div title="This is a long title with just one piece templated">foo</div>
13137 !!end
13138
13139 # SSS FIXME: While it is great we added support for all this,
13140 # do we want to make this part of the spec? Maybe we want to
13141 # deprecate this kind of usage in the future?
13142 !!test
13143 Templates: HTML Tag: 7. Generation of partial attribute key string
13144 !! wikitext
13145 <div st{{echo|yle}}="color:red;">foo</div>
13146 !! html
13147 <div style="color:red;">foo</div>
13148 !!end
13149
13150 !! test
13151 Templates: HTML Tag: 8. Template-generated attribute (k=v)
13152 !! wikitext
13153 <div {{echo|1=id="v1"}}>bar</div>
13154 !! html
13155 <div id="v1">bar</div>
13156 !!end
13157
13158 !! test
13159 Templates: HTML Tag: 9. Multiple template-generated attributes
13160 !! wikitext
13161 <div {{echo|1=id="v1" title="foo"}}>bar</div>
13162 !! html
13163 <div id="v1" title="foo">bar</div>
13164 !!end
13165
13166 !! test
13167 Templates: Support for templates generating attributes and content
13168 !! wikitext
13169 {| {{mixed_attr_content_template}}
13170 |-
13171 |bar
13172 |}
13173 !! html/php
13174 <table style="color:red;" title="T48811">
13175
13176 <tr>
13177 <td>foo
13178 </td></tr>
13179 <tr>
13180 <td>bar
13181 </td></tr></table>
13182 !! html/parsoid
13183 <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|}"]}'>
13184 <tbody><tr>
13185 <td>foo</td></tr>
13186 <tr>
13187 <td>bar</td></tr>
13188 </tbody></table>
13189 !!end
13190
13191 !! article
13192 Template:attribute_from_template
13193 !! text
13194 class="123"
13195 !! endarticle
13196
13197 !! test
13198 Table cell with attribute before expanded attribute
13199 !! wikitext
13200 {|
13201 | align="center" {{attribute_from_template}} |456
13202 |}
13203 !! html/parsoid
13204 <table>
13205 <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>
13206 </tbody></table>
13207 !! end
13208
13209 !! test
13210 1. Entities and nowikis inside templated attributes should be handled correctly
13211 !! wikitext
13212 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
13213 !! html/php
13214 <div style="background:#f9f9f9;">foo</div>
13215 !! html/parsoid
13216 <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>
13217 !! end
13218
13219 !! test
13220 2. Entities and nowikis inside templated attributes should be handled correctly
13221 !! wikitext
13222 {|
13223 |{{table_attribs_3}}
13224 |}
13225 !! html/php
13226 <table>
13227 <tr>
13228 <td style="background:#f9f9f9;">Foo
13229 </td></tr></table>
13230 !! html/parsoid
13231 <table>
13232 <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>
13233 </tbody></table>
13234 !! end
13235
13236 !! test
13237 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13238 !! wikitext
13239 {{tbl-start}}
13240 |{{table_attribs_3}}
13241 {{tbl-end}}
13242 !! html/php
13243 <table>
13244 <tr>
13245 <td style="background:#f9f9f9;">Foo
13246 </td></tr></table>
13247 !! html/parsoid
13248 <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}}]}'>
13249 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
13250 </tbody></table>
13251 !! end
13252
13253 # T107622
13254 !! test
13255 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13256 !! wikitext
13257 {|
13258 |{{table_attribs_6}} hi
13259 |}
13260 !! html/php
13261 <table>
13262 <tr>
13263 <td style="background: red;">hi
13264 </td></tr></table>
13265 !! html/parsoid
13266 <table>
13267 <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>
13268 </tbody></table>
13269 !! end
13270
13271 !!test
13272 Templates: HTML Tables: 1. Generating start of a HTML table
13273 !! wikitext
13274 {{echo|<table><tr><td>foo</td>}}</tr></table>
13275 !! html
13276 <table><tr><td>foo</td></tr></table>
13277 !!end
13278
13279 !!test
13280 Templates: HTML Tables: 2a. Generating middle of a HTML table
13281 !! wikitext
13282 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13283 !! html
13284 <table><tr><td>foo</td></tr></table>
13285 !!end
13286
13287 !!test
13288 Templates: HTML Tables: 2b. Generating middle of a HTML table
13289 !! wikitext
13290 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13291 !! html
13292 <table><tr><td>foo</td></tr></table>
13293 !!end
13294
13295 !!test
13296 Templates: HTML Tables: 3. Generating end of a HTML table
13297 !! wikitext
13298 <table><tr>{{echo|<td>foo</td></tr></table>}}
13299 !! html
13300 <table><tr><td>foo</td></tr></table>
13301 !! end
13302
13303 !!test
13304 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13305 !! wikitext
13306 {{echo|<table>}}<tr><td>foo</td></tr></table>
13307 !! html
13308 <table><tr><td>foo</td></tr></table>
13309 !! end
13310
13311 !!test
13312 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13313 !! wikitext
13314 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13315 !! html
13316 <table><tr><td>foo</td></tr></table>
13317 !! end
13318
13319 !!test
13320 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13321 !! wikitext
13322 <table><tr>{{echo|<td>}}foo</td></tr></table>
13323 !! html
13324 <table><tr><td>foo</td></tr></table>
13325 !! end
13326
13327 !!test
13328 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13329 !! wikitext
13330 <table><tr><td>foo{{echo|</td>}}</tr></table>
13331 !! html
13332 <table><tr><td>foo</td></tr></table>
13333 !! end
13334
13335 !!test
13336 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13337 !! wikitext
13338 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13339 !! html
13340 <table><tr><td>foo</td></tr></table>
13341 !! end
13342
13343 !!test
13344 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13345 !! wikitext
13346 <table><tr><td>foo</td></tr>{{echo|</table>}}
13347 !! html
13348 <table><tr><td>foo</td></tr></table>
13349 !! end
13350
13351 !!test
13352 Templates: HTML Tables: 5. Proper fostering of categories from inside
13353 !!options
13354 parsoid=wt2html,wt2wt
13355 !! wikitext
13356 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13357 <!--Two categories (T52330)-->
13358 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13359 !! html/php+tidy
13360 <table><tbody><tr><td>foo</td></tr></tbody></table>
13361 <table><tbody><tr><td>foo</td></tr></tbody></table>
13362 !! html/parsoid
13363 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13364 <!--Two categories (T52330)-->
13365 <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>
13366 !!end
13367
13368 ## Remex doesn't account for fostered content.
13369 !! test
13370 Templates: Wiki Tables: 1a. Fostering of entire template content
13371 !! wikitext
13372 {|
13373 {{echo|a}}
13374 |}
13375 !! html/php
13376 <table>
13377 a
13378 <tr><td></td></tr></table>
13379 !! html/php+tidy
13380
13381 a
13382 <table><tbody><tr><td></td></tr></tbody></table>
13383 !! html/parsoid
13384 <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">
13385
13386 </table>
13387 !! end
13388
13389 !!test
13390 Templates: Wiki Tables: 1b. Fostering of entire template content
13391 !! wikitext
13392 {|
13393 {{echo|<div>}}
13394 foo
13395 {{echo|</div>}}
13396 |}
13397 !! html
13398 <table>
13399 <div>
13400 <p>foo
13401 </p>
13402 </div>
13403 <tr><td></td></tr></table>
13404 !! html/php+tidy
13405 <div>
13406 <p>foo
13407 </p>
13408 </div><table>
13409
13410 <tbody><tr><td></td></tr></tbody></table>
13411 !! html/parsoid
13412 <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|}"]}'>
13413 <p>foo</p>
13414 </div><table about="#mwt3">
13415
13416 </table>
13417 !! end
13418
13419 ## Remex doesn't account for fostered content.
13420 !! test
13421 Templates: Wiki Tables: 2. Fostering of partial template content
13422 !! wikitext
13423 {|
13424 {{echo|a
13425 <div>b</div>}}
13426 |}
13427 !! html/php
13428 <table>
13429 a
13430 <div>b</div>
13431 <tr><td></td></tr></table>
13432 !! html/php+tidy
13433
13434 a
13435 <div>b</div><table>
13436 <tbody><tr><td></td></tr></tbody></table>
13437 !! html/parsoid
13438 <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">
13439
13440
13441 </table>
13442 !! end
13443
13444 !!test
13445 Templates: Wiki Tables: 3. td-content via multiple templates
13446 !! wikitext
13447 {|
13448 {{echo|{{pipe}}a}}{{echo|b}}
13449 |}
13450 !! html
13451 <table>
13452 <tr>
13453 <td>ab
13454 </td></tr></table>
13455 !! end
13456
13457 !!test
13458 Templates: Wiki Tables: 4. Templated tags, no content
13459 !! wikitext
13460 {{tbl-start}}
13461 {{tbl-end}}
13462 !! html
13463 <table>
13464 <tr><td></td></tr></table>
13465 !! end
13466
13467 !!test
13468 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13469 !! wikitext
13470 {{tbl-start}}
13471 |foo
13472 {{tbl-end}}
13473 !! html
13474 <table>
13475 <tr>
13476 <td>foo
13477 </td></tr></table>
13478 !! end
13479
13480 !!test
13481 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13482 !! wikitext
13483 {{tbl-start}}
13484 {{!}}foo
13485 {{tbl-end}}
13486 !! html
13487 <table>
13488 <tr>
13489 <td>foo
13490 </td></tr></table>
13491 !! end
13492
13493 ## This test case is very specific to Parsoid's internals
13494 ## and is hence only tested for Parsoid's code. Parsoid uses
13495 ## a <meta> marker tag for <ref> tags and they are expanded
13496 ## much later. We are verifying that this <meta> tag usage
13497 ## doesn't prevent foster parenting.
13498 !! test
13499 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13500 !! wikitext
13501 {{PartialTable}}<ref>foo</ref>
13502 |}
13503
13504 <references />
13505 !! html/parsoid
13506 <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">
13507 <tbody>
13508 </tbody></table>
13509
13510 <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>
13511 !! end
13512
13513 !! test
13514 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13515 !! wikitext
13516 {{echo|
13517 {{{!}}
13518 {{!}}-}}
13519 <onlyinclude>
13520 |foo
13521 </onlyinclude>
13522 {{!}}}
13523 !! html/parsoid
13524 <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{{!}}}"]}'>
13525 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13526 <tbody><tr>
13527
13528 <td>foo
13529 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13530 </tbody></table>
13531 !! end
13532
13533 !!test
13534 Templates: Lists: Multi-line list-items via templates
13535 !! wikitext
13536 *{{echo|a {{nonexistent|
13537 unused}}}}
13538 *{{echo|b {{nonexistent|
13539 unused}}}}
13540 !! html
13541 <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>
13542 <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>
13543 !!end
13544
13545 !!test
13546 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13547 !! wikitext
13548 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13549 !! html
13550 <p><i>ab</i>c<i>d</i>e
13551 </p>
13552 !!end
13553
13554 !!test
13555 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13556 (PHP parser generates misnested html)
13557 !! wikitext
13558 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13559 !! html/parsoid
13560 <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>
13561 !!end
13562
13563 !!test
13564 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13565 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13566 !! options
13567 parsoid=wt2html,wt2wt
13568 !! wikitext
13569 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13570 !! html/php+tidy
13571 <div><i>a</i></div><div><i>b</i>c<i>d</i></div><div>e</div>
13572 !! html/parsoid
13573 <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>
13574 <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>
13575 <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>
13576 !!end
13577
13578 !!test
13579 Templates: Ugly nesting: 4. Divs opened/closed across templates
13580 !! wikitext
13581 a<div>b{{echo|c</div>d}}e
13582 !! html
13583 a<div>bc</div>de
13584 !! html+tidy
13585 <p>a</p><div>bc</div><p>de</p>
13586 !! end
13587
13588 !! test
13589 Templates: Ugly templates: 3. newline-only template parameter
13590 !! wikitext
13591 foo {{echo|
13592 }}
13593 !! html
13594 <p>foo
13595 </p>
13596 !! end
13597
13598 # This looks like a bug: a single newline triggers p/br for some reason.
13599 !! test
13600 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13601 !! wikitext
13602 {{echo|
13603 }}
13604 !! html
13605 <p><br />
13606 </p>
13607 !! end
13608
13609 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13610 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13611 !! test
13612 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13613 !! wikitext
13614 {{echo|<table>}}
13615 {{echo|<div>foo}}
13616 {{echo|</table>}}
13617 !! html/parsoid
13618 <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">
13619 </span><table about="#mwt1">
13620 </table>
13621 !! end
13622
13623 # T66017 -- ugly wikitext with fostered content generates two template ranges
13624 # that are "identical" and generate nesting cycles in the algorithm
13625 !! test
13626 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13627 !! wikitext
13628 {{echo|<table><tr><td><table>}}
13629 {{echo|<div>}}
13630 {{echo|</div>}}
13631 !! html/parsoid
13632 <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"}'>
13633 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13634 </table></td></tr></tbody></table>
13635 !! end
13636
13637 !! test
13638 Templates: Parameters substituted at the top-level
13639 !! wikitext
13640 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13641
13642 {{{foo|bar|baz}}}
13643 !! html/php
13644 <p><i>who</i> me? <b>never!</b>
13645 </p><p>bar
13646 </p>
13647 !! html/parsoid
13648 <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>
13649
13650 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13651 !! end
13652
13653 !! test
13654 Templates: Param with empty arg in the final position
13655 !! wikitext
13656 {{{hi|}}}
13657 !! html/parsoid
13658 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13659 !! end
13660
13661 !!test
13662 Parser Functions: 1. Simple example
13663 !! wikitext
13664 {{uc:foo}}
13665 !! html
13666 <p>FOO
13667 </p>
13668 !!end
13669
13670 !!test
13671 Parser Functions: 2. Nested use (only outermost should be marked up)
13672 !! wikitext
13673 {{uc:{{lc:FOO}}}}
13674 !! html
13675 <p>FOO
13676 </p>
13677 !!end
13678
13679 ## Note that the templates inside the references are not wrapped
13680 !! test
13681 Template nested in extension tag in template
13682 !! options
13683 title=[[Main Page]]
13684 language=zh
13685 !! wikitext
13686 {{echo|hi<ref>[[ho|{{echo|hi}}]]</ref>}}
13687 {{echo|hi<ref>[http://test.com?q={{echo|ho}}]</ref>}}
13688 {{echo|hi<ref>-{ho|{{echo|hi}}}-</ref>}}
13689 <references />
13690 !! html/parsoid
13691 <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>
13692 <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>
13693 <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>
13694 <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>
13695 !! end
13696
13697 ###
13698 ### Pre-save transform tests
13699 ###
13700
13701 !! test
13702 pre-save transform: subst:
13703 !! options
13704 pst
13705 !! wikitext
13706 {{subst:test}}
13707 !! html/php
13708 This is a test template
13709 !! end
13710
13711 !! test
13712 pre-save transform: normal template
13713 !! options
13714 pst
13715 !! wikitext
13716 {{test}}
13717 !! html/php
13718 {{test}}
13719 !! end
13720
13721 !! test
13722 pre-save transform: nonexistent template
13723 !! options
13724 pst
13725 !! wikitext
13726 {{thistemplatedoesnotexist}}
13727 !! html/php
13728 {{thistemplatedoesnotexist}}
13729 !! end
13730
13731 !! test
13732 pre-save transform: subst magic variables
13733 !! options
13734 pst
13735 !! wikitext
13736 {{subst:SITENAME}}
13737 !! html/php
13738 MediaWiki
13739 !! end
13740
13741 # This is T2089, which I fixed. -- wtm
13742 !! test
13743 pre-save transform: subst: templates with parameters
13744 !! options
13745 pst
13746 !! wikitext
13747 {{subst:paramtest|param="something else"}}
13748 !! html/php
13749 This is a test template with parameter "something else"
13750 !! end
13751
13752 !! article
13753 Template:nowikitest
13754 !! text
13755 <nowiki>'''not wiki'''</nowiki>
13756 !! endarticle
13757
13758 !! test
13759 pre-save transform: nowiki in subst (T3188)
13760 !! options
13761 pst
13762 !! wikitext
13763 {{subst:nowikitest}}
13764 !! html/php
13765 <nowiki>'''not wiki'''</nowiki>
13766 !! end
13767
13768 !! article
13769 Template:commenttest
13770 !! text
13771 This template has <!-- a comment --> in it.
13772 !! endarticle
13773
13774 !! test
13775 pre-save transform: comment in subst (T3936)
13776 !! options
13777 pst
13778 !! wikitext
13779 {{subst:commenttest}}
13780 !! html/php
13781 This template has <!-- a comment --> in it.
13782 !! end
13783
13784 !! test
13785 pre-save transform: unclosed tag
13786 !! options
13787 pst
13788 !! wikitext
13789 <nowiki>'''not wiki'''
13790 !! html/php
13791 <nowiki>'''not wiki'''
13792 !! end
13793
13794 !! test
13795 pre-save transform: mixed tag case
13796 !! options
13797 pst
13798 !! wikitext
13799 <NOwiki>'''not wiki'''</noWIKI>
13800 !! html/php
13801 <NOwiki>'''not wiki'''</noWIKI>
13802 !! end
13803
13804 !! test
13805 pre-save transform: unclosed comment in <nowiki>
13806 !! options
13807 pst
13808 !! wikitext
13809 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13810 !! html/php
13811 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13812 !!end
13813
13814 # Leading @ in this template definition works around a limitation
13815 # in parsoid's parserTests which otherwise strips the <span> from the
13816 # result (confusing it for a template wrapper)
13817 !! article
13818 Template:dangerous
13819 !!text
13820 @<span onmouseover="alert('crap')">Oh no</span>
13821 !!endarticle
13822
13823 !!test
13824 (confirming safety of fix for subst T3936)
13825 !! wikitext
13826 {{Template:dangerous}}
13827 !! html
13828 <p>@<span>Oh no</span>
13829 </p>
13830 !! end
13831
13832 !! test
13833 pre-save transform: comment containing gallery (T7024)
13834 !! options
13835 pst
13836 !! wikitext
13837 <!-- <gallery>data</gallery> -->
13838 !! html/php
13839 <!-- <gallery>data</gallery> -->
13840 !!end
13841
13842 !! test
13843 pre-save transform: comment containing extension
13844 !! options
13845 pst
13846 !! wikitext
13847 <!-- <tag>data</tag> -->
13848 !! html/php
13849 <!-- <tag>data</tag> -->
13850 !!end
13851
13852 !! test
13853 pre-save transform: comment containing nowiki
13854 !! options
13855 pst
13856 !! wikitext
13857 <!-- <nowiki>data</nowiki> -->
13858 !! html/php
13859 <!-- <nowiki>data</nowiki> -->
13860 !!end
13861
13862 !! test
13863 pre-save transform: <noinclude> in subst (T5298)
13864 !! options
13865 pst
13866 !! wikitext
13867 {{subst:Includes}}
13868 !! html/php
13869 Foobar
13870 !! end
13871
13872 !! test
13873 pre-save transform: <onlyinclude> in subst (T5298)
13874 !! options
13875 pst
13876 !! wikitext
13877 {{subst:Includes2}}
13878 !! html/php
13879 Foo
13880 !! end
13881
13882 !! article
13883 Template:SubstTest
13884 !!text
13885 {{<includeonly>subst:</includeonly>Includes}}
13886 !! endarticle
13887
13888 !! article
13889 Template:SafeSubstTest
13890 !! text
13891 {{<includeonly>safesubst:</includeonly>Includes}}
13892 !! endarticle
13893
13894 !! test
13895 T24297: safesubst: works during PST
13896 !! options
13897 pst
13898 !! wikitext
13899 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13900 !! html/php
13901 FoobarFoobar
13902 !! end
13903
13904 !! test
13905 T24297: safesubst: works during normal parse
13906 !! wikitext
13907 {{SafeSubstTest}}
13908 !! html
13909 <p>Foobar
13910 </p>
13911 !! end
13912
13913 !! test
13914 subst: does not work during normal parse
13915 !! wikitext
13916 {{SubstTest}}
13917 !! html
13918 <p>{{subst:Includes}}
13919 </p>
13920 !! end
13921
13922 !! test
13923 pre-save transform: context links ("pipe trick")
13924 !! options
13925 pst
13926 !! wikitext
13927 [[Article (context)|]]
13928 [[Bar:Article|]]
13929 [[:Bar:Article|]]
13930 [[Bar:Article (context)|]]
13931 [[:Bar:Article (context)|]]
13932 [[|Article]]
13933 [[|Article (context)]]
13934 [[Bar:X (Y) Z|]]
13935 [[:Bar:X (Y) Z|]]
13936 !! html/php
13937 [[Article (context)|Article]]
13938 [[Bar:Article|Article]]
13939 [[:Bar:Article|Article]]
13940 [[Bar:Article (context)|Article]]
13941 [[:Bar:Article (context)|Article]]
13942 [[Article]]
13943 [[Article (context)]]
13944 [[Bar:X (Y) Z|X (Y) Z]]
13945 [[:Bar:X (Y) Z|X (Y) Z]]
13946 !! end
13947
13948 !! test
13949 pre-save transform: context links ("pipe trick") with interwiki prefix
13950 !! options
13951 pst
13952 !! wikitext
13953 [[interwiki:Article|]]
13954 [[:interwiki:Article|]]
13955 [[interwiki:Bar:Article|]]
13956 [[:interwiki:Bar:Article|]]
13957 !! html/php
13958 [[interwiki:Article|Article]]
13959 [[:interwiki:Article|Article]]
13960 [[interwiki:Bar:Article|Bar:Article]]
13961 [[:interwiki:Bar:Article|Bar:Article]]
13962 !! end
13963
13964 !! test
13965 pre-save transform: context links ("pipe trick") with parens in title
13966 !! options
13967 pst title=[[Somearticle (context)]]
13968 !! wikitext
13969 [[|Article]]
13970 !! html/php
13971 [[Article (context)|Article]]
13972 !! end
13973
13974 !! test
13975 pre-save transform: context links ("pipe trick") with comma in title
13976 !! options
13977 pst title=[[Someplace, Somewhere]]
13978 !! wikitext
13979 [[|Otherplace]]
13980 [[Otherplace, Elsewhere|]]
13981 [[Otherplace, Elsewhere, Anywhere|]]
13982 !! html/php
13983 [[Otherplace, Somewhere|Otherplace]]
13984 [[Otherplace, Elsewhere|Otherplace]]
13985 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13986 !! end
13987
13988 !! test
13989 pre-save transform: context links ("pipe trick") with parens and comma
13990 !! options
13991 pst title=[[Someplace (IGNORED), Somewhere]]
13992 !! wikitext
13993 [[|Otherplace]]
13994 [[Otherplace (place), Elsewhere|]]
13995 !! html/php
13996 [[Otherplace, Somewhere|Otherplace]]
13997 [[Otherplace (place), Elsewhere|Otherplace]]
13998 !! end
13999
14000 !! test
14001 pre-save transform: context links ("pipe trick") with comma and parens
14002 !! options
14003 pst title=[[Who, me? (context)]]
14004 !! wikitext
14005 [[|Yes, you.]]
14006 [[Me, Myself, and I (1937 song)|]]
14007 !! html/php
14008 [[Yes, you. (context)|Yes, you.]]
14009 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
14010 !! end
14011
14012 !! test
14013 pre-save transform: context links ("pipe trick") with namespace
14014 !! options
14015 pst title=[[Ns:Somearticle]]
14016 !! wikitext
14017 [[|Article]]
14018 !! html/php
14019 [[Ns:Article|Article]]
14020 !! end
14021
14022 !! test
14023 pre-save transform: context links ("pipe trick") with namespace and parens
14024 !! options
14025 pst title=[[Ns:Somearticle (context)]]
14026 !! wikitext
14027 [[|Article]]
14028 !! html/php
14029 [[Ns:Article (context)|Article]]
14030 !! end
14031
14032 !! test
14033 pre-save transform: context links ("pipe trick") with namespace and comma
14034 !! options
14035 pst title=[[Ns:Somearticle, Context, Whatever]]
14036 !! wikitext
14037 [[|Article]]
14038 !! html/php
14039 [[Ns:Article, Context, Whatever|Article]]
14040 !! end
14041
14042 !! test
14043 pre-save transform: context links ("pipe trick") with namespace, comma and parens
14044 !! options
14045 pst title=[[Ns:Somearticle, Context (context)]]
14046 !! wikitext
14047 [[|Article]]
14048 !! html/php
14049 [[Ns:Article (context)|Article]]
14050 !! end
14051
14052 !! test
14053 pre-save transform: context links ("pipe trick") with namespace, parens and comma
14054 !! options
14055 pst title=[[Ns:Somearticle (IGNORED), Context]]
14056 !! wikitext
14057 [[|Article]]
14058 !! html/php
14059 [[Ns:Article, Context|Article]]
14060 !! end
14061
14062 !! test
14063 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
14064 !! options
14065 pst
14066 !! wikitext
14067 [[Article(context)|]]
14068 [[Bar:Article(context)|]]
14069 [[:Bar:Article(context)|]]
14070 [[|Article(context)]]
14071 [[Bar:X(Y)Z|]]
14072 [[:Bar:X(Y)Z|]]
14073 !! html/php
14074 [[Article(context)|Article]]
14075 [[Bar:Article(context)|Article]]
14076 [[:Bar:Article(context)|Article]]
14077 [[Article(context)]]
14078 [[Bar:X(Y)Z|X(Y)Z]]
14079 [[:Bar:X(Y)Z|X(Y)Z]]
14080 !! end
14081
14082 !! test
14083 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
14084 !! options
14085 pst
14086 !! wikitext
14087 [[Article (context)|]]
14088 [[Bar:Article (context)|]]
14089 [[:Bar:Article (context)|]]
14090 [[|Article (context)]]
14091 [[Bar:X (Y) Z|]]
14092 [[:Bar:X (Y) Z|]]
14093 !! html/php
14094 [[Article (context)|Article]]
14095 [[Bar:Article (context)|Article]]
14096 [[:Bar:Article (context)|Article]]
14097 [[Article (context)]]
14098 [[Bar:X (Y) Z|X (Y) Z]]
14099 [[:Bar:X (Y) Z|X (Y) Z]]
14100 !! end
14101
14102 !! test
14103 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
14104 !! options
14105 pst
14106 !! wikitext
14107 [[Article(context)|]]
14108 [[Bar:Article(context)|]]
14109 [[:Bar:Article(context)|]]
14110 [[|Article(context)]]
14111 [[Bar:X(Y)Z|]]
14112 [[:Bar:X(Y)Z|]]
14113 !! html/php
14114 [[Article(context)|Article]]
14115 [[Bar:Article(context)|Article]]
14116 [[:Bar:Article(context)|Article]]
14117 [[Article(context)]]
14118 [[Bar:X(Y)Z|X(Y)Z]]
14119 [[:Bar:X(Y)Z|X(Y)Z]]
14120 !! end
14121
14122 !! test
14123 pre-save transform: context links ("pipe trick") with commas (T23660)
14124 !! options
14125 pst
14126 !! wikitext
14127 [[Article (context), context|]]
14128 [[Article (context),context|]]
14129 [[Bar:Article (context), context|]]
14130 [[Bar:Article (context),context|]]
14131 [[:Bar:Article (context), context|]]
14132 [[:Bar:Article (context),context|]]
14133 !! html/php
14134 [[Article (context), context|Article]]
14135 [[Article (context),context|Article]]
14136 [[Bar:Article (context), context|Article]]
14137 [[Bar:Article (context),context|Article]]
14138 [[:Bar:Article (context), context|Article]]
14139 [[:Bar:Article (context),context|Article]]
14140 !! end
14141
14142 !! test
14143 Parsoid: backwards pipe trick
14144 !! wikitext
14145 [[|'''bar''']]
14146 !! html/php
14147 <p>[[|<b>bar</b>]]
14148 </p>
14149 !! html/parsoid
14150 <p>[[|<b>bar</b>]]</p>
14151 !! end
14152
14153 !! test
14154 pre-save transform: trim trailing empty lines
14155 !! options
14156 pst
14157 !! wikitext
14158 Empty lines are trimmed
14159
14160
14161
14162
14163 !! html/php
14164 Empty lines are trimmed
14165 !! end
14166
14167 !! test
14168 pre-save transform: Signature expansion
14169 !! options
14170 pst
14171 !! wikitext
14172 * ~~~
14173 * ~~~~
14174 * ~~~~~
14175 * <noinclude>~~~</noinclude>
14176 * <includeonly>~~~</includeonly>
14177 * <onlyinclude>~~~</onlyinclude>
14178 !! html/php
14179 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
14180 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14181 * 00:02, 1 January 1970 (UTC)
14182 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
14183 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
14184 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
14185 !! end
14186
14187
14188 !! test
14189 ParserOutput flags from signature expansion (T84843)
14190 !! options
14191 pst
14192 showflags
14193 !! wikitext
14194 ~~~~
14195 !! html/php
14196 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14197 flags=user-signature
14198 !! end
14199
14200
14201 !! test
14202 pre-save transform: Signature expansion in nowiki tags (T2093)
14203 !! options
14204 pst disabled
14205 !! wikitext
14206 Shall not expand:
14207
14208 <nowiki>~~~~</nowiki>
14209
14210 <includeonly><nowiki>~~~~</nowiki></includeonly>
14211
14212 <noinclude><nowiki>~~~~</nowiki></noinclude>
14213
14214 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14215
14216 {{subst:Foo}} shall be converted to FOO
14217
14218 As well as inside noinclude/onlyinclude
14219 <noinclude>{{subst:Foo}}</noinclude>
14220 <onlyinclude>{{subst:Foo}}</onlyinclude>
14221
14222 But not inside includeonly
14223 <includeonly>{{subst:Foo}}</includeonly>
14224 !! html/php
14225 Shall not expand:
14226
14227 <nowiki>~~~~</nowiki>
14228
14229 <includeonly><nowiki>~~~~</nowiki></includeonly>
14230
14231 <noinclude><nowiki>~~~~</nowiki></noinclude>
14232
14233 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14234
14235 FOO shall be converted to FOO
14236
14237 As well as inside noinclude/onlyinclude
14238 <noinclude>FOO</noinclude>
14239 <onlyinclude>FOO</onlyinclude>
14240
14241 But not inside includeonly
14242 <includeonly>{{subst:Foo}}</includeonly>
14243 !! end
14244
14245 !! test
14246 Parsoid: Recognize nowiki with trailing space in tags
14247 !! options
14248 parsoid=wt2html
14249 !! wikitext
14250 <nowiki ><div>[[foo]]</nowiki >
14251
14252 a<nowiki / >b
14253
14254 c<nowiki />d
14255
14256 e<nowiki/ >f
14257 !! html/php+tidy
14258 <p>&lt;div&gt;[[foo]]
14259 </p><p>a&lt;nowiki / &gt;b
14260 </p><p>cd
14261 </p><p>e&lt;nowiki/ &gt;f
14262 </p>
14263 !! html/parsoid
14264 <p><span typeof="mw:Nowiki">&lt;div>[[foo]]</span></p>
14265
14266 <p>a&lt;nowiki / >b</p>
14267
14268 <p>c<span typeof="mw:Nowiki"></span>d</p>
14269
14270 <p>e&lt;nowiki/ >f</p>
14271 !! end
14272
14273 !! test
14274 Parsoid: Recognize nowiki with odd capitalization
14275 !! options
14276 parsoid=wt2html
14277 !! wikitext
14278 <noWikI ><div>[[foo]]</Nowiki >
14279 !! html/php+tidy
14280 <p>&lt;div&gt;[[foo]]
14281 </p>
14282 !! html/parsoid
14283 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14284 !! end
14285
14286
14287 !! test
14288 Parsoid: Escape nowiki with trailing space in tags
14289 !! options
14290 parsoid=html2wt
14291 !! html/parsoid
14292 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14293 <p>a&lt;nowiki /&gt;b</p>
14294 <p>c&lt;nowiki/ &gt;d</p>
14295 !! wikitext
14296 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14297
14298 a&lt;nowiki /&gt;b
14299
14300 c&lt;nowiki/ &gt;d
14301 !! end
14302
14303 !! test
14304 Parsoid: Escape weird noWikI capitalizations
14305 !! options
14306 parsoid=html2wt
14307 !! html/parsoid
14308 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14309 !! wikitext
14310 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14311 !! end
14312
14313 ###
14314 ### Message transform tests
14315 ###
14316 !! test
14317 message transform: magic variables
14318 !! options
14319 msg
14320 !! wikitext
14321 {{SITENAME}}
14322 !! html
14323 MediaWiki
14324 !! end
14325
14326 !! test
14327 message transform: should not transform wiki markup
14328 !! options
14329 msg
14330 !! wikitext
14331 ''test''
14332 !! html
14333 ''test''
14334 !! end
14335
14336 !! test
14337 message transform: <noinclude> in transcluded template (T6926)
14338 !! options
14339 msg
14340 !! wikitext
14341 {{Includes}}
14342 !! html
14343 Foobar
14344 !! end
14345
14346 !! test
14347 message transform: <onlyinclude> in transcluded template (T6926)
14348 !! options
14349 msg
14350 !! wikitext
14351 {{Includes2}}
14352 !! html
14353 Foo
14354 !! end
14355
14356 !! test
14357 {{#special:}} page name, known
14358 !! options
14359 msg
14360 !! wikitext
14361 {{#special:Recentchanges}}
14362 !! html
14363 Special:RecentChanges
14364 !! end
14365
14366 !! test
14367 {{#special:}} page name with subpage, known
14368 !! options
14369 msg
14370 !! wikitext
14371 {{#special:Recentchanges/param}}
14372 !! html
14373 Special:RecentChanges/param
14374 !! end
14375
14376 !! test
14377 {{#special:}} page name, unknown
14378 !! options
14379 msg
14380 !! wikitext
14381 {{#special:foobar nonexistent}}
14382 !! html
14383 Special:Foobar nonexistent
14384 !! end
14385
14386 !! test
14387 {{#speciale:}} page name, known
14388 !! options
14389 msg
14390 !! wikitext
14391 {{#speciale:Recentchanges}}
14392 !! html
14393 Special:RecentChanges
14394 !! end
14395
14396 !! test
14397 {{#speciale:}} page name with subpage, known
14398 !! options
14399 msg
14400 !! wikitext
14401 {{#speciale:Recentchanges/param}}
14402 !! html
14403 Special:RecentChanges/param
14404 !! end
14405
14406 !! test
14407 {{#speciale:}} page name, unknown
14408 !! options
14409 msg
14410 !! wikitext
14411 {{#speciale:foobar nonexistent}}
14412 !! html
14413 Special:Foobar_nonexistent
14414 !! end
14415
14416 ###
14417 ### Images
14418 ###
14419 ### For Parsoid-specific tests, see
14420 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14421
14422 !! test
14423 Simple image
14424 !! options
14425 parsoid=wt2html,wt2wt,html2html
14426 !! wikitext
14427 [[Image:foobar.jpg]]
14428 !! html/php
14429 <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>
14430 </p>
14431 !! html/parsoid
14432 <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>
14433 !! end
14434
14435 !! test
14436 Serialize simple image with span wrapper
14437 !! options
14438 parsoid=html2wt
14439 !! html/parsoid
14440 <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>
14441 !! wikitext
14442 [[File:Foobar.jpg]]
14443 !! end
14444
14445 !! test
14446 Simple image (using File: namespace, now canonical)
14447 !! wikitext
14448 [[File:Foobar.jpg]]
14449 !! html/php
14450 <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>
14451 </p>
14452 !! html/parsoid
14453 <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>
14454 !! end
14455
14456 !! test
14457 Right-aligned image
14458 !! wikitext
14459 [[File:Foobar.jpg|right]]
14460 !! html/php
14461 <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>
14462 !! html/parsoid
14463 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14464 !! end
14465
14466 !! test
14467 Image with caption
14468 !! wikitext
14469 [[File:Foobar.jpg|right|Caption text]]
14470 !! html/php
14471 <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>
14472 !! html/parsoid
14473 <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>
14474 !! end
14475
14476 !! test
14477 Image with caption, T55312 #1
14478 !! wikitext
14479 [[File:Foobar.jpg|right|Caption page stuff]]
14480 !! html/php
14481 <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>
14482 !! html/parsoid
14483 <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>
14484 !! end
14485
14486 !! test
14487 Image with caption, T55312 #2
14488 !! wikitext
14489 [[File:Foobar.jpg|right|Caption page=]]
14490 !! html/php
14491 <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>
14492 !! html/parsoid
14493 <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>
14494 !! end
14495
14496 !! test
14497 Image with caption, T55312 #3
14498 !! wikitext
14499 [[File:Foobar.jpg|right|Caption page=stuff]]
14500 !! html/php
14501 <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>
14502 !! html/parsoid
14503 <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>
14504 !! end
14505
14506 !! test
14507 Image caption with pipe entity
14508 !! wikitext
14509 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14510 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14511 !! html/php
14512 <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>
14513 <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>
14514 !! html/parsoid
14515 <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>
14516 <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>
14517 !! end
14518
14519 !! test
14520 Allow empty links in image captions (T62753)
14521 !! options
14522 thumbsize=220
14523 !! wikitext
14524 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14525 [[]]
14526 [[Link2]]
14527 ]]
14528 !! html/php
14529 <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>
14530 !! html/parsoid
14531 <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>
14532 [[]]
14533 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14534 </figcaption></figure>
14535 !! end
14536
14537 !! test
14538 Titles in unlinked images (T23454)
14539 !! wikitext
14540 [[File:Foobar.jpg|link=|stuff]]
14541 !! html/php
14542 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" title="stuff" width="1941" height="220" />
14543 </p>
14544 !! html/parsoid
14545 <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>
14546 !! end
14547
14548 !! test
14549 Link with empty target
14550 !! wikitext
14551 [[]]
14552 !! html
14553 <p>[[]]
14554 </p>
14555 !! end
14556
14557 !! test
14558 Image with link trail
14559 !! wikitext
14560 Linktrails should not work for images: [[File:Foobar.jpg]]s
14561 !! html/php
14562 <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
14563 </p>
14564 !! html/parsoid
14565 <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>
14566 !! end
14567
14568 !! test
14569 Image with empty attribute
14570 !! options
14571 parsoid=wt2html,wt2wt,html2html
14572 !! wikitext
14573 [[File:Foobar.jpg|right||Caption text]]
14574 !! html/php
14575 <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>
14576 !! html/parsoid
14577 <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>
14578 !! end
14579
14580 !! test
14581 1. Block image with individual attributes from templates
14582 !! wikitext
14583 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14584 !! html/php
14585 <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>
14586 !! html/parsoid
14587 <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":[["thumbnail",{"html":"thumb"}],["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>
14588 !! end
14589
14590 !! test
14591 2. Block Image with individual attributes from templates
14592 !! wikitext
14593 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14594 !! html/php
14595 <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>
14596 !! html/parsoid
14597 <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>
14598 !! end
14599
14600 !! test
14601 3. Inline image with individual attributes from templates
14602 !! wikitext
14603 [[File:Foobar.jpg|{{echo|50px}}]]
14604 !! html/php
14605 <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>
14606 </p>
14607 !! html/parsoid
14608 <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>
14609 !! end
14610
14611 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14612 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14613 !! test
14614 Image with multiple attributes from the same template
14615 !! wikitext
14616 [[File:Foobar.jpg|{{image_attribs}}]]
14617 !! html/php
14618 <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>
14619 !! html/parsoid
14620 <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>
14621 !! end
14622
14623 !! test
14624 Image with link tails
14625 !! options
14626 thumbsize=220
14627 !! wikitext
14628 123[[File:Foobar.jpg]]456
14629 123[[File:Foobar.jpg|right]]456
14630 123[[File:Foobar.jpg|thumb]]456
14631 !! html/php
14632 <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
14633 </p>
14634 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
14635 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
14636 !! html/php+tidy
14637 <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
14638 </p><p>
14639 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
14640 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>
14641 !! html/parsoid
14642 <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>
14643 <p>123</p><figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure><p>456
14644 123</p><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure><p>456</p>
14645 !! end
14646
14647 !! test
14648 Image with multiple captions -- only last one is accepted
14649 !! wikitext
14650 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14651 !! html/php
14652 <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>
14653 !! html/parsoid
14654 <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>
14655 !! end
14656
14657 !! test
14658 Image with multiple widths -- use last
14659 !! wikitext
14660 [[File:Foobar.jpg|200px|300px|caption]]
14661 !! html/php
14662 <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>
14663 </p>
14664 !! html/parsoid
14665 <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>
14666 !! end
14667
14668 !! test
14669 Image with multiple alignments -- use first (T50664)
14670 !! options
14671 thumbsize=220
14672 !! wikitext
14673 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14674
14675 [[File:Foobar.jpg|middle|text-top|caption]]
14676 !! html/php
14677 <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>
14678 <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>
14679 </p>
14680 !! html/parsoid
14681 <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>
14682 <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>
14683 !! end
14684
14685 !! test
14686 Image with width attribute at different positions
14687 !! wikitext
14688 [[File:Foobar.jpg|200px|right|Caption]]
14689 [[File:Foobar.jpg|right|200px|Caption]]
14690 [[File:Foobar.jpg|right|Caption|200px]]
14691 !! html/php
14692 <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>
14693 <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>
14694 <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>
14695 !! html/parsoid
14696 <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>
14697 <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>
14698 <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>
14699 !! end
14700
14701 # a sad bit of backward-compatibility
14702 !! test
14703 Image with size specified with pxpx (T15500, T53628)
14704 !! options
14705 parsoid=wt2html,wt2wt,html2html
14706 !! wikitext
14707 [[File:Foobar.jpg|20pxpx]]
14708 [[File:Foobar.jpg|200x20pxpx]]
14709 !! html/php
14710 <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>
14711 <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>
14712 </p>
14713 !! html/parsoid
14714 <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>
14715 !! end
14716
14717 !! test
14718 Image with link parameter, wiki target
14719 !! wikitext
14720 [[File:Foobar.jpg|link=Main Page]]
14721 !! html/php
14722 <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>
14723 </p>
14724 !! html/parsoid
14725 <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>
14726 !! end
14727
14728 # parsoid T51293 (part 1)
14729 !! test
14730 Image with link parameter, URL target
14731 !! wikitext
14732 [[File:Foobar.jpg|link=http://example.com/]]
14733 !! html/php
14734 <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>
14735 </p>
14736 !! html/parsoid
14737 <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>
14738 !! end
14739
14740 # parsoid T51293 (part 2)
14741 !! test
14742 Image with link parameter, protocol-less URL target
14743 !! wikitext
14744 [[File:Foobar.jpg|link=//example.com/]]
14745 !! html/php
14746 <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>
14747 </p>
14748 !! html/parsoid
14749 <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>
14750 !! end
14751
14752 !! test
14753 Escaping non-block captions (T107435)
14754 !! options
14755 parsoid={
14756 "modes": ["wt2wt"],
14757 "changes": [
14758 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14759 ]
14760 }
14761 !! wikitext
14762 [[Image:Foobar.jpg|caption]]
14763 !! wikitext/edited
14764 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14765 !! end
14766
14767 # wgExternalLinkTarget not supported by Parsoid
14768 !! test
14769 Image with link parameter, wgExternalLinkTarget
14770 !! wikitext
14771 [[Image:foobar.jpg|link=http://example.com/]]
14772 !! config
14773 wgExternalLinkTarget='foobar'
14774 !! html/php
14775 <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>
14776 </p>
14777 !! end
14778
14779 !! test
14780 Image with link parameter, wgNoFollowLinks set to false
14781 !! wikitext
14782 [[Image:foobar.jpg|link=http://example.com/]]
14783 !! config
14784 wgNoFollowLinks=false
14785 !! html/php
14786 <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>
14787 </p>
14788 !! end
14789
14790 !! test
14791 Image with link parameter, wgNoFollowDomainExceptions
14792 !! wikitext
14793 [[Image:foobar.jpg|link=http://example.com/]]
14794 !! config
14795 wgNoFollowDomainExceptions='example.com'
14796 !! html/php
14797 <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>
14798 </p>
14799 !! end
14800
14801 # wgExternalLinkTarget not supported by Parsoid
14802 !! test
14803 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14804 !! wikitext
14805 [[Image:foobar.jpg|link=http://example.com/|Title]]
14806 !! config
14807 wgExternalLinkTarget='foobar'
14808 !! html/php
14809 <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>
14810 </p>
14811 !! end
14812
14813 !! test
14814 Image with empty link parameter
14815 !! wikitext
14816 [[File:Foobar.jpg|link=]]
14817 !! html/php
14818 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" />
14819 </p>
14820 !! html/parsoid
14821 <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>
14822 !! end
14823
14824 !! test
14825 Image with link parameter (wiki target) and unnamed parameter
14826 !! wikitext
14827 [[File:Foobar.jpg|link=Main_Page|Title]]
14828 !! html/php
14829 <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>
14830 </p>
14831 !! html/parsoid
14832 <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>
14833 !! end
14834
14835 !! test
14836 Image with link parameter (URL target) and unnamed parameter
14837 !! wikitext
14838 [[File:Foobar.jpg|link=http://example.com/|Title]]
14839 !! html/php
14840 <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>
14841 </p>
14842 !! html/parsoid
14843 <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>
14844 !! end
14845
14846 !! test
14847 Thumbnail image with link parameter
14848 !! options
14849 thumbsize=220
14850 parsoid=wt2html,wt2wt,html2html
14851 !! wikitext
14852 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14853 !! html/php
14854 <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>
14855 !! html/parsoid
14856 <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>
14857 !! end
14858
14859 !! test
14860 Manually-specified thumbnail image
14861 !! options
14862 thumbsize=220
14863 !! wikitext
14864 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14865 !! html/php
14866 <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>
14867 !! html/parsoid
14868 <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>
14869 !! end
14870
14871 !! test
14872 Manually-specified thumbnail image with explicit link to wiki page
14873 !! options
14874 thumbsize=220
14875 parsoid=wt2html,wt2wt,html2html
14876 !! wikitext
14877 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14878 !! html/php
14879 <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>
14880 !! html/parsoid
14881 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14882 !! end
14883
14884 !! test
14885 Manually-specified thumbnail image with explicit link to url
14886 !! options
14887 thumbsize=220
14888 parsoid=wt2html,wt2wt,html2html
14889 !! wikitext
14890 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14891 !! html/php
14892 <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>
14893 !! html/parsoid
14894 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="http://example.com"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14895 !! end
14896
14897 !! test
14898 Manually-specified thumbnail image with explicit no link
14899 !! options
14900 thumbsize=220
14901 parsoid=wt2html,wt2wt,html2html
14902 !! wikitext
14903 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14904 !! html/php
14905 <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>
14906 !! html/parsoid
14907 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
14908 !! end
14909
14910 !! test
14911 Manually-specified thumbnail image with explicit link and alt text
14912 !! options
14913 thumbsize=220
14914 parsoid=wt2html,wt2wt,html2html
14915 !! wikitext
14916 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14917 !! html/php
14918 <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>
14919 !! html/parsoid
14920 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./Main_Page"><img alt="alttext" resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14921 !! end
14922
14923 !! test
14924 Image with frame and link
14925 !! options
14926 parsoid=wt2html,wt2wt,html2html
14927 !! wikitext
14928 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14929 !! html/php
14930 <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>
14931 !! html/parsoid
14932 <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>
14933 !! end
14934
14935 !! test
14936 Image with frame and link and explicit alt
14937 !! options
14938 parsoid=wt2html,wt2wt,html2html
14939 !! wikitext
14940 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14941 !! html/php
14942 <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>
14943 !! html/parsoid
14944 <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>
14945 !! end
14946
14947 !! test
14948 Image with wiki markup in implicit alt
14949 !! wikitext
14950 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14951
14952 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14953 !! html/php
14954 <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>
14955 </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>
14956 </p>
14957 !! html/parsoid
14958 <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>
14959
14960 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><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":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></figure-inline></p>
14961 !! end
14962
14963 !! test
14964 Alt image option should handle most kinds of wikitext without barfing
14965 !! wikitext
14966 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14967 !! html/php
14968 <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>
14969 !! html/parsoid
14970 <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":[["thumbnail",{"html":"thumb"}],["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}}]}&#39;>bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
14971 !! end
14972
14973 !! test
14974 Ampersand in alt attribute (T206940)
14975 !! options
14976 parsoid = {
14977 "nativeGallery": true
14978 }
14979 !! wikitext
14980 [[File:Foobar.jpg|alt=&amp;amp;]]
14981
14982 <!-- consistency with gallery extension -->
14983 <gallery>
14984 File:Foobar.jpg|alt=&amp;amp;
14985 </gallery>
14986 !! html/php+tidy
14987 <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>
14988 </p>
14989 <ul class="gallery mw-gallery-traditional">
14990 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14991 <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>
14992 <div class="gallerytext">
14993 </div>
14994 </div></li>
14995 </ul>
14996 !! html/parsoid
14997 <p><figure-inline class="mw-default-size" typeof="mw:Image"><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>
14998
14999 <!-- consistency with gallery extension -->
15000 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15001 <li class="gallerybox">
15002 <div class="thumb"><figure-inline typeof="mw:Image"><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>
15003 <div class="gallerytext"></div>
15004 </li>
15005 </ul>
15006 !! end
15007
15008 !! test
15009 Italics markup in alt attribute (T206940)
15010 !! wikitext
15011 [[File:Foobar.jpg|alt=''x''|caption]]
15012
15013 <!-- consistency with gallery extension -->
15014 <gallery>
15015 File:Foobar.jpg|alt=''x''|caption
15016 </gallery>
15017 !! html/php+tidy
15018 <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>
15019 </p>
15020 <ul class="gallery mw-gallery-traditional">
15021 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15022 <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>
15023 <div class="gallerytext">
15024 <p>caption
15025 </p>
15026 </div>
15027 </div></li>
15028 </ul>
15029 !! html/parsoid
15030 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=&apos;&apos;x&apos;&apos;"},{"ck":"caption","ak":"caption"}]}' data-mw='{"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" data-parsoid='{"a":{"alt":"x","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=&apos;&apos;x&apos;&apos;","resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15031
15032 <!-- consistency with gallery extension -->
15033 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|alt=&apos;&apos;x&apos;&apos;|caption\n"}}'>
15034 <li class="gallerybox">
15035 <div class="thumb"><figure-inline typeof="mw:Image"><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>
15036 <div class="gallerytext">caption</div>
15037 </li>
15038 </ul>
15039 !! end
15040
15041 !! test
15042 Nowiki markup in alt attribute (T206940)
15043 !! wikitext
15044 [[File:Foobar.jpg|alt=<nowiki>''</nowiki>x<nowiki>''</nowiki>|caption]]
15045
15046 <!-- consistency with gallery extension -->
15047 <gallery>
15048 File:Foobar.jpg|alt=<nowiki>''</nowiki>x<nowiki>''</nowiki>|caption
15049 </gallery>
15050 !! html/php+tidy
15051 <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>
15052 </p>
15053 <ul class="gallery mw-gallery-traditional">
15054 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15055 <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>
15056 <div class="gallerytext">
15057 <p>caption
15058 </p>
15059 </div>
15060 </div></li>
15061 </ul>
15062 !! html/parsoid
15063 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=&lt;nowiki>&apos;&apos;&lt;/nowiki>x&lt;nowiki>&apos;&apos;&lt;/nowiki>"},{"ck":"caption","ak":"caption"}],"dsr":[0,71,null,null]}' data-mw='{"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" data-parsoid='{"a":{"alt":"&apos;&apos;x&apos;&apos;","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=&lt;nowiki>&apos;&apos;&lt;/nowiki>x&lt;nowiki>&apos;&apos;&lt;/nowiki>","resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15064
15065 <!-- consistency with gallery extension -->
15066 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" 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"}}'>
15067 <li class="gallerybox">
15068 <div class="thumb"><figure-inline typeof="mw:Image"><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>
15069 <div class="gallerytext">caption</div>
15070 </li>
15071 </ul>
15072 !! end
15073
15074 !! test
15075 Nowiki markup in alt attribute (edited html, no data-parsoid) (T206940)
15076 !! options
15077 parsoid = {
15078 "nativeGallery": true
15079 }
15080 !! wikitext
15081 [[File:Foobar.jpg|alt=<nowiki>''x''</nowiki>|caption]]
15082
15083 <!-- consistency with gallery extension -->
15084 <gallery>
15085 File:Foobar.jpg|alt=<nowiki>''x''</nowiki>|caption
15086 </gallery>
15087 !! html/php+tidy
15088 <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>
15089 </p>
15090 <ul class="gallery mw-gallery-traditional">
15091 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15092 <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>
15093 <div class="gallerytext">
15094 <p>caption
15095 </p>
15096 </div>
15097 </div></li>
15098 </ul>
15099 !! html/parsoid
15100 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"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>
15101
15102 <!-- consistency with gallery extension -->
15103 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15104 <li class="gallerybox">
15105 <div class="thumb"><figure-inline typeof="mw:Image"><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>
15106 <div class="gallerytext">caption</div>
15107 </li>
15108 </ul>
15109 !! end
15110
15111 !! test
15112 Ampersand in link attribute (T206940)
15113 !! wikitext
15114 [[File:Foobar.jpg|link=Foo &amp; bar]]
15115
15116 <!-- consistency with gallery extension -->
15117 <gallery>
15118 File:Foobar.jpg|link=Foo &amp; bar
15119 </gallery>
15120 !! html/php+tidy
15121 <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>
15122 </p>
15123 <ul class="gallery mw-gallery-traditional">
15124 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15125 <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>
15126 <div class="gallerytext">
15127 </div>
15128 </div></li>
15129 </ul>
15130 !! html/parsoid
15131 <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>
15132
15133 <!-- consistency with gallery extension -->
15134 <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"}}'>
15135 <li class="gallerybox">
15136 <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>
15137 <div class="gallerytext"></div>
15138 </li>
15139 </ul>
15140 !! end
15141
15142 !! test
15143 Ampersand in link attribute (edited html, no data-parsoid) (T206940)
15144 !! options
15145 parsoid = {
15146 "nativeGallery": true
15147 }
15148 !! wikitext
15149 [[File:Foobar.jpg|link=Foo_&_bar]]
15150
15151 <!-- consistency with gallery extension -->
15152 <gallery>
15153 File:Foobar.jpg|link=Foo_&_bar
15154 </gallery>
15155 !! html/php+tidy
15156 <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>
15157 </p>
15158 <ul class="gallery mw-gallery-traditional">
15159 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15160 <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>
15161 <div class="gallerytext">
15162 </div>
15163 </div></li>
15164 </ul>
15165 !! html/parsoid
15166 <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>
15167
15168 <!-- consistency with gallery extension -->
15169 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15170 <li class="gallerybox">
15171 <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>
15172 <div class="gallerytext"></div>
15173 </li>
15174 </ul>
15175 !! end
15176
15177 !! test
15178 Italics markup in link attribute (T206940)
15179 !! wikitext
15180 [[Foo''s bar''s]]
15181
15182 <!-- Note that "italics" are stripped, even though this is a valid page title -->
15183 [[File:Foobar.jpg|link=Foo''s bar''s|caption1]]
15184
15185 [[File:Foobar.jpg|link=''Main Page''|caption2]]
15186
15187 <!-- consistency with gallery extension -->
15188 <gallery>
15189 File:Foobar.jpg|link=Foo''s bar''s|caption1
15190 File:Foobar.jpg|link=''Main Page''|caption2
15191 </gallery>
15192 !! html/php+tidy
15193 <p><a href="/wiki/Foo%27%27s_bar%27%27s" title="Foo&#39;&#39;s bar&#39;&#39;s">Foo''s bar''s</a>
15194 </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>
15195 </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>
15196 </p>
15197 <ul class="gallery mw-gallery-traditional">
15198 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15199 <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>
15200 <div class="gallerytext">
15201 <p>caption1
15202 </p>
15203 </div>
15204 </div></li>
15205 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15206 <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>
15207 <div class="gallerytext">
15208 <p>caption2
15209 </p>
15210 </div>
15211 </div></li>
15212 </ul>
15213 !! html/parsoid
15214 <p><a rel="mw:WikiLink" href="./Foo''s_bar''s" title="Foo''s bar''s">Foo''s bar''s</a></p>
15215
15216 <!-- Note that "italics" are stripped, even though this is a valid page title -->
15217 <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>
15218
15219 <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>
15220
15221 <!-- consistency with gallery extension -->
15222 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|link=Foo&apos;&apos;s bar&apos;&apos;s|caption1\nFile:Foobar.jpg|link=&apos;&apos;Main Page&apos;&apos;|caption2\n"}}'>
15223 <li class="gallerybox">
15224 <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>
15225 <div class="gallerytext">caption1</div>
15226 </li>
15227 <li class="gallerybox">
15228 <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>
15229 <div class="gallerytext">caption2</div>
15230 </li>
15231 </ul>
15232 !! end
15233
15234 !! test
15235 Nowiki markup in link attribute (T206940)
15236 !! wikitext
15237 [[File:Foobar.jpg|link=Foo<nowiki>''</nowiki>s_bar<nowiki>''</nowiki>s|caption]]
15238
15239 <!-- consistency with gallery extension -->
15240 <gallery>
15241 File:Foobar.jpg|link=Foo<nowiki>''</nowiki>s_bar<nowiki>''</nowiki>s|caption
15242 </gallery>
15243 !! html/php+tidy
15244 <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>
15245 </p>
15246 <ul class="gallery mw-gallery-traditional">
15247 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15248 <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>
15249 <div class="gallerytext">
15250 <p>caption
15251 </p>
15252 </div>
15253 </div></li>
15254 </ul>
15255 !! html/parsoid
15256 <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>
15257
15258 <!-- consistency with gallery extension -->
15259 <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"}}'>
15260 <li class="gallerybox">
15261 <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>
15262 <div class="gallerytext">caption</div>
15263 </li>
15264 </ul>
15265 !! end
15266
15267 !! test
15268 Nowiki markup in link attribute (edited html, no data-parsoid) (T206940)
15269 !! options
15270 parsoid = {
15271 "nativeGallery": true
15272 }
15273 !! wikitext
15274 [[File:Foobar.jpg|link=Foo<nowiki>''s_bar''</nowiki>s|caption]]
15275
15276 <!-- consistency with gallery extension -->
15277 <gallery>
15278 File:Foobar.jpg|link=Foo<nowiki>''s_bar''</nowiki>s|caption
15279 </gallery>
15280 !! html/php+tidy
15281 <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>
15282 </p>
15283 <ul class="gallery mw-gallery-traditional">
15284 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15285 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
15286 <div class="gallerytext">
15287 <p>caption
15288 </p>
15289 </div>
15290 </div></li>
15291 </ul>
15292 !! html/parsoid
15293 <p><figure-inline class="mw-default-size" typeof="mw:Image" 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>
15294
15295 <!-- consistency with gallery extension -->
15296 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15297 <li class="gallerybox">
15298 <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>
15299 <div class="gallerytext">caption</div>
15300 </li>
15301 </ul>
15302 !! end
15303
15304 !! test
15305 HTML entity prefix in link markup (T209236)
15306 !! wikitext
15307 [[File:Foobar.jpg|link=https://example.com?foo&params=bar]]
15308
15309 <!-- consistency with gallery extension -->
15310 <gallery>
15311 File:Foobar.jpg|link=https://example.com?foo&params=bar
15312 </gallery>
15313 !! html/php+tidy
15314 <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>
15315 </p>
15316 <ul class="gallery mw-gallery-traditional">
15317 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15318 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="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>
15319 <div class="gallerytext">
15320 </div>
15321 </div></li>
15322 </ul>
15323 !! html/parsoid
15324 <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>
15325
15326 <!-- consistency with gallery extension -->
15327 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|link=https://example.com?foo&amp;params=bar\n"}}'>
15328 <li class="gallerybox">
15329 <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>
15330 <div class="gallerytext"></div>
15331 </li>
15332 </ul>
15333 !! end
15334
15335 !! test
15336 Image with table with attributes in caption
15337 !! options
15338 parsoid=wt2html,html2html
15339 !! wikitext
15340 [[File:Foobar.jpg|thumb|
15341 {| class="123" |
15342 |- class="456" |
15343 | ha
15344 |}
15345 ]]
15346 !! html/parsoid
15347 <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>
15348 <table class="123">
15349 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
15350 <td> ha</td></tr>
15351 </tbody></table>
15352 </figcaption></figure>
15353 !! end
15354
15355 !! test
15356 Image with table with rows from templates in caption
15357 !! wikitext
15358 [[File:Foobar.jpg|thumb|
15359 {|
15360 {{echo|{{!}} hi}}
15361 |}
15362 ]]
15363 !! html/parsoid
15364 <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>
15365 <table>
15366 <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>
15367 </tbody></table>
15368 </figcaption></figure>
15369 !! end
15370
15371 !! test
15372 Image with nested tables in caption
15373 !! wikitext
15374 [[File:Foobar.jpg|thumb|Foo<br />
15375 {|
15376 |
15377 {|
15378 |z
15379 |}
15380 |}
15381 ]]
15382 !! html/parsoid
15383 <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}'/>
15384 <table>
15385 <tbody><tr><td>
15386 <table>
15387 <tbody><tr><td>z</td></tr>
15388 </tbody></table></td></tr>
15389 </tbody></table>
15390 </figcaption></figure>
15391 !! end
15392
15393 !! test
15394 Image with heading and horizontal rule in caption
15395 !! wikitext
15396 [[File:Foobar.jpg|thumb|
15397 ===Testing===
15398 123
15399 --------------
15400 ]]
15401 !! html/php
15402 <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>
15403 !! html/parsoid
15404 <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>
15405 <h3 id="Testing">Testing</h3>
15406 123
15407 <hr data-parsoid='{"extra_dashes":10}'/>
15408 </figcaption></figure>
15409 !! end
15410
15411 ###################
15412 # Conflicting image format options.
15413 # First option specified should 'win'.
15414 # All three cases in each test should be identical.
15415
15416 !! test
15417 Image with 'frameless' first.
15418 !! options
15419 parsoid=wt2html,wt2wt,html2html
15420 !! wikitext
15421 [[File:Foobar.jpg|frameless|caption]]
15422
15423 [[File:Foobar.jpg|frameless|frame|caption]]
15424
15425 [[File:Foobar.jpg|frameless|thumb|caption]]
15426 !! html/php
15427 <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>
15428 </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>
15429 </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>
15430 </p>
15431 !! html/parsoid
15432 <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>
15433 <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>
15434 <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>
15435 !! end
15436
15437 !! test
15438 Image with 'frame' first.
15439 !! options
15440 parsoid=wt2html,wt2wt,html2html
15441 !! wikitext
15442 [[File:Foobar.jpg|frame|caption]]
15443 [[File:Foobar.jpg|frame|frameless|caption]]
15444 [[File:Foobar.jpg|frame|thumb|caption]]
15445 !! html/php
15446 <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>
15447 <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>
15448 <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>
15449 !! html/parsoid
15450 <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>
15451 <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>
15452 <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>
15453 !! end
15454
15455 !! test
15456 Image with 'thumb' first.
15457 !! options
15458 parsoid=wt2html,wt2wt,html2html
15459 !! wikitext
15460 [[File:Foobar.jpg|thumb|caption]]
15461 [[File:Foobar.jpg|thumb|frameless|caption]]
15462 [[File:Foobar.jpg|thumb|frame|caption]]
15463 !! html/php
15464 <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>
15465 <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>
15466 <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>
15467 !! html/parsoid
15468 <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>
15469 <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>
15470 <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>
15471 !! end
15472
15473 ###################
15474 # Image sizing.
15475 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
15476 # and https://phabricator.wikimedia.org/T64258
15477 # Foobar has actual size of 1941x220
15478 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
15479 # a scalable format.
15480 # 2. Framed images always ignore size options; always render at default size.
15481 # 3. "Unspecified format" and border are the only types which can be
15482 # enlarged.
15483
15484 !! test
15485 Image: unspecified format and border enlarge
15486 !! options
15487 parsoid=wt2html,wt2wt,html2html
15488 !! wikitext
15489 [[File:Foobar.jpg|2000px]]
15490
15491 [[File:Foobar.jpg|border|2000px]]
15492 !! html/php
15493 <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>
15494 </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>
15495 </p>
15496 !! html/parsoid
15497 <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>
15498 <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>
15499 !! end
15500
15501 !! test
15502 Image: "unspecified format" and border reduce
15503 !! options
15504 parsoid=wt2html,wt2wt,html2html
15505 !! wikitext
15506 [[File:Foobar.jpg|1000px]]
15507
15508 [[File:Foobar.jpg|border|1000px]]
15509 !! html/php
15510 <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>
15511 </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>
15512 </p>
15513 !! html/parsoid
15514 <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>
15515 <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>
15516 !! end
15517
15518 !! test
15519 Image: thumbs reduce
15520 !! options
15521 parsoid=wt2html,wt2wt,html2html
15522 !! wikitext
15523 [[File:Foobar.jpg|thumb|50px]]
15524 !! html/php
15525 <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>
15526 !! html/parsoid
15527 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure>
15528 !! end
15529
15530 !! test
15531 Image: bitmap thumbs can't be enlarged past original size, but vector can.
15532 !! options
15533 parsoid=wt2html,wt2wt,html2html
15534 !! wikitext
15535 [[File:Foobar.jpg|thumb|2000px]]
15536
15537 [[File:Foobar.svg|thumb|2000px]]
15538 !! html/php
15539 <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>
15540 <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>
15541 !! html/parsoid
15542 <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></figure>
15543 <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></figure>
15544 !! end
15545
15546 !! test
15547 Image: frameless can reduce in size
15548 !! options
15549 parsoid=wt2html,wt2wt,html2html
15550 !! wikitext
15551 [[File:Foobar.jpg|frameless|50px]]
15552 !! html/php
15553 <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>
15554 </p>
15555 !! html/parsoid
15556 <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>
15557 !! end
15558
15559 !! test
15560 Image: bitmap frameless can't be enlarged past original size, but vector can
15561 !! options
15562 parsoid=wt2html,wt2wt,html2html
15563 !! wikitext
15564 [[File:Foobar.jpg|frameless|2000px]]
15565
15566 [[File:Foobar.svg|frameless|2000px]]
15567 !! html/php
15568 <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>
15569 </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>
15570 </p>
15571 !! html/parsoid
15572 <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>
15573 <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>
15574 !! end
15575
15576 !! test
15577 Image: framed images are always unscaled.
15578 !! options
15579 parsoid=wt2html,wt2wt,html2html
15580 !! wikitext
15581 [[File:Foobar.jpg|frame]]
15582
15583 [[File:Foobar.jpg|frame|50px]]
15584
15585 [[File:Foobar.jpg|frame|50x50px]]
15586
15587 [[File:Foobar.jpg|frame|2000px]]
15588 !! html/php
15589 <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>
15590 <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>
15591 <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>
15592 <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>
15593 !! html/parsoid
15594 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
15595 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
15596 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
15597 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
15598 !! end
15599
15600 ###################
15601
15602 !! test
15603 Link to image page- image page normally doesn't exists, hence edit link
15604 Add test with existing image page
15605 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
15606 !! wikitext
15607 [[:Image:test]]
15608 !! html
15609 <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>
15610 </p>
15611 !! end
15612
15613 !! test
15614 T20784 Link to non-existent image page with caption should use caption as link text
15615 !! wikitext
15616 [[:Image:test|caption]]
15617 !! html
15618 <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>
15619 </p>
15620 !! end
15621
15622 !! test
15623 Frameless image caption with a free URL
15624 !! wikitext
15625 [[File:Foobar.jpg|http://example.com]]
15626 !! html/php
15627 <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>
15628 </p>
15629 !! html/parsoid
15630 <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>
15631 !! end
15632
15633 !! test
15634 Thumbnail image caption with a free URL
15635 !! options
15636 thumbsize=220
15637 !! wikitext
15638 [[File:Foobar.jpg|thumb|http://example.com]]
15639 !! html/php
15640 <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>
15641 !! html/parsoid
15642 <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>
15643 !! end
15644
15645 !! test
15646 Thumbnail image caption with a free URL and explicit alt
15647 !! options
15648 thumbsize=220
15649 parsoid=wt2html,wt2wt,html2html
15650 !! wikitext
15651 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15652 !! html/php
15653 <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>
15654 !! html/parsoid
15655 <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>
15656 !! end
15657
15658 !! test
15659 SVG thumbnails with no language set
15660 !! options
15661 !! wikitext
15662 [[File:Foobar.svg|thumb|caption]]
15663 !! html/php
15664 <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>
15665 !! html/parsoid
15666 <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>
15667 !! end
15668
15669 !! test
15670 SVG thumbnails with language de
15671 !! options
15672 parsoid=wt2html,wt2wt,html2html
15673 !! wikitext
15674 [[File:Foobar.svg|thumb|caption|lang=de]]
15675 !! html/php
15676 <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>
15677 !! html/parsoid
15678 <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>
15679 !! end
15680
15681 !! test
15682 SVG thumbnails with invalid language code
15683 !! options
15684 parsoid=wt2html,wt2wt,html2html
15685 !! wikitext
15686 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15687 !! html/php
15688 <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>
15689 !! html/parsoid
15690 <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>
15691 !! end
15692
15693 !! test
15694 SVG thumbnails in page language
15695 !! options
15696 language=ru
15697 !! wikitext
15698 [[File:Foobar.svg]] [[File:Foobar.svg|lang=en]]
15699 !! html/php
15700 <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>
15701 </p>
15702 !! end
15703
15704 !! test
15705 SVG thumbnails in page language not present in the file
15706 !! options
15707 language=de
15708 !! wikitext
15709 [[File:Foobar.svg]] [[File:Foobar.svg|lang=ru]]
15710 !! html/php
15711 <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>
15712 </p>
15713 !! end
15714
15715 !! test
15716 T3887: A ISBN with a thumbnail
15717 !! wikitext
15718 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15719 !! html/php
15720 <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>
15721 !! html/parsoid
15722 <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>
15723 !! end
15724
15725 !! test
15726 T3887: A RFC with a thumbnail
15727 !! wikitext
15728 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15729 !! html/php
15730 <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>
15731 !! html/parsoid
15732 <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>
15733 !! end
15734
15735 !! test
15736 T3887: A mailto link with a thumbnail
15737 !! wikitext
15738 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15739 !! html/php
15740 <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>
15741 !! html/parsoid
15742 <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>
15743 !! end
15744
15745 # Pending resolution to T2368
15746 !! test
15747 T2648: Frameless image caption with a link
15748 !! wikitext
15749 [[File:Foobar.jpg|text with a [[link]] in it]]
15750 !! html/php
15751 <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>
15752 </p>
15753 !! html/parsoid
15754 <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>
15755 !! end
15756
15757 !! test
15758 T2648: Frameless image caption with a link (suffix)
15759 !! wikitext
15760 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15761 !! html/php
15762 <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>
15763 </p>
15764 !! html/parsoid
15765 <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>
15766 !! end
15767
15768 !! test
15769 T2648: Frameless image caption with an interwiki link
15770 !! wikitext
15771 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15772 !! html/php
15773 <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>
15774 </p>
15775 !! html/parsoid
15776 <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>
15777 !! end
15778
15779 !! test
15780 T2648: Frameless image caption with a piped interwiki link
15781 !! wikitext
15782 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15783 !! html/php
15784 <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>
15785 </p>
15786 !! html/parsoid
15787 <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>
15788 !! end
15789
15790 !! test
15791 T107474: Frameless image caption with <nowiki>
15792 !! wikitext
15793 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15794 !! html/parsoid
15795 <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>
15796 !! end
15797
15798 !! test
15799 Escape HTML special chars in image alt text
15800 !! wikitext
15801 [[File:Foobar.jpg|& < > "]]
15802 !! html/php
15803 <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>
15804 </p>
15805 !! html/parsoid
15806 <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>
15807 !! end
15808
15809 !! test
15810 Escape HTML special chars in image alt text with LanguageConverter
15811 !! options
15812 language=zh
15813 !! wikitext
15814 [[File:Foobar.jpg|& < > "]]
15815 !! html/php
15816 <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>
15817 </p>
15818 !! html/parsoid
15819 <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>
15820 !! end
15821
15822 !! test
15823 Entities in file name and attributes
15824 !! wikitext
15825 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15826 !! html/php
15827 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15828 </p>
15829 !! html/parsoid
15830 <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='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&#39;>7% solution&lt;/a>"}'><a href="./7%25_solution" data-parsoid='{"a":{"href":"./7%25_solution"},"sa":{"href":"link=7%25 solution"}}'><img resource="./File:7%25_solution.gif" src="./Special:FilePath/7%25_solution.gif" height="220" width="220" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif","height":"220","width":"220"},"sa":{"resource":"File:7%25 solution.gif"}}'/></a></figure-inline></p>
15831 !! end
15832
15833 !! test
15834 T2499: Alt text should have &#1234;, not &amp;1234;
15835 !! wikitext
15836 [[File:Foobar.jpg|&#9792;]]
15837 !! html/php
15838 <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>
15839 </p>
15840 !! html/parsoid
15841 <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>
15842 !! end
15843
15844 !! test
15845 Broken image caption with link
15846 !! options
15847 parsoid=wt2html,wt2wt,html2html
15848 !! wikitext
15849 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15850 !! html/php
15851 <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.
15852 </p>
15853 !! html/parsoid
15854 <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>
15855 !! end
15856
15857 !! test
15858 Image caption containing another image
15859 !! wikitext
15860 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15861 !! html/php
15862 <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>
15863 !! html/parsoid
15864 <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>
15865 !! end
15866
15867 !! test
15868 Image: caption containing a newline
15869 !! wikitext
15870 [[File:Foobar.jpg|This
15871 *is some text]]
15872 !! html/php
15873 <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>
15874 </p>
15875 !! html/parsoid
15876 <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>
15877 !!end
15878
15879 !!test
15880 Image: caption containing leading space
15881 (The leading space should not trigger nowiki escaping in wt2wt mode)
15882 !! wikitext
15883 [[File:Foobar.jpg|thumb| bar]]
15884 !! html/php
15885 <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>
15886 !! html/parsoid
15887 <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>
15888 !!end
15889
15890 # html/php output not have newlines after table, td, th, etc. because
15891 # Linker::makeThumbLink2() replaces the newlines with spaces since
15892 # the table is inside a caption.
15893 # FIXME: Verify if that circa 2004 fix is still required.
15894 !! test
15895 Image: caption containing a table
15896 !! options
15897 parsoid=wt2html,wt2wt,html2html
15898 !! wikitext
15899 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15900 {|
15901 !Foo!!Bar
15902 |-
15903 |Foo1||Bar1
15904 |}
15905 and some more text.]]
15906 !! html/php
15907 <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>
15908 !! html/parsoid
15909 <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
15910 <table>
15911 <tbody>
15912 <tr><th>Foo</th><th>Bar</th></tr>
15913 <tr>
15914 <td>Foo1</td>
15915 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15916 !! end
15917
15918 !! test
15919 T5090: External links other than http: in image captions
15920 !! wikitext
15921 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15922 !! html/php
15923 <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>
15924 !! html/parsoid
15925 <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>
15926 !! end
15927
15928 !! test
15929 Custom class
15930 !! options
15931 parsoid=wt2html,wt2wt,html2html
15932 !! wikitext
15933 [[Image:foobar.jpg|a|class=b]]
15934 !! html/php
15935 <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>
15936 </p>
15937 !! html/parsoid
15938 <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>
15939 !! end
15940
15941 !! test
15942 Localized image handling (1).
15943 !! options
15944 parsoid=wt2html,wt2wt,html2html
15945 language=es
15946 !! wikitext
15947 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15948 !! html/php
15949 <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>
15950 !! html/parsoid
15951 <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>
15952 !! end
15953
15954 !! test
15955 Localized image handling (2).
15956 !! options
15957 thumbsize=220
15958 parsoid=wt2html,wt2wt,html2html
15959 language=es
15960 !! wikitext
15961 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15962 !! html/php
15963 <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>
15964 !! html/parsoid
15965 <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>
15966 !! end
15967
15968 !! test
15969 Localized image handling (3).
15970 !! options
15971 language=fa
15972 parsoid=html2wt
15973 !! html/parsoid
15974 <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>
15975 !! wikitext
15976 [[File:Foobar.jpg|بندانگشتی]]
15977 !! end
15978
15979 !! test
15980 "border", "frameless" and "class" attributes on an image.
15981 !! options
15982 thumbsize=220
15983 parsoid=wt2html,wt2wt,html2html
15984 !! wikitext
15985 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15986 !! html/php
15987 <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>
15988 </p>
15989 !! html/parsoid
15990 <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>
15991 !! end
15992
15993 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15994 !! test
15995 Invalid image attributes (T64500)
15996 !! options
15997 thumbsize=220
15998 parsoid=wt2html,wt2wt,html2html
15999 !! wikitext
16000 [[File:Foobar.jpg|thumb|float|left|caption]]
16001
16002 [[File:Foobar.jpg|thumb|righ|caption]]
16003
16004 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
16005 !! html/php
16006 <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>
16007 <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>
16008 <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>
16009 !! html/parsoid
16010 <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>
16011 <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>
16012 <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>
16013 !! end
16014
16015 !! article
16016 File:Barfoo.jpg
16017 !! text
16018 #REDIRECT [[File:Barfoo.jpg]]
16019 !! endarticle
16020
16021 # FIXME: Parsoid should run this test -- but we'd need to teach the
16022 # mockAPI about the redirected Barfoo.jpg image.
16023 !! test
16024 Redirected image
16025 !! wikitext
16026 [[Image:Barfoo.jpg]]
16027 !! html/php
16028 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
16029 </p>
16030 !! end
16031
16032 !! test
16033 Missing image with uploads disabled
16034 !! options
16035 wgEnableUploads=0
16036 !! wikitext
16037 [[File:Foobaz.jpg]]
16038 !! html/php
16039 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
16040 </p>
16041 !! html/parsoid
16042 <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="./File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></figure-inline></p>
16043 !! end
16044
16045 # Parsoid-specific testing for images
16046 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
16047 # Currently imperfect due to a flaw in the Parsoid testrunner
16048 # Work in progress
16049 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
16050 # image tests.
16051
16052 !! test
16053 Parsoid-specific image handling - simple image with size and middle alignment
16054 !! wikitext
16055 [[File:Foobar.jpg|middle|50px]]
16056 !! html/parsoid
16057 <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>
16058 !! end
16059
16060 !! test
16061 Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
16062 !! options
16063 parsoid=wt2wt,wt2html,html2html
16064 !! wikitext
16065 [[Image:Foobar.jpg|middle|50px]]
16066 !! html/parsoid
16067 <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>
16068 !! end
16069
16070 !! test
16071 Parsoid-specific image handling - simple image with size and middle alignment (existing content)
16072 !! wikitext
16073 [[File:Foobar.jpg|50px|middle]]
16074 !! html/parsoid
16075 <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>
16076 !! end
16077
16078 !! test
16079 Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
16080 !! options
16081 parsoid=wt2html,wt2wt,html2html
16082 !! wikitext
16083 [[Image:Foobar.jpg|50px|middle]]
16084 !! html/parsoid
16085 <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>
16086 !! end
16087
16088 !! test
16089 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
16090 !! wikitext
16091 [[File:Foobar.jpg|500x10px|baseline|caption]]
16092 !! html/parsoid
16093 <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>
16094 !! end
16095
16096 !! test
16097 Parsoid-specific image handling - simple image with border and size spec
16098 !! wikitext
16099 [[File:Foobar.jpg|50px|border|caption]]
16100 !! html/parsoid
16101 <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>
16102 !! end
16103
16104 !! test
16105 Parsoid-specific image handling - thumbnail with halign, valign, and caption
16106 !! options
16107 parsoid=wt2html,html2html
16108 !! wikitext
16109 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
16110 !! html/parsoid
16111 <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>
16112 !! end
16113
16114 !! test
16115 Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
16116 !! options
16117 parsoid=wt2html,html2html
16118 !! wikitext
16119 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
16120 !! html/parsoid
16121 <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>
16122 !! end
16123
16124 !! test
16125 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
16126 !! options
16127 parsoid=wt2html,html2html
16128 !! wikitext
16129 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
16130 !! html/parsoid
16131 <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>
16132 !! end
16133
16134 !! test
16135 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
16136 !! options
16137 parsoid=wt2html,html2html
16138 !! wikitext
16139 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
16140 !! html/parsoid
16141 <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>
16142 !! end
16143
16144 !! test
16145 Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
16146 !! options
16147 parsoid=wt2html,wt2wt,html2html
16148 !! wikitext
16149 [[File:Foobar.jpg|frame|500x50px|caption]]
16150 !! html/parsoid
16151 <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>
16152 !! end
16153
16154 !! test
16155 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
16156 !! options
16157 parsoid=wt2html,html2html
16158 !! wikitext
16159 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
16160 !! html/parsoid
16161 <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>
16162 !! end
16163
16164 !! test
16165 Parsoid-specific image handling - frameless image with specific size, border, and caption
16166 !! wikitext
16167 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
16168 !! html/parsoid
16169 <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>
16170 !! end
16171
16172 !! test
16173 Parsoid-specific image handling - simple image with a formatted caption
16174 !! wikitext
16175 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
16176 !! html/parsoid
16177 <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>
16178 !! end
16179
16180 !! test
16181 Parsoid-specific image handling - caption with a template in it
16182 !! wikitext
16183 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
16184 !! html/parsoid
16185 <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>
16186 !! end
16187
16188 !! test
16189 Parsoid-specific image handling - caption with unbalanced tags in it
16190 !! options
16191 parsoid=wt2html,wt2wt,html2html
16192 !! wikitext
16193 foo
16194 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
16195 bar
16196 !! html/parsoid
16197 <p>foo</p>
16198 <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>
16199 <p>bar</p>
16200 !! end
16201
16202 !! test
16203 Parsoid-specific image handling - empty caption (1)
16204 !! options
16205 parsoid=wt2html,wt2wt
16206 !! wikitext
16207 [[File:Foobar.jpg|thumb|]]
16208 !! html/parsoid
16209 <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>
16210 !! end
16211
16212 # empty captions don't get serialized unless we're in the "round trip" case
16213 !! test
16214 Parsoid-specific image handling - empty caption (2)
16215 !! options
16216 parsoid=html2wt
16217 !! html/parsoid
16218 <figure class="mw-default-size" typeof="mw:Image/Thumb">
16219 <a href="./File:Foobar.jpg">
16220 <img resource="./File:Foobar.jpg"
16221 src="//example.com/images/3/3a/Foobar.jpg"
16222 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
16223 height="25" width="220"/>
16224 </a>
16225 <figcaption></figcaption>
16226 </figure>
16227 !! wikitext
16228 [[File:Foobar.jpg|thumb]]
16229 !! end
16230
16231 !! test
16232 Parsoid-specific image handling - whitespace caption
16233 !! wikitext
16234 [[File:Foobar.jpg|thumb| ]]
16235 !! html/parsoid
16236 <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>
16237 !! end
16238
16239 !! test
16240 Parsoid-specific image handling - lang option
16241 !! wikitext
16242 foo
16243 [[File:Foobar.svg|lang=de|caption]]
16244 bar
16245 !! html/parsoid
16246 <p>foo
16247 <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>
16248 bar</p>
16249 !! end
16250
16251 ## Edge case bugs in Parsoid from T93580
16252 !! test
16253 T93580: 1. Templated <ref> inside block images
16254 !! wikitext
16255 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
16256
16257 <references />
16258 !! html/parsoid
16259 <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>
16260
16261 <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>
16262 !! end
16263
16264 !! test
16265 T93580: 2. <ref> inside inline images
16266 !! wikitext
16267 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
16268
16269 <references />
16270 !! html/parsoid
16271 <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>
16272
16273 <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>
16274 !! end
16275
16276 !! test
16277 T93580: 3. Templated <ref> inside inline images
16278 !! wikitext
16279 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
16280
16281 <references />
16282 !! html/parsoid
16283 <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>
16284
16285 <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>
16286 !! end
16287
16288 ###
16289 ### Subpages
16290 ###
16291 !! article
16292 Subpage test/subpage
16293 !! text
16294 foo
16295 !! endarticle
16296
16297 !! test
16298 Subpage link
16299 !! options
16300 subpage title=[[Subpage test]]
16301 !! wikitext
16302 [[/subpage]]
16303 !! html
16304 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
16305 </p>
16306 !! end
16307
16308 !! test
16309 Subpage noslash link
16310 !! options
16311 subpage title=[[Subpage test]]
16312 !! wikitext
16313 [[/subpage/]]
16314 !! html
16315 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
16316 </p>
16317 !! end
16318
16319 !! article
16320 Subpage test/1/2/subpage
16321 !! text
16322 blah
16323 !! endarticle
16324
16325 !! test
16326 Relative subpage noslash link
16327 !! options
16328 parsoid=wt2wt,wt2html,html2html
16329 subpage title=[[Subpage test/1/2/3/4]]
16330 !! wikitext
16331 [[../../subpage/]]
16332
16333 [[../../subpage]]
16334 !! html/php
16335 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
16336 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
16337 </p>
16338 !! html/parsoid
16339 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
16340 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
16341 !! end
16342
16343 !! test
16344 Parsoid: dot-slash prefixed wikilinks
16345 !! wikitext
16346 [[./foo]]
16347
16348 [[././bar]]
16349
16350 [[././baz/]]
16351 !! html/php
16352 <p>[[./foo]]
16353 </p><p>[[././bar]]
16354 </p><p>[[././baz/]]
16355 </p>
16356 !! html/parsoid
16357 <p>[[./foo]]
16358 </p><p>[[././bar]]
16359 </p><p>[[././baz/]]
16360 </p>
16361 !! end
16362
16363 !! test
16364 Render invalid page names as plain text (T53090)
16365 !! wikitext
16366 [[./../foo|bar]]
16367 [[foo�|bar]]
16368 [[foo/.|bar]]
16369 [[foo/..|bar]]
16370 [[foo~~~bar]]
16371 [[foo>bar]]
16372 [[foo[bar]]
16373 [[.]]
16374 [[..]]
16375 [[foo././bar]]
16376 [[foo[http://example.com]xyz]]
16377
16378 [[{{echo|./../foo}}|bar]]
16379 [[{{echo|foo/.}}|bar]]
16380 [[{{echo|foo/..}}|bar]]
16381 [[{{echo|foo~~~~bar}}]]
16382 [[{{echo|foo>bar}}]]
16383 [[{{echo|foo././bar}}]]
16384 [[{{echo|foo{bar}}]]
16385 [[{{echo|foo}bar}}]]
16386 [[{{echo|foo[bar}}]]
16387 [[{{echo|foo]bar}}]]
16388 [[{{echo|foo<bar}}]]
16389 !!html/php
16390 <p>[[./../foo|bar]]
16391 [[foo�|bar]]
16392 [[foo/.|bar]]
16393 [[foo/..|bar]]
16394 [[foo~~~bar]]
16395 [[foo&gt;bar]]
16396 [[foo[bar]]
16397 [[.]]
16398 [[..]]
16399 [[foo././bar]]
16400 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
16401 </p><p>[[./../foo|bar]]
16402 [[foo/.|bar]]
16403 [[foo/..|bar]]
16404 [[foo~~~~bar]]
16405 [[foo&gt;bar]]
16406 [[foo././bar]]
16407 [[foo{bar]]
16408 [[foo}bar]]
16409 [[foo[bar]]
16410 [[foo]bar]]
16411 [[foo&lt;bar]]
16412 </p>
16413 !!html/parsoid
16414 <p>[[./../foo|bar]]
16415 [[foo�|bar]]
16416 [[foo/.|bar]]
16417 [[foo/..|bar]]
16418 [[foo~~~bar]]
16419 [[foo>bar]]
16420 [[foo[bar]]
16421 [[.]]
16422 [[..]]
16423 [[foo././bar]]
16424 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
16425
16426 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
16427 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
16428 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
16429 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
16430 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
16431 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
16432 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
16433 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
16434 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
16435 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
16436 [[<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>
16437 !!end
16438
16439 !! test
16440 Disabled subpages
16441 !! wikitext
16442 [[/subpage]]
16443 !! html
16444 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
16445 </p>
16446 !! end
16447
16448 !! test
16449 T2561: {{/Subpage}}
16450 !! options
16451 subpage title=[[Page]]
16452 !! wikitext
16453 {{/Subpage}}
16454 !! html
16455 <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>
16456 </p>
16457 !! end
16458
16459 ###
16460 ### Categories
16461 ###
16462 !! article
16463 Category:MediaWiki User's Guide
16464 !! text
16465 blah
16466 !! endarticle
16467
16468 !! test
16469 Link to category
16470 !! wikitext
16471 [[:Category:MediaWiki User's Guide]]
16472 !! html
16473 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
16474 </p>
16475 !! end
16476
16477 !! test
16478 Simple category
16479 !! options
16480 cat
16481 !! wikitext
16482 [[Category:MediaWiki User's Guide]]
16483 !! html/php
16484 cat=MediaWiki_User's_Guide sort=
16485 !! html/parsoid
16486 <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"}}'/>
16487 !! end
16488
16489 !! test
16490 PAGESINCATEGORY invalid title fatal (r33546 fix)
16491 !! wikitext
16492 {{PAGESINCATEGORY:<bogus>}}
16493 !! html
16494 <p>0
16495 </p>
16496 !! end
16497
16498 !! test
16499 Category with different sort key
16500 !! options
16501 cat
16502 !! wikitext
16503 [[Category:MediaWiki User's Guide|Foo]]
16504 !! html/php
16505 cat=MediaWiki_User's_Guide sort=Foo
16506 !! html/parsoid
16507 <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"}}'/>
16508 !! end
16509
16510 !! test
16511 Category with identical sort key
16512 !! options
16513 cat
16514 !! wikitext
16515 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16516 !! html/php
16517 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
16518 !! html/parsoid
16519 <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"}}'/>
16520 !! end
16521
16522 !! test
16523 Category with empty sort key
16524 !! options
16525 cat
16526 pst
16527 !! wikitext
16528 [[Category:MediaWiki User's Guide|]]
16529 !! html/php
16530 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16531 !! end
16532
16533 !! test
16534 Category with empty sort key and parentheses
16535 !! options
16536 cat
16537 pst
16538 !! wikitext
16539 [[Category:Foo (bar)|]]
16540 !! html/php
16541 [[Category:Foo (bar)|Foo]]
16542 !! end
16543
16544 !! test
16545 Category with link tail
16546 !! options
16547 cat
16548 pst
16549 !! wikitext
16550 123[[Category:Foo]]456
16551 !! html/php
16552 123[[Category:Foo]]456
16553 !! end
16554
16555 !! test
16556 Category with template
16557 !! options
16558 cat
16559 pst
16560 !! wikitext
16561 [[Category:{{echo|Foo}}]]
16562 !! html/php
16563 [[Category:{{echo|Foo}}]]
16564 !! end
16565
16566 !! test
16567 Category with template in sort key
16568 !! options
16569 cat
16570 pst
16571 !! wikitext
16572 [[Category:Foo|{{echo|Bar}}]]
16573 !! html/php
16574 [[Category:Foo|{{echo|Bar}}]]
16575 !! end
16576
16577 !! test
16578 Category with template in sort key and title
16579 !! options
16580 cat
16581 pst
16582 !! wikitext
16583 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16584 !! html/php
16585 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16586 !! end
16587
16588 ## We used to, but no longer wt2wt this test since the default serializer
16589 ## will normalize all categories to serialize on their own line.
16590 ## This wikitext usage is going to be fairly uncommon in production and
16591 ## selser will take care of preserving formatting in those scenarios.
16592 !! test
16593 Category / paragraph interactions
16594 !! options
16595 parsoid=wt2html
16596 !! wikitext
16597 Foo [[Category:Baz]] Bar
16598
16599 Foo [[Category:Baz]]
16600 Bar
16601
16602 Foo
16603 [[Category:Baz]]
16604 Bar
16605
16606 Foo
16607 [[Category:Baz]] Bar
16608
16609 Foo
16610 [[Category:Baz]]
16611 [[Category:Baz]]
16612 [[Category:Baz]]
16613 Bar
16614
16615 [[Category:Baz]]
16616 [[Category:Baz]]
16617 [[Category:Baz]]
16618
16619 [[Category:Baz]]
16620 {{echo|[[Category:Baz]]}}
16621 [[Category:Baz]]
16622 !! html/php
16623 <p>Foo Bar
16624 </p><p>Foo
16625 Bar
16626 </p><p>Foo
16627 Bar
16628 </p><p>Foo Bar
16629 </p><p>Foo
16630 Bar
16631 </p>
16632 !! html/parsoid
16633 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16634 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16635 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16636 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16637 <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>
16638 <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}}]}'/>
16639 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16640 !! end
16641
16642 ## We used to, but no longer wt2wt this test since the default serializer
16643 ## will normalize all categories to serialize on their own line.
16644 ## This wikitext usage is going to be fairly uncommon in production and
16645 ## selser will take care of preserving formatting in those scenarios.
16646 ##
16647 ## The whitespace on the empty line is part of the test. Please do not delete
16648 !! test
16649 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16650 !! options
16651 parsoid=wt2html
16652 !! wikitext
16653 This
16654
16655 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16656
16657 {{echo|[[Category:Foo]] and so should this!}}
16658 !! html/php
16659 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16660 </p>
16661 !! html/parsoid
16662 <p>This
16663
16664 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16665
16666 <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>
16667 !! end
16668
16669 ## Parsoid will not try to wt2wt this while preserving newlines because
16670 ## it suppresses excess newlines within list items -- and we don't want to
16671 ## introduce a special case just for categories, which is, in reality somewhat
16672 ## odd behavior -- categories are unlikely to be used in list items like this
16673 ## in top-level pages and are only likely to show up in template-generated
16674 ## list items where this RT-ing is a non-issue.
16675 ##
16676 ## The whitespace on the empty line is part of the test. Please do not delete
16677 !! test
16678 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16679 !! options
16680 parsoid=wt2html
16681 !! wikitext
16682 * This
16683
16684 [[Category:Foo]] and this should be part of the same list item
16685 * So should this
16686
16687 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16688 !! html/php+tidy
16689 <ul><li>This and this should be part of the same list item</li>
16690 <li>So should this and this should be part of the same list item</li></ul>
16691 !! html/parsoid
16692 <ul>
16693 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16694 <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>
16695 </ul>
16696 !! end
16697
16698 ## Newlines and categories that follow the last item of a list
16699 ## are treated differently because this (list followed by categories)
16700 ## is an extremely common pattern on wikis.
16701 !! test
16702 3. Categories and newlines: newline suppression for last list item should RT properly
16703 !! wikitext
16704 *a
16705 *b
16706
16707 [[Category:Foo]]
16708
16709 [[Category:Bar]]
16710 [[Category:Baz]]
16711
16712 :c
16713
16714 [[Category:C]]
16715
16716 ;d
16717
16718 [[Category:D]]
16719 !! html/parsoid
16720 <ul><li>a</li>
16721 <li>b</li></ul>
16722
16723 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16724
16725 <link rel="mw:PageProp/Category" href="./Category:Bar"/>
16726 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16727
16728 <dl><dd>c</dd></dl>
16729
16730 <link rel="mw:PageProp/Category" href="./Category:C"/>
16731
16732 <dl><dt>d</dt></dl>
16733
16734 <link rel="mw:PageProp/Category" href="./Category:D"/>
16735 !! end
16736
16737 !! test
16738 4. Categories and newlines: newline suppression for last list item should RT properly
16739 !! wikitext
16740 *a
16741 ****b
16742
16743 [[Category:Foo]]
16744 !! html/parsoid
16745 <ul><li>a
16746 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
16747
16748 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16749 !! end
16750
16751 ## only wt2html for this to make sure the algo only applies to the rightmost path
16752 !! test
16753 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16754 !! options
16755 parsoid=wt2html
16756 !! wikitext
16757 *a
16758 **b
16759 [[Category:Foo]]
16760 *c
16761 **d
16762 [[Category:Foo]]
16763 !! html/parsoid
16764 <ul><li>a
16765 <ul><li>b
16766 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16767 <li>c
16768 <ul><li>d</li></ul></li></ul>
16769 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16770 !! end
16771
16772 ## We used to, but no longer wt2wt this test since the default serializer
16773 ## will normalize all categories to serialize on their own line.
16774 ## This wikitext usage is going to be fairly uncommon in production and
16775 ## selser will take care of preserving formatting in those scenarios.
16776 !! test
16777 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16778 !! options
16779 parsoid=wt2html
16780 !! wikitext
16781 *a [[Category:Foo]]
16782 !! html/parsoid
16783 <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>
16784 !! end
16785
16786 # This test also demonstrates because of newline+category tunneling
16787 # through the list hander, template wrapping doesn't expand to the
16788 # containing list when the list item swallows the category.
16789 !! test
16790 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16791 !! wikitext
16792 *{{echo|a
16793 [[Category:Foo]]}}
16794 !! html/parsoid
16795 <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
16796 </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>
16797 !! end
16798
16799 !! test
16800 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16801 !! wikitext
16802 *a
16803
16804 {{echo|[[Category:Foo]]
16805 [[Category:Bar]]}}
16806 [[Category:Baz]]
16807 !! html/parsoid
16808 <ul><li>a</li></ul>
16809
16810 <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">
16811 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16812 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16813 !! end
16814
16815 !! test
16816 Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
16817 !! wikitext
16818 *a
16819
16820 [[Category:Bar]]<!--boo1--> <!--boo2-->
16821 [[Category:Baz]]<!--boo3--> <!--boo4-->
16822 !! html/parsoid
16823 <ul><li>a</li></ul>
16824
16825 <link rel="mw:PageProp/Category" href="./Category:Bar"/><!--boo1--> <!--boo2-->
16826 <link rel="mw:PageProp/Category" href="./Category:Baz"/><!--boo3--> <!--boo4-->
16827 !! end
16828
16829 !! test
16830 Categories and newlines: should behave properly with linkprefix (T87753)
16831 !! options
16832 language=ar
16833 !! wikitext
16834 foo bar
16835 foo bar
16836 [[تصنيف:Foo]]
16837 [[تصنيف:Bar]]
16838 !! html/php
16839 <p>foo bar
16840 foo bar
16841 </p>
16842 !! html/parsoid
16843 <p>foo bar
16844 foo bar</p>
16845 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16846 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16847 !! end
16848
16849 !! test
16850 No regressions on internal links following category (T174639)
16851 !! options
16852 parsoid=wt2html,html2html
16853 !! wikitext
16854 [[Category:Foo]]<div>a
16855
16856 [[Foo]]</div>
16857 !! html/php
16858 <div>a
16859 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16860 !! html/parsoid
16861 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16862
16863 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16864 !! end
16865
16866 # Note that Parsoid differs slightly from PHP due to T175421
16867 !! test
16868 11. Special case where only newlines separate links (T175416)
16869 !! options
16870 parsoid=wt2html,html2html
16871 !! wikitext
16872 [[Category:Foo]]
16873
16874 [[Foo]][[es:Alimento]]
16875
16876 [[Foo]]
16877 !! html/php
16878 <p><br />
16879 <a href="/wiki/Foo" title="Foo">Foo</a>
16880 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16881 </p>
16882 !! html/parsoid
16883 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16884
16885 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16886
16887 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16888 !! end
16889
16890 !! test
16891 Category links with multiple namespaces
16892 !! wikitext
16893 [[Category:Project:Foo]]
16894 !! html/parsoid
16895 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16896 !! end
16897
16898 !! test
16899 Parsoid: Serialize link to category page with colon escape
16900 !! wikitext
16901
16902 [[:Category:Foo]]
16903 [[:Category:Foo|Bar]]
16904 !! html/php+tidy
16905 <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>
16906 <a href="/index.php?title=Category:Foo&amp;action=edit&amp;redlink=1" class="new" title="Category:Foo (page does not exist)">Bar</a>
16907 </p>
16908 !! html/parsoid
16909 <p>
16910 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16911 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16912 </p>
16913 !! end
16914
16915 # We used to, but no longer wt2wt this test since the default serializer
16916 # will normalize all categories to serialize on their own line.
16917 # This wikitext usage is going to be fairly uncommon in production and
16918 # selser will take care of preventing whitespace insertion if this
16919 # occurs in an article.
16920 #
16921 # html2html disabled for the same reason (whitespace insertion between
16922 # x and y).
16923 #
16924 # html2wt disabled because it localizes the "Category" namespace.
16925 !! test
16926 Link prefix/suffixes aren't applied to category links
16927 !! options
16928 parsoid=wt2html
16929 language=is
16930 !! wikitext
16931 x[[Category:Foo]]y
16932 !! html/php
16933 <p>xy
16934 </p>
16935 !! html/parsoid
16936 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16937 !! end
16938
16939 !! test
16940 Link prefix/suffixes aren't applied to language links
16941 !! options
16942 parsoid=wt2html
16943 language=is
16944 !! wikitext
16945 x[[es:Foo]]y
16946 !! html/php
16947 <p>xy
16948 </p>
16949 !! html/parsoid
16950 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16951 !! end
16952
16953 !! test
16954 Parsoid: Serialize link to file page with colon escape
16955 !! wikitext
16956
16957 [[:File:Foo.png]]
16958 [[:File:Foo.png|Bar]]
16959 !! html/php+tidy
16960 <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>
16961 <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>
16962 </p>
16963 !! html/parsoid
16964 <p>
16965 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16966 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16967 </p>
16968 !! end
16969
16970 !! test
16971 Parsoid: Serialize a genuine category link without colon escape
16972 !! wikitext
16973 [[Category:Foo]]
16974 [[Category:Foo|Bar]]
16975 !! html/php+tidy
16976 !! html/parsoid
16977 <link rel="mw:PageProp/Category" href="./Category:Foo">
16978 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16979 !! end
16980
16981 !! test
16982 Normalize hrefs properly before testing for invalid link targets (T72894)
16983 !! options
16984 parsoid=html2wt
16985 !! html/parsoid
16986 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16987 !! wikitext
16988 [[Category:Toxine bactérienne]]
16989 !! end
16990
16991 !! test
16992 Parsoid: Defaultsort
16993 !! wikitext
16994 {{DEFAULTSORT:Foo}}
16995 !! html/parsoid
16996 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16997 !! end
16998
16999 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
17000 # But, this is a limitation of our representation and is documented in
17001 # TemplateHandler.js in processSpecialMagicWord
17002 !! test
17003 Parsoid: Defaultsort (template-generated)
17004 !! wikitext
17005 {{{{echo|DEFAULTSORT}}:Foo}}
17006 !! html/parsoid
17007 <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"}]]}'/>
17008 !! end
17009
17010 ###
17011 ### Inter-language links
17012 ###
17013 !! test
17014 Interlanguage links
17015 !! options
17016 ill
17017 !! wikitext
17018 [[es:Alimento]]
17019 [[fr:Nourriture]]
17020 [[zh:食品]]
17021 !! html/php
17022 es:Alimento fr:Nourriture zh:食品
17023 !! html/parsoid
17024 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
17025 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
17026 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
17027 !! end
17028
17029 !! test
17030 Duplicate interlanguage links (T26502)
17031 !! options
17032 ill
17033 !! wikitext
17034 [[es:1]]
17035 [[es:2]]
17036 [[fr:1]]
17037 [[fr:2]]
17038 !! html/php
17039 es:1 fr:1
17040 !! html/parsoid
17041 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
17042 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
17043 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
17044 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
17045 !! end
17046
17047 ###
17048 ### Sections
17049 ###
17050 !! test
17051 Basic section headings
17052 !! wikitext
17053 ==Headline 1==
17054 Some text
17055
17056 ==Headline 2==
17057 More
17058 ===Smaller headline===
17059 Blah blah
17060 !! html
17061 <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>
17062 <p>Some text
17063 </p>
17064 <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>
17065 <p>More
17066 </p>
17067 <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>
17068 <p>Blah blah
17069 </p>
17070 !! end
17071
17072 !! test
17073 Section headings with TOC
17074 !! wikitext
17075 ==Headline 1==
17076 ===Subheadline 1===
17077 =====Skipping a level=====
17078 ======Skipping a level======
17079
17080 ==Headline 2==
17081 Some text
17082 ===Another headline===
17083 !! html
17084 <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>
17085 <ul>
17086 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
17087 <ul>
17088 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
17089 <ul>
17090 <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>
17091 <ul>
17092 <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>
17093 </ul>
17094 </li>
17095 </ul>
17096 </li>
17097 </ul>
17098 </li>
17099 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
17100 <ul>
17101 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
17102 </ul>
17103 </li>
17104 </ul>
17105 </div>
17106
17107 <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>
17108 <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>
17109 <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>
17110 <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>
17111 <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>
17112 <p>Some text
17113 </p>
17114 <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>
17115 !! end
17116
17117 !! test
17118 TOC anchors don't collide
17119 !! wikitext
17120 __FORCETOC__
17121 ==Headline 2==
17122 ==Headline==
17123 ==Headline 2==
17124 ==Headline==
17125 !! html/php
17126 <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>
17127 <ul>
17128 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
17129 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
17130 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
17131 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
17132 </ul>
17133 </div>
17134
17135 <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>
17136 <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>
17137 <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>
17138 <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>
17139 !! end
17140
17141 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
17142 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
17143 !! test
17144 Handling of sections up to level 6 and beyond
17145 !! options
17146 parsoid=wt2html
17147 !! wikitext
17148 =Level 1 Heading=
17149 ==Level 2 Heading==
17150 ===Level 3 Heading===
17151 ====Level 4 Heading====
17152 =====Level 5 Heading=====
17153 ======Level 6 Heading======
17154 =======Level 7 Heading=======
17155 ========Level 8 Heading========
17156 =========Level 9 Heading=========
17157 ==========Level 10 Heading==========
17158 !! html/php
17159 <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>
17160 <ul>
17161 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
17162 <ul>
17163 <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>
17164 <ul>
17165 <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>
17166 <ul>
17167 <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>
17168 <ul>
17169 <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>
17170 <ul>
17171 <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>
17172 <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>
17173 <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>
17174 <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>
17175 <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>
17176 </ul>
17177 </li>
17178 </ul>
17179 </li>
17180 </ul>
17181 </li>
17182 </ul>
17183 </li>
17184 </ul>
17185 </li>
17186 </ul>
17187 </div>
17188
17189 <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>
17190 <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>
17191 <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>
17192 <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>
17193 <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>
17194 <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>
17195 <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>
17196 <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>
17197 <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>
17198 <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>
17199 !! html/parsoid
17200 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
17201 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
17202 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
17203 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
17204 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
17205 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
17206 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
17207 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
17208 <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>
17209 <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>
17210 !! end
17211
17212 !! test
17213 TOC regression (T11764)
17214 !! wikitext
17215 ==title 1==
17216 ===title 1.1===
17217 ====title 1.1.1====
17218 ===title 1.2===
17219 ==title 2==
17220 ===title 2.1===
17221 !! html
17222 <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>
17223 <ul>
17224 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17225 <ul>
17226 <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>
17227 <ul>
17228 <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>
17229 </ul>
17230 </li>
17231 <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>
17232 </ul>
17233 </li>
17234 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
17235 <ul>
17236 <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>
17237 </ul>
17238 </li>
17239 </ul>
17240 </div>
17241
17242 <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>
17243 <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>
17244 <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>
17245 <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>
17246 <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>
17247 <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>
17248 !! end
17249
17250 !! test
17251 TOC for heading containing <span id="..."></span> (T96153)
17252 !! wikitext
17253 __FORCETOC__
17254 ==<span id="old-anchor"></span>New title==
17255 !! html/php
17256 <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>
17257 <ul>
17258 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
17259 </ul>
17260 </div>
17261
17262 <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>
17263 !! end
17264
17265 !! test
17266 TOC with wgMaxTocLevel=3 (T8204)
17267 !! options
17268 wgMaxTocLevel=3
17269 !! wikitext
17270 ==title 1==
17271 ===title 1.1===
17272 ====title 1.1.1====
17273 ===title 1.2===
17274 ==title 2==
17275 ===title 2.1===
17276 !! html
17277 <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>
17278 <ul>
17279 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17280 <ul>
17281 <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>
17282 <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>
17283 </ul>
17284 </li>
17285 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
17286 <ul>
17287 <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>
17288 </ul>
17289 </li>
17290 </ul>
17291 </div>
17292
17293 <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>
17294 <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>
17295 <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>
17296 <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>
17297 <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>
17298 <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>
17299 !! end
17300
17301 !! test
17302 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
17303 !! options
17304 wgMaxTocLevel=3
17305 !! wikitext
17306 ==Section 1==
17307 ===Section 1.1===
17308 ====Section 1.1.1====
17309 ====Section 1.1.1.1====
17310 ==Section 2==
17311 !! html
17312 <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>
17313 <ul>
17314 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
17315 <ul>
17316 <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>
17317 </ul>
17318 </li>
17319 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
17320 </ul>
17321 </div>
17322
17323 <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>
17324 <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>
17325 <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>
17326 <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>
17327 <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>
17328 !! end
17329
17330
17331 !! test
17332 Resolving duplicate section names
17333 !! wikitext
17334 ==Foo bar==
17335 ==Foo bar==
17336 !! html
17337 <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>
17338 <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>
17339 !! end
17340
17341 !! test
17342 Resolving duplicate section names with differing case (T12721)
17343 !! wikitext
17344 ==Foo bar==
17345 ==Foo Bar==
17346 !! html
17347 <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>
17348 <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>
17349 !! end
17350
17351 !! article
17352 Template:sections
17353 !! text
17354 ===Section 1===
17355 ==Section 2==
17356 !! endarticle
17357
17358 !! test
17359 Template with sections, __NOTOC__
17360 !! wikitext
17361 __NOTOC__
17362 ==Section 0==
17363 {{sections}}
17364 ==Section 4==
17365 !! html
17366 <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>
17367 <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>
17368 <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>
17369 <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>
17370 !! end
17371
17372 !! test
17373 __NOEDITSECTION__ keyword
17374 !! wikitext
17375 __NOEDITSECTION__
17376 ==Section 1==
17377 ==Section 2==
17378 !! html
17379 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
17380 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
17381 !! end
17382
17383 !! test
17384 Link inside a section heading
17385 !! wikitext
17386 ==Section with a [[Main Page|link]] in it==
17387 !! html
17388 <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>
17389 !! end
17390
17391 !! test
17392 TOC regression (T14077)
17393 !! wikitext
17394 __TOC__
17395 ==title 1==
17396 ===title 1.1===
17397 ==title 2==
17398 !! html
17399 <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>
17400 <ul>
17401 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17402 <ul>
17403 <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>
17404 </ul>
17405 </li>
17406 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
17407 </ul>
17408 </div>
17409
17410 <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>
17411 <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>
17412 <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>
17413 !! end
17414
17415 !! test
17416 T3219 URL next to image (good)
17417 !! wikitext
17418 http://example.com [[File:Foobar.jpg]]
17419 !! html/php
17420 <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>
17421 </p>
17422 !! html/parsoid
17423 <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>
17424 !!end
17425
17426 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
17427 !! test
17428 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
17429 !! options
17430 parsoid=wt2html,html2html
17431 !! wikitext
17432 ===
17433 The line above must have a trailing space!
17434 === <!--
17435 --> <!-- -->
17436 But just in case it doesn't...
17437 !! html/php
17438 <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>
17439 <p>The line above must have a trailing space!
17440 </p>
17441 <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>
17442 <p>But just in case it doesn't...
17443 </p>
17444 !! html/parsoid
17445 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
17446 <p>The line above must have a trailing space!</p>
17447 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
17448 --> <!-- -->
17449 <p>But just in case it doesn't...</p>
17450 !! end
17451
17452 !! test
17453 Header with special characters (T27462)
17454 !! wikitext
17455 The tooltips shall not show entities to the user (ie. be double escaped)
17456
17457 ==text > text==
17458 section 1
17459
17460 ==text < text==
17461 section 2
17462
17463 ==text & text==
17464 section 3
17465
17466 ==text ' text==
17467 section 4
17468
17469 ==text " text==
17470 section 5
17471 !! html/php
17472 <p>The tooltips shall not show entities to the user (ie. be double escaped)
17473 </p>
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="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
17477 <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>
17478 <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>
17479 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
17480 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
17481 </ul>
17482 </div>
17483
17484 <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>
17485 <p>section 1
17486 </p>
17487 <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>
17488 <p>section 2
17489 </p>
17490 <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>
17491 <p>section 3
17492 </p>
17493 <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>
17494 <p>section 4
17495 </p>
17496 <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>
17497 <p>section 5
17498 </p>
17499 !! html/parsoid
17500 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
17501
17502 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
17503 <p>section 1</p>
17504
17505 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
17506 <p>section 2</p>
17507
17508 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
17509 <p>section 3</p>
17510
17511 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
17512 <p>section 4</p>
17513
17514 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
17515 <p>section 5</p>
17516 !! end
17517
17518 !! test
17519 Header with space, plus and underscore as entity
17520 !! wikitext
17521 Id should not contain + for spaces
17522
17523 ==Space between Text==
17524 section 1
17525
17526 ==Space-Entity&#32;between&#32;Text==
17527 section 2
17528
17529 ==Plus+between+Text==
17530 section 3
17531
17532 ==Plus-Entity&#43;between&#43;Text==
17533 section 4
17534
17535 ==Underscore_between_Text==
17536 section 5
17537
17538 ==Underscore-Entity&#95;between&#95;Text==
17539 section 6
17540
17541 [[#Space between Text]]
17542 [[#Space-Entity&#32;between&#32;Text]]
17543 [[#Plus+between+Text]]
17544 [[#Plus-Entity&#43;between&#43;Text]]
17545 [[#Underscore_between_Text]]
17546 [[#Underscore-Entity&#95;between&#95;Text]]
17547 !! html/php
17548 <p>Id should not contain + for spaces
17549 </p>
17550 <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>
17551 <ul>
17552 <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>
17553 <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>
17554 <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>
17555 <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>
17556 <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>
17557 <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>
17558 </ul>
17559 </div>
17560
17561 <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>
17562 <p>section 1
17563 </p>
17564 <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>
17565 <p>section 2
17566 </p>
17567 <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>
17568 <p>section 3
17569 </p>
17570 <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>
17571 <p>section 4
17572 </p>
17573 <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>
17574 <p>section 5
17575 </p>
17576 <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>
17577 <p>section 6
17578 </p><p><a href="#Space_between_Text">#Space between Text</a>
17579 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
17580 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
17581 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
17582 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17583 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17584 </p>
17585 !! html/parsoid
17586 <p>Id should not contain + for spaces</p>
17587
17588 <h2 id="Space_between_Text">Space between Text</h2>
17589 <p>section 1</p>
17590
17591 <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>
17592 <p>section 2</p>
17593
17594 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
17595 <p>section 3</p>
17596
17597 <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>
17598 <p>section 4</p>
17599
17600 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
17601 <p>section 5</p>
17602
17603 <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>
17604 <p>section 6</p>
17605
17606 <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>
17607 <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>
17608 <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>
17609 <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>
17610 <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>
17611 <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>
17612 !! end
17613
17614 # Parsoid html2wt disabled because it adds padding spaces around =
17615 !! test
17616 Headers with excess '=' characters
17617 (Are similar tests necessary beyond the 1st level?)
17618 !! options
17619 parsoid=wt2html,wt2wt,html2html
17620 !! wikitext
17621 =foo==
17622 ==foo=
17623 =''italic'' heading==
17624 ==''italic'' heading=
17625 !! html/php
17626 <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>
17627 <ul>
17628 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17629 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17630 <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>
17631 <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>
17632 </ul>
17633 </div>
17634
17635 <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>
17636 <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>
17637 <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>
17638 <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>
17639 !! html/parsoid
17640 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
17641 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
17642 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
17643 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
17644 !! end
17645
17646 !! test
17647 HTML headers vs TOC (T25393)
17648 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17649 !! wikitext
17650 <h1>Header 1</h1>
17651 ==Header 1.1==
17652 ==Header 1.2==
17653
17654 <h1>Header 2
17655 </h1>
17656 ==Header 2.1==
17657 ==Header 2.2==
17658 __NOEDITSECTION__
17659 !! html/php
17660 <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>
17661 <ul>
17662 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17663 <ul>
17664 <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>
17665 <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>
17666 </ul>
17667 </li>
17668 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
17669 <ul>
17670 <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>
17671 <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>
17672 </ul>
17673 </li>
17674 </ul>
17675 </div>
17676
17677 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17678 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17679 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17680 <h1><span class="mw-headline" id="Header_2">Header 2
17681 </span></h1>
17682 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17683 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17684 !! html/parsoid
17685 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17686 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17687 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17688
17689 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17690 </h1>
17691 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17692 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17693 <meta property="mw:PageProp/noeditsection"/>
17694 !! end
17695
17696 !! test
17697 Single-line or multiline-comments can follow headings
17698 !! options
17699 parsoid=wt2html,wt2wt
17700 !! wikitext
17701 ==foo==<!---->
17702 ==bar==<!--c1-->
17703 ==baz==<!--
17704 c2
17705 c3-->
17706 !! html/php
17707 <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>
17708 <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>
17709 <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>
17710 !! html/parsoid
17711 <h2 id="foo">foo</h2><!---->
17712 <h2 id="bar">bar</h2><!--c1-->
17713 <h2 id="baz">baz</h2><!--
17714 c2
17715 c3-->
17716 !! end
17717
17718 !! test
17719 T3219 URL next to image (broken)
17720 !! wikitext
17721 http://example.com[[File:Foobar.jpg]]
17722 !! html/php
17723 <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>
17724 </p>
17725 !! html/parsoid
17726 <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>
17727 !!end
17728
17729 !! test
17730 T3186 news: in the middle of text
17731 !! wikitext
17732 http://en.wikinews.org/wiki/Wikinews:Workplace
17733 !! html
17734 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17735 </p>
17736 !!end
17737
17738
17739 !! test
17740 Namespaced link must have a title
17741 !! wikitext
17742 [[Project:]]
17743 !! html
17744 <p>[[Project:]]
17745 </p>
17746 !!end
17747
17748 !! test
17749 Namespaced link must have a title (bad fragment version)
17750 !! wikitext
17751 [[Project:#fragment]]
17752 !! html
17753 <p>[[Project:#fragment]]
17754 </p>
17755 !!end
17756
17757
17758 ###
17759 ### HTML tags and HTML attributes
17760 ###
17761
17762 !! test
17763 div with no attributes
17764 !! wikitext
17765 <div>HTML rocks</div>
17766 !! html
17767 <div>HTML rocks</div>
17768 !! end
17769
17770 !! test
17771 div with double-quoted attribute
17772 !! wikitext
17773 <div id="rock">HTML rocks</div>
17774 !! html
17775 <div id="rock">HTML rocks</div>
17776 !! end
17777
17778 !! test
17779 div with single-quoted attribute
17780 !! wikitext
17781 <div id='rock'>HTML rocks</div>
17782 !! html
17783 <div id="rock">HTML rocks</div>
17784 !! end
17785
17786 !! test
17787 div with unquoted attribute
17788 !! wikitext
17789 <div id=rock>HTML rocks</div>
17790 !! html
17791 <div id="rock">HTML rocks</div>
17792 !! end
17793
17794 !! test
17795 div with illegal double attributes
17796 !! wikitext
17797 <div id="a" id="b">HTML rocks</div>
17798 !! html
17799 <div id="b">HTML rocks</div>
17800 !! end
17801
17802 !! test
17803 div with empty attribute value, space before equals
17804 !! options
17805 parsoid=wt2html,html2html
17806 !! wikitext
17807 <div class =>HTML rocks</div>
17808 !! html/php
17809 <div class="">HTML rocks</div>
17810 !! html/parsoid
17811 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17812 !! end
17813
17814 !! test
17815 div with multiple empty attribute values
17816 !! config
17817 wgFragmentMode=[ 'html5', 'legacy' ]
17818 !! options
17819 parsoid=wt2html,html2html
17820 !! wikitext
17821 <div id= title=>HTML rocks</div>
17822 !! html/php
17823 <div id="title=">HTML rocks</div>
17824 !! html/parsoid
17825 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17826 !! end
17827
17828 # FIXME Parsoid doesn't actually match PHP here.
17829 !! test
17830 Extension tag in attribute value
17831 !! options
17832 wgRawHtml=1
17833 !! wikitext
17834 <span title="<html><div>123</div></html>">ok</span>
17835 !! html/php+tidy
17836 <p><span title="&lt;div&gt;123&lt;/div&gt;">ok</span>
17837 </p>
17838 !! html/parsoid
17839 <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>
17840 !! end
17841
17842 !! test
17843 table with multiple empty attribute values
17844 !! options
17845 parsoid=wt2html,html2html
17846 !! wikitext
17847 {| title= id=
17848 |hi
17849 |}
17850 !! html/php
17851 <table title="id=">
17852 <tr>
17853 <td>hi
17854 </td></tr></table>
17855 !! html/parsoid
17856 <table title="id=">
17857 <tbody><tr><td>hi</td></tr>
17858 </tbody></table>
17859 !! end
17860
17861 !! test
17862 div with braces in attribute value
17863 !! wikitext
17864 <div title="{}">Foo</div>
17865 !! html/php
17866 <div title="&#123;&#125;">Foo</div>
17867 !! html/parsoid
17868 <div title="{}">Foo</div>
17869 !! end
17870
17871 !! test
17872 div with empty attribute value, no space before equals
17873 !! options
17874 parsoid=wt2html,html2html
17875 !! wikitext
17876 <div class=>HTML rocks</div>
17877 !! html/php
17878 <div class="">HTML rocks</div>
17879 !! html/parsoid
17880 <div class="">HTML rocks</div>
17881 !! end
17882
17883 !! test
17884 HTML multiple attributes correction
17885 !! wikitext
17886 <p class="error" class="awesome">Awesome!</p>
17887 !! html
17888 <p class="awesome">Awesome!</p>
17889 !! end
17890
17891 !! test
17892 Table multiple attributes correction
17893 !! wikitext
17894 {|
17895 !+ class="error" class="awesome"|status
17896 |}
17897 !! html
17898 <table>
17899 <tr>
17900 <th class="awesome">status
17901 </th></tr></table>
17902 !! end
17903
17904 !! test
17905 DIV IN UPPERCASE
17906 !! wikitext
17907 <DIV ID="x">HTML ROCKS</DIV>
17908 !! html
17909 <div id="x">HTML ROCKS</div>
17910 !! end
17911
17912 !! test
17913 Non-ASCII pseudo-tags are rendered as text
17914 !! wikitext
17915 <khyô>
17916 !! html
17917 <p>&lt;khyô&gt;
17918 </p>
17919 !! end
17920
17921 !! test
17922 Pseudo-tag with URL 'name' renders as url link
17923 !! wikitext
17924 <http://example.com/>
17925 !! html
17926 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17927 </p>
17928 !! end
17929
17930 !! test
17931 text with amp in the middle of nowhere
17932 !! wikitext
17933 Remember AT&T?
17934 !! html
17935 <p>Remember AT&amp;T?
17936 </p>
17937 !! end
17938
17939 !! test
17940 text with character entity: eacute
17941 !! wikitext
17942 I always thought &eacute; was a cute letter.
17943 !! html+tidy
17944 <p>I always thought &#233; was a cute letter.
17945 </p>
17946 !! end
17947
17948 !! test
17949 text with entity-escaped character entity-like string: eacute
17950 !! wikitext
17951 I always thought &amp;eacute; was a cute letter.
17952 !! html
17953 <p>I always thought &amp;eacute; was a cute letter.
17954 </p>
17955 !! end
17956
17957 !! test
17958 text with undefined character entity: xacute
17959 !! wikitext
17960 I always thought &xacute; was a cute letter.
17961 !! html
17962 <p>I always thought &amp;xacute; was a cute letter.
17963 </p>
17964 !! end
17965
17966 !! test
17967 HTML5 tags
17968 !! wikitext
17969 <data value="5">five</data>
17970 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17971 <mark>This highlighted text</mark>
17972 !! html
17973 <p><data value="5">five</data>
17974 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17975 <mark>This highlighted text</mark>
17976 </p>
17977 !! end
17978
17979 !! test
17980 HTML tag with leading space is parsed as text
17981 !! wikitext
17982 < div>foo< /div>
17983 !! html
17984 <p>&lt; div&gt;foo&lt; /div&gt;
17985 </p>
17986 !! end
17987
17988 ## FIXME: The untrimmed attribute in Parsoid is T205737
17989 !! test
17990 Element with broken attribute syntax
17991 !! options
17992 parsoid=wt2html
17993 !! wikitext
17994 <div style=" style="123">hi</div>
17995 <div =>ho</div>
17996 !! html/php
17997 <div style="style=">hi</div>
17998 <div>ho</div>
17999 !! html/parsoid
18000 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
18001 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
18002 !! end
18003
18004 ###
18005 ### Nesting tests (see T43545, T52604, T53081)
18006 ###
18007
18008 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
18009 # Note that html2wt is considerably more difficult if we use <b> in
18010 # the test case, instead of <small>
18011 !! test
18012 Ensure that HTML adoption agency algorithm is properly implemented.
18013 !! wikitext
18014 <small>X<small>Y</small>Z</small>
18015 !! html
18016 <p><small>X<small>Y</small>Z</small>
18017 </p>
18018 !! end
18019
18020 # This was T43545 in the PHP parser.
18021 !! test
18022 Nesting of <kbd>
18023 !! wikitext
18024 <kbd>X<kbd>Y</kbd>Z</kbd>
18025 !! html+tidy
18026 <p><kbd>X<kbd>Y</kbd>Z</kbd>
18027 </p>
18028 !! end
18029
18030 # The following cases were T53081 in the PHP parser.
18031 # Note that there are some other nestable tags (b, i, etc) which are
18032 # not covered; see T53081 for discussion.
18033
18034 !! test
18035 Nesting of <em>
18036 !! wikitext
18037 <em>X<em>Y</em>Z</em>
18038 !! html+tidy
18039 <p><em>X<em>Y</em>Z</em>
18040 </p>
18041 !! end
18042
18043 !! test
18044 Nesting of <strong>
18045 !! wikitext
18046 <strong>X<strong>Y</strong>Z</strong>
18047 !! html+tidy
18048 <p><strong>X<strong>Y</strong>Z</strong>
18049 </p>
18050 !! end
18051
18052 !! test
18053 Nesting of <q>
18054 !! wikitext
18055 <q>X<q>Y</q>Z</q>
18056 !! html+tidy
18057 <p><q>X<q>Y</q>Z</q>
18058 </p>
18059 !! end
18060
18061 !! test
18062 Nesting of <ruby>
18063 !! wikitext
18064 <ruby>X<ruby>Y</ruby>Z</ruby>
18065 !! html
18066 <p><ruby>X<ruby>Y</ruby>Z</ruby>
18067 </p>
18068 !! end
18069
18070 !! test
18071 Nesting of <bdo>
18072 !! wikitext
18073 <bdo>X<bdo>Y</bdo>Z</bdo>
18074 !! html
18075 <p><bdo>X<bdo>Y</bdo>Z</bdo>
18076 </p>
18077 !! end
18078
18079
18080 ###
18081 ### Media links
18082 ###
18083
18084 !! test
18085 Media link
18086 !! wikitext
18087 [[Media:Foobar.jpg]]
18088 [[Media:Video.ogv]]
18089 [[:Media:Video.ogv]]
18090 !! html/php
18091 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
18092 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
18093 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
18094 </p>
18095 !! html/parsoid
18096 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
18097 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" resource="./Media:Video.ogv" title="Video.ogv">Media:Video.ogv</a>
18098 <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>
18099 !! end
18100
18101 !! test
18102 Media link with text
18103 !! wikitext
18104 [[Media:Foobar.jpg|A neat file to look at]]
18105 !! html/php
18106 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
18107 </p>
18108 !! html/parsoid
18109 <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>
18110 !! end
18111
18112 !! test
18113 Localized media link
18114 !! options
18115 language=is
18116 !! wikitext
18117 [[Miðill:Foobar.jpg]]
18118
18119 [[Miðill:Foobar.jpg|Icelandic]]
18120 !! html/php
18121 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Miðill:Foobar.jpg</a>
18122 </p><p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Icelandic</a>
18123 </p>
18124 !! html/parsoid
18125 <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>
18126 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Miðill:Foobar.jpg" title="Foobar.jpg">Icelandic</a></p>
18127 !! end
18128
18129 # FIXME: this is still bad HTML tag nesting
18130 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
18131 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
18132 !! test
18133 Media link with nasty text
18134 !! options
18135 parsoid=wt2html,html2html
18136 !! wikitext
18137 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
18138 !! html/php
18139 <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>
18140 !! html/php+tidy
18141 <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>
18142 !! html/parsoid
18143 <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>
18144 !! end
18145
18146 !! test
18147 Media link from missing resource (parsoid-only)
18148 !! options
18149 parsoid=html2wt
18150 !! html/parsoid
18151 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
18152 !! wikitext
18153 [[Media:Foobar.jpg|Bat!]]
18154 !! end
18155
18156 !! test
18157 Media link from missing resource, localized (parsoid-only)
18158 !! options
18159 parsoid=html2wt
18160 language=is
18161 !! html/parsoid
18162 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
18163 !! wikitext
18164 [[Miðill:Foobar.jpg|Bat!]]
18165 !! end
18166
18167 # This is a sanity test to ensure we don't crash or choke when given
18168 # old cached 1.7.0 HTML for media links; we don't require that the
18169 # result be "valid" because wt2wt was completely broken in 1.7.0
18170 !! test
18171 Media link from old 1.7.0 DOM spec (crash test, parsoid-only) T198511
18172 !! options
18173 parsoid=html2wt
18174 !! html/parsoid
18175 <p>This is what Parsoid would emit (and we still handle this HTML fine):</p>
18176 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18177 <p>But VisualEditor would mangle the rel attribute, and give us back this:</p>
18178 <p><a rel="mw:ExtLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18179 <p>But at least we don't crash when trying to handle the mangled HTML!</p>
18180 !! wikitext
18181 This is what Parsoid would emit (and we still handle this HTML fine):
18182
18183 [[Media:Foobar.jpg|A neat file to look at]]
18184
18185 But VisualEditor would mangle the rel attribute, and give us back this:
18186
18187 [//example.com/images/3/3a/Foobar.jpg A neat file to look at]
18188
18189 But at least we don't crash when trying to handle the mangled HTML!
18190 !! end
18191
18192 !! test
18193 Media link to nonexistent file (T3702)
18194 !! wikitext
18195 [[Media:No such.jpg]]
18196 [[Media:No_such file.jpg]]
18197 !! html/php
18198 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
18199 <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>
18200 </p>
18201 !! html/parsoid
18202 <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>
18203 <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>
18204 !! end
18205
18206 !! test
18207 Image link to nonexistent file (T3850 - good)
18208 !! wikitext
18209 [[File:No_such.jpg]]
18210 !! html/php
18211 <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>
18212 </p>
18213 !! html/parsoid
18214 <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="./File:No_such.jpg"><img resource="./File:No_such.jpg" src="./Special:FilePath/No_such.jpg" height="220" width="220"/></a></figure-inline></p>
18215 !! end
18216
18217 !! test
18218 :Image link to nonexistent file (T3850 - bad)
18219 !! wikitext
18220 [[:Image:No such.jpg]]
18221 !! html/php
18222 <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>
18223 </p>
18224 !! html/parsoid
18225 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
18226 !! end
18227
18228 !! test
18229 Character reference normalization in link text (T3938)
18230 !! wikitext
18231 [[Main Page|this&that]]
18232 !! html
18233 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
18234 </p>
18235 !!end
18236
18237 !! article
18238 אַ
18239 !! text
18240 Test for unicode normalization
18241
18242 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
18243 !! endarticle
18244
18245 !! test
18246 (T21451) Links should refer to the normalized form.
18247 !! wikitext
18248 [[&#xFB2E;]]
18249 [[&#x5d0;&#x5b7;]]
18250 [[&#x5d0;ַ]]
18251 [[א&#x5b7;]]
18252 [[אַ]]
18253 !! html
18254 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
18255 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
18256 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
18257 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
18258 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
18259 </p>
18260 !! end
18261
18262 !! test
18263 Empty attribute crash test (T4067)
18264 !! wikitext
18265 <font color="">foo</font>
18266 !! html
18267 <p><font color="">foo</font>
18268 </p>
18269 !! end
18270
18271 !! test
18272 Empty attribute crash test single-quotes (T4067)
18273 !! wikitext
18274 <font color=''>foo</font>
18275 !! html
18276 <p><font color="">foo</font>
18277 </p>
18278 !! end
18279
18280 !! test
18281 Attribute test: equals, then nothing
18282 !! options
18283 parsoid=wt2html,html2html
18284 !! wikitext
18285 <font color=>foo</font>
18286 !! html/php
18287 <p><font color="">foo</font>
18288 </p>
18289 !! html/parsoid
18290 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
18291 !! end
18292
18293 !! test
18294 Attribute test: unquoted value
18295 !! options
18296 parsoid=wt2html,html2html
18297 !! wikitext
18298 <font color=x>foo</font>
18299 !! html/php
18300 <p><font color="x">foo</font>
18301 </p>
18302 !! html/parsoid
18303 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
18304 !! end
18305
18306 !! test
18307 Attribute test: unquoted but illegal value (hash)
18308 !! wikitext
18309 <font color=#x>foo</font>
18310 !! html
18311 <p><font color="#x">foo</font>
18312 </p>
18313 !! end
18314
18315 # Parsoid does not serialize to empty attribute syntax,
18316 # so wt2wt and html2wt cases are skipped
18317 !! test
18318 Attribute test: no value (T54330)
18319 !! options
18320 parsoid=wt2html,html2html
18321 !! wikitext
18322 <font color>foo</font>
18323 !! html/php
18324 <p><font color="">foo</font>
18325 </p>
18326 !! html/parsoid
18327 <p><font color="">foo</font></p>
18328 !! end
18329
18330 !! test
18331 T4095: link with three closing brackets
18332 !! wikitext
18333 [[Main Page]]]
18334 !! html/php
18335 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
18336 </p>
18337 !! html/parsoid
18338 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
18339 !! end
18340
18341 !! test
18342 T4095: link with pipe and three closing brackets
18343 !! wikitext
18344 [[Main Page|link]]]
18345 !! html/php
18346 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
18347 </p>
18348 !! html/parsoid
18349 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
18350 !! end
18351
18352 !! test
18353 T4095: link with pipe and three closing brackets, version 2
18354 !! wikitext
18355 [[Main Page|[http://example.com/]]]
18356 !! html/php
18357 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
18358 </p>
18359 !! html/parsoid
18360 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
18361 !! end
18362
18363
18364 ###
18365 ### Safety
18366 ###
18367
18368 !! article
18369 Template:Dangerous attribute
18370 !! text
18371 " onmouseover="alert(document.cookie)
18372 !! endarticle
18373
18374 !! article
18375 Template:Dangerous style attribute
18376 !! text
18377 border-size: expression(alert(document.cookie))
18378 !! endarticle
18379
18380 !! article
18381 Template:Div style
18382 !! text
18383 <div style="float: right; {{{1}}}">Magic div</div>
18384 !! endarticle
18385
18386 !! test
18387 T4304: HTML attribute safety (safe template; regression T4309)
18388 !! wikitext
18389 <div title="{{test}}"></div>
18390 !! html/php
18391 <div title="This is a test template"></div>
18392 !! html/parsoid
18393 <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>
18394 !! end
18395
18396 # Parsoid has enough context to handle this case
18397 !! test
18398 T4304: HTML attribute safety (dangerous template; 2309)
18399 !! wikitext
18400 <div title="{{dangerous attribute}}"></div>
18401 !! html/php
18402 <div title=""></div>
18403 !! html/parsoid
18404 <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>
18405 !! end
18406
18407 !! test
18408 T4304: HTML attribute safety (dangerous style template; 2309)
18409 !! wikitext
18410 <div style="{{dangerous style attribute}}"></div>
18411 !! html/php
18412 <div style="/* insecure input */"></div>
18413 !! html/parsoid
18414 <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>
18415 !! end
18416
18417 !! test
18418 T4304: HTML attribute safety (safe parameter; 2309)
18419 !! wikitext
18420 {{div style|width: 200px}}
18421 !! html/php
18422 <div style="float: right; width: 200px">Magic div</div>
18423 !! html/parsoid
18424 <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>
18425 !! end
18426
18427 !! test
18428 T4304: HTML attribute safety (unsafe parameter; 2309)
18429 !! wikitext
18430 {{div style|width: expression(alert(document.cookie))}}
18431 !! html/php
18432 <div style="/* insecure input */">Magic div</div>
18433 !! html/parsoid
18434 <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>
18435 !! end
18436
18437 ## Parsoid output here differs; needs investigation.
18438 !! test
18439 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
18440 !! wikitext
18441 {{div style|"><script>alert(document.cookie)</script>}}
18442 !! html
18443 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18444 !! end
18445
18446 ## Parsoid output here differs; needs investigation.
18447 !! test
18448 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
18449 !! wikitext
18450 {{div style|" ><script>alert(document.cookie)</script>}}
18451 !! html
18452 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18453 !! end
18454
18455 !! test
18456 T4304: HTML attribute safety (link)
18457 !! wikitext
18458 <div title="[[Main Page]]"></div>
18459 !! html/php
18460 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
18461 !! html/parsoid
18462 <div title="[[Main Page]]"></div>
18463 !! end
18464
18465 !! test
18466 T4304: HTML attribute safety (italics)
18467 !! wikitext
18468 <div title="''foobar''"></div>
18469 !! html
18470 <div title="&#39;&#39;foobar&#39;&#39;"></div>
18471 !! end
18472
18473 !! test
18474 T4304: HTML attribute safety (bold)
18475 !! wikitext
18476 <div title="'''foobar'''"></div>
18477 !! html
18478 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
18479 !! end
18480
18481 !! test
18482 T4304: HTML attribute safety (ISBN)
18483 !! wikitext
18484 <div title="ISBN 1234567890"></div>
18485 !! html
18486 <div title="&#73;SBN 1234567890"></div>
18487 !! end
18488
18489 !! test
18490 T4304: HTML attribute safety (RFC)
18491 !! wikitext
18492 <div title="RFC 1234"></div>
18493 !! html
18494 <div title="&#82;FC 1234"></div>
18495 !! end
18496
18497 !! test
18498 T4304: HTML attribute safety (PMID)
18499 !! wikitext
18500 <div title="PMID 1234567890"></div>
18501 !! html
18502 <div title="&#80;MID 1234567890"></div>
18503 !! end
18504
18505 !! test
18506 T4304: HTML attribute safety (web link)
18507 !! wikitext
18508 <div title="http://example.com/"></div>
18509 !! html
18510 <div title="http&#58;//example.com/"></div>
18511 !! end
18512
18513 !! test
18514 T4304: HTML attribute safety (named web link)
18515 !! wikitext
18516 <div title="[http://example.com/ link]"></div>
18517 !! html/php
18518 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
18519 !! html/parsoid
18520 <div title="[http://example.com/ link]"></div>
18521 !! end
18522
18523 !! test
18524 T5244: HTML attribute safety (extension; safe)
18525 !! wikitext
18526 <div style="<nowiki>background:blue</nowiki>"></div>
18527 !! html/php
18528 <div style="background:blue"></div>
18529 !! html/parsoid
18530 <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>
18531 !! end
18532
18533 !! test
18534 T5244: HTML attribute safety (extension; unsafe)
18535 !! wikitext
18536 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
18537 !! html/php
18538 <div style="/* insecure input */"></div>
18539 !! html/parsoid
18540 <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>
18541 !! end
18542
18543 # More MSIE fun discovered by Tom Gilder
18544
18545 !! test
18546 MSIE CSS safety test: spurious slash
18547 !! wikitext
18548 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
18549 !! html/php
18550 <div style="/* insecure input */">evil</div>
18551 !! html/parsoid
18552 <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>
18553 !! end
18554
18555 !! test
18556 MSIE CSS safety test: hex code
18557 !! wikitext
18558 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
18559 !! html/php
18560 <div style="/* insecure input */">evil</div>
18561 !! html/parsoid
18562 <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>
18563 !! end
18564
18565 !! test
18566 MSIE CSS safety test: comment in url
18567 !! wikitext
18568 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
18569 !! html/php
18570 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
18571 !! html/parsoid
18572 <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>
18573 !! end
18574
18575 !! test
18576 MSIE CSS safety test: comment in expression
18577 !! wikitext
18578 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
18579 !! html/php
18580 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
18581 !! html/parsoid
18582 <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>
18583 !! end
18584
18585 !! test
18586 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
18587 !! wikitext
18588 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
18589 !! html/php
18590 <p style="/* invalid control char */">A</p>
18591 !! html/parsoid
18592 <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>
18593 !! end
18594
18595 !! test
18596 MSIE 6 CSS safety test: Fullwidth (T57332)
18597 !! wikitext
18598 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
18599 <div style="top:EXPRESSION(alert())">B</div>
18600 !! html/php
18601 <p style="/* insecure input */">A</p>
18602 <div style="/* insecure input */">B</div>
18603 !! html/parsoid
18604 <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>
18605 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
18606 !! end
18607
18608 !! test
18609 MSIE 6 CSS safety test: IPA extensions (T57332)
18610 !! wikitext
18611 <div style="background-image:uʀʟ(javascript:alert())">A</div>
18612 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
18613 !! html/php
18614 <div style="/* insecure input */">A</div>
18615 <p style="/* insecure input */">B</p>
18616 !! html/parsoid
18617 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
18618 <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>
18619 !! end
18620
18621 !! test
18622 MSIE 6 CSS safety test: sup/sub script (T57332)
18623 !! wikitext
18624 <div style="background-image:url⁽javascript:alert())">A</div>
18625 <div style="background-image:url₍javascript:alert())">B</div>
18626 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
18627 !! html/php
18628 <div style="/* insecure input */">A</div>
18629 <div style="/* insecure input */">B</div>
18630 <p style="/* insecure input */">C</p>
18631 !! html/parsoid
18632 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
18633 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
18634 <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>
18635 !! end
18636
18637 !! test
18638 Opera -o-link CSS
18639 !! options
18640 parsoid=wt2html,html2html
18641 !! wikitext
18642 <div
18643 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;"
18644 style="-o-link:attr(title);-o-link-source:current">X</div>
18645 !! html/php
18646 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
18647 !! html/parsoid
18648 <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>
18649 !! end
18650
18651 !! test
18652 MSIE 6 CSS safety test: Repetition markers (T57332)
18653 !! wikitext
18654 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
18655 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
18656 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
18657 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
18658 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
18659 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
18660 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
18661 !! html/php
18662 <p style="/* insecure input */">A</p>
18663 <p style="/* insecure input */">B</p>
18664 <p style="/* insecure input */">C</p>
18665 <p style="/* insecure input */">D</p>
18666 <p style="/* insecure input */">E</p>
18667 <p style="/* insecure input */">F</p>
18668 <p style="/* insecure input */">G</p>
18669 !! html/parsoid
18670 <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>
18671 <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>
18672 <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>
18673 <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>
18674 <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>
18675 <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>
18676 <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>
18677 !! end
18678
18679 !! test
18680 Table attribute legitimate extension
18681 !! wikitext
18682 {|
18683 !+ style="<nowiki>color:blue</nowiki>"|status
18684 |}
18685 !! html
18686 <table>
18687 <tr>
18688 <th style="color:blue">status
18689 </th></tr></table>
18690 !! end
18691
18692 !! test
18693 Table attribute safety
18694 !! wikitext
18695 {|
18696 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18697 |}
18698 !! html
18699 <table>
18700 <tr>
18701 <th style="/* insecure input */">status
18702 </th></tr></table>
18703 !! end
18704
18705 !! test
18706 CSS line continuation 1
18707 !! wikitext
18708 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18709 !! html
18710 <div style="/* insecure input */"></div>
18711 !! end
18712
18713 !! test
18714 CSS line continuation 2
18715 !! wikitext
18716 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18717 !! html
18718 <div style="/* invalid control char */"></div>
18719 !! end
18720
18721 !! article
18722 Template:Identity
18723 !! text
18724 {{{1}}}
18725 !! endarticle
18726
18727 !! test
18728 Expansion of multi-line templates in attribute values (T8255)
18729 !! wikitext
18730 <div style="background: {{identity|#00FF00}}">-</div>
18731 !! html
18732 <div style="background: #00FF00">-</div>
18733 !! end
18734
18735 !! test
18736 Expansion of multi-line templates in attribute values (T8255 sanity check)
18737 !! wikitext
18738 <div style="background:
18739 #00FF00">-</div>
18740 !! html/php
18741 <div style="background: #00FF00">-</div>
18742 !! html/parsoid
18743 <div style="background:
18744 #00FF00">-</div>
18745 !! end
18746
18747 !! test
18748 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18749 !! wikitext
18750 <div style="background: &#10;#00FF00">-</div>
18751 !! html
18752 <div style="background: &#10;#00FF00">-</div>
18753 !! end
18754
18755 !! test
18756 Tags which are hidden from tidiers cannot pass through the Sanitizer
18757 !! wikitext
18758 <mw:toc><script>alert();</script></mw:toc>
18759 !! html+tidy
18760 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18761 </p>
18762 !! end
18763
18764 ###
18765 ### Parser hooks (see tests/parser/ParserTestParserHook.php for the <tag> extension)
18766 ###
18767
18768 !! test
18769 Parser hook: empty input
18770 !! wikitext
18771 <tag></tag>
18772 !! html/php
18773 <pre>
18774 ''
18775 array (
18776 )
18777 </pre>
18778 !! html/parsoid
18779 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18780 !! end
18781
18782 ## Don't expect parsoid to rt this form.
18783 !! test
18784 Parser hook: empty input using terminated empty elements
18785 !! options
18786 parsoid=wt2html,html2html
18787 !! wikitext
18788 <tag/>
18789 !! html/php
18790 <pre>
18791 NULL
18792 array (
18793 )
18794 </pre>
18795 !! html/parsoid
18796 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
18797 !! end
18798
18799 !! test
18800 Parser hook: empty input using terminated empty elements (space before)
18801 !! wikitext
18802 <tag />
18803 !! html/php
18804 <pre>
18805 NULL
18806 array (
18807 )
18808 </pre>
18809 !! html/parsoid
18810 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
18811 !! end
18812
18813 !! test
18814 Parser hook: basic input
18815 !! wikitext
18816 <tag>input</tag>
18817 !! html/php
18818 <pre>
18819 'input'
18820 array (
18821 )
18822 </pre>
18823 !! html/parsoid
18824 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18825 !! end
18826
18827 ## Don't expect parsoid to rt this form.
18828 !! test
18829 Parser hook: case insensitive
18830 !! options
18831 parsoid=wt2html,html2html
18832 !! wikitext
18833 <TAG>input</TAG>
18834 !! html/php
18835 <pre>
18836 'input'
18837 array (
18838 )
18839 </pre>
18840 !! html/parsoid
18841 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18842 !! end
18843
18844 ## Don't expect parsoid to rt this form.
18845 !! test
18846 Parser hook: case insensitive, redux
18847 !! options
18848 parsoid=wt2html,html2html
18849 !! wikitext
18850 <TaG>input</TAg>
18851 !! html/php
18852 <pre>
18853 'input'
18854 array (
18855 )
18856 </pre>
18857 !! html/parsoid
18858 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18859 !! end
18860
18861 !! test
18862 Parser hook: nested tags
18863 !! options
18864 parsoid=wt2html
18865 !! wikitext
18866 <tag><tag></tag></tag>
18867 !! html/php
18868 <pre>
18869 '<tag>'
18870 array (
18871 )
18872 </pre>&lt;/tag&gt;
18873 !! html/php+tidy
18874 <pre>'<tag>'
18875 array (
18876 )
18877 </tag></pre><p>&lt;/tag&gt;</p>
18878 !! html/parsoid
18879 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}'></pre><p>&lt;/tag></p>
18880 !! end
18881
18882 !! test
18883 Parser hook: basic arguments
18884 !! wikitext
18885 <tag width="200" height="100" depth="50" square=""></tag>
18886 !! html/php
18887 <pre>
18888 ''
18889 array (
18890 'width' => '200',
18891 'height' => '100',
18892 'depth' => '50',
18893 'square' => '',
18894 )
18895 </pre>
18896 !! html/parsoid
18897 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18898 !! end
18899
18900 ## Don't expect parsoid to rt this form.
18901 !! test
18902 Parser hook: basic arguments, variations
18903 !! options
18904 parsoid=wt2html,html2html
18905 !! wikitext
18906 <tag width=200 height = "100" depth = '50' square></tag>
18907 !! html/php
18908 <pre>
18909 ''
18910 array (
18911 'width' => '200',
18912 'height' => '100',
18913 'depth' => '50',
18914 'square' => '',
18915 )
18916 </pre>
18917 !! html/parsoid
18918 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18919 !! end
18920
18921 !! test
18922 Parser hook: argument containing a forward slash (T7344)
18923 !! wikitext
18924 <tag filename="/tmp/bla"></tag>
18925 !! html/php
18926 <pre>
18927 ''
18928 array (
18929 'filename' => '/tmp/bla',
18930 )
18931 </pre>
18932 !! html/parsoid
18933 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18934 !! end
18935
18936 ## Don't expect parsoid to rt this form.
18937 !! test
18938 Parser hook: empty input using terminated empty elements (T4374)
18939 !! options
18940 parsoid=wt2html,html2html
18941 !! wikitext
18942 <tag foo=bar/>text
18943 !! html/php
18944 <pre>
18945 NULL
18946 array (
18947 'foo' => 'bar',
18948 )
18949 </pre>text
18950 !! html/parsoid
18951 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{"foo":"bar"}}'></pre><p>text</p>
18952 !! end
18953
18954 ## </tag> should be output literally since there is no matching tag that begins it
18955 ## Don't expect parsoid to rt this form.
18956 !! test
18957 Parser hook: basic arguments using terminated empty elements (T4374)
18958 !! options
18959 parsoid=wt2html
18960 !! wikitext
18961 <tag width=200 height = "100" depth = '50' square/>
18962 other stuff
18963 </tag>
18964 !! html/php
18965 <pre>
18966 NULL
18967 array (
18968 'width' => '200',
18969 'height' => '100',
18970 'depth' => '50',
18971 'square' => '',
18972 )
18973 </pre>
18974 <p>other stuff
18975 &lt;/tag&gt;
18976 </p>
18977 !! html/parsoid
18978 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""}}' about="#mwt2"></pre><p>other stuff
18979 &lt;/tag></p>
18980 !! end
18981
18982 ## Don't expect parsoid to rt this form.
18983 !! test
18984 Parser hook: Don't allow unclosed extension tags
18985 !! options
18986 parsoid=wt2html
18987 !! wikitext
18988 test <tag>123
18989
18990 this is a '''test'''
18991 !! html/php
18992 <p>test &lt;tag&gt;123
18993 </p><p>this is a <b>test</b>
18994 </p>
18995 !! html/parsoid
18996 <p>test &lt;tag>123</p>
18997
18998 <p>this is a <b>test</b></p>
18999 !! end
19000
19001 !! test
19002 Parser hook: horizontal rule inside extension tag that outputs <pre>
19003 !! wikitext
19004 <tag>
19005 Hello
19006 <hr/>
19007 Goodbye
19008 </tag>
19009 !! html/php
19010 <pre>
19011 '
19012 Hello
19013 <hr/>
19014 Goodbye
19015 '
19016 array (
19017 )
19018 </pre>
19019 !! end
19020
19021 ###
19022 ### (see tests/parser/ParserTestParserHook.php for the <statictag> extension)
19023 ###
19024
19025 !! test
19026 Parser hook: static parser hook not inside a comment
19027 !! wikitext
19028 <statictag>hello, world</statictag>
19029
19030 <statictag action="flush" />
19031 !! html/php
19032 <p><br />
19033 hello, world
19034 </p>
19035 !! html/parsoid
19036 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' about="#mwt2"></span></p>
19037 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"}}' about="#mwt4">hello, world</span></p>
19038 !! end
19039
19040 !! test
19041 Parser hook: static parser hook inside a comment
19042 !! wikitext
19043 <!-- <statictag>hello, world</statictag> -->
19044 <statictag action="flush" />
19045 !! html/php
19046 <p><br />
19047 </p>
19048 !! html/parsoid
19049 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
19050 <p><span typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about='#mwt2'></span></p>
19051 !! end
19052
19053 # Nested template calls; this case was broken by Parser.php rev 1.506,
19054 # since reverted.
19055
19056 !! article
19057 Template:One-parameter
19058 !! text
19059 (My parameter is: {{{1}}})
19060 !! endarticle
19061
19062 !! article
19063 Template:Map-one-parameter
19064 !! text
19065 {{{{{1}}}|{{{2}}}}}
19066 !! endarticle
19067
19068 !! test
19069 Nested template calls
19070 !! wikitext
19071 {{Map-one-parameter|One-parameter|param}}
19072 !! html
19073 <p>(My parameter is: param)
19074 </p>
19075 !! end
19076
19077
19078 ###
19079 ### Sanitizer
19080 ###
19081
19082 !! test
19083 Sanitizer: Closing of open tags
19084 !! wikitext
19085 <s></s><table></table>
19086 !! html/php+tidy
19087 <p><s></s></p><table></table>
19088 !! html/parsoid
19089 <p><s data-parsoid='{"stx":"html"}'></s></p><table data-parsoid='{"stx":"html"}'></table>
19090 !! end
19091
19092 !! test
19093 Sanitizer: Closing of open but not closed tags
19094 !! wikitext
19095 <s>foo
19096 !! html
19097 <p><s>foo</s>
19098 </p>
19099 !! end
19100
19101 !! test
19102 Sanitizer: Closing of closed but not open tags
19103 !! options
19104 parsoid=wt2html
19105 !! wikitext
19106 </s>
19107 !! html+tidy
19108 <p class="mw-empty-elt">
19109 </p>
19110 !! end
19111
19112 !! test
19113 Sanitizer: Closing of closed but not open table tags
19114 !! options
19115 parsoid=wt2html
19116 !! wikitext
19117 Table not started</td></tr></table>
19118 !! html+tidy
19119 <p>Table not started</p>
19120 !! end
19121
19122 !! test
19123 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
19124 !! options
19125 title=[[Main Page]]
19126 !! config
19127 wgFragmentMode=[ 'html5', 'legacy' ]
19128 !! wikitext
19129 <span id="æ: v">byte</span>[[#æ: v|backlink]]
19130 !! html/php
19131 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
19132 </p>
19133 !! html/parsoid
19134 <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>
19135 !! end
19136
19137 !! test
19138 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
19139 !! config
19140 wgFragmentMode=[ 'legacy' ]
19141 !! wikitext
19142 <span id="æ: v">byte</span>[[#æ: v|backlink]]
19143 !! html/php
19144 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
19145 </p>
19146 !! end
19147
19148 # In HTML5, the restrictions are that id must contain at least one character,
19149 # and must not contain any space characters.
19150 !! test
19151 Sanitizer: Validating the contents of the id attribute (T6515)
19152 !! options
19153 disabled
19154 !! wikitext
19155 <br id="" /><br id="a space" />
19156 !! html
19157 Something ...
19158 !! end
19159
19160 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
19161 !! test
19162 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
19163 !! options
19164 disabled
19165 !! wikitext
19166 <br id="foo" /><br id="foo" />
19167 !! html
19168 Something need to be done. foo-2 ?
19169 !! end
19170
19171 !! test
19172 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
19173 !! wikitext
19174 <div itemscope>
19175 <meta itemprop="hello" content="world">
19176 <meta http-equiv="refresh" content="5">
19177 <meta itemprop="hello" http-equiv="refresh" content="5">
19178 <link itemprop="hello" href="{{SERVER}}">
19179 <link rel="stylesheet" href="{{SERVER}}">
19180 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
19181 </div>
19182 !! html
19183 <div itemscope="">
19184 <p> <meta itemprop="hello" content="world" />
19185 &lt;meta http-equiv="refresh" content="5"&gt;
19186 <meta itemprop="hello" content="5" />
19187 <link itemprop="hello" href="http&#58;//example.org" />
19188 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
19189 <link itemprop="hello" href="http&#58;//example.org" />
19190 </p>
19191 </div>
19192 !! end
19193
19194 !! test
19195 Sanitizer: Strip comments from CSS attributes
19196 !! options
19197 parsoid=wt2html,wt2wt
19198 !! wikitext
19199 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
19200 !! html/php
19201 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
19202 </p>
19203 !! html/parsoid
19204 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
19205 !! end
19206
19207 !! test
19208 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
19209 !! wikitext
19210 [[meatball:Soft"Security]]
19211 !! html/php
19212 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
19213 </p>
19214 !! html/parsoid
19215 <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>
19216 !! end
19217
19218 !! test
19219 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
19220 !! wikitext
19221 [[meatball:Foo<Bar]]
19222 [[meatball:Foo>Bar]]
19223 [[meatball:Foo&lt;bar]]
19224 [[meatball:Foo&gt;bar]]
19225 !! html/php
19226 <p>[[meatball:Foo&lt;Bar]]
19227 [[meatball:Foo&gt;Bar]]
19228 [[meatball:Foo&lt;bar]]
19229 [[meatball:Foo&gt;bar]]
19230 </p>
19231 !! html/parsoid
19232 <p>[[meatball:Foo&lt;Bar]]
19233 [[meatball:Foo>Bar]]
19234 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
19235 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
19236 !! end
19237
19238 !! test
19239 Language converter: output gets cut off unexpectedly (T7757)
19240 !! options
19241 language=zh
19242 !! wikitext
19243 this bit is safe: }-
19244
19245 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
19246
19247 then we get cut off here: }-
19248
19249 all additional text is vanished
19250 !! html/php
19251 <p>this bit is safe: }-
19252 </p><p>but if we add a conversion instance: xxx
19253 </p><p>then we get cut off here: }-
19254 </p><p>all additional text is vanished
19255 </p>
19256 !! html/parsoid
19257 <p>this bit is safe: }-</p>
19258 <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>
19259 <p>then we get cut off here: }-</p>
19260 <p>all additional text is vanished</p>
19261 !! end
19262
19263 !! test
19264 Language converter glossary rules inside attributes (T119158)
19265 !! options
19266 language=sr variant=sr-el
19267 !! wikitext
19268 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
19269
19270 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
19271 !! html/php
19272 <p>
19273 </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>
19274 </p>
19275 !! html/parsoid
19276 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
19277
19278 <p><figure-inline class="mw-default-size" typeof="mw:Image"><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":{"alt":"foAjrjvi","resource":"./Датотека:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=-{}-foAjrjvi-{}-","resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
19279 !! end
19280
19281 !! test
19282 Self closed html pairs (T7487)
19283 !! wikitext
19284 <center><font id="bug" />Centered text</center>
19285 <div><font id="bug2" />In div text</div>
19286 !! html+tidy
19287 <center><font id="bug"></font>Centered text</center>
19288 <div><font id="bug2"></font>In div text</div>
19289 !! end
19290
19291 !! test
19292 Punctuation: nbsp before exclamation
19293 !! wikitext
19294 C'est grave !
19295 !! html
19296 <p>C'est grave&#160;!
19297 </p>
19298 !! end
19299
19300 !! test
19301 Punctuation: CSS !important (T13874)
19302 !! wikitext
19303 <div style="width:50% !important">important</div>
19304 !! html
19305 <div style="width:50% !important">important</div>
19306 !! end
19307
19308 !! test
19309 Punctuation: CSS ! important (T13874; with space after)
19310 !! wikitext
19311 <div style="width:50% ! important">important</div>
19312 !! html
19313 <div style="width:50%&#32;! important">important</div>
19314 !! end
19315
19316 !! test
19317 HTML bullet list, closed tags (T7497)
19318 !! wikitext
19319 <ul>
19320 <li>One</li>
19321 <li>Two</li>
19322 </ul>
19323 !! html/php
19324 <ul>
19325 <li>One</li>
19326 <li>Two</li>
19327 </ul>
19328 !! html/parsoid
19329 <ul data-parsoid='{"stx":"html"}'>
19330 <li data-parsoid='{"stx":"html"}'>One</li>
19331 <li data-parsoid='{"stx":"html"}'>Two</li>
19332 </ul>
19333 !! end
19334
19335 !! test
19336 HTML bullet list, unclosed tags (T7497)
19337 !! wikitext
19338 <ul>
19339 <li>One
19340 <li>Two
19341 </ul>
19342 !! html/php+tidy
19343 <ul>
19344 <li>One
19345 </li><li>Two
19346 </li></ul>
19347 !! html/parsoid
19348 <ul data-parsoid='{"stx":"html"}'>
19349 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19350 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19351 </ul>
19352 !! end
19353
19354 !! test
19355 HTML ordered list, closed tags (T7497)
19356 !! wikitext
19357 <ol>
19358 <li>One</li>
19359 <li>Two</li>
19360 </ol>
19361 !! html/php
19362 <ol>
19363 <li>One</li>
19364 <li>Two</li>
19365 </ol>
19366 !! html/parsoid
19367 <ol data-parsoid='{"stx":"html"}'>
19368 <li data-parsoid='{"stx":"html"}'>One</li>
19369 <li data-parsoid='{"stx":"html"}'>Two</li>
19370 </ol>
19371 !! end
19372
19373 !! test
19374 HTML ordered list, unclosed tags (T7497)
19375 !! options
19376 !! wikitext
19377 <ol>
19378 <li>One
19379 <li>Two
19380 </ol>
19381 !! html/php+tidy
19382 <ol>
19383 <li>One
19384 </li><li>Two
19385 </li></ol>
19386 !! html/parsoid
19387 <ol data-parsoid='{"stx":"html"}'>
19388 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19389 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19390 </ol>
19391 !! end
19392
19393 !! test
19394 HTML nested bullet list, closed tags (T7497)
19395 !! wikitext
19396 <ul>
19397 <li>One</li>
19398 <li>Two:
19399 <ul>
19400 <li>Sub-one</li>
19401 <li>Sub-two</li>
19402 </ul>
19403 </li>
19404 </ul>
19405 !! html/php
19406 <ul>
19407 <li>One</li>
19408 <li>Two:
19409 <ul>
19410 <li>Sub-one</li>
19411 <li>Sub-two</li>
19412 </ul>
19413 </li>
19414 </ul>
19415 !! html/parsoid
19416 <ul data-parsoid='{"stx":"html"}'>
19417 <li data-parsoid='{"stx":"html"}'>One</li>
19418 <li data-parsoid='{"stx":"html"}'>Two:
19419 <ul data-parsoid='{"stx":"html"}'>
19420 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
19421 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
19422 </ul>
19423 </li>
19424 </ul>
19425 !! end
19426
19427 !! test
19428 HTML nested bullet list, open tags (T7497)
19429 !! wikitext
19430 <ul>
19431 <li>One
19432 <li>Two:
19433 <ul>
19434 <li>Sub-one
19435 <li>Sub-two
19436 </ul>
19437 </ul>
19438 !! html+tidy
19439 <ul>
19440 <li>One
19441 </li><li>Two:
19442 <ul>
19443 <li>Sub-one
19444 </li><li>Sub-two
19445 </li></ul>
19446 </li></ul>
19447 !! end
19448
19449 !! test
19450 HTML nested ordered list, closed tags (T7497)
19451 !! wikitext
19452 <ol>
19453 <li>One</li>
19454 <li>Two:
19455 <ol>
19456 <li>Sub-one</li>
19457 <li>Sub-two</li>
19458 </ol>
19459 </li>
19460 </ol>
19461 !! html
19462 <ol>
19463 <li>One</li>
19464 <li>Two:
19465 <ol>
19466 <li>Sub-one</li>
19467 <li>Sub-two</li>
19468 </ol>
19469 </li>
19470 </ol>
19471 !! end
19472
19473 !! test
19474 HTML nested ordered list, open tags (T7497)
19475 !! wikitext
19476 <ol>
19477 <li>One
19478 <li>Two:
19479 <ol>
19480 <li>Sub-one
19481 <li>Sub-two
19482 </ol>
19483 </ol>
19484 !! html/php
19485 <ol>
19486 <li>One
19487 <li>Two:
19488 <ol>
19489 <li>Sub-one
19490 <li>Sub-two
19491 </ol>
19492 </ol>
19493 !! html/parsoid
19494 <ol>
19495 <li>One
19496 </li>
19497 <li>Two:
19498 <ol>
19499 <li>Sub-one
19500 </li>
19501 <li>Sub-two
19502 </li>
19503 </ol>
19504 </li>
19505 </ol>
19506 !! end
19507
19508 !! test
19509 HTML ordered list item with parameters oddity
19510 !! wikitext
19511 <ol><li id="fragment">One</li>
19512 </ol>
19513 !! html
19514 <ol><li id="fragment">One</li>
19515 </ol>
19516 !! end
19517
19518 # parsoid doesn't explicitly mark autonumbered links, see T55505
19519 !!test
19520 T7918: autonumbering
19521 !! wikitext
19522 [http://first/] [http://second] [ftp://ftp]
19523
19524 ftp://inlineftp
19525
19526 [mailto:enclosed@mail.tld With target]
19527
19528 [mailto:enclosed@mail.tld]
19529
19530 mailto:inline@mail.tld
19531 !! html/php
19532 <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>
19533 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
19534 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
19535 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
19536 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
19537 </p>
19538 !! html/parsoid
19539 <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>
19540 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
19541 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
19542 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
19543 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
19544 !! end
19545
19546
19547 #
19548 # Security and HTML correctness
19549 # From Nick Jenkins' fuzz testing
19550 #
19551
19552 !! test
19553 Fuzz testing: Parser13
19554 !! wikitext
19555 {|
19556 | http://a|
19557 !! html
19558 <table>
19559 <tr>
19560 <td>
19561 </td>
19562 </tr>
19563 </table>
19564 !! end
19565
19566 # Note that Parsoid output differs from the PHP parser here: the PHP
19567 # parser breaks the URL for the magic word, while in Parsoid the URL
19568 # production takes precedence.
19569 !! test
19570 Fuzz testing: Parser14
19571 !! wikitext
19572 ==onmouseover===
19573 http://__TOC__
19574 !! html/php
19575 <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>
19576 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>
19577 <ul>
19578 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19579 </ul>
19580 </div>
19581
19582 !! html/php+tidy
19583 <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>
19584 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>
19585 <ul>
19586 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19587 </ul>
19588 </div>
19589 !! html/parsoid
19590 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
19591 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
19592 !! end
19593
19594 !! test
19595 Fuzz testing: Parser14-table
19596 !! options
19597 parsoid=wt2html,html2html
19598 !! wikitext
19599 ==a==
19600 {| STYLE=__TOC__
19601 !! html/php
19602 <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>
19603 <table style="&#95;_TOC&#95;_">
19604 <tr><td></td></tr>
19605 </table>
19606 !! html/php+tidy
19607 <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>
19608 <table style="&#95;_TOC&#95;_">
19609 <tbody><tr><td></td></tr>
19610 </tbody></table>
19611 !! html/parsoid
19612 <h2 id="a">a</h2>
19613 <table style="__TOC__"></table>
19614 !! end
19615
19616 # Known to produce bogus xml (extra </td>)
19617 # Don't add the html/php section since it generates broken HTML
19618 !! test
19619 Fuzz testing: Parser16
19620 !! wikitext
19621 {|
19622 !https://||||||
19623 !! html+tidy
19624 <table>
19625 <tbody><tr>
19626 <th>https://</th>
19627 <th></th>
19628 <th></th>
19629 <th>
19630
19631 </th></tr>
19632 </tbody></table>
19633 !! end
19634
19635 !! test
19636 Fuzz testing: Parser21
19637 !! wikitext
19638 {|
19639 !irc://{{ftp://a" onmouseover="alert('hello world');"
19640 |
19641 !! html
19642 <table>
19643 <tr>
19644 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
19645 </th>
19646 <td>
19647 </td>
19648 </tr>
19649 </table>
19650 !! end
19651
19652 !! test
19653 Fuzz testing: Parser22
19654 !! wikitext
19655 http://===r:::https://b
19656
19657 {|
19658 !! html
19659 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
19660 </p>
19661 <table>
19662 <tr><td></td></tr>
19663 </table>
19664 !! end
19665
19666 ## Remex doesn't account for fostered content.
19667 ## Known to produce bad XML for now
19668 !! test
19669 Fuzz testing: Parser24
19670 !! options
19671 parsoid=wt2html
19672 !! wikitext
19673 {|
19674 {{{|
19675 <u CLASS=
19676 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19677 <br style="onmouseover='alert(document.cookie);' " />
19678
19679 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19680 |
19681 !! html/php
19682 <table>
19683 {{{|
19684 <u class="&#124;">}}}} &gt;
19685 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19686
19687 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19688 <tr>
19689 <td></u>
19690 </td>
19691 </tr>
19692 </table>
19693 !! html/php+tidy
19694
19695 {{{|
19696 <u class="&#124;">}}}} &gt;
19697 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19698
19699 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19700 </u><table><tbody><tr>
19701 <td>
19702 </td>
19703 </tr>
19704 </tbody></table>
19705 !! html/parsoid
19706 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
19707 {{{|
19708 <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>"}'/>}}}} >
19709 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/>
19710
19711 MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p>
19712 <table data-parsoid='{"autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedStart":true}'><td></td></tr></tbody></table>
19713 !! end
19714
19715 # Note: the current result listed for this is not what the original one was,
19716 # but the original bug was JavaScript injection, which is fixed in any case.
19717 # It's not clear that the original result listed was any more correct than the
19718 # current one. Original result:
19719 # <p>{{{|
19720 # </p>
19721 # <li class="&#124;&#124;">
19722 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19723 !!test
19724 Fuzz testing: Parser25 (T8055)
19725 !! wikitext
19726 {{{
19727 |
19728 <LI CLASS=||
19729 >
19730 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19731 !! html/php
19732 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19733 </p>
19734 !! html/parsoid
19735 <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"]}'>
19736 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19737 !! end
19738
19739 !!test
19740 Fuzz testing: URL adjacent extension (with space, clean)
19741 !! wikitext
19742 http://example.com <nowiki>junk</nowiki>
19743 !! html/php
19744 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19745 </p>
19746 !! html/parsoid
19747 <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>
19748 !! end
19749
19750 !!test
19751 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19752 !! wikitext
19753 http://example.com<nowiki>junk</nowiki>
19754 !! html/php
19755 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19756 </p>
19757 !! html/parsoid
19758 <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>
19759 !! end
19760
19761 !! test
19762 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19763 !! wikitext
19764 http://example.com<pre>junk</pre>
19765 !! html/php
19766 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19767 !! html/php+tidy
19768 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19769 !! html/parsoid
19770 <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>
19771 !! end
19772
19773 !! test
19774 Fuzz testing: image with bogus manual thumbnail
19775 !! wikitext
19776 [[Image:foobar.jpg|thumbnail= ]]
19777 !! html/php
19778 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19779 !! html/parsoid
19780 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' data-mw='{"errors":[{"key":"apierror-invalidtitle","message":"Invalid thumbnail title.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"Image:foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/Foobar.jpg" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
19781 !! end
19782
19783 # Parsoid will emit the newline literally in wt2wt; see next test case.
19784 !! test
19785 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19786 !! options
19787 parsoid=wt2html
19788 !! wikitext
19789 <pre dir="&#10;"></pre>
19790 !! html/php
19791 <pre dir="&#10;"></pre>
19792 !! html/parsoid
19793 <pre dir="
19794 " typeof="mw:Extension/pre" about="#mwt2"data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19795 !! end
19796
19797 !! test
19798 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19799 !! options
19800 parsoid=html2wt
19801 !! html/parsoid
19802 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19803 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19804 !! wikitext
19805 <pre dir="
19806 "></pre>
19807 !! html/php
19808 <pre dir=""></pre>
19809 !! end
19810
19811 !! test
19812 Templates in extension attributes are not expanded
19813 !! wikitext
19814 <pre dir="{{echo|ltr}}"></pre>
19815 !! html/php
19816 <pre dir="{{echo|ltr}}"></pre>
19817 !! html/parsoid
19818 <pre dir="{{echo|ltr}}" typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19819 !! end
19820
19821 !! test
19822 Parsing optional HTML elements (T8171)
19823 !! options
19824 !! wikitext
19825 <table>
19826 <tr>
19827 <td> Some tabular data</td>
19828 <td> More tabular data ...
19829 <td> And yet som tabular data</td>
19830 </tr>
19831 </table>
19832 !! html
19833 <table>
19834 <tr>
19835 <td> Some tabular data</td>
19836 <td> More tabular data ...
19837 </td><td> And yet som tabular data</td>
19838 </tr>
19839 </table>
19840 !! end
19841
19842 !! test
19843 Correct handling of <td>, <tr> (T8171)
19844 !! options
19845 !! wikitext
19846 <table>
19847 <tr>
19848 <td> Some tabular data</td>
19849 <td> More tabular data ...</td>
19850 <td> And yet som tabular data</td>
19851 </tr>
19852 </table>
19853 !! html
19854 <table>
19855 <tr>
19856 <td> Some tabular data</td>
19857 <td> More tabular data ...</td>
19858 <td> And yet som tabular data</td>
19859 </tr>
19860 </table>
19861 !! end
19862
19863
19864 !! test
19865 Parsing crashing regression (fr:JavaScript)
19866 !! wikitext
19867 </body></x>
19868 !! html
19869 <p>&lt;/body&gt;&lt;/x&gt;
19870 </p>
19871 !! end
19872
19873 !! test
19874 Inline wiki vs wiki block nesting
19875 !! wikitext
19876 '''Bold paragraph
19877
19878 New wiki paragraph
19879 !! html
19880 <p><b>Bold paragraph</b>
19881 </p><p>New wiki paragraph
19882 </p>
19883 !! end
19884
19885 # FIXME: The current php output is documented
19886 # and desired output is the parsoid target.
19887 !! test
19888 Inline HTML vs wiki block nesting
19889 !! wikitext
19890 <b>Bold paragraph
19891
19892 New wiki paragraph
19893 !! html/php
19894 <p><b>Bold paragraph
19895 </p><p>New wiki paragraph</b>
19896 </p>
19897 !! html/php+tidy
19898 <p><b>Bold paragraph
19899 </b></p><p><b>New wiki paragraph
19900 </b></p>
19901 !! html/parsoid
19902 <p><b>Bold paragraph</b>
19903 </p><p>New wiki paragraph
19904 </p>
19905 !! end
19906
19907 # Original result was this:
19908 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19909 # </p>
19910 # While that might be marginally more intuitive, maybe, the six-apostrophe
19911 # construct is clearly pathological and the result stated here (which is what
19912 # the parser actually does) is about as reasonable as anything.
19913 !!test
19914 Mixing markup for italics and bold
19915 !! options
19916 !! wikitext
19917 '''bold''''''bold''bolditalics'''''
19918 !! html
19919 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19920 </p>
19921 !! end
19922
19923
19924 !! article
19925 Xyzzyx
19926 !! text
19927 Article for special page transclusion test
19928 !! endarticle
19929
19930 !! test
19931 Special page transclusion
19932 !! options
19933 !! wikitext
19934 {{Special:Prefixindex/Xyzzyx}}
19935 !! html
19936 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19937 </ul>
19938 !! end
19939
19940 !! test
19941 Special page transclusion twice (T7021)
19942 !! options
19943 !! wikitext
19944 {{Special:Prefixindex/Xyzzyx}}
19945 {{Special:Prefixindex/Xyzzyx}}
19946 !! html
19947 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19948 </ul>
19949 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19950 </ul>
19951 !! end
19952
19953 !! test
19954 Transclusion of default MediaWiki message
19955 !! wikitext
19956 {{MediaWiki:Mainpage}}
19957 !! html
19958 <p>Main Page
19959 </p>
19960 !! end
19961
19962 !! test
19963 Transclusion of nonexistent MediaWiki message
19964 !! wikitext
19965 {{MediaWiki:Mainpagexxx}}
19966 !! html
19967 <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>
19968 </p>
19969 !! end
19970
19971 !! test
19972 Transclusion of MediaWiki message with underscore
19973 !! wikitext
19974 {{MediaWiki:history_short}}
19975 !! html
19976 <p>History
19977 </p>
19978 !! end
19979
19980 !! test
19981 Transclusion of MediaWiki message with space
19982 !! wikitext
19983 {{MediaWiki:history short}}
19984 !! html
19985 <p>History
19986 </p>
19987 !! end
19988
19989 !! test
19990 Invalid header with following text
19991 !! wikitext
19992 = x = y
19993 !! html
19994 <p>= x = y
19995 </p>
19996 !! end
19997
19998
19999 !! test
20000 Section extraction test (section 0)
20001 !! options
20002 section=0
20003 !! wikitext
20004 start
20005 ==a==
20006 ===aa===
20007 ====aaa====
20008 ==b==
20009 ===ba===
20010 ===bb===
20011 ====bba====
20012 ===bc===
20013 ==c==
20014 ===ca===
20015 !! html/php
20016 start
20017 !! end
20018
20019 !! test
20020 Section extraction test (section 1)
20021 !! options
20022 section=1
20023 !! wikitext
20024 start
20025 ==a==
20026 ===aa===
20027 ====aaa====
20028 ==b==
20029 ===ba===
20030 ===bb===
20031 ====bba====
20032 ===bc===
20033 ==c==
20034 ===ca===
20035 !! html/php
20036 ==a==
20037 ===aa===
20038 ====aaa====
20039 !! end
20040
20041 !! test
20042 Section extraction test (section 2)
20043 !! options
20044 section=2
20045 !! wikitext
20046 start
20047 ==a==
20048 ===aa===
20049 ====aaa====
20050 ==b==
20051 ===ba===
20052 ===bb===
20053 ====bba====
20054 ===bc===
20055 ==c==
20056 ===ca===
20057 !! html/php
20058 ===aa===
20059 ====aaa====
20060 !! end
20061
20062 !! test
20063 Section extraction test (section 3)
20064 !! options
20065 section=3
20066 !! wikitext
20067 start
20068 ==a==
20069 ===aa===
20070 ====aaa====
20071 ==b==
20072 ===ba===
20073 ===bb===
20074 ====bba====
20075 ===bc===
20076 ==c==
20077 ===ca===
20078 !! html/php
20079 ====aaa====
20080 !! end
20081
20082 !! test
20083 Section extraction test (section 4)
20084 !! options
20085 section=4
20086 !! wikitext
20087 start
20088 ==a==
20089 ===aa===
20090 ====aaa====
20091 ==b==
20092 ===ba===
20093 ===bb===
20094 ====bba====
20095 ===bc===
20096 ==c==
20097 ===ca===
20098 !! html/php
20099 ==b==
20100 ===ba===
20101 ===bb===
20102 ====bba====
20103 ===bc===
20104 !! end
20105
20106 !! test
20107 Section extraction test (section 5)
20108 !! options
20109 section=5
20110 !! wikitext
20111 start
20112 ==a==
20113 ===aa===
20114 ====aaa====
20115 ==b==
20116 ===ba===
20117 ===bb===
20118 ====bba====
20119 ===bc===
20120 ==c==
20121 ===ca===
20122 !! html/php
20123 ===ba===
20124 !! end
20125
20126 !! test
20127 Section extraction test (section 6)
20128 !! options
20129 section=6
20130 !! wikitext
20131 start
20132 ==a==
20133 ===aa===
20134 ====aaa====
20135 ==b==
20136 ===ba===
20137 ===bb===
20138 ====bba====
20139 ===bc===
20140 ==c==
20141 ===ca===
20142 !! html/php
20143 ===bb===
20144 ====bba====
20145 !! end
20146
20147 !! test
20148 Section extraction test (section 7)
20149 !! options
20150 section=7
20151 !! wikitext
20152 start
20153 ==a==
20154 ===aa===
20155 ====aaa====
20156 ==b==
20157 ===ba===
20158 ===bb===
20159 ====bba====
20160 ===bc===
20161 ==c==
20162 ===ca===
20163 !! html/php
20164 ====bba====
20165 !! end
20166
20167 !! test
20168 Section extraction test (section 8)
20169 !! options
20170 section=8
20171 !! wikitext
20172 start
20173 ==a==
20174 ===aa===
20175 ====aaa====
20176 ==b==
20177 ===ba===
20178 ===bb===
20179 ====bba====
20180 ===bc===
20181 ==c==
20182 ===ca===
20183 !! html/php
20184 ===bc===
20185 !! end
20186
20187 !! test
20188 Section extraction test (section 9)
20189 !! options
20190 section=9
20191 !! wikitext
20192 start
20193 ==a==
20194 ===aa===
20195 ====aaa====
20196 ==b==
20197 ===ba===
20198 ===bb===
20199 ====bba====
20200 ===bc===
20201 ==c==
20202 ===ca===
20203 !! html/php
20204 ==c==
20205 ===ca===
20206 !! end
20207
20208 !! test
20209 Section extraction test (section 10)
20210 !! options
20211 section=10
20212 !! wikitext
20213 start
20214 ==a==
20215 ===aa===
20216 ====aaa====
20217 ==b==
20218 ===ba===
20219 ===bb===
20220 ====bba====
20221 ===bc===
20222 ==c==
20223 ===ca===
20224 !! html/php
20225 ===ca===
20226 !! end
20227
20228 !! test
20229 Section extraction test (nonexistent section 11)
20230 !! options
20231 section=11
20232 !! wikitext
20233 start
20234 ==a==
20235 ===aa===
20236 ====aaa====
20237 ==b==
20238 ===ba===
20239 ===bb===
20240 ====bba====
20241 ===bc===
20242 ==c==
20243 ===ca===
20244 !! html/php
20245 !! end
20246
20247 !! test
20248 Section extraction test with bogus heading (section 1)
20249 !! options
20250 section=1
20251 !! wikitext
20252 ==a==
20253 ==bogus== not a legal section
20254 ==b==
20255 !! html/php
20256 ==a==
20257 ==bogus== not a legal section
20258 !! end
20259
20260 !! test
20261 Section extraction test with bogus heading (section 2)
20262 !! options
20263 section=2
20264 !! wikitext
20265 ==a==
20266 ==bogus== not a legal section
20267 ==b==
20268 !! html/php
20269 ==b==
20270 !! end
20271
20272 !! test
20273 Section extraction test with comment after heading (section 1)
20274 !! options
20275 section=1
20276 !! wikitext
20277 ==a==
20278 ==b== <!-- -->
20279 ==c==
20280 !! html/php
20281 ==a==
20282 !! end
20283
20284 !! test
20285 Section extraction test with comment after heading (section 2)
20286 !! options
20287 section=2
20288 !! wikitext
20289 ==a==
20290 ==b== <!-- -->
20291 ==c==
20292 !! html/php
20293 ==b== <!-- -->
20294 !! end
20295
20296 !! test
20297 Section extraction test with bogus <nowiki> heading (section 1)
20298 !! options
20299 section=1
20300 !! wikitext
20301 ==a==
20302 ==bogus== <nowiki>not a legal section</nowiki>
20303 ==b==
20304 !! html/php
20305 ==a==
20306 ==bogus== <nowiki>not a legal section</nowiki>
20307 !! end
20308
20309 !! test
20310 Section extraction test with bogus <nowiki> heading (section 2)
20311 !! options
20312 section=2
20313 !! wikitext
20314 ==a==
20315 ==bogus== <nowiki>not a legal section</nowiki>
20316 ==b==
20317 !! html/php
20318 ==b==
20319 !! end
20320
20321 # Formerly testing for T4587, now resolved by the use of unmarked sections
20322 # instead of respecting commented sections
20323 !! test
20324 Section extraction prefixed by comment (section 1)
20325 !! options
20326 section=1
20327 !! wikitext
20328 <!-- -->==sec1==
20329 ==sec2==
20330 !! html/php
20331 ==sec2==
20332 !!end
20333
20334 !! test
20335 Section extraction prefixed by comment (section 2)
20336 !! options
20337 section=2
20338 !! wikitext
20339 <!-- -->==sec1==
20340 ==sec2==
20341 !! html/php
20342 !! end
20343
20344 # Formerly testing for T4607, now resolved by the use of unmarked sections
20345 # instead of respecting HTML-style headings
20346 !! test
20347 Section extraction, mixed wiki and html (section 1)
20348 !! options
20349 section=1
20350 !! wikitext
20351 <h2>unmarked</h2>
20352 unmarked
20353 ==1==
20354 one
20355 ==2==
20356 two
20357 !! html/php
20358 ==1==
20359 one
20360 !! end
20361
20362 !! test
20363 Section extraction, mixed wiki and html (section 2)
20364 !! options
20365 section=2
20366 !! wikitext
20367 <h2>unmarked</h2>
20368 unmarked
20369 ==1==
20370 one
20371 ==2==
20372 two
20373 !! html/php
20374 ==2==
20375 two
20376 !! end
20377
20378
20379 # Formerly testing for T5342
20380 !! test
20381 Section extraction, heading surrounded by <noinclude>
20382 !! options
20383 section=1
20384 !! wikitext
20385 <noinclude>==unmarked==</noinclude>
20386 ==marked==
20387 !! html/php
20388 ==marked==
20389 !!end
20390
20391 # Test behavior of T21910
20392 !! test
20393 Sectiion with all-equals
20394 !! options
20395 section=2
20396 !! wikitext
20397 ===
20398 The line above must have a trailing space
20399 === <!--
20400 --> <!-- -->
20401 But just in case it doesn't...
20402 !! html/php
20403 === <!--
20404 --> <!-- -->
20405 But just in case it doesn't...
20406 !! end
20407
20408 !! test
20409 Section replacement test (section 0)
20410 !! options
20411 replace=0,"xxx"
20412 !! wikitext
20413 start
20414 ==a==
20415 ===aa===
20416 ====aaa====
20417 ==b==
20418 ===ba===
20419 ===bb===
20420 ====bba====
20421 ===bc===
20422 ==c==
20423 ===ca===
20424 !! html/php
20425 xxx
20426
20427 ==a==
20428 ===aa===
20429 ====aaa====
20430 ==b==
20431 ===ba===
20432 ===bb===
20433 ====bba====
20434 ===bc===
20435 ==c==
20436 ===ca===
20437 !! end
20438
20439 !! test
20440 Section replacement test (section 1)
20441 !! options
20442 replace=1,"xxx"
20443 !! wikitext
20444 start
20445 ==a==
20446 ===aa===
20447 ====aaa====
20448 ==b==
20449 ===ba===
20450 ===bb===
20451 ====bba====
20452 ===bc===
20453 ==c==
20454 ===ca===
20455 !! html/php
20456 start
20457 xxx
20458
20459 ==b==
20460 ===ba===
20461 ===bb===
20462 ====bba====
20463 ===bc===
20464 ==c==
20465 ===ca===
20466 !! end
20467
20468 !! test
20469 Section replacement test (section 2)
20470 !! options
20471 replace=2,"xxx"
20472 !! wikitext
20473 start
20474 ==a==
20475 ===aa===
20476 ====aaa====
20477 ==b==
20478 ===ba===
20479 ===bb===
20480 ====bba====
20481 ===bc===
20482 ==c==
20483 ===ca===
20484 !! html/php
20485 start
20486 ==a==
20487 xxx
20488
20489 ==b==
20490 ===ba===
20491 ===bb===
20492 ====bba====
20493 ===bc===
20494 ==c==
20495 ===ca===
20496 !! end
20497
20498 !! test
20499 Section replacement test (section 3)
20500 !! options
20501 replace=3,"xxx"
20502 !! wikitext
20503 start
20504 ==a==
20505 ===aa===
20506 ====aaa====
20507 ==b==
20508 ===ba===
20509 ===bb===
20510 ====bba====
20511 ===bc===
20512 ==c==
20513 ===ca===
20514 !! html/php
20515 start
20516 ==a==
20517 ===aa===
20518 xxx
20519
20520 ==b==
20521 ===ba===
20522 ===bb===
20523 ====bba====
20524 ===bc===
20525 ==c==
20526 ===ca===
20527 !! end
20528
20529 !! test
20530 Section replacement test (section 4)
20531 !! options
20532 replace=4,"xxx"
20533 !! wikitext
20534 start
20535 ==a==
20536 ===aa===
20537 ====aaa====
20538 ==b==
20539 ===ba===
20540 ===bb===
20541 ====bba====
20542 ===bc===
20543 ==c==
20544 ===ca===
20545 !! html/php
20546 start
20547 ==a==
20548 ===aa===
20549 ====aaa====
20550 xxx
20551
20552 ==c==
20553 ===ca===
20554 !! end
20555
20556 !! test
20557 Section replacement test (section 5)
20558 !! options
20559 replace=5,"xxx"
20560 !! wikitext
20561 start
20562 ==a==
20563 ===aa===
20564 ====aaa====
20565 ==b==
20566 ===ba===
20567 ===bb===
20568 ====bba====
20569 ===bc===
20570 ==c==
20571 ===ca===
20572 !! html/php
20573 start
20574 ==a==
20575 ===aa===
20576 ====aaa====
20577 ==b==
20578 xxx
20579
20580 ===bb===
20581 ====bba====
20582 ===bc===
20583 ==c==
20584 ===ca===
20585 !! end
20586
20587 !! test
20588 Section replacement test (section 6)
20589 !! options
20590 replace=6,"xxx"
20591 !! wikitext
20592 start
20593 ==a==
20594 ===aa===
20595 ====aaa====
20596 ==b==
20597 ===ba===
20598 ===bb===
20599 ====bba====
20600 ===bc===
20601 ==c==
20602 ===ca===
20603 !! html/php
20604 start
20605 ==a==
20606 ===aa===
20607 ====aaa====
20608 ==b==
20609 ===ba===
20610 xxx
20611
20612 ===bc===
20613 ==c==
20614 ===ca===
20615 !! end
20616
20617 !! test
20618 Section replacement test (section 7)
20619 !! options
20620 replace=7,"xxx"
20621 !! wikitext
20622 start
20623 ==a==
20624 ===aa===
20625 ====aaa====
20626 ==b==
20627 ===ba===
20628 ===bb===
20629 ====bba====
20630 ===bc===
20631 ==c==
20632 ===ca===
20633 !! html/php
20634 start
20635 ==a==
20636 ===aa===
20637 ====aaa====
20638 ==b==
20639 ===ba===
20640 ===bb===
20641 xxx
20642
20643 ===bc===
20644 ==c==
20645 ===ca===
20646 !! end
20647
20648 !! test
20649 Section replacement test (section 8)
20650 !! options
20651 replace=8,"xxx"
20652 !! wikitext
20653 start
20654 ==a==
20655 ===aa===
20656 ====aaa====
20657 ==b==
20658 ===ba===
20659 ===bb===
20660 ====bba====
20661 ===bc===
20662 ==c==
20663 ===ca===
20664 !! html/php
20665 start
20666 ==a==
20667 ===aa===
20668 ====aaa====
20669 ==b==
20670 ===ba===
20671 ===bb===
20672 ====bba====
20673 xxx
20674
20675 ==c==
20676 ===ca===
20677 !!end
20678
20679 !! test
20680 Section replacement test (section 9)
20681 !! options
20682 replace=9,"xxx"
20683 !! wikitext
20684 start
20685 ==a==
20686 ===aa===
20687 ====aaa====
20688 ==b==
20689 ===ba===
20690 ===bb===
20691 ====bba====
20692 ===bc===
20693 ==c==
20694 ===ca===
20695 !! html/php
20696 start
20697 ==a==
20698 ===aa===
20699 ====aaa====
20700 ==b==
20701 ===ba===
20702 ===bb===
20703 ====bba====
20704 ===bc===
20705 xxx
20706 !! end
20707
20708 !! test
20709 Section replacement test (section 10)
20710 !! options
20711 replace=10,"xxx"
20712 !! wikitext
20713 start
20714 ==a==
20715 ===aa===
20716 ====aaa====
20717 ==b==
20718 ===ba===
20719 ===bb===
20720 ====bba====
20721 ===bc===
20722 ==c==
20723 ===ca===
20724 !! html/php
20725 start
20726 ==a==
20727 ===aa===
20728 ====aaa====
20729 ==b==
20730 ===ba===
20731 ===bb===
20732 ====bba====
20733 ===bc===
20734 ==c==
20735 xxx
20736 !! end
20737
20738 !! test
20739 Section replacement test with initial whitespace (T15728)
20740 !! options
20741 replace=2,"xxx"
20742 !! wikitext
20743 Preformatted initial line
20744 ==a==
20745 ===a===
20746 !! html/php
20747 Preformatted initial line
20748 ==a==
20749 xxx
20750 !! end
20751
20752
20753 !! test
20754 Section extraction, heading followed by pre with 20 spaces (T8398)
20755 !! options
20756 section=1
20757 !! wikitext
20758 ==a==
20759 a
20760 !! html/php
20761 ==a==
20762 a
20763 !! end
20764
20765 !! test
20766 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20767 !! options
20768 section=1
20769 !! wikitext
20770 ==a==
20771 a
20772 !! html/php
20773 ==a==
20774 a
20775 !! end
20776
20777
20778 !! test
20779 Section extraction, <pre> around bogus header (T12309)
20780 !! options
20781 section=2
20782 !! wikitext
20783 == Section One ==
20784 <pre>
20785 =======
20786 </pre>
20787
20788 == Section Two ==
20789 stuff
20790 !! html/php
20791 == Section Two ==
20792 stuff
20793 !! end
20794
20795 !! test
20796 Section replacement, <pre> around bogus header (T12309)
20797 !! options
20798 replace=2,"xxx"
20799 !! wikitext
20800 == Section One ==
20801 <pre>
20802 =======
20803 </pre>
20804
20805 == Section Two ==
20806 stuff
20807 !! html/php
20808 == Section One ==
20809 <pre>
20810 =======
20811 </pre>
20812
20813 xxx
20814 !! end
20815
20816 !! test
20817 Handling of &#x0A; in URLs
20818 !! wikitext
20819 *irc://&#x0A;a
20820 !! html/php
20821 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20822 !! html/parsoid
20823 <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>
20824 !! end
20825
20826 !! test
20827 Handling of %0A in URLs
20828 !! wikitext
20829 *irc://%0Aa
20830 !! html/php
20831 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20832 !! html/parsoid
20833 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20834 !! end
20835
20836 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20837 !! test
20838 5 quotes, code coverage +1 line
20839 !! options
20840 parsoid=wt2html
20841 !! wikitext
20842 '''''
20843 !! html/php
20844 !! html/parsoid
20845 <p><b><i></i></b></p>
20846 !! end
20847
20848 # same html as previous, but wikitext adjusted to match parsoid html2wt
20849 # note that wt2html and html2html will put the <i> before the <b>
20850 !! test
20851 5 quotes, code coverage +1 line w/ nowiki (1)
20852 !! options
20853 parsoid=wt2wt,html2wt
20854 !! wikitext
20855 '''''<nowiki/>'''''
20856 !! html/php
20857 <p><i></i>
20858 </p>
20859 !! html/parsoid
20860 <p><b><i></i></b></p>
20861 !! end
20862
20863 # same as previous, just swapping the <i> and <b>
20864 !! test
20865 5 quotes, code coverage +1 line w/ nowiki (2)
20866 !! wikitext
20867 '''''<nowiki/>'''''
20868 !! html/php
20869 <p><i></i>
20870 </p>
20871 !! html/parsoid
20872 <p><i><b></b></i></p>
20873 !! end
20874
20875 !! test
20876 Special:Search page linking.
20877 !! wikitext
20878 {{Special:search}}
20879 !! html
20880 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20881 </p>
20882 !! end
20883
20884 !! test
20885 {{!}} is a magic word
20886 !! wikitext
20887 {{!}} is a magic word there and {{!}} is still a magic word here
20888 | is not a magic word here but {{!}} is still a magic word here
20889 !! html/php
20890 <p>| is a magic word there and | is still a magic word here
20891 | is not a magic word here but | is still a magic word here
20892 </p>
20893 !! html/parsoid
20894 <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
20895 | 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>
20896 !! end
20897
20898 !! test
20899 Say the magic word
20900 !! options
20901 title=[[Parser test]]
20902 !! wikitext
20903 *{{PAGENAME}}
20904 *{{PAGENAMEE}}
20905 *{{FULLPAGENAME}}
20906 *{{FULLPAGENAMEE}}
20907 *{{BASEPAGENAME}}
20908 *{{BASEPAGENAMEE}}
20909 *{{SUBPAGENAME}}
20910 *{{SUBPAGENAMEE}}
20911 *{{ROOTPAGENAME}}
20912 *{{ROOTPAGENAMEE}}
20913 *{{TALKPAGENAME}}
20914 *{{TALKPAGENAMEE}}
20915 *{{SUBJECTPAGENAME}}
20916 *{{SUBJECTPAGENAMEE}}
20917 *{{NAMESPACEE}}
20918 *{{NAMESPACE}}
20919 *{{NAMESPACENUMBER}}
20920 *{{TALKSPACE}}
20921 *{{TALKSPACEE}}
20922 *{{SUBJECTSPACE}}
20923 *{{SUBJECTSPACEE}}
20924 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20925 !! html
20926 <ul><li>Parser test</li>
20927 <li>Parser_test</li>
20928 <li>Parser test</li>
20929 <li>Parser_test</li>
20930 <li>Parser test</li>
20931 <li>Parser_test</li>
20932 <li>Parser test</li>
20933 <li>Parser_test</li>
20934 <li>Parser test</li>
20935 <li>Parser_test</li>
20936 <li>Talk:Parser test</li>
20937 <li>Talk:Parser_test</li>
20938 <li>Parser test</li>
20939 <li>Parser_test</li>
20940 <li></li>
20941 <li></li>
20942 <li>0</li>
20943 <li>Talk</li>
20944 <li>Talk</li>
20945 <li></li>
20946 <li></li>
20947 <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>
20948 !! end
20949 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20950
20951 !! test
20952 Gallery with valid attributes
20953 !! wikitext
20954 <gallery type="123" summary="345">
20955 File:File:Foobar.jpg
20956 </gallery>
20957 !! html/php
20958 <ul class="gallery mw-gallery-traditional" type="123">
20959 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20960 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20961 <div class="gallerytext">
20962 </div>
20963 </div></li>
20964 </ul>
20965 !! html/parsoid
20966 <ul class="gallery mw-gallery-traditional" type="123" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"type":"123","summary":"345"},"body":{"extsrc":"\nFile:File:Foobar.jpg\n"}}'>
20967 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:File:Foobar.jpg"><img resource="./File:File:Foobar.jpg" src="./Special:FilePath/File:Foobar.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20968 </ul>
20969 !! end
20970
20971 ## Parsoid thinks the "centre" here is a property, not a caption.
20972 !! test
20973 Gallery
20974 !! options
20975 parsoid={
20976 "modes": ["wt2html"],
20977 "nativeGallery": true
20978 }
20979 !! wikitext
20980 <gallery>
20981 image1.png |
20982 image2.gif|||||
20983
20984 image3|
20985 image4 |300px| centre
20986 image5.svg| http://///////
20987 [[x|xx]]]]
20988 * image6
20989 </gallery>
20990 !! html/php
20991 <ul class="gallery mw-gallery-traditional">
20992 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20993 <div class="thumb" style="height: 150px;">Image1.png</div>
20994 <div class="gallerytext">
20995 </div>
20996 </div></li>
20997 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20998 <div class="thumb" style="height: 150px;">Image2.gif</div>
20999 <div class="gallerytext">
21000 </div>
21001 </div></li>
21002 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21003 <div class="thumb" style="height: 150px;">Image3</div>
21004 <div class="gallerytext">
21005 </div>
21006 </div></li>
21007 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21008 <div class="thumb" style="height: 150px;">Image4</div>
21009 <div class="gallerytext">
21010 <pre>centre
21011 </pre>
21012 </div>
21013 </div></li>
21014 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21015 <div class="thumb" style="height: 150px;">Image5.svg</div>
21016 <div class="gallerytext">
21017 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
21018 </p>
21019 </div>
21020 </div></li>
21021 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21022 <div class="thumb" style="height: 150px;">* image6</div>
21023 <div class="gallerytext">
21024 </div>
21025 </div></li>
21026 </ul>
21027 !! html/parsoid
21028 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21029 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image1.png"><img resource="./File:Image1.png" src="./Special:FilePath/Image1.png" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21030 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image2.gif"><img resource="./File:Image2.gif" src="./Special:FilePath/Image2.gif" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21031 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image3"><img resource="./File:Image3" src="./Special:FilePath/Image3" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21032 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image4"><img resource="./File:Image4" src="./Special:FilePath/Image4" height="300" width="300"/></a></figure-inline></div><div class="gallerytext"></div></li>
21033 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image5.svg"><img resource="./File:Image5.svg" src="./Special:FilePath/Image5.svg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"> <a rel="mw:ExtLink" class="external free" href="http://///////">http://///////</a></div></li>
21034 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:*_image6"><img resource="./File:*_image6" src="./Special:FilePath/*_image6" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21035 </ul>
21036 !! end
21037
21038 !! test
21039 Gallery (with options, html)
21040 !! options
21041 parsoid={
21042 "modes": ["wt2html", "html2html"],
21043 "nativeGallery": true
21044 }
21045 !! wikitext
21046 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
21047 File:Nonexistent.jpg|caption
21048 File:Nonexistent.jpg
21049 image:foobar.jpg|some '''caption''' [[Main Page]]
21050 image:foobar.jpg
21051 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
21052 </gallery>
21053 !! html/php
21054 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
21055 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
21056 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21057 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21058 <div class="gallerytext">
21059 <p>caption
21060 </p>
21061 </div>
21062 </div></li>
21063 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21064 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21065 <div class="gallerytext">
21066 </div>
21067 </div></li>
21068 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21069 <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>
21070 <div class="gallerytext">
21071 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21072 </p>
21073 </div>
21074 </div></li>
21075 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21076 <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>
21077 <div class="gallerytext">
21078 </div>
21079 </div></li>
21080 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21081 <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>
21082 <div class="gallerytext">
21083 <p>blabla.
21084 </p>
21085 </div>
21086 </div></li>
21087 </ul>
21088 !! html/parsoid
21089 <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":{}}'>
21090 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
21091 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
21092 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
21093 <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>
21094 <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>
21095 <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>
21096 </ul>
21097 !! end
21098
21099 !! test
21100 Gallery (with options, extsrc)
21101 !! options
21102 parsoid={
21103 "nativeGallery": false
21104 }
21105 !! wikitext
21106 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
21107 File:Nonexistent.jpg|caption
21108 File:Nonexistent.jpg
21109 image:foobar.jpg|some '''caption''' [[Main Page]]
21110 image:foobar.jpg
21111 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
21112 </gallery>
21113 !! html/php
21114 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
21115 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
21116 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21117 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21118 <div class="gallerytext">
21119 <p>caption
21120 </p>
21121 </div>
21122 </div></li>
21123 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21124 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21125 <div class="gallerytext">
21126 </div>
21127 </div></li>
21128 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21129 <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>
21130 <div class="gallerytext">
21131 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21132 </p>
21133 </div>
21134 </div></li>
21135 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21136 <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>
21137 <div class="gallerytext">
21138 </div>
21139 </div></li>
21140 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21141 <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>
21142 <div class="gallerytext">
21143 <p>blabla.
21144 </p>
21145 </div>
21146 </div></li>
21147 </ul>
21148 !! html/parsoid
21149 <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 &#39;&#39;&#39;caption&#39;&#39;&#39; [[Main Page]]\nimage:foobar.jpg\nimage:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.\n"}}'>
21150 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
21151 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
21152 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
21153 <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>
21154 <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>
21155 <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>
21156 </ul>
21157 !! end
21158
21159 !! test
21160 Gallery (without px units)
21161 !! wikitext
21162 <gallery widths="70" heights="40">
21163 File:Foobar.jpg
21164 </gallery>
21165 !! html/php
21166 <ul class="gallery mw-gallery-traditional">
21167 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21168 <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>
21169 <div class="gallerytext">
21170 </div>
21171 </div></li>
21172 </ul>
21173 !! html/parsoid
21174 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70","heights":"40"},"body":{"extsrc":"\nFile:Foobar.jpg\n"}}'>
21175 <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>
21176 </ul>
21177 !! end
21178
21179 !! test
21180 Gallery (with invalid units)
21181 !! wikitext
21182 <gallery widths="70em" heights="40em">
21183 File:Foobar.jpg
21184 </gallery>
21185 !! html/php
21186 <ul class="gallery mw-gallery-traditional">
21187 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21188 <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>
21189 <div class="gallerytext">
21190 </div>
21191 </div></li>
21192 </ul>
21193 !! html/parsoid
21194 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70em","heights":"40em"},"body":{"extsrc":"\nFile:Foobar.jpg\n"}}'>
21195 <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>
21196 </ul>
21197 !! end
21198
21199 !! test
21200 Gallery with link that has fragment
21201 !! options
21202 parsoid={
21203 "modes": ["wt2html", "html2html"],
21204 "nativeGallery": true
21205 }
21206 !! wikitext
21207 <gallery>
21208 image:foobar.jpg|link=Main_Page
21209 image:foobar.jpg|link=Main_Page#section
21210 image:foobar.jpg|link=Main Page#section|caption
21211 </gallery>
21212 !! html/php
21213 <ul class="gallery mw-gallery-traditional">
21214 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21215 <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>
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="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>
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="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>
21226 <div class="gallerytext">
21227 <p>caption
21228 </p>
21229 </div>
21230 </div></li>
21231 </ul>
21232 !! html/parsoid
21233 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21234 <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>
21235 <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>
21236 <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>
21237 </ul>
21238 !! end
21239
21240 !! test
21241 Gallery with template inside caption
21242 !! options
21243 parsoid={
21244 "nativeGallery": true
21245 }
21246 !! wikitext
21247 <gallery caption="{{echo|hi}}">
21248 File:Foobar.jpg|{{echo|ho}}
21249 </gallery>
21250 !! html/php
21251 <ul class="gallery mw-gallery-traditional">
21252 <li class='gallerycaption'>hi</li>
21253 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21254 <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>
21255 <div class="gallerytext">
21256 <p>ho
21257 </p>
21258 </div>
21259 </div></li>
21260 </ul>
21261 !! html/parsoid
21262 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21263 <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>
21264 <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>
21265 </ul>
21266 !! end
21267
21268 !! test
21269 Gallery with wikitext inside gallery caption
21270 !! wikitext
21271 <gallery caption="# List item
21272
21273 Text '''bold''' [[link]] {{ns:-1}}
21274
21275 [[File:Foobar.jpg|thumb|File in gallery caption]]">
21276 File:Foobar.jpg|Image caption
21277 </gallery>
21278 !! html/php
21279 <ul class="gallery mw-gallery-traditional">
21280 <li class='gallerycaption'># 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>
21281 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21282 <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>
21283 <div class="gallerytext">
21284 <p>Image caption
21285 </p>
21286 </div>
21287 </div></li>
21288 </ul>
21289 !! end
21290
21291 !! test
21292 Gallery with wikitext inside caption
21293 !! options
21294 parsoid={
21295 "nativeGallery": true
21296 }
21297 !! wikitext
21298 <gallery>
21299 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
21300 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
21301 </gallery>
21302 !! html/php
21303 <ul class="gallery mw-gallery-traditional">
21304 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21305 <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>
21306 <div class="gallerytext">
21307 <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>
21308 </p>
21309 </div>
21310 </div></li>
21311 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21312 <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>
21313 <div class="gallerytext">
21314 <p>This is a test template
21315 </p>
21316 </div>
21317 </div></li>
21318 </ul>
21319 !! html/parsoid
21320 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21321 <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>
21322 <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>
21323 </ul>
21324 !! end
21325
21326 !! test
21327 Gallery (with showfilename option)
21328 !! options
21329 parsoid={
21330 "nativeGallery": true
21331 }
21332 !! wikitext
21333 <gallery showfilename="">
21334 File:Nonexistent.jpg|caption
21335 File:Nonexistent.jpg
21336 File:Foobar.jpg|some '''caption''' [[Main Page]]
21337 File:Foobar.jpg
21338 </gallery>
21339 !! html/php
21340 <ul class="gallery mw-gallery-traditional">
21341 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21342 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21343 <div class="gallerytext">
21344 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21345 caption
21346 </p>
21347 </div>
21348 </div></li>
21349 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21350 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21351 <div class="gallerytext">
21352 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21353 </p>
21354 </div>
21355 </div></li>
21356 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21357 <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>
21358 <div class="gallerytext">
21359 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21360 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21361 </p>
21362 </div>
21363 </div></li>
21364 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21365 <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>
21366 <div class="gallerytext">
21367 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21368 </p>
21369 </div>
21370 </div></li>
21371 </ul>
21372 !! html/parsoid
21373 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
21374 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></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>
21375 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></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>
21376 <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>
21377 <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>
21378 </ul>
21379 !! end
21380
21381 ## Should Parsoid be preserving these variations? See T151367
21382 !! test
21383 Gallery (with namespace-less filenames)
21384 !! options
21385 parsoid={
21386 "modes": ["wt2html", "html2html"],
21387 "nativeGallery": true
21388 }
21389 !! wikitext
21390 <gallery>
21391 File:Nonexistent.jpg
21392 Nonexistent.jpg
21393 image:foobar.jpg
21394 foobar.jpg
21395 </gallery>
21396 !! html/php
21397 <ul class="gallery mw-gallery-traditional">
21398 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21399 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21400 <div class="gallerytext">
21401 </div>
21402 </div></li>
21403 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21404 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21405 <div class="gallerytext">
21406 </div>
21407 </div></li>
21408 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21409 <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>
21410 <div class="gallerytext">
21411 </div>
21412 </div></li>
21413 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21414 <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>
21415 <div class="gallerytext">
21416 </div>
21417 </div></li>
21418 </ul>
21419 !! html/parsoid
21420 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21421 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21422 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21423 <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>
21424 <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>
21425 </ul>
21426 !! end
21427
21428 !! test
21429 Gallery override link with wikilink (T36852)
21430 !! options
21431 parsoid={
21432 "nativeGallery": true
21433 }
21434 !! wikitext
21435 <gallery>
21436 File:Foobar.jpg|alt=galleryalt|link=Wikilink
21437 </gallery>
21438 !! html/php
21439 <ul class="gallery mw-gallery-traditional">
21440 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21441 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
21442 <div class="gallerytext">
21443 </div>
21444 </div></li>
21445 </ul>
21446 !! html/parsoid
21447 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21448 <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>
21449 </ul>
21450 !! end
21451
21452 !! test
21453 Gallery override link with absolute external link (T36852)
21454 !! options
21455 parsoid={
21456 "nativeGallery": true
21457 }
21458 !! wikitext
21459 <gallery>
21460 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
21461 </gallery>
21462 !! html/php
21463 <ul class="gallery mw-gallery-traditional">
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="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>
21466 <div class="gallerytext">
21467 </div>
21468 </div></li>
21469 </ul>
21470 !! html/parsoid
21471 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21472 <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>
21473 </ul>
21474 !! end
21475
21476 !! test
21477 Gallery override link with absolute external link with LanguageConverter
21478 !! options
21479 language=zh
21480 !! wikitext
21481 <gallery>
21482 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21483 </gallery>
21484 !! html/php
21485 <ul class="gallery mw-gallery-traditional">
21486 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21487 <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>
21488 <div class="gallerytext">
21489 <p>caption
21490 </p>
21491 </div>
21492 </div></li>
21493 </ul>
21494 !! html/parsoid
21495 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org\n"}}'>
21496 <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>
21497 </ul>
21498 !! end
21499
21500 !! test
21501 Gallery override link with malicious javascript (T36852)
21502 !! options
21503 parsoid={
21504 "modes": ["wt2html", "html2html"],
21505 "nativeGallery": true
21506 }
21507 !! wikitext
21508 <gallery>
21509 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21510 </gallery>
21511 !! html/php
21512 <ul class="gallery mw-gallery-traditional">
21513 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21514 <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>
21515 <div class="gallerytext">
21516 </div>
21517 </div></li>
21518 </ul>
21519 !! html/parsoid
21520 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21521 <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>
21522 </ul>
21523 !! end
21524
21525 # Note that parsoid uses the invalid link as a caption, PHP does not.
21526 !! test
21527 Gallery with invalid title as link (T45964)
21528 !! options
21529 parsoid={
21530 "modes": ["wt2html", "html2html"],
21531 "nativeGallery": true
21532 }
21533 !! wikitext
21534 <gallery>
21535 File:Foobar.jpg|link=<
21536 </gallery>
21537 !! html/php
21538 <ul class="gallery mw-gallery-traditional">
21539 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21540 <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>
21541 <div class="gallerytext">
21542 </div>
21543 </div></li>
21544 </ul>
21545 !! html/parsoid
21546 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21547 <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">link=&lt;</div></li>
21548 </ul>
21549 !! end
21550
21551 !! test
21552 Serialize gallery without attrs in data-mw
21553 !! options
21554 parsoid={
21555 "modes": ["html2wt"],
21556 "nativeGallery": true
21557 }
21558 !! html/parsoid
21559 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
21560 <li class="gallerycaption">123</li>
21561 <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>
21562 </ul>
21563 !! wikitext
21564 <gallery caption="123">
21565 File:Test.png
21566 </gallery>
21567 !! end
21568
21569 !! test
21570 Gallery with class and style attributes
21571 !! options
21572 parsoid={
21573 "nativeGallery": true
21574 }
21575 !! wikitext
21576 <gallery class="center" style="text-align: center;">
21577 File:Foobar.jpg
21578 </gallery>
21579 !! html/php
21580 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
21581 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21582 <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>
21583 <div class="gallerytext">
21584 </div>
21585 </div></li>
21586 </ul>
21587 !! html/parsoid
21588 <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":{}}'>
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"></div></li>
21590 </ul>
21591 !! end
21592
21593 !! test
21594 Gallery in slideshow mode
21595 !! options
21596 parsoid={
21597 "nativeGallery": true
21598 }
21599 !! wikitext
21600 <gallery mode="slideshow" showthumbnails="">
21601 File:Foobar.jpg
21602 </gallery>
21603 !! html/php
21604 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
21605 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21606 <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>
21607 <div class="gallerytext">
21608 </div>
21609 </div></li>
21610 </ul>
21611 !! html/parsoid
21612 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
21613 <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>
21614 </ul>
21615 !! end
21616
21617 !! test
21618 Serialize gallery image captions on a line
21619 !! options
21620 parsoid={
21621 "modes": ["html2wt"],
21622 "nativeGallery": true
21623 }
21624 !! html/parsoid
21625 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21626 <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>
21627 <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>
21628 </ul>
21629 !! wikitext
21630 <gallery>
21631 File:Foobar.jpg| hi ho
21632 File:Foobar.jpg|hi<br />ho
21633 </gallery>
21634 !! end
21635
21636 !! test
21637 HTML Hex character encoding (spells the word "JavaScript")
21638 !! options
21639 parsoid=wt2html,wt2wt,html2html
21640 !! wikitext
21641 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
21642 !! html/php
21643 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
21644 </p>
21645 !! html/parsoid
21646 <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>
21647 !! end
21648
21649 !! test
21650 HTML Hex character encoding bogus encoding (T28437 regression check)
21651 !! wikitext
21652 &#xsee;&#XSEE;
21653 !! html
21654 <p>&amp;#xsee;&amp;#XSEE;
21655 </p>
21656 !! end
21657
21658 !! test
21659 HTML Hex character encoding mixed case
21660 !! options
21661 parsoid=wt2html,wt2wt,html2html
21662 !! wikitext
21663 &#xEE;&#Xee;
21664 !! html/php
21665 <p>&#xee;&#xee;
21666 </p>
21667 !! html/parsoid
21668 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
21669 !! end
21670
21671 # See: https://www.w3.org/TR/html5/syntax.html#character-references
21672 # Note that U+000C (form feed) is not a valid XML character, so
21673 # it is banned even though allowed in HTML5.
21674 !! test
21675 Illegal character references (T106578)
21676 !! wikitext
21677 ; Null: &#00;
21678 ; FF: &#xC;
21679 ; CR: &#xD;
21680 ; Control (low): &#8;
21681 ; Control (high): &#x7F; &#x9F;
21682 ; Surrogate: &#xD83D;&#xDCA9;
21683 ; This is an okay astral character: &#x1F4A9;
21684 !! html+tidy
21685 <dl><dt>Null</dt>
21686 <dd>&amp;#00;</dd>
21687 <dt>FF</dt>
21688 <dd>&amp;#xC;</dd>
21689 <dt>CR</dt>
21690 <dd>&amp;#xD;</dd>
21691 <dt>Control (low)</dt>
21692 <dd>&amp;#8;</dd>
21693 <dt>Control (high)</dt>
21694 <dd>&amp;#x7F; &amp;#x9F;</dd>
21695 <dt>Surrogate</dt>
21696 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
21697 <dt>This is an okay astral character</dt>
21698 <dd>&#x1f4a9;</dd></dl>
21699 !! end
21700
21701 !! test
21702 __FORCETOC__ override
21703 !! wikitext
21704 __NEWSECTIONLINK__
21705 __FORCETOC__
21706 !! html/php
21707 <p><br />
21708 </p>
21709 !! end
21710
21711 !! test
21712 ISBN code coverage
21713 !! wikitext
21714 ISBN 978-0-1234-56&#x20;789
21715 !! html/php
21716 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21717 </p>
21718 !! html/parsoid
21719 <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>
21720 !! end
21721
21722 !! test
21723 ISBN followed by 5 spaces
21724 !! wikitext
21725 ISBN
21726 !! html
21727 <p>ISBN
21728 </p>
21729 !! end
21730
21731 !! test
21732 Double ISBN
21733 !! wikitext
21734 ISBN ISBN 1234567890
21735 !! html/php
21736 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21737 </p>
21738 !! html/parsoid
21739 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21740 !! end
21741
21742 # Uppercase X and lowercase x as well
21743 !! test
21744 ISBN with an X
21745 !! wikitext
21746 ISBN 3-462-04561-X
21747 ISBN 3-462-04561-x
21748 ISBN 080442957X
21749 ISBN 080442957x
21750 ISBN 978080442957X
21751 ISBN 978080442957x
21752 !! html/php
21753 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21754 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21755 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21756 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21757 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21758 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21759 </p>
21760 !! html/parsoid
21761 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21762 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21763 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21764 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21765 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21766 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21767 !! end
21768
21769 !! test
21770 ISBN with empty prefix (parsoid test)
21771 !! wikitext
21772 ISBN 1234567890
21773 !! html/php
21774 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21775 </p>
21776 !! html/parsoid
21777 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21778 !! end
21779
21780 !! test
21781 T24905: <abbr> followed by ISBN followed by </a>
21782 !! wikitext
21783 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21784 !! html/php
21785 <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>
21786 </p>
21787 !! html/parsoid
21788 <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>
21789 !! end
21790
21791 !! test
21792 Double RFC
21793 !! wikitext
21794 RFC RFC 1234
21795 !! html/php
21796 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21797 </p>
21798 !! html/parsoid
21799 <p>RFC <a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
21800 !! end
21801
21802 !! test
21803 Double RFC with a wiki link
21804 !! wikitext
21805 RFC [[RFC 1234]]
21806 !! html/php
21807 <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>
21808 </p>
21809 !! html/parsoid
21810 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234" title="RFC 1234">RFC 1234</a></p>
21811 !! end
21812
21813 !! test
21814 RFC code coverage
21815 !! wikitext
21816 RFC 983&#x20;987
21817 !! html/php
21818 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21819 </p>
21820 !! html/parsoid
21821 <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>
21822 !! end
21823
21824 !! test
21825 Centre-aligned image
21826 !! wikitext
21827 [[Image:foobar.jpg|centre]]
21828 !! html/php
21829 <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>
21830 !! html/parsoid
21831 <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></figure>
21832 !! end
21833
21834 !! test
21835 None-aligned image
21836 !! wikitext
21837 [[Image:foobar.jpg|none]]
21838 !! html/php
21839 <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>
21840 !! html/parsoid
21841 <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></figure>
21842 !! end
21843
21844 !! test
21845 Width + Height sized image (using px) (height is ignored)
21846 !! wikitext
21847 [[Image:foobar.jpg|640x480px]]
21848 !! html/php
21849 <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>
21850 </p>
21851 !! html/parsoid
21852 <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>
21853 !! end
21854
21855 !! test
21856 Width-sized image (using px, no following whitespace)
21857 !! wikitext
21858 [[Image:foobar.jpg|640px]]
21859 !! html/php
21860 <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>
21861 </p>
21862 !! html/parsoid
21863 <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>
21864 !! end
21865
21866 !! test
21867 Width-sized image (using px, with following whitespace - test regression from r39467)
21868 !! wikitext
21869 [[Image:foobar.jpg|640px ]]
21870 !! html/php
21871 <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>
21872 </p>
21873 !! html/parsoid
21874 <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>
21875 !!end
21876
21877 !! test
21878 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21879 !! wikitext
21880 [[Image:foobar.jpg| 640px]]
21881 !! html/php
21882 <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>
21883 </p>
21884 !! html/parsoid
21885 <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>
21886 !! end
21887
21888 !! test
21889 Image with page parameter
21890 !! options
21891 djvu
21892 !! wikitext
21893 [[File:LoremIpsum.djvu|page=2]]
21894 !! html/php
21895 <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>
21896 </p>
21897 !! html/parsoid
21898 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"page","ak":"page=2"}]}' data-mw='{"page":"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>
21899 !! end
21900
21901 !! test
21902 Another italics / bold test
21903 !! wikitext
21904 ''' ''x'
21905 !! html
21906 <pre>'<i> </i>x'
21907 </pre>
21908 !!end
21909
21910 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21911 !! test
21912 dt/dd/dl test
21913 !! wikitext
21914 :;;;::
21915 !! html/php
21916 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21917 !! html/parsoid
21918 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21919 !! end
21920
21921 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21922 !! test
21923 Images with the "|" character in the comment
21924 !! wikitext
21925 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21926 !! html/php
21927 <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>
21928 !! html/parsoid
21929 <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>
21930 !! end
21931
21932 !! test
21933 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21934 !! wikitext
21935 <html><script>alert(1);</script></html>
21936 !! html
21937 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21938 </p>
21939 !! end
21940
21941 !! test
21942 HTML with raw HTML ($wgRawHtml==true)
21943 !! options
21944 wgRawHtml=1
21945 !! wikitext
21946 <html><script>alert(1);</script></html>
21947 !! html/php
21948 <p><script>alert(1);</script>
21949 </p>
21950 !! html/parsoid
21951 <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>
21952 !! end
21953
21954 !! test
21955 Parents of subpages, one level up
21956 !! options
21957 subpage title=[[Subpage test/L1/L2/L3]]
21958 !! wikitext
21959 [[../|L2]]
21960 !! html
21961 <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>
21962 </p>
21963 !! end
21964
21965
21966 !! test
21967 Parents of subpages, one level up, not named
21968 !! options
21969 subpage title=[[Subpage test/L1/L2/L3]]
21970 !! wikitext
21971 [[../]]
21972 !! html
21973 <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>
21974 </p>
21975 !! end
21976
21977
21978
21979 !! test
21980 Parents of subpages, two levels up
21981 !! options
21982 subpage title=[[Subpage test/L1/L2/L3]]
21983 !! wikitext
21984 [[../../|L1]]2
21985
21986 [[../../|L1]]l
21987 !! html
21988 <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
21989 </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>
21990 </p>
21991 !! end
21992
21993 !! test
21994 Parents of subpages, two levels up, without trailing slash or name.
21995 !! options
21996 subpage title=[[Subpage test/L1/L2/L3]]
21997 !! wikitext
21998 [[../..]]
21999 !! html
22000 <p>[[../..]]
22001 </p>
22002 !! end
22003
22004 !! test
22005 Parents of subpages, two levels up, with lots of extra trailing slashes.
22006 !! options
22007 subpage title=[[Subpage test/L1/L2/L3]]
22008 !! wikitext
22009 [[../../////]]
22010 !! html
22011 <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>
22012 </p>
22013 !! end
22014
22015 !! article
22016 Subpage test/L1/L2/L3Sibling
22017 !! text
22018 Sibling article
22019 !! endarticle
22020
22021 !! test
22022 Transclusion of a sibling page (one level up)
22023 !! options
22024 subpage title=[[Subpage test/L1/L2/L3]]
22025 !! wikitext
22026 {{../L3Sibling}}
22027 !! html
22028 <p>Sibling article
22029 </p>
22030 !! end
22031
22032 !! test
22033 Transclusion of a child page
22034 !! options
22035 subpage title=[[Subpage test/L1/L2]]
22036 !! wikitext
22037 {{/L3Sibling}}
22038 !! html
22039 <p>Sibling article
22040 </p>
22041 !! end
22042
22043 # This is wt2html only in Parsoid because we add <nowiki>
22044 # because of {{..}} and we don't expect to fix that to
22045 # eliminate the nowikis selective for {{..}} markup.
22046 !! test
22047 Non-transclusion because of too many up levels
22048 !! options
22049 subpage title=[[Subpage test/L1/L2/L3]]
22050 parsoid=wt2html
22051 !! wikitext
22052 {{../../../../More than parent}}
22053 !! html/php
22054 <p>{{../../../../More than parent}}
22055 </p>
22056 !! html/parsoid
22057 <p>{{../../../../More than parent}}</p>
22058 !! end
22059
22060 !! test
22061 Definition list code coverage
22062 !! wikitext
22063 ;title :def
22064 ;title :def
22065 ;title:def
22066 !! html/php
22067 <dl><dt>title</dt>
22068 <dd>def</dd>
22069 <dt>title</dt>
22070 <dd>def</dd>
22071 <dt>title</dt>
22072 <dd>def</dd></dl>
22073 !! html/parsoid
22074 <dl><dt>title </dt><dd>def</dd>
22075 <dt>title </dt><dd>def</dd>
22076 <dt>title</dt><dd>def</dd></dl>
22077 !! end
22078
22079 !! test
22080 Don't fall for the self-closing div
22081 !! wikitext
22082 <div>hello world</div/>
22083 !! html
22084 <div>hello world</div>
22085 !! end
22086
22087 !! test
22088 MSGNW magic word
22089 !! wikitext
22090 {{MSGNW:msg}}
22091 !! html/php
22092 <p>&#91;&#91;:Template:Msg&#93;&#93;
22093 </p>
22094 !! end
22095
22096 !! test
22097 RAW magic word
22098 !! wikitext
22099 {{RAW:QUERTY}}
22100 !! html
22101 <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>
22102 </p>
22103 !! end
22104
22105 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
22106 !! test
22107 Always escape literal '>' in output, not just after '<'
22108 !! wikitext
22109 ><>
22110 !! html
22111 <p>&gt;&lt;&gt;
22112 </p>
22113 !! end
22114
22115 !! test
22116 Template caching
22117 !! wikitext
22118 {{Test}}
22119 {{Test}}
22120 !! html
22121 <p>This is a test template
22122 This is a test template
22123 </p>
22124 !! end
22125
22126
22127 !! article
22128 MediaWiki:Fake
22129 !! text
22130 ==header==
22131 !! endarticle
22132
22133 !! test
22134 Inclusion of !userCanEdit() content
22135 !! wikitext
22136 {{MediaWiki:Fake}}
22137 !! html
22138 <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>
22139 !! end
22140
22141
22142 !! test
22143 Out-of-order TOC heading levels
22144 !! wikitext
22145 ==2==
22146 ======6======
22147 ===3===
22148 =1=
22149 =====5=====
22150 ==2==
22151 !! html
22152 <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>
22153 <ul>
22154 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
22155 <ul>
22156 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
22157 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
22158 </ul>
22159 </li>
22160 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
22161 <ul>
22162 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
22163 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
22164 </ul>
22165 </li>
22166 </ul>
22167 </div>
22168
22169 <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>
22170 <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>
22171 <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>
22172 <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>
22173 <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>
22174 <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>
22175 !! end
22176
22177
22178 !! test
22179 ISBN with a dummy number
22180 !! wikitext
22181 ISBN ---
22182 !! html
22183 <p>ISBN ---
22184 </p>
22185 !! end
22186
22187
22188 !! test
22189 ISBN with space-delimited number
22190 !! wikitext
22191 ISBN 92 9017 032 8
22192 !! html/php
22193 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
22194 </p>
22195 !! html/parsoid
22196 <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>
22197 !! end
22198
22199
22200 !! test
22201 ISBN with multiple spaces, no number
22202 !! wikitext
22203 ISBN foo
22204 !! html
22205 <p>ISBN foo
22206 </p>
22207 !! end
22208
22209
22210 !! test
22211 ISBN length
22212 !! wikitext
22213 ISBN 123456789
22214
22215 ISBN 1234567890
22216
22217 ISBN 12345678901
22218 !! html/php
22219 <p>ISBN 123456789
22220 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22221 </p><p>ISBN 12345678901
22222 </p>
22223 !! html/parsoid
22224 <p>ISBN 123456789</p>
22225
22226 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
22227
22228 <p>ISBN 12345678901</p>
22229 !! end
22230
22231
22232 !! test
22233 ISBN with trailing year (T9110)
22234 !! wikitext
22235 ISBN 1-234-56789-0 - 2006
22236
22237 ISBN 1 234 56789 0 - 2006
22238 !! html/php
22239 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
22240 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
22241 </p>
22242 !! html/parsoid
22243 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
22244
22245 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
22246 !! end
22247
22248
22249 !! test
22250 anchorencode
22251 !! config
22252 wgFragmentMode=[ 'html5', 'legacy' ]
22253 !! wikitext
22254 {{anchorencode:foo bar©#%n}}
22255 !! html/php
22256 <p>foo_bar©#%n
22257 </p>
22258 !! html/parsoid
22259 <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>
22260 !! end
22261
22262 !! test
22263 anchorencode (legacy)
22264 !! config
22265 wgFragmentMode=[ 'legacy' ]
22266 !! wikitext
22267 {{anchorencode:foo bar©#%n}}
22268 !! html/php
22269 <p>foo_bar.C2.A9.23.25n
22270 </p>
22271 !! end
22272
22273 !! test
22274 anchorencode trims spaces
22275 !! config
22276 wgFragmentMode=[ 'html5', 'legacy' ]
22277 !! wikitext
22278 {{anchorencode: __pretty__please__}}
22279 !! html/php
22280 <p>pretty_please
22281 </p>
22282 !! html/parsoid
22283 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
22284 !! end
22285
22286 !! test
22287 anchorencode deals with links
22288 !! config
22289 wgFragmentMode=[ 'html5', 'legacy' ]
22290 !! wikitext
22291 {{anchorencode: [[hello|world]] [[hi]]}}
22292 !! html/php
22293 <p>world_hi
22294 </p>
22295 !! html/parsoid
22296 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
22297 !! end
22298
22299 !! test
22300 anchorencode deals with templates
22301 !! config
22302 wgFragmentMode=[ 'html5', 'legacy' ]
22303 !! wikitext
22304 {{anchorencode: {{Foo}} x}}
22305 !! html/php
22306 <p>FOO_x
22307 </p>
22308 !! html/parsoid
22309 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
22310 !! end
22311
22312 !! test
22313 anchorencode encodes like the TOC generator: (T20431)
22314 !! config
22315 wgFragmentMode=[ 'html5', 'legacy' ]
22316 !! wikitext
22317 ===_ +:.3A%3A _ &&amp;]] x===
22318 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
22319 __NOEDITSECTION__
22320 !! html/php
22321 <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>
22322 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
22323 </p>
22324 !! html/parsoid
22325 <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>
22326 <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>
22327 <meta property="mw:PageProp/noeditsection"/>
22328 !! end
22329
22330 !! test
22331 anchorencode encodes like the TOC generator: (T20431) (legacy)
22332 !! config
22333 wgFragmentMode=[ 'legacy' ]
22334 !! wikitext
22335 ===_ +:.3A%3A&&amp;]]===
22336 {{anchorencode: _ +:.3A%3A&&amp;]] }}
22337 __NOEDITSECTION__
22338 !! html/php
22339 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
22340 <p>.2B:.3A.253A.26.26.5D.5D
22341 </p>
22342 !! end
22343
22344 !! test
22345 T8200: blockquotes and paragraph formatting
22346 !! wikitext
22347 <blockquote>
22348 foo
22349 </blockquote>
22350
22351 bar
22352
22353 baz
22354 !! html
22355 <blockquote>
22356 <p>foo
22357 </p>
22358 </blockquote>
22359 <p>bar
22360 </p>
22361 <pre>baz
22362 </pre>
22363 !! end
22364
22365 !! test
22366 T10293: Use of center tag ruins paragraph formatting
22367 !! wikitext
22368 <center>
22369 foo
22370 </center>
22371
22372 bar
22373
22374 baz
22375 !! html
22376 <center>
22377 <p>foo
22378 </p>
22379 </center>
22380 <p>bar
22381 </p>
22382 <pre>baz
22383 </pre>
22384 !! end
22385
22386 !!test
22387 Parsing of overlapping (improperly nested) inline html tags
22388 !! wikitext
22389 <span><s>x</span></s>
22390 !! html/php
22391 <p><span><s>x&lt;/span&gt;</s></span>
22392 </p>
22393 !! html/parsoid
22394 <p><span><s>x</s></span>
22395 </p>
22396 !!end
22397
22398 ###
22399 ### Language variants related tests
22400 ###
22401
22402 # Parsoid does not mark self-links.
22403 # Parsoid does not convert links; PHP will do any necessary redirects.
22404
22405 !! test
22406 Self-link in language variants
22407 !! options
22408 title=[[Dunav]] language=sr
22409 !! wikitext
22410 Both [[Dunav]] and [[Дунав]] are names for this river.
22411 !! html/php
22412 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
22413 </p>
22414 !! html/parsoid
22415 <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>
22416 !! end
22417
22418 !! article
22419 Дуна
22420 !! text
22421 content
22422 !! endarticle
22423
22424 !! test
22425 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
22426 !! options
22427 title=[[Duna]] language=sr
22428 !! wikitext
22429 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
22430 !! html/php
22431 <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.
22432 </p>
22433 !! html/parsoid
22434 <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>
22435 !! end
22436
22437 !! test
22438 Link to a section of a variant of this title shouldn't be parsed as self-link
22439 !! options
22440 title=[[Duna]] language=sr
22441 !! wikitext
22442 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
22443 !! html/php
22444 <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.
22445 </p>
22446 !! html/parsoid
22447 <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>
22448 !! end
22449
22450 !! test
22451 Link to pages in language variants
22452 !! options
22453 language=sr
22454 !! wikitext
22455 Main Page can be written as [[Маин Паге]]
22456 !! html/php
22457 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
22458 </p>
22459 !! html/parsoid
22460 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
22461 !! end
22462
22463
22464 !! test
22465 Multiple links to pages in language variants
22466 !! options
22467 language=sr
22468 !! wikitext
22469 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
22470 !! html/php
22471 <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>.
22472 </p>
22473 !! html/parsoid
22474 <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>
22475 !! end
22476
22477
22478 !! test
22479 Simple template in language variants
22480 !! options
22481 language=sr
22482 !! wikitext
22483 {{тест}}
22484 !! html/php
22485 <p>This is a test template
22486 </p>
22487 !! end
22488
22489
22490 !! test
22491 Template with explicit namespace in language variants
22492 !! options
22493 language=sr
22494 !! wikitext
22495 {{Template:тест}}
22496 !! html/php
22497 <p>This is a test template
22498 </p>
22499 !! end
22500
22501
22502 !! test
22503 Basic test for template parameter in language variants
22504 !! options
22505 language=sr
22506 !! wikitext
22507 {{парамтест|param=foo}}
22508 !! html/php
22509 <p>This is a test template with parameter foo
22510 </p>
22511 !! end
22512
22513 !! test
22514 Simple category in language variants
22515 !! options
22516 language=sr cat
22517 !! wikitext
22518 [[Category:МедиаWики Усер'с Гуиде]]
22519 !! html/php
22520 cat=МедиаWики_Усер'с_Гуиде sort=
22521 !! html/parsoid
22522 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
22523 !! end
22524
22525 !! article
22526 Category:分类
22527 !! text
22528 blah
22529 !! endarticle
22530
22531 !! article
22532 Category:分類
22533 !! text
22534 blah
22535 !! endarticle
22536
22537 ## We used to, but no longer wt2wt this test since the default serializer
22538 ## will normalize all categories to serialize on their own line.
22539 ## This wikitext usage is going to be fairly uncommon in production and
22540 ## selser will take care of preserving formatting in those scenarios.
22541 !! test
22542 Don't convert blue categorylinks to another variant (T35210)
22543 !! options
22544 cat
22545 language=zh
22546 parsoid=wt2html
22547 !! wikitext
22548 [[A]][[Category:分类]]
22549 !! html/php
22550 cat=分类 sort=
22551 !! html/parsoid
22552 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
22553 <link rel="mw:PageProp/Category" href="./Category:分类"/>
22554 !! end
22555
22556 !! test
22557 Stripping -{}- tags (language variants)
22558 !! options
22559 language=sr
22560 !! wikitext
22561 Latin proverb: -{Ne nuntium necare}-
22562 !! html/php
22563 <p>Latin proverb: Ne nuntium necare
22564 </p>
22565 !! html/parsoid
22566 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22567 !! end
22568
22569
22570 !! test
22571 Prevent conversion with -{}- tags (language variants)
22572 !! options
22573 language=sr variant=sr-ec
22574 !! wikitext
22575 Latinski: -{Ne nuntium necare}-
22576 !! html/php
22577 <p>Латински: Ne nuntium necare
22578 </p>
22579 !! html/parsoid
22580 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22581 !! end
22582
22583
22584 !! test
22585 Prevent conversion of text with -{}- tags (language variants)
22586 !! options
22587 language=sr variant=sr-ec
22588 !! wikitext
22589 Latinski: -{Ne nuntium necare}-
22590 !! html/php
22591 <p>Латински: Ne nuntium necare
22592 </p>
22593 !! html/parsoid
22594 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22595 !! end
22596
22597
22598 !! test
22599 Prevent conversion of links with -{}- tags (language variants)
22600 !! options
22601 language=sr variant=sr-ec
22602 !! wikitext
22603 -{[[Main Page]]}-
22604 !! html/php
22605 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22606 </p>
22607 !! html/parsoid
22608 <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>
22609 !! end
22610
22611
22612 !! test
22613 -{}- tags within headlines (within html for parserConvert())
22614 !! config
22615 wgFragmentMode=[ 'html5', 'legacy' ]
22616 !! options
22617 language=sr variant=sr-ec
22618 !! wikitext
22619 ==-{Naslov}-==
22620
22621 Note that even an unprotected headline ID is not affected by language
22622 conversion:
22623
22624 ==Latinski==
22625 !! html/php
22626 <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>
22627 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
22628 цонверсион:
22629 </p>
22630 <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>
22631 !! html/parsoid
22632 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
22633
22634 <p>Note that even an unprotected headline ID is not affected by language
22635 conversion:</p>
22636
22637 <h2 id="Latinski">Latinski</h2>
22638 !! end
22639
22640 !! test
22641 Explicit definition of language variant alternatives
22642 !! options
22643 language=zh variant=zh-tw
22644 !! wikitext
22645 -{zh:China;zh-tw:Taiwan}-, not China
22646 !! html/php
22647 <p>Taiwan, not China
22648 </p>
22649 !! html/parsoid
22650 <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>
22651 !! end
22652
22653 !! test
22654 Explicit definition of language variant alternatives (BCP 47 codes)
22655 !! options
22656 language=zh variant=zh-tw
22657 !! wikitext
22658 -{zh:China;zh-Hant-TW:Taiwan}-, not China
22659 !! html/php
22660 <p>Taiwan, not China
22661 </p>
22662 !! html/parsoid
22663 <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>
22664 !! end
22665
22666 !! test
22667 Filter syntax for language variants
22668 !! options
22669 language=zh variant=zh-tw
22670 !! wikitext
22671 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
22672 !! html/php
22673 <p>fooblog, WEBJOURNAL, WEBLOGquux
22674 </p>
22675 !! html/parsoid
22676 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
22677 !! end
22678
22679 # Note that Parsoid post-processing for language variants needs to
22680 # update the `title` attribute here, based on the mw:ExpandedAttrs property
22681 !! test
22682 Conversion around HTML tags
22683 !! options
22684 language=sr variant=sr-ec
22685 !! wikitext
22686 -{H|span=>sr-ec:script;title=>sr-ec:src}-
22687 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
22688 !! html/php
22689 <p>
22690 <span title="ЛаCтин">ски</span>
22691 </p>
22692 !! html/parsoid
22693 <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"}]}'/>
22694 <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>
22695 !! end
22696
22697 !! test
22698 Explicit session-wise two-way language variant mapping (A flag and - flag)
22699 !! options
22700 language=zh variant=zh-tw
22701 !! wikitext
22702 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
22703
22704 Taiwan is not China.
22705
22706 But -{A|zh:China; zh-tw:Taiwan}- is China,
22707
22708 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
22709
22710 and -{China}- is China.
22711 !! html/php
22712 <p>This is Taiwan, but we'll forget that now.
22713 </p><p>Taiwan is not China.
22714 </p><p>But Taiwan is Taiwan,
22715 </p><p>(This should be stripped!)
22716 </p><p>and China is China.
22717 </p>
22718 !! html/parsoid
22719 <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>
22720 <p>Taiwan is not China.</p>
22721 <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>
22722 <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>
22723 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22724 !! end
22725
22726 !! test
22727 Explicit session-wise one-way language variant mapping (A flag and - flag)
22728 !! options
22729 language=zh variant=zh-tw
22730 !! wikitext
22731 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
22732
22733 COUNTRY is China or Taiwan.
22734
22735 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
22736
22737 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22738
22739 and -{COUNTRY}- is COUNTRY.
22740 !! html/php
22741 <p>This is Taiwan, but we'll forget that now.
22742 </p><p>COUNTRY is China or Taiwan.
22743 </p><p>But Taiwan is Taiwan,
22744 </p><p>(This should be stripped!)
22745 </p><p>and COUNTRY is COUNTRY.
22746 </p>
22747 !! html/parsoid
22748 <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>
22749 <p>COUNTRY is China or Taiwan.</p>
22750 <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>
22751 <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>
22752 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22753 !! end
22754
22755 !! test
22756 Explicit session-wise two-way language variant mapping (H flag for hide)
22757 !! options
22758 language=zh variant=zh-tw
22759 !! wikitext
22760 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22761
22762 Taiwan is China.
22763 !! html/php
22764 <p>(This should be stripped!)
22765 </p><p>Taiwan is Taiwan.
22766 </p>
22767 !! html/parsoid
22768 <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>
22769 <p>Taiwan is China.</p>
22770 !! end
22771
22772 !! test
22773 Explicit session-wise one-way language variant mapping (H flag for hide)
22774 !! options
22775 language=zh variant=zh-tw
22776 !! wikitext
22777 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22778
22779 COUNTRY is Taiwan or China.
22780 !! html/php
22781 <p>(This should be stripped!)
22782 </p><p>Taiwan is Taiwan or China.
22783 </p>
22784 !! html/parsoid
22785 <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>
22786 <p>COUNTRY is Taiwan or China.</p>
22787 !! end
22788
22789 ## Note that parsoid test runner does not support 'showtitle' option.
22790 !! test
22791 Adding explicit conversion rule for title (T flag)
22792 !! options
22793 language=zh variant=zh-tw showtitle
22794 !! wikitext
22795 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22796
22797 Taiwan is China.
22798 !! html/php
22799 Taiwan
22800 <p>Should be stripped!
22801 </p><p>Taiwan is China.
22802 </p>
22803 !! html/parsoid
22804 <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>
22805 <p>Taiwan is China.</p>
22806 !! end
22807
22808 !! test
22809 Code coverage: T combined with H flag
22810 !! options
22811 language=zh variant=zh-tw showtitle
22812 !! wikitext
22813 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22814
22815 Taiwan is China.
22816 !! html/php
22817 Taiwan
22818 <p>Should be stripped!
22819 </p><p>Taiwan is Taiwan.
22820 </p>
22821 !! html/parsoid
22822 <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>
22823 <p>Taiwan is China.</p>
22824 !! end
22825
22826 !! test
22827 Code coverage: T with no variants
22828 !! options
22829 language=zh variant=zh-tw showtitle
22830 !! wikitext
22831 -{H|zh:China; zh-tw:Taiwan}-
22832 Taiwan is China.-{T|Taiwan is China}-
22833 !! html/php
22834 Taiwan is China
22835 <p>
22836 Taiwan is Taiwan.
22837 </p>
22838 !! html/parsoid
22839 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22840 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22841 !! end
22842
22843 !! test
22844 Code coverage: rules with no variants
22845 !! options
22846 language=zh variant=zh-tw
22847 !! wikitext
22848 -{H|zh:China; zh-tw:Taiwan}-
22849 Taiwan is China.
22850 -{H|China}-
22851 Taiwan is China.
22852 !! html/php
22853 <p>
22854 Taiwan is Taiwan.
22855
22856 Taiwan is China.
22857 </p>
22858 !! html/parsoid
22859 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22860 Taiwan is China.
22861 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22862 Taiwan is China.</p>
22863 !! end
22864
22865
22866 !! test
22867 Code coverage: D flag for conversion rule
22868 !! options
22869 language=zh variant=zh-tw
22870 !! wikitext
22871 -{D|zh-cn:XA; zh-tw:YA}-
22872 -{A;D|zh-cn:XB; zh-tw:YB}-
22873 -{D;H|zh-cn:XC; zh-tw:YC}-
22874
22875 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22876
22877 -{D|0=>zh-tw:1}-
22878 -{A;D|2=>zh-tw:3}-
22879 -{D;H|4=>zh-tw:5}-
22880
22881 XA XB XC YA YB YC FOO BAR BAT 012345
22882 !! html/php
22883 <p>大陆:XA;台灣:YA;
22884
22885 大陆:XC;台灣:YC;
22886 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22887 </p><p>0⇒台灣:1;
22888
22889 4⇒台灣:5;
22890 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22891 </p>
22892 !! html/parsoid
22893 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22894 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22895 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22896 <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>
22897 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22898 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22899 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22900 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22901 !! end
22902
22903 !! test
22904 Code coverage: N flag for conversion rule
22905 !! options
22906 language=zh variant=zh-cn
22907 !! wikitext
22908 -{N|zh-cn}-
22909
22910 -{N|zh-tw}-
22911
22912 -{N|sr-ec}-
22913 !! html/php
22914 <p>大陆
22915 </p><p>台灣
22916 </p><p>српски (ћирилица)‎
22917 </p>
22918 !! html/parsoid
22919 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22920 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22921 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22922 !! end
22923
22924 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22925 !! test
22926 Code coverage: N flag for conversion rule (wt2html only)
22927 !! options
22928 language=zh variant=zh-cn
22929 parsoid=wt2html,html2html
22930 !! wikitext
22931 -{D;N|en}-
22932 !! html/php
22933 <p>English
22934 </p>
22935 !! html/parsoid
22936 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22937 !! end
22938
22939 !! test
22940 Testing that changing the language variant here in the tests actually works
22941 !! options
22942 language=zh variant=zh showtitle
22943 !! wikitext
22944 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22945 !! html/php
22946 China
22947 <p>Should be stripped!
22948 </p>
22949 !! html/parsoid
22950 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22951 !! end
22952
22953 !! test
22954 Recursive conversion of alt and title attrs shouldn't clear converter state
22955 !! options
22956 language=zh variant=zh-cn
22957 showtitle
22958 !! wikitext
22959 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22960 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22961 !! html/php
22962 China
22963 <p>
22964 Should be stripped<span title="Exclamation">!</span>
22965 </p>
22966 !! html/parsoid
22967 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22968 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>
22969 !! end
22970
22971 !! test
22972 T26072: more test on conversion rule for title
22973 !! options
22974 language=zh variant=zh-tw showtitle
22975 !! wikitext
22976 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22977
22978 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22979 !! html/php
22980 Taiwan
22981 <p>This should be stripped!
22982 </p><p>This won't take interferes with the title rule.
22983 </p>
22984 !! html/parsoid
22985 <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>
22986 <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>
22987 !! end
22988
22989 !! test
22990 Partly disable title conversion if variant == main language code
22991 !! options
22992 language=zh variant=zh title=[[ZH]] showtitle
22993 !! wikitext
22994 -{T|zh-cn:CN;zh-tw:TW}-
22995 !! html/php
22996 ZH
22997 <p>
22998 </p>
22999 !! html/parsoid
23000 <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>
23001 !! end
23002
23003 !! test
23004 Partly disable title conversion if variant == main language code, more
23005 !! options
23006 language=zh variant=zh title=[[ZH]] showtitle
23007 !! wikitext
23008 -{T|TW}-
23009 !! html/php
23010 ZH
23011 <p>
23012 </p>
23013 !! html/parsoid
23014 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
23015 !! end
23016
23017 !! test
23018 Raw output of variant escape tags (R flag)
23019 !! options
23020 language=zh variant=zh-tw
23021 !! wikitext
23022 Raw: -{R|zh:China;zh-tw:Taiwan}-
23023 !! html/php
23024 <p>Raw: zh:China;zh-tw:Taiwan
23025 </p>
23026 !! html/parsoid
23027 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
23028 !! end
23029
23030 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
23031 !! test
23032 Raw output of variant escape tags (R flag) (wt2html only)
23033 !! options
23034 language=zh variant=zh-tw
23035 parsoid=wt2html,html2html
23036 !! wikitext
23037 -{Variant}- -{D|syntax}- -{D;R|options}-
23038 !! html/php
23039 <p>Variant syntax options
23040 </p>
23041 !! html/parsoid
23042 <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>
23043 !! end
23044
23045 !! test
23046 Nested markup inside raw output of variant escape tags (R flag)
23047 !! options
23048 language=zh variant=zh-tw
23049 !! wikitext
23050 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
23051 !! html/php
23052 <p>Nested raw: nested Taiwan nested
23053 </p>
23054 !! html/parsoid
23055 <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>
23056 !! end
23057
23058 !! test
23059 Nested markup and spaces inside raw output of variant escape tags (R flag)
23060 !! options
23061 language=zh variant=zh-tw
23062 !! wikitext
23063 X-{ outer -{ inner }- outer }-X
23064 !! html/php
23065 <p>X outer inner outer X
23066 </p>
23067 !! html/parsoid
23068 <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>
23069 !! end
23070
23071 !! test
23072 Templates inside raw output of variant escape tags (R flag)
23073 !! options
23074 language=zh variant=zh-tw
23075 !! wikitext
23076 Nested raw: -{R|nested {{echo|hi}} templates}-
23077 !! html/php
23078 <p>Nested raw: nested hi templates
23079 </p>
23080 !! html/parsoid
23081 <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>
23082 !! end
23083
23084 !! test
23085 Strings evaluating false shouldn't be ignored by Language converter (T51072)
23086 !! options
23087 language=zh variant=zh-cn
23088 !! wikitext
23089 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
23090 !! html/php
23091 <p>0
23092 </p>
23093 !! html/parsoid
23094 <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>
23095 !! end
23096
23097 !! test
23098 Conversion rules from [numeric-only string] to [something else] (T48634)
23099 !! options
23100 language=zh variant=zh-cn
23101 !! wikitext
23102 -{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
23103 !! html/php
23104 <p>D12345EE12345
23105 </p>
23106 !! html/parsoid
23107 <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>
23108 !! end
23109
23110 !! test
23111 Two-way converter rule entries with an empty value should be ignored (T53551)
23112 !! options
23113 language=zh variant=zh-cn
23114 !! wikitext
23115 -{H|zh-cn:foo;zh-tw:;}-foobar
23116 !! html/php
23117 <p>foobar
23118 </p>
23119 !! html/parsoid
23120 <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>
23121 !! end
23122
23123 !! test
23124 One-way converter rule entries with an empty "from" string should be ignored (T53551)
23125 !! options
23126 language=zh variant=zh-cn
23127 !! wikitext
23128 -{H|=>zh-cn:foo;}-foobar
23129 !! html/php
23130 <p>foobar
23131 </p>
23132 !! html/parsoid
23133 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
23134 !! end
23135
23136 !! test
23137 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
23138 !! options
23139 language=zh variant=zh-cn
23140 !! wikitext
23141 -{H|}-foobar
23142 !! html/php
23143 <p>foobar
23144 </p>
23145 !! html/parsoid
23146 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
23147 !! end
23148
23149 !! test
23150 Nested using of manual convert syntax
23151 !! options
23152 language=zh variant=zh-hk
23153 !! wikitext
23154 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
23155 !! html/php
23156 <p>Nested: Hello Hong Kong!
23157 </p>
23158 !! html/parsoid
23159 <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>
23160 !! end
23161
23162 !! test
23163 HTML markups with conversion syntax in attribs, nested in other conversion blocks
23164 !! options
23165 language=zh variant=zh-cn
23166 !! wikitext
23167 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
23168 !! html/php
23169 <p><span title="X">A</span>
23170 </p>
23171 !! html/parsoid
23172 <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>
23173 !! end
23174
23175 !! test
23176 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
23177 !! options
23178 language=zh variant=zh-cn
23179 !! wikitext
23180 -{<span title="-{X}-">A</span>}-
23181 !! html/php+disabled
23182 <p><span title="X">A</span>
23183 </p>
23184 !! html/parsoid
23185 <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>
23186 !! end
23187
23188 # Parsoid and PHP disagree on how to parse this example: Parsoid
23189 # insists that the content of a language converter element be a valid
23190 # DOM fragment or attribute string
23191 !! test
23192 Language converter markup with block content
23193 !! options
23194 language=zh variant=zh-cn
23195 !! wikitext
23196 <span>a-{b<div>c}-d
23197
23198 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
23199
23200 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
23201 !! html/php+tidy
23202 <span>ab<div>cd
23203 <span>ab<div>cd
23204 <span>ad</span></div></span></div></span>
23205 !! html/parsoid
23206 <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
23207
23208 <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
23209
23210 <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>
23211 !! end
23212
23213 !! test
23214 LanguageConverter selser (1)
23215 !! options
23216 language=zh variant=zh-cn
23217 parsoid={
23218 "modes": ["wt2wt", "selser"],
23219 "changes": [
23220 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23221 ]
23222 }
23223 !! wikitext
23224 -{raw}-
23225 !! wikitext/edited
23226 -{edited}-
23227 !! end
23228
23229 !! test
23230 LanguageConverter selser (2)
23231 !! options
23232 language=zh variant=zh-cn
23233 parsoid={
23234 "modes": ["wt2wt", "selser"],
23235 "changes": [
23236 ["span[class='x']", "contents", "text", "-{foo}-"],
23237 ["a", "contents", "text", "-{"],
23238 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
23239 ]
23240 }
23241 !! wikitext
23242 <span class="x">TEXT1</span>
23243 [http://example.com TEXT2]
23244 [[Foo|TEXT3]]
23245 {{echo|TEXT4}}
23246 !! wikitext/edited
23247 <span class="x"><nowiki>-{foo}-</nowiki></span>
23248 [http://example.com -{]
23249 [[Foo|<nowiki>-{</nowiki>]]
23250 {{1x|<nowiki>-{</nowiki>}}
23251 !! end
23252
23253 # Tests LanguageVariantText in ConstrainedText
23254 !! test
23255 LanguageConverter selser (3)
23256 !! options
23257 language=zh variant=zh-cn
23258 parsoid={
23259 "modes": ["wt2wt", "selser"],
23260 "changes": [
23261 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
23262 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23263 ]
23264 }
23265 !! wikitext
23266 {|
23267 |-
23268 |<span>Foo</span>
23269 |}
23270 !! wikitext/edited
23271 {|
23272 |-
23273 |<nowiki/>-{edited}-
23274 |}
23275 !! end
23276
23277 # Tests LanguageVariantText._fromSelSer
23278 !! test
23279 LanguageConverter selser (4)
23280 !! options
23281 language=zh variant=zh-cn
23282 parsoid={
23283 "modes": ["wt2wt", "selser"],
23284 "changes": [
23285 ["td > span.x", "remove"]
23286 ]
23287 }
23288 !! wikitext
23289 {|
23290 |-
23291 |<span class="x">Foo</span>-{Bar}-
23292 ||<span class="x">Foo</span>-{Bar}-
23293 |}
23294 !! wikitext/edited
23295 {|
23296 |-
23297 |<nowiki/>-{Bar}-
23298 ||-{Bar}-
23299 |}
23300 !! end
23301
23302 # Since Parsoid is starting to emit canonical wikitext for links,
23303 # [http://example.com http://example.com] will not RT back to that
23304 # form anymore.
23305 # Parsoid does not language-convert links (it is done in a
23306 # post-processing step)
23307 !! test
23308 Proper conversion of text in external links
23309 !! options
23310 language=sr variant=sr-ec
23311 parsoid=wt2html
23312 !! wikitext
23313 http://www.google.com
23314 gopher://www.google.com
23315 [http://www.google.com http://www.google.com]
23316 [gopher://www.google.com gopher://www.google.com]
23317 [https://www.google.com irc://www.google.com]
23318 [ftp://www.google.com www.google.com/ftp://dir]
23319 [//www.google.com www.google.com]
23320 !! html/php
23321 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
23322 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23323 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
23324 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23325 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
23326 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
23327 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
23328 </p>
23329 !! html/parsoid
23330 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
23331 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23332 <a rel="mw:ExtLink" class="external text" href="http://www.google.com">http://www.google.com</a>
23333 <a rel="mw:ExtLink" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23334 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
23335 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
23336 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
23337 !! end
23338
23339 !! test
23340 Do not convert roman numbers to language variants
23341 !! options
23342 language=sr variant=sr-ec
23343 !! wikitext
23344 Fridrih IV je car.
23345 !! html/php
23346 <p>Фридрих IV је цар.
23347 </p>
23348 !! html/parsoid
23349 <p>Fridrih IV je car.</p>
23350 !! end
23351
23352 !! test
23353 Unclosed language converter markup "-{"
23354 !! options
23355 language=sr
23356 !! wikitext
23357 -{T|hello
23358 !! html
23359 <p>-{T|hello
23360 </p>
23361 !! end
23362
23363 !! test
23364 Don't convert raw rule "-{R|=&gt;}-" to "=>"
23365 !! options
23366 language=sr
23367 !! wikitext
23368 -{R|=&gt;}-
23369 !! html/php
23370 <p>=&gt;
23371 </p>
23372 !! html/parsoid
23373 <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>
23374 !!end
23375
23376 !! test
23377 Don't break link parsing if language converter markup is in the caption.
23378 !! options
23379 language=sr variant=sr-ec
23380 !! wikitext
23381 [[Main Page|-{R|main page}-]]
23382 !! html/php
23383 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
23384 </p>
23385 !! html/parsoid
23386 <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>
23387 !! end
23388
23389 !! test
23390 T146304: Don't break template parsing if language converter markup is in the parameter.
23391 !! options
23392 language=sr variant=sr-ec
23393 !! wikitext
23394 {{echo|-{R|foo}-}}
23395 !! html/php
23396 <p>foo
23397 </p>
23398 !! html/parsoid
23399 <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>
23400 !! end
23401
23402 !! test
23403 T146305: Don't break image parsing if language converter markup is in the caption.
23404 !! options
23405 language=sr
23406 !! wikitext
23407 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
23408 !! html/php
23409 <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>
23410 !! html/parsoid
23411 <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>
23412 !! end
23413
23414 !! test
23415 T146305: Don't break image parsing if nested language converter markup is in the caption.
23416 !! options
23417 language=zh variant=zh-cn
23418 !! wikitext
23419 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
23420 !! html/php
23421 <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>
23422 !! html/parsoid
23423 <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>
23424 !! end
23425
23426 # XXX html2wt disabled because rich markup in alt is not preserved.
23427 !! test
23428 Don't break gallery if language converter markup is inside.
23429 !! options
23430 language=zh
23431 !! wikitext
23432 <gallery>
23433 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
23434 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
23435 </gallery>
23436 !! html/php
23437 <ul class="gallery mw-gallery-traditional">
23438 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23439 <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>
23440 <div class="gallerytext">
23441 <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>
23442 </p>
23443 </div>
23444 </div></li>
23445 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23446 <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>
23447 <div class="gallerytext">
23448 <p>This is a test template
23449 </p>
23450 </div>
23451 </div></li>
23452 </ul>
23453 !! html/parsoid
23454 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-\nFile:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt\n"}}'>
23455 <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="" 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":"&lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"disabled\":{\"t\":\"bar\"}}&#39; data-parsoid=&#39;{\"fl\":[\"R\"],\"dsr\":[68,77,null,2]}&#39;>&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>
23456 <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":"-{R|param}-"}},"i":0}}]}'>This is a test template</span></div></li>
23457 </ul>
23458 !! end
23459
23460 !! test
23461 T153135: Don't break list handling if language converter markup is in the item.
23462 !! options
23463 language=zh variant=zh-cn
23464 !! wikitext
23465 ;-{zh-cn:AAA;zh-tw:BBB}-
23466 ;-{R|foo:bar}-
23467 !! html/php
23468 <dl><dt>AAA</dt>
23469 <dt>foo:bar</dt></dl>
23470 !! html/parsoid
23471 <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>
23472 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
23473 </dl>
23474 !! end
23475
23476 // Note that parsoid does not protect colons unless language converter
23477 // markup is properly nested, because it is a backtracking parser.
23478 !! test
23479 T153135: Unclosed markup in definition list (code coverage)
23480 !! options
23481 language=zh variant=zh-cn
23482 !! wikitext
23483 ;<b>foo:bar
23484 ;-{zh-cn:AAA
23485 !! html/php+tidy
23486 <dl><dt><b>foo:bar</b></dt><b>
23487 <dt>-{zh-cn:AAA</dt></b></dl>
23488 !! html/parsoid
23489 <dl><dt data-parsoid='{}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
23490 <dt data-parsoid='{}'>-{zh-cn</dt><dd data-parsoid='{"stx":"row"}'>AAA</dd></b></dl>
23491 !! end
23492
23493 !! test
23494 T153135: Nested language converter markup in definition list (code coverage)
23495 !! options
23496 language=zh variant=zh-cn
23497 !! wikitext
23498 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
23499 !! html/php
23500 <dl><dt>AAA foo:bar bat:baz</dt>
23501 <dd>def</dd></dl>
23502 !! html/parsoid
23503 <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>
23504 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
23505 </dl>
23506 !! end
23507
23508 # html2wt mode disabled due to <nowiki> insertion.
23509 !! test
23510 T153140: Don't break table handling if language converter markup is in the cell.
23511 !! options
23512 language=sr variant=sr-ec
23513 parsoid=wt2html,wt2wt,html2html
23514 !! wikitext
23515 {|
23516 |-
23517 | -{R|B}-
23518 |}
23519 !! html/php
23520 <table>
23521
23522 <tr>
23523 <td>B
23524 </td></tr></table>
23525 !! html/parsoid
23526 <table>
23527 <tbody>
23528 <tr>
23529 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
23530 </tr>
23531 </tbody>
23532 </table>
23533 !! end
23534
23535 !! test
23536 Language converter tricky html2wt cases (1)
23537 !! options
23538 language=sr
23539 parsoid=html2wt,wt2wt
23540 !! html/parsoid
23541 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
23542 !! wikitext
23543 -{<nowiki>}-</nowiki>}-
23544 !! html/php
23545 <p>&#125;-
23546 </p>
23547 !! end
23548
23549 !! test
23550 Language converter tricky html2wt cases (2)
23551 !! options
23552 language=sr
23553 parsoid=html2wt,wt2wt
23554 !! html/parsoid
23555 <p>-{foo}-</p>
23556 !! wikitext
23557 <nowiki>-{foo}-</nowiki>
23558 !! html/php
23559 <p>-&#123;foo&#125;-
23560 </p>
23561 !! end
23562
23563 !! test
23564 Language converter tricky html2wt cases (3)
23565 !! options
23566 language=sr
23567 parsoid=html2wt,wt2wt
23568 !! html/parsoid
23569 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
23570 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
23571 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
23572 !! wikitext
23573 -{R||}-
23574
23575 -{R|R|raw}-
23576
23577 -{<nowiki>-{foo}-</nowiki>}-
23578 !! html/php
23579 <p>|
23580 </p><p>R|raw
23581 </p><p>-&#123;foo&#125;-
23582 </p>
23583 !! end
23584
23585 !! test
23586 Language converter tricky html2wt cases (4)
23587 !! options
23588 language=sr
23589 parsoid=html2wt,wt2wt
23590 !! html/parsoid
23591 <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>
23592 !! wikitext
23593 -{R|{{echo|hey}}}-
23594 !! html/php
23595 <p>hey
23596 </p>
23597 !! end
23598
23599 # Note that the <nowiki> escaping added by parsoid for source text,
23600 # destination text, and language names only works on the PHP side
23601 # for *destination text*. (HTML entity escaping wouldn't work
23602 # any better.) This is probably a bug, at least for source texts.
23603 # (For language names PHP uses a precise regexp based on the languages
23604 # it currently knows have variants, which is fragile since this set
23605 # can grow/shrink over time.)
23606 !! test
23607 Language converter tricky html2wt cases (5)
23608 !! options
23609 language=zh variant=zh-cn
23610 !! html/parsoid
23611 <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>
23612 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
23613 <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>
23614 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
23615 <p>a:b=>c xyz</p>
23616 !! wikitext
23617 -{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
23618
23619 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
23620
23621 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
23622
23623 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
23624
23625 a:b=>c xyz
23626 !! html/php+disabled
23627 <p>foobat;xyz=&gt;zh-cn:abc
23628 </p><p>A
23629 </p><p>0;zh-tw:bar
23630 </p><p>abc
23631 </p><p>a:b=&gt;c 0;zh-tw:bar
23632 </p>
23633 !! end
23634
23635 !! test
23636 T179579: Nowiki and lc interaction
23637 !! options
23638 parsoid=wt2html
23639 language=sr
23640 !! wikitext
23641 -{</nowiki>123}-
23642
23643 -{123<nowiki>|</nowiki>456}-
23644 !! html/parsoid
23645 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
23646
23647 <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>
23648 !! end
23649
23650 !! test
23651 T2529: Uncovered bullet
23652 !! wikitext
23653 *Foo {{bullet}}
23654 !! html
23655 <ul><li>Foo</li>
23656 <li>Bar</li></ul>
23657 !! end
23658
23659 !! test
23660 T2529: Uncovered bullet in a deeply nested list
23661 !! wikitext
23662 *******Foo {{bullet}}
23663 !! html
23664 <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>
23665 <li>Bar</li></ul>
23666 !! end
23667
23668 !! test
23669 T2529: Uncovered table already at line-start
23670 !! wikitext
23671 x
23672
23673 {{table}}
23674 y
23675 !! html
23676 <p>x
23677 </p>
23678 <table>
23679 <tr>
23680 <td>1</td>
23681 <td>2
23682 </td></tr>
23683 <tr>
23684 <td>3</td>
23685 <td>4
23686 </td></tr></table>
23687 <p>y
23688 </p>
23689 !! end
23690
23691 !! test
23692 T2529: Uncovered bullet in parser function result
23693 !! wikitext
23694 *Foo {{lc:{{bullet}} }}
23695 !! html
23696 <ul><li>Foo</li>
23697 <li>bar</li></ul>
23698 !! end
23699
23700 !! test
23701 T7678: Double-parsed template argument
23702 !! wikitext
23703 {{lc:{{{1}}}|hello}}
23704 !! html
23705 <p>{{{1}}}
23706 </p>
23707 !! end
23708
23709 !! test
23710 T7678: Double-parsed template invocation
23711 !! wikitext
23712 {{lc:{{paramtest {{!}} param = hello }} }}
23713 !! html
23714 <p>{{paramtest | param = hello }}
23715 </p>
23716 !! end
23717
23718 !! test
23719 Case insensitivity of parser functions for non-ASCII characters (T10143)
23720 !! options
23721 language=cs
23722 title=[[Main Page]]
23723 !! wikitext
23724 {{PRVNÍVELKÉ:ěščř}}
23725 {{prvnívelké:ěščř}}
23726 {{PRVNÍMALÉ:ěščř}}
23727 {{prvnímalé:ěščř}}
23728 {{MALÁ:ěščř}}
23729 {{malá:ěščř}}
23730 {{VELKÁ:ěščř}}
23731 {{velká:ěščř}}
23732 !! html
23733 <p>Ěščř
23734 Ěščř
23735 ěščř
23736 ěščř
23737 ěščř
23738 ěščř
23739 ĚŠČŘ
23740 ĚŠČŘ
23741 </p>
23742 !! end
23743
23744 !! test
23745 Morwen/13: Unclosed link followed by heading
23746 !! wikitext
23747 [[link
23748 ==heading==
23749 !! html
23750 <p>[[link
23751 </p>
23752 <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>
23753 !! end
23754
23755 !! test
23756 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23757 !! wikitext
23758 {{foo|
23759 =heading=
23760 !! html
23761 <p>{{foo|
23762 </p>
23763 <h1><span class="mw-headline" id="heading">heading</span></h1>
23764 !! end
23765
23766 !! test
23767 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23768 !! wikitext
23769 {{foo|
23770 ==heading==
23771 !! html
23772 <p>{{foo|
23773 </p>
23774 <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>
23775 !! end
23776
23777 !! test
23778 Tildes in comments
23779 !! options
23780 pst
23781 !! wikitext
23782 <!-- ~~~~ -->
23783 !! html/php
23784 <!-- ~~~~ -->
23785 !! end
23786
23787 !! test
23788 Paragraphs inside divs (no extra line breaks)
23789 !! wikitext
23790 <div>Line one
23791
23792 Line two</div>
23793 !! html
23794 <div>Line one
23795 Line two</div>
23796 !! end
23797
23798 !! test
23799 Paragraphs inside divs (extra line break on open)
23800 !! wikitext
23801 <div>
23802 Line one
23803
23804 Line two</div>
23805 !! html
23806 <div>
23807 <p>Line one
23808 </p>
23809 Line two</div>
23810 !! end
23811
23812 !! test
23813 Paragraphs inside divs (extra line break on close)
23814 !! wikitext
23815 <div>Line one
23816
23817 Line two
23818 </div>
23819 !! html
23820 <div>Line one
23821 <p>Line two
23822 </p>
23823 </div>
23824 !! end
23825
23826 !! test
23827 Paragraphs inside divs (extra line break on open and close)
23828 !! wikitext
23829 <div>
23830 Line one
23831
23832 Line two
23833 </div>
23834 !! html
23835 <div>
23836 <p>Line one
23837 </p><p>Line two
23838 </p>
23839 </div>
23840 !! end
23841
23842 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23843 !! test
23844 Nesting tags, paragraphs on lines which begin with <div>
23845 !! wikitext
23846 <div></div><strong>A
23847 B</strong>
23848 !! html/php+tidy
23849 <div></div><p><strong>A
23850 </strong></p><strong></strong><p><strong>B</strong>
23851 </p>
23852 !! html/parsoid
23853 <div data-parsoid='{"stx":"html"}'></div><p><strong data-parsoid='{"stx":"html","autoInsertedEnd":true}'>A</strong></p>
23854 <p><strong data-parsoid='{"stx":"html","autoInsertedStart":true}'>B</strong></p>
23855 !! end
23856
23857 # T8200: <blockquote> should behave like <div> with respect to line breaks
23858 !! test
23859 T8200: paragraphs inside blockquotes (no extra line breaks)
23860 !! wikitext
23861 <blockquote>Line one
23862
23863 Line two</blockquote>
23864 !! html
23865 <blockquote>Line one
23866 Line two</blockquote>
23867 !! html+tidy
23868 <blockquote><p>Line one
23869 Line two</p></blockquote>
23870 !! end
23871
23872 !! test
23873 T8200: paragraphs inside blockquotes (extra line break on open)
23874 !! wikitext
23875 <blockquote>
23876 Line one
23877
23878 Line two</blockquote>
23879 !! html
23880 <blockquote>
23881 <p>Line one
23882 </p>
23883 Line two</blockquote>
23884 !! html+tidy
23885 <blockquote>
23886 <p>Line one
23887 </p><p>
23888 Line two</p></blockquote>
23889 !! end
23890
23891 !! test
23892 T8200: paragraphs inside blockquotes (extra line break on close)
23893 !! wikitext
23894 <blockquote>Line one
23895
23896 Line two
23897 </blockquote>
23898 !! html
23899 <blockquote>Line one
23900 <p>Line two
23901 </p>
23902 </blockquote>
23903 !! html+tidy
23904 <blockquote><p>Line one
23905 </p><p>Line two
23906 </p>
23907 </blockquote>
23908 !! end
23909
23910 !! test
23911 T8200: paragraphs inside blockquotes (extra line break on open and close)
23912 !! wikitext
23913 <blockquote>
23914 Line one
23915
23916 Line two
23917 </blockquote>
23918 !! html
23919 <blockquote>
23920 <p>Line one
23921 </p><p>Line two
23922 </p>
23923 </blockquote>
23924 !! end
23925
23926 ## This is a corner case interaction between the paragraph wrapping in the
23927 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
23928 ## some tags which close paragraphs (and thus prevent wrapping on their line),
23929 ## of which "div" is one, but do p-wrapping inside them. These are referred
23930 ## to as "never suppressing". Remex, for its part, doesn't traverse into
23931 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
23932 !! test
23933 Paragraphs inside blockquotes/divs (no extra line breaks)
23934 !! wikitext
23935 <blockquote><div>Line one
23936
23937 Line two</div></blockquote>
23938 !! html
23939 <blockquote><div>Line one
23940 Line two</div></blockquote>
23941 !! end
23942
23943 !! test
23944 Paragraphs inside blockquotes/divs (extra line break on open)
23945 !! wikitext
23946 <blockquote><div>
23947 Line one
23948
23949 Line two</div></blockquote>
23950 !! html
23951 <blockquote><div>
23952 <p>Line one
23953 </p>
23954 Line two</div></blockquote>
23955 !! end
23956
23957 !! test
23958 Paragraphs inside blockquotes/divs (extra line break on close)
23959 !! wikitext
23960 <blockquote><div>Line one
23961
23962 Line two
23963 </div></blockquote>
23964 !! html
23965 <blockquote><div>Line one
23966 <p>Line two
23967 </p>
23968 </div></blockquote>
23969 !! end
23970
23971 !! test
23972 Paragraphs inside blockquotes/divs (extra line break on open and close)
23973 !! wikitext
23974 <blockquote><div>
23975 Line one
23976
23977 Line two
23978 </div></blockquote>
23979 !! html
23980 <blockquote><div>
23981 <p>Line one
23982 </p><p>Line two
23983 </p>
23984 </div></blockquote>
23985 !! end
23986
23987 !! test
23988 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23989 !! options
23990 wgLinkHolderBatchSize=0
23991 !! wikitext
23992 [[meatball:1]]
23993 [[meatball:2]]
23994 [[meatball:3]]
23995 !! html
23996 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23997 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23998 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23999 </p>
24000 !! end
24001
24002 !! test
24003 Free external link invading image caption
24004 !! wikitext
24005 [[Image:Foobar.jpg|thumb|http://x|hello]]
24006 !! html/php
24007 <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>
24008 !! html/parsoid
24009 <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>
24010 !! end
24011
24012 !! test
24013 T17196: localised external link numbers
24014 !! options
24015 language=fa
24016 !! wikitext
24017 [http://en.wikipedia.org/]
24018 !! html/php
24019 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
24020 </p>
24021 !! html/parsoid
24022 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
24023 !! end
24024
24025 !! test
24026 Multibyte character in padleft
24027 !! wikitext
24028 {{padleft:-Hello|7|Æ}}
24029 !! html/php
24030 <p>Æ-Hello
24031 </p>
24032 !! html/parsoid
24033 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
24034 !! end
24035
24036 !! test
24037 Multibyte character in padright
24038 !! wikitext
24039 {{padright:Hello-|7|Æ}}
24040 !! html/php
24041 <p>Hello-Æ
24042 </p>
24043 !! html/parsoid
24044 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
24045 !! end
24046
24047 !!test
24048 formatdate parser function
24049 !! wikitext
24050 {{#formatdate:2009-03-24}}
24051 !! html
24052 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
24053 </p>
24054 !! end
24055
24056 !!test
24057 formatdate parser function, with default format
24058 !! wikitext
24059 {{#formatdate:2009-03-24|mdy}}
24060 !! html
24061 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
24062 </p>
24063 !! end
24064
24065 !! test
24066 Spacing of numbers in formatted dates
24067 !! wikitext
24068 {{#formatdate:January 15}}
24069 !! html
24070 <p><span class="mw-formatted-date" title="01-15">January 15</span>
24071 </p>
24072 !! end
24073
24074 !! test
24075 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
24076 !! options
24077 language=nl title=[[MediaWiki:Common.css]]
24078 !! wikitext
24079 {{#formatdate:2009-03-24|dmy}}
24080 !! html
24081 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
24082 </p>
24083 !! end
24084
24085 #
24086 #
24087 #
24088
24089 #
24090 # Edit comments
24091 #
24092
24093 !! test
24094 Edit comment with link
24095 !! options
24096 comment
24097 !! wikitext
24098 I like the [[Main Page]] a lot
24099 !! html/php
24100 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
24101 !!end
24102
24103 !! test
24104 Edit comment with link and link text
24105 !! options
24106 comment
24107 !! wikitext
24108 I like the [[Main Page|best pages]] a lot
24109 !! html/php
24110 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
24111 !!end
24112
24113 !! test
24114 Edit comment with link and link text with suffix
24115 !! options
24116 comment
24117 !! wikitext
24118 I like the [[Main Page|best page]]s a lot
24119 !! html/php
24120 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
24121 !!end
24122
24123 !! test
24124 Edit comment with section link (non-local, eg in history list)
24125 !! options
24126 comment title=[[Main Page]]
24127 !! wikitext
24128 /* External links */ removed bogus entries
24129 !! html/php
24130 <span dir="auto"><span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→‎External links</a>: </span> removed bogus entries</span>
24131 !!end
24132
24133 !! test
24134 Edit comment with section link and text before it (non-local, eg in history list)
24135 !! options
24136 comment title=[[Main Page]]
24137 !! wikitext
24138 pre-comment text /* External links */ removed bogus entries
24139 !! html/php
24140 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>
24141 !!end
24142
24143 !! test
24144 Edit comment with section link (local, eg in diff view)
24145 !! options
24146 comment local title=[[Main Page]]
24147 !! wikitext
24148 /* External links */ removed bogus entries
24149 !! html/php
24150 <span dir="auto"><span class="autocomment"><a href="#External_links">→‎External links</a>: </span> removed bogus entries</span>
24151 !!end
24152
24153 !! test
24154 Edit comment with section link that has a link in it
24155 !! options
24156 comment local title=[[Main Page]]
24157 !! wikitext
24158 /* [[A link]] */
24159 !! html/php
24160 <span dir="auto"><span class="autocomment"><a href="#A_link">→‎&#91;[A link]]</a></span></span>
24161 !! end
24162
24163 !! test
24164 Edit comment with section link that has a template in it
24165 !! options
24166 comment local title=[[Main Page]]
24167 !! wikitext
24168 /* {{foobar|param}} */
24169 !! html/php
24170 <span dir="auto"><span class="autocomment"><a href="#.7B.7Bfoobar.7Cparam.7D.7D">→‎{{foobar|param}}</a></span></span>
24171 !! end
24172
24173 !! test
24174 Edit comment with subpage link (T16080)
24175 !! options
24176 comment
24177 subpage
24178 title=[[Subpage test]]
24179 !! wikitext
24180 Poked at a [[/subpage]] here...
24181 !! html/php
24182 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
24183 !!end
24184
24185 !! test
24186 Edit comment with subpage link and link text (T16080)
24187 !! options
24188 comment
24189 subpage
24190 title=[[Subpage test]]
24191 !! wikitext
24192 Poked at a [[/subpage|neat little page]] here...
24193 !! html/php
24194 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
24195 !!end
24196
24197 !! test
24198 Edit comment with bogus subpage link in non-subpage NS (T16080)
24199 !! options
24200 comment
24201 title=[[Subpage test]]
24202 !! wikitext
24203 Poked at a [[/subpage]] here...
24204 !! html/php
24205 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...
24206 !!end
24207
24208 !! test
24209 Edit comment with bare anchor link (local, as on diff)
24210 !! options
24211 comment
24212 local
24213 title=[[Main Page]]
24214 !! wikitext
24215 [[#section]]
24216 !! html/php
24217 <a href="#section">#section</a>
24218 !! end
24219
24220 !! test
24221 Edit comment with bare anchor link (non-local, as on history)
24222 !! options
24223 comment
24224 title=[[Main Page]]
24225 !! wikitext
24226 [[#section]]
24227 !! html/php
24228 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
24229 !! end
24230
24231 !! test
24232 Anchor starting with underscore
24233 !! options
24234 title=[[Foo]]
24235 !! wikitext
24236 [[#_ref|One]]
24237 !! html/php
24238 <p><a href="#_ref">One</a>
24239 </p>
24240 !! html/parsoid
24241 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
24242 !! end
24243
24244 !! test
24245 Id starting with underscore
24246 !! wikitext
24247 <div id="_ref"></div>
24248 !! html/*
24249 <div id="_ref"></div>
24250 !! end
24251
24252 !! test
24253 Edit comment with link with more than one pipe (T99346)
24254 !! options
24255 comment
24256 !! wikitext
24257 [[Main Page|Many|pipes]]
24258 !! html/php
24259 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
24260 !! end
24261
24262 !! test
24263 Complex edit comment with link with more than one pipe (T99346)
24264 !! options
24265 comment
24266 !! wikitext
24267 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
24268 !! html/php
24269 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;
24270 !! end
24271
24272 !! test
24273 Space normalisation on autocomment (T24784)
24274 !! options
24275 comment
24276 title=[[Main Page]]
24277 !! wikitext
24278 /* __hello__world__ */
24279 !! html/php
24280 <span dir="auto"><span class="autocomment"><a href="/wiki/Main_Page#hello_world" title="Main Page">→‎__hello__world__</a></span></span>
24281 !! end
24282
24283 !! test
24284 percent-encoding and + signs in comments (T28410)
24285 !! options
24286 comment
24287 !! wikitext
24288 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
24289 !! html/php
24290 <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>
24291 !! end
24292
24293 # Parsoid doesn't support this yet: see T75581
24294 # but it *should* omit the 'src' attribute if the image is bad.
24295 # PHP side of tests was disabled in
24296 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
24297 # because of issues in the PHP parserTests infrastructure
24298 # (but the output below is indeed what the PHP side emits)
24299 !! test
24300 Bad images - basic functionality
24301 !! wikitext
24302 [[File:Bad.jpg]]
24303 !! html/php+disabled
24304 !! html/parsoid
24305 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="./File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span></p>
24306 !! end
24307
24308 !! test
24309 Bad images - T18039: text after bad image disappears
24310 !! wikitext
24311 Foo bar
24312 [[File:Bad.jpg]]
24313 Bar foo
24314 !! html/php+disabled
24315 <p>Foo bar
24316 </p><p>Bar foo
24317 </p>
24318 !! html/parsoid
24319 <p>Foo bar
24320 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="./File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span>
24321 Bar foo</p>
24322 !! end
24323
24324 !! test
24325 Verify that displaytitle works (T24501) no displaytitle
24326 !! options
24327 showtitle
24328 !! config
24329 wgAllowDisplayTitle=true
24330 wgRestrictDisplayTitle=false
24331 !! wikitext
24332 this is not the the title
24333 !! html/php
24334 Parser test
24335 <p>this is not the the title
24336 </p>
24337 !! end
24338
24339 !! test
24340 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
24341 !! options
24342 showtitle
24343 title=[[Screen]]
24344 !! config
24345 wgAllowDisplayTitle=true
24346 wgRestrictDisplayTitle=false
24347 !! wikitext
24348 this is not the the title
24349 {{DISPLAYTITLE:whatever}}
24350 !! html/php
24351 whatever
24352 <p>this is not the the title
24353 </p>
24354 !! end
24355
24356 !! test
24357 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
24358 !! options
24359 showtitle
24360 title=[[Screen]]
24361 !! config
24362 wgAllowDisplayTitle=true
24363 wgRestrictDisplayTitle=true
24364 !! wikitext
24365 this is not the the title
24366 {{DISPLAYTITLE:whatever}}
24367 !! html/php
24368 Screen
24369 <p>this is not the the title
24370 </p>
24371 !! end
24372
24373 !! test
24374 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
24375 !! options
24376 showtitle
24377 title=[[Screen]]
24378 !! config
24379 wgAllowDisplayTitle=true
24380 wgRestrictDisplayTitle=true
24381 !! wikitext
24382 this is not the the title
24383 {{DISPLAYTITLE:screen}}
24384 !! html/php
24385 screen
24386 <p>this is not the the title
24387 </p>
24388 !! end
24389
24390 !! test
24391 Verify that displaytitle works (T24501) AllowDisplayTitle=false
24392 !! options
24393 showtitle
24394 title=[[Screen]]
24395 !! config
24396 wgAllowDisplayTitle=false
24397 !! wikitext
24398 this is not the the title
24399 {{DISPLAYTITLE:screen}}
24400 !! html/php
24401 Screen
24402 <p>this is not the the title
24403 <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>
24404 </p>
24405 !! end
24406
24407 !! test
24408 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
24409 !! options
24410 showtitle
24411 title=[[Screen]]
24412 !! config
24413 wgAllowDisplayTitle=false
24414 !! wikitext
24415 this is not the the title
24416 !! html/php
24417 Screen
24418 <p>this is not the the title
24419 </p>
24420 !! end
24421
24422 !! test
24423 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
24424 !! options
24425 showtitle
24426 title=[[Screen]]
24427 !! config
24428 wgAllowDisplayTitle=true
24429 wgRestrictDisplayTitle=true
24430 !! wikitext
24431 this is not the the title
24432 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
24433 !! html/php
24434 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
24435 <p>this is not the the title
24436 </p>
24437 !! end
24438
24439 !! test
24440 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
24441 !! options
24442 showtitle
24443 title=[[Screen]]
24444 !! config
24445 wgAllowDisplayTitle=true
24446 wgRestrictDisplayTitle=true
24447 !! wikitext
24448 this is not the the title
24449 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
24450 !! html/php
24451 <span style="color: red;">s</span>creen
24452 <p>this is not the the title
24453 </p>
24454 !! end
24455
24456 !! test
24457 Page status indicators: Empty name is invalid
24458 !! options
24459 showindicators
24460 !! wikitext
24461 <indicator name=" "></indicator>
24462 <indicator></indicator>
24463 !! html/php
24464 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24465 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24466 </p>
24467 !! end
24468
24469 !! test
24470 Page status indicators: Weird syntaxes that are okay
24471 !! options
24472 showindicators
24473 !! wikitext
24474 <indicator name="empty" />
24475 <indicator name="name"></indicator>
24476 !! html/php
24477 empty=
24478 name=
24479 <p><br />
24480 </p>
24481 !! end
24482
24483 !! test
24484 Page status indicators: Torture test
24485 !! options
24486 showindicators
24487 !! wikitext
24488 <indicator name="01">hello world</indicator>
24489 <indicator name="02">[[Main Page]]</indicator>
24490 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
24491 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
24492 <indicator name="05">*foo
24493 *bar</indicator>
24494 <indicator name="06"><nowiki>foo</nowiki></indicator>
24495 <indicator name="07"> Preformatted</indicator>
24496 <indicator name="08"><div>Broken tag</indicator>
24497 <indicator name="09">{| class=wikitable
24498 |cell
24499 |}</indicator>
24500 <indicator name="10">Two
24501
24502 paragraphs</indicator>
24503 !! html/php
24504 01=hello world
24505 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
24506 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" />
24507 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>
24508 05=<ul><li>foo</li>
24509 <li>bar</li></ul>
24510 06=foo
24511 07=<pre>Preformatted
24512 </pre>
24513 08=<div>Broken tag</div>
24514
24515 09=<table class="wikitable">
24516 <tr>
24517 <td>cell
24518 </td></tr></table>
24519 10=<p>Two
24520 </p><p>paragraphs
24521 </p>
24522 <p><br />
24523 </p><p><br />
24524 </p><p><br />
24525 </p><p><br />
24526 </p><p><br />
24527 </p>
24528 !! end
24529
24530 !! test
24531 preload: check <noinclude> and <includeonly>
24532 !! options
24533 preload
24534 !! wikitext
24535 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
24536 !! html/php
24537 Hello kind world.
24538 !! end
24539
24540 !! test
24541 preload: check <onlyinclude>
24542 !! options
24543 preload
24544 !! wikitext
24545 Goodbye <onlyinclude>Hello world</onlyinclude>
24546 !! html/php
24547 Hello world
24548 !! end
24549
24550 !! test
24551 preload: can pass tags through if we want to
24552 !! options
24553 preload
24554 !! wikitext
24555 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
24556 !! html/php
24557 <includeonly>Hello world</includeonly>
24558 !! end
24559
24560 !! test
24561 preload: check that it doesn't try to do tricks
24562 !! options
24563 preload
24564 !! wikitext
24565 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24566 !! html/php
24567 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24568 !! end
24569
24570 !! test
24571 Play a bit with r67090 and T5158
24572 !! wikitext
24573 <div style="width:50% !important">&nbsp;</div>
24574 <div style="width:50%&nbsp;!important">&nbsp;</div>
24575 <div style="width:50%&#160;!important">&nbsp;</div>
24576 <div style="border : solid;">&nbsp;</div>
24577 !! html/php
24578 <div style="width:50% !important">&#160;</div>
24579 <div style="width:50% !important">&#160;</div>
24580 <div style="width:50% !important">&#160;</div>
24581 <div style="border&#32;: solid;">&#160;</div>
24582 !! html/parsoid
24583 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24584 <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>
24585 <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>
24586 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24587 !! end
24588
24589 !! test
24590 French spaces in wikitext
24591 !! wikitext
24592 foo ! bar ? bat 50 % is less than 75 %.
24593
24594 Hello : this ; is « something ‹ else › again »
24595 !! html
24596 <p>foo&#160;! bar&#160;? bat 50&#160;% is less than 75&#160;%.
24597 </p><p>Hello&#160;: this&#160;; is «&#160;something ‹&#160;else&#160;› again&#160;»
24598 </p>
24599 !! end
24600
24601 # It would be reasonable for Parsoid and PHP to differ here.
24602 # The PHP behavior is arguably a bug.
24603 !! test
24604 Corner case: french spaces in definition list
24605 !! wikitext
24606 ;foo : bar
24607 !! html+tidy
24608 <dl><dt>foo&#160;</dt>
24609 <dd>bar</dd></dl>
24610 !! end
24611
24612 !! test
24613 T5158: Test for French spaces in attributes
24614 !! wikitext
24615 <br style=" clear : both ; " />
24616 !! html/php
24617 <p><br style="clear&#32;: both&#32;;" />
24618 </p>
24619 !! end
24620
24621 !! test
24622 HTML5 data attributes
24623 !! wikitext
24624 <span data-foo="bar">Baz</span>
24625 <p data-abc-def_hij="">Quuz</p>
24626 !! html/php
24627 <p><span data-foo="bar">Baz</span>
24628 </p>
24629 <p data-abc-def_hij="">Quuz</p>
24630 !! html/parsoid
24631 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
24632 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
24633 !! end
24634
24635 !! test
24636 Strip reserved data attributes
24637 !! wikitext
24638 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
24639 !! html/php
24640 <div data-ok="fred">d</div>
24641 !! html/parsoid
24642 <div data-x-data-mw="foo" data-x-data-parsoid="bar" data-x-data-mw-someext="baz" data-ok="fred" data-parsoid='{"stx":"html","a":{"data-ooui":null,"data-bad:ns":null},"sa":{"data-ooui":"xyzzy","data-bad:ns":"ns"}}'>d</div>
24643 !! end
24644
24645 !! test
24646 percent-encoding and + signs in internal links (T28410)
24647 !! wikitext
24648 [[User:+%]] [[Page+title%]]
24649 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
24650 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
24651 [[%33%45]] [[%33%45+]]
24652 !! html/php
24653 <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>
24654 <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>
24655 <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>
24656 <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>
24657 </p>
24658 !! html/parsoid
24659 <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>
24660 <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>
24661 <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='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bar\"},\"sa\":{\"href\":\"bar\"},\"dsr\":[94,101,2,2]}&#39;>bar&lt;/a>"}'><a href="./File:%25+abc9" data-parsoid='{"a":{"href":"./File:%25+abc9"},"sa":{}}'><img resource="./File:%25+abc9" src="./Special:FilePath/%25+abc9" height="220" width="220" data-parsoid='{"a":{"resource":"./File:%25+abc9","height":"220","width":"220"},"sa":{"resource":"File:%+abc%39"}}'/></a></figure-inline>
24662 <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>
24663 !! end
24664
24665 !! test
24666 Special characters in embedded file links (T29679)
24667 !! wikitext
24668 [[File:Contains & ampersand.jpg]]
24669 [[File:Does not exist.jpg|Title with & ampersand]]
24670 !! html/php
24671 <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>
24672 <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>
24673 </p>
24674 !! html/parsoid
24675 <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="./File:Contains_&amp;_ampersand.jpg"><img resource="./File:Contains_&amp;_ampersand.jpg" src="./Special:FilePath/Contains_&amp;_ampersand.jpg" height="220" width="220"/></a></figure-inline>
24676 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"Title with &amp;amp; ampersand"}'><a href="./File:Does_not_exist.jpg"><img resource="./File:Does_not_exist.jpg" src="./Special:FilePath/Does_not_exist.jpg" height="220" width="220"/></a></figure-inline></p>
24677 !! end
24678
24679 !! test
24680 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
24681 !! wikitext
24682 Text&apos;s been normalized?
24683 !! html
24684 <p>Text&#39;s been normalized?
24685 </p>
24686 !! end
24687
24688 !! test
24689 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
24690 !! wikitext
24691 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
24692 !! html
24693 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
24694 </p>
24695 !! end
24696
24697 !! test
24698 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
24699 !! wikitext
24700 [http://www.example.org/ ideograms]
24701 !! html
24702 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
24703 </p>
24704 !! end
24705
24706 !! test
24707 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
24708 !! wikitext
24709 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
24710 !! html
24711 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
24712 </p>
24713 !! end
24714
24715 !! article
24716 Mediawiki:loop1
24717 !! text
24718 {{Identical|A}}
24719 !! endarticle
24720
24721 !! article
24722 Mediawiki:loop2
24723 !! text
24724 {{Identical|B}}
24725 !! endarticle
24726
24727 !! article
24728 Template:Identical
24729 !! text
24730 {{int:loop1}}
24731 {{int:loop2}}
24732 !! endarticle
24733
24734 !! test
24735 T33098 Template which includes system messages which includes the template
24736 !! wikitext
24737 {{Identical}}
24738 !! html
24739 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24740 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24741 </p>
24742 !! end
24743
24744 !! test
24745 T33490 Turkish: ucfirst 'blah'
24746 !! options
24747 language=tr
24748 !! wikitext
24749 {{ucfirst:blah}}
24750 !! html
24751 <p>Blah
24752 </p>
24753 !! end
24754
24755 !! test
24756 T33490 Turkish: ucfirst 'ix'
24757 !! options
24758 language=tr
24759 !! wikitext
24760 {{ucfirst:ix}}
24761 !! html
24762 <p>İx
24763 </p>
24764 !! end
24765
24766 !! test
24767 T33490 Turkish: lcfirst 'BLAH'
24768 !! options
24769 language=tr
24770 !! wikitext
24771 {{lcfirst:BLAH}}
24772 !! html
24773 <p>bLAH
24774 </p>
24775 !! end
24776
24777 !! test
24778 T33490 Turkish: ucfırst (with a dotless i)
24779 !! options
24780 language=tr
24781 !! wikitext
24782 {{ucfırst:blah}}
24783 !! html
24784 <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>
24785 </p>
24786 !! end
24787
24788 !! test
24789 T33490 ucfırst (with a dotless i) with English language
24790 !! options
24791 language=en
24792 !! wikitext
24793 {{ucfırst:blah}}
24794 !! html
24795 <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>
24796 </p>
24797 !! end
24798
24799 # Note that Parsoid doesn't emit an explicit TOC.
24800 # Note also that the html2wt direction tends to emit an extra newline
24801 # between the __TOC__ magicword and the first heading unless *both*
24802 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24803 # it's "{}").
24804
24805 !! test
24806 T28375: TOC with italics
24807 !! options
24808 title=[[Main Page]]
24809 !! wikitext
24810 __TOC__
24811 ==''Lost'' episodes==
24812 !! html/php
24813 <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>
24814 <ul>
24815 <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>
24816 </ul>
24817 </div>
24818
24819 <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>
24820 !! html/parsoid
24821 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24822 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24823 !! end
24824
24825 !! test
24826 T28375: TOC with bold
24827 !! options
24828 title=[[Main Page]]
24829 !! wikitext
24830 __TOC__
24831 =='''should be bold''' then normal text==
24832 !! html/php
24833 <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>
24834 <ul>
24835 <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>
24836 </ul>
24837 </div>
24838
24839 <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>
24840 !! html/parsoid
24841 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24842 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24843 !! end
24844
24845 !! test
24846 T35845: Headings become cursive in TOC when they contain an image
24847 !! options
24848 title=[[Main Page]]
24849 !! wikitext
24850 __TOC__
24851 ==Image [[Image:foobar.jpg]]==
24852 !! html/php
24853 <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>
24854 <ul>
24855 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24856 </ul>
24857 </div>
24858
24859 <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>
24860 !! html/parsoid
24861 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24862 <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>
24863 !! end
24864
24865 !! test
24866 T35845 (2): Headings become bold in TOC when they contain a blockquote
24867 !! options
24868 title=[[Main Page]]
24869 !! wikitext
24870 __TOC__
24871 ==<blockquote>Quote</blockquote>==
24872 !! html/php
24873 <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>
24874 <ul>
24875 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24876 </ul>
24877 </div>
24878
24879 <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>
24880 !! html/php+tidy
24881 <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>
24882 <ul>
24883 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24884 </ul>
24885 </div>
24886
24887 <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>
24888 !! html/parsoid
24889 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24890 <h2 id="Quote" data-parsoid='{}'><blockquote><p>Quote</p></blockquote></h2>
24891 !! end
24892
24893 !! test
24894 Unclosed tags in TOC
24895 !! config
24896 wgFragmentMode=[ 'html5', 'legacy' ]
24897 !! options
24898 title=[[Main Page]]
24899 !! wikitext
24900 __TOC__
24901 ==Proof: 2 < 3==
24902 <small>Hanc marginis exiguitas non caperet.</small>
24903 QED
24904 !! html/php
24905 <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>
24906 <ul>
24907 <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>
24908 </ul>
24909 </div>
24910
24911 <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>
24912 <p><small>Hanc marginis exiguitas non caperet.</small>
24913 QED
24914 </p>
24915 !! html/parsoid
24916 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24917 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24918 <p><small>Hanc marginis exiguitas non caperet.</small>
24919 QED</p>
24920 !! end
24921
24922 !! test
24923 Multiple tags in TOC
24924 !! wikitext
24925 __TOC__
24926 ==<i>Foo</i> <b>Bar</b>==
24927
24928 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24929 !! html/php
24930 <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>
24931 <ul>
24932 <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>
24933 <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>
24934 </ul>
24935 </div>
24936
24937 <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>
24938 <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>
24939 !! html/php+tidy
24940 <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>
24941 <ul>
24942 <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>
24943 <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>
24944 </ul>
24945 </div>
24946
24947 <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>
24948 <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>
24949 !! html/parsoid
24950 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24951 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
24952
24953 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote><p>Bar</p></blockquote></h2>
24954 !! end
24955
24956 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24957 # html5 tag parsing.
24958 !! test
24959 Tags with parameters in TOC
24960 !! options
24961 parsoid=wt2html
24962 !! wikitext
24963 __TOC__
24964 ==<sup class="in-h2">Hello</sup>==
24965
24966 ==<sup class="a > b">Evilbye</sup>==
24967 !! html/php
24968 <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>
24969 <ul>
24970 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24971 <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>
24972 </ul>
24973 </div>
24974
24975 <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>
24976 <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>
24977 !! html/parsoid
24978 <meta property="mw:PageProp/toc" />
24979 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
24980
24981 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
24982 !! end
24983
24984 !! test
24985 span tags with directionality in TOC
24986 !! wikitext
24987 __TOC__
24988 ==<span dir="ltr">C++</span>==
24989
24990 ==<span dir="rtl">זבנג!</span>==
24991
24992 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
24993
24994 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
24995
24996 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
24997 !! html/php
24998 <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>
24999 <ul>
25000 <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>
25001 <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>
25002 <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>
25003 <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>
25004 <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>
25005 </ul>
25006 </div>
25007
25008 <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>
25009 <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>
25010 <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>
25011 <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>
25012 <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>
25013 !! html/parsoid
25014 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25015 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
25016 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
25017 <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>
25018 <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>
25019 <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>
25020 !! end
25021
25022 !! test
25023 T74884: bdi element in ToC
25024 !! wikitext
25025 __TOC__
25026 ==<bdi>test</bdi>==
25027 !! html/php
25028 <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>
25029 <ul>
25030 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
25031 </ul>
25032 </div>
25033
25034 <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>
25035 !! html/parsoid
25036 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25037 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
25038 !! end
25039
25040 !! test
25041 T35715: s/strike element in ToC
25042 !! wikitext
25043 __TOC__
25044 ==<s>test</s> test <strike>test</strike>==
25045 !! html/php
25046 <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>
25047 <ul>
25048 <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>
25049 </ul>
25050 </div>
25051
25052 <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>
25053 !! html/parsoid
25054 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25055 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
25056 !! end
25057
25058 !! test
25059 T198618: style element in ToC
25060 !! options
25061 styletag=1
25062 !! wikitext
25063 __TOC__
25064 ==<style>.foo {}</style>Style<style>.bar {}</style>==
25065 !! html/php
25066 <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>
25067 <ul>
25068 <li class="toclevel-1 tocsection-1"><a href="#Style"><span class="tocnumber">1</span> <span class="toctext">Style</span></a></li>
25069 </ul>
25070 </div>
25071
25072 <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>
25073 !! html/parsoid
25074 <meta property="mw:PageProp/toc" data-parsoid="{}"/>
25075 <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>
25076 !! end
25077
25078 !! test
25079 T198618: script element in ToC
25080 !! options
25081 wgRawHtml=1
25082 !! wikitext
25083 __TOC__
25084 ==<html><script>alert(1);</script></html>Script<html><script>alert(1);</script></html>==
25085 !! html/php
25086 <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>
25087 <ul>
25088 <li class="toclevel-1 tocsection-1"><a href="#Script"><span class="tocnumber">1</span> <span class="toctext">Script</span></a></li>
25089 </ul>
25090 </div>
25091
25092 <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>
25093 !! html/parsoid
25094 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25095 <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>
25096 !! end
25097
25098 !! test
25099 Empty <p> tag in TOC, removed by Sanitizer (T92892)
25100 !! wikitext
25101 __TOC__
25102 ==x==
25103 !! html/php
25104 <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>
25105 <ul>
25106 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
25107 </ul>
25108 </div>
25109
25110 <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>
25111 !! html/parsoid
25112 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25113 <h2 id="x" data-parsoid='{}'>x</h2>
25114 !! end
25115
25116 !! article
25117 MediaWiki:T34057
25118 !! text
25119 == {{int:headline_sample}} ==
25120 !! endarticle
25121
25122 !! test
25123 T34057: Title needed when expanding <h> nodes.
25124 !! options
25125 title=[[Main Page]]
25126 !! wikitext
25127 {{int:T34057}}
25128 !! html
25129 <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>
25130 !! end
25131
25132 !! test
25133 Strip marker in urlencode
25134 !! wikitext
25135 {{urlencode:x<nowiki/>y}}
25136 {{urlencode:x<nowiki/>y|wiki}}
25137 {{urlencode:x<nowiki/>y|path}}
25138 {{urlencode:x<pre id="one">two</pre>y}}
25139 !! html/php
25140 <p>xy
25141 xy
25142 xy
25143 xy
25144 </p>
25145 !! end
25146
25147 !! test
25148 Strip marker in lc
25149 !! wikitext
25150 {{lc:x<nowiki/>y}}
25151 !! html
25152 <p>xy
25153 </p>
25154 !! end
25155
25156 !! test
25157 Strip marker in uc
25158 !! wikitext
25159 {{uc:x<nowiki/>y}}
25160 !! html
25161 <p>XY
25162 </p>
25163 !! end
25164
25165 !! test
25166 Strip marker in formatNum
25167 !! wikitext
25168 {{formatnum:1<nowiki/>2}}
25169 {{formatnum:1<nowiki/>2|R}}
25170 !! html
25171 <p>12
25172 12
25173 </p>
25174 !! end
25175
25176 !! test
25177 Check noCommafy in formatNum
25178 !! options
25179 language=be-tarask
25180 !! wikitext
25181 {{formatnum:123456.78}}
25182 {{formatnum:123456.78|NOSEP}}
25183 !! html
25184 <p>123 456,78
25185 123456.78
25186 </p>
25187 !! end
25188
25189 !! test
25190 Wrong option for formatNum (T58199)
25191 !! wikitext
25192 {{formatnum:1,234.56|Random}}
25193 {{formatnum:1,234.56|EVERYTHING}}
25194 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
25195 !! html
25196 <p>1,234.56
25197 1,234.56
25198 1,234.56
25199 </p>
25200 !! end
25201
25202 !! test
25203 Strip marker in grammar
25204 !! options
25205 language=fi
25206 !! wikitext
25207 {{grammar:elative|foo<nowiki/>bar}}
25208 !! html
25209 <p>foobarista
25210 </p>
25211 !! end
25212
25213 !! test
25214 Strip marker in padleft
25215 !! wikitext
25216 {{padleft:|2|x<nowiki/>y}}
25217 !! html
25218 <p>xy
25219 </p>
25220 !! end
25221
25222 !! test
25223 Strip marker in padright
25224 !! wikitext
25225 {{padright:|2|x<nowiki/>y}}
25226 !! html
25227 <p>xy
25228 </p>
25229 !! end
25230
25231 !! test
25232 Strip marker in anchorencode
25233 !! wikitext
25234 {{anchorencode:x<nowiki/>y}}
25235 !! html/php
25236 <p>xy
25237 </p>
25238 !! html/parsoid
25239 <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>
25240 !! end
25241
25242 !! test
25243 nowiki inside link inside heading (T20295)
25244 !! wikitext
25245 ==[[foo|x<nowiki>y</nowiki>z]]==
25246 !! html
25247 <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>
25248 !! end
25249
25250 !! test
25251 new support for bdi element (T33817)
25252 !! wikitext
25253 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25254 !! html
25255 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25256 !! end
25257
25258 !! test
25259 Ignore pipe between table row attributes
25260 !! wikitext
25261 {|
25262 |quux
25263 |- id=foo | style='color: red'
25264 |bar
25265 |}
25266 !! html
25267 <table>
25268 <tr>
25269 <td>quux
25270 </td></tr>
25271 <tr id="foo" style="color: red">
25272 <td>bar
25273 </td></tr></table>
25274 !! end
25275
25276 !!test
25277 Language parser function
25278 !! wikitext
25279 {{#language:ar}}
25280 !! html
25281 <p>العربية
25282 </p>
25283 !! end
25284
25285 !!test
25286 Padleft and padright (default 0-padding)
25287 !! wikitext
25288 {{padleft:xyz|5}}
25289 {{padright:xyz|5}}
25290 !! html/php
25291 <p>00xyz
25292 xyz00
25293 </p>
25294 !! html/parsoid
25295 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
25296 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
25297 !! end
25298
25299 !!test
25300 Padleft and padright (partial fill)
25301 !! wikitext
25302 {{padleft:xyz|6|ab}}
25303 {{padright:xyz|6|ab}}
25304 !! html/php
25305 <p>abaxyz
25306 xyzaba
25307 </p>
25308 !! html/parsoid
25309 <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>
25310 <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>
25311 !! end
25312
25313 !!test
25314 Padleft and padright as substr
25315 !! wikitext
25316 {{padleft:|3|abcde}}
25317 {{padright:|3|abcde}}
25318 !! html/php
25319 <p>abc
25320 abc
25321 </p>
25322 !! html/parsoid
25323 <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>
25324 <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>
25325 !! end
25326
25327 !! test
25328 Padleft and padright with non-numerical length (T180403)
25329 !! wikitext
25330 {{padleft:abcdef|junk}}
25331 {{padright:abcdef|junk}}
25332 !! html/php
25333 <p>abcdef
25334 abcdef
25335 </p>
25336 !! end
25337
25338 !!test
25339 Special parser function
25340 !! wikitext
25341 {{#special:RandomPage}}
25342 {{#special:BaDtItLe}}
25343 {{#special:Foobar}}
25344 !! html
25345 <p>Special:Random
25346 Special:Badtitle
25347 Special:Foobar
25348 </p>
25349 !! end
25350
25351 !!test
25352 T36939 - Case insensitive link parsing ([HttP://])
25353 !! wikitext
25354 [HttP://MediaWiki.Org/]
25355 !! html/php
25356 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
25357 </p>
25358 !! html/parsoid
25359 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
25360 !! end
25361
25362 !!test
25363 T36939 - Case insensitive link parsing ([HttP:// title])
25364 !! wikitext
25365 [HttP://MediaWiki.Org/ MediaWiki]
25366 !! html
25367 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
25368 </p>
25369 !! end
25370
25371 !!test
25372 T36939 - Case insensitive link parsing (HttP://)
25373 !! wikitext
25374 HttP://MediaWiki.Org/
25375 !! html/php
25376 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
25377 </p>
25378 !! html/parsoid
25379 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
25380 !! end
25381
25382 !!test
25383 Disable TOC
25384 !! options
25385 notoc
25386 !! wikitext
25387 Lead
25388 ==Section 1==
25389 ==Section 2==
25390 ==Section 3==
25391 ==Section 4==
25392 ==Section 5==
25393 !! html
25394 <p>Lead
25395 </p>
25396
25397 <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>
25398 <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>
25399 <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>
25400 <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>
25401 <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>
25402 !! end
25403
25404
25405 ###
25406 ### Parsoid-specific tests
25407 ### Parsoid-PHP parser incompatibilities
25408 ###
25409 !!test
25410 1. SOL-sensitive wikitext tokens as template-args
25411 !! options
25412 parsoid=wt2html,wt2wt
25413 !! wikitext
25414 {{echo|*a}}
25415 {{echo|#a}}
25416 {{echo|:a}}
25417 !! html/php+tidy
25418 <ul><li>a</li></ul>
25419 <ol><li>a</li></ol>
25420 <dl><dd>a</dd></dl>
25421 !! html/parsoid
25422 <span about="#mwt1" typeof="mw:Transclusion">
25423 </span><ul about="#mwt1"><li>a</li>
25424 </ul>
25425 <span about="#mwt2" typeof="mw:Transclusion">
25426 </span><ol about="#mwt2"><li>a</li>
25427 </ol>
25428 <span about="#mwt3" typeof="mw:Transclusion">
25429 </span><dl about="#mwt3"><dd>a</dd>
25430 </dl>
25431 !!end
25432
25433 #### -----------------------------------------------------------------
25434 #### Parsoid-specific functionality tests
25435 #### -----------------------------------------------------------------
25436
25437 # T65642/T68749: Formatting elt fixup around images.
25438 # We know wt2wt will fail, but we expect selser to pass.
25439 # Due to the nature of our testing, wt2wt and selser tests will enter the
25440 # blacklist and we'll catch selser regressions based on changes to the
25441 # blacklist entries for selser tests.
25442 !! test
25443 1. Treebuilder fixup of formatting elt
25444 !! options
25445 parsoid=wt2html,wt2wt
25446 !! wikitext
25447 {|
25448 |
25449 <small>
25450 [[Image:Foobar.jpg|right|Test]]
25451 </small>
25452 |}
25453 !! html/php+tidy
25454 <table>
25455 <tbody><tr>
25456 <td>
25457 <p><small>
25458 </small></p><small>
25459 <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>
25460 </small><p><small></small>
25461 </p>
25462 </td></tr></tbody></table>
25463 !! html/parsoid
25464 <table>
25465 <tbody><tr><td>
25466 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
25467 <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>
25468 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p></td></tr>
25469 </tbody></table>
25470 !! end
25471
25472 !! test
25473 2. Treebuilder fixup of formatting elt
25474 !! options
25475 parsoid=wt2html,wt2wt
25476 !! wikitext
25477 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
25478
25479 <small>[[Image:Foobar.jpg|right|300px]]</small>
25480 !! html/php+tidy
25481 <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>
25482 </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>
25483 !! html/parsoid
25484 <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>
25485
25486 <small><figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure></small>
25487 !! end
25488
25489 !! test
25490 3. Treebuilder fixup of formatting elt
25491 !! options
25492 parsoid=wt2html,wt2wt
25493 !! wikitext
25494 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
25495 !! html/php+tidy
25496 <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>
25497 !! html/parsoid
25498 <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>
25499 !! end
25500
25501 !! test
25502 4. Treebuilder fixup of formatting elt: formatting tags around captionless images
25503 !! options
25504 parsoid=wt2html,wt2wt
25505 !! wikitext
25506 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
25507 !! html/php+tidy
25508 <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>
25509 !! html/parsoid
25510 <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></figure></small></b>
25511 !! end
25512
25513 #### ----------------------------------------------------------------
25514 #### Parsoid-only testing of Parsoid's impl of LST
25515 #### Not implemented yet, see
25516 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
25517 #### ----------------------------------------------------------------
25518
25519 ## We still need to support serializing the older format while content is stored.
25520 !! test
25521 LST Sections: Backwards compatibility
25522 !! options
25523 parsoid={
25524 "suppressErrors": true,
25525 "modes": ["html2wt"]
25526 }
25527 !! wikitext
25528 <section begin="2011-05-16" />
25529 <section end="2014-04-10 (MW 1.23wmf22)" />
25530 !! html/parsoid
25531 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
25532 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
25533 !! end
25534
25535 !! test
25536 LST Sections: Newfangled approach
25537 !! wikitext
25538 <section begin="2011-05-16" />
25539 <section end="2014-04-10 (MW 1.23wmf22)" />
25540 !! html/parsoid
25541 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"}}'>
25542 </span>
25543 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"}}'>
25544 </span></p>
25545 !! end
25546
25547 #--------- Test stripping of empty nodes in template content ----------
25548
25549 !! test
25550 Empty LI and TR nodes should be stripped from template content
25551 !! wikitext
25552 {{EmptyLITest}}
25553 {{EmptyTRTest}}
25554 !! html/parsoid
25555 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
25556 <li>a</li>
25557 <li>b</li>
25558 </ul>
25559 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
25560 <tbody>
25561 <tr>
25562 <td>foo</td>
25563 </tr>
25564 <tr>
25565 <td>bar</td>
25566 </tr>
25567 </tbody>
25568 </table>
25569 !! end
25570
25571 !! test
25572 Empty LI and TR nodes should not be stripped from top-level content
25573 !! wikitext
25574 *a
25575 *
25576 *b
25577
25578 {|
25579 |-
25580 |-
25581 |foo
25582 |}
25583 !! html/parsoid
25584 <ul>
25585 <li>a</li>
25586 <li class='mw-empty-elt'></li>
25587 <li>b</li>
25588 </ul>
25589 <table>
25590 <tbody>
25591 <tr class='mw-empty-elt'></tr>
25592 <tr>
25593 <td>foo</td>
25594 </tr>
25595 </tbody>
25596 </table>
25597 !! end
25598
25599 !! test
25600 Empty TR nodes should not be stripped if they have any attributes set
25601 !! wikitext
25602 {{EmptyTRWithHTMLAttrTest}}
25603 !! html/parsoid
25604 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
25605 <tr align='center'></tr>
25606 <tr><td>foo</td></tr>
25607 <tr align='center'></tr>
25608 <tr><td>bar</td></tr>
25609 </table>
25610 !! end
25611
25612 #### ----------------------------------------------------------------
25613 #### The following section of tests are primarily to test
25614 #### wikitext escaping capabilities of Parsoid. Given that
25615 #### escaping can be done any number of ways, the wikitext (input)
25616 #### is always adjusted to reflect how Parsoid adds nowiki
25617 #### escape tags.
25618 ####
25619 #### We are marking several tests as parsoid-only since the
25620 #### HTML in the result section is different from what the
25621 #### PHP parser generates for it.
25622 #### ----------------------------------------------------------------
25623
25624
25625 #### --------------- Headings ---------------
25626 #### 0. Unnested
25627 #### 1. Nested inside html <h1>=foo=</h1>
25628 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
25629 #### 3. Nested inside html with wikitext split by html tags
25630 #### 4. No escape needed
25631 #### 5. Empty headings <h1></h1>
25632 #### 6. Heading chars in SOL context
25633 #### ----------------------------------------
25634 !! test
25635 Headings: 0. Unnested
25636 !! options
25637 parsoid=html2wt
25638 !! html/parsoid
25639 <p>=foo=</p>
25640
25641 <p> =foo=
25642 <!--cmt-->
25643 =foo=</p>
25644
25645 <p>=foo<i>a</i>=</p>
25646 !! wikitext
25647 <nowiki>=foo=</nowiki>
25648
25649 <nowiki> </nowiki>=foo=
25650 <!--cmt-->
25651 <nowiki>=foo=</nowiki>
25652
25653 =foo''a''<nowiki>=</nowiki>
25654 !!end
25655
25656 # New headings and existing headings are handled differently
25657 !! test
25658 Headings: 1. Nested inside html
25659 !! options
25660 parsoid=html2wt
25661 !! html/parsoid
25662 <h1>=foo=</h1>
25663 <h2>=foo=</h2>
25664 <h3>=foo=</h3>
25665
25666 <h1 data-parsoid=''>=foo=</h1>
25667 <h2 data-parsoid=''>=foo=</h2>
25668 <h3 data-parsoid=''>=foo=</h3>
25669 <h4 data-parsoid=''>=foo=</h4>
25670 <h5 data-parsoid=''>=foo=</h5>
25671 <h6 data-parsoid=''>=foo=</h6>
25672 !! wikitext
25673 = =foo= =
25674
25675 == =foo= ==
25676
25677 === =foo= ===
25678
25679 =<nowiki>=foo=</nowiki>=
25680 ==<nowiki>=foo=</nowiki>==
25681 ===<nowiki>=foo=</nowiki>===
25682 ====<nowiki>=foo=</nowiki>====
25683 =====<nowiki>=foo=</nowiki>=====
25684 ======<nowiki>=foo=</nowiki>======
25685 !! end
25686
25687 !! test
25688 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
25689 !! options
25690 parsoid=html2wt
25691 !! html/parsoid
25692 <h1>foo</h1>*bar
25693 <h1>foo</h1>=bar
25694 <h1>foo</h1>=bar=
25695 !! wikitext
25696 = foo =
25697 <nowiki>*</nowiki>bar
25698
25699 = foo =
25700 =bar
25701
25702 = foo =
25703 <nowiki>=bar=</nowiki>
25704 !!end
25705
25706 !! test
25707 Headings: 3. Nested inside html with wikitext split by html tags
25708 !! options
25709 parsoid=html2wt
25710 !! html/parsoid
25711 <h1>=<b>bold</b>foo=</h1>
25712 !! wikitext
25713 = ='''bold'''foo= =
25714 !!end
25715
25716 !! test
25717 Headings: 4a. No escaping needed (testing just h1 and h2)
25718 !! options
25719 parsoid=html2wt
25720 !! html/parsoid
25721 <h1>=foo</h1>
25722 <h1>foo=</h1>
25723 <h1> =foo= </h1>
25724 <h1>=foo= bar</h1>
25725 <h2>=foo</h2>
25726 <h2>foo=</h2>
25727 <h1>=</h1>
25728 <h1><i>=</i>foo=</h1>
25729 !! wikitext
25730 = =foo =
25731
25732 = foo= =
25733
25734 = =foo= =
25735
25736 = =foo= bar =
25737
25738 == =foo ==
25739
25740 == foo= ==
25741
25742 = = =
25743
25744 = ''=''foo= =
25745 !!end
25746
25747 !! test
25748 Headings: 4b. No escaping needed (inside p-tags)
25749 !! options
25750 parsoid=html2wt
25751 !! html/parsoid
25752 <p>=foo= x
25753 =foo= <s></s>
25754 </p>
25755 !! wikitext
25756 =foo= x
25757 =foo= <s></s>
25758 !! html/php
25759 <p>=foo= x
25760 =foo= <s></s>
25761 </p>
25762 !!end
25763
25764 !! test
25765 Headings: 4c. Short headings (1)
25766 !! options
25767 parsoid=html2wt
25768 !! html/parsoid
25769 <p>===
25770 </p>
25771 !! wikitext
25772 <nowiki>===</nowiki>
25773 !! html/php
25774 <p>===
25775 </p>
25776 !! end
25777
25778 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
25779 !! test
25780 Headings: 4d. Short headings (2)
25781 !! options
25782 parsoid=wt2html,html2html
25783 !! wikitext
25784 =
25785 ==
25786 ===
25787 ====
25788 =====
25789 !! html/php
25790 <p>=
25791 ==
25792 </p>
25793 <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>
25794 <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>
25795 <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>
25796 !! html/parsoid
25797 <p>=
25798 ==</p>
25799 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
25800 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
25801 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
25802 !! end
25803
25804 !! test
25805 Headings: 5. Empty headings
25806 !! options
25807 parsoid=html2wt
25808 !! html/parsoid
25809 <h1 data-parsoid='{}'></h1>
25810
25811 <h2 data-parsoid='{}'></h2>
25812
25813 <h3 data-parsoid='{}'></h3>
25814
25815 <h4 data-parsoid='{}'></h4>
25816
25817 <h5 data-parsoid='{}'></h5>
25818
25819 <h6 data-parsoid='{}'></h6>
25820 !! wikitext
25821 =<nowiki/>=
25822
25823 ==<nowiki/>==
25824
25825 ===<nowiki/>===
25826
25827 ====<nowiki/>====
25828
25829 =====<nowiki/>=====
25830
25831 ======<nowiki/>======
25832 !!end
25833
25834 !! test
25835 Headings: 6a. Heading chars in SOL context (with trailing spaces)
25836 !! options
25837 parsoid=html2wt
25838 !! html/parsoid
25839 <p>=a=</p>
25840
25841 <p>=a=</p>
25842
25843 <p>=a=</p>
25844 !! wikitext
25845 <nowiki>=a=</nowiki>
25846
25847 <nowiki>=a=</nowiki>
25848
25849 <nowiki>=a=</nowiki>
25850 !!end
25851
25852 !! test
25853 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25854 !! options
25855 parsoid=html2wt
25856 !! html/parsoid
25857 <p>=a=
25858 b</p>
25859
25860 <p>=a=
25861 b</p>
25862
25863 <p>=a=
25864 b</p>
25865 !! wikitext
25866 <nowiki>=a=</nowiki>
25867 b
25868
25869 <nowiki>=a=</nowiki>
25870 b
25871
25872 <nowiki>=a=</nowiki>
25873 b
25874 !!end
25875
25876 !! test
25877 Headings: 6c. Heading chars in SOL context (leading newline break)
25878 !! options
25879 parsoid=html2wt
25880 !! html/parsoid
25881 <p>a
25882 =b=</p>
25883 !! wikitext
25884 a
25885 <nowiki>=b=</nowiki>
25886 !!end
25887
25888 !! test
25889 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25890 !! options
25891 parsoid=html2wt
25892 !! html/parsoid
25893 <!--c0--><p>=a=</p>
25894
25895 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25896 !! wikitext
25897 <!--c0--><nowiki>=a=</nowiki>
25898
25899 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25900 !!end
25901
25902 !! test
25903 Headings: 6d. Heading chars in SOL context (No escaping needed)
25904 !! options
25905 parsoid=html2wt
25906 !! html/parsoid
25907 =a=<div>b</div>
25908 !! wikitext
25909 =a=<div>b</div>
25910 !!end
25911
25912 !! test
25913 Headings: 7. Insert a newline between new content and headings
25914 !! options
25915 parsoid=html2wt
25916 !! html/parsoid
25917 <h2>NEW</h2>
25918 <p>new</p>
25919 <h2 data-parsoid='{}'>A</h2>
25920 <p data-parsoid='{}'>a</p>
25921 !! wikitext
25922 == NEW ==
25923 new
25924
25925 ==A==
25926 a
25927 !! end
25928
25929 !! test
25930 Headings: Used as horizontal rule
25931 !! config
25932 wgFragmentMode=[ 'html5', 'legacy' ]
25933 !! options
25934 parsoid=wt2html
25935 !! wikitext
25936 ===============
25937 !! html/php
25938 <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>
25939 !! html/parsoid
25940 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25941 !! end
25942
25943 #### --------------- Lists ---------------
25944 #### 0. Outside nests (*foo, etc.)
25945 #### 1. Nested inside html <ul><li>*foo</li></ul>
25946 #### 2. Inside definition lists
25947 #### 3. Only bullets at start should be escaped
25948 #### 4. No escapes needed
25949 #### 5. No unnecessary escapes
25950 #### 6. Escape bullets in SOL position
25951 #### 7. Escape bullets in a multi-line context
25952 #### ----------------------------------------
25953
25954 !! test
25955 Lists: 0. Outside nests
25956 !! options
25957 parsoid=html2wt
25958 !! html/parsoid
25959 <p>*foo</p>
25960
25961 <p>#foo</p>
25962
25963 <p>;Foo:bar</p>
25964 !! wikitext
25965 <nowiki>*</nowiki>foo
25966
25967 <nowiki>#</nowiki>foo
25968
25969 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25970 !!end
25971
25972 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25973 ## to test wikitext escaping, and insignificant whitespace diffs
25974 ## cause PHP parser tests to barf
25975 !! test
25976 Lists: 1. Nested inside html (No unnecessary escapes)
25977 !! options
25978 parsoid=html2wt
25979 !! html/parsoid
25980 <ul>
25981 <li>*foo</li>
25982 <li>#foo</li>
25983 <li>:foo</li>
25984 <li>;foo</li>
25985 <li data-parsoid='{}'>*foo</li>
25986 <li data-parsoid='{}'>#foo</li>
25987 <li data-parsoid='{}'>:foo</li>
25988 <li data-parsoid='{}'>;foo</li>
25989 </ul>
25990
25991 <ol>
25992 <li>*foo</li>
25993 <li>#foo</li>
25994 <li>:foo</li>
25995 <li>;foo</li>
25996 <li data-parsoid='{}'>*foo</li>
25997 <li data-parsoid='{}'>#foo</li>
25998 <li data-parsoid='{}'>:foo</li>
25999 <li data-parsoid='{}'>;foo</li>
26000 </ol>
26001 !! wikitext
26002 * *foo
26003 * #foo
26004 * :foo
26005 * ;foo
26006 *<nowiki>*foo</nowiki>
26007 *<nowiki>#foo</nowiki>
26008 *<nowiki>:foo</nowiki>
26009 *<nowiki>;foo</nowiki>
26010
26011 # *foo
26012 # #foo
26013 # :foo
26014 # ;foo
26015 #<nowiki>*foo</nowiki>
26016 #<nowiki>#foo</nowiki>
26017 #<nowiki>:foo</nowiki>
26018 #<nowiki>;foo</nowiki>
26019 !!end
26020
26021 !! test
26022 Lists: 2. Inside definition lists
26023 !! options
26024 parsoid=html2wt
26025 !! html/parsoid
26026 <dl><dt>;foo</dt></dl>
26027 <dl><dt>:foo</dt></dl>
26028 <dl><dt>:foo</dt>
26029 <dd>bar</dd></dl>
26030 <dl><dd>:foo</dd></dl>
26031 !! wikitext
26032 ; ;foo
26033
26034 ; <nowiki>:foo</nowiki>
26035
26036 ; <nowiki>:foo</nowiki>
26037 : bar
26038
26039 : :foo
26040 !!end
26041
26042 !! test
26043 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
26044 !! options
26045 parsoid=html2wt
26046 !! html/parsoid
26047 <ul>
26048 <li>*foo*bar</li>
26049 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
26050 </ul>
26051 !! wikitext
26052 * *foo*bar
26053 *<nowiki>*foo</nowiki>''it''*bar
26054 !!end
26055
26056 !! test
26057 Lists: 4. No escapes needed
26058 !! options
26059 parsoid=html2wt
26060 !! html/parsoid
26061 <ul>
26062 <li>foo*bar
26063 </li>
26064 </ul>
26065 <ul>
26066 <li><i>foo</i>*bar
26067 </li>
26068 </ul>
26069 <ul>
26070 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
26071 </li>
26072 </ul>
26073 <ul>
26074 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
26075 </li>
26076 </ul>
26077 !! wikitext
26078 *foo*bar
26079
26080 *''foo''*bar
26081
26082 *[[Foo]]: bar
26083
26084 *[[Foo]]*bar
26085 !!end
26086
26087 !! test
26088 Lists: 5. No unnecessary escapes
26089 !! options
26090 parsoid=html2wt
26091 !! html/parsoid
26092 <ul><li> bar <span>[[foo]]</span></li></ul>
26093 <ul><li> =bar <span>[[foo]]</span></li></ul>
26094 <ul><li> [[bar <span>[[foo]]</span></li></ul>
26095 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
26096 <ul><li> =bar <span>foo]]</span>=</li></ul>
26097 <ul><li> <s></s>: a</li></ul>
26098 <ul><li> <i>* foo</i></li></ul>
26099
26100 !! wikitext
26101 * bar <span><nowiki>[[foo]]</nowiki></span>
26102
26103 * =bar <span><nowiki>[[foo]]</nowiki></span>
26104
26105 * [[bar <span><nowiki>[[foo]]</nowiki></span>
26106
26107 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
26108
26109 * =bar <span>foo]]</span>=
26110
26111 * <s></s>: a
26112
26113 * ''* foo''
26114 !!end
26115
26116 !! test
26117 Lists: 6. Escape bullets in SOL position
26118 !! options
26119 parsoid=html2wt
26120 !! html/parsoid
26121 <p><!--cmt-->*foo</p>
26122 !! wikitext
26123 <!--cmt--><nowiki>*</nowiki>foo
26124 !!end
26125
26126 !! test
26127 Lists: 7. Escape bullets in a multi-line context
26128 !! options
26129 parsoid=html2wt
26130 !! html/parsoid
26131 <p>a
26132 *b
26133 </p>
26134 !! wikitext
26135 a
26136 <nowiki>*</nowiki>b
26137 !!end
26138
26139 !! test
26140 Lists: 8. Escape colons only if not present in tags
26141 !! options
26142 parsoid=html2wt
26143 !! html/parsoid
26144 <dl><dt>a:b<i>c:d</i></dt></dl>
26145 !! wikitext
26146 ; <nowiki>a:b</nowiki>''c:d''
26147 !! end
26148
26149 #### --------------- HRs ---------------
26150 #### 1. Single line
26151 #### -----------------------------------
26152
26153 !! test
26154 HRs: 1. Single line
26155 !! options
26156 parsoid=html2wt
26157 !! html/parsoid
26158 <hr />----
26159 <hr />=foo=
26160 <hr />*foo
26161 !! wikitext
26162 ----<nowiki>----</nowiki>
26163 ----=foo=
26164 ----*foo
26165 !! end
26166
26167 #### --------------- Tables ---------------
26168 #### 1a. Simple example
26169 #### 1b. No escaping needed (!foo)
26170 #### 1c. No escaping needed (|foo)
26171 #### 1d. No escaping needed (|}foo)
26172 ####
26173 #### 2a. Nested in td (<td>foo|bar</td>)
26174 #### 2b. Nested in td (<td>foo||bar</td>)
26175 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
26176 ####
26177 #### 3a. Nested in th (<th>foo!bar</th>)
26178 #### 3b. Nested in th (<th>foo!!bar</th>)
26179 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
26180 ####
26181 #### 4a. Escape -
26182 #### 4b. Escape +
26183 #### 4c. No escaping needed
26184 #### --------------------------------------
26185
26186 !! test
26187 Tables: 1a. Simple example
26188 !! options
26189 parsoid=html2wt
26190 !! html/parsoid
26191 <p>{|
26192 |}
26193 </p>
26194 !! wikitext
26195 <nowiki>{|</nowiki>
26196 |}
26197 !! end
26198
26199 !! test
26200 Tables: 1b. No escaping needed
26201 !! options
26202 parsoid=html2wt
26203 !! html/parsoid
26204 <p>!foo
26205 </p>
26206 !! wikitext
26207 !foo
26208 !! end
26209
26210 !! test
26211 Tables: 1c. No escaping needed
26212 !! options
26213 parsoid=html2wt
26214 !! html/parsoid
26215 <p>|foo
26216 </p>
26217 !! wikitext
26218 |foo
26219 !! end
26220
26221 !! test
26222 Tables: 1d. No escaping needed
26223 !! options
26224 parsoid=html2wt
26225 !! html/parsoid
26226 <p>|}foo
26227 </p>
26228 !! wikitext
26229 |}foo
26230 !! end
26231
26232 !! test
26233 Tables: 2a. Nested in td
26234 !! options
26235 parsoid=html2wt
26236 !! html/parsoid
26237 <table><tbody><tr>
26238 <td>foo|bar</td></tr>
26239 <tr><td>x<div>a|b</div></td>
26240 </tbody></table>
26241 !! wikitext
26242 {|
26243 |<nowiki>foo|bar</nowiki>
26244 |-
26245 |x<div><nowiki>a|b</nowiki></div>
26246 |}
26247 !! html/php+tidy
26248 <table>
26249 <tbody><tr>
26250 <td>foo|bar
26251 </td></tr>
26252 <tr>
26253 <td>x<div>a|b</div>
26254 </td></tr></tbody></table>
26255 !! end
26256
26257 !! test
26258 Tables: 2b. Nested in td
26259 !! options
26260 parsoid=html2wt
26261 !! html/parsoid
26262 <table><tbody><tr>
26263 <td>foo||bar</td>
26264 <td>a<i>b||c</i></td>
26265 <td>a<i><div>b||c</div></i></td>
26266 </tr></tbody></table>
26267 !! wikitext
26268 {|
26269 |<nowiki>foo||bar</nowiki>
26270 |a''<nowiki>b||c</nowiki>''
26271 |a''<div><nowiki>b||c</nowiki></div>''
26272 |}
26273 !! html/php
26274 <table>
26275 <tr>
26276 <td>foo||bar
26277 </td>
26278 <td>a<i>b||c</i>
26279 </td>
26280 <td>a<i><div>b||c</div></i>
26281 </td></tr></table>
26282 !! end
26283
26284 !! test
26285 Tables: 2c. Nested in td -- no escaping needed
26286 !! options
26287 parsoid=html2wt
26288 !! html/*
26289 <table>
26290 <tr>
26291 <td>foo!!bar
26292 </td></tr></table>
26293 !! wikitext
26294 {|
26295 |foo!!bar
26296 |}
26297 !! end
26298
26299 !! test
26300 Tables: 3a. Nested in th
26301 !! options
26302 parsoid=html2wt
26303 !! html/*
26304 <table>
26305 <tr>
26306 <th>foo!bar
26307 </th></tr></table>
26308 !! wikitext
26309 {|
26310 !foo!bar
26311 |}
26312 !! end
26313
26314 !! test
26315 Tables: 3b. Nested in th
26316 !! options
26317 parsoid=html2wt
26318 !! html/parsoid
26319 <table><tbody>
26320 <tr><th>foo!!bar</th>
26321 <th><i>foo|bar</i></th>
26322 <th><i>foo!!bar</i></th>
26323 <th><i><span>foo!!bar</span></i></th>
26324 </tr></tbody></table>
26325 !! wikitext
26326 {|
26327 !<nowiki>foo!!bar</nowiki>
26328 !''<nowiki>foo|bar</nowiki>''
26329 !''<nowiki>foo!!bar</nowiki>''
26330 !''<span><nowiki>foo!!bar</nowiki></span>''
26331 |}
26332 !! html/php
26333 <table>
26334 <tr>
26335 <th>foo!!bar
26336 </th>
26337 <th><i>foo|bar</i>
26338 </th>
26339 <th><i>foo!!bar</i>
26340 </th>
26341 <th><i><span>foo!!bar</span></i>
26342 </th></tr></table>
26343 !! end
26344
26345 !! test
26346 Tables: 3c. Nested in th
26347 !! options
26348 parsoid=html2wt
26349 !! html/parsoid
26350 <table><tbody>
26351 <tr><th>foo||bar</th>
26352 <th><span typeof="mw:Nowiki">foo||bar</span></th>
26353 </tr></tbody></table>
26354 !! wikitext
26355 {|
26356 !<nowiki>foo||bar</nowiki>
26357 !<nowiki>foo||bar</nowiki>
26358 |}
26359 !! html/php
26360 <table>
26361 <tr>
26362 <th>foo||bar
26363 </th>
26364 <th>foo||bar
26365 </th></tr></table>
26366 !! end
26367
26368 !! test
26369 Tables: 4a. Escape -
26370 !! options
26371 parsoid=html2wt
26372 !! html/*
26373 <table>
26374 <tr>
26375 <th>-bar
26376 </th></tr>
26377 <tr>
26378 <td>-bar
26379 </td></tr></table>
26380 !! wikitext
26381 {|
26382 !-bar
26383 |-
26384 |<nowiki>-bar</nowiki>
26385 |}
26386 !! end
26387
26388 !! test
26389 Tables: 4b. Escape +
26390 !! options
26391 parsoid=html2wt
26392 !! html/*
26393 <table>
26394 <tr>
26395 <th>+bar
26396 </th></tr>
26397 <tr>
26398 <td>+bar
26399 </td></tr></table>
26400 !! wikitext
26401 {|
26402 !+bar
26403 |-
26404 |<nowiki>+bar</nowiki>
26405 |}
26406 !! end
26407
26408 !! test
26409 Tables: 4c. No escaping needed
26410 !! options
26411 parsoid=html2wt
26412 !! html/parsoid
26413 <table><tbody>
26414 <tr><td>foo-bar</td><td>foo+bar</td></tr>
26415 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
26416 <tr><td>foo
26417 <p>bar|baz
26418 +bar
26419 -bar</p></td></tr>
26420 <tr><td>x
26421 <div>a|b</div></td>
26422 </tbody></table>
26423 !! wikitext
26424 {|
26425 |foo-bar
26426 |foo+bar
26427 |-
26428 |''foo''-bar
26429 |''foo''+bar
26430 |-
26431 |foo
26432 bar|baz
26433 +bar
26434 -bar
26435 |-
26436 |x
26437 <div>a|b</div>
26438 |}
26439 !! html/php
26440 <table>
26441 <tr>
26442 <td>foo-bar
26443 </td>
26444 <td>foo+bar
26445 </td></tr>
26446 <tr>
26447 <td><i>foo</i>-bar
26448 </td>
26449 <td><i>foo</i>+bar
26450 </td></tr>
26451 <tr>
26452 <td>foo
26453 <p>bar|baz
26454 +bar
26455 -bar
26456 </p>
26457 </td></tr>
26458 <tr>
26459 <td>x
26460 <div>a|b</div>
26461 </td></tr></table>
26462 !! end
26463
26464 !! test
26465 Tables: 4d. No escaping needed
26466 !! options
26467 parsoid=html2wt
26468 !! html/parsoid
26469 <table>
26470 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
26471 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
26472 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
26473 </tbody></table>
26474 !! wikitext
26475 {|
26476 |[[Foo]]-bar
26477 ||+1
26478 ||-2
26479 |}
26480 !! html/php
26481 <table>
26482 <tr>
26483 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
26484 </td>
26485 <td>+1
26486 </td>
26487 <td>-2
26488 </td></tr></table>
26489 !! end
26490
26491 !! test
26492 Tables: 4e. Escape }
26493 !! options
26494 parsoid=html2wt
26495 !! html/parsoid
26496 <table>
26497 <tr><td>}</td></tr>
26498 <tr><td>x</td><td data-parsoid='{"stx":"row"}'>}</td></tr></table>
26499 </table>
26500 !! wikitext
26501 {|
26502 |<nowiki>}</nowiki>
26503 |-
26504 |x||}
26505 |}
26506 !! html/php
26507 <table>
26508 <tr>
26509 <td>}
26510 </td></tr>
26511 <tr>
26512 <td>x</td>
26513 <td>}
26514 </td></tr></table>
26515 !! end
26516
26517 !! test
26518 Tables: 5. Empty table cells should get whitespace to avoid need for nowikis
26519 !! options
26520 parsoid=html2wt
26521 !! html/parsoid
26522 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26523
26524 <table><tr><td></td><td align="center"></td><td></td></tr></table>
26525
26526 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26527
26528 <table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table>
26529 !! wikitext
26530 {|
26531 | || align="center" | ||
26532 |}
26533
26534 {|
26535 |
26536 | align="center" |
26537 |
26538 |}
26539
26540 {|
26541 | {{!}}{{!}} align="center" | ||
26542 |}
26543
26544 {|
26545 ! !! align="center" | !!
26546 |}
26547 !! html/php+tidy
26548 <table>
26549 <tbody><tr>
26550 <td></td>
26551 <td align="center"></td>
26552 <td>
26553 </td></tr></tbody></table>
26554 <table>
26555 <tbody><tr>
26556 <td>
26557 </td>
26558 <td align="center">
26559 </td>
26560 <td>
26561 </td></tr></tbody></table>
26562 <table>
26563 <tbody><tr>
26564 <td></td>
26565 <td align="center"></td>
26566 <td>
26567 </td></tr></tbody></table>
26568 <table>
26569 <tbody><tr>
26570 <th></th>
26571 <th align="center"></th>
26572 <th>
26573 </th></tr></tbody></table>
26574 !! end
26575
26576 !! test
26577 T97430: Don't emit empty nowiki pairs around marker meta tags
26578 !! options
26579 parsoid=html2wt
26580 !! html/parsoid
26581 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26582 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
26583 !! wikitext
26584 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26585 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
26586 !! end
26587
26588 !! test
26589 Unclosed xmlish element in table line shouldn't eat end delimiters
26590 !! options
26591 parsoid=html2wt
26592 !! html/parsoid
26593 <table>
26594 <tbody><tr><td> &lt;foo</td>
26595 <td> bar></td></tr>
26596 </tbody></table>
26597 !! wikitext
26598 {|
26599 | <foo
26600 | bar>
26601 |}
26602 !! html/php
26603 <table>
26604 <tr>
26605 <td>&lt;foo
26606 </td>
26607 <td>bar&gt;
26608 </td></tr></table>
26609 !! end
26610
26611 #### --------------- Links ----------------
26612 #### 1. Quote marks in link text
26613 #### 2. Wikilinks: Escapes needed
26614 #### 3. Wikilinks: No escapes needed
26615 #### 4. Extlinks: Escapes needed
26616 #### 5. Extlinks: No escapes needed
26617 #### --------------------------------------
26618 !! test
26619 Links 1. WikiLinks: No escapes needed
26620 !! options
26621 parsoid=html2wt
26622 !! html/parsoid
26623 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
26624 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
26625 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
26626 !! wikitext
26627 [[Foo|Foo''boo'']]
26628 [[Foo|[Foobar]]]
26629 [[Foo|x [Foobar] x]]
26630 !! html/php
26631 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
26632 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
26633 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
26634 </p>
26635 !! end
26636
26637 !! test
26638 Links 2. WikiLinks: Escapes needed
26639 !! options
26640 parsoid=html2wt
26641 !! html/parsoid
26642 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
26643 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
26644 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
26645 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
26646 <a href="Foo" rel="mw:WikiLink">|Bar</a>
26647 <a href="Foo" rel="mw:WikiLink">]]bar</a>
26648 <a href="Foo" rel="mw:WikiLink">[[bar</a>
26649 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
26650 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
26651 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
26652 !! wikitext
26653 [[Foo|<nowiki>Foobar]</nowiki>]]
26654 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
26655 [[Foo|<nowiki>[[Bar]]</nowiki>]]
26656 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
26657 [[Foo|<nowiki>|Bar</nowiki>]]
26658 [[Foo|<nowiki>]]bar</nowiki>]]
26659 [[Foo|<nowiki>[[bar</nowiki>]]
26660 [[Foo|<nowiki>x [[ y</nowiki>]]
26661 [[Foo|<nowiki>x ]] y</nowiki>]]
26662 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
26663 !! html/php
26664 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
26665 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
26666 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
26667 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
26668 <a href="/wiki/Foo" title="Foo">|Bar</a>
26669 <a href="/wiki/Foo" title="Foo">]]bar</a>
26670 <a href="/wiki/Foo" title="Foo">[[bar</a>
26671 <a href="/wiki/Foo" title="Foo">x [[ y</a>
26672 <a href="/wiki/Foo" title="Foo">x ]] y</a>
26673 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
26674 </p>
26675 !! end
26676
26677 !! test
26678 Links 3. WikiLinks: No escapes needed
26679 !! options
26680 parsoid=html2wt
26681 !! html/parsoid
26682 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
26683 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
26684 !! wikitext
26685 [[Foo|[Foobar]]
26686 [[Foo|foo|bar]]
26687 !! html/php
26688 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
26689 <a href="/wiki/Foo" title="Foo">foo|bar</a>
26690 </p>
26691 !! end
26692
26693 !! test
26694 Links 4. ExtLinks: Escapes needed
26695 !! options
26696 parsoid=html2wt
26697 !! html/parsoid
26698 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
26699 <a rel="mw:ExtLink" href="http://google.com">google]</a>
26700 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
26701 <p>[http://google.com]</p>
26702 <p>[http://google.com google]</p>
26703 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
26704 <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>
26705 !! wikitext
26706 [http://google.com <nowiki>[google]</nowiki>]
26707 [http://google.com <nowiki>google]</nowiki>]
26708 [http://google.com <nowiki>goog] le</nowiki>]
26709
26710 <nowiki>[http://google.com]</nowiki>
26711
26712 <nowiki>[http://google.com google]</nowiki>
26713
26714 [http://google.com<nowiki>]</nowiki>
26715
26716 [{{echo|http://google.com}}<nowiki>]</nowiki>
26717 !! html/php
26718 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
26719 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
26720 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
26721 </p><p>[http://google.com]
26722 </p><p>[http://google.com google]
26723 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26724 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26725 </p>
26726 !! end
26727
26728 !! test
26729 Links 5. ExtLinks: No escapes needed
26730 !! options
26731 parsoid=html2wt
26732 !! html/parsoid
26733 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
26734 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
26735 !! wikitext
26736 [http://google.com [google]
26737
26738 [[http://google.com]]
26739 !! html/php
26740 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
26741 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
26742 </p>
26743 !! end
26744
26745 !! test
26746 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
26747 !! options
26748 parsoid=html2wt
26749 !! html/parsoid
26750 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
26751 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
26752 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
26753 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
26754 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
26755 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
26756 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26757 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
26758 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26759 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
26760 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
26761 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
26762 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
26763 </p>
26764 !! wikitext
26765 x<nowiki/>http://example.com<nowiki/>y
26766 http://example.com<nowiki/>?x
26767 http://example.com<nowiki/>&x
26768 http://example.com<nowiki/>'x
26769 http://example.com<nowiki/>,x
26770 http://example.com<nowiki/>.x
26771 http://example.com<nowiki/>;x
26772 http://example.com<nowiki/>:x
26773 http://example.com<nowiki/>;x
26774 http://example.com<nowiki/>!x
26775 http://example.com<nowiki/>=x
26776 http://example.com<nowiki/>(x)
26777 http://example.com(x<nowiki/>)
26778 !! end
26779
26780 !! test
26781 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26782 !! options
26783 parsoid=html2wt
26784 !! html/parsoid
26785 <p>x
26786 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
26787 y
26788 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
26789 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
26790 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
26791 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
26792 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
26793 </p>
26794 !! wikitext
26795 x
26796 http://example.com
26797 y
26798 "http://example.com"
26799 (http://example.com)
26800 (http://example.com) foo
26801 http://example.com,
26802 http://example.com, foo
26803 !! html/php
26804 <p>x
26805 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
26806 y
26807 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
26808 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
26809 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
26810 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
26811 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
26812 </p>
26813 !! end
26814
26815 !! test
26816 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26817 !! options
26818 parsoid=html2wt
26819 !! html/parsoid
26820 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
26821 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
26822 !! wikitext
26823 http://example.com.,;:!?\
26824 -http://example.com:
26825 !! html/php
26826 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
26827 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
26828 </p>
26829 !! end
26830
26831 !! test
26832 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
26833 !! options
26834 parsoid=html2wt
26835 !! html/parsoid
26836 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
26837 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
26838 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
26839 !! wikitext
26840 RFC 123<nowiki/>4
26841 RFC 123<nowiki/>y
26842 X<nowiki/>RFC 123<nowiki/>y
26843 !! end
26844
26845 !! test
26846 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
26847 !! options
26848 parsoid=html2wt
26849 !! html/parsoid
26850 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
26851 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
26852 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
26853 </p>
26854 !! wikitext
26855 RFC 123?foo
26856 RFC 123&foo
26857 -RFC 123-
26858 !! html/php
26859 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
26860 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
26861 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
26862 </p>
26863 !! end
26864
26865 !! test
26866 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
26867 !! options
26868 parsoid=html2wt
26869 !! html/parsoid
26870 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
26871 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26872 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26873 !! wikitext
26874 PMID 123<nowiki/>4
26875 PMID 123<nowiki/>y
26876 X<nowiki/>PMID 123<nowiki/>y
26877 !! end
26878
26879 !! test
26880 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
26881 !! options
26882 parsoid=html2wt
26883 !! html/parsoid
26884 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
26885 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
26886 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
26887 </p>
26888 !! wikitext
26889 PMID 123?foo
26890 PMID 123&foo
26891 -PMID 123-
26892 !! html/php
26893 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
26894 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
26895 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
26896 </p>
26897 !! end
26898
26899 !! test
26900 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
26901 !! options
26902 parsoid=html2wt
26903 !! html/parsoid
26904 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
26905 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
26906 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
26907 </p>
26908 !! wikitext
26909 ISBN 1234567890<nowiki/>1
26910 ISBN 1234567890<nowiki/>x
26911 a<nowiki/>ISBN 1234567890<nowiki/>b
26912 !! end
26913
26914 !! test
26915 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
26916 !! options
26917 parsoid=html2wt
26918 !! html/parsoid
26919 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26920 !! wikitext
26921 -ISBN 1234567890's
26922 !! html/php
26923 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26924 </p>
26925 !! end
26926
26927 !! test
26928 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26929 !! options
26930 parsoid=html2wt
26931 !! html/*
26932 <p>this is not a link: http://example.com
26933 </p>
26934 !! wikitext
26935 this is not a link: <nowiki>http://example.com</nowiki>
26936 !! end
26937
26938 !! test
26939 Links 15. Link trails can't become link prefixes.
26940 !! options
26941 language=is
26942 parsoid=html2wt
26943 !! html/parsoid
26944 <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>
26945 !! wikitext
26946 [[Söfnuður]]-[[00]]
26947 !! html/php
26948 <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>
26949 </p>
26950 !! end
26951
26952 #### --------------- Quotes ---------------
26953 #### 1. Quotes inside <b> and <i>
26954 #### 2. Link fragments separated by <i> and <b> tags
26955 #### 3. Link fragments inside <i> and <b>
26956 #### 4. No escaping needed
26957 #### --------------------------------------
26958 !! test
26959 1a. Quotes inside <b> and <i>
26960 !! options
26961 parsoid=html2wt
26962 !! html/*
26963 <p><i>'foo'</i>
26964 <i>''foo''</i>
26965 <i>'''foo'''</i>
26966 <i>foo</i>'s
26967 <b>'foo'</b>
26968 <b>''foo''</b>
26969 <b>'''foo'''</b>
26970 <b>foo'<i>bar'</i>baz</b>
26971 <b>foo</b>'s
26972 '<i>foo</i>
26973 <i>foo</i>'
26974 <i>foo'</i>'
26975 '<i>foo</i>'
26976 '<b>foo</b>
26977 <b>foo</b>'
26978 '<b>foo</b>'
26979 <i>fools'<span> errand</span></i>
26980 <i><span>fool</span>'s errand</i>
26981 '<i>foo</i> bar '<i>baz</i>
26982 a|!*#-:;+-~[]{}b'<i>x</i>
26983 </p>
26984 !! wikitext
26985 ''<nowiki/>'foo'''
26986 ''<nowiki>''foo''</nowiki>''
26987 ''<nowiki>'''foo'''</nowiki>''
26988 ''foo''<nowiki/>'s
26989 '''<nowiki/>'foo''''
26990 '''<nowiki>''foo''</nowiki>'''
26991 '''<nowiki>'''foo'''</nowiki>'''
26992 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26993 '''foo'''<nowiki/>'s
26994 '''foo''
26995 ''foo''<nowiki/>'
26996 ''foo'''<nowiki/>'
26997 '''foo''<nowiki/>'
26998 ''''foo'''
26999 '''foo'''<nowiki/>'
27000 ''''foo'''<nowiki/>'
27001 ''fools'<span> errand</span>''
27002 ''<span>fool</span>'s errand''
27003 '<nowiki/>''foo'' bar '''baz''
27004 a|!*#-:;+-~[]{}b'''x''
27005 !! end
27006
27007 !! test
27008 1b. Quotes inside <b> and <i> with other tags on same line
27009 !! options
27010 parsoid=html2wt
27011 !! html/parsoid
27012 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
27013 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
27014 <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>
27015 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
27016 '<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>
27017 '<i>foo</i> <div title="name">test</div>
27018 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
27019 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
27020 <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>
27021 </ol>
27022 !! wikitext
27023 '''a'' foo ''[[bar]]''
27024 ''a''' foo ''[[bar]]''
27025 ''a''' foo '''{{echo|[[bar]]}}'''
27026 [[foo]] x'''[[bar]]''
27027 '''foo'' <ref>test</ref>
27028 '''foo'' <div title="name">test</div>
27029 '''foo'' and <br> bar
27030 <references />
27031 !! end
27032
27033 !! test
27034 2. Link fragments separated by <i> and <b> tags
27035 !! options
27036 parsoid=html2wt
27037 !! html/parsoid
27038 <p>[[<i>foo</i>hello]]</p>
27039 <p>[[<b>foo</b>hello]]</p>
27040 !! wikitext
27041 [[''foo''<nowiki>hello]]</nowiki>
27042
27043 [['''foo'''<nowiki>hello]]</nowiki>
27044 !! end
27045
27046 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
27047 # this is one of the shortcomings of this format
27048 !! test
27049 3. Link fragments inside <i> and <b>
27050 !! options
27051 parsoid=html2wt
27052 !! html/parsoid
27053 <p><i>[[foo</i>]]</p>
27054 <p><b>[[foo</b>]]</p>
27055 !! wikitext
27056 ''[[foo''<nowiki>]]</nowiki>
27057
27058 '''[[foo'''<nowiki>]]</nowiki>
27059 !! end
27060
27061 !! test
27062 4. No escaping needed
27063 !! options
27064 parsoid=html2wt
27065 !! html/parsoid
27066 <p>'<span><i>bar</i></span>'
27067 '<span><b>bar</b></span>'
27068 'a:b'foo
27069 </p>
27070 !! wikitext
27071 '<span>''bar''</span>'
27072 '<span>'''bar'''</span>'
27073 'a:b'foo
27074 !! end
27075
27076 #### ----------- Paragraphs ---------------
27077 #### 1. No unnecessary escapes
27078 #### --------------------------------------
27079
27080 !! test
27081 1. No unnecessary escapes
27082 !! options
27083 parsoid=html2wt
27084 !! html/parsoid
27085 <p>bar <span>[[foo]]</span>
27086 </p><p>=bar <span>[[foo]]</span>
27087 </p><p>[[bar <span>[[foo]]</span>
27088 </p><p>]]bar <span>[[foo]]</span>
27089 </p><p>=bar <span>foo]]</span>=
27090 </p>
27091 !! wikitext
27092 bar <span><nowiki>[[foo]]</nowiki></span>
27093
27094 =bar <span><nowiki>[[foo]]</nowiki></span>
27095
27096 [[bar <span><nowiki>[[foo]]</nowiki></span>
27097
27098 ]]bar <span><nowiki>[[foo]]</nowiki></span>
27099
27100 =bar <span>foo]]</span><nowiki>=</nowiki>
27101 !!end
27102
27103 #### ----------------------- PRE --------------------------
27104 !! test
27105 1. Leading whitespace in SOL context should be escaped
27106 !! options
27107 parsoid=html2wt
27108 !! html/parsoid
27109 <p> a</p>
27110
27111 <p> a</p>
27112
27113 <p> a(tab)</p>
27114
27115 <p> a
27116 <!--cmt-->
27117 a</p>
27118
27119 <p>a
27120 b</p>
27121
27122 <p>a
27123 b</p>
27124
27125 <p>a
27126 b</p>
27127 !! wikitext
27128 <nowiki> </nowiki>a
27129
27130 <nowiki> </nowiki> a
27131
27132 a(tab)
27133
27134 <nowiki> </nowiki> a
27135 <!--cmt-->
27136 <nowiki> </nowiki>a
27137
27138 a
27139 <nowiki> </nowiki>b
27140
27141 a
27142 b
27143
27144 a
27145 b
27146 !! html/php
27147 <p> a
27148 </p><p> a
27149 </p><p> a(tab)
27150 </p><p> a
27151 a
27152 </p><p>a
27153 b
27154 </p><p>a
27155 b
27156 </p><p>a
27157 b
27158 </p>
27159 !! end
27160
27161 !! test
27162 2. Leading whitespace in non-indent-pre contexts should not be escaped
27163 !! options
27164 parsoid=html2wt
27165 !! html/parsoid
27166 <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>
27167 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
27168 <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>
27169 b</span></li>
27170 </ol>
27171 !! wikitext
27172 foo <ref>''a''
27173 b</ref>
27174 <references />
27175 !! end
27176
27177 !! test
27178 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
27179 !! options
27180 parsoid=html2wt
27181 !! html/parsoid
27182 <blockquote>
27183 <p>
27184 a
27185 <span>b</span>
27186 c</p>
27187 </blockquote>
27188 !! wikitext
27189 <blockquote>
27190 a
27191 <span>b</span>
27192 c
27193 </blockquote>
27194 !! end
27195
27196 !! test
27197 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
27198 !! options
27199 parsoid=html2wt
27200 !! html/parsoid
27201 <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>
27202 !! wikitext
27203 [[File:Foobar.jpg|thumb|caption]]
27204 !! end
27205
27206 !! test
27207 5. Nowiki escaping should account for indent-pres
27208 !! options
27209 parsoid=html2wt
27210 !! html/parsoid
27211 <pre>==foo==</pre>
27212 !! wikitext
27213 ==foo==
27214 !! end
27215
27216 !! test
27217 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
27218 !! options
27219 parsoid=html2wt
27220 !! html/parsoid
27221 <pre>
27222 * foo
27223 * bar
27224 </pre>
27225 !! wikitext
27226 * foo
27227 * bar
27228 !! end
27229
27230 !! test
27231 Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup
27232 !! options
27233 parsoid = {
27234 "modes": ["html2wt"],
27235 "scrubWikitext": true
27236 }
27237 !! html/parsoid
27238 <p> foo</p>
27239 <p> %foo</p>
27240 <p> *foo</p>
27241 <p> #foo</p>
27242 <p> =foo=</p>
27243 <p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p>
27244 <p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p>
27245 <p> <!--boo-->*foo</p>
27246 <p><!--boo--> *foo</p>
27247 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p>
27248 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p>
27249 !! wikitext
27250 foo
27251
27252 %foo
27253
27254 <nowiki/>*foo
27255
27256 <nowiki/>#foo
27257
27258 <nowiki/>=foo=
27259
27260 [[Category:Foo]]
27261 <nowiki/>*foo
27262
27263 [[Category:Foo]]
27264 <nowiki>*</nowiki>foo
27265
27266 <nowiki/><!--boo-->*foo
27267
27268 <!--boo--><nowiki/>*foo
27269
27270 <!--a--><!--b--><!--c--><!--d--><!--e-->foo
27271
27272 <!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo
27273 !! end
27274
27275 #### --------------- Behavior Switches --------------------
27276
27277 !! test
27278 1. Valid behavior switches should be escaped
27279 !! options
27280 parsoid=html2wt
27281 !! html/parsoid
27282 __TOC__
27283 <i>__TOC__</i>
27284 !! wikitext
27285 <nowiki>__TOC__</nowiki>
27286 ''<nowiki>__TOC__</nowiki>''
27287 !! end
27288
27289 !! test
27290 2. Invalid behavior switches should not be escaped
27291 !! options
27292 parsoid=html2wt
27293 !! html/parsoid
27294 __TOO__
27295 __|__
27296 !! wikitext
27297 __TOO__
27298 __|__
27299 !! end
27300
27301 # We use indent-pre as an indirect way to test for sol-transparent behavior.
27302 !! test
27303 Behavior switches should be SOL-transparent
27304 !! options
27305 parsoid=html2wt
27306 !! html/parsoid
27307 <meta property="mw:PageProp/toc" />
27308
27309 <!-- this one's bogus -->
27310 <pre>__TOO__</pre>
27311
27312 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
27313
27314 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
27315 !! wikitext
27316 __TOC__
27317
27318 <!-- this one's bogus -->
27319 __TOO__
27320
27321 __TOC__ foo
27322
27323 __TOC__
27324 bar
27325 !! end
27326
27327 #### --------------- HTML tags ---------------
27328 #### 1. a tags
27329 #### 2. other tags
27330 #### 3. multi-line html tag
27331 #### 4. extension tags
27332 #### -----------------------------------------
27333 !! test
27334 1. a tags
27335 !! options
27336 parsoid=html2wt
27337 !! html/parsoid
27338 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
27339 !! wikitext
27340 <a href="http://google.com">google</a>
27341 !! end
27342
27343 !! test
27344 2. other tags
27345 !! options
27346 parsoid=html2wt
27347 !! html/parsoid
27348 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
27349 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
27350 <li> &lt;td&gt;</li></ul>
27351
27352 !! wikitext
27353 * <nowiki><div>foo</div></nowiki>
27354 * <nowiki><div style="color:red">foo</div></nowiki>
27355 * <nowiki><td></nowiki>
27356 !! end
27357
27358 !! test
27359 3. multi-line html tag
27360 !! options
27361 parsoid=html2wt
27362 !! html/parsoid
27363 <p>&lt;div
27364 &gt;foo&lt;/div
27365 &gt;
27366 </p>
27367 !! wikitext
27368 <nowiki><div
27369 >foo</div
27370 ></nowiki>
27371 !! end
27372
27373 !! test
27374 4. extension tags
27375 !! options
27376 parsoid=html2wt
27377 !! html/parsoid
27378 <p>&lt;ref&gt;foo&lt;/ref&gt;
27379 </p><p>&lt;ref&gt;bar
27380 </p><p>baz&lt;/ref&gt;
27381 </p>
27382 !! wikitext
27383 <nowiki><ref>foo</ref></nowiki>
27384
27385 <nowiki><ref>bar</nowiki>
27386
27387 baz<nowiki></ref></nowiki>
27388 !! end
27389
27390 !! test
27391 Parsoid: newline inducing block nodes don't suppress <nowiki>
27392 !! options
27393 parsoid=html2wt
27394 !! html/parsoid
27395 a<h1>foo</h1>
27396 !! wikitext
27397 <nowiki> </nowiki>a
27398
27399 = foo =
27400 !! end
27401
27402 #### --------------- Others ---------------
27403 !! test
27404 Escaping nowikis
27405 !! options
27406 parsoid=html2wt
27407 !! html/parsoid
27408 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
27409 </p>
27410 !! wikitext
27411 &lt;nowiki&gt;foo&lt;/nowiki&gt;
27412 !! end
27413
27414 ## The quote-char in the input is necessary for triggering the bug
27415 !! test
27416 (T54035) Nowiki-escaping should not get tripped by " :" in text
27417 !! options
27418 parsoid=html2wt
27419 !! html/parsoid
27420 <p>foo's bar :</p>
27421 !! wikitext
27422 foo's bar :
27423 !! end
27424
27425 #----------- End of wikitext escaping tests --------------
27426
27427 !! test
27428
27429 Tag-like HTML structures are passed through as text
27430 !! wikitext
27431 <x y>
27432
27433 <x.y>
27434
27435 <x-y>
27436
27437 1>2
27438
27439 x<y
27440
27441 a>b
27442
27443 1<d e>f
27444 !! html
27445 <p>&lt;x y&gt;
27446 </p><p>&lt;x.y&gt;
27447 </p><p>&lt;x-y&gt;
27448 </p><p>1&gt;2
27449 </p><p>x&lt;y
27450 </p><p>a&gt;b
27451 </p><p>1&lt;d e&gt;f
27452 </p>
27453 !! end
27454
27455 !! test
27456 HTML tag with necessary entities in attributes
27457 !! wikitext
27458 <span title="&amp;amp;">foo</span>
27459 !! html
27460 <p><span title="&amp;amp;">foo</span>
27461 </p>
27462 !! end
27463
27464 !! test
27465 HTML tag with 'unnecessary' entity encoding in attributes
27466 !! wikitext
27467 <span title="&amp;">foo</span>
27468 !! html
27469 <p><span title="&amp;">foo</span>
27470 </p>
27471 !! end
27472
27473 !! test
27474 HTML tag with broken attribute value quoting
27475 !! options
27476 parsoid=wt2html,html2html
27477 !! wikitext
27478 <span title="Hello world>Foo</span>
27479 !! html/php
27480 <p><span title="Hello world">Foo</span>
27481 </p>
27482 !! html/parsoid
27483 <p><span title="Hello world">Foo</span></p>
27484 !! end
27485
27486 !! test
27487 Self-closed tag with broken attribute value quoting
27488 !! options
27489 parsoid=wt2html,html2html
27490 !! wikitext
27491 <div title="Hello world />Foo
27492 !! html/php+tidy
27493 <div title="Hello world"></div><p>Foo</p>
27494 !! html/parsoid
27495 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
27496 !! end
27497
27498 !! test
27499 Table with broken attribute value quoting
27500 !! options
27501 parsoid=wt2html,html2html
27502 !! wikitext
27503 {|
27504 | title="Hello world|Foo
27505 |}
27506 !! html/php
27507 <table>
27508 <tr>
27509 <td title="Hello world">Foo
27510 </td></tr></table>
27511 !! html/parsoid
27512 <table>
27513 <tr>
27514 <td title="Hello world">Foo
27515 </td></tr></table>
27516 !! end
27517
27518 !! test
27519 Table with broken attribute value quoting on consecutive lines
27520 !! options
27521 parsoid=wt2html,html2html
27522 !! wikitext
27523 {|
27524 | title="Hello world|Foo
27525 | style="color:red|Bar
27526 |}
27527 !! html/php
27528 <table>
27529 <tr>
27530 <td title="Hello world">Foo
27531 </td>
27532 <td style="color:red">Bar
27533 </td></tr></table>
27534 !! html/parsoid
27535 <table><tbody>
27536 <tr>
27537 <td title="Hello world">Foo
27538 </td><td style="color: red">Bar
27539 </td></tr></tbody></table>
27540 !! end
27541
27542 !!test
27543 Accept empty td cell attribute
27544 !! wikitext
27545 {|
27546 | align="center" |foo|| |
27547 |}
27548 !! html
27549 <table>
27550 <tr>
27551 <td align="center">foo</td>
27552 <td>
27553 </td></tr></table>
27554 !! end
27555
27556 !!test
27557 Non-empty attributes in th-cells
27558 !! wikitext
27559 {|
27560 !Foo!! style="color: red" |Bar
27561 |}
27562 !! html
27563 <table>
27564 <tr>
27565 <th>Foo</th>
27566 <th style="color: red">Bar
27567 </th></tr></table>
27568 !! end
27569
27570 !!test
27571 Accept empty attributes in th-cells
27572 !! wikitext
27573 {|
27574 !|foo!!|bar
27575 |}
27576 !! html
27577 <table>
27578 <tr>
27579 <th>foo</th>
27580 <th>bar
27581 </th></tr></table>
27582 !! end
27583
27584 !!test
27585 Empty table rows go away
27586 !! wikitext
27587 {|
27588 |Hello
27589 |there
27590 |- class="foo"
27591 |-
27592 |}
27593 !! html
27594 <table>
27595 <tr>
27596 <td>Hello
27597 </td>
27598 <td>there
27599 </td></tr>
27600
27601 </table>
27602 !! end
27603
27604 ###
27605 ### Parsoid-centric tests for testing RTing of inter-element separators
27606 ### Edge cases not tested by existing parser tests and specific to
27607 ### Parsoid-specific serialization strategies.
27608 ###
27609
27610 !!test
27611 RT-ed inter-element separators should be valid separators
27612 !! wikitext
27613 {|
27614 |- [[foo]]
27615 |}
27616 !! html/php
27617 <table>
27618
27619 </table>
27620 !! html/parsoid
27621 <table>
27622 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
27623 </tbody></table>
27624 !!end
27625
27626 # Parsoid-only test of a DOM pass
27627 !!test
27628 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
27629 !! wikitext
27630 {|
27631 |<small>foo
27632 bar
27633 |}
27634
27635 {|
27636 |<small>foo<small>
27637 |}
27638 !! html/parsoid
27639 <table>
27640 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
27641 <p>bar</p></small></td></tr>
27642 </tbody></table>
27643
27644 <table>
27645 <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>
27646 </tbody></table>
27647 !!end
27648
27649 # Note that the "style" attribute is really a template parameter here.
27650 # The = would have to be {{=}} if you wanted the literal.
27651 !!test
27652 Empty TD followed by TD with tpl-generated attribute
27653 !! wikitext
27654 {|
27655 |-
27656 |
27657 |{{echo|style='color:red'}}|foo
27658 |}
27659 !! html
27660 <table>
27661
27662 <tr>
27663 <td>
27664 </td>
27665 <td>foo
27666 </td></tr></table>
27667 !! end
27668
27669 !!test
27670 Indented table with an empty td
27671 !! wikitext
27672 {|
27673 |-
27674 |
27675 |foo
27676 |}
27677 !! html
27678 <table>
27679
27680 <tr>
27681 <td>
27682 </td>
27683 <td>foo
27684 </td></tr></table>
27685 !! end
27686
27687 !! test
27688 Indented table with blank lines in between (T85627)
27689 !! wikitext
27690 {|
27691 |foo
27692
27693
27694 |}
27695 !! html/php
27696 <table>
27697 <tr>
27698 <td>foo
27699 <p><br />
27700 </p>
27701 </td></tr></table>
27702 !! html/parsoid
27703 <table>
27704 <tbody><tr><td>foo
27705 <p>
27706 <br /></p></td></tr>
27707 </tbody></table>
27708 !! end
27709
27710 !!test
27711 Indented block & table
27712 !! wikitext
27713 <div>foo</div>
27714 {|
27715 |foo
27716 |}
27717 !! html/php
27718 <div>foo</div>
27719 <table>
27720 <tr>
27721 <td>foo
27722 </td></tr></table>
27723 !! html/parsoid
27724 <div data-parsoid='{"stx":"html"}'>foo</div>
27725 <table><tbody>
27726 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
27727 </tbody></table>
27728 !!end
27729
27730 !! test
27731 Indent and comment before table row
27732 !! wikitext
27733 {|
27734 <!--hi-->|-
27735 |there
27736 |}
27737 !! html/php
27738 <table>
27739
27740 <tr>
27741 <td>there
27742 </td></tr></table>
27743 !! html/parsoid
27744 <table>
27745 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
27746 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
27747 </tbody></table>
27748 !! end
27749
27750 # PHP parser omits empty TR
27751 !!test
27752 Empty TR followed by a template-generated TR
27753 !! wikitext
27754 {|
27755 |-
27756 {{echo|<tr><td>foo</td></tr>}}
27757 |}
27758 !! html/php+tidy
27759 <table>
27760
27761 <tbody><tr><td>foo</td></tr>
27762 </tbody></table>
27763 !! html/parsoid
27764 <table>
27765 <tbody>
27766 <tr class='mw-empty-elt'></tr>
27767 <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}}]}'>
27768 <td>foo</td></tr>
27769 </tbody></table>
27770 !!end
27771
27772 ## PHP and parsoid output differ for this; as usual PHP omits empty
27773 ## elements, and since it strips the comments the TR is empty.
27774 !!test
27775 Empty TR followed by mixed-ws-comment line should RT correctly
27776 !! wikitext
27777 {|
27778 |-
27779 <!--c-->
27780 |-
27781 <!--c--> <!--d-->
27782 |}
27783 !! html/php+tidy
27784 <table>
27785
27786
27787 </table>
27788 !! html/parsoid
27789 <table>
27790 <tbody>
27791 <tr class='mw-empty-elt'></tr>
27792 <!--c-->
27793 <tr>
27794 <!--c--> </tr><!--d-->
27795 </tbody></table>
27796 !! end
27797
27798 !!test
27799 Multi-line image caption generated by templates with/without trailing newlines
27800 !! wikitext
27801 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
27802 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
27803 !! html/parsoid
27804 <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>
27805 <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>
27806 !!end
27807
27808 !! test
27809 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
27810 !! options
27811 parsoid=html2wt
27812 !! html/parsoid
27813 <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>
27814
27815 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
27816 !! wikitext
27817 <includeonly>foo</includeonly>
27818 new para
27819
27820 [[Category:Foo]]
27821
27822 = new heading =
27823 !! end
27824
27825 ## PHP emits broken html for this, and since this is primarily
27826 ## a Parsoid serializer test, marking this Parsoid only
27827 !!test
27828 Improperly nested inline or quotes tags with whitespace in between
27829 !! wikitext
27830 <span> <s>x</span> </s>
27831 ''' ''x''' ''
27832 !! html/parsoid
27833 <p><span> <s>x</s></span><s> </s>
27834 <b> <i>x</i></b><i> </i>
27835 </p>
27836 !!end
27837
27838 !!test
27839 Encapsulate protected attributes from wt
27840 !! wikitext
27841 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
27842
27843 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
27844 |ok
27845 |}
27846 !! html/parsoid
27847 <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>
27848
27849 <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">
27850 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'>ok</td></tr>
27851 </tbody></table>
27852 !!end
27853
27854 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
27855 ## Having nested or stray pre tags results in the attempt to add duplicates,
27856 ## causing an assertion fail. This test tries to prevent that situation.
27857 !! test
27858 Ensure ParagraphWrapper can deal with stray closing pre tags
27859 !! options
27860 parsoid=wt2html
27861 !! wikitext
27862 plain text</pre>
27863 !! html/parsoid
27864 <p>plain text</p>
27865 !! end
27866
27867 ## Remex doesn't account for fostered content.
27868 !! test
27869 1. Ensure fostered text content is wrapped in element nodes
27870 !! options
27871 parsoid=wt2html
27872 !! wikitext
27873 <table>hi</table><table>ho</table>
27874 !! html/php+tidy
27875 hi<table></table>ho<table></table>
27876 !! html/parsoid
27877 <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>
27878 !! end
27879
27880 ## Remex doesn't account for fostered content.
27881 !! test
27882 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
27883 !! options
27884 parsoid=wt2html,wt2wt
27885 !! wikitext
27886 <table>
27887 <tr> || ||
27888 <td> a
27889 </table>
27890 !! html/php+tidy
27891 || ||
27892 <table>
27893 <tbody><tr><td> a
27894 </td></tr></tbody></table>
27895 !! html/parsoid
27896 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||</p>
27897 <table data-parsoid='{"stx":"html"}'>
27898 <tbody><tr data-parsoid='{"stx":"html","autoInsertedEnd":true}'><td data-parsoid='{"stx":"html","autoInsertedEnd":true}'> a
27899 </td></tr></tbody></table>
27900 !! end
27901
27902 ## Remex doesn't account for fostered content.
27903 !! test
27904 Encapsulation properly handles null DSR information from foster box
27905 !! options
27906 parsoid=wt2html,wt2wt
27907 !! wikitext
27908 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
27909 !! html/parsoid
27910 <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>
27911 !! end
27912
27913 ## Remex doesn't account for fostered content.
27914 !! test
27915 1. Encapsulate foster-parented transclusion content
27916 !! options
27917 parsoid=wt2wt,wt2html
27918 !! wikitext
27919 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
27920 !! html/php+tidy
27921 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
27922 !! html/parsoid
27923 <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>
27924 !! end
27925
27926 !! test
27927 2. Encapsulate foster-parented transclusion content
27928 !! options
27929 parsoid=wt2wt,wt2html
27930 !! wikitext
27931 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
27932 !! html/parsoid
27933 <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>
27934 <table>
27935 <tbody>
27936 <tr>
27937 <td>bar</td>
27938 </tr>
27939 </tbody>
27940 </table>
27941 !! end
27942
27943 !! test
27944 3. Encapsulate foster-parented transclusion content
27945 !! options
27946 parsoid=wt2wt,wt2html
27947 !! wikitext
27948 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27949 !! html/parsoid
27950 <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;]}">
27951 <p>foo</p>
27952 </div>
27953 <table>
27954 <tbody>
27955 <tr>
27956 <td>bar</td>
27957 </tr>
27958 </tbody>
27959 </table>
27960 !! end
27961
27962 !! test
27963 4. Encapsulate foster-parented transclusion content
27964 !! options
27965 parsoid=wt2wt,wt2html
27966 !! wikitext
27967 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27968 !! html/parsoid
27969 <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;]}">
27970 <p>foo</p>
27971 </div>
27972 <table>
27973 <tbody>
27974 <tr>
27975 <td>bar</td>
27976 </tr>
27977 </tbody>
27978 </table>
27979 !! end
27980
27981 ## Remex doesn't account for fostered content.
27982 !! test
27983 5. Encapsulate foster-parented transclusion content
27984 !!options
27985 parsoid=wt2wt,wt2html
27986 !! wikitext
27987 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27988 !! html/php+tidy
27989 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
27990 !! html/parsoid
27991 <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>
27992 !! end
27993
27994 ## Remex doesn't account for fostered content.
27995 !! test
27996 6. Encapsulate foster-parented transclusion content
27997 !! options
27998 parsoid=wt2wt,wt2html
27999 !! wikitext
28000 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
28001 !! html/php+tidy
28002 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
28003 !! html/parsoid
28004 <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>
28005 !! end
28006
28007 !! test
28008 7. Encapsulate foster-parented transclusion content
28009 !!options
28010 parsoid=wt2wt,wt2html
28011 !! wikitext
28012 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
28013 !! html/parsoid
28014 <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>
28015 <table>
28016 <tbody>
28017 <tr>
28018 <td>bar</td>
28019 </tr>
28020 </tbody>
28021 </table>
28022 !! end
28023
28024 ## Remex doesn't account for fostered content.
28025 # Note that the wt is broken on purpose: the = should be {{=}} if you
28026 # don't want it to be a template parameter key.
28027 !! test
28028 8. Encapsulate foster-parented transclusion content
28029 !! options
28030 parsoid=wt2wt,wt2html
28031 !! wikitext
28032 {{echo|a
28033 }}{|{{echo|style='color:red'}}
28034 |-
28035 |b
28036 |}
28037 !! html/php+tidy
28038 <p>a
28039 </p>
28040 <table>
28041
28042 <tbody><tr>
28043 <td>b
28044 </td></tr></tbody></table>
28045 !! html/parsoid
28046 <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">
28047 </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">
28048 <tbody><tr>
28049 <td>b
28050 </td></tr></tbody></table>
28051 !! end
28052
28053 ## Remex doesn't account for fostered content.
28054 !! test
28055 9. Encapsulate foster-parented transclusion content
28056 !!options
28057 parsoid=wt2wt,wt2html
28058 !! wikitext
28059 <table>{{echo|hi</table>hello}}
28060 !! html/php+tidy
28061 hi<table></table><p>hello</p>
28062 !! html/parsoid
28063 <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>
28064 !! end
28065
28066 !! test
28067 Table in fosterable position
28068 !!options
28069 parsoid=wt2html
28070 !! wikitext
28071 {{OpenTable}}
28072 <div>
28073 {|
28074 |}
28075 </div>
28076 |}
28077 !! html/parsoid
28078 <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">
28079 </span>
28080 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
28081
28082 <table>
28083 </table>
28084 !! end
28085
28086 # Parsoid only for T66747
28087 !! test
28088 Properly encapsulate empty-content transclusions in fosterable positions
28089 !! wikitext
28090 <table>
28091 {{#if:|
28092 <td>foo</td>
28093 }}
28094 </table>
28095 !! html/parsoid
28096 <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"}]]}'>
28097
28098 </table>
28099 !! end
28100
28101 ## No longer captures its original intention
28102 !! test
28103 Always encapsulate foster box when template range is expanded to table
28104 !! options
28105 disabled
28106 parsoid=wt2wt
28107 !! wikitext
28108 {|
28109 hello
28110 {{OpenTable}}
28111 |}
28112 !! html/parsoid
28113 !! end
28114
28115 !! test
28116 T115289: Unclosed table
28117 !! wikitext
28118 {{echo|<table>}}<!--c-->[[Category:Two]]
28119 !! html/parsoid
28120 <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>
28121 !! end
28122
28123 !! test
28124 T115289: Don't migrate newlines out of tables with fostered content
28125 !! wikitext
28126 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
28127 !! html/parsoid
28128 <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>
28129 !! end
28130
28131 !! test
28132 T73074: More fostering fun
28133 !! wikitext
28134 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
28135 !! html/parsoid
28136 <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>
28137 !! end
28138
28139 !!test
28140 Support <object> element with .data attribute
28141 !!options
28142 parsoid=html2wt
28143 !! html/parsoid
28144 <object data="test.swf"></object>
28145 !! wikitext
28146 <object data="test.swf"></object>
28147 !!end
28148
28149 !! test
28150 Don't block XML namespace declaration
28151 !! wikitext
28152 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
28153 !! html/php
28154 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
28155 </p>
28156 !! html/parsoid
28157 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
28158 !! end
28159
28160 # -----------------------------------------------------------------
28161 # The following section of tests are primarily to spec requirements
28162 # around Parsoid's serialization (old, new, edited content)
28163 #
28164 # All these tests are marked Parsoid html2wt and html2html only
28165 # ----------------------------------------------------------------
28166
28167 !! test
28168 Ignore rel attribute in a-tags during serialization to url-links
28169 !! options
28170 parsoid=html2wt
28171 !! html/parsoid
28172 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
28173 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
28174 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
28175 !! wikitext
28176 http://en.wikipedia.org/wiki/Foobar
28177 http://en.wikipedia.org/wiki/Foobar
28178 http://en.wikipedia.org/wiki/Foobar
28179 !! end
28180
28181 # 'mi' is a localinterwiki prefix as well as a language
28182 !! test
28183 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
28184 !! options
28185 parsoid=html2wt
28186 !! html/parsoid
28187 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
28188 !! wikitext
28189 [[Foo]]
28190 !! end
28191
28192 !! test
28193 Parsoid should accept interwiki shortcuts
28194 !! options
28195 parsoid=html2wt
28196 !! html/parsoid
28197 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
28198 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
28199 <a href='./fr:Foo'>Foo</a></p>
28200 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
28201 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
28202 <a href='fr%3AFoo'>Foo</a></p>
28203 <p><a href='FR%3AFoo'>Foo</a>
28204 <a href='./FR:Foo'>Foo</a></p>
28205 !! wikitext
28206 [[:fr:Foo|Foo]]
28207 [[:fr:Foo|Foo]]
28208 [[:fr:Foo|Foo]]
28209
28210 [[:fr:Foo|Foo]]
28211 [[:fr:Foo|Foo]]
28212 [[:fr:Foo|Foo]]
28213
28214 [[:fr:Foo|Foo]]
28215 [[:fr:Foo|Foo]]
28216 !! end
28217
28218 !! test
28219 Parsoid should not accept invalid interwiki shortcuts
28220 !! options
28221 parsoid=html2wt
28222 !! html/parsoid
28223 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
28224 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
28225 <a href='news:Foo'>Foo</a></p>
28226 !! wikitext
28227 [news:Foo Foo]
28228 [news:Foo Foo]
28229 [news:Foo Foo]
28230 !! end
28231
28232 # See T93839
28233 !! test
28234 New wikilinks should be serialized properly
28235 !! options
28236 parsoid=html2wt
28237 !! html/parsoid
28238 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
28239 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
28240 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
28241 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
28242 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
28243 !! wikitext
28244 [[Foo]]
28245 [[Foo]]
28246 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
28247 http://en.wikipedia.org/wiki/Foo
28248 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
28249 !! end
28250
28251 !! test
28252 New wiki links (href variations)
28253 !! options
28254 parsoid=html2wt
28255 !! html/parsoid
28256 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28257 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
28258 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
28259 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
28260 !! wikitext
28261 [[Foo_bar]]
28262 [[Foo_bar]]
28263 [[Foo_bar]]
28264 [[Toxine bactérienne]]
28265 !! end
28266
28267 !! test
28268 New wiki links (content string variations)
28269 !! options
28270 parsoid=html2wt
28271 !! html/parsoid
28272 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28273 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
28274 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
28275 !! wikitext
28276 [[Foo_bar]]
28277 [[Foo bar]]
28278 [[Foo_bar|./Foo_bar]]
28279 !! end
28280
28281 !! test
28282 New category links (href variations)
28283 !! options
28284 parsoid=html2wt
28285 !! html/parsoid
28286 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
28287 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
28288 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
28289 !! wikitext
28290 [[Category:Toxine bactérienne]]
28291 [[Category:Toxine bactérienne]]
28292 [[Category:Toxine bactérienne]]
28293 !! end
28294
28295 !! test
28296 New sol transparent links don't need indent-pre nowiki protection
28297 !! options
28298 parsoid=html2wt
28299 language=de
28300 !! html/parsoid
28301 <link rel="mw:PageProp/redirect" href="./Main_Page">
28302 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
28303 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
28304 !! wikitext
28305 #WEITERLEITUNG [[Main Page]]
28306 <!-- this is good --> [[Category:Good]]
28307 <!-- this is great --> [[Kategorie:Great]]
28308 !! end
28309
28310 !! test
28311 New interlanguage links (href variations)
28312 !! options
28313 parsoid=html2wt
28314 !! html/parsoid
28315 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
28316 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
28317 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
28318 !! wikitext
28319 [[es:Toxine bactérienne]]
28320 [[es:Toxine_bactérienne]]
28321 [[es:Toxine_bactérienne]]
28322 !! end
28323
28324 !! test
28325 Image: Modifying size of an image (1)
28326 !! options
28327 parsoid={
28328 "modes": ["wt2wt"],
28329 "changes": [
28330 ["img[height]", "attr", "height", "22"],
28331 ["img[width]", "attr", "width", "200"]
28332 ]
28333 }
28334 !! wikitext
28335 [[Image:Foobar.jpg|230x230px]]
28336 !! wikitext/edited
28337 [[Image:Foobar.jpg|200x200px]]
28338 !!end
28339
28340 !! test
28341 Image: Modifying size of an image (2)
28342 !! options
28343 parsoid={
28344 "modes": ["wt2wt"],
28345 "changes": [
28346 ["img[height]", "attr", "height", "100"],
28347 ["img[width]", "attr", "width", "500"]
28348 ]
28349 }
28350 !! wikitext
28351 [[Image:Foobar.jpg|230x230px]]
28352 !! wikitext/edited
28353 [[Image:Foobar.jpg|500x500px]]
28354 !!end
28355
28356 # Change in size is ignored so long as class='mw-default-size'
28357 !! test
28358 Image: Modifying size of an image (3)
28359 !! options
28360 parsoid={
28361 "modes": ["wt2wt"],
28362 "changes": [
28363 ["figure[class]", "removeClass", "mw-default-size"],
28364 ["figure img", "attr", "height", "19"],
28365 ["figure img", "attr", "width", "170"]
28366 ]
28367 }
28368 !! wikitext
28369 [[Image:Foobar.jpg|thumb]]
28370 !! wikitext/edited
28371 [[Image:Foobar.jpg|thumb|170x170px]]
28372 !!end
28373
28374 !! test
28375 Image: Modifying alignment of an image (T50665)
28376 !! options
28377 parsoid={
28378 "modes": ["wt2wt"],
28379 "changes": [
28380 ["figure[class]", "removeClass", "mw-halign-right"],
28381 ["figure[class]", "addClass", "mw-halign-left"]
28382 ]
28383 }
28384 !! wikitext
28385 [[Image:Foobar.jpg|thumb|caption|right]]
28386 !! wikitext/edited
28387 [[Image:Foobar.jpg|thumb|caption|left]]
28388 !! end
28389
28390 !! test
28391 Image: Modifying mw-default-size of an frameless image (T64805)
28392 !! options
28393 parsoid={
28394 "modes": ["wt2wt"],
28395 "changes": [
28396 ["figure.mw-default-size", "removeClass", "mw-default-size"]
28397 ]
28398 }
28399 !! wikitext
28400 [[Image:Foobar.jpg|frameless|right]]
28401 !! wikitext/edited
28402 [[Image:Foobar.jpg|frameless|right|220x220px]]
28403 !! end
28404
28405 !! test
28406 Image: Modifying valign of an image (T51221)
28407 !! options
28408 parsoid={
28409 "modes": ["wt2wt"],
28410 "changes": [
28411 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
28412 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
28413 ]
28414 }
28415 !! wikitext
28416 [[File:Foobar.jpg|20px|middle]]
28417 !! wikitext/edited
28418 [[File:Foobar.jpg|20px|text-top]]
28419 !! end
28420
28421 !! test
28422 Image: Modifying alt attribute of an image (T58400)
28423 !! options
28424 parsoid={
28425 "modes": ["wt2wt"],
28426 "changes": [
28427 ["img[alt]", "attr", "alt", "some alternate edited text"]
28428 ]
28429 }
28430 !! wikitext
28431 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
28432 !! wikitext/edited
28433 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
28434 !!end
28435
28436 !! test
28437 Image: Modifying caption of an image
28438 !! options
28439 parsoid={
28440 "modes": ["wt2wt"],
28441 "changes": [
28442 ["figcaption", "text", "new caption"]
28443 ]
28444 }
28445 !! wikitext
28446 [[Image:Foobar.jpg|thumb|original caption]]
28447 !! wikitext/edited
28448 [[Image:Foobar.jpg|thumb|new caption]]
28449 !!end
28450
28451 !! test
28452 Image: empty alt attribute (T50924)
28453 !! wikitext
28454 [[File:Foobar.jpg|thumb|alt=|bar]]
28455 !! html/php+tidy
28456 <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>
28457 !! html/parsoid
28458 <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>
28459 !! end
28460
28461 !! test
28462 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
28463 !! options
28464 parsoid=html2wt
28465 language=ar
28466 disabled
28467 !! html/parsoid
28468 <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>
28469 !! wikitext
28470 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
28471 !! end
28472
28473 !! test
28474 Image: Block level image should have \n before and after
28475 !! wikitext
28476 123
28477 [[File:Foobar.jpg|right|thumb|150x150px]]
28478 456
28479 !! html/parsoid
28480 <p>123</p>
28481 <figure class="mw-halign-right" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150"/></a></figure>
28482 <p>456</p>
28483 !! end
28484
28485 !! test
28486 Image: New block level image should have \n before and after (existing content)
28487 !! wikitext
28488 123
28489 [[File:Foobar.jpg|right|thumb|150x150px]]
28490 456
28491 !! html/parsoid
28492 <p>123</p>
28493 <figure class="mw-halign-right" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"right","ak":"right"},{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"150x150px"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"17","width":"150"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure>
28494 <p>456</p>
28495 !! end
28496
28497 !! test
28498 Image: upright option (parsoid)
28499 !! wikitext
28500 [[File:Foobar.jpg|thumb|upright|caption]]
28501 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
28502 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
28503 !! html/parsoid
28504 <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>
28505 <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>
28506 <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>
28507 !! end
28508
28509 !! test
28510 Image: upright option is ignored on inline and frame images (parsoid)
28511 !! wikitext
28512 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
28513 !! html/parsoid
28514 <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>
28515 !! end
28516
28517 !! test
28518 Image: in template parameter with empty parameter
28519 !! wikitext
28520 {{echo|[[File:Foobar.jpg|link=]]}}
28521 !! html/parsoid
28522 <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>
28523 !! end
28524
28525 !! test
28526 Image: from basic HTML (1)
28527 !! options
28528 parsoid=html2wt
28529 !! html/parsoid
28530 <span typeof="mw:Image">
28531 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28532 </span>
28533 !! wikitext
28534 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28535 !! end
28536
28537 !! test
28538 Image: from basic HTML (2)
28539 !! options
28540 parsoid=html2wt
28541 !! html/parsoid
28542 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28543 !! wikitext
28544 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28545 !! end
28546
28547 !! test
28548 Image: from basic HTML (3)
28549 !! options
28550 parsoid=html2wt
28551 !! html/parsoid
28552 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
28553 !! wikitext
28554 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
28555 !! end
28556
28557 !! test
28558 Image: from basic HTML (4)
28559 !! options
28560 parsoid=html2wt
28561 !! html/parsoid
28562 <img src="./File:Foobar.jpg">
28563 !! wikitext
28564 [[File:Foobar.jpg|link=]]
28565 !! end
28566
28567 !! test
28568 Image: Invalid title as link
28569 !! wikitext
28570 [[File:Foobar.jpg|link=<]]
28571 !! html/php
28572 <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>
28573 </p>
28574 !! html/parsoid
28575 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=&lt;"}]}' data-mw='{"caption":"link=&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>
28576 !! end
28577
28578 !! test
28579 Various link types in alt and link options
28580 !! wikitext
28581 [[File:Foobar.jpg|link=[[Main Page]]|alt=[[Main Page]]|caption]]
28582
28583 [[File:Foobar.jpg|link=[[Media:Thumb.png]]|alt=[[Media:Thumb.png]]|caption]]
28584
28585 [[File:Foobar.jpg|link=[[wikipedia:Foo]]|alt=[[wikipedia:Foo]]|caption]]
28586 !! html/php+tidy
28587 <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>
28588 </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>
28589 </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>
28590 </p>
28591 !! html/parsoid
28592 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"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" data-parsoid='{"a":{"alt":"Main Page","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=[[Main Page]]","resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
28593
28594 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"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" data-parsoid='{"a":{"alt":"Media:Thumb.png","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=[[Media:Thumb.png]]","resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
28595
28596 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"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" data-parsoid='{"a":{"alt":"wikipedia:Foo","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=[[wikipedia:Foo]]","resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
28597 !! end
28598
28599 !! test
28600 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
28601 !! options
28602 parsoid=html2wt
28603 !! html/parsoid
28604 <ul>
28605 <li><p>foo</p></li>
28606 </ul>
28607 !! wikitext
28608 * foo
28609 !! end
28610
28611 !! test
28612 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
28613 !! options
28614 parsoid=html2wt
28615 !! html/parsoid
28616 <ul> <li>foo</li></ul>
28617 !! wikitext
28618 * foo
28619 !! end
28620
28621 !! test
28622 Don't strip leading whitespace when handling indent-pre suppressing tags
28623 !! options
28624 parsoid=html2wt
28625 !! html/parsoid
28626 <table>
28627 <tr><td> indented row</td></tr>
28628 </table>
28629 <blockquote><p>
28630 <b>This is very bold of you!</b>
28631 </p>
28632 <table><tr><td>
28633 indented cell (no pre-wrapping!)
28634 </td></tr></table>
28635 </blockquote>
28636 <p>foo</p>
28637 <div>bar</div>
28638 !! wikitext
28639 {|
28640 | indented row
28641 |}
28642 <blockquote>
28643 '''This is very bold of you!'''
28644
28645 {|
28646 |
28647 indented cell (no pre-wrapping!)
28648 |}
28649 </blockquote>
28650 foo
28651 <div>bar</div>
28652 !! end
28653
28654 !! test
28655 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
28656 !! options
28657 parsoid=html2wt
28658 !! html/parsoid
28659 <p>foo</p>
28660 <span>bar</span>
28661
28662 <span>foo2
28663 </span>bar2
28664
28665 <div>foo</div>
28666 <span>bar</span>
28667
28668 <div>
28669 <span>foo</span>
28670 </div>
28671 !! wikitext
28672 foo
28673
28674 <span>bar</span>
28675
28676 <span>foo2
28677 <nowiki> </nowiki></span>bar2
28678
28679 <div>foo</div>
28680 <nowiki> </nowiki><span>bar</span>
28681
28682 <div>
28683 <nowiki> </nowiki><span>foo</span>
28684 </div>
28685 !! end
28686
28687 !! test
28688 Lists: Dont insert newlines in a serialized list item.
28689 !! options
28690 parsoid=html2wt
28691 !! html/parsoid
28692 <ul><li>a<br>b</li><li>c</li></ul>
28693 !! wikitext
28694 * a<br />b
28695 * c
28696 !! end
28697
28698 !! test
28699 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
28700 !! options
28701 parsoid={
28702 "modes": ["html2wt"],
28703 "scrubWikitext": false
28704 }
28705 !! html/parsoid
28706 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28707 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28708
28709 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28710 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28711
28712 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
28713
28714 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28715 !! wikitext
28716 == hello there [[Category:A1]] ==
28717
28718 == [[Category:A2]] hi pal ==
28719
28720 == <!--foo--> [[Category:A3]] how goes it ==
28721
28722 == it goes well [[Category:A4]] <!--bar--> ==
28723
28724 ==howdy [[Category:A5]]==
28725
28726 == __TOC__ ok ==
28727 !! end
28728
28729 !! test
28730 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
28731 !! options
28732 parsoid={
28733 "modes": ["html2wt"],
28734 "scrubWikitext": true
28735 }
28736 !! html/parsoid
28737 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28738 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28739
28740 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28741 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28742
28743 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28744 !! wikitext
28745 == hello there ==
28746 [[Category:A1]]
28747 [[Category:A2]]
28748
28749 == hi pal ==
28750
28751 <!--foo-->[[Category:A3]]
28752
28753 == how goes it ==
28754
28755 == it goes well ==
28756 [[Category:A4]] <!--bar-->
28757
28758 __TOC__
28759
28760 == ok ==
28761 !! end
28762
28763 !! test
28764 Headings: Don't hoist metas that come from templates
28765 !! options
28766 parsoid={
28767 "modes": ["html2wt"],
28768 "scrubWikitext": true
28769 }
28770 !! html/parsoid
28771 <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>
28772 !! wikitext
28773 == {{echo|foo [[Category:Foo]]}} ==
28774 !! end
28775
28776 !! test
28777 Headings: Category in ref isn't hoisted
28778 !! options
28779 parsoid={
28780 "modes": ["html2wt"],
28781 "scrubWikitext": true
28782 }
28783 !! html/parsoid
28784 <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>
28785
28786 <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>
28787 !! wikitext
28788 == foo <ref>bar
28789 [[Category:Baz]] </ref> ==
28790
28791 <references />
28792 !! end
28793
28794 !! test
28795 Parsoid: Serialize positional parameters with = in them as named parameter
28796 !! options
28797 parsoid=html2wt
28798 !! html/parsoid
28799 <p about="#mwt1" typeof="mw:Transclusion"
28800 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
28801
28802 <p about="#mwt1" typeof="mw:Transclusion"
28803 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
28804
28805 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28806 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28807 <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>
28808 !! wikitext
28809 {{echo|1=f=oo}}
28810
28811 {{echo|1=f=oo|2=bar}}
28812
28813 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28814 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28815 {{echo|<nowiki>f=oo</nowiki>|bar}}
28816 !! end
28817
28818 !! test
28819 Parsoid: Serialize positional parameters with = in extlink as named parameter
28820 !! options
28821 parsoid=html2wt
28822 !! html/parsoid
28823 <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>
28824 !! wikitext
28825 {{echo|1=http://stuff?is=ok}}
28826 !! end
28827
28828 !! test
28829 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
28830 !! options
28831 parsoid=html2wt
28832 !! html/parsoid
28833 <div>a<p>b</p></div>
28834 <div>a
28835 <p>b</p></div>
28836 <div>
28837 a
28838 <p>b</p></div>
28839 !! wikitext
28840 <div>a
28841 b
28842 </div>
28843 <div>a
28844 b
28845 </div>
28846 <div>
28847 a
28848
28849 b
28850 </div>
28851 !! end
28852
28853 !! test
28854 Substrings resembling wikitext in hrefs should not get nowiki escapes
28855 !! options
28856 parsoid=html2wt
28857 !! html/parsoid
28858 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
28859 !! wikitext
28860 [[Foo''bar''baz]]
28861 !! end
28862
28863 !! test
28864 Enforce single-line context in the serializer
28865 !! options
28866 parsoid=html2wt
28867 !! html/parsoid
28868 <h2>testing
28869 123</h2>
28870
28871 <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">
28872 </span><span about="#mwt1">you</span> </h2>
28873
28874 <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>
28875
28876 <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
28877 there</span></li></ol>
28878
28879 <ul><li>asd
28880 sdf</li></ul>
28881
28882 <ul><li>foo
28883 bar
28884 baz</li>
28885 <li>foo <b>bar</b>
28886 baz</li></ul>
28887
28888 <dl><dt>hi
28889 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
28890 ho</dd></dl>
28891
28892 <dl><dd> <table>
28893 <tbody><tr><td> ha
28894 ha
28895 ha</td></tr>
28896 </tbody></table></dd></dl>
28897 !! wikitext
28898 == testing 123 ==
28899
28900 == hi {{bogus|there
28901 you}} ==
28902
28903 == foo <ref>hello
28904 there</ref> ==
28905
28906 <references />
28907
28908 * asd sdf
28909
28910 * foo bar baz
28911 * foo '''bar''' baz
28912
28913 ; hi ho : hi ho
28914
28915 : {|
28916 | ha
28917 ha
28918 ha
28919 |}
28920 !! end
28921
28922 !! test
28923 Serialize new placeholder space without spans
28924 !! options
28925 parsoid=html2wt
28926 !! html/parsoid
28927 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
28928
28929 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
28930
28931 <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>
28932 !! wikitext
28933 foo : bar
28934
28935 foo : bar
28936
28937 <ref>foo : bar</ref>ok
28938 !! end
28939
28940
28941 #-----------------------
28942 # Tag minimization tests
28943 #-----------------------
28944
28945 !! test
28946 1. I/B quote minimization: wikitext-only tags should be combined
28947 !! options
28948 parsoid=html2wt
28949 !! html/parsoid
28950 <p><i>A</i><i>B</i></p>
28951 <p><b>A</b><b>B</b></p>
28952 <p><i>A</i><b><i>B</i></b></p>
28953 <p><b>A</b><i><b>B</b></i></p>
28954 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
28955 <p><i><b>A</b></i><i><b>B</b></i></p>
28956 <p><i><b>A</b></i><b><i>B</i></b></p>
28957 <p><b><i>A</i></b><i><b>B</b></i></p>
28958 !! wikitext
28959 ''AB''
28960
28961 '''AB'''
28962
28963 ''A'''B'''''
28964
28965 '''A''B'''''
28966
28967 '''A''BC''D'''
28968
28969 '''''AB'''''
28970
28971 '''''AB'''''
28972
28973 '''''AB'''''
28974 !! end
28975
28976 !! test
28977 2. I/B quote minimization: wikitext and html tags should not be combined
28978 !! options
28979 parsoid=html2wt
28980 !! html/parsoid
28981 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
28982 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
28983 !! wikitext
28984 ''A''<i>B</i>
28985
28986 ''A''<nowiki/>'''<i>B</i>'''
28987 !! end
28988
28989 !! test
28990 3. I/B quote minimization: templated content stops minimization
28991 !! options
28992 parsoid=html2wt
28993 !! html/parsoid
28994 <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>
28995 <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>
28996 !! wikitext
28997 ''A''{{echo|''B''}}
28998
28999 ''A''{{echo|'''''B'''''}}
29000 !! end
29001
29002 !! test
29003 4. I/B quote minimization: new content should be mimimized with adjacent old content
29004 !! options
29005 parsoid=html2wt
29006 !! html/parsoid
29007 <p><i>A</i><i>B</i></p>
29008 <p><b>A</b><b>B</b></p>
29009 <p><i>A</i><b><i>B</i></b></p>
29010 !! wikitext
29011 ''AB''
29012
29013 '''AB'''
29014
29015 ''A'''B'''''
29016 !! end
29017
29018 !! test
29019 5a. Merge adjacent quote nodes if they've been edited
29020 !! options
29021 parsoid={
29022 "modes": ["wt2wt", "selser"],
29023 "changes": [
29024 ["p", "contents", "remove", ":contains('b')"]
29025 ]
29026 }
29027 !! wikitext
29028 ''a''b''c''
29029 !! wikitext/edited
29030 ''ac''
29031 !! end
29032
29033 !! test
29034 5b. Merge adjacent quote nodes if they've been edited
29035 !! options
29036 parsoid={
29037 "modes": ["wt2wt", "selser"],
29038 "changes": [
29039 ["#x", "remove"]
29040 ]
29041 }
29042 !! wikitext
29043 ''a''<span id="x">b</span>''c''
29044 !! wikitext/edited
29045 ''ac''
29046 !! end
29047
29048 !! test
29049 1. Merge adjacent link nodes as long as at least one element is new
29050 !! options
29051 parsoid={
29052 "modes": ["html2wt"],
29053 "scrubWikitext": true
29054 }
29055 !! html/parsoid
29056 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29057 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29058 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
29059 !! wikitext
29060 [[Football]]
29061 [[Football]]
29062 [[Football|Foot]][[Football|ball]]
29063 !! end
29064
29065 !! test
29066 2. Merge adjacent link nodes and enable additional normalizations
29067 !! options
29068 parsoid={
29069 "modes": ["html2wt"],
29070 "scrubWikitext": true
29071 }
29072 !! html/parsoid
29073 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
29074 !! wikitext
29075 ''[[Football]]''
29076 !! end
29077
29078 !! test
29079 3. Don't merge adjacent link nodes if scrubWikitext is false
29080 !! options
29081 parsoid={
29082 "modes": ["html2wt"],
29083 "scrubWikitext": false
29084 }
29085 !! html/parsoid
29086 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29087 !! wikitext
29088 [[Football|Foot]][[Football|ball]]
29089 !! end
29090
29091 !! test
29092 1. Move format tags outside of WikiLink
29093 !! options
29094 parsoid={
29095 "modes": ["html2wt"],
29096 "scrubWikitext": true
29097 }
29098 !! html/parsoid
29099 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
29100 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
29101 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
29102 !! wikitext
29103 ''[[Football]]''
29104 '''''[[Football]]'''''
29105 <u>'''''[[Football]]'''''</u>
29106 !! end
29107
29108 !! test
29109 2. Move format tags outside of WikiLink with mergable A tags
29110 !! options
29111 parsoid={
29112 "modes": ["html2wt"],
29113 "scrubWikitext": true
29114 }
29115 !! html/parsoid
29116 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
29117 !! wikitext
29118 '''''[[Football]]'''''
29119 !! end
29120
29121 !! test
29122 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
29123 !! options
29124 parsoid={
29125 "modes": ["html2wt"],
29126 "scrubWikitext": true
29127 }
29128 !! html/parsoid
29129 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
29130 !! wikitext
29131 <font color="red"><u>'''[[Foo]]'''</u></font>
29132 !! end
29133
29134 !! test
29135 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
29136 !! options
29137 parsoid={
29138 "modes": ["html2wt"],
29139 "scrubWikitext": true
29140 }
29141 !! html/parsoid
29142 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
29143 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
29144 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
29145 !! wikitext
29146 [[Foo|<font color="red">Foo</font>]]
29147 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
29148 [[Foo|<span class="Bar">Foo</span>]]
29149 !! end
29150
29151 !! test
29152 5. T194083 Regression test: Manual edit test that also enables scrubWikitext to move format tags outside wikilinks
29153 !! options
29154 parsoid={
29155 "modes": ["selser"],
29156 "scrubWikitext": true,
29157 "changes": [
29158 ["a", "html", "<i>Foo</i>"]
29159 ]
29160 }
29161 !! wikitext
29162 [[Foo]]
29163 !! wikitext/edited
29164 ''[[Foo]]''
29165 !! end
29166
29167 !! test
29168 6. Regression test: Manual edit test to ensure diff markers are not lost
29169 !! options
29170 parsoid={
29171 "modes": ["selser"],
29172 "scrubWikitext": true,
29173 "changes": [
29174 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
29175 ]
29176 }
29177 !! wikitext
29178 ''Foo''
29179 !! wikitext/edited
29180 ''[[Foo]]''
29181 !! end
29182
29183 !! test
29184 7. T194083 Regression test: Manual edit test to ensure nested diff markers aren't inserted
29185 !! options
29186 parsoid={
29187 "modes": ["selser"],
29188 "scrubWikitext": true,
29189 "changes": [
29190 ["div", "after", "\n<p><a href='./Foo' rel='mw:WikiLink'>Foo </a>, placeholder</p>"]
29191 ]
29192 }
29193 !! wikitext
29194 <div>placeholder</div>
29195 !! wikitext/edited
29196 <div>placeholder</div>
29197 [[Foo]] , placeholder
29198 !! end
29199
29200 #------------------------------
29201 # End of tag minimization tests
29202 #------------------------------
29203
29204 !!test
29205 T56262: New entities
29206 !! options
29207 parsoid=html2wt
29208 !! html/parsoid
29209 <span typeof="mw:Entity">&nbsp;</span>
29210 !! wikitext
29211 &nbsp;
29212 !! end
29213
29214 ## Note that there is no wikitext output for 'unknownproperty' ##
29215 ## Unknown magic words are silently dropped ##
29216
29217 !! test
29218 Magic words
29219 !! options
29220 parsoid=html2wt
29221 !! html/parsoid
29222 <meta property='mw:PageProp/toc' />
29223 <meta property='mw:PageProp/notoc' />
29224 <meta property='mw:PageProp/forcetoc' />
29225 <meta property='mw:PageProp/index' />
29226 <meta property='mw:PageProp/noindex' />
29227 <meta property='mw:PageProp/nogallery' />
29228 <meta property='mw:PageProp/noeditsection' />
29229 <meta property='mw:PageProp/notitleconvert' />
29230 <meta property='mw:PageProp/nocontentconvert' />
29231 <meta property='mw:PageProp/unknownproperty' />
29232 !! wikitext
29233 __TOC__
29234 __NOTOC__
29235 __FORCETOC__
29236 __INDEX__
29237 __NOINDEX__
29238 __NOGALLERY__
29239 __NOEDITSECTION__
29240 __NOTITLECONVERT__
29241 __NOCONTENTCONVERT__
29242 !! end
29243
29244 !! test
29245 Consecutive <pre>s should not get merged
29246 !! options
29247 parsoid=html2wt,html2html
29248 !! html/parsoid
29249 <pre>a</pre><pre>b</pre>
29250
29251 <pre>c
29252 </pre><pre>
29253 d</pre>
29254
29255 <pre>e
29256
29257 </pre><pre>
29258
29259 f</pre>
29260 !! wikitext
29261 a
29262
29263 b
29264
29265 c
29266
29267 d
29268
29269 e
29270
29271
29272
29273 f
29274 !! end
29275
29276 !! test
29277 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
29278 !! options
29279 parsoid=html2wt
29280 !! html/parsoid
29281 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
29282 !! wikitext
29283 [[Special:BookSources/1234567890|ISBN 1234567895]]
29284 !! end
29285
29286 !! test
29287 Edited RFC links not serializable as RFC links should serialize as extlinks
29288 !! options
29289 parsoid=html2wt
29290 !! html/parsoid
29291 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
29292 !! wikitext
29293 [https://tools.ietf.org/html/rfc123 New RFC]
29294 !! end
29295
29296 !! test
29297 Edited PMID links not serializable as PMID links should serialize as extlinks
29298 !! options
29299 parsoid=html2wt
29300 !! html/parsoid
29301 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
29302 !! wikitext
29303 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
29304 !! end
29305
29306 !! test
29307 WTS of autolinks with trailing/surrounding context
29308 !! options
29309 parsoid=html2wt
29310 !! html/parsoid
29311 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
29312 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
29313 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
29314 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
29315 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
29316 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
29317 !! wikitext
29318 http://cscott.net'''foo'''
29319
29320 http://cscott.net<b>foo</b>
29321
29322 '''http://cscott.net'''
29323
29324 '''http://cscott.net '''
29325
29326 '''http://cscott.net<nowiki/>x'''
29327
29328 http://cscott.net<nowiki/>x
29329 !! end
29330
29331 !! test
29332 WTS of autolinks with nowikis (round-trip)
29333 !! wikitext
29334 x<nowiki/>http://cscott.net<nowiki/>x
29335 !! html/parsoid
29336 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
29337 !! end
29338
29339 # this is the "easy" test because it leaves in place all the
29340 # data-parsoid information indicating this is an autolink
29341 !! test
29342 WTS of autolinks with escapes (editing)
29343 !! options
29344 parsoid={
29345 "modes": ["wt2wt"],
29346 "changes": [
29347 [ "span", "remove" ]
29348 ]
29349 }
29350 !! wikitext
29351 x<nowiki/>http://cscott.net<nowiki/>x
29352 !! wikitext/edited
29353 x<nowiki/>http://cscott.net<nowiki/>x
29354 !! end
29355
29356 !! test
29357 WTS of edited autolink-like text (T103364)
29358 !! options
29359 parsoid={
29360 "modes": ["wt2wt"],
29361 "changes": [
29362 [ "span[typeof]", "removeAttr", "typeof" ]
29363 ]
29364 }
29365 !! wikitext
29366 Not a link: <nowiki>http://example.com</nowiki>.
29367 !! wikitext/edited
29368 Not a link: <span><nowiki>http://example.com</nowiki></span>.
29369 !! end
29370
29371 !! test
29372 WTS of newly-authored autolink-like text (T103364)
29373 !! options
29374 parsoid=html2wt
29375 !! html/parsoid
29376 <p>http://example.com is not a link.</p>
29377 !! wikitext
29378 <nowiki>http://example.com</nowiki> is not a link.
29379 !! end
29380
29381 !! test
29382 WTS of autolink-like text after an autolink (T108563)
29383 !! options
29384 parsoid=html2wt
29385 !! html/parsoid
29386 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
29387 !! wikitext
29388 http://example.com <nowiki>http://example.com</nowiki> is not a link.
29389 !! end
29390
29391 !! test
29392 Magic links inside links (not autolinked)
29393 !! wikitext
29394 [[Foo|http://example.com]]
29395 [[Foo|RFC 1234]]
29396 [[Foo|PMID 1234]]
29397 [[Foo|ISBN 123456789x]]
29398
29399 [http://foo.com http://example.com]
29400 [http://foo.com RFC 1234]
29401 [http://foo.com PMID 1234]
29402 [http://foo.com ISBN 123456789x]
29403 !! html+tidy
29404 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
29405 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
29406 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
29407 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
29408 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
29409 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
29410 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
29411 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
29412 </p>
29413 !! html/parsoid
29414 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
29415 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
29416 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
29417 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
29418
29419 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
29420 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
29421 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
29422 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
29423 !! end
29424
29425 !! test
29426 Magic links inside image captions (autolinked)
29427 !! wikitext
29428 [[File:Foobar.jpg|thumb|http://example.com]]
29429 [[File:Foobar.jpg|thumb|RFC 1234]]
29430 [[File:Foobar.jpg|thumb|PMID 1234]]
29431 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
29432 !! html+tidy
29433 <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>
29434 <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>
29435 <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>
29436 <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>
29437 !! html/parsoid
29438 <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>
29439 <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>
29440 <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>
29441 <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>
29442 !! end
29443
29444 !! test
29445 WTS of magic word text (T109371)
29446 !! options
29447 parsoid=html2wt
29448 !! html/parsoid
29449 <p>RFC 1234</p>
29450 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
29451 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
29452 !! wikitext
29453 <nowiki>RFC 1234</nowiki>
29454
29455 [http://foo.com RFC 1234]
29456
29457 [[Foo|RFC 1234]]
29458 !! end
29459
29460 !! test
29461 Edited Redirect link should emit a non-piped wikitext link
29462 !! options
29463 parsoid=html2wt
29464 !! html/parsoid
29465 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
29466 !! wikitext
29467 #REDIRECT [[Bar]]
29468 !! end
29469
29470 !! test
29471 T75121: Infer extension name from typeOf if data-mw is not present
29472 !! options
29473 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29474 !! html/parsoid
29475 <div typeOf="mw:Extension/foo"></div>
29476 !! wikitext
29477 <foo />
29478 !! end
29479
29480 # Note that the <p> wrapping isn't present in PHP parser output
29481 # The important thing for this test is that P-wrapping doesn't
29482 # interfere with the <nowiki> protection for leading - in <td>
29483 # (which isn't necessary for <th>).
29484 !! test
29485 T88318: p-wrapped dash in table.
29486 !! options
29487 parsoid=html2wt,wt2wt
29488 !! html/parsoid
29489 <table><tbody>
29490 <tr><th><p>-</p></th><th><p>- </p></th></tr>
29491 <tr><td><p>-</p></td><td><p>- </p></td></tr>
29492 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
29493 </tbody></table>
29494 !! wikitext
29495 {|
29496 !-
29497 !-
29498 |-
29499 |<nowiki>-</nowiki>
29500 |<nowiki>- </nowiki>
29501 |-
29502 |<small>-</small>
29503 |<br />
29504 -
29505 |<br />-
29506 |}
29507 !! html/php+tidy
29508 <table>
29509 <tbody><tr>
29510 <th>-
29511 </th>
29512 <th>-
29513 </th></tr>
29514 <tr>
29515 <td>-
29516 </td>
29517 <td>-
29518 </td></tr>
29519 <tr>
29520 <td><small>-</small>
29521 </td>
29522 <td><br />
29523 <p>-
29524 </p>
29525 </td>
29526 <td><br />-
29527 </td></tr></tbody></table>
29528 !! end
29529
29530 !! test
29531 T149209: WTS: Handle newlines in table cells properly
29532 !! options
29533 parsoid=html2wt
29534 !! html/parsoid
29535 <table>
29536 <tbody>
29537 <tr><td>a
29538 b
29539 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
29540 <tr><td><p>x</p>
29541 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
29542 </tbody></table>
29543 <table>
29544 <tbody>
29545 <tr><th>a
29546 b
29547 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
29548 <tr><th><p>x</h>
29549 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
29550 </tbody></table>
29551 !! wikitext
29552 {|
29553 |a
29554 b
29555 |c
29556 |-
29557 |x
29558 {{!}}y
29559 |}
29560 {|
29561 !a
29562 b
29563 !c
29564 |-
29565 !x
29566 !y
29567 |}
29568 !! end
29569
29570 !! test
29571 T149209: Selser: Handle newlines in table cells properly
29572 !! options
29573 parsoid={
29574 "modes": ["selser"],
29575 "changes": [
29576 [ "#h1", "html", "a\nb\n" ],
29577 [ "#h2", "html", "a\nb\n" ],
29578 [ "#c1", "html", "a\nb\n" ],
29579 [ "#c2", "html", "<p>a</p>" ],
29580 [ "#c3", "html", "<p>a</p>" ],
29581 [ "#c4", "html", "edit-me<p>a</p>" ]
29582 ]
29583 }
29584 !! wikitext
29585 {|
29586 ! id="h1" |edit-me!!1
29587 |-
29588 ! id="h2" |edit-me||2
29589 |-
29590 | id="c1" |edit-me||3
29591 |-
29592 | id="c2" |edit-me||4
29593 |-
29594 | id="c3" |edit-me||p||q||r
29595 |-
29596 | id="c4" |edit-me||p||q||r
29597 |}
29598 !! wikitext/edited
29599 {|
29600 ! id="h1" |a
29601 b
29602 !1
29603 |-
29604 ! id="h2" |a
29605 b
29606 !2
29607 |-
29608 | id="c1" |a
29609 b
29610 |3
29611 |-
29612 | id="c2" |a
29613 |4
29614 |-
29615 | id="c3" |a
29616 |p||q||r
29617 |-
29618 | id="c4" |edit-me
29619 a
29620 |p||q||r
29621 |}
29622 !! end
29623
29624 !! test
29625 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
29626 !! options
29627 parsoid=html2wt
29628 !! html/parsoid
29629 <table id='mwAb'>
29630 <td id='mwAc'>foo</td>
29631 <td id='serialize-this'>bar</td>
29632 </table>
29633 !! wikitext
29634 {|
29635 |foo
29636 | id="serialize-this" |bar
29637 |}
29638 !! end
29639
29640 !! test
29641 Parsoid-like element ids should not be serialized to wikitext unless shadowed
29642 !! options
29643 parsoid=html2wt
29644 !! html/parsoid
29645 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
29646 !! wikitext
29647 <div id="hello">ok</div>
29648 !! end
29649
29650 !! test
29651 Testing serialization after deletion in references
29652 !! options
29653 parsoid={
29654 "modes": ["wt2wt"],
29655 "changes": [
29656 ["#x", "remove"]
29657 ]
29658 }
29659 !! wikitext
29660 hi <ref><div id="x">ho</div></ref>
29661
29662 <references />
29663 !! wikitext/edited
29664 hi <ref></ref>
29665
29666 <references />
29667 !! end
29668
29669 !!test
29670 Testing serialization after deletion of table cells
29671 !!options
29672 parsoid={
29673 "modes": ["wt2wt", "selser"],
29674 "changes": [
29675 ["#x", "remove"]
29676 ]
29677 }
29678 !!wikitext
29679 {|
29680 !h1 !!h2 !!h3
29681 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
29682 |}
29683 !! wikitext/edited
29684 {|
29685 !h1!!h2!!h3
29686 |c2|||c3
29687 |}
29688 !!end
29689
29690 !! test
29691 Testing selser after addition of new row before first row (T125419)
29692 !! options
29693 parsoid={
29694 "modes": ["wt2wt", "selser"],
29695 "changes": [
29696 [ "tr", "before", "<tr><td>X</td></tr>" ]
29697 ]
29698 }
29699 !! wikitext
29700 {|
29701 |a
29702 |}
29703 !! wikitext/edited
29704 {|
29705 |X
29706 |-
29707 |a
29708 |}
29709 !! end
29710
29711 !! test
29712 Serialize new table rows in a HTML table using HTML tags
29713 !! options
29714 parsoid={
29715 "modes": ["wt2wt", "selser"],
29716 "changes": [
29717 [ "tr", "before", "<tr><td>X</td></tr>" ]
29718 ]
29719 }
29720 !! wikitext
29721 <table><tr><td>a</td></tr></table>
29722 !! wikitext/edited
29723 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
29724 !! end
29725
29726 !! test
29727 Serialize new table cells in a HTML row using HTML tags
29728 !! options
29729 parsoid={
29730 "modes": ["wt2wt", "selser"],
29731 "changes": [
29732 [ "td", "before", "<td>X</td>" ]
29733 ]
29734 }
29735 !! wikitext
29736 <table><tr><td>a</td></tr></table>
29737 !! wikitext/edited
29738 <table><tr><td>X</td><td>a</td></tr></table>
29739 !! end
29740
29741 !! test
29742 Serialize wikitext list items as HTML list items when embedded in a HTML list
29743 !! options
29744 parsoid=html2wt
29745 !! html/parsoid
29746 <ul data-parsoid='{"stx": "html"}'>
29747 <li data-parsoid='{}'>a</li>
29748 <li>b</li>
29749 </ul>
29750 !! wikitext
29751 <ul>
29752 <li>a</li>
29753 <li>b</li>
29754 </ul>
29755 !! html/php+tidy
29756 <ul>
29757 <li>a</li>
29758 <li>b</li>
29759 </ul>
29760 !! end
29761
29762 # Nested list should be inside <li>, that is
29763 # <ul><li>foo<ul>..</ul></li></ul> instead of
29764 # <ul><li>foo</li><ul>..</ul></ul>
29765 # See https://stackoverflow.com/questions/5899337/proper-way-to-make-html-nested-list
29766 !! test
29767 Wikitext lists can be nested inside HTML lists
29768 !! options
29769 parsoid=html2wt
29770 !! html/parsoid
29771 <ul data-parsoid='{"stx": "html"}'>
29772 <li data-parsoid='{"stx": "html"}'>a
29773 <ul><li>b</li></ul>
29774 </li>
29775 </ul>
29776
29777 <ul data-parsoid='{"stx": "html"}'>
29778 <li>x
29779 <ul><li>y</li></ul>
29780 </li>
29781 </ul>
29782 !! wikitext
29783 <ul>
29784 <li>a
29785 * b
29786 </li>
29787 </ul>
29788
29789 <ul>
29790 <li>x
29791 * y
29792 </li>
29793 </ul>
29794 !! html/php+tidy
29795 <ul>
29796 <li>a
29797 <ul><li>b</li></ul>
29798 </li>
29799 </ul>
29800 <ul>
29801 <li>x
29802 <ul><li>y</li></ul>
29803 </li>
29804 </ul>
29805 !! end
29806
29807 !! test
29808 WTS change modes
29809 !! options
29810 parsoid={
29811 "modes": ["wt2wt"],
29812 "changes": [
29813 [ "#xyz", "before", "<b>before</b> stuff " ],
29814 [ "#xyz", "after", " stuff <i>after</i>" ],
29815 [ "#xyz", "html", "x <b>y</b> z" ]
29816 ]
29817 }
29818 !! wikitext
29819 <span id="xyz">hello</span>
29820 !! wikitext/edited
29821 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
29822 !! end
29823
29824 !! test
29825 Never serialize a-tag as html, regardless of what data-parsoid has to say
29826 !! options
29827 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29828 !! html/parsoid
29829 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
29830 !! wikitext
29831 [[Foo]]
29832 !! end
29833
29834 ## SSS FIXME: This is broken output nevertheless.
29835 ## What might be a reasonable non-broken output for this?
29836 ## This is an edge case unlikely to be seen in production
29837 ## that I am not wasting more time on this right now.
29838 !! test
29839 Never serialize a-tag as html, no matter what attributes it has
29840 !! options
29841 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29842 !! html/parsoid
29843 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
29844 !! wikitext
29845 [http://boo.org http://boohoo.org]
29846 !! end
29847
29848 # Misnested is an indication that selser can reuse the source but these have
29849 # shown to sneak through on occasion. See T101768.
29850 # The original wikitext here is: [http://test.com [[one]] two three]
29851 !! test
29852 Strip span tags added to mark misnested links
29853 !! options
29854 parsoid=html2wt
29855 !! html/parsoid
29856 <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>
29857 !! wikitext
29858 [http://test.com][[one]] two three
29859 !! end
29860
29861 !! test
29862 Catch regression when unpacking misnested links
29863 !! options
29864 parsoid=wt2html
29865 !! wikitext
29866 {{echo|hi}}[http://example.com [[ho]]]
29867 !! html/parsoid
29868 <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>
29869 !! end
29870
29871 !! test
29872 Catch regression when unpacking with trailing content
29873 !! wikitext
29874 {{echo|Foo <references/> bar}}
29875 !! html/parsoid
29876 <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>
29877 !! end
29878
29879 !! test
29880 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
29881 !! options
29882 parsoid=html2wt
29883 !! html/parsoid
29884 <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|}"]}'>
29885 <tbody><tr><td>d
29886 </td></tr>
29887 </tbody></table>
29888 !! wikitext
29889 {{echo|a}}
29890 {|{{echo|c
29891 {{!}}d
29892 }}
29893 |}
29894 !! end
29895
29896 ## This test verifies the presence and computation of this attribute indirectly
29897 ## by making an edit and ensuring that the serialization is correct (which it would be
29898 ## only if firstWikitextNode is properly set).
29899 !! test
29900 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
29901 !! options
29902 parsoid= {
29903 "modes": ["wt2wt"],
29904 "changes": [
29905 [ "div#x", "remove" ],
29906 [ "div", "before", "<div>new</div>" ]
29907 ]
29908 }
29909 !! wikitext
29910 <div id="x">foo</div>
29911 {|
29912 {{echo|<div>boo</div>
29913 {{!}}b}}
29914 |c
29915 |}
29916 !! wikitext/edited
29917
29918 <div>new</div>
29919 {|
29920 {{echo|<div>boo</div>
29921 {{!}}b}}
29922 |c
29923 |}
29924 !! end
29925
29926 # --------------------------------------------
29927 # Tests spec'ing wikitext serialization norms |
29928 # --------------------------------------------
29929
29930 !! test
29931 Serialize multi-line indent-pre starting with wikitext syntax
29932 !! options
29933 parsoid=html2wt
29934 !! html/parsoid
29935 <pre>* 1
29936 ** 2
29937 * 3</pre>
29938 !! wikitext
29939 * 1
29940 ** 2
29941 * 3
29942 !! end
29943
29944 !! test
29945 1. Categories should always be serialized on their own line
29946 !! options
29947 parsoid=html2wt
29948 !! html/parsoid
29949 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
29950 !! wikitext
29951 foo
29952 [[Category:Foo]]
29953 bar
29954 !! end
29955
29956 !! test
29957 2. Categories that are part of templates should not introduce a line break
29958 !! wikitext
29959 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
29960 !! html/parsoid
29961 <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>
29962 !! end
29963
29964 # Careful while editing these next 2 tests. There are \u200f characters
29965 # before and after the <link> tags in the HTML and following some
29966 # of the categories in wikitext
29967 # Do not remove these characters in edits.
29968 #
29969 # As part of the serialization, these bidi characters will get stripped.
29970 !! test
29971 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
29972 !! options
29973 parsoid={
29974 "modes": ["html2wt"],
29975 "scrubWikitext": true
29976 }
29977 !! html/parsoid
29978 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
29979 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
29980 !! wikitext
29981 [[קטגוריה:טקסים]]
29982 [[קטגוריה: שיטות משפט]]
29983 !! end
29984
29985 !! test
29986 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
29987 !! options
29988 parsoid={
29989 "modes": ["html2wt"],
29990 "scrubWikitext": true
29991 }
29992 !! html/parsoid
29993 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
29994 !! wikitext
29995 [[קטגוריה:טקסים]]
29996 ‏y
29997 !! end
29998
29999 !! test
30000 Lists: Add space after bullets
30001 !! options
30002 parsoid=html2wt
30003 !! html/parsoid
30004 <ul>
30005 <li>foo</li>
30006 <li> bar</li>
30007 <li><span> baz</span></li>
30008 </ul>
30009 !! wikitext
30010 * foo
30011 * bar
30012 * <span> baz</span>
30013 !! end
30014
30015 !! test
30016 1. Headings: Add space before/after == (T53744)
30017 !! options
30018 parsoid=html2wt
30019 !! html/parsoid
30020 <h2>foo</h2>
30021 <h2> bar</h2>
30022 <h2>baz </h2>
30023 <h2><span> baz</span></h2>
30024 !! wikitext
30025 == foo ==
30026
30027 == bar ==
30028
30029 == baz ==
30030
30031 == <span> baz</span> ==
30032 !! end
30033
30034 !! test
30035 2. Headings: Add space before/after == even after hoisted content
30036 !! options
30037 parsoid={
30038 "modes": ["html2wt"],
30039 "scrubWikitext": true
30040 }
30041 !! html/parsoid
30042 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
30043 !! wikitext
30044 [[Category:A2]]
30045
30046 == ok ==
30047 !! end
30048
30049 !! test
30050 1. Headings: suppress newly created empty headings
30051 !! options
30052 parsoid={
30053 "modes": ["html2wt"],
30054 "scrubWikitext": true
30055 }
30056 !! html/parsoid
30057 <h2></h2>
30058 !! wikitext
30059 !! end
30060
30061 !! test
30062 2. Headings: don't suppress empty headings if scrubWikitext is false
30063 !! options
30064 parsoid=html2wt
30065 !! html/parsoid
30066 <h2></h2>
30067 !! wikitext
30068 ==<nowiki/>==
30069 !! end
30070
30071 !! test
30072 3. Headings: suppress empty headings on edits
30073 !! options
30074 parsoid={
30075 "modes": ["selser"],
30076 "scrubWikitext": true,
30077 "changes": [
30078 [ "#x", "remove"]
30079 ]
30080 }
30081 !! wikitext
30082 ==<span id="x">foo</span>==
30083 !! wikitext/edited
30084 !! end
30085
30086 !! test
30087 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
30088 !! options
30089 parsoid={
30090 "modes": ["html2wt"],
30091 "scrubWikitext": true
30092 }
30093 !! html/parsoid
30094 <h2>foo<br/>bar</h2>
30095 <h2>foo <span><br/>bar</span> baz</h2>
30096 !! wikitext
30097 == foo bar ==
30098
30099 == foo <span> bar</span> baz ==
30100 !! end
30101
30102 !! test
30103 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
30104 !! options
30105 parsoid={
30106 "modes": ["html2wt"],
30107 "scrubWikitext": false
30108 }
30109 !! html/parsoid
30110 <h2>foo<br/>bar</h2>
30111 !! wikitext
30112 == foo<br />bar ==
30113 !! end
30114
30115 !! test
30116 1. WT Quote Tags: suppress newly created empty style tags
30117 !! options
30118 parsoid={
30119 "modes": ["html2wt"],
30120 "scrubWikitext": true
30121 }
30122 !! html/parsoid
30123 <i></i><b></b>
30124 !! wikitext
30125 !! end
30126
30127 !! test
30128 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
30129 !! options
30130 parsoid=html2wt
30131 !! html/parsoid
30132 <i></i><b></b>
30133 !! wikitext
30134 ''<nowiki/>'''''<nowiki/>'''
30135 !! end
30136
30137 !! test
30138 3. WT Quote Tags: suppress empty style tags on edits
30139 !! options
30140 parsoid={
30141 "modes": ["selser"],
30142 "scrubWikitext": true,
30143 "changes": [
30144 [ "#x", "remove"]
30145 ]
30146 }
30147 !! wikitext
30148 '''<span id="x">foo</span>'''
30149 !! wikitext/edited
30150 !! end
30151
30152 !! test
30153 1. Anchors: suppress newly created empty anchors
30154 !! options
30155 parsoid={
30156 "modes": ["html2wt"],
30157 "scrubWikitext": true
30158 }
30159 !! html/parsoid
30160 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
30161 !! wikitext
30162 !! end
30163
30164 !! test
30165 2. Anchors: don't suppress empty anchors if scrubWikitext is false
30166 !! options
30167 parsoid={
30168 "modes": ["html2wt"],
30169 "scrubWikitext": false
30170 }
30171 !! html/parsoid
30172 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
30173 !! wikitext
30174 [[Test|<nowiki/>]]
30175 !! end
30176
30177 !! test
30178 3. Anchors: suppress empty anchors on edits
30179 !! options
30180 parsoid={
30181 "modes": ["selser"],
30182 "scrubWikitext": true,
30183 "changes": [
30184 [ "#x", "remove"]
30185 ]
30186 }
30187 !! wikitext
30188 [[Test|<span id="x">foo</span>]]
30189 !! wikitext/edited
30190 !! end
30191
30192 !! test
30193 3a. Anchors: do not suppress numbered extlinks
30194 !! options
30195 parsoid={
30196 "modes": ["wt2wt"],
30197 "scrubWikitext": true
30198 }
30199 !! wikitext
30200 [http://foo.com]
30201 !! html/parsoid
30202 <a rel="mw:ExtLink" href="http://foo.com"></a>
30203 !! end
30204
30205 !! test
30206 3b. Anchors: do not suppress numbered extlinks
30207 !! options
30208 parsoid={
30209 "modes": ["wt2wt"],
30210 "scrubWikitext": true,
30211 "changes": [
30212 [ "#x", "remove"]
30213 ]
30214 }
30215 !! wikitext
30216 [http://foo.com <span id="x">foo</span>]
30217 !! wikitext/edited
30218 [http://foo.com]
30219 !! end
30220
30221 !!test
30222 Normalizations should be restricted to edited content
30223 !!options
30224 parsoid={
30225 "modes": ["selser"],
30226 "scrubWikitext": true,
30227 "changes": [
30228 [ "h1", "before", "<i></i>"]
30229 ]
30230 }
30231 !!wikitext
30232 a
30233 = =
30234 b
30235 !!wikitext/edited
30236 a
30237 = =
30238 b
30239 !!end
30240
30241 !! test
30242 1. Multiple normalizations (html2wt)
30243 !! options
30244 parsoid={
30245 "modes": ["html2wt"],
30246 "scrubWikitext": true
30247 }
30248 !! html/parsoid
30249 <h2><i></i></h2>
30250 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
30251 </a><b><i></i></b>x</p>
30252 !! wikitext
30253
30254 [[foo]]
30255 x
30256 !! end
30257
30258 !! test
30259 2. Multiple normalizations (selser)
30260 !! options
30261 parsoid={
30262 "modes": ["selser"],
30263 "scrubWikitext": true,
30264 "changes": [
30265 [ "#x", "after", "<h1><i></i></h1>\n<p> bar<b></b></p>"]
30266 ]
30267 }
30268 !! wikitext
30269 <div id="x">foo</div>
30270 !! wikitext/edited
30271 <div id="x">foo</div>
30272 bar
30273 !! end
30274
30275 !! test
30276 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
30277 !! options
30278 parsoid={
30279 "modes": ["html2wt"],
30280 "scrubWikitext": true
30281 }
30282 !! html/parsoid
30283 <p> hi</p>
30284 <p> hello</p>
30285 !! wikitext
30286 hi
30287
30288 hello
30289 !! end
30290
30291 !! test
30292 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
30293 !! options
30294 parsoid=html2wt
30295 !! html/parsoid
30296 <p> hi</p>
30297 <p> hello</p>
30298 !! wikitext
30299 <nowiki> </nowiki>hi
30300
30301 <nowiki> </nowiki> hello
30302 !! end
30303
30304 !! test
30305 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
30306 !! options
30307 parsoid={
30308 "modes": ["html2wt"],
30309 "scrubWikitext": true
30310 }
30311 !! html/parsoid
30312 <p>Foo
30313 bar
30314 baz</p>
30315
30316 <table><tr><td>Foo
30317 bar
30318 baz bang</td></tr></table>
30319
30320 <p><!--boo--> foo
30321 bar</p>
30322
30323 <p> foo
30324 bar<span>boo</span></p>
30325 !! wikitext
30326 Foo
30327 bar
30328 baz
30329
30330 {|
30331 |Foo
30332 bar
30333 baz bang
30334 |}
30335
30336 <!--boo-->foo
30337 bar
30338
30339 foo
30340 bar<span>boo</span>
30341 !! end
30342
30343 !! test
30344 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
30345 !! options
30346 parsoid={
30347 "modes": ["selser"],
30348 "scrubWikitext": true,
30349 "changes": [
30350 [ "p", "html", " a\n b" ]
30351 ]
30352 }
30353 !! wikitext
30354 xyz
30355 !! wikitext/edited
30356 a
30357 b
30358 !! end
30359
30360 !! test
30361 1. New links that end in spaces
30362 !! options
30363 parsoid={
30364 "modes": ["html2wt"],
30365 "scrubWikitext": false
30366 }
30367 !! html/parsoid
30368 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30369 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30370 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30371 !! wikitext
30372 [[Berlin ]]<nowiki/>is the capital of Germany.
30373
30374 [[Foo ]]'''bar'''
30375
30376 [[Boston ]] is a city.
30377 !! end
30378
30379 !! test
30380 2. New links that end in spaces
30381 !! options
30382 parsoid={
30383 "modes": ["html2wt"],
30384 "scrubWikitext": true
30385 }
30386 !! html/parsoid
30387 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30388 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30389 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30390 !! wikitext
30391 [[Berlin]] is the capital of Germany.
30392
30393 [[Foo]] '''bar'''
30394
30395 [[Boston]] is a city.
30396 !! end
30397
30398 !! test
30399 1. Table cells with escapable prefixes
30400 !! options
30401 parsoid={
30402 "modes": ["html2wt"],
30403 "scrubWikitext": false
30404 }
30405 !! html/parsoid
30406 <table>
30407 <tr><td>a</td></tr>
30408 <tr><td>-</td></tr>
30409 <tr><td>+</td></tr>
30410 <tr><td>}</td></tr>
30411 </table>
30412 !! wikitext
30413 {|
30414 |a
30415 |-
30416 |<nowiki>-</nowiki>
30417 |-
30418 |<nowiki>+</nowiki>
30419 |-
30420 |<nowiki>}</nowiki>
30421 |}
30422 !! end
30423
30424 !! test
30425 2. Table cells with escapable prefixes
30426 !! options
30427 parsoid={
30428 "modes": ["html2wt"],
30429 "scrubWikitext": true
30430 }
30431 !! html/parsoid
30432 <table>
30433 <tr><td>a</td></tr>
30434 <tr><td>-</td></tr>
30435 <tr><td>+</td></tr>
30436 <tr><td>}</td></tr>
30437 </table>
30438 !! wikitext
30439 {|
30440 |a
30441 |-
30442 | -
30443 |-
30444 | +
30445 |-
30446 | }
30447 |}
30448 !! end
30449
30450 !! test
30451 3a. Table cells with escapable prefixes after edits
30452 !! options
30453 parsoid={
30454 "modes": ["selser"],
30455 "scrubWikitext": true,
30456 "changes": [
30457 [ "table tbody tr:first-child td:first-child", "remove"]
30458 ]
30459 }
30460 !! wikitext
30461 {|
30462 |a||-
30463 |}
30464 !! wikitext/edited
30465 {|
30466 | -
30467 |}
30468 !! end
30469
30470 !! test
30471 3b. Table cells with escapable prefixes after edits
30472 !! options
30473 parsoid={
30474 "modes": ["selser"],
30475 "scrubWikitext": true,
30476 "changes": [
30477 [ "table tbody tr:first-child td:first-child", "html", "-" ],
30478 [ "#x", "remove" ]
30479 ]
30480 }
30481 !! wikitext
30482 {|
30483 |pqr
30484 |<span id="x">foo</span>+
30485 |}
30486 !! wikitext/edited
30487 {|
30488 | -
30489 | +
30490 |}
30491 !! end
30492
30493 # FIXME: This test will fail because
30494 # normalization doesn't realize that the id attribute
30495 # will eliminate the escapable scenario
30496 !! test
30497 4a. Table cells without escapable prefixes after edits
30498 !! options
30499 parsoid={
30500 "modes": ["selser"],
30501 "scrubWikitext": true,
30502 "changes": [
30503 [ "#x", "html", "-" ]
30504 ]
30505 }
30506 !! wikitext
30507 {|
30508 | id="x" |abcd
30509 |}
30510 !! wikitext/edited
30511 {|
30512 | id="x" |-
30513 |}
30514 !! end
30515
30516 ## This tests normalizer's ability to discriminate between
30517 ## cells having identical content.
30518 !! test
30519 4b. Table cells without escapable prefixes after edits
30520 !! options
30521 parsoid={
30522 "modes": ["selser"],
30523 "scrubWikitext": true,
30524 "changes": [
30525 [ "td", "html", "-" ]
30526 ]
30527 }
30528 !! wikitext
30529 {|
30530 |a||b
30531 |}
30532 !! wikitext/edited
30533 {|
30534 | -||-
30535 |}
30536 !! end
30537
30538 ## This tests normalizer's ability to not be tripped by
30539 ## comments (and whitespace)
30540 !! test
30541 4c. Table cells without escapable prefixes after edits
30542 !! options
30543 parsoid={
30544 "modes": ["selser"],
30545 "scrubWikitext": true,
30546 "changes": [
30547 [ "table tbody tr td:first-child", "remove" ]
30548 ]
30549 }
30550 !! wikitext
30551 {|
30552 |-
30553 <!--foo--> |a||-
30554 |}
30555 !! wikitext/edited
30556 {|
30557 |-
30558 <!--foo--> | -
30559 |}
30560 !! end
30561
30562 ## This tests normalizer's ability to handle HTML cells
30563 !! test
30564 4d. Table cells without escapable prefixes after edits
30565 !! options
30566 parsoid={
30567 "modes": ["selser"],
30568 "scrubWikitext": true,
30569 "changes": [
30570 [ "td", "html", "-" ]
30571 ]
30572 }
30573 !! wikitext
30574 <table>
30575 <tr><td>a</td></tr>
30576 </table>
30577 !! wikitext/edited
30578 <table>
30579 <tr><td>-</td></tr>
30580 </table>
30581 !! end
30582
30583 ## T111151 Remove font elements without attributes
30584 !! test
30585 5a. font tags without attributes should be dropped in scrubWikitext mode
30586 !! options
30587 parsoid={
30588 "modes": ["html2wt"],
30589 "scrubWikitext": true
30590 }
30591 !! html/parsoid
30592 <font>foo</font>
30593 <font><font>bar</font></font>
30594 <font class="x">boo</font>
30595 !! wikitext
30596 foo
30597 bar
30598 <font class="x">boo</font>
30599 !! end
30600
30601 !! test
30602 5b. font tags should not be dropped without scrubWikitext being enabled
30603 !! options
30604 parsoid={
30605 "modes": ["html2wt"],
30606 "scrubWikitext": false
30607 }
30608 !! html/parsoid
30609 <font>foo</font>
30610 !! wikitext
30611 <font>foo</font>
30612 !! end
30613
30614 !! test
30615 Ignore empty <p></p> when scrubWikitext is false
30616 !! options
30617 parsoid={
30618 "modes": ["html2wt"],
30619 "scrubWikitext": false
30620 }
30621 !! html/parsoid
30622 <div>1</div>
30623 <p>a</p><p></p><p>b</p>
30624 <div>2</div>
30625 <p>a</p>
30626 <p></p>
30627 <p>b</p>
30628 <div>3</div>
30629 <p>a</p>
30630 <p></p>
30631 <p></p>
30632 <p></p>
30633 <p></p>
30634 <p>b</p>
30635 !! wikitext
30636 <div>1</div>
30637 a
30638
30639 b
30640 <div>2</div>
30641 a
30642
30643 b
30644 <div>3</div>
30645 a
30646
30647 b
30648 !! html/php+tidy
30649 <div>1</div>
30650 <p>a
30651 </p><p>b
30652 </p>
30653 <div>2</div>
30654 <p>a
30655 </p><p>b
30656 </p>
30657 <div>3</div>
30658 <p>a
30659 </p><p>b
30660 </p>
30661 !! end
30662
30663 !! test
30664 Normalize empty paragraphs to HTML form that html2wt expects
30665 !! options
30666 parsoid={
30667 "modes": ["html2wt"],
30668 "scrubWikitext": true
30669 }
30670 !! html/parsoid
30671 <div>1</div>
30672 <p>a</p><p></p><p>b</p>
30673 <div>2</div>
30674 <p>a</p>
30675 <p></p>
30676 <p>b</p>
30677 <div>3</div>
30678 <p>a</p>
30679 <p></p>
30680 <p></p>
30681 <p></p>
30682 <p></p>
30683 <p>b</p>
30684 <div>4</div>
30685 <p>a</p>
30686 <p></p>
30687 <div>foo</div>
30688 !! wikitext
30689 <div>1</div>
30690 a
30691
30692
30693 b
30694 <div>2</div>
30695 a
30696
30697
30698 b
30699 <div>3</div>
30700 a
30701
30702
30703
30704
30705
30706 b
30707 <div>4</div>
30708 a
30709
30710 <br />
30711 <div>foo</div>
30712 !! html/php+tidy
30713 <div>1</div>
30714 <p>a
30715 </p><p><br />
30716 b
30717 </p>
30718 <div>2</div>
30719 <p>a
30720 </p><p><br />
30721 b
30722 </p>
30723 <div>3</div>
30724 <p>a
30725 </p><p><br />
30726 </p><p><br />
30727 </p><p>b
30728 </p>
30729 <div>4</div>
30730 <p>a
30731 </p><p><br />
30732 </p>
30733 <div>foo</div>
30734 !! end
30735
30736 !! test
30737 Empty paragraphs (marked with mw-empty-elt) found in source should not be normalized away
30738 !! options
30739 parsoid={
30740 "modes": ["html2wt"],
30741 "scrubWikitext": true
30742 }
30743 !! html/parsoid
30744 <table>
30745 <tbody>
30746 <tr>
30747 <td><div>foo
30748 </div>
30749 <p class="mw-empty-elt"></p>
30750 </td>
30751 </tr>
30752 </tbody>
30753 <caption></caption>
30754 </table>
30755 !! wikitext
30756 {|
30757 |<div>foo
30758 </div>
30759 |+
30760 |}
30761 !! end
30762
30763 !! test
30764 Templated content should be skipped over by normalization
30765 !! options
30766 parsoid={
30767 "modes": ["html2wt"],
30768 "scrubWikitext": true
30769 }
30770 !! html/parsoid
30771 <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">
30772 </span><p about="#mwt2"></p><span about="#mwt2">
30773 </span>
30774 !! wikitext
30775 {{SomeTemplate1|boo}}{{SomeTemplate2|booboo}}
30776 !! end
30777
30778 !! test
30779 Escape nowiki DOM elements
30780 !! options
30781 parsoid=html2wt
30782 !! html/parsoid
30783 <nowiki><i>foo</i></nowiki>
30784 !! wikitext
30785 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
30786 !! end
30787
30788 # This is meant to be an interim fix while we go about figuring out
30789 # how to not introduce these trailing <nowiki/>s in the first place.
30790 !! test
30791 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
30792 !! options
30793 parsoid=html2wt
30794 !! html/parsoid
30795 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
30796 y</p>
30797 <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>
30798 <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>
30799 !! wikitext
30800 x
30801 y
30802
30803 {{echo|
30804 1 = <nowiki/>}}
30805
30806 {{echo|
30807 1 = <nowiki/>
30808 }}
30809 !! end
30810
30811 !! test
30812 New list is serialized on newlines
30813 !! options
30814 parsoid=html2wt
30815 !! html/parsoid
30816 <p>The quick brown fox jumps over the lazy dog.</p><ul>
30817 <li>Yesterday</li>
30818 <li>Today</li>
30819 <li>Tomorrow</li>
30820 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
30821 !! wikitext
30822 The quick brown fox jumps over the lazy dog.
30823
30824 * Yesterday
30825 * Today
30826 * Tomorrow
30827
30828 The quick onyx goblin jumps over the lazy dwarf.
30829 !! end
30830
30831 !! test
30832 New lists in formatting elements serialized w/o newlines
30833 !! options
30834 parsoid=html2wt
30835 !! html/parsoid
30836 <small>
30837
30838 <ul>
30839 <li>123</li>
30840 </ul>
30841
30842 </small>
30843
30844 <small><ul><li>hi</li></ul></small>
30845 !! wikitext
30846 <small>
30847 * 123
30848 </small>
30849
30850 <small>
30851 * hi
30852 </small>
30853 !! end
30854
30855 !! test
30856 New list in table doesn't need newlines
30857 !! options
30858 parsoid=html2wt
30859 !! html/parsoid
30860 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
30861 !! wikitext
30862 {|
30863 |
30864 * test
30865 * 123
30866 |}
30867 !! end
30868
30869 # ---------------------------------------------------
30870 # End of tests spec'ing wikitext serialization norms |
30871 # ---------------------------------------------------
30872
30873 # T104032
30874 !! test
30875 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
30876 !! options
30877 parsoid=html2wt
30878 !! html/parsoid
30879 a<p>b</p>
30880 <b>c</b><p>d</p>
30881 <table><tr>
30882 <td>a<p>b</p></td>
30883 <td><b>c</b><p>d</p></td>
30884 </tr></table>
30885 !! wikitext
30886 a
30887
30888 b
30889
30890 '''c'''
30891
30892 d
30893 {|
30894 |a
30895 b
30896 |'''c'''
30897 d
30898 |}
30899 !! end
30900
30901 !! test
30902 Anchor without href scenarios
30903 !! options
30904 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30905 !! html/parsoid
30906 <a class="bc"></a>
30907 <a class="no">dice</a>
30908 <a name="foo"></a>
30909 !! wikitext
30910
30911 dice
30912 <span name="foo"></span>
30913 !! end
30914
30915 !! test
30916 New transclusion added after a list should be serialized after the list
30917 !! options
30918 parsoid=html2wt
30919 !! html/parsoid
30920 <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>
30921 !! wikitext
30922 * a
30923 {{echo|foo}}
30924 !! end
30925
30926 # -----------------------------------------------------------------
30927 # End of section for Parsoid-only html2wt tests for serialization
30928 # of new content
30929 # -----------------------------------------------------------------
30930
30931 # -----------------------------------------------------------------
30932 # The following section of tests are primarily to spec behavior of
30933 # the selective serializer. All these tests have manual selser
30934 # changes. The automated selser changes for all tests handle the
30935 # wide variation of changes, but these tests here capture specs
30936 # deterministically.
30937 # ----------------------------------------------------------------
30938
30939 ## T90517
30940 !! test
30941 Selser: New comments should not be lost
30942 !! options
30943 parsoid={
30944 "modes": ["selser"],
30945 "changes": [
30946 [ "#a", "after", "<!--c1-->" ],
30947 [ "#b", "before", "<!--c2-->" ]
30948 ]
30949 }
30950 !! wikitext
30951 <span id="a">a</span>
30952
30953 <span id="b">b</span>
30954 !! wikitext/edited
30955 <span id="a">a</span><!--c1-->
30956
30957 <!--c2--><span id="b">b</span>
30958 !! end
30959
30960 ## T89383
30961 !! test
30962 Selser: Check for validity of DSR before using it
30963 !! options
30964 parsoid={
30965 "modes": ["selser"],
30966 "changes": [
30967 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
30968 ]
30969 }
30970 !! wikitext
30971 <span id="a">a</span>
30972 !! wikitext/edited
30973 {{DISPLAYTITLE:foo}}
30974 <span id="a">a</span>
30975 !! end
30976
30977 !! test
30978 1. DOMDiff: Changes to <ref> content should be looked up using id
30979 !! options
30980 parsoid={
30981 "modes": ["selser"],
30982 "changes": [
30983 ["#X", "after", "bar"],
30984 ["#Y", "after", "baz"]
30985 ]
30986 }
30987 !! wikitext
30988 X <ref><span id="X">foo</span></ref>
30989 Y <ref name="a" />
30990 <references>
30991 <ref name="a"><span id="Y">foo</span></ref>
30992 </references>
30993 !! wikitext/edited
30994 X <ref><span id="X">foo</span>bar</ref>
30995 Y <ref name="a" />
30996 <references>
30997 <ref name="a"><span id="Y">foo</span>baz</ref>
30998 </references>
30999 !! end
31000
31001 !! test
31002 2. DOMDiff: Changes to <ref> content should be looked up using id
31003 !! options
31004 parsoid={
31005 "modes": ["selser"],
31006 "changes": [
31007 ["#Z", "after", "bar"]
31008 ]
31009 }
31010 !! wikitext
31011 A <ref>foo bar for a</ref>
31012 B <ref group="X" name="b" />
31013
31014 <references />
31015
31016 <references group="X">
31017 <ref name="b"><span id="Z">foo</span></ref>
31018 </references>
31019 !! wikitext/edited
31020 A <ref>foo bar for a</ref>
31021 B <ref group="X" name="b" />
31022
31023 <references />
31024
31025 <references group="X">
31026 <ref name="b"><span id="Z">foo</span>bar</ref>
31027 </references>
31028 !! end
31029
31030 !! test
31031 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
31032 !! options
31033 parsoid={
31034 "modes": ["selser"],
31035 "changes": [
31036 [ "div:first-child", "text", "bar" ]
31037 ]
31038 }
31039 !! wikitext
31040 <div style="{{1x|color:red;}}%">foo</div>
31041 !! wikitext/edited
31042 <div style="{{1x|color:red;}}%">bar</div>
31043 !! end
31044
31045 !! test
31046 Empty LI (T49673)
31047 !! wikitext
31048 *a
31049 *
31050 *
31051 *b
31052 !! html+tidy
31053 <ul><li>a</li>
31054 <li class="mw-empty-elt"></li>
31055 <li class="mw-empty-elt"></li>
31056 <li>b</li></ul>
31057 !! end
31058
31059 !! test
31060 Thumbnail output
31061 !! wikitext
31062 [[File:Thumb.png|thumb]]
31063 !! html/php+tidy
31064 <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>
31065 !! html/parsoid
31066 <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></figure>
31067 !! end
31068
31069 !! test
31070 unclosed internal link XSS (T137264)
31071 !! wikitext
31072 [[#%3Cscript%3Ealert(1)%3C/script%3E|
31073 !! html/php
31074 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
31075 </p>
31076 !! html/parsoid
31077 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
31078 !! end
31079
31080 !! test
31081 Validating that <style> isn't eaten by tidy (T167349)
31082 !! options
31083 styletag=1
31084 !! wikitext
31085 <div class="foo">
31086 <style>.foo::before { content: "<foo>"; }</style>
31087 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
31088 </div>
31089 !! html/php+tidy
31090 <div class="foo">
31091 <style>.foo::before { content: "<foo>"; }</style>
31092 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
31093 </div>
31094 !! html/parsoid
31095 <div class="foo">
31096 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31097 <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>
31098 </div>
31099 !! end
31100
31101 ## Right now, Parsoid doesn't de-duplicate style tags.
31102 ## So, we shouldn't see link tags that need to bypass the sanitizer.
31103 ## In a followup patch, when we de-duplicate style tags and
31104 ## introduce link tags, we'll add a hook for link tags in
31105 ## the parser test runner script.
31106 !! test
31107 Validating that <style> isn't wrapped in a paragraph (T186965)
31108 !! options
31109 styletag=1
31110 !! wikitext
31111 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31112
31113 <style>.foo::before { content: "<foo>"; }</style>
31114
31115 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
31116
31117 But if it's on a line with other content, let it be wrapped.
31118
31119 <style>.foo::before { content: "<foo>"; }</style> bar
31120
31121 foo <style>.foo::before { content: "<foo>"; }</style>
31122
31123 foo <style>.foo::before { content: "<foo>"; }</style> bar
31124
31125 And the same if we have non-paragraph-breaking whitespace
31126
31127 foo
31128 <style>.foo::before { content: "<foo>"; }</style>
31129 bar
31130 !! html/php
31131 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31132 </p>
31133 <style>.foo::before { content: "<foo>"; }</style>
31134 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
31135 <p>But if it's on a line with other content, let it be wrapped.
31136 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
31137 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
31138 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
31139 </p><p>And the same if we have non-paragraph-breaking whitespace
31140 </p><p>foo
31141 <style>.foo::before { content: "<foo>"; }</style>
31142 bar
31143 </p>
31144 !! html/parsoid
31145 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph</p>
31146
31147 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31148
31149 <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>
31150
31151 <p>But if it's on a line with other content, let it be wrapped.</p>
31152
31153 <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>
31154
31155 <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>
31156
31157 <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>
31158
31159 <p>And the same if we have non-paragraph-breaking whitespace</p>
31160
31161 <p>foo
31162 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31163 bar</p>
31164 !! end
31165
31166 !! test
31167 Validating that <link> isn't wrapped in a paragraph (T186965)
31168 !! options
31169 styletag=1
31170 !! wikitext
31171 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31172
31173 <link rel="foo" href="bar"/>
31174
31175 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
31176
31177 But if it's on a line with other content, let it be wrapped.
31178
31179 <link rel="foo" href="bar"/> bar
31180
31181 foo <link rel="foo" href="bar"/>
31182
31183 foo <link rel="foo" href="bar"/> bar
31184
31185 And the same if we have non-paragraph-breaking whitespace
31186
31187 foo
31188 <link rel="foo" href="bar"/>
31189 bar
31190 !! html/php
31191 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31192 </p>
31193 <link rel="foo" href="bar"/>
31194 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
31195 <p>But if it's on a line with other content, let it be wrapped.
31196 </p><p><link rel="foo" href="bar"/> bar
31197 </p><p>foo <link rel="foo" href="bar"/>
31198 </p><p>foo <link rel="foo" href="bar"/> bar
31199 </p><p>And the same if we have non-paragraph-breaking whitespace
31200 </p><p>foo
31201 <link rel="foo" href="bar"/>
31202 bar
31203 </p>
31204 !! end
31205
31206 !! test
31207 Extension returning multiple nodes starting with a style tag roundtrips
31208 !! options
31209 wgRawHtml=1
31210 !! wikitext
31211 <table>
31212 {{echo|<html><style>.hi { color: red; }</style>
31213 </html>}}
31214 <tr><td class="hi">ho</td></tr>
31215 </table>
31216 !! html/parsoid
31217 <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">
31218 </span></p><table about="#mwt5" data-parsoid='{"stx":"html"}'>
31219
31220 <tbody><tr><td class="hi">ho</td></tr>
31221 </tbody></table>
31222 !! end
31223
31224 !! test
31225 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
31226 !! config
31227 wgFragmentMode=[ 'html5', 'legacy' ]
31228 !! wikitext
31229 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
31230 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
31231 !! html/php
31232 <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>
31233 <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>
31234 </p>
31235 !! html/parsoid
31236 <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>
31237 <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>
31238 !! end
31239
31240 !! test
31241 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
31242 !! config
31243 wgFragmentMode=[ 'legacy' ]
31244 !! wikitext
31245 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
31246 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
31247 !! html/php
31248 <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>
31249 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
31250 </p>
31251 !! end
31252
31253 !! test
31254 Decoding of HTML entities in embedded HTML tags
31255 !! wikitext
31256 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
31257 !! html/php
31258 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
31259 !! html/parsoid
31260 <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>
31261 !! end
31262
31263 !! test
31264 Decoding of HTML entities in indicator names for IDs (T104196)
31265 !! options
31266 parsoid=wt2html,html2html
31267 showindicators
31268 !! wikitext
31269 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
31270 !! html/php
31271 1&2&3&amp;4&amp;amp;5=Indicator
31272
31273 !! html/parsoid
31274 <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>
31275 !! end
31276
31277 # this version of the test strips out the ambiguity so Parsoid rts cleanly
31278 !! test
31279 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
31280 !! options
31281 showindicators
31282 !! wikitext
31283 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
31284 !! html/php
31285 1&2&3&amp;4&amp;amp;5=Indicator
31286
31287 !! html/parsoid
31288 <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>
31289 !! end
31290
31291 # This fragment mode is what Parsoid supports.
31292 !! test
31293 HTML5 ids: fallback to legacy
31294 !! config
31295 wgFragmentMode=[ 'html5', 'legacy' ]
31296 !! wikitext
31297 ==Foo bar==
31298
31299 ==foo Bar==
31300
31301 ==Тест==
31302
31303 ==Тест==
31304
31305 ==тест==
31306
31307 ==Hey < # " > % : '==
31308 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31309
31310 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31311
31312 <!-- These two links should produce identical HTML -->
31313 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31314
31315 !! html/php
31316 <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>
31317 <ul>
31318 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31319 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31320 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
31321 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
31322 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
31323 <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>
31324 </ul>
31325 </div>
31326
31327 <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>
31328 <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>
31329 <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>
31330 <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>
31331 <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>
31332 <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>
31333 <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>
31334 </p><p>💩 <span id="💩"></span>
31335 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
31336 </p>
31337 !! html/parsoid
31338 <h2 id="Foo_bar">Foo bar</h2>
31339
31340 <h2 id="foo_Bar_2">foo Bar</h2>
31341
31342 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
31343
31344 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
31345
31346 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
31347
31348 <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>
31349 <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>
31350
31351 <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>
31352
31353 <!-- These two links should produce identical HTML -->
31354 <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>
31355 !! end
31356
31357 # Parsoid doesn't support this mode
31358 !! test
31359 HTML5 ids: legacy with a fallback to modern
31360 !! config
31361 wgFragmentMode=[ 'legacy', 'html5' ]
31362 !! wikitext
31363 ==Foo bar==
31364
31365 ==foo Bar==
31366
31367 ==Тест==
31368
31369 ==Тест==
31370
31371 ==тест==
31372
31373 ==Hey < # " > % : '==
31374 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31375
31376 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31377
31378 <!-- These two links should produce identical HTML -->
31379 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31380
31381 !! html/php
31382 <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>
31383 <ul>
31384 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31385 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31386 <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>
31387 <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>
31388 <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>
31389 <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>
31390 </ul>
31391 </div>
31392
31393 <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>
31394 <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>
31395 <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>
31396 <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>
31397 <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>
31398 <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>
31399 <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>
31400 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
31401 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
31402 </p>
31403 !! end
31404
31405 # Parsoid doesn't support this mode.
31406 !! test
31407 HTML5 ids: no legacy
31408 !! config
31409 wgFragmentMode=[ 'html5' ]
31410 !! wikitext
31411 ==Foo bar==
31412
31413 ==foo Bar==
31414
31415 ==Тест==
31416
31417 ==Тест==
31418
31419 ==тест==
31420
31421 ==Hey < # " > % : '==
31422 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31423
31424 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31425
31426 <!-- These two links should produce identical HTML -->
31427 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31428
31429 !! html/php
31430 <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>
31431 <ul>
31432 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31433 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31434 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
31435 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
31436 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
31437 <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>
31438 </ul>
31439 </div>
31440
31441 <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>
31442 <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>
31443 <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>
31444 <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>
31445 <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>
31446 <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>
31447 <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>
31448 </p><p>💩 <span id="💩"></span>
31449 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
31450 </p>
31451 !! end
31452
31453 !! test
31454 T90902: Normalize weird characters in section IDs
31455 !! config
31456 wgFragmentMode=[ 'html5', 'legacy' ]
31457 !! wikitext
31458 ==Foo&nbsp;bar==
31459 [[#Foo&nbsp;bar]]
31460
31461 !! html/php
31462 <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>
31463 <p><a href="#Foo_bar">#Foo&#160;bar</a>
31464 </p>
31465 !! html/parsoid
31466 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
31467 <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>
31468 !! end
31469
31470 !! test
31471 T51672: Test for brackets in attributes of elements in external link texts
31472 !! wikitext
31473 [http://example.com/ link <span title="title with [brackets]">span</span>]
31474 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
31475
31476 !! html/php
31477 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31478 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31479 </p>
31480 !! html/parsoid
31481 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
31482 <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>
31483 !! end
31484
31485 !! test
31486 T72875: Test for brackets in attributes of elements in internal link texts
31487 !! wikitext
31488 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
31489 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
31490
31491 !! html/php
31492 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31493 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31494 </p>
31495 !! html/parsoid
31496 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
31497 <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>
31498 !! end
31499
31500 !! test
31501 T199926: html arrow wt: Parsoid sometimes trips up on verticalbar chars in hrefs
31502 !! options
31503 parsoid={
31504 "modes": ["html2wt"]
31505 }
31506 !! html/parsoid
31507 <a href="https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total">9</a>
31508 <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>
31509 !! wikitext
31510 [https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total 9]
31511 [[stats:v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total|10]]
31512 !! end
31513
31514 !! test
31515 T179544: {{anchorencode:}} output should be always usable in links
31516 !! config
31517 wgFragmentMode=[ 'html5' ]
31518 !! wikitext
31519 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
31520 !! html/php
31521 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
31522 </p>
31523 !! html/parsoid
31524 <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>
31525 !! end
31526
31527 ## ------------------------------
31528 ## Parsoid section-wrapping tests
31529 ## ------------------------------
31530 !! test
31531 Section wrapping for well-nested sections (no leading content)
31532 !! options
31533 parsoid={
31534 "wrapSections": true
31535 }
31536 !! wikitext
31537 =1=
31538 a
31539
31540 =2=
31541 b
31542
31543 ==2.1==
31544 c
31545
31546 ==2.2==
31547 d
31548
31549 ===2.2.1===
31550 e
31551
31552 =3=
31553 f
31554 !! html/parsoid
31555 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31556 <p>a</p>
31557
31558 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31559 <p>b</p>
31560
31561 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
31562 <p>c</p>
31563
31564 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
31565 <p>d</p>
31566
31567 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
31568 <p>e</p>
31569
31570 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
31571 <p>f</p>
31572
31573 </section>
31574 !! end
31575
31576 !! test
31577 Section wrapping for well-nested sections (with leading content)
31578 !! options
31579 parsoid={
31580 "wrapSections": true
31581 }
31582 !! wikitext
31583 Para 1.
31584
31585 Para 2 with a <div>nested in it</div>
31586
31587 Para 3.
31588
31589 =1=
31590 a
31591
31592 =2=
31593 b
31594
31595 ==2.1==
31596 c
31597 !! html/parsoid
31598 <section data-mw-section-id="0"><p>Para 1.</p>
31599
31600 <p>Para 2 with a </p><div>nested in it</div>
31601
31602 <p>Para 3.</p>
31603
31604 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
31605 <p>a</p>
31606
31607 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31608 <p>b</p>
31609
31610 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
31611 <p>c</p>
31612
31613 </section></section>
31614 !! end
31615
31616 !! test
31617 Section wrapping with template-generated sections (good nesting 1)
31618 !! options
31619 parsoid={
31620 "wrapSections": true
31621 }
31622 !! wikitext
31623 =1=
31624 a
31625
31626 {{echo|1=
31627 ==1.1==
31628 b
31629 }}
31630
31631 ==1.2==
31632 c
31633
31634 =2=
31635 d
31636 !! html/parsoid
31637 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31638 <p>a</p>
31639
31640 <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">
31641 </span><p about="#mwt1">b</p>
31642 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
31643 <p>c</p>
31644
31645 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
31646 <p>d</p></section>
31647 !! end
31648
31649 # In this example, the template scope is mildly expanded to incorporate the
31650 # trailing newline after the transclusion since that is part of section 1.1.1
31651 !! test
31652 Section wrapping with template-generated sections (good nesting 2)
31653 !! options
31654 parsoid={
31655 "wrapSections": true,
31656 "modes": ["wt2html", "wt2wt"]
31657 }
31658 !! wikitext
31659 =1=
31660 a
31661
31662 {{echo|1=
31663 ==1.1==
31664 b
31665 ===1.1.1===
31666 d
31667 }}
31668 =2=
31669 e
31670 !! html/parsoid
31671 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31672 <p>a</p>
31673
31674 <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">
31675 </span><p about="#mwt1">b</p><span about="#mwt1">
31676 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
31677 </span><p about="#mwt1">d</p><span about="#mwt1">
31678 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
31679 <p>e</p></section>
31680 !! end
31681
31682 # In this example, the template scope is mildly expanded to incorporate the
31683 # trailing newline after the transclusion since that is part of section 1.2.1
31684 !! test
31685 Section wrapping with template-generated sections (good nesting 3)
31686 !! options
31687 parsoid={
31688 "wrapSections": true,
31689 "modes": ["wt2html", "wt2wt"]
31690 }
31691 !! wikitext
31692 =1=
31693 a
31694
31695 {{echo|1=
31696 x
31697 ==1.1==
31698 b
31699 ==1.2==
31700 c
31701 ===1.2.1===
31702 d
31703 }}
31704 =2=
31705 e
31706 !! html/parsoid
31707 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
31708 <p>a</p>
31709
31710 <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">
31711 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
31712 </span><p about="#mwt1">b</p><span about="#mwt1">
31713 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
31714 </span><p about="#mwt1">c</p><span about="#mwt1">
31715 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
31716 </span><p about="#mwt1">d</p><span about="#mwt1">
31717 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
31718 <p>e</p></section>
31719 !! end
31720
31721 # Because of section-wrapping and template-wrapping interactions,
31722 # the scope of the template is expanded so that the template markup
31723 # is valid in the presence of <section> tags.
31724 # This exercises the s1 is null scenario in the wrapSections code
31725 !! test
31726 Section wrapping with template-generated sections (bad nesting 1)
31727 !! options
31728 parsoid={
31729 "wrapSections": true
31730 }
31731 !! wikitext
31732 <div>
31733 a
31734
31735 {{echo|
31736 =1=
31737 b
31738 }}
31739
31740 c
31741 </div>
31742 !! html/parsoid
31743 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
31744 <p>a</p>
31745
31746 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n=1=\nb\n"}},"i":0}},"\n\nc\n"]}'>
31747 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
31748 </span><p about="#mwt1">b
31749 </p><span about="#mwt1">
31750
31751 </span><p about="#mwt1">c</p><span about="#mwt1">
31752 </span></section></div></section>
31753 !! end
31754
31755 # Because of section-wrapping and template-wrapping interactions,
31756 # the scope of the template is expanded so that the template markup
31757 # is valid in the presence of <section> tags.
31758 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
31759 !! test
31760 Section wrapping with template-generated sections (bad nesting 2)
31761 !! options
31762 parsoid={
31763 "wrapSections": true
31764 }
31765 !! wikitext
31766 =1=
31767 a
31768
31769 {{echo|1=
31770 =2=
31771 b
31772 ==2.1==
31773 c
31774 }}
31775
31776 d
31777
31778 =3=
31779 e
31780 !! html/parsoid
31781 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31782 <p>a</p>
31783
31784 </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">
31785 </span><p about="#mwt1">b</p><span about="#mwt1">
31786 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
31787 </span><p about="#mwt1">c</p><span about="#mwt1">
31788
31789 </span><p about="#mwt1">d</p><span about="#mwt1">
31790
31791 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
31792 <p>e</p></section>
31793 !! end
31794
31795 # Because of section-wrapping and template-wrapping interactions,
31796 # additional template wrappers are added to <section> tags
31797 # so that template wrapping semantics are valid whether section
31798 # tags are retained or stripped. But, the template scope can expand
31799 # greatly when accounting for section tags.
31800 # This exercises the s1 and s2 are in different subtrees scenario
31801 !! test
31802 Section wrapping with template-generated sections (bad nesting 3)
31803 !! options
31804 parsoid={
31805 "wrapSections": true,
31806 "modes": ["wt2html", "wt2wt"]
31807 }
31808 !! wikitext
31809 =1=
31810 a
31811
31812 {{echo|1=
31813 ==1.2==
31814 b
31815 =2=
31816 c
31817 }}
31818
31819 d
31820
31821 =3=
31822 e
31823 !! html/parsoid
31824 <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>
31825 <p>a</p>
31826
31827 <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">
31828 </span><p about="#mwt1">b</p><span about="#mwt1">
31829 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
31830 </span><p about="#mwt1">c</p>
31831
31832 <p>d</p>
31833 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
31834 <p>e</p></section>
31835 !! end
31836
31837 !! test
31838 Section wrapping with uneditable lead section + div wrapping multiple sections
31839 !! options
31840 parsoid={
31841 "wrapSections": true
31842 }
31843 !! wikitext
31844 foo
31845
31846 <div style="border:1px solid red;">
31847 =1=
31848 a
31849
31850 ==1.1==
31851 b
31852
31853 =2=
31854 c
31855 </div>
31856
31857 =3=
31858 d
31859
31860 ==3.1==
31861 e
31862 !! html/parsoid
31863 <section data-mw-section-id="-1"><p>foo</p>
31864
31865 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31866 <section data-mw-section-id="1"><h1 id="1">1</h1>
31867 <p>a</p>
31868
31869 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31870 <p>b</p>
31871
31872 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31873 <p>c</p>
31874 </section></div>
31875
31876 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31877 <p>d</p>
31878
31879 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31880 <p>e</p>
31881 </section></section>
31882 !! end
31883
31884 !! test
31885 Section wrapping with editable lead section + div overlapping multiple sections
31886 !! options
31887 parsoid={
31888 "wrapSections": true
31889 }
31890 !! wikitext
31891 foo
31892
31893 =1=
31894 a
31895 <div style="border:1px solid red;">
31896 b
31897
31898 ==1.1==
31899 c
31900
31901 =2=
31902 d
31903 </div>
31904 e
31905
31906 =3=
31907 f
31908
31909 ==3.1==
31910 g
31911 !! html/parsoid
31912 <section data-mw-section-id="0"><p>foo</p>
31913
31914 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
31915 <p>a</p>
31916 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31917 <p>b</p>
31918
31919 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31920 <p>c</p>
31921
31922 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31923 <p>d</p>
31924 </section></div>
31925 <p>e</p>
31926
31927 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31928 <p>f</p>
31929
31930 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31931 <p>g</p>
31932 </section></section>
31933 !! end
31934
31935 !! test
31936 HTML header tags should not be wrapped in section tags
31937 !! options
31938 parsoid={
31939 "wrapSections": true
31940 }
31941 !! wikitext
31942 foo
31943
31944 <h1>a</h1>
31945
31946 =b=
31947
31948 <h1>c</h1>
31949
31950 =d=
31951 !! html/parsoid
31952 <section data-mw-section-id="0"><p>foo</p>
31953
31954 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
31955
31956 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
31957
31958 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
31959
31960 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
31961 !! end
31962
31963 !! test
31964 Lead section containing only whitespace and comments.
31965 !! options
31966 parsoid={
31967 "wrapSections": true
31968 }
31969 !! wikitext
31970
31971 <!-- this is a comment, presumably significant to editors -->
31972 =1=
31973 a
31974
31975 =2=
31976 b
31977 !! html/parsoid
31978 <section data-mw-section-id="0" data-parsoid="{}">
31979 <!-- this is a comment, presumably significant to editors -->
31980 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
31981 <p>a</p>
31982
31983 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31984 <p>b</p></section>
31985 !! end
31986
31987 !! test
31988 Pseudo-sections emitted by templates should have id -2
31989 !! options
31990 parsoid={
31991 "wrapSections": true
31992 }
31993 !! wikitext
31994 foo
31995 {{echo|<div>
31996 ==a==
31997 ==b==
31998 </div>
31999 }}
32000 !! html/parsoid
32001 <section data-mw-section-id="-1"><p>foo</p>
32002 </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}}]}'>
32003 <section data-mw-section-id="-1"><h2 id="a">a</h2>
32004 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
32005 </section></div><span about="#mwt1">
32006 </span></section>
32007 !! end
32008
32009 ##########################################################################
32010 Tests demonstrating white-space insensitivity in input wikitext
32011 for wikitext headings, wikitext list items, and wikitext table captions,
32012 headings, and cells. HTML versions of the same should preserve whitespace.
32013 ##########################################################################
32014 !! test
32015 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
32016 !! options
32017 parsoid={
32018 "modes": ["wt2html"],
32019 "preserveIEW": true
32020 }
32021 !! wikitext
32022 __NOTOC__
32023 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
32024 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
32025 == <!--Headings with fallback ids--> Личная жизнь ==
32026 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
32027 ; <!--term to define--> term : <!--term's definition--> definition
32028 {|
32029 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
32030 |-
32031 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
32032 |-
32033 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
32034 |-
32035 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
32036 |-
32037 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
32038 |}
32039 : {|
32040 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
32041 |} foo <!--c1-->
32042 !! html/php+tidy
32043 <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>
32044 <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>
32045 <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>
32046 <ul><li>List item</li></ul>
32047 <dl><dt>term&#160;</dt>
32048 <dd>definition</dd></dl>
32049 <table>
32050 <caption>Table Caption
32051 </caption>
32052 <tbody><tr>
32053 <th>Table Heading 1</th>
32054 <th>Table Heading 2
32055 </th></tr>
32056 <tr>
32057 <td>Table Cell 1</td>
32058 <td>Table Cell 2
32059 </td></tr>
32060 <tr>
32061 <td>class="foo"</td>
32062 <td>Table Cell 3
32063 </td></tr>
32064 <tr>
32065 <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
32066 </td></tr></tbody></table>
32067 <dl><dd><table>
32068 <tbody><tr>
32069 <td>Table Cell 1</td>
32070 <td>Table Cell 2
32071 </td></tr></tbody></table> foo</dd></dl>
32072 !! html/parsoid
32073 <meta property="mw:PageProp/notoc">
32074 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
32075 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
32076 <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>
32077 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
32078 <dl><dt><!--term to define-->term&nbsp;</dt><dd><!--term's definition-->definition</dd></dl>
32079 <table>
32080 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
32081 <tbody><tr>
32082 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th>Table Heading 2<!--c5--></th></tr>
32083 <tr>
32084 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
32085 <tr>
32086 <td>class="foo"</td><td><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
32087 <tr>
32088 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One">two</a> <!--c2--> | <!--c3--> some content</td></tr>
32089 </tbody></table>
32090 <dl><dd><table>
32091 <tbody><tr><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
32092 </tbody></table> foo<!--c1--></dd></dl>
32093 !! end
32094
32095 # Looks like <caption> is not accepted in HTML
32096 !! test
32097 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
32098 !! options
32099 parsoid={
32100 "modes": ["wt2html"],
32101 "preserveIEW": true
32102 }
32103 !! wikitext
32104 __NOTOC__
32105 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
32106 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
32107 <table>
32108 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
32109 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
32110 </table>
32111 !! html/php+tidy
32112 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
32113 <ul><li> List item </li></ul>
32114 <table>
32115 <tbody><tr><th> Table Heading </th><th></th></tr>
32116 <tr><td> Table Cell </td><th></th></tr>
32117 </tbody></table>
32118 !! html/parsoid
32119 <meta property="mw:PageProp/notoc"/>
32120 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
32121 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
32122 <table>
32123 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
32124 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
32125 </tbody></table>
32126 !! end
32127
32128 !! test
32129 Do not trim whitespace in links and quotes
32130 !! options
32131 parsoid={
32132 "modes": ["wt2html"],
32133 "preserveIEW": true
32134 }
32135 !! wikitext
32136 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
32137 [[Foo| some text ]]
32138 !! html/php+tidy
32139 <p>foo <i> italic </i> and <b> bold </b>
32140 <a href="/wiki/Foo" title="Foo"> some text </a>
32141 </p>
32142 !! html/parsoid
32143 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
32144 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
32145 !! end
32146
32147 !! test
32148 Remove p tags surrounding a single element in a figcaption
32149 !! options
32150 parsoid=html2wt
32151 !! wikitext
32152 [[File:Foobar.jpg|right|200x200px|Caption]]
32153 !! html/parsoid
32154 <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>
32155 !! end
32156
32157 !! test
32158 Selser preserves lack of newline before list and allows newline after the list
32159 !! options
32160 parsoid={
32161 "modes": ["selser"],
32162 "scrubWikitext": true,
32163 "changes": [
32164 [ "ul", "after", "<p>footer</p>" ]
32165 ]
32166 }
32167 !! wikitext
32168 header
32169 *foo
32170 *bar
32171 !! wikitext/edited
32172 header
32173 *foo
32174 *bar
32175
32176 footer
32177 !! end
32178
32179
32180 !! test
32181 Selser does not introduce newlines between unedited paragraph preceding the list
32182 !! options
32183 parsoid={
32184 "modes": ["selser"],
32185 "changes": [
32186 [ "table tbody tr td p:last-child", "empty" ]
32187 ]
32188 }
32189 !! wikitext
32190 {|
32191 |
32192 header
32193 *foo
32194 *bar
32195 footer
32196 |}
32197 !! wikitext/edited
32198 {|
32199 |
32200 header
32201 *foo
32202 *bar
32203
32204 |}
32205 !! end
32206
32207 !! test
32208 Selser does not introduce newlines between unedited paragraph following the list
32209 !! options
32210 parsoid={
32211 "modes": ["selser"],
32212 "changes": [
32213 [ "table tbody tr td p:first-child", "empty" ]
32214 ]
32215 }
32216 !! wikitext
32217 {|
32218 |
32219 header
32220 *foo
32221 *bar
32222 footer
32223 |}
32224 !! wikitext/edited
32225 {|
32226 |
32227
32228 *foo
32229 *bar
32230 footer
32231 |}
32232 !! end
32233
32234 !! test
32235 Remove a list item but do not insert newline above list
32236 !! options
32237 parsoid={
32238 "modes": ["selser"],
32239 "changes": [
32240 [ "ul li:last-child", "remove" ]
32241 ]
32242 }
32243 !! wikitext
32244 header
32245 *foo
32246 *bar
32247 footer
32248 !! wikitext/edited
32249 header
32250 *foo
32251 footer
32252 !! end