Merge "upload: Simplify file extension extraction in UploadBase"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 # wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
40 # wgEnableMagicLinks
41 #
42 # For testing purposes, temporary articles can created:
43 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
44 # where '/' denotes a newline.
45
46 # This is the standard article assumed to exist.
47 !! article
48 Main Page
49 !! text
50 blah blah
51 !! endarticle
52
53 !!article
54 Foo
55 !!text
56 FOO
57 !!endarticle
58
59 !!article
60 Foo''s bar''s
61 !!text
62 Article titles can contain single quotes!
63 !!endarticle
64
65 !!article
66 Template:Foo
67 !!text
68 FOO
69 !!endarticle
70
71 !! article
72 Template:redirect to foo
73 !! text
74 #REDIRECT [[Template:Foo]]
75 !! endarticle
76
77 !! article
78 Template:Blank
79 !! text
80 !! endarticle
81
82 !! article
83 Template:pipe
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:=
90 !! text
91 <nowiki>=</nowiki>
92 !! endarticle
93
94 !!article
95 MediaWiki:bad image list
96 !!text
97 * [[File:Bad.jpg]] except [[Nasty page]]
98 !!endarticle
99
100 !! article
101 Template:inner list
102 !! text
103 * item 1
104 !! endarticle
105
106 !! article
107 Template:tbl-start
108 !! text
109 {|
110 !! endarticle
111
112 !! article
113 Template:tbl-end
114 !! text
115 |}
116 !! endarticle
117
118 !! article
119 Template:echo
120 !! text
121 {{{1}}}
122 !! endarticle
123
124 !! article
125 Template:echo3
126 !! text
127 {{{1}}}
128 {{{1}}}
129 {{{1}}}
130 !! endarticle
131
132 // For Serbian; localize Template namespace
133 !! article
134 Шаблон:Echo
135 !! text
136 {{{1}}}
137 !! endarticle
138
139 !! article
140 Template:echo_with_span
141 !! text
142 <span>{{{1}}}</span>
143 !! endarticle
144
145 !! article
146 Template:echo_with_div
147 !! text
148 <div>{{{1}}}</div>
149 !! endarticle
150
151 !! article
152 Template:echo with depth
153 !! text
154 {{echo|{{{1}}}}}
155 !! endarticle
156
157 !! article
158 Template:blank_param
159 !! text
160 {{{1}}}
161 {{{}}}
162 !! endarticle
163
164 !! article
165 Template:table_attribs
166 !! text
167 <noinclude>
168 |</noinclude>style="color:red;"|Foo
169 !! endarticle
170
171 !! article
172 Template:table_attribs_2
173 !! text
174 <noinclude>
175 |</noinclude>style="color:red;"|Foo
176 |Bar||Baz
177 !! endarticle
178
179 !! article
180 Template:table_attribs_3
181 !! text
182 <noinclude>
183 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
184 !! endarticle
185
186 !! article
187 Template:table_attribs_4
188 !! text
189 | style="background-color:#DC241f;" width="10px" |
190 !! endarticle
191
192 !! article
193 Template:table_attribs_5
194 !! text
195 <noinclude>
196 |</noinclude>style="color:red;"||Bar
197 !! endarticle
198
199 !! article
200 Template:table_attribs_6
201 !! text
202 style="background: <nowiki>
203
204
205 red;</nowiki>" |
206 !! endarticle
207
208 !! article
209 Template:table_attribs_7
210 !! text
211 <noinclude>
212 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
213 !! endarticle
214
215 !! article
216 Template:table_header_cells
217 !! text
218 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
219 !! endarticle
220
221 !! article
222 Template:table_cells
223 !! text
224 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
225 !! endarticle
226
227 !! article
228 Template:PartialTable
229 !! text
230 {|
231 |-
232 !! endarticle
233
234 !! article
235 Template:image_attribs
236 !! text
237 <noinclude>
238 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
239 !! endarticle
240
241 ## See T48811 for details
242 !! article
243 Template:mixed_attr_content_template
244 !! text
245 style="color:red;" title="T48811"
246 |-
247 |foo
248 !! endarticle
249
250 !! article
251 Template:definition_list
252 !! text
253 one
254 ::two
255 !! endarticle
256
257 !! article
258 A?b
259 !! text
260 Weirdo titles!
261 !! endarticle
262
263 !!article
264 Template:Bullet
265 !!text
266 *Bar
267 !!endarticle
268
269 !!article
270 Template:OpenTable
271 !!text
272 {|
273 !!endarticle
274
275 !!article
276 Template:EmptyLITest
277 !!text
278 *a
279 *
280 *
281 *b
282 !!endarticle
283
284 !!article
285 Template:EmptyTRTest
286 !!text
287 {|
288 |-
289 |-
290 |foo
291 |-
292 |-
293 |bar
294 |}
295 !!endarticle
296
297 !!article
298 Template:EmptyTRWithHTMLAttrTest
299 !!text
300 <table>
301 <tr align="center"></tr>
302 <tr><td>foo</td></tr>
303 <tr align="center"></tr>
304 <tr><td>bar</td></tr>
305 </table>
306 !!endarticle
307
308 !! article
309 Template:With: Colon
310 !! text
311 Template with colon
312 !! endarticle
313
314 ###
315 ### Basic tests
316 ###
317
318 !! test
319 Blank input
320 !! wikitext
321 !! html
322 !! end
323
324 !! test
325 Simple paragraph
326 !! wikitext
327 This is a simple paragraph.
328 !! html
329 <p>This is a simple paragraph.
330 </p>
331 !! end
332
333 !! test
334 Paragraphs with extra newline spacing
335 !! wikitext
336 a
337
338 b (+2 nls)
339
340
341 c (+3 nls)
342
343
344
345 d (+4 nls)
346
347
348
349
350 e (+5 nls)
351 !! html
352 <p>a
353 </p><p>b (+2 nls)
354 </p><p><br />
355 c (+3 nls)
356 </p><p><br />
357 </p><p>d (+4 nls)
358 </p><p><br />
359 </p><p><br />
360 e (+5 nls)
361 </p>
362 !! end
363
364 !! test
365 Paragraphs with newline spacing with comment lines in between
366 !! wikitext
367 ----
368 a
369 <!--foo-->
370 b
371 ----
372 a
373 <!--foo--><!--More than 1 comment, still stripped-->
374 b
375 ----
376 a
377 <!--foo--> <!----> <!-- bar -->
378 b
379 ----
380 a
381 <!--foo-->
382
383 b
384 ----
385 a
386
387 <!--foo-->
388 b
389 ----
390 a
391 <!--foo-->
392
393
394 b
395 ----
396 a
397
398
399 <!--foo-->
400 b
401 ----
402 !! html
403 <hr />
404 <p>a
405 b
406 </p>
407 <hr />
408 <p>a
409 b
410 </p>
411 <hr />
412 <p>a
413 b
414 </p>
415 <hr />
416 <p>a
417 </p><p>b
418 </p>
419 <hr />
420 <p>a
421 </p><p>b
422 </p>
423 <hr />
424 <p>a
425 </p><p><br />
426 b
427 </p>
428 <hr />
429 <p>a
430 </p><p><br />
431 b
432 </p>
433 <hr />
434 !! end
435
436 !! test
437 Paragraphs with newline spacing with non-empty white-space lines in between
438 !! wikitext
439 ----
440 a
441
442 b
443 ----
444 a
445
446
447 b
448 ----
449 !! html
450 <hr />
451 <p>a
452 </p><p>b
453 </p>
454 <hr />
455 <p>a
456 </p><p><br />
457 b
458 </p>
459 <hr />
460 !! end
461
462 !! test
463 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
464 !! wikitext
465 ----
466 a
467 <!--foo-->
468 b
469 ----
470 a
471 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
472 b
473 ----
474 a
475
476 <!--foo-->
477 <!--bar-->
478 b
479 ----
480 a
481
482 <!--foo-->
483 <!--bar-->
484
485 b
486 ----
487 !! html
488 <hr />
489 <p>a
490 b
491 </p>
492 <hr />
493 <p>a
494 b
495 </p>
496 <hr />
497 <p>a
498 </p><p>b
499 </p>
500 <hr />
501 <p>a
502 </p><p><br />
503 b
504 </p>
505 <hr />
506 !! end
507
508 !! test
509 Extra newlines: More paragraphs with indented comment
510 !! wikitext
511 a
512
513 <!--boo-->
514
515 b
516 !! html
517 <p>a
518 </p><p><br />
519 b
520 </p>
521 !!end
522
523 !! test
524 Extra newlines followed by heading
525 !! wikitext
526 a
527
528
529 =b=
530 [[a]]
531
532
533 =b=
534 !! html
535 <p>a
536 </p><p><br />
537 </p>
538 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
539 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
540 </p><p><br />
541 </p>
542 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
543 !! end
544
545 !! test
546 Extra newlines between heading and content are swallowed (Parsoid does not)
547 !! wikitext
548 =b=
549
550
551
552 [[a]]
553 !! html/php+tidy
554 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
555 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
556 </p>
557 !! html/parsoid
558 <h1 id="b">b</h1>
559 <p>
560 <br></p>
561
562 <p><a rel="mw:WikiLink" href="./A" title="A">a</a></p>
563 !! end
564
565 !! test
566 Extra new lines before and after lists are preserved
567 !! wikitext
568 a
569
570
571 *b
572
573
574 c
575 !! html/php+tidy
576 <p>a
577 </p><p><br />
578 </p>
579 <ul><li>b</li></ul>
580 <p><br />
581 c
582 </p>
583 !! html/parsoid
584 <p>a</p>
585 <p>
586 <br></p>
587 <ul><li>b</li></ul>
588 <p>
589 <br>
590 c</p>
591 !! end
592
593 # Parsoid regression test
594 !!test
595 Multiple newlines after tables are converted to p-br-p tags
596 !!options
597 parsoid=wt2html,wt2wt
598 !!wikitext
599 {|
600 |x
601 |}
602
603
604
605
606 =b=
607 !!html/php+tidy
608 <table>
609 <tbody><tr>
610 <td>x
611 </td></tr></tbody></table>
612 <p><br />
613 </p><p><br />
614 </p>
615 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
616 !!html/parsoid
617 <table>
618 <tbody>
619 <tr>
620 <td>x</td>
621 </tr>
622 </tbody>
623 </table>
624 <p><br/></p>
625 <p><br/></p>
626 <h1 id="b">b</h1>
627 !!end
628
629 !! test
630 Heading with line break in nowiki
631 !! options
632 parsoid=wt2html
633 !! config
634 wgFragmentMode=[ 'html5', 'legacy' ]
635 !! wikitext
636 ==A <nowiki>B
637 C</nowiki>==
638 !! html/php
639 <h2><span id="A_B.0AC"></span><span class="mw-headline" id="A_B
640 C">A B
641 C</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
642 !! html/parsoid
643 <h2 id="A_B
644 C"><span id="A_B.0AC" typeof="mw:FallbackId"></span>A <span typeof="mw:Nowiki">B
645 C</span></h2>
646 !! end
647
648 !! test
649 Parsing an URL
650 !! wikitext
651 http://fr.wikipedia.org/wiki/🍺
652 <!-- EasterEgg we love beer, better be able be able to link to it -->
653 !! html
654 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
655 </p>
656 !! end
657
658 !! test
659 Simple list
660 !! wikitext
661 *Item 1
662 *Item 2
663 !! html
664 <ul><li>Item 1</li>
665 <li>Item 2</li></ul>
666 !! end
667
668 !! test
669 Italics and bold
670 !! wikitext
671 *plain
672 *plain''italic''plain
673 *plain''italic''plain''italic''plain
674 *plain'''bold'''plain
675 *plain'''bold'''plain'''bold'''plain
676 *plain''italic''plain'''bold'''plain
677 *plain'''bold'''plain''italic''plain
678 *plain''italic'''bold-italic'''italic''plain
679 *plain'''bold''bold-italic''bold'''plain
680 *plain'''''bold-italic'''italic''plain
681 *plain'''''bold-italic''bold'''plain
682 *plain''italic'''bold-italic'''''plain
683 *plain'''bold''bold-italic'''''plain
684 *plain l'''italic''plain
685 *plain l''''bold''' plain
686 !! html
687 <ul><li>plain</li>
688 <li>plain<i>italic</i>plain</li>
689 <li>plain<i>italic</i>plain<i>italic</i>plain</li>
690 <li>plain<b>bold</b>plain</li>
691 <li>plain<b>bold</b>plain<b>bold</b>plain</li>
692 <li>plain<i>italic</i>plain<b>bold</b>plain</li>
693 <li>plain<b>bold</b>plain<i>italic</i>plain</li>
694 <li>plain<i>italic<b>bold-italic</b>italic</i>plain</li>
695 <li>plain<b>bold<i>bold-italic</i>bold</b>plain</li>
696 <li>plain<i><b>bold-italic</b>italic</i>plain</li>
697 <li>plain<b><i>bold-italic</i>bold</b>plain</li>
698 <li>plain<i>italic<b>bold-italic</b></i>plain</li>
699 <li>plain<b>bold<i>bold-italic</i></b>plain</li>
700 <li>plain l'<i>italic</i>plain</li>
701 <li>plain l'<b>bold</b> plain</li></ul>
702 !! end
703
704 # this example taken from the [[simple:Moon]] article (T49326)
705 !! test
706 Italics and possessives (1)
707 !! wikitext
708 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
709 !! html
710 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
711 </p>
712 !! end
713
714 # this example taken from [[en:Flaming Pie]] (T51926)
715 !! test
716 Italics and possessives (2)
717 !! wikitext
718 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
719 !! html
720 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
721 </p>
722 !! end
723
724 # this example taken from [[en:Dictionary]] (T51926)
725 !! test
726 Italics and possessives (3)
727 !! wikitext
728 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
729 !! html
730 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
731 </p>
732 !! end
733
734
735 ###
736 ### 2-quote opening sequence tests
737 ###
738 !! test
739 Italics and bold: 2-quote opening sequence: (2,2)
740 !! wikitext
741 ''foo''
742 !! html
743 <p><i>foo</i>
744 </p>
745 !!end
746
747 !! test
748 Italics and bold: 2-quote opening sequence: (2,3)
749 !! wikitext
750 ''foo'''
751 !! html/*
752 <p><i>foo'</i>
753 </p>
754 !!end
755
756 !! test
757 Italics and bold: 2-quote opening sequence: (2,4)
758 !! options
759 parsoid=wt2html
760 !! wikitext
761 ''foo''''
762 !! html/*
763 <p><i>foo''</i>
764 </p>
765 !!end
766
767 # same html as previous, but wikitext adjusted to match parsoid html2wt
768 !! test
769 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
770 !! wikitext
771 ''foo<nowiki>''</nowiki>''
772 !! html
773 <p><i>foo''</i>
774 </p>
775 !! end
776
777 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
778 !! test
779 Italics and bold: 2-quote opening sequence: (2,5)
780 !! options
781 parsoid=wt2html
782 !! wikitext
783 ''foo'''''
784 !! html/php
785 <p><i>foo</i>
786 </p>
787 !! html/parsoid
788 <p><i>foo</i><b></b>
789 </p>
790 !!end
791
792 # same html as previous, but wikitext adjusted to match parsoid html2wt
793 !! test
794 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
795 !! wikitext
796 ''foo'''''<nowiki/>'''
797 !! html/php
798 <p><i>foo</i>
799 </p>
800 !! html/parsoid
801 <p><i>foo</i><b></b>
802 </p>
803 !! end
804
805
806 ###
807 ### 3-quote opening sequence tests
808 ###
809
810 !! test
811 Italics and bold: 3-quote opening sequence: (3,2)
812 !! wikitext
813 '''foo''
814 !! html/*
815 <p>'<i>foo</i>
816 </p>
817 !!end
818
819 !! test
820 Italics and bold: 3-quote opening sequence: (3,3)
821 !! wikitext
822 '''foo'''
823 !! html
824 <p><b>foo</b>
825 </p>
826 !!end
827
828 !! test
829 Italics and bold: 3-quote opening sequence: (3,4)
830 !! wikitext
831 '''foo''''
832 !! html/*
833 <p><b>foo'</b>
834 </p>
835 !!end
836
837 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
838 !! test
839 Italics and bold: 3-quote opening sequence: (3,5)
840 !! options
841 parsoid=wt2html
842 !! wikitext
843 '''foo'''''
844 !! html/php
845 <p><b>foo</b>
846 </p>
847 !! html/parsoid
848 <p><b>foo</b><i></i>
849 </p>
850 !!end
851
852 # same html as previous, but wikitext adjusted to match parsoid html2wt
853 !! test
854 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
855 !! wikitext
856 '''foo'''''<nowiki/>''
857 !! html/php
858 <p><b>foo</b>
859 </p>
860 !! html/parsoid
861 <p><b>foo</b><i></i>
862 </p>
863 !! end
864
865
866 ###
867 ### 4-quote opening sequence tests
868 ###
869
870 !! test
871 Italics and bold: 4-quote opening sequence: (4,2)
872 !! options
873 parsoid=wt2html
874 !! wikitext
875 ''''foo''
876 !! html/*
877 <p>''<i>foo</i>
878 </p>
879 !!end
880
881 # same html as previous, but wikitext adjusted to match parsoid html2wt
882 !! test
883 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
884 !! wikitext
885 <nowiki>''</nowiki>''foo''
886 !! html
887 <p>''<i>foo</i>
888 </p>
889 !! end
890
891 !! test
892 Italics and bold: 4-quote opening sequence: (4,3)
893 !! wikitext
894 ''''foo'''
895 !! html/*
896 <p>'<b>foo</b>
897 </p>
898 !!end
899
900 !! test
901 Italics and bold: 4-quote opening sequence: (4,4)
902 !! options
903 parsoid=wt2html
904 !! wikitext
905 ''''foo''''
906 !! html/*
907 <p>'<b>foo'</b>
908 </p>
909 !!end
910
911 # same html as previous, but wikitext adjusted to match parsoid html2wt
912 !! test
913 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
914 !! wikitext
915 '<nowiki/>'''foo''''
916 !! html
917 <p>'<b>foo'</b>
918 </p>
919 !! end
920
921 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
922 !! test
923 Italics and bold: 4-quote opening sequence: (4,5)
924 !! options
925 parsoid=wt2html
926 !! wikitext
927 ''''foo'''''
928 !! html/php
929 <p>'<b>foo</b>
930 </p>
931 !! html/parsoid
932 <p>'<b>foo</b><i></i>
933 </p>
934 !!end
935
936 # same html as previous, but wikitext adjusted to match parsoid html2wt
937 !! test
938 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
939 !! wikitext
940 '<nowiki/>'''foo'''''<nowiki/>''
941 !! html/php
942 <p>'<b>foo</b>
943 </p>
944 !! html/parsoid
945 <p>'<b>foo</b><i></i>
946 </p>
947 !! end
948
949
950 ###
951 ### 5-quote opening sequence tests
952 ###
953
954 !! test
955 Italics and bold: 5-quote opening sequence: (5,2)
956 !! options
957 parsoid=wt2html
958 !! wikitext
959 '''''foo''
960 !! html/*
961 <p><b><i>foo</i></b>
962 </p>
963 !!end
964
965 # same html as previous, but wikitext adjusted to match parsoid html2wt
966 !! test
967 Italics and bold: 5-quote opening sequence: (5,2+3)
968 !! wikitext
969 '''''foo'''''
970 !! html/*
971 <p><i><b>foo</b></i>
972 </p>
973 !! end
974
975 !! test
976 Italics and bold: 5-quote opening sequence: (5,3)
977 !! options
978 parsoid=wt2html
979 !! wikitext
980 '''''foo'''
981 !! html/*
982 <p><i><b>foo</b></i>
983 </p>
984 !!end
985
986 # same html as previous, but wikitext adjusted to match parsoid html2wt
987 !! test
988 Italics and bold: 5-quote opening sequence: (5,3+2)
989 !! wikitext
990 '''''foo'''''
991 !! html
992 <p><i><b>foo</b></i>
993 </p>
994 !! end
995
996 !! test
997 Italics and bold: 5-quote opening sequence: (5,4)
998 !! options
999 parsoid=wt2html
1000 !! wikitext
1001 '''''foo''''
1002 !! html/*
1003 <p><i><b>foo'</b></i>
1004 </p>
1005 !!end
1006
1007 !! test
1008 Italics and bold: 5-quote opening sequence: (5,5)
1009 !! wikitext
1010 '''''foo'''''
1011 !! html
1012 <p><i><b>foo</b></i>
1013 </p>
1014 !!end
1015
1016 !! test
1017 Italics and bold: 5-quote opening sequence: (5,6)
1018 !! wikitext
1019 '''''foo''''''
1020 !! html/*
1021 <p><i><b>foo'</b></i>
1022 </p>
1023 !! end
1024
1025 ###
1026 ### multiple quote sequences in a line
1027 ###
1028
1029 !! test
1030 Italics and bold: multiple quote sequences: (2,4,2)
1031 !! options
1032 parsoid=wt2html
1033 !! wikitext
1034 ''foo''''bar''
1035 !! html/*
1036 <p><i>foo'<b>bar</b></i>
1037 </p>
1038 !! end
1039
1040 # same html as previous, but wikitext adjusted to match parsoid html2wt
1041 !! test
1042 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
1043 !! wikitext
1044 ''foo'<nowiki/>'''bar'''''
1045 !! html
1046 <p><i>foo'<b>bar</b></i>
1047 </p>
1048 !! end
1049
1050 !! test
1051 Italics and bold: multiple quote sequences: (2,4,3)
1052 !! options
1053 parsoid=wt2html
1054 !! wikitext
1055 ''foo''''bar'''
1056 !! html/*
1057 <p><i>foo'<b>bar</b></i>
1058 </p>
1059 !! end
1060
1061 # same html as previous, but wikitext adjusted to match parsoid html2wt
1062 !! test
1063 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
1064 !! wikitext
1065 ''foo'<nowiki/>'''bar'''''
1066 !! html
1067 <p><i>foo'<b>bar</b></i>
1068 </p>
1069 !! end
1070
1071 !! test
1072 Italics and bold: multiple quote sequences: (2,4,4)
1073 !! options
1074 parsoid=wt2html
1075 !! wikitext
1076 ''foo''''bar''''
1077 !! html/*
1078 <p><i>foo'<b>bar'</b></i>
1079 </p>
1080 !! end
1081
1082 # same html as previous, but wikitext adjusted to match parsoid html2wt
1083 !! test
1084 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
1085 !! wikitext
1086 ''foo'<nowiki/>'''bar'<nowiki/>'''''
1087 !! html
1088 <p><i>foo'<b>bar'</b></i>
1089 </p>
1090 !! end
1091
1092 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1093 !! test
1094 Italics and bold: multiple quote sequences: (3,4,2)
1095 !! options
1096 parsoid=wt2html
1097 !! wikitext
1098 '''foo''''bar''
1099 !! html/php
1100 <p><b>foo'</b>bar
1101 </p>
1102 !! html/parsoid
1103 <p><b>foo'</b>bar<i></i>
1104 </p>
1105 !! end
1106
1107 # same html as previous, but wikitext adjusted to match parsoid html2wt
1108 !! test
1109 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1110 !! wikitext
1111 '''foo''''bar''<nowiki/>''
1112 !! html/php
1113 <p><b>foo'</b>bar
1114 </p>
1115 !! html/parsoid
1116 <p><b>foo'</b>bar<i></i>
1117 </p>
1118 !! end
1119
1120 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1121 !! test
1122 Italics and bold: multiple quote sequences: (3,4,3)
1123 !! options
1124 parsoid=wt2html
1125 !! wikitext
1126 '''foo''''bar'''
1127 !! html/php
1128 <p><b>foo'</b>bar
1129 </p>
1130 !! html/parsoid
1131 <p><b>foo'</b>bar<b></b>
1132 </p>
1133 !! end
1134
1135 # same html as previous, but wikitext adjusted to match parsoid html2wt
1136 !! test
1137 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1138 !! wikitext
1139 '''foo''''bar'''<nowiki/>'''
1140 !! html/php
1141 <p><b>foo'</b>bar
1142 </p>
1143 !! html/parsoid
1144 <p><b>foo'</b>bar<b></b>
1145 </p>
1146 !! end
1147
1148 ###
1149 ### other quote tests
1150 ###
1151 !! test
1152 Italics and bold: other quote tests: (2,3,5)
1153 !! wikitext
1154 ''this is about '''foo's family'''''
1155 !! html
1156 <p><i>this is about <b>foo's family</b></i>
1157 </p>
1158 !!end
1159
1160
1161 !! test
1162 Italics and bold: other quote tests: (2,(3,3),2)
1163 !! wikitext
1164 ''this is about '''foo's''' family''
1165 !! html
1166 <p><i>this is about <b>foo's</b> family</i>
1167 </p>
1168 !!end
1169
1170
1171 !! test
1172 Italics and bold: other quote tests: (3,2,3,2)
1173 !! options
1174 parsoid=wt2html
1175 !! wikitext
1176 '''this is about ''foo'''s family''
1177 !! html/*
1178 <p><b>this is about <i>foo</i></b><i>s family</i>
1179 </p>
1180 !!end
1181
1182
1183 # same html as previous, but wikitext adjusted to match parsoid html2wt
1184 !! test
1185 Italics and bold: other quote tests: (3,2,3+2+2,2)
1186 !! wikitext
1187 '''this is about ''foo'''''<nowiki/>''s family''
1188 !! html
1189 <p><b>this is about <i>foo</i></b><i>s family</i>
1190 </p>
1191 !! end
1192
1193
1194 !! test
1195 Italics and bold: other quote tests: (3,2,3,3)
1196 !! wikitext
1197 '''this is about ''foo'''s family'''
1198 !! html/*
1199 <p>'<i>this is about </i>foo<b>s family</b>
1200 </p>
1201 !!end
1202
1203
1204 !! test
1205 Italics and bold: other quote tests: (3,(2,2),3)
1206 !! wikitext
1207 '''this is about ''foo's'' family'''
1208 !! html
1209 <p><b>this is about <i>foo's</i> family</b>
1210 </p>
1211 !!end
1212
1213
1214 !! test
1215 Italicized possessive
1216 !! wikitext
1217 The ''[[Main Page]]'''s talk page.
1218 !! html/php
1219 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1220 </p>
1221 !! html/parsoid
1222 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1223 !! end
1224
1225 !! test
1226 Quote balancing context should be restricted to td/th cells on the same wikitext line
1227 !! options
1228 parsoid=wt2html,wt2wt
1229 !! wikitext
1230 {|
1231 !''a!!''b
1232 |''a||''b
1233 |}
1234 !! html+tidy
1235 <table>
1236 <tbody><tr>
1237 <th><i>a</i></th>
1238 <th><i>b</i>
1239 </th>
1240 <td><i>a</i></td>
1241 <td><i>b</i>
1242 </td></tr></tbody></table>
1243 !! end
1244
1245 !! test
1246 Bold conversion test
1247 !! wikitext
1248 a b'''c ''d e'''f'' g h'''i ''j
1249 !! options
1250 parsoid=wt2html
1251 !! html+tidy
1252 <p>a b'<i>c </i>d e<b>f<i> g h</i></b><i>i </i>j
1253 </p>
1254 !! end
1255
1256 ###
1257 ### Non-html5 tags
1258 ###
1259
1260 !! test
1261 Non-html5 tags should be accepted
1262 !! wikitext
1263 <center>''foo''</center>
1264 <big>''foo''</big>
1265 <font>''foo''</font>
1266 <strike>''foo''</strike>
1267 <tt>''foo''</tt>
1268 !! html
1269 <center><i>foo</i></center>
1270 <p><big><i>foo</i></big>
1271 <font><i>foo</i></font>
1272 <strike><i>foo</i></strike>
1273 <tt><i>foo</i></tt>
1274 </p>
1275 !! end
1276
1277 !! test
1278 <wbr> is valid wikitext (T54468)
1279 !! wikitext
1280 <wbr>
1281 !! html
1282 <p><wbr />
1283 </p>
1284 !! end
1285
1286 # <strike> is HTML4, <s> is HTML4/5.
1287 !! test
1288 <s> or <strike> for strikethrough
1289 !! wikitext
1290 <strike>strike</strike>
1291
1292 <s>s</s>
1293 !! html
1294 <p><strike>strike</strike>
1295 </p><p><s>s</s>
1296 </p>
1297 !! end
1298
1299 ## a not permitted
1300 ## i,b,br omitted
1301 !! test
1302 Text-level semantic html elements in wikitext
1303 !! wikitext
1304 <em>text</em>
1305 <strong>text</strong>
1306 <small>text</small>
1307 <s>text</s>
1308 <cite>text</cite>
1309 <q>text</q>
1310 <dfn>text</dfn>
1311 <abbr>text</abbr>
1312 <data>text</data>
1313 <time>text</time>
1314 <code>text</code>
1315 <var>text</var>
1316 <samp>text</samp>
1317 <kbd>text</kbd>
1318 <sub>text</sub>
1319 <u>text</u>
1320 <mark>text</mark>
1321 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1322 <bdi>text</bdi>
1323 <bdo>text</bdo>
1324 <span>text</span>
1325 <wbr />
1326 !! html
1327 <p><em>text</em>
1328 <strong>text</strong>
1329 <small>text</small>
1330 <s>text</s>
1331 <cite>text</cite>
1332 <q>text</q>
1333 <dfn>text</dfn>
1334 <abbr>text</abbr>
1335 <data>text</data>
1336 <time>text</time>
1337 <code>text</code>
1338 <var>text</var>
1339 <samp>text</samp>
1340 <kbd>text</kbd>
1341 <sub>text</sub>
1342 <u>text</u>
1343 <mark>text</mark>
1344 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1345 <bdi>text</bdi>
1346 <bdo>text</bdo>
1347 <span>text</span>
1348 <wbr />
1349 </p>
1350 !! end
1351
1352 # test cases taken from
1353 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1354 !! test
1355 Ruby markup (W3C-style)
1356 !! wikitext
1357 ;Mono-ruby for individual base characters
1358 :<ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1359 ;Group ruby
1360 :<ruby>今日<rt>きょう</rt></ruby>
1361 ;Jukugo ruby
1362 :<ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1363 ;Inline ruby
1364 :<ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1365 ;Double-sided ruby
1366 :<ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1367
1368 <ruby>
1369 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1370 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1371 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1372 </ruby>
1373 !! html
1374 <dl><dt>Mono-ruby for individual base characters</dt>
1375 <dd><ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1376 <dt>Group ruby</dt>
1377 <dd><ruby>今日<rt>きょう</rt></ruby></dd>
1378 <dt>Jukugo ruby</dt>
1379 <dd><ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1380 <dt>Inline ruby</dt>
1381 <dd><ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1382 <dt>Double-sided ruby</dt>
1383 <dd><ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1384 <p><ruby>
1385 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1386 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1387 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1388 </ruby>
1389 </p>
1390 !! end
1391
1392 # The next two test different paths in the sanitizer.
1393 !! test
1394 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1395 !! wikitext
1396 <blockquote|>a</blockquote>
1397
1398 <b→> doesn't terminate </b→>
1399
1400 <bä> doesn't terminate </bä>
1401
1402 <boo> doesn't terminate </boo>
1403
1404 <s.foo> doesn't terminate </s.foo>
1405
1406 <sub-ID#1>
1407 !! html/php
1408 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1409 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1410 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1411 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1412 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1413 </p><p>&lt;sub-ID#1&gt;
1414 </p>
1415 !! end
1416
1417 !! test
1418 Non-word characters don't terminate tag names
1419 !! wikitext
1420 <blockquote|>a</blockquote>
1421
1422 <b→> doesn't terminate </b→>
1423
1424 <bä> doesn't terminate </bä>
1425
1426 <boo> doesn't terminate </boo>
1427
1428 <s.foo> doesn't terminate </s.foo>
1429
1430 <sub-ID#1>
1431 !! html+tidy
1432 <p>&lt;blockquote|&gt;a
1433 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1434 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1435 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1436 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1437 </p><p>&lt;sub-ID#1&gt;
1438 </p>
1439 !! end
1440
1441 ###
1442 ### See tests/parser/ParserTestParserHook.php for the <tåg> extension)
1443 ### This checks that HTML5 tags (with non-word characters in the tag
1444 ### name) make it safely through the parser -- the Sanitizer will
1445 ### munge them later, as it should.
1446 ###
1447 !! test
1448 Non-word characters are valid in extension tags (T19663)
1449 !! wikitext
1450 <tåg>tåg</tåg>
1451 !! html/php
1452 <pre>
1453 'tåg'
1454 array (
1455 )
1456 </pre>
1457 !! html/parsoid
1458 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1459 !! end
1460
1461 !! test
1462 Isolated close tags should be treated as literal text (T54760)
1463 !! options
1464 parsoid=wt2html
1465 !! wikitext
1466 </b>
1467
1468 <s.foo>s</s>
1469 !! html+tidy
1470 <p class="mw-empty-elt">
1471 </p><p>&lt;s.foo&gt;s
1472 </p>
1473 !! end
1474
1475 ###
1476 ### Special characters
1477 ###
1478
1479 !! test
1480 Bare pipe character (T54363)
1481 !! wikitext
1482 |
1483 !! html
1484 <p>|
1485 </p>
1486 !! end
1487
1488 !! test
1489 Bare pipe character from a template (T54363)
1490 !! wikitext
1491 {{pipe}}
1492 !! html
1493 <p>|
1494 </p>
1495 !! end
1496
1497 ###
1498 ### <nowiki> test cases
1499 ###
1500
1501 !! test
1502 <nowiki> unordered list
1503 !! wikitext
1504 <nowiki>* This is not an unordered list item.</nowiki>
1505 !! html/php
1506 <p>* This is not an unordered list item.
1507 </p>
1508 !! html/parsoid
1509 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1510 !! end
1511
1512 !! test
1513 <nowiki> spacing
1514 !! wikitext
1515 <nowiki>Lorem ipsum dolor
1516
1517 sed abit.
1518 sed nullum.
1519
1520 :and a colon
1521 </nowiki>
1522 !! html/php
1523 <p>Lorem ipsum dolor
1524
1525 sed abit.
1526 sed nullum.
1527
1528 :and a colon
1529
1530 </p>
1531 !! html/parsoid
1532 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1533
1534 sed abit.
1535 sed nullum.
1536
1537 :and a colon
1538 </span></p>
1539 !! end
1540
1541 !! test
1542 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1543 !! wikitext
1544 <nowiki><span class="error"></nowiki>
1545 !! html/php
1546 <p>&lt;span class="error"&gt;
1547 </p>
1548 !! html/parsoid
1549 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1550 !! end
1551
1552 !! test
1553 nowiki 3
1554 !! wikitext
1555 :There is not nowiki.
1556 :There is <nowiki>nowiki</nowiki>.
1557
1558 #There is not nowiki.
1559 #There is <nowiki>nowiki</nowiki>.
1560
1561 *There is not nowiki.
1562 *There is <nowiki>nowiki</nowiki>.
1563 !! html/php
1564 <dl><dd>There is not nowiki.</dd>
1565 <dd>There is nowiki.</dd></dl>
1566 <ol><li>There is not nowiki.</li>
1567 <li>There is nowiki.</li></ol>
1568 <ul><li>There is not nowiki.</li>
1569 <li>There is nowiki.</li></ul>
1570 !! html/parsoid
1571 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1572 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1573
1574 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1575 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1576
1577 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1578 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1579 !! end
1580
1581 !! test
1582 Entities inside <nowiki>
1583 !! wikitext
1584 <nowiki>&lt;</nowiki>
1585 !! html/php
1586 <p>&lt;
1587 </p>
1588 !! html/parsoid
1589 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1590 !! end
1591
1592 !! test
1593 Entities inside template parameters
1594 !! wikitext
1595 {{echo|&ndash;}}
1596 !! html/php+tidy
1597 <p>&#8211;
1598 </p>
1599 !! html/parsoid
1600 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1601 !! end
1602
1603 !! test
1604 Properly escape nowiki when combined with other wiki markup
1605 !! options
1606 parsoid=html2wt
1607 !! html/parsoid
1608 <p>* &lt;/nowiki&gt; tag</p>
1609 !! wikitext
1610 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1611 !! end
1612
1613 !! test
1614 T93824: Put escaped HTML tags inside nowiki
1615 !! options
1616 parsoid=html2wt
1617 !! html/parsoid
1618 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1619 !! wikitext
1620 <nowiki><h2>foo</h2></nowiki>
1621 !! end
1622
1623 !! test
1624 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1625 !! options
1626 parsoid=html2wt
1627 !! html/parsoid
1628 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1629 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1630 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1631 !! wikitext
1632 This text: L'[[Foo]]
1633 This text: L<nowiki>''</nowiki>[[Foo]]
1634 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1635 !! end
1636
1637 # This test fails because wikitext whitespace is not normalized before comparing.
1638 !! test
1639 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1640 !! options
1641 parsoid=html2wt
1642 !! html/parsoid
1643 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1644 </p>
1645 !! wikitext
1646 This text : L<nowiki>''</nowiki>[[Foo]]
1647 !! end
1648
1649 # This test and the next one are html2wt only as they test that incorrect wikitext
1650 # passed in template arguments gets escaped or wrapped in nowikis where required.
1651 !! test
1652 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1653 !! options
1654 parsoid=html2wt
1655 !! html/parsoid
1656 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1657 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1658 !! wikitext
1659 {{echo|foo{{!}}bar}}
1660 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1661 !! end
1662
1663 !! test
1664 T53961: Output correct nowikis in template arguments
1665 !! options
1666 parsoid=html2wt
1667 !! html/parsoid
1668 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1669 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1670 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1671 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1672 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1673 !! wikitext
1674 {{echo|a [ b}}
1675 {{echo|<nowiki>a }} b</nowiki>}}
1676 {{echo|<nowiki>a [[ b</nowiki>}}
1677 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1678 {{echo|a <nowiki>}</nowiki>}}
1679 !! end
1680
1681 !! test
1682 Cases where "!!" needs nowiki protection
1683 !! options
1684 parsoid=html2wt
1685 !! html/parsoid
1686 <table>
1687 <tr><th>this needs protection !! here</th></tr>
1688 </table>
1689
1690 <table>
1691 <tr><th>this does not need
1692 protection !! here</th></tr>
1693 </table>
1694 !! wikitext
1695 {|
1696 !<nowiki>this needs protection !! here</nowiki>
1697 |}
1698
1699 {|
1700 !this does not need
1701 protection !! here
1702 |}
1703 !! end
1704
1705 ###
1706 ### Comments
1707 ###
1708 !! test
1709 Comments and Indent-Pre
1710 !! wikitext
1711 <!-- comment 1 --> asdf
1712
1713 <!-- comment 1 --> asdf
1714 <!-- comment 2 -->
1715
1716 <!-- comment 1 --> asdf
1717 <!-- comment 2 -->xyz
1718
1719 <!-- comment 1 --> asdf
1720 <!-- comment 2 --> xyz
1721 !! html
1722 <pre>asdf
1723 </pre>
1724 <pre>asdf
1725 </pre>
1726 <pre>asdf
1727 </pre>
1728 <p>xyz
1729 </p>
1730 <pre>asdf
1731 xyz
1732 </pre>
1733 !! end
1734
1735 !! test
1736 Comment test 2a
1737 !! wikitext
1738 asdf
1739 <!-- comment 1 -->
1740 jkl
1741 !! html
1742 <p>asdf
1743 jkl
1744 </p>
1745 !! end
1746
1747 !! test
1748 Comment test 2b
1749 !! wikitext
1750 asdf
1751 <!-- comment 1 -->
1752
1753 jkl
1754 !! html
1755 <p>asdf
1756 </p><p>jkl
1757 </p>
1758 !! end
1759
1760 !! test
1761 Comment test 3
1762 !! wikitext
1763 asdf
1764 <!-- comment 1 -->
1765 <!-- comment 2 -->
1766 jkl
1767 !! html
1768 <p>asdf
1769 jkl
1770 </p>
1771 !! end
1772
1773 !! test
1774 Comment test 4
1775 !! wikitext
1776 asdf<!-- comment 1 -->jkl
1777 !! html
1778 <p>asdfjkl
1779 </p>
1780 !! end
1781
1782 !! test
1783 Comment spacing
1784 !! wikitext
1785 a
1786 <!-- foo --> b <!-- bar -->
1787 c
1788 !! html
1789 <p>a
1790 </p>
1791 <pre> b
1792 </pre>
1793 <p>c
1794 </p>
1795 !! end
1796
1797 !! test
1798 Comment whitespace
1799 !! wikitext
1800 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1801 !! html
1802 !! end
1803
1804 !! test
1805 Comment semantics and delimiters
1806 !! wikitext
1807 <!-- --><!----><!-----><!------>
1808 !! html/php
1809 !! html/parsoid
1810 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1811 !! end
1812
1813 !! test
1814 Comment semantics and delimiters, redux
1815 !! wikitext
1816 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1817 -- foo -- funky huh? ... -->
1818 !! html/php
1819 !! html/parsoid
1820 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1821 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1822 !! end
1823
1824 !! test
1825 Comment semantics and delimiters: directors cut
1826 !! wikitext
1827 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1828 everything starting with < followed by !-- until the first -- and > we see,
1829 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1830 -->-->
1831 !! html/php
1832 <p>--&gt;
1833 </p>
1834 !! html/parsoid
1835 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1836 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1837 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1838 --><p>--></p>
1839 !! end
1840
1841 !! test
1842 Comment semantics: nesting
1843 !! wikitext
1844 <!--<!-- no, we're not going to do anything fancy here -->-->
1845 !! html/php
1846 <p>--&gt;
1847 </p>
1848 !! html/parsoid
1849 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1850 !! end
1851
1852 # Parsoid closes the unclosed comment, even if it means a slight
1853 # round-trip diff.
1854 !! test
1855 Comment semantics: unclosed comment at end
1856 !! options
1857 parsoid=wt2html,html2html
1858 !! wikitext
1859 <!--This comment will run out to the end of the document
1860 !! html/php
1861 !! html/parsoid
1862 <!--This comment will run out to the end of the document-->
1863 !! end
1864
1865 !! test
1866 Comment semantics: normalize comments to play nice with XML and browsers
1867 !! wikitext
1868 <!-- Browsers --!> think this is closed -->
1869 <!--> This would normally be text -->
1870 <!---> As would this -->
1871 <!-- XML doesn't like trailing dashes -------->
1872 <!-- Nor doubled hyphens -- anywhere in the data -->
1873 But this is not a comment.
1874 !! html/php
1875 <p>But this is not a comment.
1876 </p>
1877 !! html/parsoid
1878 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1879 <!--&#x3E; This would normally be text -->
1880 <!--&#x2D;&#x3E; As would this -->
1881 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1882 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1883 <p>But this is not a comment.</p>
1884 !! end
1885
1886 !! test
1887 Comment semantics: round-trip even text which contains encoded -->
1888 !! wikitext
1889 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1890 !! html/parsoid
1891 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1892 !! end
1893
1894 !! test
1895 Comment in template title
1896 !! wikitext
1897 {{f<!---->oo}}
1898 !! html
1899 <p>FOO
1900 </p>
1901 !! end
1902
1903 !! test
1904 Comment on its own line post-expand
1905 !! wikitext
1906 a
1907 {{blank}}<!---->
1908 b
1909 !! html
1910 <p>a
1911 </p><p>b
1912 </p>
1913 !! end
1914
1915 !! test
1916 Comment on its own line post-expand with non-significant whitespace
1917 !! wikitext
1918 a
1919 {{blank}} <!---->
1920 b
1921 !! html
1922 <p>a
1923 </p><p>b
1924 </p>
1925 !! end
1926
1927 !! test
1928 post-expand include size being exceeded
1929 !! options
1930 maxincludesize=20
1931 !! wikitext
1932 {{echo3|1234567890}}
1933 !! html
1934 <p><a href="/wiki/Template:Echo3" title="Template:Echo3">Template:Echo3</a><!-- WARNING: template omitted, post-expand include size too large -->
1935 </p>
1936 !! end
1937
1938 !! test
1939 max template depth being reached
1940 !! options
1941 maxtemplatedepth=1
1942 !! wikitext
1943 {{echo with depth|too deep!}}
1944 !! html
1945 <p><span class="error">Template recursion depth limit exceeded (1)</span>
1946 </p>
1947 !! end
1948
1949 !! test
1950 multiple templates that are redirects
1951 !! wikitext
1952 {{redirect to foo}}
1953 {{redirect to foo}}
1954 !! html
1955 <p>FOO
1956 FOO
1957 </p>
1958 !! end
1959
1960 !! test
1961 Multiple comments should still parse as SOL-transparent
1962 !! options
1963 parsoid=wt2html,wt2wt
1964 !! wikitext
1965 <!--c1-->*a
1966 <!--c2--><!--c3--><!--c4-->*b
1967 !! html/php
1968 <ul><li>a</li>
1969 <li>b</li></ul>
1970 !! html/parsoid
1971 <!--c1--><ul>
1972 <li>a
1973 </li>
1974 <!--c2--><!--c3--><!--c4-->
1975 <li>b
1976 </li>
1977 </ul>
1978 !! end
1979
1980 ## Make sure ">" gets escaped in comments to avoid XSS
1981 !! test
1982 IE conditional comments
1983 !! wikitext
1984 <!--[if lt IE 9]>
1985 <script>alert('hi');</script>
1986 <![endif]-->
1987 !! html/parsoid
1988 <!--[if lt IE 9]&#x3E;
1989 <script&#x3E;alert('hi');</script&#x3E;
1990 <![endif]-->
1991 !! end
1992
1993 ###
1994 ### paragraph wrapping tests
1995 ###
1996
1997 !! test
1998 No block tags
1999 !! wikitext
2000 a
2001
2002 b
2003 !! html
2004 <p>a
2005 </p><p>b
2006 </p>
2007 !! end
2008
2009 !! test
2010 Block tag on one line (<div>)
2011 !! wikitext
2012 a <div>foo</div>
2013
2014 b
2015 !! html
2016 a <div>foo</div>
2017 <p>b
2018 </p>
2019 !! html+tidy
2020 <p>a </p><div>foo</div>
2021 <p>b
2022 </p>
2023 !! end
2024
2025 !! test
2026 No p-wrappable content
2027 !! options
2028 parsoid=wt2html,html2html
2029 !! wikitext
2030 <span><div>x</div></span>
2031 <span><s><div>x</div></s></span>
2032 <small><em></em></small><span><s><div>x</div></s></span>
2033 !! html+tidy
2034 <span><div>x</div></span>
2035 <span><s><div>x</div></s></span>
2036 <p><small><em></em></small></p><span><s><div>x</div></s></span>
2037 !! end
2038
2039 # T177612: Parsoid-only test
2040 !! test
2041 Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code
2042 !! wikitext
2043 {{echo|<span><div>x</div></span>}}
2044 x
2045 !! html/parsoid
2046 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>&lt;div>x&lt;/div>&lt;/span>"}},"i":0}}]}'><div>x</div></span>
2047 <p>x</p>
2048 !! end
2049
2050 !! test
2051 Block tag on one line (<blockquote>)
2052 !! wikitext
2053 a <blockquote>foo</blockquote>
2054
2055 b
2056 !! html
2057 a <blockquote>foo</blockquote>
2058 <p>b
2059 </p>
2060 !! html+tidy
2061 <p>a </p><blockquote><p>foo</p></blockquote>
2062 <p>b
2063 </p>
2064 !! end
2065
2066 !! test
2067 Block tag on both lines (<div>)
2068 !! wikitext
2069 a <div>foo</div>
2070
2071 b <div>foo</div>
2072 !! html
2073 a <div>foo</div>
2074 b <div>foo</div>
2075 !! html+tidy
2076 <p>a </p><div>foo</div><p>
2077 b </p><div>foo</div>
2078 !! end
2079
2080 !! test
2081 Block tag on both lines (<blockquote>)
2082 !! wikitext
2083 a <blockquote>foo</blockquote>
2084
2085 b <blockquote>foo</blockquote>
2086 !! html
2087 a <blockquote>foo</blockquote>
2088 b <blockquote>foo</blockquote>
2089 !! html+tidy
2090 <p>a </p><blockquote><p>foo</p></blockquote><p>
2091 b </p><blockquote><p>foo</p></blockquote>
2092 !! end
2093
2094 !! test
2095 Multiple lines without block tags
2096 !! wikitext
2097 <div>foo</div> a
2098 b
2099 c
2100 d<!--foo--> e
2101 x <div>foo</div> z
2102 !! html
2103 <div>foo</div> a
2104 <p>b
2105 c
2106 d e
2107 </p>
2108 x <div>foo</div> z
2109 !! html+tidy
2110 <div>foo</div><p> a
2111 </p><p>b
2112 c
2113 d e
2114 </p><p>
2115 x </p><div>foo</div><p> z</p>
2116 !! end
2117
2118 !! test
2119 Empty lines between lines with block tags
2120 !! wikitext
2121 <div></div>
2122
2123
2124 <div></div>a
2125
2126 b
2127 <div>a</div>b
2128
2129 <div>b</div>d
2130
2131
2132 <div>e</div>
2133 !! html
2134 <div></div>
2135 <p><br />
2136 </p>
2137 <div></div>a
2138 <p>b
2139 </p>
2140 <div>a</div>b
2141 <div>b</div>d
2142 <p><br />
2143 </p>
2144 <div>e</div>
2145 !! html+tidy
2146 <div></div>
2147 <p><br />
2148 </p>
2149 <div></div><p>a
2150 </p><p>b
2151 </p>
2152 <div>a</div><p>b
2153 </p><div>b</div><p>d
2154 </p><p><br />
2155 </p>
2156 <div>e</div>
2157 !! html/parsoid
2158 <div data-parsoid='{"stx":"html"}'></div>
2159
2160 <p><br /></p>
2161 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2162
2163 <p>b</p>
2164 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2165
2166 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2167
2168 <p><br /></p>
2169 <div data-parsoid='{"stx":"html"}'>e</div>
2170 !! end
2171
2172 !! test
2173 Unclosed HTML p-tags should be handled properly
2174 !! wikitext
2175 <div><p>foo</div>
2176 a
2177
2178 b
2179 !! html/php+tidy
2180 <div><p>foo</p></div>
2181 <p>a
2182 </p><p>b
2183 </p>
2184 !! html/parsoid
2185 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2186 <p>a</p>
2187 <p>b</p>
2188 !! end
2189
2190 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2191 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2192 ## them for now.
2193 !! test
2194 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2195 !! options
2196 parsoid=wt2html
2197 !! wikitext
2198 a [[Category:A1]] [[Category:A2]]
2199 [[Category:A3]]
2200 [[Category:A4]]
2201 !! html/parsoid
2202 <p>a</p>
2203 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2204 !! end
2205
2206 !! test
2207 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2208 !! options
2209 parsoid=wt2html
2210 !! wikitext
2211 [[Category:A1]]a
2212 !! html/parsoid
2213 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2214 !! end
2215
2216 !! test
2217 No paragraph necessary for SOL transparent template
2218 !! wikitext
2219 <span><div>foo</div></span>
2220 [[Category:Foo]]
2221
2222 <span><div>foo</div></span>
2223 {{echo|[[Category:Foo]]}}
2224 !! html/php
2225 <span><div>foo</div></span>
2226 <span><div>foo</div></span>
2227 !! html/parsoid
2228 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2229 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
2230
2231 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2232 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]"}},"i":0}}]}'/>
2233 !! end
2234
2235 !! test
2236 Avoid expanding multiline sol transparent template ranges unnecessarily
2237 !! wikitext
2238 hi
2239
2240
2241 {{echo|<br/>
2242 }}
2243
2244 [[Category:Ho]]
2245 !! html/php
2246 <p>hi
2247 </p><p><br />
2248 <br />
2249 </p>
2250 !! html/parsoid
2251 <p>hi</p>
2252
2253 <p><br />
2254 <br about="#mwt1" typeof="mw:Transclusion" data-parsoid='{}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;br/>\n"}},"i":0}}]}'/><span about="#mwt1">
2255 </span></p>
2256
2257 <link rel="mw:PageProp/Category" href="./Category:Ho" />
2258 !! end
2259
2260 !! test
2261 Paragraph wrapping following unclosed table
2262 !! options
2263 parsoid=wt2html,html2html
2264 !! wikitext
2265 {|
2266 |-
2267
2268 {|
2269 | x
2270 |}
2271
2272 a
2273
2274 b
2275
2276 c
2277 !! html/php+tidy
2278 <table>
2279
2280
2281 </table><table>
2282 <tbody><tr>
2283 <td>x
2284 </td></tr></tbody></table>
2285 <p>a
2286 </p><p>b
2287 </p><p>c
2288 </p>
2289 !! html/parsoid
2290 <table data-parsoid='{"autoInsertedEnd":true}'>
2291 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr>
2292
2293 </tbody></table><table>
2294 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>x</td></tr>
2295 </tbody></table>
2296
2297 <p>a</p>
2298
2299 <p>b</p>
2300
2301 <p>c</p>
2302 !! end
2303
2304 !! test
2305 Paragraph wrapping suppressed in html p
2306 !! options
2307 parsoid=wt2html,html2html
2308 !! wikitext
2309 <p>
2310
2311
2312 hi
2313
2314
2315
2316 </p>
2317 !! html/php+tidy
2318 <p>
2319
2320
2321 hi
2322
2323
2324
2325 </p>
2326 !! html/parsoid
2327 <p data-parsoid='{"stx":"html"}'>
2328
2329
2330 hi
2331
2332
2333
2334 </p>
2335 !! end
2336
2337 !! test
2338 Dangling table row doesn't prevent p-wrapping
2339 !! options
2340 parsoid=wt2html,html2html
2341 !! wikitext
2342 {|
2343 | hi
2344 |-
2345 |} ho
2346 !! html/parsoid
2347 <table>
2348 <tbody><tr><td>hi</td></tr>
2349 <tr class="mw-empty-elt"></tr>
2350 </tbody></table><p> ho</p>
2351 !! end
2352
2353 !! test
2354 P-wrapping non-breaking spaces
2355 !! wikitext
2356  
2357 !! html/php+tidy
2358 <p>&#160;
2359 </p>
2360 !! html/parsoid
2361 <p> </p>
2362 !! end
2363
2364 ###
2365 ### Preformatted text
2366 ###
2367
2368 !! test
2369 Preformatted text
2370 !! wikitext
2371 This is some
2372 Preformatted text
2373 With ''italic''
2374 And '''bold'''
2375 And a [[Main Page|link]]
2376 !! html
2377 <pre>This is some
2378 Preformatted text
2379 With <i>italic</i>
2380 And <b>bold</b>
2381 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2382 </pre>
2383 !! end
2384
2385 !! test
2386 Tabs don't trigger preformatted text
2387 !! wikitext
2388 This is not
2389 preformatted text.
2390 This is preformatted text.
2391 So is this.
2392 !! html/php
2393 <p> This is not
2394 preformatted text.
2395 </p>
2396 <pre>This is preformatted text.
2397 So is this.
2398 </pre>
2399 !! html/parsoid
2400 <p> This is not
2401 preformatted text.</p>
2402 <pre>This is preformatted text.
2403 So is this.</pre>
2404 !! end
2405
2406 !! test
2407 Space before tab needs nowiki pre protection
2408 !! options
2409 parsoid=html2wt
2410 !! html/parsoid
2411 <p> a</p>
2412 !! wikitext
2413 <nowiki> </nowiki> a
2414 !! end
2415
2416 !! test
2417 Ident preformatting with inline content
2418 !! wikitext
2419 a
2420 ''b''
2421 !! html
2422 <pre>a
2423 <i>b</i>
2424 </pre>
2425 !! end
2426
2427 !! test
2428 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2429 !! wikitext
2430 <pre><nowiki>
2431 <b>
2432 <cite>
2433 <em>
2434 </nowiki></pre>
2435 !! html
2436 <pre>
2437 &lt;b&gt;
2438 &lt;cite&gt;
2439 &lt;em&gt;
2440 </pre>
2441 !! end
2442
2443 !! test
2444 Regression with preformatted in <center>
2445 !! wikitext
2446 <center>
2447 Blah
2448 </center>
2449 !! html
2450 <center>
2451 <pre>Blah
2452 </pre>
2453 </center>
2454 !! end
2455
2456 !! test
2457 T54763: Preformatted in <blockquote>
2458 !! wikitext
2459 <blockquote>
2460 Blah
2461 {|
2462 |
2463 indented cell (no pre-wrapping!)
2464 |}
2465 </blockquote>
2466 !! html
2467 <blockquote>
2468 <p> Blah
2469 </p>
2470 <table>
2471 <tr>
2472 <td>
2473 <p> indented cell (no pre-wrapping!)
2474 </p>
2475 </td></tr></table>
2476 </blockquote>
2477 !! end
2478
2479 !! test
2480 T53086: Double newlines in blockquotes should be turned into paragraphs
2481 !! wikitext
2482 <blockquote>
2483 Foo
2484
2485 Bar
2486 </blockquote>
2487 !! html
2488 <blockquote>
2489 <p>Foo
2490 </p><p>Bar
2491 </p>
2492 </blockquote>
2493 !! end
2494
2495 !! test
2496 T17491: <ins>/<del> in blockquote
2497 !! wikitext
2498 <blockquote>
2499 Foo <del>bar</del> <ins>baz</ins> quux
2500 </blockquote>
2501 !! html
2502 <blockquote>
2503 <p>Foo <del>bar</del> <ins>baz</ins> quux
2504 </p>
2505 </blockquote>
2506 !! html+tidy
2507 <blockquote>
2508 <p>Foo <del>bar</del> <ins>baz</ins> quux
2509 </p>
2510 </blockquote>
2511 !! end
2512
2513 !! test
2514 T17491: <ins>/<del> in blockquote (2)
2515 !! wikitext
2516 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2517 </blockquote>
2518 !! html
2519 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2520 </blockquote>
2521 !! html+tidy
2522 <blockquote><p>Foo <del>bar</del> <ins>baz</ins> quux
2523 </p></blockquote>
2524 !! end
2525
2526 !! test
2527 <pre> with attributes (T5202)
2528 !! wikitext
2529 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2530 !! html
2531 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2532 !! end
2533
2534 !! test
2535 <pre> with width attribute (T5202)
2536 !! wikitext
2537 <pre width="8">Narrow screen goodies</pre>
2538 !! html
2539 <pre width="8">Narrow screen goodies</pre>
2540 !! end
2541
2542 !! test
2543 <pre> with forbidden attribute (T5202)
2544 !! wikitext
2545 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2546 !! html
2547 <pre width="8">Narrow screen goodies</pre>
2548 !! end
2549
2550 !! test
2551 Entities inside <pre>
2552 !! wikitext
2553 <pre>&lt;</pre>
2554 !! html
2555 <pre>&lt;</pre>
2556 !! end
2557
2558 !! test
2559 <pre> with forbidden attribute values (T5202)
2560 !! wikitext
2561 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2562 !! html
2563 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2564 !! end
2565
2566 !! test
2567 <nowiki> inside <pre> (T15238)
2568 !! wikitext
2569 <pre>
2570 <nowiki>
2571 </pre>
2572 <pre>
2573 <nowiki></nowiki>
2574 </pre>
2575 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2576 !! html
2577 <pre>
2578 &lt;nowiki&gt;
2579 </pre>
2580 <pre>
2581
2582 </pre>
2583 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2584 !! end
2585
2586 !! test
2587 <nowiki> inside of #tag:pre
2588 !! wikitext
2589 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2590 !! html/php
2591 <pre>Foo &#8594;bar</pre>
2592 !! html/parsoid
2593 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2594 !! end
2595
2596 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2597 ## aren't enclosed in nowikis.
2598 !! test
2599 <nowiki> and <pre> preference (first one wins)
2600 !! options
2601 parsoid=wt2html
2602 !! wikitext
2603 <pre>
2604 <nowiki>
2605 </pre>
2606 </nowiki>
2607 </pre>
2608
2609 <nowiki>
2610 <pre>
2611 <nowiki>
2612 </pre>
2613 </nowiki>
2614 </pre>
2615
2616 !! html/php
2617 <pre>
2618 &lt;nowiki&gt;
2619 </pre>
2620 <p>&lt;/nowiki&gt;
2621 &lt;/pre&gt;
2622 </p><p>
2623 &lt;pre&gt;
2624 &lt;nowiki&gt;
2625 &lt;/pre&gt;
2626
2627 &lt;/pre&gt;
2628 </p>
2629 !! html/parsoid
2630 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2631 </pre>
2632 <p>&lt;/nowiki></p>
2633
2634
2635 <p><span typeof="mw:Nowiki">
2636 &lt;pre>
2637 &lt;nowiki>
2638 &lt;/pre>
2639 </span></p>
2640 !! end
2641
2642 !! test
2643 </pre> inside nowiki
2644 !! wikitext
2645 <nowiki></pre></nowiki>
2646 !! html
2647 <p>&lt;/pre&gt;
2648 </p>
2649 !! end
2650
2651 !! test
2652 Empty pre; pre inside other HTML tags (T56946)
2653 !! wikitext
2654 a
2655
2656 <div><pre>
2657 foo
2658 </pre></div>
2659 <pre></pre>
2660 !! html/php+tidy
2661 <p>a
2662 </p>
2663 <div><pre>foo
2664 </pre></div>
2665 <pre></pre>
2666 !! html/parsoid
2667 <p>a</p>
2668
2669 <div data-parsoid='{"stx":"html"}'><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
2670 </pre></div>
2671 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2672 !! end
2673
2674 !! test
2675 HTML pre followed by indent-pre
2676 !! wikitext
2677 <pre>foo</pre>
2678 bar
2679 !! html
2680 <pre>foo</pre>
2681 <pre>bar
2682 </pre>
2683 !! end
2684
2685 !! test
2686 Block tag pre
2687 !! wikitext
2688 <p><pre>foo</pre></p>
2689 !! html/php+tidy
2690 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2691 !! html/parsoid
2692 <p class='mw-empty-elt' data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre><p class='mw-empty-elt' data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2693 !! end
2694
2695 !!test
2696 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2697 !! wikitext
2698 {{echo|}}
2699 !! html
2700 !! end
2701
2702 !!test
2703 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2704 !! wikitext
2705 {{echo|
2706 foo}}
2707 !! html
2708 <p>foo
2709 </p>
2710 !!end
2711
2712 !! test
2713 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2714 !! wikitext
2715 {{echo|a
2716 b}}
2717 !! html
2718 <pre>a
2719 </pre>
2720 <p>b
2721 </p>
2722 !!end
2723
2724 !! test
2725 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2726 !! wikitext
2727 {{echo|a
2728 b
2729 c
2730 d
2731 e
2732 }}
2733 !! html
2734 <pre>a
2735 </pre>
2736 <p>b
2737 c
2738 </p>
2739 <pre>d
2740 </pre>
2741 <p>e
2742 </p>
2743 !!end
2744
2745 !!test
2746 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2747 !! wikitext
2748 {{echo| foo}}
2749
2750 {{echo| foo}}{{echo| bar}}
2751
2752 {{echo| foo}}
2753 {{echo| bar}}
2754
2755 {{echo|<!--cmt--> foo}}
2756
2757 <!--cmt-->{{echo| foo}}
2758
2759 {{echo|{{echo| }}bar}}
2760 !! html
2761 <pre>foo
2762 </pre>
2763 <pre>foo bar
2764 </pre>
2765 <pre>foo
2766 bar
2767 </pre>
2768 <pre>foo
2769 </pre>
2770 <pre>foo
2771 </pre>
2772 <pre>bar
2773 </pre>
2774 !!end
2775
2776 !! test
2777 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2778 !! wikitext
2779 {{echo| }}a
2780
2781 {{echo|
2782 }}a
2783
2784 {{echo|
2785 b}}
2786
2787 {{echo|a
2788 }}b
2789
2790 {{echo|a
2791 }} b
2792 !! html
2793 <pre>a
2794 </pre>
2795 <p><br />
2796 </p>
2797 <pre>a
2798 </pre>
2799 <p><br />
2800 </p>
2801 <pre>b
2802 </pre>
2803 <p>a
2804 </p>
2805 <pre>b
2806 </pre>
2807 <p>a
2808 </p>
2809 <pre>b
2810 </pre>
2811 !!end
2812
2813 ## Hmm, should Parsoid rt this?
2814 !! test
2815 Pres with newline attributes
2816 !! options
2817 parsoid=wt2html,html2html
2818 !! wikitext
2819 <pre class="one
2820 two">hi</pre>
2821 !! html/php
2822 <pre class="one two">hi</pre>
2823 !! html/parsoid
2824 <pre class="one two" typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2825 !! end
2826
2827 !! test
2828 Things that look like <pre> tags aren't treated as such
2829 !! wikitext
2830 Barack Obama <President> of the United States
2831 <President></President>
2832 !! html
2833 <p>Barack Obama &lt;President&gt; of the United States
2834 &lt;President&gt;&lt;/President&gt;
2835 </p>
2836 !! end
2837
2838 ## Remex doesn't account for fostered content.
2839 ## The difference between Parsoid and the PHP parser can be attributed to core
2840 ## commit 674e8388cba and 710618f89af in Parsoid's repo. Parsoid doesn't
2841 ## tokenize unmatched extension tags that shadow html tags as strings to ease
2842 ## an escaping mechanism. See the comment in `maybeExtensionTag`.
2843 !! test
2844 Handle broken pre-like tags (T66025)
2845 !! options
2846 parsoid=wt2html
2847 !! wikitext
2848 {{echo|<pre <pre>x</pre>}}
2849
2850 <table><pre </table>
2851 !! html/php
2852 <pre>x</pre>
2853 <table>&lt;pre </table>
2854 !! html/php+tidy
2855 <pre>x</pre>
2856 &lt;pre <table></table>
2857 !! html/parsoid
2858 <pre typeof="mw:Extension/pre mw:Transclusion" about="#mwt2" data-parsoid='{"stx":"html","a":{"&lt;pre":null},"sa":{"&lt;pre":""},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2859
2860 <pre data-parsoid='{"stx":"html","src":"&lt;pre &lt;/table>","tagWidths":[13,0],"a":{"&lt;":null,"table":null},"sa":{"&lt;":"","table":""},"fostered":true,"autoInsertedEnd":true}'></pre><table data-parsoid='{"stx":"html","autoInsertedEnd":true}'></table>
2861 !! end
2862
2863 ## Similar to the above, but shows the difference between extension and html tags
2864 !! test
2865 Less than in attribute position
2866 !! wikitext
2867 <pre <pre>123</pre>
2868
2869 <div <div>123</div>
2870 !! html/php+tidy
2871 <pre>123</pre><p>
2872 &lt;div </p><div>123</div>
2873 !! html/parsoid
2874 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"&lt;pre":""},"body":{"extsrc":"123"}}'>123</pre><p>
2875
2876 &lt;div </p><div>123</div>
2877 !! end
2878
2879 !! test
2880 Parsoid: handle pre with space after attribute
2881 !! options
2882 parsoid=wt2html
2883 !! wikitext
2884 <pre style="width:50%;" >{{echo|foo}}</pre>
2885 !! html/php
2886 <pre style="width:50%;">{{echo|foo}}</pre>
2887 !! html/parsoid
2888 <pre typeof="mw:Extension/pre" about="#mwt2" style="width:50%;" data-mw='{"name":"pre","attrs":{"style":"width:50%;"},"body":{"extsrc":"{{echo|foo}}"}}'>{{echo|foo}}</pre>
2889 !! end
2890
2891 !! test
2892 Self-closed pre
2893 !! wikitext
2894 <pre />
2895 !! html/php
2896 <pre></pre>
2897 !! html/parsoid
2898 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{}}'></pre>
2899 !! end
2900
2901 !! test
2902 Newline before table-close generates empty table row: T208619
2903 !! wikitext
2904 {|
2905
2906 |}
2907 !! html/php+tidy
2908 <table>
2909
2910 <tbody><tr><td></td></tr></tbody></table>
2911 !! html/parsoid
2912 <table data-parsoid='{}'>
2913
2914 </table>
2915 !! end
2916
2917 # PHP has one more row in the output than Parsoid does: T208619
2918 !! test
2919 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2920 !! options
2921 parsoid=wt2html
2922 !! wikitext
2923 {|
2924 <td>
2925 <td>
2926 </td>
2927
2928
2929
2930 |}
2931 !! html/php+tidy
2932 <table>
2933 <tbody><tr><td>
2934 </td><td>
2935 </td>
2936
2937
2938
2939 </tr><tr><td></td></tr></tbody></table>
2940 !! html/parsoid
2941 <table>
2942
2943 <tbody>
2944 <tr>
2945 <td></td>
2946
2947 <td>
2948 </td></tr>
2949
2950
2951
2952 </tbody></table>
2953 !! end
2954
2955
2956 #--------------------------------------------------------------------
2957 # Transclusion parameter whitespace stripping tests
2958 # Behavior is different for positional and named parameters
2959 #--------------------------------------------------------------------
2960 !! test
2961 Templates: Strip leading and trailing whitespace from named-param values
2962 !! wikitext
2963 {{echo|1= a }}
2964
2965 {{echo|1= {{echo|b}} }}
2966
2967 {{echo| 1 =
2968 c }}
2969
2970 {{echo| 1 =
2971 * d
2972 }}
2973 !! html
2974 <p>a
2975 </p><p>b
2976 </p><p>c
2977 </p>
2978 <ul><li>d</li></ul>
2979 !! end
2980
2981 !! test
2982 Templates: Don't strip whitespace from positional-param values
2983 !! wikitext
2984 {{echo|a }}
2985
2986 {{echo|{{echo|b}} }}
2987
2988 {{echo| c
2989 }}
2990
2991 {{echo| {{echo|d}}
2992 }}
2993
2994 {{echo|
2995 e}}
2996
2997 {{echo|
2998 *f}}
2999
3000 {{echo|
3001 }}g
3002 !! html
3003 <p>a
3004 </p><p>b
3005 </p>
3006 <pre>c
3007 </pre>
3008 <p><br />
3009 </p>
3010 <pre>d
3011 </pre>
3012 <p><br />
3013 </p>
3014 <pre>e
3015 </pre>
3016 <p><br />
3017 </p>
3018 <ul><li>f</li></ul>
3019 <p><br />
3020 </p>
3021 <pre>g
3022 </pre>
3023 !! end
3024
3025 !! test
3026 Templates: Don't recognize targets split by newlines
3027 !! options
3028 parsoid=wt2html
3029 !! wikitext
3030 {{ech
3031 o|foo}}
3032 !! html/php
3033 <p>{{ech
3034 o|foo}}
3035 </p>
3036 !! html/parsoid
3037 <p>{{ech
3038 o|foo}}</p>
3039 !! end
3040
3041 !! test
3042 Templates: Recognize targets when newlines and comments don't split the target
3043 !! options
3044 parsoid=wt2html
3045 !! wikitext
3046 {{
3047 <!--X--> ech<!--X-->o<!--X-->
3048 <!--X--> <!--X-->
3049
3050 |foo}}
3051 !! html/php
3052 <p>foo
3053 </p>
3054 !! html/parsoid
3055 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ech&lt;!--X-->o&lt;!--X--> \n &lt;!--X--> &lt;!--X-->\n\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3056 !! end
3057
3058 !! test
3059 Templates: Handle empty comment-and-ws-only lines correctly
3060 !! wikitext
3061 {{echo|foo
3062 <!--should be ignored-->
3063 <!--should be ignored as well-->
3064 bar}}
3065 !! html/php
3066 <p>foo
3067 bar
3068 </p>
3069 !! html/parsoid
3070 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
3071 !! end
3072
3073 !! test
3074 Templates: Handle comments in the target
3075 !! wikitext
3076 {{echo
3077 <!-- should be ignored -->
3078 |foo}}
3079
3080 {{echo
3081 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
3082 |foo}}
3083
3084 {{echo<!-- should be ignored -->
3085 |foo}}
3086
3087 {{echo<!-- should be ignored -->|foo}}
3088
3089 {{<!-- should be ignored -->echo|foo}}
3090 !! html/php
3091 <p>foo
3092 </p><p>foo
3093 </p><p>foo
3094 </p><p>foo
3095 </p><p>foo
3096 </p>
3097 !! html/parsoid
3098 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3099
3100 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored and spaces on next line should not trip us up (T147742) -->\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3101
3102 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3103
3104 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3105
3106 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3107 !! end
3108
3109 !! test
3110 Templates: Handle comments in parameter names (T69657)
3111 !! wikitext
3112 {{echo|1
3113 <!-- should be ignored -->
3114 =foo}}
3115
3116 {{echo|
3117 <!-- should be ignored -->
3118 1 = foo}}
3119
3120 {{echo|1<!-- should be ignored -->=foo}}
3121
3122 {{echo|<!-- should be ignored -->1=foo}}
3123 !! html/php
3124 <p>foo
3125 </p><p>foo
3126 </p><p>foo
3127 </p><p>foo
3128 </p>
3129 !! html/parsoid
3130 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
3131
3132 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
3133
3134 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
3135
3136 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
3137 !! end
3138
3139 !! test
3140 Templates: Other wikitext in parameter names (T69657)
3141 !! wikitext
3142 {{echo|''1''=foo}}
3143 !! html/php
3144 <p>{{{1}}}
3145 </p>
3146 !! html/parsoid
3147 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3148 !! end
3149
3150 !! test
3151 Templates: With colons
3152 !! wikitext
3153 {{With: Colon}}
3154 !! html/php
3155 <p>Template with colon
3156 </p>
3157 !! html/parsoid
3158 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"With: Colon","href":"./Template:With:_Colon"},"params":{},"i":0}}]}'>Template with colon</p>
3159 !! end
3160
3161 #--------------------------------------------------------------------
3162 # Transclusion parameter escaping tests
3163 #--------------------------------------------------------------------
3164
3165 !! test
3166 Templates: Parsoid parameter escaping test 1
3167 !! wikitext
3168 {{echo|[foo]|{{echo|[bar]}}}}
3169 !! html/php+tidy
3170 <p>[foo]
3171 </p>
3172 !! html/parsoid
3173 <p about="#mwt1" typeof="mw:Transclusion"
3174 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
3175 !! end
3176
3177 !! test
3178 Parsoid: Pipes in external links in template parameter
3179 !! wikitext
3180 {{echo|[{{echo|http://example.com}} link]}}
3181 !! html/php+tidy
3182 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
3183 </p>
3184 !! html/parsoid
3185 <p><a rel="mw:ExtLink" class="external text" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
3186 !! end
3187
3188 !! test
3189 Parsoid: pipe in transclusion parameter
3190 !! wikitext
3191 {{echo|http://foo.com/a&#124;b}}
3192 !! html/php+tidy
3193 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
3194 </p>
3195 !! html/parsoid
3196 <p><a rel="mw:ExtLink" class="external free" href="http://foo.com/a%7Cb" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a%7Cb</a></p>
3197 !! end
3198
3199 !! test
3200 Parsoid: Pipe in external link target and content in template parameter
3201 !! options
3202 parsoid=html2wt,wt2wt
3203 !! wikitext
3204 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
3205 !! html/php+tidy
3206 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
3207 </p>
3208 !! html/parsoid
3209 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
3210 typeof="mw:Transclusion"
3211 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
3212 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
3213 !! end
3214
3215 !! test
3216 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
3217 !! wikitext
3218 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
3219 !! html/php+tidy
3220 <p><a rel="nofollow" class="external text" href="http://example.org/index.php?title=Parser_test&amp;action=edit">bar</a>
3221 </p>
3222 !! html/parsoid
3223 <p><a rel="mw:ExtLink" class="external text" href="http://example.org/index.php?title=Parser_test&amp;action=edit" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>bar</a></p>
3224 !! end
3225
3226 !! test
3227 Templates: Don't escape already nowiki-escaped text in template parameters
3228 !! options
3229 parsoid=html2wt,wt2wt
3230 !! wikitext
3231 {{echo|foo<nowiki>|</nowiki>bar}}
3232 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3233 {{echo|<nowiki></nowiki>}}
3234 !! html/php+tidy
3235 <p>foo|bar
3236 &lt;div&gt;
3237
3238 </p>
3239 !! html/parsoid
3240 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
3241 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
3242 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
3243 </p>
3244 !! end
3245
3246 ## T54824
3247 !! test
3248 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3249 !! options
3250 parsoid=html2wt,wt2wt
3251 !! wikitext
3252 {{echo|{{echo|1=bar}}}}
3253 !! html/php+tidy
3254 <p>bar
3255 </p>
3256 !! html/parsoid
3257 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
3258 !! end
3259
3260 ## T58733
3261 !! test
3262 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3263 !! wikitext
3264 {{echo|a : b}}
3265 !! html/php+tidy
3266 <p>a&#160;: b
3267 </p>
3268 !! html/parsoid
3269 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
3270 !! end
3271
3272 ## T73412
3273 !! test
3274 Templates: Preserve blank parameter names
3275 !! wikitext
3276 {{echo|=foo}}
3277 !! html/php+tidy
3278 <p>{{{1}}}
3279 </p>
3280 !! html/parsoid
3281 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3282 !! end
3283
3284 !! test
3285 Templates: Preserve blank parameter names in other positions
3286 !! wikitext
3287 {{blank_param|bar|=foo}}
3288 !! html/php+tidy
3289 <p>bar
3290 foo
3291 </p>
3292 !! html/parsoid
3293 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
3294 foo</p>
3295 !! end
3296
3297 ###
3298 ### Parsoid-centric tests for testing RT edge cases for pre
3299 ###
3300
3301 !!test
3302 1a. Indent-Pre and Comments
3303 !! wikitext
3304 a
3305 <!--a-->
3306 c
3307 !! html
3308 <pre>a
3309 </pre>
3310 <p>c
3311 </p>
3312 !!end
3313
3314 !!test
3315 1b. Indent-Pre and Comments
3316 !! wikitext
3317 a
3318 <!--a-->
3319 c
3320 !! html
3321 <pre>a
3322 </pre>
3323 <p>c
3324 </p>
3325 !!end
3326
3327 !!test
3328 1c. Indent-Pre and Comments
3329 !! wikitext
3330 <!--a--> a
3331
3332 <!--a--> a
3333 !! html
3334 <pre> a
3335 </pre>
3336 <pre> a
3337 </pre>
3338 !!end
3339
3340 !!test
3341 1d. Indent-Pre and Comments
3342 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3343 !! wikitext
3344 <!--a--> a
3345
3346 <!--b-->b
3347 !! html
3348 <pre>a
3349 </pre>
3350 <pre>b
3351 </pre>
3352 !!end
3353
3354 !!test
3355 2a. Indent-Pre and tables
3356 !! wikitext
3357 {|
3358 |-
3359 !h1!!h2
3360 |foo||bar
3361 |}
3362 !! html
3363 <table>
3364
3365 <tr>
3366 <th>h1</th>
3367 <th>h2
3368 </th>
3369 <td>foo</td>
3370 <td>bar
3371 </td></tr></table>
3372 !!end
3373
3374 !!test
3375 2b. Indent-Pre and tables
3376 !! wikitext
3377 {|
3378 |-
3379 |foo
3380 |}
3381 !! html
3382 <table>
3383
3384 <tr>
3385 <td>foo
3386 </td></tr></table>
3387 !!end
3388
3389 !!test
3390 2c. Indent-Pre and tables (T44252)
3391 !! wikitext
3392 {|
3393 |+foo
3394 ! |bar
3395 |}
3396 !! html
3397 <table>
3398 <caption>foo
3399 </caption>
3400 <tr>
3401 <th>bar
3402 </th></tr></table>
3403 !!end
3404
3405 !!test
3406 2d. Indent-Pre and tables
3407 !! wikitext
3408 a
3409 {|
3410 |b
3411 |}
3412 !! html/php
3413 <pre>a
3414 </pre>
3415 <table>
3416 <tr>
3417 <td>b
3418 </td></tr></table>
3419 !! html/parsoid
3420 <pre>a</pre>
3421 <table>
3422 <tbody><tr><td> b</td></tr>
3423 </tbody></table>
3424 !!end
3425
3426 !!test
3427 2e. Indent-Pre and table-line syntax
3428 !! wikitext
3429 a
3430 | b
3431 | c
3432 !! html/php
3433 <pre>a
3434 | b
3435 | c
3436 </pre>
3437 !!end
3438
3439 !!test
3440 2f. Indent-pre started by table-line syntax
3441 !! wikitext
3442 a
3443 | b
3444 | c
3445 !! html/php
3446 <p>a
3447 </p>
3448 <pre>| b
3449 | c
3450 </pre>
3451 !! html/parsoid
3452 <p>a</p>
3453 <pre>
3454 | b
3455 | c</pre>
3456 !!end
3457
3458 !! test
3459 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3460 !! wikitext
3461 <table>
3462 <tr>
3463 <td>
3464 Text that should be rendered preformatted
3465 </td>
3466 </tr>
3467 </table>
3468 !! html
3469 <table>
3470 <tr>
3471 <td>
3472 <pre>Text that should be rendered preformatted
3473 </pre>
3474 </td>
3475 </tr>
3476 </table>
3477 !! end
3478
3479 !! test
3480 2h. Indent pre in tables
3481 !! options
3482 parsoid=wt2html,html2html
3483 !! wikitext
3484 {|
3485 !
3486 foo
3487 !
3488 bar
3489 |-
3490 |
3491 baz
3492 {{!}}
3493 bam
3494 |}
3495 !! html/php
3496 <table>
3497 <tr>
3498 <th>
3499 <pre>foo
3500 </pre>
3501 </th>
3502 <th>
3503 <pre>bar
3504 </pre>
3505 </th></tr>
3506 <tr>
3507 <td>
3508 <pre>baz
3509 </pre>
3510 </td>
3511 <td>
3512 <pre>bam
3513 </pre>
3514 </td></tr></table>
3515 !! html/parsoid
3516 <table>
3517 <tbody><tr><th>
3518 <pre>foo</pre>
3519 </th><th>
3520 <pre>bar</pre>
3521 </th></tr><tr>
3522 <td>
3523 <pre>baz</pre>
3524 </td><td data-parsoid='{"startTagSrc":"{{!}}"}'>
3525 <pre>bam</pre>
3526 </td></tr></tbody></table>
3527 !! end
3528
3529 !! test
3530 3a. Indent-Pre and block tags (single-line html)
3531 !! wikitext
3532 a <p> foo </p>
3533 b <div> foo </div>
3534 c <blockquote> foo </blockquote>
3535 <span> foo </span>
3536 !! html
3537 a <p> foo </p>
3538 b <div> foo </div>
3539 c <blockquote> foo </blockquote>
3540 <pre><span> foo </span>
3541 </pre>
3542 !! html/php+tidy
3543 <p> a </p><p> foo </p><p>
3544 b </p><div> foo </div><p>
3545 c </p><blockquote><p> foo </p></blockquote>
3546 <pre><span> foo </span>
3547 </pre>
3548 !! html/parsoid
3549 <p> a </p><p data-parsoid='{"stx":"html"}'> foo </p><p>
3550 b </p><div data-parsoid='{"stx":"html"}'> foo </div><p>
3551 c </p><blockquote data-parsoid='{"stx":"html"}'><p> foo </p></blockquote>
3552 <pre><span data-parsoid='{"stx":"html"}'> foo </span></pre>
3553 !! end
3554
3555 !! test
3556 3b. Indent-Pre and block tags (multi-line html)
3557 !! wikitext
3558 a <span>foo</span>
3559 <!-- comment --> b <div> foo </div>
3560 !! html/php
3561 <pre>a <span>foo</span>
3562 </pre>
3563 b <div> foo </div>
3564 !! html/parsoid
3565 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3566 <!-- comment --> <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3567 !! html/php+tidy
3568 <pre>a <span>foo</span>
3569 </pre><p>
3570 b </p><div> foo </div>
3571 !! end
3572
3573 !! test
3574 3c. Indent-Pre and block tags (pre-content on separate line)
3575 !! wikitext
3576 <p>
3577 foo
3578 </p>
3579
3580 <div>
3581 foo
3582 </div>
3583
3584 <center>
3585 foo
3586 </center>
3587
3588 <blockquote>
3589 foo
3590 </blockquote>
3591
3592 <blockquote>
3593 <pre>
3594 foo
3595 </pre>
3596 </blockquote>
3597
3598 <table><tr><td>
3599 foo
3600 </td></tr></table>
3601
3602 <ul><li>
3603 foo
3604 </li></ul>
3605
3606 !! html/php
3607 <p>
3608 foo
3609 </p>
3610 <div>
3611 <pre>foo
3612 </pre>
3613 </div>
3614 <center>
3615 <pre>foo
3616 </pre>
3617 </center>
3618 <blockquote>
3619 <p> foo
3620 </p>
3621 </blockquote>
3622 <blockquote>
3623 <pre>
3624 foo
3625 </pre>
3626 </blockquote>
3627 <table><tr><td>
3628 <pre>foo
3629 </pre>
3630 </td></tr></table>
3631 <ul><li>
3632 foo
3633 </li></ul>
3634
3635 !! html/parsoid
3636 <p data-parsoid='{"stx":"html"}'>
3637 foo
3638 </p>
3639
3640 <div>
3641 <pre>foo</pre>
3642 </div>
3643
3644 <center>
3645 <pre>foo</pre>
3646 </center>
3647
3648 <blockquote>
3649 <p> foo</p>
3650 </blockquote>
3651
3652 <blockquote>
3653 <pre typeof="mw:Extension/pre" about="#mwt3" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3654 </pre>
3655 </blockquote>
3656
3657 <table data-parsoid='{"stx":"html"}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>
3658 <pre>foo</pre>
3659 </td></tr></tbody></table>
3660
3661 <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>
3662 foo
3663 </li></ul>
3664 !! end
3665
3666 !! test
3667 4. Indent-Pre and extension tags
3668 !! options
3669 parsoid=wt2html,html2html
3670 !! wikitext
3671 a <tag />
3672 !! html/php+tidy
3673 <p> a </p><pre>NULL
3674 array (
3675 )
3676 </pre>
3677 !! html/parsoid
3678 <p> a </p><pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{}}'></pre>
3679 !! end
3680
3681 !! test
3682 5. Indent-Pre and html pre
3683 !! wikitext
3684 <pre class="123">hi</pre>
3685 !! html/php
3686 <pre class="123">hi</pre>
3687 !! html/parsoid
3688 <pre class="123" typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3689 !! end
3690
3691 !!test
3692 Render paragraphs when indent-pre is suppressed in blocklevels
3693 !! wikitext
3694 <blockquote>
3695 foo
3696
3697 bar
3698 </blockquote>
3699 !! html
3700 <blockquote>
3701 <p> foo
3702 </p><p> bar
3703 </p>
3704 </blockquote>
3705 !!end
3706
3707 !!test
3708 4. Multiple spaces at start-of-line
3709 !! wikitext
3710 <p> foo </p>
3711 foo
3712 {|
3713 |foo
3714 |}
3715 !! html
3716 <p> foo </p>
3717 <pre> foo
3718 </pre>
3719 <table>
3720 <tr>
3721 <td>foo
3722 </td></tr></table>
3723 !!end
3724
3725 ## NOTE: the leading white-space chars on empty line are significant
3726 !! test
3727 5a. White-space in indent-pre
3728 !! wikitext
3729 a<br />
3730
3731 b
3732 !! html
3733 <pre>a<br />
3734
3735 b
3736 </pre>
3737 !! end
3738
3739 ## NOTE: the leading white-space chars on empty line are significant
3740 !! test
3741 5b. White-space in indent-pre
3742 !! wikitext
3743 a
3744
3745 b
3746
3747
3748 c
3749 !! html
3750 <pre>a
3751
3752 b
3753
3754
3755 c
3756 </pre>
3757 !! end
3758
3759 !! test
3760 5c. White-space in indent-pre
3761 !! wikitext
3762 ''a''
3763 ''b''
3764 ''c''
3765 !! html
3766 <pre><i>a</i>
3767 <i>b</i>
3768 <i>c</i>
3769 </pre>
3770 !! end
3771
3772 !! test
3773 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3774 !! wikitext
3775 a
3776
3777 <!-- continue -->
3778 b
3779
3780 c
3781
3782 d
3783 !! html
3784 <pre>a
3785
3786 b
3787 </pre>
3788 <pre>c
3789
3790 </pre>
3791 <p>d
3792 </p>
3793 !! end
3794
3795 !! test
3796 7a. Indent-pre and category links
3797 !! options
3798 parsoid=wt2html,wt2wt
3799 !! wikitext
3800 [[Category:foo]] <!-- No pre-wrapping -->
3801 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3802 !! html/php+tidy
3803 !! html/parsoid
3804 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3805 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3806 !! end
3807
3808 ## We used to, but no longer wt2wt this test since the default serializer
3809 ## will normalize all categories to serialize on their own line.
3810 ## This wikitext usage is going to be fairly uncommon in production and
3811 ## selser will take care of preserving formatting in those scenarios.
3812 !! test
3813 7b. Indent-pre and category links
3814 !! options
3815 parsoid=wt2html
3816 !! wikitext
3817 [[Category:foo]] a
3818 [[Category:foo]] {{echo|b}}
3819 !! html/parsoid
3820 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3821 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3822 !! end
3823
3824 !! test
3825 Indent-Pre: Newlines in comments shouldn't affect sol state
3826 !! wikitext
3827 a <!--
3828 foo
3829 --> b
3830 !! html/php+tidy
3831 <p>a b
3832 </p>
3833 !! html/parsoid
3834 <p>a <!--
3835 foo
3836 --> b</p>
3837 !! end
3838
3839 ###
3840 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3841 ###
3842
3843 !!test
3844 HTML-pre: 1. embedded newlines
3845 !! wikitext
3846 <pre>foo</pre>
3847
3848 <pre>
3849 foo
3850 </pre>
3851
3852 <pre>
3853
3854 foo
3855 </pre>
3856
3857 <pre>
3858
3859
3860 foo
3861 </pre>
3862 !! html/php+tidy
3863 <pre>foo</pre>
3864 <pre>foo
3865 </pre>
3866 <pre>
3867
3868 foo
3869 </pre>
3870 <pre>
3871
3872
3873 foo
3874 </pre>
3875 !! html/parsoid
3876 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3877
3878 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3879 </pre>
3880
3881 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3882
3883 foo
3884 </pre>
3885
3886 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3887
3888
3889 foo
3890 </pre>
3891 !!end
3892
3893 !! test
3894 HTML-pre: big spaces
3895 !! wikitext
3896 <pre>
3897
3898
3899
3900
3901 haha
3902
3903
3904
3905
3906 haha
3907
3908
3909
3910
3911 </pre>
3912 !! html/php+tidy
3913 <pre>
3914
3915
3916
3917
3918 haha
3919
3920
3921
3922
3923 haha
3924
3925
3926
3927
3928 </pre>
3929 !! html/parsoid
3930 <pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\n\n\nhaha\n\n\n\n\nhaha\n\n\n\n\n"}}'>
3931
3932
3933
3934
3935 haha
3936
3937
3938
3939
3940 haha
3941
3942
3943
3944
3945 </pre>
3946 !! end
3947
3948 !!test
3949 HTML-pre: 2: indented text
3950 !! wikitext
3951 <pre>
3952 foo
3953 </pre>
3954 !! html
3955 <pre>
3956 foo
3957 </pre>
3958 !!end
3959
3960 !!test
3961 HTML-pre: 3: other wikitext
3962 !! wikitext
3963 <pre>
3964 * foo
3965 # bar
3966 = no-h =
3967 '' no-italic ''
3968 [[ NoLink ]]
3969 </pre>
3970 !! html/php
3971 <pre>
3972 * foo
3973 # bar
3974 = no-h =
3975 '' no-italic ''
3976 [[ NoLink ]]
3977 </pre>
3978 !! html/parsoid
3979 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n* foo\n# bar\n= no-h =\n&#39;&#39; no-italic &#39;&#39;\n[[ NoLink ]]\n"}}'>* foo
3980 # bar
3981 = no-h =
3982 '' no-italic ''
3983 [[ NoLink ]]
3984 </pre>
3985 !!end
3986
3987 ###
3988 ### Definition lists
3989 ###
3990 !! test
3991 Simple definition
3992 !! wikitext
3993 ;name :Definition
3994 !! html
3995 <dl><dt>name</dt>
3996 <dd>Definition</dd></dl>
3997 !! end
3998
3999 !! test
4000 Definition list for indentation only
4001 !! wikitext
4002 :Indented text
4003 !! html
4004 <dl><dd>Indented text</dd></dl>
4005 !! end
4006
4007 !! test
4008 Definition list with no space
4009 !! wikitext
4010 ;name:Definition
4011 !! html
4012 <dl><dt>name</dt>
4013 <dd>Definition</dd></dl>
4014 !!end
4015
4016 !! test
4017 Definition list with URL link
4018 !! wikitext
4019 ;http://example.com/ :definition
4020 !! html
4021 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a></dt>
4022 <dd>definition</dd></dl>
4023 !! end
4024
4025 !! test
4026 Definition list with bracketed URL link
4027 !! wikitext
4028 ;[http://www.example.com/ Example]:Something about it
4029 !! html
4030 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
4031 <dd>Something about it</dd></dl>
4032 !! end
4033
4034 !! test
4035 Definition list with wikilink containing colon
4036 !! wikitext
4037 ;[[Help:FAQ]]:The least-read page on Wikipedia
4038 !! html
4039 <dl><dt><a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
4040 <dd>The least-read page on Wikipedia</dd></dl>
4041 !! end
4042
4043 # At Brion's and JeLuF's insistence... :)
4044 !! test
4045 Definition list with news link containing colon
4046 !! wikitext
4047 ;news:alt.wikipedia.rox :This isn't even a real newsgroup!
4048 !! html/php
4049 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
4050 <dd>This isn't even a real newsgroup!</dd></dl>
4051 !! html/parsoid
4052 <dl><dt><a rel="mw:ExtLink" class="external free" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'>This isn't even a real newsgroup!</dd></dl>
4053 !! end
4054
4055 !! test
4056 Malformed definition list with colon
4057 !! wikitext
4058 ;news:alt.wikipedia.rox -- don't crash or enter an infinite loop
4059 !! html
4060 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
4061 !! end
4062
4063 !! test
4064 Definition lists: colon in external link text
4065 !! wikitext
4066 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
4067 !! html
4068 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia :The Next Generation</a></dt>
4069 <dd>OK, I made that up</dd></dl>
4070 !! end
4071
4072 !! test
4073 Definition lists: colon in HTML attribute
4074 !! wikitext
4075 ;<b style="display: inline">bold</b>
4076 !! html
4077 <dl><dt><b style="display: inline">bold</b></dt></dl>
4078 !! end
4079
4080 !! test
4081 Definition lists: self-closed tag
4082 !! wikitext
4083 ;one<br/>two :two-line fun
4084 !! html
4085 <dl><dt>one<br />two</dt>
4086 <dd>two-line fun</dd></dl>
4087 !! end
4088
4089 !! test
4090 Definition lists: ignore colons inside tags
4091 !! wikitext
4092 ;one <b>two : tag <i>fun:</i>:</b>:def
4093 !! html
4094 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
4095 <dd>def</dd></dl>
4096 !! end
4097
4098 !! test
4099 Definition lists: excess closed tags
4100 !! wikitext
4101 ;one</b>two :bad tag fun
4102 !! html/php+tidy
4103 <dl><dt>onetwo</dt>
4104 <dd>bad tag fun</dd></dl>
4105 !! html/parsoid
4106 <dl>
4107 <dt>onetwo</dt>
4108 <dd>bad tag fun</dd>
4109 </dl>
4110 !! end
4111
4112 !! test
4113 T13748: Literal closing tags
4114 !! wikitext
4115 <dl>
4116 <dt>test 1</dt>
4117 <dd>test test test test test</dd>
4118 <dt>test 2</dt>
4119 <dd>test test test test test</dd>
4120 </dl>
4121 !! html
4122 <dl>
4123 <dt>test 1</dt>
4124 <dd>test test test test test</dd>
4125 <dt>test 2</dt>
4126 <dd>test test test test test</dd>
4127 </dl>
4128 !! end
4129
4130 !! test
4131 Definition and unordered list using wiki syntax nested in unordered list using html tags.
4132 !! wikitext
4133 <ul><li>
4134 ;term :description
4135 *unordered
4136 </li></ul>
4137 !! html
4138 <ul><li>
4139 <dl><dt>term</dt>
4140 <dd>description</dd></dl>
4141 <ul><li>unordered</li></ul>
4142 </li></ul>
4143 !! end
4144
4145 !! test
4146 Definition list with empty definition and following paragraph
4147 !! wikitext
4148 ;term:
4149
4150 Paragraph text
4151 !! html
4152 <dl><dt>term</dt>
4153 <dd></dd></dl>
4154 <p>Paragraph text
4155 </p>
4156 !! end
4157
4158 !! test
4159 Nested definition lists using html syntax
4160 !! wikitext
4161 <dl><dt>x</dt>
4162 <dd>a</dd>
4163 <dd>b</dd></dl>
4164 !! html
4165 <dl><dt>x</dt>
4166 <dd>a</dd>
4167 <dd>b</dd></dl>
4168 !! end
4169
4170 !! test
4171 Definition Lists: No nesting: Multiple dd's
4172 !! wikitext
4173 ;x
4174 :a
4175 :b
4176 !! html
4177 <dl><dt>x</dt>
4178 <dd>a</dd>
4179 <dd>b</dd></dl>
4180 !! end
4181
4182 !! test
4183 Definition Lists: Indentation: Regular
4184 !! wikitext
4185 :i1
4186 ::i2
4187 :::i3
4188 !! html
4189 <dl><dd>i1
4190 <dl><dd>i2
4191 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4192 !! end
4193
4194 !! test
4195 Definition Lists: Indentation: Missing 1st level
4196 !! wikitext
4197 ::i2
4198 :::i3
4199 !! html
4200 <dl><dd><dl><dd>i2
4201 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4202 !! end
4203
4204 !! test
4205 Definition Lists: Indentation: Multi-level indent
4206 !! wikitext
4207 :::i3
4208 !! html
4209 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
4210 !! end
4211
4212 !! test
4213 Definition Lists: Hacky use to indent tables
4214 !! wikitext
4215 ::{|
4216 |foo
4217 |bar
4218 |}
4219 this text
4220 should be left alone
4221 !! html
4222 <dl><dd><dl><dd><table>
4223 <tr>
4224 <td>foo
4225 </td>
4226 <td>bar
4227 </td></tr></table></dd></dl></dd></dl>
4228 <p>this text
4229 should be left alone
4230 </p>
4231 !! end
4232
4233 !! test
4234 Definition Lists: Hacky use to indent tables (with content following table)
4235 !! wikitext
4236 :{|
4237 |foo
4238 |bar
4239 |} <!--c1--> this text should be part of the dl
4240 !! html/php+tidy
4241 <dl><dd><table>
4242 <tbody><tr>
4243 <td>foo
4244 </td>
4245 <td>bar
4246 </td></tr></tbody></table> this text should be part of the dl</dd></dl>
4247 !! html/parsoid
4248 <dl><dd><table>
4249 <tbody><tr>
4250 <td>foo
4251 </td>
4252 <td>bar
4253 </td></tr></tbody></table> <!--c1--> this text should be part of the dl</dd></dl>
4254 !! end
4255
4256 !! test
4257 Definition Lists: Hacky use to indent tables, with comments (T65979)
4258 !! wikitext
4259 <!-- foo -->
4260 ::{|
4261 |foo
4262 |bar
4263 |}<!-- bar -->
4264 this text
4265 should be left alone
4266 !! html/parsoid
4267 <!-- foo -->
4268 <dl><dd><dl><dd><table><tr>
4269 <td>foo</td>
4270 <td>bar</td>
4271 </tr></table><!-- bar --></dd></dl></dd></dl>
4272 <p>this text
4273 should be left alone</p>
4274 !! end
4275
4276 !! test
4277 Definition Lists: Hacky use to indent tables, with comment before table
4278 !!options
4279 parsoid=wt2html
4280 !! wikitext
4281 ::<!-- foo -->{|
4282 |foo
4283 |}
4284 !! html/parsoid
4285 <dl><dd><dl><dd><!-- foo --><table><tr>
4286 <td>foo</td>
4287 </tr></table></dd></dl></dd></dl>
4288 !! end
4289
4290 # The trailing whitespace in this test is to catch a regression in
4291 # Parsoid after T54473.
4292 !! test
4293 Definition Lists: Hacky use to indent tables (WS-insensitive)
4294 !! wikitext
4295 :{|
4296 |a
4297 |}
4298 !! html/php
4299 <dl><dd><table>
4300 <tr>
4301 <td>a
4302 </td></tr></table></dd></dl>
4303 !! html/parsoid
4304 <dl><dd><table>
4305 <tbody><tr><td>a</td></tr>
4306 </tbody></table></dd></dl>
4307 !! end
4308
4309 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4310 ## as an empty dt item. It also ignores all but the last ";" when followed
4311 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4312 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4313 ## ";"s.
4314 ##
4315 ## Ex: ";;t2 ::d2" is transformed into:
4316 ##
4317 ## <dl>
4318 ## <dt>t2 </dt>
4319 ## <dd>
4320 ## <dl>
4321 ## <dt></dt>
4322 ## <dd>d2</dd>
4323 ## </dl>
4324 ## </dd>
4325 ## </dl>
4326 ##
4327 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4328 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4329 ##
4330 ## <dl>
4331 ## <dt>
4332 ## <dl>
4333 ## <dt>t2 </dt>
4334 ## <dd>:d2</dd>
4335 ## </dl>
4336 ## </dt>
4337 ## </dl>
4338 ##
4339 ## All Parsoid only definition list tests have this difference.
4340 ##
4341 ## See also: https://phabricator.wikimedia.org/T8569
4342 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4343
4344 !! test
4345 Table / list interaction: indented table with lists in table contents
4346 !! wikitext
4347 :{|
4348 |-
4349 |a
4350
4351 *b
4352 |-
4353 |c
4354
4355 *d
4356 |}
4357 !! html
4358 <dl><dd><table>
4359
4360 <tr>
4361 <td>a
4362 <ul><li>b</li></ul>
4363 </td></tr>
4364 <tr>
4365 <td>c
4366 <ul><li>d</li></ul>
4367 </td></tr></table></dd></dl>
4368 !! end
4369
4370 !!test
4371 Table / list interaction: lists nested in tables nested in indented lists
4372 !! wikitext
4373 :{|
4374 |
4375 :a
4376 :b
4377 |
4378 *c
4379 *d
4380 |}
4381
4382 *e
4383 *f
4384 !! html
4385 <dl><dd><table>
4386 <tr>
4387 <td>
4388 <dl><dd>a</dd>
4389 <dd>b</dd></dl>
4390 </td>
4391 <td>
4392 <ul><li>c</li>
4393 <li>d</li></ul>
4394 </td></tr></table></dd></dl>
4395 <ul><li>e</li>
4396 <li>f</li></ul>
4397 !!end
4398
4399 !! test
4400 Definition Lists: Nesting: Multi-level (Parsoid only)
4401 !! wikitext
4402 ;t1 :d1
4403 ;;t2 ::d2
4404 ;;;t3 :::d3
4405 !! html/parsoid
4406 <dl>
4407 <dt>t1 </dt>
4408 <dd>d1</dd>
4409 <dt>
4410 <dl>
4411 <dt>t2 </dt>
4412 <dd>:d2</dd>
4413 <dt>
4414 <dl>
4415 <dt>t3 </dt>
4416 <dd>::d3</dd>
4417 </dl>
4418 </dt>
4419 </dl>
4420 </dt>
4421 </dl>
4422 !! end
4423
4424
4425 !! test
4426 Definition Lists: Nesting: Test 2
4427 !! wikitext
4428 ;t1
4429 ::d2
4430 !! html+tidy
4431 <dl><dt>t1</dt>
4432 <dd>
4433 <dl><dd>d2</dd></dl></dd></dl>
4434 !! end
4435
4436
4437 !! test
4438 Definition Lists: Nesting: Test 3
4439 !! wikitext
4440 :;t1
4441 ::::d2
4442 !! html+tidy
4443 <dl><dd><dl><dt>t1</dt>
4444 <dd>
4445 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4446 !! end
4447
4448
4449 !! test
4450 Definition Lists: Nesting: Test 4
4451 !! wikitext
4452 ::;t3
4453 :::d3
4454 !! html
4455 <dl><dd><dl><dd><dl><dt>t3</dt>
4456 <dd>d3</dd></dl></dd></dl></dd></dl>
4457 !! end
4458
4459
4460 ## The Parsoid team believes the following three test exposes a
4461 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4462 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4463 ## It also exposes a "misfeature" in tidy, which doesn't like
4464 ## <dl> tags with a single <dt> child; it converts the <dt> into
4465 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4466 !! test
4467 Definition Lists: Mixed Lists: Test 1
4468 !! wikitext
4469 :;*foo
4470 ::*bar
4471 :;baz
4472 !! html/php
4473 <dl><dd><dl><dt><ul><li>foo</li>
4474 <li>bar</li></ul></dt></dl>
4475 <dl><dt>baz</dt></dl></dd></dl>
4476 !! html/php+tidy
4477 <dl><dd><dl><dt><ul><li>foo</li>
4478 <li>bar</li></ul></dt></dl>
4479 <dl><dt>baz</dt></dl></dd></dl>
4480 !! html/parsoid
4481 <dl>
4482 <dd><dl>
4483 <dt><ul>
4484 <li>foo
4485 </li>
4486 </ul></dt>
4487 <dd><ul>
4488 <li>bar
4489 </li>
4490 </ul></dd>
4491 <dt>baz</dt>
4492 </dl></dd>
4493 </dl>
4494 !! end
4495
4496 !! test
4497 Definition Lists: Mixed Lists: Test 2
4498 !! wikitext
4499 *:d1
4500 *:d2
4501 !! html
4502 <ul><li><dl><dd>d1</dd>
4503 <dd>d2</dd></dl></li></ul>
4504 !! end
4505
4506
4507 !! test
4508 Definition Lists: Mixed Lists: Test 3
4509 !! wikitext
4510 *:::d1
4511 *:::d2
4512 !! html
4513 <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
4514 <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
4515 !! end
4516
4517
4518 !! test
4519 Definition Lists: Mixed Lists: Test 4
4520 !! wikitext
4521 *;d1 :d2
4522 *;d3 :d4
4523 !! html
4524 <ul><li><dl><dt>d1</dt>
4525 <dd>d2</dd>
4526 <dt>d3</dt>
4527 <dd>d4</dd></dl></li></ul>
4528 !! end
4529
4530
4531 !! test
4532 Definition Lists: Mixed Lists: Test 5
4533 !! wikitext
4534 *:d1
4535 *::d2
4536 !! html
4537 <ul><li><dl><dd>d1
4538 <dl><dd>d2</dd></dl></dd></dl></li></ul>
4539 !! end
4540
4541
4542 !! test
4543 Definition Lists: Mixed Lists: Test 6
4544 !! wikitext
4545 #*:d1
4546 #*:::d3
4547 !! html
4548 <ol><li><ul><li><dl><dd>d1
4549 <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4550 !! end
4551
4552
4553 !! test
4554 Definition Lists: Mixed Lists: Test 7
4555 !! wikitext
4556 :*d1
4557 :*d2
4558 !! html
4559 <dl><dd><ul><li>d1</li>
4560 <li>d2</li></ul></dd></dl>
4561 !! end
4562
4563
4564 !! test
4565 Definition Lists: Mixed Lists: Test 8
4566 !! wikitext
4567 :*d1
4568 ::*d2
4569 !! html
4570 <dl><dd><ul><li>d1</li></ul>
4571 <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
4572 !! end
4573
4574
4575 !! test
4576 Definition Lists: Mixed Lists: Test 9
4577 !! wikitext
4578 *;foo :bar
4579 !! html
4580 <ul><li><dl><dt>foo</dt>
4581 <dd>bar</dd></dl></li></ul>
4582 !! end
4583
4584
4585 !! test
4586 Definition Lists: Mixed Lists: Test 10
4587 !! wikitext
4588 *#;foo :bar
4589 !! html
4590 <ul><li><ol><li><dl><dt>foo</dt>
4591 <dd>bar</dd></dl></li></ol></li></ul>
4592 !! end
4593
4594 # The Parsoid team disagrees with the PHP parser's seemingly-random
4595 # rules regarding dd/dt on the next few tests. Parsoid is more
4596 # consistent, and recognizes the shared nesting and keeps the
4597 # still-open tags around until the nesting is complete.
4598
4599 # This is a regression test for T175099
4600 !! test
4601 Definition Lists: Mixed Lists: Test 11
4602 !! wikitext
4603 ;a
4604 :*b
4605 !! html/php
4606 <dl><dt>a</dt>
4607 <dd>
4608 <ul><li>b</li></ul></dd></dl>
4609 !! html/parsoid
4610 <dl><dt>a
4611 <dd><ul><li>b</li></ul></dd></dl>
4612 !! end
4613
4614 # FIXME: Maybe get rid of this test?
4615 !! test
4616 Definition Lists: Mixed Lists: Test 12
4617 !! wikitext
4618 *#*#;*;;foo :bar
4619 *#*#;boo :baz
4620 !! html/php
4621 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4622 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4623 <dl><dt>boo</dt>
4624 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4625 !! html/php+tidy
4626 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4627 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4628 <dl><dt>boo</dt>
4629 <dd>baz</dd></dl></li></ol></li></ul>
4630 !! html/parsoid
4631 <ul>
4632 <li>
4633 <ol>
4634 <li>
4635 <ul>
4636 <li>
4637 <ol>
4638 <li>
4639 <dl>
4640 <dt>
4641 <ul>
4642 <li>
4643 <dl>
4644 <dt>
4645 <dl>
4646 <dt>foo</dt>
4647 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4648 </dl></dt>
4649 </dl></li>
4650 </ul></dt>
4651 <dt>boo</dt>
4652 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4653 </dl></li>
4654 </ol></li>
4655 </ul></li>
4656 </ol></li>
4657 </ul>
4658 !! end
4659
4660 !! test
4661 Definition Lists: Mixed Lists: Test 13
4662 !! wikitext
4663 *#*#;*;;foo : bar
4664 *#*#;boo : baz
4665 !! html+tidy
4666 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4667 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4668 <dl><dt>boo&#160;</dt>
4669 <dd>baz</dd></dl></li></ol></li></ul>
4670 !! end
4671
4672 # FIXME: Maybe get rid of this test?
4673 # From whitelist:
4674 # * The test is wrong, there are two colons where there should be :;
4675 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4676 !! test
4677 Definition Lists: Weird Ones: Test 1
4678 !! wikitext
4679 *#;*::;;foo :bar (who uses this?)
4680 !! html/php+tidy
4681 <ul><li><ol><li><dl><dt>foo</dt>
4682 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt>bar (who uses this?)</dt></dl></dt></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4683 !! html/parsoid
4684 <ul>
4685 <li>
4686 <ol>
4687 <li>
4688 <dl>
4689 <dt>
4690 <ul>
4691 <li>
4692 <dl>
4693 <dd>
4694 <dl>
4695 <dd>
4696 <dl>
4697 <dt>
4698 <dl>
4699 <dt>foo</dt>
4700 <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
4701 </dl></dt>
4702 </dl></dd>
4703 </dl></dd>
4704 </dl></li>
4705 </ul></dt>
4706 </dl></li>
4707 </ol></li>
4708 </ul>
4709 !! end
4710
4711 !! test
4712 Definition Lists: colons occurring in tags
4713 !! wikitext
4714 ;a:b
4715 ;'''a:b'''
4716 ;<i>a:b</i>
4717 ;<span>a:b</span>
4718 ;<div>a:b</div>
4719 ;<div>a
4720 :b</div>
4721 ;{{echo|a:b}}
4722 ;{{echo|''a:b''}}
4723 ;;;''a:b''
4724 !! html+tidy
4725 <dl><dt>a</dt>
4726 <dd>b</dd>
4727 <dt><b>a:b</b></dt>
4728 <dt><i>a:b</i></dt>
4729 <dt><span>a:b</span></dt>
4730 <dt><div>a:b</div></dt>
4731 <dt><div>a</div></dt>
4732 <dd>b</dd>
4733 <dt>a</dt>
4734 <dd>b</dd>
4735 <dt><i>a:b</i></dt></dl>
4736 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4737 !! html/parsoid
4738 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4739 <dt><b>a:b</b></dt>
4740 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4741 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4742 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4743 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4744 <dd>b</dd>
4745 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4746 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4747 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4748 !! end
4749
4750 # Parsoid's output differs here again because it shares
4751 # nesting between the two lists unlike the PHP parser.
4752 # Unsure which is more desirable.
4753 !! test
4754 Definition Lists: colons and tables 1
4755 !! wikitext
4756 :{|
4757 |x
4758 |}
4759 :{|
4760 |y
4761 |}
4762 !! html/php
4763 <dl><dd><table>
4764 <tr>
4765 <td>x
4766 </td></tr></table></dd></dl>
4767 <dl><dd><table>
4768 <tr>
4769 <td>y
4770 </td></tr></table></dd></dl>
4771 !! html/parsoid
4772 <dl><dd><table>
4773 <tr>
4774 <td>x
4775 </td></tr></table></dd>
4776 <dd><table>
4777 <tr>
4778 <td>y
4779 </td></tr></table></dd></dl>
4780 !! end
4781
4782 # FIXME: Does this need a html/php section?
4783 !! test
4784 Definition Lists: template interaction
4785 !! wikitext
4786 ::{{definition_list}}
4787
4788 :one
4789 ::{{definition_list}}
4790 :::two
4791 :::three
4792 ::four
4793 !! html/parsoid
4794 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4795 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4796
4797 <dl><dd data-parsoid='{}'>one
4798 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4799 </span><dd about="#mwt2">two
4800 <dl><dd>two</dd>
4801 <dd>three</dd></dl></dd>
4802 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4803 !! end
4804
4805
4806 ###
4807 ### External links
4808 ###
4809 !! test
4810 External links: non-bracketed
4811 !! wikitext
4812 Non-bracketed: http://example.com
4813 !! html
4814 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4815 </p>
4816 !! end
4817
4818 # parsoid doesn't explicitly mark autonumbered links, see T55505
4819 !! test
4820 External links: numbered
4821 !! wikitext
4822 Numbered: [http://example.com]
4823 Numbered: [http://example.net]
4824 Numbered: [http://example.com]
4825 !! html/php
4826 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4827 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4828 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4829 </p>
4830 !! html/parsoid
4831 <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
4832 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4833 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
4834 !!end
4835
4836 !! test
4837 External links: specified text
4838 !! wikitext
4839 Specified text: [http://example.com link]
4840 !! html
4841 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4842 </p>
4843 !!end
4844
4845 !! test
4846 External links: trail
4847 !! wikitext
4848 Linktrails should not work for external links: [http://example.com link]s
4849 !! html
4850 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4851 </p>
4852 !! end
4853
4854 !! test
4855 External links: dollar sign in URL
4856 !! wikitext
4857 http://example.com/1$2345
4858 !! html
4859 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4860 </p>
4861 !! end
4862
4863 # parsoid doesn't explicitly mark autonumbered links, see T55505
4864 !! test
4865 External links: dollar sign in URL (autonumber)
4866 !! wikitext
4867 [http://example.com/1$2345]
4868 !! html/php
4869 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4870 </p>
4871 !! html/parsoid
4872 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
4873 !!end
4874
4875 !! test
4876 External links: open square bracket forbidden in URL (T6377)
4877 !! options
4878 parsoid=wt2html,wt2wt,html2html
4879 !! wikitext
4880 http://example.com/1[2345
4881 !! html/php
4882 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4883 </p>
4884 !! html/parsoid
4885 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
4886 !! end
4887
4888 !! test
4889 External links: open square bracket forbidden in URL (named) (T6377)
4890 !! options
4891 parsoid=wt2html,html2html
4892 !! wikitext
4893 [http://example.com/1[2345]
4894 !! html/php
4895 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4896 </p>
4897 !! html/parsoid
4898 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
4899 !!end
4900
4901 # parsoid adds a space before the link name
4902 !! test
4903 External links: open square bracket forbidden in URL (named) (T6377)
4904 Parsoid variant.
4905 !! wikitext
4906 [http://example.com/1 [2345]
4907 !! html
4908 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4909 </p>
4910 !!end
4911
4912 !! test
4913 External links: nowiki in URL link text (T8230)
4914 !! wikitext
4915 [http://example.com/ <nowiki>''example site''</nowiki>]
4916 !! html
4917 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4918 </p>
4919 !! end
4920
4921 !! test
4922 External links: newline forbidden in text (T8230 regression check)
4923 !! wikitext
4924 [http://example.com/ first
4925 second]
4926 !! html
4927 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4928 second]
4929 </p>
4930 !!end
4931
4932 !! test
4933 External links: Pipe char between url and text
4934 !! wikitext
4935 [http://example.com | link]
4936 !! html
4937 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4938 </p>
4939 !!end
4940
4941 !! test
4942 External links: protocol-relative URL in brackets
4943 !! wikitext
4944 [//example.com/ Test]
4945 !! html
4946 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4947 </p>
4948 !! end
4949
4950 # parsoid doesn't explicitly mark autonumbered links, see T55505
4951 !! test
4952 External links: protocol-relative URL in brackets without text
4953 !! wikitext
4954 [//example.com]
4955 !! html/php
4956 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4957 </p>
4958 !! html/parsoid
4959 <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
4960 !! end
4961
4962 !! test
4963 External links: protocol-relative URL in free text is left alone
4964 !! wikitext
4965 //example.com/Foo
4966 !! html
4967 <p>//example.com/Foo
4968 </p>
4969 !!end
4970
4971 !! test
4972 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4973 !! wikitext
4974 foo//example.com/Foo
4975 !! html
4976 <p>foo//example.com/Foo
4977 </p>
4978 !! end
4979
4980 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
4981 !! test
4982 External links: with no contents
4983 !! options
4984 parsoid=wt2html,wt2wt
4985 !! wikitext
4986 [http://en.wikipedia.org/wiki/Foo]
4987
4988 [[wikipedia:Foo|Bar]]
4989
4990 [[wikipedia:Foo|<span>Bar</span>]]
4991 !! html/php
4992 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4993 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4994 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4995 </p>
4996 !! html/parsoid
4997 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4998 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4999 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
5000 !! end
5001
5002 !! test
5003 External links: Free with trailing punctuation
5004 !! wikitext
5005 http://example.com,
5006 http://example.com;
5007 http://example.com\
5008 http://example.com.
5009 http://example.com:
5010 http://example.com!
5011 http://example.com?
5012 http://example.com)
5013 http://example.com/url_with_(brackets)
5014 (http://example.com/url_without_brackets)
5015 http://example.com/url_with_entity&amp;
5016 http://example.com/url_with_entity&#x26;
5017 http://example.com/url_with_entity&#038;
5018 http://example.com/url_with_entity&nbsp;
5019 http://example.com/url_with_entity&#xA0;
5020 http://example.com/url_with_entity&#160;
5021 http://example.com/url_with_entity&lt;
5022 http://example.com/url_with_entity&#x3C;
5023 http://example.com/url_with_entity&#60;
5024 !! html/php
5025 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
5026 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
5027 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
5028 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
5029 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
5030 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
5031 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
5032 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5033 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5034 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5035 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5036 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5037 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5038 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5039 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
5040 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5041 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
5042 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
5043 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
5044 </p>
5045 !! html/parsoid
5046 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
5047 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
5048 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
5049 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
5050 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
5051 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
5052 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
5053 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
5054 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5055 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5056 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5057 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5058 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5059 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
5060 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
5061 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
5062 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
5063 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
5064 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
5065 !! end
5066
5067 !! test
5068 External links: tricky Parsoid html2html case
5069 !! options
5070 parsoid=wt2html,wt2wt,html2html
5071 !! wikitext
5072 http://example.com/url_with_entity&amp;amp;
5073 !! html/php
5074 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
5075 </p>
5076 !! html/parsoid
5077 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
5078 !! end
5079
5080 !! test
5081 External links: Free with trailing quotes (T113666)
5082 !! wikitext
5083 '''News:''' Stuff here
5084
5085 news:'a'b''c''d e
5086 !! html/php
5087 <p><b>News:</b> Stuff here
5088 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
5089 </p>
5090 !! html/parsoid
5091 <p><b>News:</b> Stuff here</p>
5092 <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
5093 !! end
5094
5095 !! test
5096 External links: with entity
5097 !! wikitext
5098 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
5099 !! html/php
5100 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
5101 </p>
5102 !! html/parsoid
5103 <p><a rel="mw:ExtLink" class="external text" href="http://+www.librarieswithoutborders.org" data-parsoid='{"a":{"href":"http://+www.librarieswithoutborders.org"},"sa":{"href":"http://&amp;#x20;www.librarieswithoutborders.org"}}'>Libraries without borders</a></p>
5104 !! end
5105
5106 !! test
5107 External links: Lone protocols are never linked (T105697)
5108 !! wikitext
5109 http://
5110 http://;
5111 (http://)
5112 bitcoin:
5113 bitcoin:;
5114 (bitcoin:)
5115 !! html
5116 <p>http://
5117 http://;
5118 (http://)
5119 bitcoin:
5120 bitcoin:;
5121 (bitcoin:)
5122 </p>
5123 !! end
5124
5125 !! test
5126 External links: No preceding word characters allowed (T67278)
5127 !! wikitext
5128 NOPEhttp://example.com
5129 N0http://example.com
5130 ok:http://example.com
5131 ok-http://example.com
5132 !! html
5133 <p>NOPEhttp://example.com
5134 N0http://example.com
5135 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5136 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5137 </p>
5138 !! end
5139
5140 !! test
5141 External links: nofollow domain exception
5142 !! wikitext
5143 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
5144 !! html
5145 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
5146 </p>
5147 !!end
5148
5149 !! test
5150 External image
5151 !! wikitext
5152 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5153 !! html
5154 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5155 </p>
5156 !! end
5157
5158 !! test
5159 External image from https
5160 !! wikitext
5161 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5162 !! html
5163 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5164 </p>
5165 !! end
5166
5167 !! test
5168 External image (when not allowed)
5169 !! options
5170 wgAllowExternalImages=0
5171 !! wikitext
5172 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5173 !! html
5174 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
5175 </p>
5176 !! end
5177
5178 !! test
5179 Link to non-http image, no img tag
5180 !! wikitext
5181 Link to non-http image, no img tag: ftp://example.com/test.jpg
5182 !! html
5183 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
5184 </p>
5185 !! end
5186
5187 !! test
5188 External links: terminating separator
5189 !! wikitext
5190 Terminating separator: http://example.com/thing,
5191 !! html
5192 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
5193 </p>
5194 !! end
5195
5196 !! test
5197 External links: intervening separator
5198 !! wikitext
5199 Intervening separator: http://example.com/1,2,3
5200 !! html
5201 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
5202 </p>
5203 !! end
5204
5205 !! test
5206 External links: old bug with URL in query
5207 !! wikitext
5208 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
5209 !! html
5210 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
5211 </p>
5212 !! end
5213
5214 !! test
5215 External links: old URL-in-URL bug, mixed protocols
5216 !! wikitext
5217 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
5218 !! html
5219 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
5220 </p>
5221 !!end
5222
5223 # Since Parsoid is starting to emit canonical wikitext for links,
5224 # [http://example.com http://example.com] will not RT back to that
5225 # form anymore.
5226 !! test
5227 External links: URL in text
5228 !! options
5229 parsoid=wt2html
5230 !! wikitext
5231 URL in text: [http://example.com http://example.com]
5232 !! html/php
5233 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
5234 </p>
5235 !! html/parsoid
5236 <p>URL in text: <a rel="mw:ExtLink" class="external text" href="http://example.com">http://example.com</a></p>
5237 !! end
5238
5239 !! test
5240 External links: Clickable images
5241 !! wikitext
5242 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5243 !! html/php
5244 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/></a>
5245 </p>
5246 !! html/parsoid
5247 <p>ja-style clickable images: <a rel="mw:ExtLink" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
5248 !! end
5249
5250 !! test
5251 External links: raw ampersand
5252 !! wikitext
5253 Old &amp; use: http://x&y
5254 !! html
5255 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5256 </p>
5257 !! end
5258
5259 !! test
5260 External links: encoded ampersand
5261 !! wikitext
5262 Old &amp; use: http://x&amp;y
5263 !! html/php
5264 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5265 </p>
5266 !! html/parsoid
5267 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external free" href="http://x&amp;y">http://x&amp;y</a></p>
5268 !! end
5269
5270 !! test
5271 External links: encoded equals (T8102)
5272 !! wikitext
5273 http://example.com/?foo&#61;bar
5274 !! html/php
5275 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5276 </p>
5277 !! html/parsoid
5278 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5279 !! end
5280
5281 ##
5282 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5283 ## does it number them. As discussed in T55505, we can identify
5284 ## autonumbered links via CSS.
5285 ##
5286
5287 !! test
5288 External links: [raw ampersand]
5289 !! wikitext
5290 Old &amp; use: [http://x&y]
5291 !! html/php
5292 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5293 </p>
5294 !! html/parsoid
5295 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5296 !! end
5297
5298 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5299 # mode will return the [raw ampersand] wikitext
5300 !! test
5301 External links: [encoded ampersand]
5302 !! options
5303 parsoid=wt2html,wt2wt,html2html
5304 !! wikitext
5305 Old &amp; use: [http://x&amp;y]
5306 !! html/php
5307 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5308 </p>
5309 !! html/parsoid
5310 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5311 !! end
5312
5313 !! test
5314 External links: [raw equals]
5315 !! wikitext
5316 [http://example.com/?foo=bar]
5317 !! html/php
5318 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5319 </p>
5320 !! html/parsoid
5321 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5322 !! end
5323
5324 # note that parsoid html is identical to [raw equals] case; so html2wt
5325 # mode will return the [raw equals] wikitext
5326 !! test
5327 External links: [encoded equals] (T8102)
5328 !! options
5329 parsoid=wt2html,wt2wt,html2html
5330 !! wikitext
5331 [http://example.com/?foo&#61;bar]
5332 !! html/php
5333 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5334 </p>
5335 !! html/parsoid
5336 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5337 !! end
5338
5339 # xxx parsoid strips the IDN character, so the round-trip tests will
5340 # obviously fail and are disabled. --cscott
5341 !! test
5342 External links: [IDN ignored character reference in hostname; strip it right off]
5343 !! options
5344 parsoid=wt2html,wt2wt,html2html
5345 !! wikitext
5346 [http://e&zwnj;xample.com/]
5347 !! html/php
5348 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5349 </p>
5350 !! html/parsoid
5351 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
5352 !! end
5353
5354 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5355 # Where an external link could easily circumvent the sanitization of the text of
5356 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5357 # test demands a higher standard. That's a bit strange.
5358 #
5359 # Example:
5360 #
5361 # http://e‌xample.com -> [http://example.com|http://example.com]
5362 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5363 #
5364 # The first example is sanitized, but the second is not. Any security benefits
5365 # from this production are trivial to circumvent. Either remove this test and
5366 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5367 # the test accordingly.
5368 #
5369 # All our love,
5370 # The Parsoid team.
5371 # xxx parsoid strips the IDN character, so the round-trip tests will
5372 # obviously fail and are disabled. --cscott
5373 !! test
5374 External links: IDN ignored character reference in hostname; strip it right off
5375 !! options
5376 parsoid=wt2html,html2html
5377 !! wikitext
5378 http://e&zwnj;xample.com/
5379 !! html/php
5380 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5381 </p>
5382 !! html/parsoid
5383 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
5384 !! end
5385
5386 !! test
5387 External links: www.jpeg.org (T2554)
5388 !! wikitext
5389 http://www.jpeg.org
5390 !! html
5391 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5392 </p>
5393 !! end
5394
5395 # parsoid doesn't explicitly mark autonumbered links, see T55505
5396 !! test
5397 External links: URL within URL (T2002)
5398 !! wikitext
5399 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5400 !! html/php
5401 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5402 </p>
5403 !! html/parsoid
5404 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5405 !! end
5406
5407 !! test
5408 T2361: URL inside bracketed URL
5409 !! wikitext
5410 [http://www.example.com/foo http://www.example.com/bar]
5411 !! html
5412 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5413 </p>
5414 !! end
5415
5416 !! test
5417 T2361: URL within URL, not bracketed
5418 !! wikitext
5419 http://www.example.com/foo?=http://www.example.com/bar
5420 !! html
5421 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
5422 </p>
5423 !! end
5424
5425 !! test
5426 T2289: ">"-token in URL-tail
5427 !! wikitext
5428 http://www.example.com/<hello>
5429 !! html
5430 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5431 </p>
5432 !!end
5433
5434 !! test
5435 T2289: literal ">"-token in URL-tail
5436 !! wikitext
5437 http://www.example.com/<b>html</b>
5438 !! html/php
5439 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5440 </p>
5441 !! html/parsoid
5442 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5443 !! end
5444
5445 !! test
5446 T2289: ">"-token in bracketed URL
5447 !! wikitext
5448 [http://www.example.com/<hello> stuff]
5449 !! html
5450 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5451 </p>
5452 !!end
5453
5454 !! test
5455 T2289: literal ">"-token in bracketed URL
5456 !! wikitext
5457 [http://www.example.com/<b>html</b> stuff]
5458 !! html
5459 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5460 </p>
5461 !!end
5462
5463 !! test
5464 T2289: literal double quote at end of URL
5465 !! wikitext
5466 http://www.example.com/"hello"
5467 !! html
5468 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5469 </p>
5470 !!end
5471
5472 !! test
5473 T2289: literal double quote in bracketed URL
5474 !! wikitext
5475 [http://www.example.com/"hello" stuff]
5476 !! html
5477 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5478 </p>
5479 !!end
5480
5481 !! test
5482 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5483 !! wikitext
5484 [http://www.example.com test]
5485 !! html
5486 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5487 </p>
5488 !! end
5489
5490 !! test
5491 External links: link text with spaces
5492 !! wikitext
5493 [http://www.example.com a b c]
5494 [http://www.example.com ''a'' ''b'']
5495 !! html
5496 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5497 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5498 </p>
5499 !! end
5500
5501 # Note edge case difference between PHP and Parsoid here.
5502 !! test
5503 External links: wiki links within external link (T5695)
5504 !! options
5505 parsoid=wt2html,html2html
5506 !! wikitext
5507 [http://example.com [[wikilink]] embedded in ext link]
5508
5509 [http://example.com test [[wikilink]] embedded in ext link]
5510 !! html/php
5511 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5512 </p><p><a rel="nofollow" class="external text" href="http://example.com">test </a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5513 </p>
5514 !! html/parsoid
5515 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5516 <p><a rel="mw:ExtLink" class="external text" href="http://example.com">test </a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5517 !! end
5518
5519 !! test
5520 T2787: Links with one slash after the url protocol are invalid
5521 !! wikitext
5522 http:/example.com
5523
5524 [http:/example.com title]
5525 !! html
5526 <p>http:/example.com
5527 </p><p>[http:/example.com title]
5528 </p>
5529 !! end
5530
5531 !! test
5532 Bracketed external links with template-generated invalid target
5533 !! wikitext
5534 [{{echo|http:/example.com}} title]
5535 !! html
5536 <p>[http:/example.com title]
5537 </p>
5538 !! end
5539
5540 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5541 !! test
5542 Broken wikilinks (but not external links) prevent templates from closing
5543 !! options
5544 parsoid=wt2html
5545 !! wikitext
5546 [http://example.com x
5547
5548 {{echo|[http://example.com x}}
5549
5550 [[Foo
5551
5552 {{echo|[[Foo}}
5553 !! html/php
5554 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5555 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5556 </p><p>[[Foo
5557 </p><p>{{echo|[[Foo}}
5558 </p>
5559 !! html/parsoid
5560 <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5561 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://example.com x"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5562 <p>[[Foo</p>
5563 <p>{{echo|[[Foo}}</p>
5564 !! end
5565
5566 !! test
5567 Wikilinks with embedded newlines are not broken
5568 !! wikitext
5569 {{echo|[[ Foo
5570 B
5571 C]]}}
5572 !! html/php
5573 <p>[[ Foo
5574 B
5575 C]]
5576 </p>
5577 !! html/parsoid
5578 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[ Foo\nB\nC]]"}},"i":0}}]}'>[[ Foo B C]]</p>
5579 !! end
5580
5581 !! test
5582 Broken templates
5583 !! options
5584 parsoid=wt2html
5585 !! wikitext
5586 {{echo|[[Foo|}}]]
5587
5588 [[Foo|{{echo|]]}}
5589 !! html/php
5590 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5591 </p><p>[[Foo|]]
5592 </p>
5593 !! html/parsoid
5594 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5595 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5596 !! end
5597
5598 !! test
5599 T4702: Mismatched <i>, <b> and <a> tags are invalid
5600 !! wikitext
5601 ''[http://example.com text'']
5602 [http://example.com '''text]'''
5603 ''Something [http://example.com in italic'']
5604 ''Something [http://example.com mixed''''', even bold]'''
5605 '''''Now [http://example.com both''''']
5606 !! html
5607 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5608 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5609 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5610 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5611 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5612 </p>
5613 !! end
5614
5615
5616 !! test
5617 T6781: %26 in URL
5618 !! wikitext
5619 http://www.example.com/?title=AT%26T
5620 !! html/php
5621 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5622 </p>
5623 !! html/parsoid
5624 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5625 !! end
5626
5627 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5628 # % is actually legal in HTML5. Any change in output would need testing though.
5629 !! test
5630 T6781, T7267: %25 in URL
5631 !! wikitext
5632 http://www.example.com/?title=100%25_Bran
5633 !! html/php
5634 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5635 </p>
5636 !! html/parsoid
5637 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5638 !! end
5639
5640 !! test
5641 T6781, T7267: %28, %29 in URL
5642 !! wikitext
5643 http://www.example.com/?title=Ben-Hur_%281959_film%29
5644 !! html/php
5645 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5646 </p>
5647 !! html/parsoid
5648 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5649 !! end
5650
5651
5652 !! test
5653 T6781: %26 in autonumber URL
5654 !! wikitext
5655 [http://www.example.com/?title=AT%26T]
5656 !! html/php
5657 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5658 </p>
5659 !! html/parsoid
5660 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5661 !! end
5662
5663 !! test
5664 T6781, T7267: %26 in autonumber URL
5665 !! wikitext
5666 [http://www.example.com/?title=100%25_Bran]
5667 !! html/php
5668 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5669 </p>
5670 !! html/parsoid
5671 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5672 !! end
5673
5674 !! test
5675 T6781, T7267: %28, %29 in autonumber URL
5676 !! wikitext
5677 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5678 !! html/php
5679 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5680 </p>
5681 !! html/parsoid
5682 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5683 !! end
5684
5685
5686 !! test
5687 T6781: %26 in bracketed URL
5688 !! wikitext
5689 [http://www.example.com/?title=AT%26T link]
5690 !! html/php
5691 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5692 </p>
5693 !! html/parsoid
5694 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5695 !! end
5696
5697 !! test
5698 T6781, T7267: %25 in bracketed URL
5699 !! wikitext
5700 [http://www.example.com/?title=100%25_Bran link]
5701 !! html
5702 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5703 </p>
5704 !! end
5705
5706 !! test
5707 T6781, T7267: %28, %29 in bracketed URL
5708 !! wikitext
5709 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5710 !! html/php
5711 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5712 </p>
5713 !! html/parsoid
5714 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5715 !! end
5716
5717 !! test
5718 External link containing a period in the anchor. (T65947)
5719 !! wikitext
5720 [//foo.org/bar#baz. bang]
5721
5722 [//foo.org/bar. bang]
5723 !! html/php
5724 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5725 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5726 </p>
5727 !! html/parsoid
5728 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5729 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5730 !! end
5731
5732 !! test
5733 External link containing a single quote. (T65947)
5734 !! wikitext
5735 [//foo.org/bar'baz]
5736
5737 [//foo.org/bar'baz bang]
5738 !! html/php
5739 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5740 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5741 </p>
5742 !! html/parsoid
5743 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5744 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5745 !! end
5746
5747 !! test
5748 External link containing double-single-quotes in text '' (T6598 sanity check)
5749 !! wikitext
5750 Some [http://example.com/ pretty ''italics'' and stuff]!
5751 !! html
5752 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5753 </p>
5754 !! end
5755
5756 !! test
5757 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5758 !! wikitext
5759 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5760 !! html
5761 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5762 </p>
5763 !! end
5764
5765 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5766 !! test
5767 External link containing double-single-quotes with no space separating the url from text in italics
5768 !! wikitext
5769 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5770 !! html/php+tidy
5771 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.
5772 </p>
5773 !! html/parsoid
5774 <p><a rel="mw:ExtLink" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5775 !! end
5776
5777 !! test
5778 External link with comments in link text
5779 !! wikitext
5780 [http://www.google.com Google <!-- comment -->]
5781 !! html/php
5782 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5783 </p>
5784 !! html/parsoid
5785 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5786 !! end
5787
5788 !! test
5789 External link to bare IPv4 address
5790 !! wikitext
5791 [http://192.168.0.1 Link]
5792 !! html/php
5793 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5794 </p>
5795 !! html/parsoid
5796 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5797 !! end
5798
5799 !! test
5800 URL-encoding in URL functions (single parameter)
5801 !! wikitext
5802 {{localurl:Some page|amp=&}}
5803 !! html
5804 <p>/index.php?title=Some_page&amp;amp=&amp;
5805 </p>
5806 !! end
5807
5808 !! test
5809 URL-encoding in URL functions (multiple parameters)
5810 !! wikitext
5811 {{localurl:Some page|q=?&amp=&}}
5812 !! html
5813 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5814 </p>
5815 !! end
5816
5817 !! test
5818 Brackets in urls
5819 !! wikitext
5820 http://example.com/index.php?foozoid%5B%5D=bar
5821
5822 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5823 !! html/php
5824 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5825 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5826 </p>
5827 !! html/parsoid
5828 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5829
5830 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar" data-parsoid='{"stx":"url","a":{"href":"http://example.com/index.php?foozoid%5B%5D=bar"},"sa":{"href":"http://example.com/index.php?foozoid&amp;#x5B;&amp;#x5D;=bar"}}'>http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5831 !! end
5832
5833 !! test
5834 IPv6 urls, autolink format (T23261)
5835 !! wikitext
5836 http://[2404:130:0:1000::187:2]/index.php
5837
5838 Examples from RFC 2373, section 2.2:
5839
5840 *http://[1080::8:800:200C:417A]/unicast
5841 *http://[FF01::101]/multicast
5842 *http://[::1]/loopback
5843 *http://[::]/unspecified
5844 *http://[::13.1.68.3]/ipv4compat
5845 *http://[::FFFF:129.144.52.38]/ipv4compat
5846
5847 Examples from RFC 2732, section 2:
5848
5849 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5850 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5851 *http://[3ffe:2a00:100:7031::1]
5852 *http://[1080::8:800:200C:417A]/foo
5853 *http://[::192.9.5.5]/ipng
5854 *http://[::FFFF:129.144.52.38]:80/index.html
5855 *http://[2010:836B:4179::836B:4179]
5856 !! html/php
5857 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5858 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5859 </p>
5860 <ul><li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5861 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5862 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5863 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5864 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5865 <li><a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5866 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5867 </p>
5868 <ul><li><a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5869 <li><a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5870 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5871 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5872 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5873 <li><a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5874 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5875 !! html/parsoid
5876 <p><a rel="mw:ExtLink" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5877
5878 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external mw-magiclink">RFC 2373</a>, section 2.2:</p>
5879 <ul><li><a rel="mw:ExtLink" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5880 <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5881 <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5882 <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5883 <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5884 <li><a rel="mw:ExtLink" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5885
5886 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5887 <ul><li><a rel="mw:ExtLink" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5888 <li><a rel="mw:ExtLink" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5889 <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5890 <li><a rel="mw:ExtLink" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5891 <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5892 <li><a rel="mw:ExtLink" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5893 <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5894 !! end
5895
5896 !! test
5897 IPv6 urls, bracketed format (T23261)
5898 !! wikitext
5899 [http://[2404:130:0:1000::187:2]/index.php test]
5900
5901 Examples from RFC 2373, section 2.2:
5902
5903 *[http://[1080::8:800:200C:417A] unicast]
5904 *[http://[FF01::101] multicast]
5905 *[http://[::1]/ loopback]
5906 *[http://[::] unspecified]
5907 *[http://[::13.1.68.3] ipv4compat]
5908 *[http://[::FFFF:129.144.52.38] ipv4compat]
5909
5910 Examples from RFC 2732, section 2:
5911
5912 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5913 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5914 *[http://[3ffe:2a00:100:7031::1] 3]
5915 *[http://[1080::8:800:200C:417A]/foo 4]
5916 *[http://[::192.9.5.5]/ipng 5]
5917 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5918 *[http://[2010:836B:4179::836B:4179] 7]
5919 !! html/php
5920 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5921 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5922 </p>
5923 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5924 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5925 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5926 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5927 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5928 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5929 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5930 </p>
5931 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5932 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5933 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5934 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5935 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5936 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5937 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5938 !! html/parsoid
5939 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5940
5941 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external mw-magiclink">RFC 2373</a>, section 2.2:</p>
5942 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5943 <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5944 <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5945 <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5946 <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5947 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5948
5949 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5950 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5951 <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5952 <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5953 <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5954 <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5955 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5956 <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5957 !! end
5958
5959 !! test
5960 Non-extlinks in brackets
5961 !! wikitext
5962 [foo]
5963 [foo bar]
5964 [foo ''bar'']
5965 [fool's] errand
5966 [fool's errand]
5967 [{{echo|foo}}]
5968 [{{echo|foo}} bar]
5969 [{{echo|foo}} ''bar'']
5970 [{{echo|foo}}l's] errand
5971 [{{echo|foo}}l's errand]
5972 [url={{echo|foo}}]
5973 [url=http://example.com]
5974 [http:// bare protocols don't count]
5975 !! html/php
5976 <p>[foo]
5977 [foo bar]
5978 [foo <i>bar</i>]
5979 [fool's] errand
5980 [fool's errand]
5981 [foo]
5982 [foo bar]
5983 [foo <i>bar</i>]
5984 [fool's] errand
5985 [fool's errand]
5986 [url=foo]
5987 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5988 [http:// bare protocols don't count]
5989 </p>
5990 !! html/parsoid
5991 <p>[foo]
5992 [foo bar]
5993 [foo <i>bar</i>]
5994 [fool's] errand
5995 [fool's errand]
5996 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
5997 [<span about="#mwt20" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span> bar]
5998 [<span about="#mwt21" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span> <i>bar</i>]
5999 [<span about="#mwt22" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>l's] errand
6000 [<span about="#mwt23" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>l's errand]
6001 [url=<span about="#mwt24" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
6002 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
6003 [http:// bare protocols don't count]</p>
6004 !! end
6005
6006 !! test
6007 Percent encoding in external links
6008 !! wikitext
6009 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
6010 !! html/php
6011 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
6012 </p>
6013 !! html/parsoid
6014 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
6015 !! end
6016
6017 !! test
6018 Use url link syntax for links where the content is equal the link target
6019 !! wikitext
6020 http://example.com
6021 !! html/php
6022 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
6023 </p>
6024 !! html/parsoid
6025 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
6026 !! end
6027
6028 !! test
6029 Parenthesis in external links, especially URL links
6030 !! wikitext
6031 http://example.com)
6032
6033 http://example.com/test)
6034
6035 http://example.com/(test)
6036
6037 http://example.com/((test)
6038
6039 (http://example.com/(test))
6040
6041 (http://example.com/(test)))))
6042
6043 http://example.com/a)b
6044
6045 [http://example.com) foo]
6046 !! html/php
6047 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6048 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
6049 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
6050 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
6051 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
6052 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
6053 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
6054 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
6055 </p>
6056 !! html/parsoid
6057 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
6058 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
6059 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
6060 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
6061 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
6062 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
6063 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
6064 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
6065 !! end
6066
6067 !! test
6068 Parenthesis in external links, w/ transclusion or comment
6069 !! wikitext
6070 (http://example.com/{{echo|hi}})
6071
6072 (http://example.com<!-- hi -->)
6073 !! html/php
6074 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
6075 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6076 </p>
6077 !! html/parsoid
6078 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" class="external free" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
6079
6080 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
6081 !! end
6082
6083 !! test
6084 Serialize <a> tags with invalid link targets as plain text
6085 !! options
6086 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
6087 !! html/parsoid
6088 <a rel="mw:WikiLink" href="[[foo]]">text</a>
6089 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
6090 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
6091 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
6092 !! wikitext
6093 text
6094 <nowiki>*</nowiki>text
6095 <nowiki>[[foo]]</nowiki>
6096 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
6097 !! end
6098
6099 !! test
6100 mw:ExtLink -vs- mw:WikiLink (T94723)
6101 !! options
6102 parsoid=html2wt
6103 !! html/parsoid
6104 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
6105 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
6106 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6107 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6108 <p>
6109 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6110 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6111 </p>
6112 !! wikitext
6113 [[Foo|Bar]]
6114 [[Foo|Bar]]
6115 [[:en:Foo|Bar]]
6116 [[:en:Foo|Bar]]
6117
6118 [[:en:European_Robin|European Robin]]
6119 [[:en:European_Robin|European Robin]]
6120 !! end
6121
6122 !! test
6123 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
6124 !! options
6125 parsoid=wt2wt
6126 !! wikitext
6127 [http://en.wikipedia.org/wiki/European_Robin European Robin]
6128 !! html/parsoid
6129 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
6130 !! end
6131
6132
6133 ###
6134 ### Quotes
6135 ###
6136
6137 !! test
6138 Quotes
6139 !! wikitext
6140 Normal text. '''Bold text.''' Normal text. ''Italic text.''
6141
6142 Normal text. '''''Bold italic text.''''' Normal text.
6143 !! html
6144 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
6145 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
6146 </p>
6147 !! end
6148
6149 !! test
6150 Quotes wrapping HTML table
6151 !! wikitext
6152 '''<table><tr><td>hi</td></tr></table>'''
6153 !! html/php+tidy
6154 <b><table><tbody><tr><td>hi</td></tr></tbody></table></b>
6155 !! html/parsoid
6156 <b><table data-parsoid='{"stx":"html"}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>hi</td></tr></tbody></table></b>
6157 !! end
6158
6159 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
6160 # parser strips. The wikitext contains just the first half of the bold
6161 # quote pair.
6162 !! test
6163 Unclosed and unmatched quotes
6164 !! wikitext
6165 '''''Bold italic text '''with bold deactivated''' in between.'''''
6166
6167 '''''Bold italic text ''with italic deactivated'' in between.'''''
6168
6169 '''Bold text..
6170
6171 ..spanning two paragraphs (should not work).'''
6172
6173 '''Bold tag left open
6174
6175 ''Italic tag left open
6176
6177 Normal text.
6178
6179 <!-- Unmatching number of opening, closing tags: -->
6180 '''This year''''s election ''should'' beat '''last year''''s.
6181
6182 ''Tom'''s car is bigger than ''Susan'''s.
6183
6184 Plain ''italic'''s plain
6185 !! html/php
6186 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6187 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6188 </p><p><b>Bold text..</b>
6189 </p><p>..spanning two paragraphs (should not work).
6190 </p><p><b>Bold tag left open</b>
6191 </p><p><i>Italic tag left open</i>
6192 </p><p>Normal text.
6193 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6194 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6195 </p><p>Plain <i>italic'</i>s plain
6196 </p>
6197 !! html/parsoid
6198 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6199 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6200 </p><p><b>Bold text..</b>
6201 </p><p>..spanning two paragraphs (should not work).<b></b>
6202 </p><p><b>Bold tag left open</b>
6203 </p><p><i>Italic tag left open</i>
6204 </p><p>Normal text.
6205 </p>
6206 <!-- Unmatching number of opening, closing tags: -->
6207 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6208 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6209 </p><p>Plain <i>italic'</i>s plain
6210 </p>
6211 !! end
6212
6213 ###
6214 ### Tables
6215 ###
6216 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
6217 ###
6218
6219 # This should not produce <table></table> as <table><tr><td></td></tr></table>
6220 # is the bare minimum required by the spec, see:
6221 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
6222 # Parsoid team replies: empty table tags are legal in HTML5
6223 !! test
6224 A table with no data.
6225 !! options
6226 parsoid=wt2html
6227 !! wikitext
6228 {||}
6229 !! html/php
6230 !! html/parsoid
6231 <table></table>
6232 !! end
6233
6234 !! test
6235 A table with stray table end tags on start tag line (wt2html)
6236 !! options
6237 parsoid=wt2html
6238 !! wikitext
6239 {|style="color: red;"|}
6240
6241 {|style="color: red;" |}
6242 |foo
6243 |}
6244
6245 {|style="color: red;"|} id="foo"
6246 |foo
6247 |}
6248
6249 {|style="color: red;" |} id="foo"
6250 |foo
6251 |}
6252 !! html/php+tidy
6253 <table style="color: red;">
6254
6255 </table><table style="color: red;">
6256 <tbody><tr>
6257 <td>foo
6258 </td></tr></tbody></table>
6259 <table style="color: red;" id="foo">
6260 <tbody><tr>
6261 <td>foo
6262 </td></tr></tbody></table>
6263 <table style="color: red;" id="foo">
6264 <tbody><tr>
6265 <td>foo
6266 </td></tr></tbody></table>
6267 !! html/parsoid
6268 <table style="color: red;"></table>
6269
6270 <table style="color: red;">
6271 <tbody><tr>
6272 <td>foo</td>
6273 </tr></tbody>
6274 </table>
6275
6276 <table style="color: red;" id="foo">
6277 <tbody><tr>
6278 <td>foo</td>
6279 </tr></tbody>
6280 </table>
6281
6282 <table style="color: red;" id="foo">
6283 <tbody><tr>
6284 <td>foo</td>
6285 </tr></tbody>
6286 </table>
6287 !! end
6288
6289 !! test
6290 A table with no data (take 2)
6291 !! wikitext
6292 {|
6293 |}
6294 !! html/parsoid
6295 <table></table>
6296 !! end
6297
6298 # A table with nothing but a caption is invalid XHTML, we might want to render
6299 # this as <p>caption</p>
6300 # Parsoid team replies: table with only a caption is legal in HTML5
6301 !! test
6302 A table with nothing but a caption
6303 !! wikitext
6304 {|
6305 |+caption
6306 |}
6307 !! html/php
6308 <table>
6309 <caption>caption
6310 </caption><tr><td></td></tr></table>
6311 !! html/parsoid
6312 <table><caption>caption</caption></table>
6313 !! end
6314
6315 !! test
6316 A table with caption with default-spaced attributes and a table row
6317 !! wikitext
6318 {|
6319 |+ style="color: red;" |caption1
6320 |-
6321 |foo
6322 |}
6323 !! html
6324 <table>
6325 <caption style="color: red;">caption1
6326 </caption>
6327 <tr>
6328 <td>foo
6329 </td></tr></table>
6330 !! end
6331
6332 !! test
6333 A table with captions with non-default spaced attributes and a table row
6334 !! wikitext
6335 {|
6336 |+style="color: red;"|caption2
6337 |+ style="color: red;"|caption3
6338 |-
6339 |foo
6340 |}
6341 !! html
6342 <table>
6343 <caption style="color: red;">caption2
6344 </caption>
6345 <caption style="color: red;">caption3
6346 </caption>
6347 <tr>
6348 <td>foo
6349 </td></tr></table>
6350 !! end
6351
6352 !! test
6353 Table td-cell syntax variations
6354 !! wikitext
6355 {|
6356 |foo bar foo|baz
6357 |foo bar foo||baz
6358 |style='color:red;'|baz
6359 |style='color:red;'||baz
6360 |}
6361 !! html
6362 <table>
6363 <tr>
6364 <td>baz
6365 </td>
6366 <td>foo bar foo</td>
6367 <td>baz
6368 </td>
6369 <td style="color:red;">baz
6370 </td>
6371 <td>style='color:red;'</td>
6372 <td>baz
6373 </td></tr></table>
6374 !! end
6375
6376 !! test
6377 Simple table
6378 !! wikitext
6379 {|
6380 |1||2
6381 |-
6382 |3||4
6383 |}
6384 !! html
6385 <table>
6386 <tr>
6387 <td>1</td>
6388 <td>2
6389 </td></tr>
6390 <tr>
6391 <td>3</td>
6392 <td>4
6393 </td></tr></table>
6394 !! end
6395
6396 !! test
6397 Simple table but with multiple dashes for row wikitext
6398 !! wikitext
6399 {|
6400 |foo
6401 |-----
6402 |bar
6403 |}
6404 !! html
6405 <table>
6406 <tr>
6407 <td>foo
6408 </td></tr>
6409 <tr>
6410 <td>bar
6411 </td></tr></table>
6412 !! end
6413
6414 !! test
6415 Multiplication table
6416 !! wikitext
6417 {| border="1" cellpadding="2"
6418 |+Multiplication table
6419 |-
6420 !&times;!!1!!2!!3
6421 |-
6422 !1
6423 |1||2||3
6424 |-
6425 !2
6426 |2||4||6
6427 |-
6428 !3
6429 |3||6||9
6430 |-
6431 !4
6432 |4||8||12
6433 |-
6434 !5
6435 |5||10||15
6436 |}
6437 !! html
6438 <table border="1" cellpadding="2">
6439 <caption>Multiplication table
6440 </caption>
6441 <tr>
6442 <th>&#215;</th>
6443 <th>1</th>
6444 <th>2</th>
6445 <th>3
6446 </th></tr>
6447 <tr>
6448 <th>1
6449 </th>
6450 <td>1</td>
6451 <td>2</td>
6452 <td>3
6453 </td></tr>
6454 <tr>
6455 <th>2
6456 </th>
6457 <td>2</td>
6458 <td>4</td>
6459 <td>6
6460 </td></tr>
6461 <tr>
6462 <th>3
6463 </th>
6464 <td>3</td>
6465 <td>6</td>
6466 <td>9
6467 </td></tr>
6468 <tr>
6469 <th>4
6470 </th>
6471 <td>4</td>
6472 <td>8</td>
6473 <td>12
6474 </td></tr>
6475 <tr>
6476 <th>5
6477 </th>
6478 <td>5</td>
6479 <td>10</td>
6480 <td>15
6481 </td></tr></table>
6482 !! end
6483
6484 !! test
6485 Accept "||" in table headings
6486 !! wikitext
6487 {|
6488 !h1||h2
6489 |}
6490 !! html
6491 <table>
6492 <tr>
6493 <th>h1</th>
6494 <th>h2
6495 </th></tr></table>
6496 !! end
6497
6498 !! test
6499 Accept "!!" in table data
6500 !! wikitext
6501 {|
6502 |Foo!!||
6503 |}
6504 !! html
6505 <table>
6506 <tr>
6507 <td>Foo!!</td>
6508 <td>
6509 </td></tr></table>
6510 !! html/parsoid
6511 <table>
6512 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6513 </tbody></table>
6514 !! end
6515
6516 !! test
6517 Accept "||" in indented table headings
6518 !! wikitext
6519 :{|
6520 !h1||h2
6521 |}
6522 !! html
6523 <dl><dd><table>
6524 <tr>
6525 <th>h1</th>
6526 <th>h2
6527 </th></tr></table></dd></dl>
6528 !! end
6529
6530 !! test
6531 Accept "!!" in templates
6532 !! wikitext
6533 {|
6534 !a {{echo|b!!c}}
6535 |}
6536 !! html/php
6537 <table>
6538 <tr>
6539 <th>a b</th>
6540 <th>c
6541 </th></tr></table>
6542 !! html/parsoid
6543 <table>
6544 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6545 !! end
6546
6547 !! test
6548 Accept "!!" in table headings after newline
6549 !! wikitext
6550 {|
6551 !a
6552 b!!c
6553 |}
6554 !! html/php
6555 <table>
6556 <tr>
6557 <th>a
6558 <p>b!!c
6559 </p>
6560 </th></tr></table>
6561 !! html/parsoid
6562 <table>
6563 <tbody><tr><th>a
6564 <p>b!!c</p></th></tr>
6565 </tbody></table>
6566 !! end
6567
6568 !! test
6569 Accept "!!" in table data of mixed wikitext / html syntax
6570 !! wikitext
6571 {|
6572 !a
6573 <tr><td>b!!c</td></tr>
6574 |}
6575 !! html/php+tidy
6576 <table>
6577 <tbody><tr>
6578 <th>a
6579 </th></tr><tr><td>b!!c</td></tr>
6580 </tbody></table>
6581 !! html/parsoid
6582 <table>
6583 <tbody><tr><th>a</th></tr>
6584 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6585 </tbody></table>
6586 !! end
6587
6588 !! test
6589 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6590 !! wikitext
6591 {|
6592 !|h1
6593 ||a
6594 |}
6595 !! html
6596 <table>
6597 <tr>
6598 <th>h1
6599 </th>
6600 <td>a
6601 </td></tr></table>
6602 !! end
6603
6604 !!test
6605 Accept "| !" at start of line in tables (ignore !-attribute)
6606 !! wikitext
6607 {|
6608 |-
6609 |!style="color:red"|bar
6610 |}
6611 !! html
6612 <table>
6613
6614 <tr>
6615 <td>bar
6616 </td></tr></table>
6617 !!end
6618
6619 !!test
6620 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6621 !! wikitext
6622 {|
6623 |-
6624 |style='color:red;'|+1
6625 |style='color:blue;'|-1
6626 |-
6627 |1||2||3
6628 |1||+2||-3
6629 |-
6630 | +1
6631 | -1
6632 |}
6633 !! html
6634 <table>
6635
6636 <tr>
6637 <td style="color:red;">+1
6638 </td>
6639 <td style="color:blue;">-1
6640 </td></tr>
6641 <tr>
6642 <td>1</td>
6643 <td>2</td>
6644 <td>3
6645 </td>
6646 <td>1</td>
6647 <td>+2</td>
6648 <td>-3
6649 </td></tr>
6650 <tr>
6651 <td>+1
6652 </td>
6653 <td>-1
6654 </td></tr></table>
6655 !!end
6656
6657 !! test
6658 Table rowspan
6659 !! wikitext
6660 {| border=1
6661 |Cell 1, row 1
6662 |rowspan=2|Cell 2, row 1 (and 2)
6663 |Cell 3, row 1
6664 |-
6665 |Cell 1, row 2
6666 |Cell 3, row 2
6667 |}
6668 !! html
6669 <table border="1">
6670 <tr>
6671 <td>Cell 1, row 1
6672 </td>
6673 <td rowspan="2">Cell 2, row 1 (and 2)
6674 </td>
6675 <td>Cell 3, row 1
6676 </td></tr>
6677 <tr>
6678 <td>Cell 1, row 2
6679 </td>
6680 <td>Cell 3, row 2
6681 </td></tr></table>
6682 !! end
6683
6684 !! test
6685 Nested table
6686 !! wikitext
6687 {| border=1
6688 | &alpha;
6689 |
6690 {| bgcolor=#ABCDEF border=2
6691 |nested
6692 |-
6693 |table
6694 |}
6695 |the original table again
6696 |}
6697 !! html
6698 <table border="1">
6699 <tr>
6700 <td>&#945;
6701 </td>
6702 <td>
6703 <table bgcolor="#ABCDEF" border="2">
6704 <tr>
6705 <td>nested
6706 </td></tr>
6707 <tr>
6708 <td>table
6709 </td></tr></table>
6710 </td>
6711 <td>the original table again
6712 </td></tr></table>
6713 !! end
6714
6715 !! test
6716 Invalid attributes in table cell (T3830)
6717 !! wikitext
6718 {|
6719 |Cell:|broken
6720 |}
6721 !! html
6722 <table>
6723 <tr>
6724 <td>broken
6725 </td></tr></table>
6726 !! end
6727
6728 !! test
6729 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6730 !! wikitext
6731 {|
6732 |title="foo" |bar
6733 |title="foo<nowiki>|</nowiki>" |bar
6734 |title="foo<nowiki>|</nowiki>" bar
6735 |}
6736 !! html/php
6737 <table>
6738 <tr>
6739 <td title="foo">bar
6740 </td>
6741 <td title="foo&#124;">bar
6742 </td>
6743 <td>title="foo|" bar
6744 </td></tr></table>
6745 !! html/parsoid
6746 <table>
6747 <tbody><tr><td title="foo">bar</td>
6748 <td title="foo|" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"foo&lt;span typeof=\"mw:Nowiki\" data-parsoid=&apos;{\"dsr\":[32,50,8,9]}&apos;>|&lt;/span>"}]]}'>bar</td>
6749 <td>title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6750 </tbody></table>
6751 !! end
6752
6753 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6754 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6755 # *2wt modes will fail.
6756 !! test
6757 Table security: embedded pipes
6758 !! options
6759 parsoid=wt2html,html2html
6760 !! wikitext
6761 {|
6762 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6763 !! html/php
6764 <table>
6765 <tr>
6766 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6767 <td>]" onmouseover="alert(document.cookie)"&gt;test
6768 </td>
6769 </tr>
6770 </table>
6771 !! html/parsoid
6772 <table><tbody>
6773 <tr>
6774 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'>[<a rel="mw:ExtLink" class="external free" href="ftp://%7Cx" data-parsoid='{"stx":"url","a":{"href":"ftp://%7Cx"},"sa":{"href":"ftp://|x"}}'>ftp://%7Cx</a></td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6775 !! end
6776
6777 !! test
6778 Element attributes with double ! should not be broken up by <th>
6779 !! wikitext
6780 {|
6781 !hi <div class="!!">ha</div> ho
6782 |}
6783 !! html/php
6784 <table>
6785 <tr>
6786 <th>hi <div class="!!">ha</div> ho
6787 </th></tr></table>
6788 !! html/parsoid
6789 <table>
6790 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6791 </tbody></table>
6792 !! end
6793
6794 !! test
6795 ! and || in element attributes should not be parsed as <th>/<td>
6796 !! wikitext
6797 {|
6798 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6799 |}
6800 !! html/php
6801 <table>
6802 <tr>
6803 <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6804 </td></tr></table>
6805 !! html/parsoid
6806 <table>
6807 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6808 </tbody></table>
6809 !! end
6810
6811 # FIXME: The output seems broken. Filed as T110268.
6812 !! test
6813 ! and || in td attributes should not be parsed as <th>/<td>
6814 !! options
6815 parsoid=wt2html
6816 !! wikitext
6817 {|
6818 |style="color: red !important;" data-contrived="put this here ||"|foo
6819 |}
6820 !! html/php
6821 <table>
6822 <tr>
6823 <td>style="color: red !important;" data-contrived="put this here</td>
6824 <td>foo
6825 </td></tr></table>
6826 !! html/parsoid
6827 <table>
6828 <tbody><tr><td>style="color: red !important;" data-contrived="put this here</td><td data-parsoid='{"stx":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'>foo</td></tr>
6829 </tbody></table>
6830 !! end
6831
6832 !! test
6833 Break on | in element attribute in template
6834 !! options
6835 parsoid=wt2html,html2html
6836 !! wikitext
6837 {{echo|1=<div class="hi|ho">ha</div>}}
6838 !! html/php
6839 <p>ho"&gt;ha&lt;/div&gt;
6840 </p>
6841 !! html/parsoid
6842 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</p>
6843 !! end
6844
6845 !! test
6846 Break on | in element attribute name in template
6847 !! wikitext
6848 {{echo|<div cla|ss="hiho">ha</div>}}
6849 !! html/parsoid
6850 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</p>
6851 !! end
6852
6853 !! test
6854 Don't break on | in extension attribute in template
6855 !! wikitext
6856 {{echo|<ref name="hi|ho">ha</ref>}}
6857
6858 <references />
6859 !! html/parsoid
6860 <p><sup about="#mwt2" class="mw-ref" id="cite_ref-hi|ho_1-0" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref name=\"hi|ho\">ha&lt;/ref>"}},"i":0}}]}'><a href="./Parser_test#cite_note-hi|ho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
6861
6862 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi|ho-1" id="cite_note-hi|ho-1"><a href="./Parser_test#cite_ref-hi|ho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi|ho-1" class="mw-reference-text">ha</span></li></ol>
6863 !! end
6864
6865 ## We don't support roundtripping of these attributes in Parsoid.
6866 ## Selective serialization takes care of preventing dirty diffs.
6867 ## But, on edits, we dirty-diff the invalid attribute text.
6868 !! test
6869 Invalid text in table attributes should be discarded
6870 !! options
6871 parsoid=wt2html
6872 !! wikitext
6873 {| <span>boo</span> style='border:1px solid black'
6874 | <span>boo</span> style='color:blue' |1
6875 |<span>boo</span> style='color:blue'|2
6876 |}
6877 !! html/php
6878 <table style="border:1px solid black">
6879 <tr>
6880 <td style="color:blue">1
6881 </td>
6882 <td style="color:blue">2
6883 </td></tr></table>
6884 !! html/parsoid
6885 <table style="border:1px solid black">
6886 <tr>
6887 <td style="color:blue">1</td>
6888 <td style="color:blue">2</td>
6889 </tr>
6890 </table>
6891 !! end
6892
6893 !! test
6894 Invalid text in table attributes should be preserved by selective serializer
6895 !! options
6896 parsoid={
6897 "modes": ["selser"],
6898 "changes": [
6899 ["td:first-child", "text", "abc"],
6900 ["td + td", "text", "xyz"]
6901 ]
6902 }
6903 !! wikitext
6904 {| <span>boo</span> style='border:1px solid black'
6905 | <span>boo</span> style='color:blue' | 1
6906 |<span>boo</span> style='color:blue'| 2
6907 |}
6908 !! wikitext/edited
6909 {| <span>boo</span> style='border:1px solid black'
6910 | <span>boo</span> style='color:blue' | abc
6911 |<span>boo</span> style='color:blue'| xyz
6912 |}
6913 !! end
6914
6915 !! test
6916 1. Template-generated table cell attributes and cell content
6917 !! wikitext
6918 {|
6919 |{{table_attribs}}
6920 | {{table_attribs}}
6921 || {{table_attribs_5}}
6922 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6923 |align=center {{table_attribs}}
6924 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6925 |}
6926 !! html
6927 <table>
6928 <tr>
6929 <td style="color:red;">Foo
6930 </td>
6931 <td style="color:red;">Foo
6932 </td>
6933 <td>style="color:red;"</td>
6934 <td>Bar
6935 </td>
6936 <td style="color:red;">Foo
6937 </td>
6938 <td align="center" style="color:red;">Foo
6939 </td>
6940 <td align="center" style="color:red;">Foo
6941 </td></tr></table>
6942 !! end
6943
6944 !! test
6945 2. Template-generated table cell attributes and cell content
6946 !! wikitext
6947 {|
6948 |{{table_attribs_2}}
6949 |}
6950 !! html/php
6951 <table>
6952 <tr>
6953 <td style="color:red;">Foo
6954 </td>
6955 <td>Bar</td>
6956 <td>Baz
6957 </td></tr></table>
6958 !! html/parsoid
6959 <table>
6960 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6961 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6962 </tbody></table>
6963 !! end
6964
6965 !! test
6966 3. Template-generated table cell attributes and cell content
6967 !! wikitext
6968 {|
6969 !align=center {{table_header_cells}}
6970 |-
6971 |align=center {{table_cells}}
6972 |}
6973 !! html/php
6974 <table>
6975 <tr>
6976 <th align="center" style="color:red;">Foo</th>
6977 <th style="color:red;"><i>Bar</i></th>
6978 <th style="color:brown;"><i>Foo</i> and Baz
6979 </th></tr>
6980 <tr>
6981 <td align="center" style="color:red;">Foo</td>
6982 <td style="color:red;"><i>Bar</i></td>
6983 <td style="color:brown;"><i>Foo</i> and Baz
6984 </td></tr></table>
6985 !! html/parsoid
6986 <table>
6987 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6988 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6989 </tbody></table>
6990 !! end
6991
6992 !! test
6993 4. Template-generated table cell attributes and cell content inside a templated table
6994 !! wikitext
6995 {{tbl-start}}
6996 !align=center {{table_header_cells}}
6997 |-
6998 |align=center {{table_cells}}
6999 {{tbl-end}}
7000 !! html/php
7001 <table>
7002 <tr>
7003 <th align="center" style="color:red;">Foo</th>
7004 <th style="color:red;"><i>Bar</i></th>
7005 <th style="color:brown;"><i>Foo</i> and Baz
7006 </th></tr>
7007 <tr>
7008 <td align="center" style="color:red;">Foo</td>
7009 <td style="color:red;"><i>Bar</i></td>
7010 <td style="color:brown;"><i>Foo</i> and Baz
7011 </td></tr></table>
7012 !! html/parsoid
7013 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
7014 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
7015 <tr>
7016 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
7017 </tbody></table>
7018 !! end
7019
7020 ## Edge case fix to prevent future regressions
7021 !! test
7022 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
7023 !! wikitext
7024 {|
7025 |{{table_attribs_7}}
7026 |}
7027 <references />
7028 !! html/parsoid
7029 <table>
7030 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<sup class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></s></td></tr>
7031 </tbody></table>
7032 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
7033 !! end
7034
7035 !! test
7036 Table with row followed by newlines and table heading
7037 !! options
7038 parsoid=wt2html,html2html
7039 !! wikitext
7040 {|
7041 |-
7042
7043 !foo
7044 |}
7045 !! html/*
7046 <table>
7047
7048
7049 <tr>
7050 <th>foo
7051 </th></tr></table>
7052 !! end
7053
7054 !! test
7055 Table with empty line following the start tag
7056 !! options
7057 parsoid=wt2html,html2html
7058 !! wikitext
7059 {|
7060
7061 |-
7062 |foo
7063 |}
7064 !! html/*
7065 <table>
7066
7067
7068 <tr>
7069 <td>foo
7070 </td></tr></table>
7071 !! end
7072
7073 !! test
7074 Table attributes with empty value
7075 !! options
7076 parsoid=wt2html,html2html
7077 !! wikitext
7078 {|
7079 | style=|hello
7080 |}
7081 !! html/php
7082 <table>
7083 <tr>
7084 <td style="">hello
7085 </td></tr></table>
7086 !! html/parsoid
7087 <table>
7088 <tbody><tr><td style="">hello</td></tr>
7089 </tbody></table>
7090 !! end
7091
7092 !! test
7093 Wikitext table with a lot of comments
7094 !! wikitext
7095 {|
7096 <!-- c0 -->
7097 |foo
7098 <!-- c1 -->
7099 |-<!-- c2 -->
7100 <!-- c3 -->
7101 |<!-- c4 -->
7102 <!-- c5 -->
7103 |}
7104 !! html
7105 <table>
7106 <tr>
7107 <td>foo
7108 </td></tr>
7109 <tr>
7110 <td>
7111 </td></tr></table>
7112 !! end
7113
7114 !! test
7115 Wikitext table comments represented in parsoid dom
7116 !! wikitext
7117 {|<!--c1--><!--c2-->
7118 |-<!--c3-->
7119 |x
7120 |}
7121 !! html/php+tidy
7122 <table>
7123
7124 <tbody><tr>
7125 <td>x
7126 </td></tr></tbody></table>
7127 !! html/parsoid
7128 <table><!--c1--><!--c2-->
7129 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
7130 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
7131 </tbody></table>
7132 !! end
7133
7134 !! test
7135 Wikitext table with double-line table cell
7136 !! wikitext
7137 {|
7138 |a
7139 b
7140 |}
7141 !! html
7142 <table>
7143 <tr>
7144 <td>a
7145 <p>b
7146 </p>
7147 </td></tr></table>
7148 !! end
7149
7150 !! test
7151 Table cell with a single comment
7152 !! wikitext
7153 {|
7154 |<!-- c1 -->
7155 |a
7156 |}
7157 !! html
7158 <table>
7159 <tr>
7160 <td>
7161 </td>
7162 <td>a
7163 </td></tr></table>
7164 !! end
7165
7166 !! test
7167 Table-cell after a comment-only-empty-line
7168 !! wikitext
7169 {|
7170 |a
7171 <!--c1-->
7172 <!--c2-->|b
7173 |}
7174 !! html
7175 <table>
7176 <tr>
7177 <td>a
7178 </td>
7179 <td>b
7180 </td></tr></table>
7181 !! html/parsoid
7182 <table>
7183 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7184 <!--c1-->
7185 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
7186 </tbody></table>
7187 !! end
7188
7189 !! test
7190 Build table with {{!}}
7191 !! wikitext
7192 {{{!}} class="wikitable"
7193 !header
7194 !second header
7195 {{!}}- style="color:red;"
7196 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
7197 {{!}}}
7198 !! html
7199 <table class="wikitable">
7200 <tr>
7201 <th>header
7202 </th>
7203 <th>second header
7204 </th></tr>
7205 <tr style="color:red;">
7206 <td>data</td>
7207 <td style="color:red;">second data
7208 </td></tr></table>
7209 !! end
7210
7211 !! test
7212 Build table with pipe as data
7213 !! wikitext
7214 {| class="wikitable"
7215 !header
7216 !second header
7217 |- style="color:red;"
7218 |data|| style="color:red;" |second data
7219 |-
7220 | style="color:red;" |data with | || style="color:red;" | second data with |
7221 |-
7222 ||data with | |||second data with |
7223 |}
7224 !! html
7225 <table class="wikitable">
7226 <tr>
7227 <th>header
7228 </th>
7229 <th>second header
7230 </th></tr>
7231 <tr style="color:red;">
7232 <td>data</td>
7233 <td style="color:red;">second data
7234 </td></tr>
7235 <tr>
7236 <td style="color:red;">data with |</td>
7237 <td style="color:red;">second data with |
7238 </td></tr>
7239 <tr>
7240 <td>data with |</td>
7241 <td>second data with |
7242 </td></tr></table>
7243 !! end
7244
7245 !! test
7246 Build table with wikilink
7247 !! wikitext
7248 {| class="wikitable"
7249 !header||second header
7250 |- style="color:red;"
7251 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
7252 |-
7253 |data||second data [[Main Page|link|text with pipe]]
7254 |}
7255 !! html
7256 <table class="wikitable">
7257 <tr>
7258 <th>header</th>
7259 <th>second header
7260 </th></tr>
7261 <tr style="color:red;">
7262 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
7263 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7264 </td></tr>
7265 <tr>
7266 <td>data</td>
7267 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7268 </td></tr></table>
7269 !! end
7270
7271 # The expected HTML structure in this test is debatable. The PHP parser does
7272 # not parse this kind of table at all. The main focus for Parsoid is on
7273 # round-tripping, so this output is ok for now. TODO: revisit!
7274 !! test
7275 Wikitext table with html-syntax row
7276 !! wikitext
7277 {|
7278 |-
7279 <td>foo</td>
7280 |}
7281 !! html/parsoid
7282 <table>
7283 <tbody>
7284 <tr>
7285 <td>foo</td></tr></tbody></table>
7286 !! end
7287
7288 ## Remex doesn't account for fostered content.
7289 !! test
7290 Fostered content in tables: Plain text
7291 !! options
7292 parsoid=wt2html
7293 !! wikitext
7294 {|
7295 |-
7296 a
7297 |}
7298 !! html/php
7299 <table>
7300
7301 a
7302 </table>
7303 !! html/php+tidy
7304
7305
7306 a
7307 <table></table>
7308 !! html/parsoid
7309 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
7310 a</p>
7311 <table>
7312 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr></tbody></table>
7313 !! end
7314
7315 !! test
7316 Fostered content in tables: Lists
7317 !! options
7318 parsoid=wt2html,html2html
7319 !! wikitext
7320 {|
7321 |-
7322 *a
7323 |}
7324 !! html/php
7325 <table>
7326
7327 <ul><li>a</li></ul>
7328 </table>
7329 !! html/php+tidy
7330 <ul><li>a</li></ul><table>
7331
7332
7333 </table>
7334 !! html/parsoid
7335 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7336 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7337
7338 </tr></tbody></table>
7339 !! end
7340
7341 !! test
7342 Template generated table cell with attributes
7343 !! wikitext
7344 {|
7345 |-
7346 {{table_attribs_4}} ||a||b
7347 |}
7348 !! html/php+tidy
7349 <table>
7350
7351 <tbody><tr>
7352 <td style="background-color:#DC241f;" width="10px"></td>
7353 <td>a</td>
7354 <td>b
7355 </td></tr></tbody></table>
7356 !! html/parsoid
7357 <table>
7358 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7359 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," ||a||b"]}'></td><td about="#mwt1">a</td><td about="#mwt1">b</td></tr>
7360 !! end
7361
7362 !! test
7363 Parsoid: Round-trip tables directly followed by content (T53219)
7364 !! options
7365 parsoid=wt2html,wt2wt
7366 !! wikitext
7367 {|
7368 |foo
7369 |} bar
7370
7371 {|
7372 |baz
7373 |}<b>quux</b>
7374 !! html+tidy
7375 <table>
7376 <tbody><tr>
7377 <td>foo
7378 </td></tr></tbody></table><p> bar
7379 </p><table>
7380 <tbody><tr>
7381 <td>baz
7382 </td></tr></tbody></table><p><b>quux</b></p>
7383 !! end
7384
7385 !! test
7386 Parsoid: Default to a newline after tables in new content (T53219)
7387 !! options
7388 parsoid=html2wt
7389 !! html/parsoid
7390 <table><tbody>
7391 <tr><td>foo</td></tr></tbody></table> bar
7392 <table><tbody>
7393 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7394 !! wikitext
7395 {|
7396 |foo
7397 |}
7398 <nowiki> </nowiki>bar
7399 {|
7400 |baz
7401 |}
7402 '''quux'''
7403 !! end
7404
7405 !! test
7406 Parsoid: Row-syntax table headings followed by comment & table cells
7407 !! options
7408 parsoid=wt2html,wt2wt
7409 !! wikitext
7410 {|
7411 !foo||bar
7412 <!-- foo --> ||baz||quux
7413 |}
7414 !! html/php
7415 <table>
7416 <tr>
7417 <th>foo</th>
7418 <th>bar
7419 </th>
7420 <td>baz</td>
7421 <td>quux
7422 </td></tr></table>
7423 !! html/parsoid
7424 <table>
7425 <tbody><tr><th>foo</th><th>bar
7426 <!-- foo --></th><td> baz </td><td>quux</td></tr>
7427 </tbody></table>
7428 !! end
7429
7430 !!test
7431 Parsoid: Recover better from broken table attributes
7432 !!options
7433 parsoid=wt2html
7434 !!wikitext
7435 {| class="foo
7436 | class="bar" |
7437 foo
7438 |}
7439 !!html/php+tidy
7440 <table class="foo">
7441 <tbody><tr>
7442 <td class="bar">
7443 <p>foo
7444 </p>
7445 </td></tr></tbody></table>
7446 !!html/parsoid
7447 <table class="foo">
7448 <tr>
7449 <td class="bar">
7450 <p>foo</p></td></tr>
7451 </tbody></table>
7452 !!end
7453
7454 # Note: PHP parser omits empty rows
7455 !! test
7456 Tables: Digest broken attributes on table and tr tag
7457 !! options
7458 parsoid=wt2html
7459 !! wikitext
7460 {| || |} ++
7461 |- || || ++ --
7462 |- > [
7463 |}
7464 !! html/php+tidy
7465 <table>
7466
7467
7468 </table>
7469 !! html/parsoid
7470 <table>
7471 <tbody>
7472 <tr class='mw-empty-elt'></tr>
7473 <tr class='mw-empty-elt'></tr>
7474 </tbody></table>
7475 !! end
7476
7477 !! test
7478 Table with missing opening <tr> tag
7479 !! options
7480 parsoid=wt2html,wt2wt
7481 !! wikitext
7482 <table>
7483 <td>foo</td>
7484 </tr>
7485 </table>
7486 !! html+tidy
7487 <table>
7488 <tbody><tr><td>foo</td>
7489 </tr>
7490 </tbody></table>
7491 !! end
7492
7493 # T137406: Whitespace in the HTML
7494 !! test
7495 1. Generate correct wikitext for tables with thead/tbody/tfoot
7496 !! options
7497 parsoid=html2wt
7498 !! html/parsoid
7499 <table>
7500 <caption>Test</caption>
7501 <thead>
7502 <tr>
7503 <th>Month</th>
7504 <th>Savings</th>
7505 </tr>
7506 </thead>
7507 <tbody>
7508 <tr>
7509 <td>January</td>
7510 <td>$100</td>
7511 </tr>
7512 <tr>
7513 <td>February</td>
7514 <td>$80</td>
7515 </tr>
7516 </tbody>
7517 <tfoot>
7518 <tr>
7519 <td>Sum</td>
7520 <td>$180</td>
7521 </tr>
7522 </tfoot>
7523 </table>
7524 !! wikitext
7525 {|
7526 |+Test
7527 !Month
7528 !Savings
7529 |-
7530 |January
7531 |$100
7532 |-
7533 |February
7534 |$80
7535 |-
7536 |Sum
7537 |$180
7538 |}
7539 !! html/php+tidy
7540 <table>
7541 <caption>Test
7542 </caption>
7543 <tbody><tr>
7544 <th>Month
7545 </th>
7546 <th>Savings
7547 </th></tr>
7548 <tr>
7549 <td>January
7550 </td>
7551 <td>$100
7552 </td></tr>
7553 <tr>
7554 <td>February
7555 </td>
7556 <td>$80
7557 </td></tr>
7558 <tr>
7559 <td>Sum
7560 </td>
7561 <td>$180
7562 </td></tr></tbody></table>
7563 !! end
7564
7565 # T137406: No whitespace in the HTML
7566 !! test
7567 2. Generate correct wikitext for tables with thead/tbody/tfoot
7568 !! options
7569 parsoid=html2wt
7570 !! html/parsoid
7571 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7572 !! wikitext
7573 {|
7574 !heading
7575 |-
7576 |foo
7577 |}
7578 !! end
7579
7580 !! test
7581 Wikitext tables can be nested inside HTML tables
7582 !! options
7583 parsoid=html2wt
7584 !! html/parsoid
7585 <table data-parsoid='{"stx":"html"}'>
7586 <tr><td>
7587 <table>
7588 <tr><td>foo</td></tr>
7589 </table>
7590 </td></tr>
7591 </table>
7592 !! wikitext
7593 <table>
7594 <tr><td>
7595 {|
7596 |foo
7597 |}
7598 </td></tr>
7599 </table>
7600 !! html/php+tidy
7601 <table>
7602 <tbody><tr><td>
7603 <table>
7604 <tbody><tr>
7605 <td>foo
7606 </td></tr></tbody></table>
7607 </td></tr>
7608 </tbody></table>
7609 !! end
7610
7611 ###
7612 ### Internal links
7613 ###
7614 !! test
7615 Plain link, capitalized
7616 !! wikitext
7617 [[Main Page]]
7618 !! html
7619 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7620 </p>
7621 !! end
7622
7623 !! test
7624 Plain link, uncapitalized
7625 !! wikitext
7626 [[main Page]]
7627 !! html
7628 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7629 </p>
7630 !! end
7631
7632 !! test
7633 Piped link
7634 !! wikitext
7635 [[Main Page|The Main Page]]
7636 !! html
7637 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7638 </p>
7639 !! end
7640
7641 !! test
7642 Piped link with comment in link text
7643 !! wikitext
7644 [[Main Page|The Main<!--front--> Page]]
7645 !! html
7646 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7647 </p>
7648 !! end
7649
7650 !! test
7651 Piped link with multiple pipe characters in link text
7652 !! wikitext
7653 [[Main Page||The|Main|Page|]]
7654 !! html/php
7655 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7656 </p>
7657 !! html/parsoid
7658 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7659 !! end
7660
7661 !! test
7662 Piped link with no link text
7663 !! wikitext
7664 [[Thomas Bek (bishop of St David's)|]]
7665 !! html/php
7666 <p>[[Thomas Bek (bishop of St David's)|]]
7667 </p>
7668 !! html/parsoid
7669 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7670 !! end
7671
7672 !! test
7673 Piped link with empty link text
7674 !! wikitext
7675 [[Main Page|<nowiki/>]] - empty nowiki
7676 [[Main Page| ]] - empty space
7677 [[Main Page|&nbsp;]] - empty non breaking space
7678 !! html/php
7679 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7680 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7681 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7682 </p>
7683 !! html/parsoid
7684 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7685 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7686 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></a> - empty non breaking space</p>
7687 !! end
7688
7689 !! test
7690 Broken link
7691 !! wikitext
7692 [[Zigzagzogzagzig]]
7693 !! html
7694 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7695 </p>
7696 !! end
7697
7698 !! test
7699 Broken link with fragment
7700 !! wikitext
7701 [[Zigzagzogzagzig#zug]]
7702 !! html
7703 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7704 </p>
7705 !! end
7706
7707 !! test
7708 Special page link with fragment
7709 !! wikitext
7710 [[Special:Version#anchor]]
7711 !! html
7712 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7713 </p>
7714 !! end
7715
7716 !! test
7717 Nonexistent special page link with fragment
7718 !! wikitext
7719 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7720 !! html
7721 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7722 </p>
7723 !! end
7724
7725 !! test
7726 Link with prefix
7727 !! wikitext
7728 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7729 !! html
7730 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7731 </p>
7732 !! end
7733
7734 !! test
7735 Link with suffix
7736 !! wikitext
7737 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7738 !! html
7739 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
7740 </p>
7741 !! end
7742
7743 !! article
7744 prefixed article
7745 !! text
7746 Some text
7747 !! endarticle
7748
7749 !! test
7750 T45661: Piped links with identical prefixes
7751 !! wikitext
7752 [[prefixed article|prefixed articles with spaces]]
7753
7754 [[prefixed article|prefixed articlesaoeu]]
7755
7756 [[Main Page|Main Page test]]
7757 !! html
7758 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7759 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7760 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7761 </p>
7762 !! end
7763
7764
7765 !! test
7766 Link with HTML entity in suffix / tail
7767 !! wikitext
7768 [[Main Page]]&quot;, [[Main Page]]&#97;
7769 !! html/php
7770 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
7771 </p>
7772 !! html/parsoid
7773 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
7774 !! end
7775
7776 !! test
7777 Link with 3 brackets
7778 !! wikitext
7779 [[[Main Page]]]
7780 Foo [[[Main Page]]]
7781 !! html
7782 <p>[[[Main Page]]]
7783 Foo [[[Main Page]]]
7784 </p>
7785 !! end
7786
7787 !! test
7788 Link with 4 brackets
7789 !! wikitext
7790 [[[[Main Page]]]]
7791 !! html
7792 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7793 </p>
7794 !! end
7795
7796 !! test
7797 Piped link with 3 brackets
7798 !! wikitext
7799 [[[main page|the main page]]]
7800 !! html
7801 <p>[[[main page|the main page]]]
7802 </p>
7803 !! end
7804
7805 !! test
7806 Piped link with extlink-like text
7807 !! wikitext
7808 [[Main Page|[bar]]]
7809 [[Main Page|This is a [bar]]]
7810 [[Main Page|[bar]]
7811 !! html/php
7812 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7813 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7814 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7815 </p>
7816 !! html/parsoid
7817 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7818 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7819 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7820 !! end
7821
7822 !! test
7823 Link with multiple pipes
7824 !! wikitext
7825 [[Main Page|The|Main|Page]]
7826 !! html
7827 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7828 </p>
7829 !! end
7830
7831 !! test
7832 Anchor containing a #. (T65430)
7833 !! config
7834 wgFragmentMode=[ 'html5', 'legacy' ]
7835 !! wikitext
7836 [[Main Page#And#Link]]
7837 !! html/php
7838 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7839 </p>
7840 !! html/parsoid
7841 <p><a rel="mw:WikiLink" href="./Main_Page#And#Link" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#And#Link"},"sa":{"href":"Main Page#And#Link"}}'>Main Page#And#Link</a></p>
7842 !! end
7843
7844 !! test
7845 Link to namespaces
7846 !! wikitext
7847 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7848 !! html
7849 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
7850 </p>
7851 !! end
7852
7853 !! test
7854 Link with space in namespace
7855 !! wikitext
7856 [[User talk:Foo bar]]
7857 !! html
7858 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
7859 </p>
7860 !! end
7861
7862 !! article
7863 MemoryAlpha:AlphaTest
7864 !! text
7865 This is an article in the MemoryAlpha namespace
7866 (which shadows the memoryalpha interwiki link).
7867 !! endarticle
7868
7869 !! test
7870 Namespace takes precedence over interwiki link (T53680)
7871 !! wikitext
7872 [[MemoryAlpha:AlphaTest]]
7873 !! html
7874 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7875 </p>
7876 !! end
7877
7878 # The previous test doesn't work correctly in html2*, due to not recognizing the
7879 # link as an internal one. This one checks for the correct behavior.
7880 !! test
7881 Link to namespace preferred over interwiki with correct rel attribute
7882 !! options
7883 parsoid=html2wt,html2html
7884 !! html/parsoid
7885 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7886 !! wikitext
7887 [[MemoryAlpha:AlphaTest]]
7888 !! end
7889
7890 !! test
7891 Piped link to namespace
7892 !! wikitext
7893 [[Meta:Disclaimers|The disclaimers]]
7894 !! html
7895 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
7896 </p>
7897 !! end
7898
7899 !! test
7900 Link containing }
7901 !! wikitext
7902 [[Usually caused by a typo (oops}]]
7903 !! html
7904 <p>[[Usually caused by a typo (oops}]]
7905 </p>
7906 !! end
7907
7908 !! article
7909 7% Solution
7910 !! text
7911 Just a test of an article title containing a percent.
7912 !! endarticle
7913
7914 !! test
7915 Link containing % (not as a hex sequence)
7916 !! wikitext
7917 [[7% Solution]]
7918 [[7% Solution|7%25 Solution]]
7919 !! html/php
7920 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7921 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7922 </p>
7923 !! html/parsoid
7924 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7925 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7926 !! end
7927
7928 # note that the parsoid HTML is identical to the previous test output,
7929 # so the previous test ensures that the html2wt mode will generate the
7930 # "not as a hex sequence" wikitext.
7931 !! test
7932 Link containing % as a single hex sequence interpreted to char
7933 !! options
7934 parsoid=wt2wt,wt2html,html2html
7935 !! wikitext
7936 [[7%25 Solution]]
7937 [[7%25 Solution|7%25 Solution]]
7938 !! html/php
7939 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7940 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7941 </p>
7942 !! html/parsoid
7943 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7944 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7945 !!end
7946
7947 !! test
7948 Link containing % as a double hex sequence interpreted to hex sequence
7949 !! wikitext
7950 [[7%2525 Solution]]
7951 !! html
7952 <p>[[7%2525 Solution]]
7953 </p>
7954 !!end
7955
7956 ## Example for such a section: == < ==
7957 !! test
7958 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7959 !! options
7960 title=[[Main Page]]
7961 !! config
7962 wgFragmentMode=[ 'html5', 'legacy' ]
7963 !! wikitext
7964 [[%23%3c]][[%23%3e]]
7965 !! html/php
7966 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
7967 </p>
7968 !! html/parsoid
7969 <p><a rel="mw:WikiLink" href="./Main_Page#&lt;" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#&lt;"},"sa":{"href":"%23%3c"}}'>#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#>" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#>"},"sa":{"href":"%23%3e"}}'>#></a></p>
7970 !! end
7971
7972 ## Example for such a section: == < ==
7973 !! test
7974 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
7975 !! config
7976 wgFragmentMode=[ 'legacy' ]
7977 !! wikitext
7978 [[%23%3c]][[%23%3e]]
7979 !! html/php
7980 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7981 </p>
7982 !! end
7983
7984 !! test
7985 Link containing "<#" and ">#" as a hex sequences
7986 !! wikitext
7987 [[%3c%23]][[%3e%23]]
7988 !! html
7989 <p>[[%3c%23]][[%3e%23]]
7990 </p>
7991 !! end
7992
7993 !! test
7994 Link containing an equals sign
7995 !! wikitext
7996 [[Special:BookSources/isbn=4-00-026157-6]]
7997 !! html/php
7998 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
7999 </p>
8000 !! html/parsoid
8001 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
8002 !! end
8003
8004 !! article
8005 Foo & bar
8006 !! text
8007 Just a test of an article title containing an ampersand
8008 !! endarticle
8009
8010 !! test
8011 Link containing an ampersand
8012 !! wikitext
8013 [[Foo & bar]]
8014
8015 [[Foo &amp; bar]]
8016
8017 [[Foo &amp;amp; bar]]
8018 !! html/php+tidy
8019 <p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar">Foo &amp; bar</a>
8020 </p><p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar">Foo &amp; bar</a>
8021 </p><p>[[Foo &amp;amp; bar]]
8022 </p>
8023 !! html/parsoid
8024 <p><a rel="mw:WikiLink" href="./Foo_&amp;_bar" title="Foo &amp; bar">Foo &amp; bar</a></p>
8025 <p><a rel="mw:WikiLink" href="./Foo_&amp;_bar" title="Foo &amp; bar" data-parsoid='{"stx":"simple","a":{"href":"./Foo_&amp;_bar"},"sa":{"href":"Foo &amp;amp; bar"}}'>Foo &amp; bar</a></p>
8026 <p>[[Foo <span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>amp; bar]]</p>
8027 !! end
8028
8029 !! article
8030 Foo~bar
8031 !! text
8032 Just a test of an article title containing a tilde.
8033 !! endarticle
8034
8035 # note that links containing signatures, like [[Foo~~~~]], are
8036 # massaged by the pre-save transform (PST) and so the tildes are never
8037 # seen by the parser.
8038 !! test
8039 Link containing a tilde
8040 !! wikitext
8041 [[Foo~bar]]
8042 !! html/php
8043 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
8044 </p>
8045 !! html/parsoid
8046 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
8047 !! end
8048
8049 !! test
8050 Link containing double-single-quotes '' (T6598)
8051 !! wikitext
8052 [[Lista d''e paise d''o munno]]
8053 !! html/php
8054 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d&#39;&#39;e paise d&#39;&#39;o munno (page does not exist)">Lista d''e paise d''o munno</a>
8055 </p>
8056 !! html/parsoid
8057 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
8058 !! end
8059
8060 !! test
8061 Link containing double quotes and spaces
8062 !! wikitext
8063 [[Cool "Gator"]]
8064 !! html/php
8065 <p><a href="/index.php?title=Cool_%22Gator%22&amp;action=edit&amp;redlink=1" class="new" title="Cool &quot;Gator&quot; (page does not exist)">Cool "Gator"</a>
8066 </p>
8067 !! html/parsoid
8068 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
8069 !! end
8070
8071 !! test
8072 File containing double quotes and spaces
8073 !! wikitext
8074 [[File:Cool "Gator".png]]
8075 !! html/php+tidy
8076 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Cool_%22Gator%22.png" class="new" title="File:Cool &quot;Gator&quot;.png">File:Cool &quot;Gator&quot;.png</a>
8077 </p>
8078 !! html/parsoid
8079 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Cool_%22Gator%22.png"><span resource='./File:Cool_"Gator".png' data-parsoid='{"a":{"resource":"./File:Cool_\"Gator\".png"},"sa":{"resource":"File:Cool \"Gator\".png"}}'>File:Cool "Gator".png</span></a></figure-inline></p>
8080 !! end
8081
8082 !! test
8083 Redirect containing double quotes and spaces
8084 !! wikitext
8085 #REDIRECT [[Cool "Gator"]]
8086 !! html/parsoid
8087 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
8088 !! end
8089
8090 !! test
8091 Link containing double-single-quotes '' in text (T6598 sanity check)
8092 !! wikitext
8093 Some [[Link|pretty ''italics'' and stuff]]!
8094 !! html/php
8095 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
8096 </p>
8097 !! html/parsoid
8098 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8099 !! end
8100
8101 !! test
8102 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8103 !! wikitext
8104 ''Some [[Link|pretty ''italics'' and stuff]]!''
8105 !! html
8106 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
8107 </p>
8108 !! end
8109
8110 ## FIXME: Title part of filename is interpreted in php
8111 !! test
8112 Link with double quotes in title part (literal) and alternate part (interpreted)
8113 !! wikitext
8114 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8115
8116 [[''Pentecoste'']]
8117
8118 [[''Pentecoste''|Pentecoste]]
8119
8120 [[''Pentecoste''|''Pentecoste'']]
8121 !! html/php
8122 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
8123 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)">''Pentecoste''</a>
8124 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)">Pentecoste</a>
8125 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)"><i>Pentecoste</i></a>
8126 </p>
8127 !! html/parsoid
8128 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg"><span resource="./File:Denys_Savchenko_''Pentecoste''.jpg" data-parsoid='{"a":{"resource":"./File:Denys_Savchenko_&apos;&apos;Pentecoste&apos;&apos;.jpg"},"sa":{"resource":"File:Denys_Savchenko_&apos;&apos;Pentecoste&apos;&apos;.jpg"}}'>File:Denys Savchenko ''Pentecoste''.jpg</span></a></figure-inline></p>
8129 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8130 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8131 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8132 !! end
8133
8134 !! test
8135 Broken image links with HTML captions (T41700)
8136 !! wikitext
8137 [[File:Nonexistent|<script></script>]]
8138 [[File:Nonexistent|100x100px|<script></script>]]
8139 [[File:Nonexistent|&lt;]]
8140 [[File:Nonexistent|a<i>b</i>c]]
8141 !! html/php
8142 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8143 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8144 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8145 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8146 </p>
8147 !! html/parsoid
8148 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"caption":"&amp;lt;script>&amp;lt;/script>","errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent"><span resource="./File:Nonexistent" data-parsoid='{"a":{"resource":"./File:Nonexistent"},"sa":{"resource":"File:Nonexistent"}}'>File:Nonexistent</span></a></figure-inline>
8149 <figure-inline typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"caption":"&amp;lt;script>&amp;lt;/script>","errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent"><span resource="./File:Nonexistent" data-width="100" data-height="100" data-parsoid='{"a":{"resource":"./File:Nonexistent"},"sa":{"resource":"File:Nonexistent"}}'>File:Nonexistent</span></a></figure-inline>
8150 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&apos;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&apos;>&amp;lt;&lt;/span>","errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent"><span resource="./File:Nonexistent" data-parsoid='{"a":{"resource":"./File:Nonexistent"},"sa":{"resource":"File:Nonexistent"}}'>File:Nonexistent</span></a></figure-inline>
8151 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"caption":"a&lt;i data-parsoid=&apos;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&apos;>b&lt;/i>c","errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent"><span resource="./File:Nonexistent" data-parsoid='{"a":{"resource":"./File:Nonexistent"},"sa":{"resource":"File:Nonexistent"}}'>File:Nonexistent</span></a></figure-inline></p>
8152 !! end
8153
8154 !! test
8155 Plain link to URL
8156 !! wikitext
8157 [[http://www.example.com]]
8158 !! html/php
8159 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8160 </p>
8161 !! html/parsoid
8162 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
8163 !! end
8164
8165 !! test
8166 Plain link to URL with link text
8167 !! wikitext
8168 [[http://www.example.com Link text]]
8169 !! html
8170 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8171 </p>
8172 !! end
8173
8174 !! test
8175 Plain link to URL containing special characters, with link text (see T213950).
8176 !! wikitext
8177 [[http://www.example.com/?q=%7Babc%7D Link text]]
8178 !! html
8179 <p>[<a rel="nofollow" class="external text" href="http://www.example.com/?q=%7Babc%7D">Link text</a>]
8180 </p>
8181 !! end
8182
8183 !! test
8184 Plain link to protocol-relative URL
8185 !! wikitext
8186 [[//www.example.com]]
8187 !! html/php
8188 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8189 </p>
8190 !! html/parsoid
8191 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8192 !! end
8193
8194 !! test
8195 Plain link to protocol-relative URL with link text
8196 !! wikitext
8197 [[//www.example.com Link text]]
8198 !! html
8199 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8200 </p>
8201 !! end
8202
8203 !! test
8204 Plain link to page with question mark in title
8205 !! wikitext
8206 [[A?b]]
8207
8208 [[A?b|Baz]]
8209 !! html
8210 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8211 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8212 </p>
8213 !! end
8214
8215 # I'm fairly sure the expected result here is wrong.
8216 # We want these to be URL links, not pseudo-pages with URLs for titles....
8217 # However the current output is also pretty screwy.
8218 #
8219 # ----
8220 # I'm changing it to match the current output--it arguably makes more
8221 # sense in the light of the test above. Old expected result was:
8222 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8223 #</p>
8224 # But I think this test is bordering on "garbage in, garbage out" anyway.
8225 # -- wtm
8226 !! test
8227 Piped link to URL
8228 !! wikitext
8229 Piped link to URL: [[http://www.example.com|an example URL]]
8230 !! html/php
8231 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8232 </p>
8233 !! html/parsoid
8234 <p>Piped link to URL: [<a rel="mw:ExtLink" class="external text" href="http://www.example.com%7Can" data-parsoid='{"a":{"href":"http://www.example.com%7Can"},"sa":{"href":"http://www.example.com|an"}}'>example URL</a>]</p>
8235 !! end
8236
8237 !! test
8238 Plain link in template argument
8239 !! options
8240 parsoid=wt2html
8241 !! wikitext
8242 {{echo|[http://www.example.com |123]}}
8243
8244 {{echo|[[http://www.example.com |123]]}}
8245
8246 {{echo|[[http://www.example.com |123]}}
8247
8248 {{echo|[http://www.example.com |123]]}}
8249 !! html/php
8250 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8251 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8252 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8253 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8254 </p>
8255 !! html/parsoid
8256 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://www.example.com">http://www.example.com</a> </p>
8257
8258 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[http://www.example.com |123]]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external text" href="http://www.example.com">|123</a>]</p>
8259
8260 <p>{{echo|[<a rel="mw:ExtLink" class="external text" href="http://www.example.com" data-parsoid='{"targetOff":114,"contentOffsets":[114,118],"dsr":[90,119,24,1]}'>|123</a>}}</p>
8261
8262 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://www.example.com">http://www.example.com</a> </p>
8263 !! end
8264
8265 !! test
8266 T2002: [[page|http://url/]] should link to page, not http://url/
8267 !! wikitext
8268 [[Main Page|http://url/]]
8269 !! html/php
8270 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8271 </p>
8272 !! html/parsoid
8273 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8274 !! end
8275
8276 # Parsoid does not mark self-links, by design.
8277 !! test
8278 T2337: Escaped self-links should be bold
8279 !! options
8280 title=[[Bug462]]
8281 !! wikitext
8282 [[Bu&#103;462]] [[Bug462]]
8283 !! html/php+tidy
8284 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8285 </p>
8286 !! html/parsoid
8287 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8288 !! end
8289
8290 !! test
8291 Self-link to section should not be bold
8292 !! options
8293 title=[[Main Page]]
8294 !! wikitext
8295 [[Main Page#section]]
8296 !! html
8297 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8298 </p>
8299 !! end
8300
8301 !! article
8302 00
8303 !! text
8304 This is 00.
8305 !! endarticle
8306
8307 !!test
8308 Self-link to numeric title
8309 !!options
8310 title=[[0]]
8311 !! wikitext
8312 [[0]]
8313 !! html
8314 <p><a class="mw-selflink selflink">0</a>
8315 </p>
8316 !!end
8317
8318 !!test
8319 Link to numeric-equivalent title
8320 !!options
8321 title=[[0]]
8322 !! wikitext
8323 [[00]]
8324 !! html
8325 <p><a href="/wiki/00" title="00">00</a>
8326 </p>
8327 !!end
8328
8329 !! test
8330 <nowiki> inside a link
8331 !! wikitext
8332 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8333 !! html/php+tidy
8334 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8335 </p>
8336 !! html/parsoid
8337 <p>[[Main<span typeof="mw:Nowiki"> Page</span>]] <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">the main page <span typeof="mw:Nowiki">[it's not very good]</span></a></p>
8338 !! end
8339
8340 ## Parsoid doesn't get this right and even fails wt2html because, when doing the
8341 ## normalization for comparison, the html serialization / re-parse doesn't
8342 ## roundtrip. This is T49963
8343 !! test
8344 <pre> inside a link
8345 !! wikitext
8346 [[Main<pre> Page</pre>]] [[Main Page|the main page <pre>[it's not very good]</pre>]]
8347 !! html/php+tidy
8348 <p>[[Main</p><pre> Page</pre><p>]] <a href="/wiki/Main_Page" title="Main Page">the main page </a></p><a href="/wiki/Main_Page" title="Main Page"><pre>[it's not very good]</pre></a>
8349 !! html/parsoid
8350 <p>[[Main</p><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":" Page"}}'> Page</pre><p>]] <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">the main page <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"[it&apos;s not very good]"}}'>[it's not very good]</pre></a></p>
8351 !! end
8352
8353 !! test
8354 Non-breaking spaces in title
8355 !! wikitext
8356 [[&nbsp; Main &nbsp; Page &nbsp;]]
8357 !! html
8358 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8359 </p>
8360 !!end
8361
8362 # Add new article for the test below so that it doesn't red-link
8363 !! article
8364 Foo bar baz
8365 !! text
8366 boo
8367 !! endarticle
8368
8369 !! test
8370 Multiple spaces in titles should normalize to a single underscore
8371 !! options
8372 parsoid=wt2html,wt2wt
8373 !! wikitext
8374 [[Foo bar baz|x]]
8375 [[Foo bar baz|x]]
8376 [[Foo bar baz|x]]
8377 !! html/php
8378 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8379 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8380 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8381 </p>
8382 !! html/parsoid
8383 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8384 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8385 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8386 </p>
8387 !! end
8388
8389 !! test
8390 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8391 !! options
8392 language=ca
8393 !! wikitext
8394 '''[[Main Page]]'''
8395 !! html
8396 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8397 </p>
8398 !! end
8399
8400 !! test
8401 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8402 !! options
8403 language=ca
8404 !! wikitext
8405 ''[[Main Page]]''
8406 !! html
8407 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8408 </p>
8409 !! end
8410
8411 !! test
8412 Internal link with en linktrail: no apostrophes (T29473)
8413 !! options
8414 language=en
8415 !! wikitext
8416 [[Something]]'nice
8417 !! html
8418 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8419 </p>
8420 !! end
8421
8422 !! test
8423 Internal link with ca linktrail with apostrophes (T29473)
8424 !! options
8425 language=ca
8426 !! wikitext
8427 [[Something]]'nice
8428 !! html
8429 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8430 </p>
8431 !! end
8432
8433 !! test
8434 Internal link with kaa linktrail with apostrophes (T29473)
8435 !! options
8436 language=kaa
8437 !! wikitext
8438 [[Something]]'nice
8439 !! html
8440 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag&#39;an)">Something'nice</a>
8441 </p>
8442 !! end
8443
8444 !! test
8445 Link with multiple ":" in a subpage-supporting namespace (T65636)
8446 !! wikitext
8447 [[User:Foo/Test/63636:Bar|Test]]
8448 !! html/php
8449 <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
8450 </p>
8451 !! html/parsoid
8452 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8453 !! end
8454
8455 ## Mainly a sanity check for Parsoid
8456 !! test
8457 Handle title parsing for subpages
8458 !! options
8459 title=[[/123123]]
8460 subpage
8461 !! wikitext
8462 123
8463 !! html/php
8464 <p>123
8465 </p>
8466 !! html/parsoid
8467 <p>123</p>
8468 !! end
8469
8470 !! article
8471 User:Test/123
8472 !! text
8473 test 123
8474 !! endarticle
8475
8476 !! test
8477 Link to a subpage from a namespace other than main
8478 !! options
8479 title=[[User:Test]]
8480 subpage
8481 !! wikitext
8482 [[/123]]
8483 !! html/php
8484 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8485 </p>
8486 !! html/parsoid
8487 <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
8488 !! end
8489
8490 !! test
8491 Ensure that transclusion titles are not url-decoded
8492 !! options
8493 subpage title=[[Test]]
8494 parsoid=wt2html
8495 !! wikitext
8496 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8497 !! html/php
8498 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8499 </p>
8500 !! html/parsoid
8501 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8502 !! end
8503
8504 !! test
8505 Purely hash wikilink
8506 !! options
8507 title=[[User:Test/123]]
8508 subpage
8509 !! wikitext
8510 [[#a|b]]
8511 !! html/php
8512 <p><a href="#a">b</a>
8513 </p>
8514 !! html/parsoid
8515 <p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
8516 !! end
8517
8518 !! test
8519 Serialization of purely hash wikilink
8520 !! options
8521 title=[[User:Test/123]]
8522 subpage
8523 parsoid=html2wt
8524 !! html/parsoid
8525 <p><a href="#a">[[</a></p>
8526 !! wikitext
8527 [[#a|<nowiki>[[</nowiki>]]
8528 !! html/php
8529 <p><a href="#a">[[</a>
8530 </p>
8531 !! end
8532
8533 !! test
8534 1. Interaction of linktrail and template encapsulation
8535 !! wikitext
8536 {{echo|[[Foo]]}}l
8537 !! html/php+tidy
8538 <p><a href="/wiki/Foo" title="Foo">Fool</a>
8539 </p>
8540 !! html/parsoid
8541 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
8542 !! end
8543
8544 !! test
8545 2. Interaction of linktrail and template encapsulation
8546 !! wikitext
8547 {{echo|Some [[Fool]]}}s
8548 !! html/php+tidy
8549 <p>Some <a href="/index.php?title=Fool&amp;action=edit&amp;redlink=1" class="new" title="Fool (page does not exist)">Fools</a>
8550 </p>
8551 !! html/parsoid
8552 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
8553 !! end
8554
8555 !! test
8556 3. Interaction of linktrail and template encapsulation
8557 !! wikitext
8558 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8559 !! html/php+tidy
8560 <p>Some <a href="/index.php?title=Fool&amp;action=edit&amp;redlink=1" class="new" title="Fool (page does not exist)">Fools</a> are <b>bold and foolish</b>
8561 </p>
8562 !! html/parsoid
8563 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
8564 !! end
8565
8566 !! article
8567 Söfnuður
8568 !! text
8569 Test.
8570 !! endarticle
8571
8572 !! test
8573 Internal link with is link prefix
8574 !! options
8575 language=is
8576 !! wikitext
8577 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8578 !! html
8579 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8580 </p>
8581 !! end
8582
8583 !! article
8584 Mótmælendatrú
8585 !! text
8586 Test.
8587 !! endarticle
8588
8589 !! test
8590 Internal link with is link trail and link prefix
8591 !! options
8592 language=is
8593 !! wikitext
8594 [[mótmælendatrú|xxx]]ar
8595 [[mótmælendatrú]]ar
8596 mótmælenda[[söfnuður]]
8597 mótmælenda[[söfnuður|söfnuðir]]
8598 mótmælenda[[söfnuður|söfnuðir]]xxx
8599 !! html
8600 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8601 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8602 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8603 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8604 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8605 </p>
8606 !! end
8607
8608 !! test
8609 Parsoid link trail escaping
8610 !! options
8611 parsoid=html2wt,html2html
8612 !! html/parsoid
8613 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8614 !! wikitext
8615 [[apple]]<nowiki/>s
8616 !! end
8617
8618 !! test
8619 Parsoid link prefix escaping
8620 !! options
8621 language=is
8622 parsoid=html2wt,html2html
8623 !! html/parsoid
8624 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8625 !! wikitext
8626 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8627 !! end
8628
8629 !! test
8630 Parsoid link bracket escaping
8631 !! options
8632 parsoid=html2wt,html2html
8633 !! html/parsoid
8634 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8635 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8636 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8637 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8638 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8639 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8640 !! wikitext
8641 [[Test]]
8642
8643 [<nowiki/>[[Test]]]
8644
8645 [[[[Test]]]]
8646
8647 [[[<nowiki/>[[Test]]]]]
8648
8649 [[[[[[Test]]]]]]
8650
8651 [[[[[<nowiki/>[[Test]]]]]]]
8652 !! end
8653
8654 !! test
8655 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8656 !! wikitext
8657 [[Foo| bar]]
8658
8659 [[Foo| ''bar'']]
8660
8661 [http://wp.org foo]
8662
8663 [http://wp.org ''foo'']
8664 !! html
8665 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8666 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8667 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8668 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8669 </p>
8670 !! end
8671
8672 !! test
8673 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8674 !! wikitext
8675 [[Foo|{{echo|a}} b {{echo|c}}]]
8676 !! html/parsoid
8677 <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
8678 !! end
8679
8680 !! test
8681 Link with angle bracket after anchor
8682 !! config
8683 wgFragmentMode=[ 'html5', 'legacy' ]
8684 !! wikitext
8685 [[Foo#<bar>]]
8686 !! html/php
8687 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8688 </p>
8689 !! html/parsoid
8690 <p><a rel="mw:WikiLink" href="./Foo#&lt;bar>" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#&lt;bar>"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
8691 !! end
8692
8693 !! test
8694 Link with angle bracket after anchor (legacy)
8695 !! config
8696 wgFragmentMode=[ 'legacy' ]
8697 !! wikitext
8698 [[Foo#<bar>]]
8699 !! html/php
8700 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8701 </p>
8702 !! end
8703
8704 ###
8705 ### Interwiki links (see maintenance/interwiki.sql)
8706 ###
8707
8708 !! test
8709 Inline interwiki link
8710 !! options
8711 parsoid=wt2html,wt2wt,html2html
8712 !! wikitext
8713 [[MeatBall:SoftSecurity]]
8714 !! html/php
8715 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8716 </p>
8717 !! html/parsoid
8718 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8719 !! end
8720
8721 !! test
8722 Inline interwiki link with empty title (T4372)
8723 !! options
8724 parsoid=wt2html,wt2wt,html2html
8725 !! wikitext
8726 [[MeatBall:]]
8727 !! html/php
8728 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8729 </p>
8730 !! html/parsoid
8731 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8732 !! end
8733
8734 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8735 !! test
8736 Interwiki link encoding conversion (T3636)
8737 !! options
8738 parsoid=wt2html,wt2wt
8739 !! wikitext
8740 *[[Wikipedia:ro:Olteni&#0355;a]]
8741 *[[Wikipedia:ro:Olteni&#355;a]]
8742 !! html/php
8743 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
8744 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
8745 !! html/php+tidy
8746 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
8747 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
8748 !! html/parsoid
8749 <ul>
8750 <li><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8751 <li><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8752 </ul>
8753 !! end
8754
8755 !! test
8756 Interwiki link with fragment (T4130)
8757 !! wikitext
8758 [[MeatBall:SoftSecurity#foo]]
8759 !! html
8760 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8761 </p>
8762 !! end
8763
8764 ## The interwiki case here continued to be legacy escaped because of the
8765 ## default setting of $wgExternalInterwikiFragmentMode
8766 !! test
8767 Link scenarios with escaped fragments
8768 !! options
8769 title=[[Main Page]]
8770 !! config
8771 wgFragmentMode=[ 'html5', 'legacy' ]
8772 !! wikitext
8773 [[#Is this great?]]
8774 [[Foo#Is this great?]]
8775 [[meatball:Foo#Is this great?]]
8776 !! html/php
8777 <p><a href="#Is_this_great?">#Is this great?</a>
8778 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8779 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8780 </p>
8781 !! html/parsoid
8782 <p><a rel="mw:WikiLink" href="./Main_Page#Is_this_great?" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Is_this_great?"},"sa":{"href":"#Is this great?"}}'>#Is this great?</a>
8783 <a rel="mw:WikiLink" href="./Foo#Is_this_great?" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#Is_this_great?"},"sa":{"href":"Foo#Is this great?"}}'>Foo#Is this great?</a>
8784 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" title="meatball:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F"},"sa":{"href":"meatball:Foo#Is this great?"},"isIW":true}'>meatball:Foo#Is this great?</a></p>
8785 !! end
8786
8787 !! test
8788 Link scenarios with escaped fragments (legacy)
8789 !! config
8790 wgFragmentMode=[ 'legacy' ]
8791 !! wikitext
8792 [[#Is this great?]]
8793 [[Foo#Is this great?]]
8794 [[meatball:Foo#Is this great?]]
8795 !! html/php
8796 <p><a href="#Is_this_great.3F">#Is this great?</a>
8797 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8798 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8799 </p>
8800 !! end
8801
8802 # Ideally the wikipedia: prefix here should be proto-relative too
8803 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8804 # define the 'en' prefix, and originally the test used 'wikipedia',
8805 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8806 # article.
8807 !! test
8808 Different interwiki prefixes mapping to the same URL
8809 !! wikitext
8810 [[:en:Foo]]
8811
8812 [[:en:Foo|Foo]]
8813
8814 [[wikipedia:Foo]]
8815
8816 [[:wikipedia:Foo|Foo]]
8817
8818 [[wikipedia:en:Foo]]
8819
8820 [[:wikipedia:en:Foo]]
8821
8822 [[ wikiPEdia :Foo]]
8823 !! html/parsoid
8824 <p><a rel="mw:WikiLink/Interwiki" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
8825
8826 <p><a rel="mw:WikiLink/Interwiki" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
8827
8828 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
8829
8830 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
8831
8832 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8833
8834 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8835
8836 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
8837 !! end
8838
8839 !! test
8840 Interwiki links that cannot be represented in wiki syntax
8841 !! wikitext
8842 [[meatball:ok]]
8843 [[meatball:ok#foo|ok with fragment]]
8844 [[meatball:ok_as_well?|ok ending with ? mark]]
8845 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8846 [http://de.wikipedia.org/wiki/#foo is just fragment]
8847
8848 !! html/php
8849 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8850 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8851 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
8852 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8853 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8854 </p>
8855 !! html/parsoid
8856 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8857 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8858 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" title="meatball:ok as well?">ok ending with ? mark</a>
8859 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8860 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8861 !! end
8862
8863 !! test
8864 Interwiki links: trail
8865 !! wikitext
8866 [[wikipedia:Foo|Ba]]r
8867 !! html/php
8868 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8869 </p>
8870 !! html/parsoid
8871 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
8872 !! end
8873
8874 !! test
8875 Local interwiki link
8876 !! options
8877 parsoid=wt2html,wt2wt,html2html
8878 !! wikitext
8879 [[local:Template:Foo]]
8880 !! html/php
8881 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8882 </p>
8883 !! html/parsoid
8884 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8885 !! end
8886
8887 # Parsoid does not mark self-links, by design.
8888 !! test
8889 Local interwiki link: self-link to current page
8890 !! options
8891 title=[[Main Page]]
8892 parsoid=wt2html,wt2wt,html2html
8893 !! wikitext
8894 [[local:Main Page]]
8895 !! html/php
8896 <p><a class="mw-selflink selflink">local:Main Page</a>
8897 </p>
8898 !! html/parsoid
8899 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8900 !! end
8901
8902 !! test
8903 Local interwiki link: prefix only (T66167)
8904 !! options
8905 parsoid=wt2html,wt2wt,html2html
8906 !! wikitext
8907 [[local:]]
8908 !! html/php
8909 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8910 </p>
8911 !! html/parsoid
8912 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8913 !! end
8914
8915 !! test
8916 Local interwiki link: with additional interwiki prefix (T63357)
8917 !! options
8918 parsoid=wt2html,wt2wt,html2html
8919 !! wikitext
8920 [[local:meatball:Hello]]
8921 !! html/php
8922 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8923 </p>
8924 !! html/parsoid
8925 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8926 !! end
8927
8928 !! test
8929 Multiple local interwiki link prefixes
8930 !! wikitext
8931 [[local:local:local:local:mi:local:Foo]]
8932 !! options
8933 parsoid=wt2html,wt2wt,html2html
8934 !! html/php
8935 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8936 </p>
8937 !! html/parsoid
8938 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8939 !! end
8940
8941 !! test
8942 Interwiki link with percent encoded target
8943 !! wikitext
8944 [[:es:Nueva Guip%C3%BAzcoa|Nueva Guipúzcoa]]
8945 !! html/php
8946 <p><a href="http://es.wikipedia.org/wiki/Nueva_Guip%C3%BAzcoa" class="extiw" title="es:Nueva Guipúzcoa">Nueva Guipúzcoa</a>
8947 </p>
8948 !! html/parsoid
8949 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Nueva%20Guipúzcoa" title="es:Nueva Guipúzcoa" data-parsoid='{"stx":"piped","a":{"href":"http://es.wikipedia.org/wiki/Nueva%20Guipúzcoa"},"sa":{"href":":es:Nueva Guip%C3%BAzcoa"},"isIW":true}'>Nueva Guipúzcoa</a></p>
8950 !! end
8951
8952 ###
8953 ### Interlanguage links
8954 ### Language links (so that searching for '### language' matches..)
8955 ###
8956
8957 !! test
8958 Interlanguage link
8959 !! wikitext
8960 Blah blah blah
8961 [[zh:Chinese]]
8962 !! html/php
8963 <p>Blah blah blah
8964 </p>
8965 !! html/parsoid
8966 <p>Blah blah blah</p>
8967 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8968 !! end
8969
8970 ## parsoid html2wt will lose the space variations
8971 !! test
8972 Interlanguage link with spacing
8973 !! options
8974 parsoid=wt2html,wt2wt,html2html
8975 !! wikitext
8976 Blah blah blah
8977 [[ zh : Chinese ]]
8978 !! html/php
8979 <p>Blah blah blah
8980 </p>
8981 !! html/parsoid
8982 <p>Blah blah blah</p>
8983 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8984 !! end
8985
8986 !! test
8987 Double interlanguage link
8988 !! wikitext
8989 Blah blah blah
8990 [[es:Spanish]]
8991 [[zh:Chinese]]
8992 !! html/php
8993 <p>Blah blah blah
8994 </p>
8995 !! html/parsoid
8996 <p>Blah blah blah</p>
8997 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8998 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8999 !! end
9000
9001 ## parsoid html2wt will lose the space variations
9002 !! test
9003 Interlanguage link variations
9004 !! options
9005 parsoid=wt2html,wt2wt,html2html
9006 !! wikitext
9007 Blah blah blah
9008 [[ es :Spanish]]
9009 [[ ZH :Chinese]]
9010 [[es:Foo_bar]]
9011 !! html/php
9012 <p>Blah blah blah
9013 </p>
9014 !! html/parsoid
9015 <p>Blah blah blah</p>
9016 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
9017 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
9018 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
9019 !! end
9020
9021 !! test
9022 Escaping of interlanguage links (T129218, T156308)
9023 !! wikitext
9024 Blah blah blah
9025 [[:es:Spanish]]
9026 [[ : zh : Chinese ]]
9027 !! html/php
9028 <p>Blah blah blah
9029 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9030 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
9031 </p>
9032 !! html/parsoid
9033 <p>Blah blah blah
9034 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9035 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
9036 !! end
9037
9038 !! test
9039 Multiple colons escaping interlanguage links
9040 !! options
9041 parsoid=wt2html
9042 !! wikitext
9043 [[:es:Spanish]]
9044 [[::es:Spanish]]
9045 [[:::es:Spanish]]
9046 !! html/php
9047 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9048 [[::es:Spanish]]
9049 [[:::es:Spanish]]
9050 </p>
9051 !! html/parsoid
9052 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9053 [[::es:Spanish]]
9054 [[:::es:Spanish]]</p>
9055 !! end
9056
9057 ## parsoid html2wt will normalize the space to _
9058 !! test
9059 Space and question mark encoding in interlanguage links (T95473)
9060 !! options
9061 parsoid=wt2html,wt2wt,html2html
9062 !! wikitext
9063 Blah blah blah
9064 [[es:Foo bar?]]
9065 !! html/php
9066 <p>Blah blah blah
9067 </p>
9068 !! html/parsoid
9069 <p>Blah blah blah</p>
9070 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
9071 !! end
9072
9073 !! test
9074 Interlanguage link, with prefix links
9075 !! options
9076 language=ln
9077 !! wikitext
9078 Blah blah blah
9079 [[zh:Chinese]]
9080 !! html/php
9081 <p>Blah blah blah
9082 </p>
9083 !! html/parsoid
9084 <p>Blah blah blah</p>
9085 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9086 !! end
9087
9088 !! test
9089 Double interlanguage link, with prefix links (T10897)
9090 !! options
9091 language=ln
9092 !! wikitext
9093 Blah blah blah
9094 [[es:Spanish]]
9095 [[zh:Chinese]]
9096 !! html/php
9097 <p>Blah blah blah
9098 </p>
9099 !! html/parsoid
9100 <p>Blah blah blah</p>
9101 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9102 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9103 !! end
9104
9105 !! test
9106 "Extra" interlanguage links (T34189 / gerrit 111390)
9107 !! wikitext
9108 Blah blah blah
9109 [[mul:Article]]
9110 !! html/php
9111 <p>Blah blah blah
9112 </p>
9113 !! html/parsoid
9114 <p>Blah blah blah</p>
9115 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
9116 !! end
9117
9118 ## PHP parser tests script needs an update
9119 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9120 !! test
9121 Language links render as inline links if $wgInterwikiMagic=false
9122 !! options
9123 wgInterwikiMagic=false
9124 parsoid=wt2html,wt2wt,html2html
9125 !! wikitext
9126 Blah blah blah
9127 [[zh:Chinese]]
9128 !! html/parsoid
9129 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9130 !! end
9131
9132 ## PHP parser tests script needs an update
9133 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9134 !! test
9135 Language links render as inline links in the Talk namespace
9136 !! options
9137 title=Talk:Foo
9138 parsoid=wt2html,wt2wt,html2html
9139 !! wikitext
9140 Blah blah blah
9141 [[zh:Chinese]]
9142 !! html/parsoid
9143 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9144 !! end
9145
9146 !! test
9147 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
9148 !! options
9149 language=ln
9150 !! wikitext
9151 [[WW&nbsp;II]]
9152 !! html
9153 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
9154 </p>
9155 !! end
9156
9157 !! test
9158 Parsoid T55221: Wikilinks should be properly entity-escaped
9159 !! options
9160 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
9161 !! html/parsoid
9162 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9163 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9164 !! wikitext
9165 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
9166
9167 He&amp;nbsp;llo He&amp;nbsp;llo
9168 !! html/php
9169 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
9170 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
9171 </p>
9172 !! end
9173
9174 # html2wt will fail because of title normalization without data-parsoid
9175 !! test
9176 Parsoid: handle constructor well
9177 !! options
9178 parsoid=wt2html,wt2wt
9179 !! wikitext
9180 [[constructor]]
9181
9182 [[constructor:foo]]
9183 !! html/php
9184 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9185 </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
9186 </p>
9187 !! html/parsoid
9188 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9189
9190 <p><a rel="mw:WikiLink" href="./Constructor:foo" title="Constructor:foo" data-parsoid='{"stx":"simple","a":{"href":"./Constructor:foo"},"sa":{"href":"constructor:foo"}}'>constructor:foo</a></p>
9191 !! end
9192
9193 !! test
9194 Template parameter named "constructor"
9195 !! wikitext
9196 {{echo| constructor = |hi}}
9197 !! html/parsoid
9198 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"constructor","named":true,"spc":[" "," ",""," "]},{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"},"constructor":{"wt":""}},"i":0}}]}'>hi</p>
9199 !! end
9200
9201 !! article
9202 ko:
9203 !! text
9204 Test.
9205 !! endarticle
9206
9207 # Note that `ko` isn't a known interlanguage prefix
9208 !! test
9209 Parsoid: recognize interlanguage links without a target page
9210 !! options
9211 ill
9212 !! wikitext
9213 [[es:]]
9214
9215 [[ko:]]
9216 !! html/php
9217 es:
9218 !! html/parsoid
9219 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9220
9221 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9222 !! end
9223
9224 # Note that `ko` isn't a known interwiki prefix
9225 !! test
9226 Parsoid: recognize interwiki links without a target page
9227 !! options
9228 parsoid=wt2html,wt2wt,html2html
9229 !! wikitext
9230 [[:es:]]
9231
9232 [[:ko:]]
9233 !! html/php
9234 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9235 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9236 </p>
9237 !! html/parsoid
9238 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9239 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9240 !! end
9241
9242 !! test
9243 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9244 !! wikitext
9245 [[mi:Foo]]
9246 !! html/php
9247 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9248 </p>
9249 !! html/parsoid
9250 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9251 !! end
9252
9253 !! test
9254 Interlanguage link with preceding local interwiki link (T70085)
9255 !! options
9256 parsoid=wt2html,wt2wt,html2html
9257 !! wikitext
9258 Blah blah blah
9259 [[local:es:Spanish]]
9260 !! html/php
9261 <p>Blah blah blah
9262 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9263 </p>
9264 !! html/parsoid
9265 <p>Blah blah blah
9266 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9267 !! end
9268
9269 !! test
9270 Looks like an interlanguage link, but is actually a local interwiki
9271 !! options
9272 parsoid=wt2html,wt2wt,html2html
9273 !! wikitext
9274 Blah blah blah
9275 [[mi:Template:Foo]]
9276 !! html/php
9277 <p>Blah blah blah
9278 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9279 </p>
9280 !! html/parsoid
9281 <p>Blah blah blah
9282 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9283 !! end
9284
9285 ###
9286 ### Redirects, Parsoid-only
9287 ###
9288
9289 !! test
9290 1. Simple redirect to page
9291 !! wikitext
9292 #REDIRECT [[Main Page]]
9293 !! html/parsoid
9294 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9295 !! end
9296
9297 !! test
9298 2. Other redirect variants
9299 !! wikitext
9300 #REDIRECT [[Main_Page]]
9301 !! html/parsoid
9302 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9303 !! end
9304
9305 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9306 # This tests the Parsoid bail-out code.
9307 !! test
9308 3. Other redirect variants
9309 !! options
9310 parsoid=wt2html
9311 !! wikitext
9312 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9313 !! html/parsoid
9314 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9315 !! end
9316
9317 !! test
9318 4. Redirect to a templated destination
9319 !! wikitext
9320 #REDIRECT [[{{echo|Foo}}bar]]
9321 !! html/parsoid
9322 <link about="#mwt2" typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-parsoid='{"a":{"href":"./Foobar"},"sa":{"href":"{{echo|Foo}}bar"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&#39;>Foo&lt;/span>bar"}]]}'/>
9323 !! end
9324
9325 !! test
9326 Empty redirect
9327 !! options
9328 parsoid=wt2html,wt2wt
9329 !! wikitext
9330 #REDIRECT [[]]
9331 !! html/parsoid
9332 <ol>
9333 <li>REDIRECT [[]]</li></ol>
9334 !! end
9335
9336 !! test
9337 Optional colon in #REDIRECT
9338 !! options
9339 # the colon is archaic syntax. we support it for wt2html, but we
9340 # don't care that it roundtrips back to the modern syntax.
9341 parsoid=wt2html,html2html
9342 !! wikitext
9343 #REDIRECT:[[Main Page]]
9344 !! html/parsoid
9345 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9346 !! end
9347
9348 !! test
9349 Whitespace in #REDIRECT with optional colon
9350 !! options
9351 # the colon and gratuitous whitespace is archaic syntax. we support
9352 # it for wt2html, but we don't care that it roundtrips back to the
9353 # modern syntax (without extra whitespace)
9354 parsoid=wt2html,html2html
9355 !! wikitext
9356
9357 #REDIRECT
9358 :
9359 [[Main Page]]
9360 !! html/parsoid
9361 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9362 !! end
9363
9364 !! test
9365 Piped link in #REDIRECT
9366 !! options
9367 # content after piped link is ignored. we support this syntax,
9368 # but don't care that the piped link is lost when we roundtrip this.
9369 parsoid=wt2html
9370 !! wikitext
9371 #REDIRECT [[Main Page|bar]]
9372 !! html/parsoid
9373 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9374 !! end
9375
9376 !! test
9377 Redirect to category (T104502)
9378 !! options
9379 parsoid=wt2html,wt2wt
9380 !! wikitext
9381 #REDIRECT [[Category:Foo]]
9382 !! html/parsoid
9383 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9384 !! end
9385
9386 !! test
9387 Redirect to category with URL encoding (T104502)
9388 !! options
9389 parsoid=wt2html
9390 !! wikitext
9391 #REDIRECT [[Category%3AFoo]]
9392 !! html/parsoid
9393 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9394 !! end
9395
9396 !! test
9397 Redirect to category page
9398 !! wikitext
9399 #REDIRECT [[:Category:Foo]]
9400 !! html/parsoid
9401 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9402 !! end
9403
9404 !! test
9405 Redirect to image page (1)
9406 !! wikitext
9407 #REDIRECT [[File:Wiki.png]]
9408 !! html/parsoid
9409 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9410 !! end
9411
9412 !! test
9413 Redirect to image page (2)
9414 !! wikitext
9415 #REDIRECT [[Image:Wiki.png]]
9416 !! html/parsoid
9417 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9418 !! end
9419
9420 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9421 # Next test confirms this.
9422 !! test
9423 Redirect to language (1) (T104918)
9424 !! options
9425 parsoid=wt2html,wt2wt,html2html
9426 !! wikitext
9427 #REDIRECT [[en:File:Wiki.png]]
9428 !! html/parsoid
9429 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9430 !! end
9431
9432 !! test
9433 Redirect to language (2) (T104918)
9434 !! wikitext
9435 #REDIRECT [[:en:File:Wiki.png]]
9436 !! html/parsoid
9437 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9438 !! end
9439
9440 !! test
9441 Redirect to interwiki (T104918)
9442 !! wikitext
9443 #REDIRECT [[meatball:File:Wiki.png]]
9444 !! html/parsoid
9445 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9446 !! end
9447
9448 !! test
9449 Non-English #REDIRECT
9450 !! options
9451 language=is
9452 !! wikitext
9453 #TILVÍSUN [[Main Page]]
9454 !! html/parsoid
9455 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9456 !! end
9457
9458 !! test
9459 Redirect syntax under text isn't considered a redirect
9460 !! wikitext
9461 some text
9462
9463 #redirect [[Main Page]]
9464 !! html/parsoid
9465 <p>some text</p>
9466 <ol data-parsoid='{}'><li data-parsoid='{}'>redirect <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a></li></ol>
9467 !! end
9468
9469 !! test
9470 New redirect
9471 !! options
9472 parsoid=html2wt
9473 !! html/parsoid
9474 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9475 !! wikitext
9476 #REDIRECT [[Foo]]
9477 Foo
9478 !! end
9479
9480 !! test
9481 Redirect followed by block on the same line
9482 !! options
9483 parsoid=wt2html
9484 !! wikitext
9485 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9486 !! html/parsoid
9487 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9488 !! end
9489
9490 !! test
9491 Redirect followed by a newline
9492 !! wikitext
9493 #REDIRECT [[Main Page]]
9494 A newline
9495 !! html/parsoid
9496 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9497 <p>A newline</p>
9498 !! end
9499
9500 !! test
9501 Redirect followed by multiple newlines
9502 !! wikitext
9503 #REDIRECT [[Main Page]]
9504
9505
9506 A newline
9507 !! html/parsoid
9508 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9509
9510 <p><br/>
9511 A newline</p>
9512 !! end
9513
9514 !! test
9515 Drop duplicate redirects
9516 !! options
9517 parsoid=html2wt
9518 !! html/parsoid
9519 <link rel="mw:PageProp/redirect" href="./Foo"/>
9520 <link rel="mw:PageProp/redirect" href="./Bar"/>
9521 <link rel="mw:PageProp/redirect" href="./Baz"/>
9522 !! wikitext
9523 #REDIRECT [[Foo]]
9524 !! end
9525
9526 ##
9527 ## XHTML tidiness
9528 ###
9529
9530 !! test
9531 <br> to <br />
9532 !! wikitext
9533 1<br>2<br />3
9534 !! html
9535 <p>1<br />2<br />3
9536 </p>
9537 !! end
9538
9539 !! test
9540 Broken br tag sanitization
9541 !! wikitext
9542 </br>
9543 !! html/php
9544 <p>&lt;/br&gt;
9545 </p>
9546 !! end
9547
9548 # TODO: Fix html2html mode (T53055)!
9549 !! test
9550 Parsoid: Broken br tag recognition
9551 !! options
9552 parsoid=wt2html
9553 !! wikitext
9554 </br>
9555
9556 <br/ >
9557 !! html+tidy
9558 <p><br />
9559 </p><p><br />
9560 </p>
9561 !! end
9562
9563 !! test
9564 Incorrecly removing closing slashes from correctly formed XHTML
9565 !! wikitext
9566 <br style="clear:both;" />
9567 !! html
9568 <p><br style="clear:both;" />
9569 </p>
9570 !! end
9571
9572 !! test
9573 Failing to transform badly formed HTML into correct XHTML
9574 !! wikitext
9575 <br style="clear: left;">
9576 <br style="clear: right;">
9577 <br style="clear: both;">
9578 !! html
9579 <p><br style="clear: left;" />
9580 <br style="clear: right;" />
9581 <br style="clear: both;" />
9582 </p>
9583 !!end
9584
9585 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9586 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9587 !! test
9588 Handling html with a div self-closing tag
9589 !! wikitext
9590 <div title />
9591 <div title/>
9592 <div title/ >
9593 <div title=bar />
9594 <div title=bar/>
9595 <div title=bar/ >
9596 !! html/php+tidy
9597 <div title=""></div>
9598 <div title=""></div>
9599 <div title="">
9600 <div title="bar"></div>
9601 <div title="bar"></div>
9602 <div title="bar/"></div></div>
9603 !! html/parsoid
9604 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9605 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9606 <div title="" data-parsoid='{"stx":"html","autoInsertedEnd":true}'>
9607 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9608 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9609 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div></div>
9610 !! end
9611
9612 !! test
9613 Elements with solidus in various attribute positions
9614 !! options
9615 parsoid=wt2html,html2html
9616 !! wikitext
9617 <div cla/ss="123">ha</div>
9618
9619 <div / class="123">ha</div>
9620
9621 <div class= / "123">ha</div>
9622 !! html/php+tidy
9623 <div>ha</div>
9624 <div class="123">ha</div>
9625 <div class="/">ha</div>
9626 !! html/parsoid
9627 <div data-parsoid='{"stx":"html","a":{"cla":null,"ss":null},"sa":{"cla":"","ss":"123"}}'>ha</div>
9628
9629 <div class="123" data-parsoid='{"stx":"html"}'>ha</div>
9630
9631 <div class="/" data-parsoid='{"stx":"html","a":{"\"123\"":null},"sa":{"\"123\"":""}}'>ha</div>
9632 !! end
9633
9634 !! test
9635 Handling html with a br self-closing tag
9636 !! wikitext
9637 <br title />
9638 <br title/>
9639 <br title/ >
9640 <br title=bar />
9641 <br title=bar/>
9642 <br title=bar/ >
9643 !! html/php+tidy
9644 <p><br title="" />
9645 <br title="" />
9646 <br title="" />
9647 <br title="bar" />
9648 <br title="bar" />
9649 <br title="bar/" />
9650 </p>
9651 !! html/parsoid
9652 <p><br title="" />
9653 <br title="" />
9654 <br title="" />
9655 <br title="bar" />
9656 <br title="bar" />
9657 <br title="bar/" />
9658 </p>
9659 !! end
9660
9661 !! test
9662 Quoted attributes without spaces
9663 !! options
9664 parsoid=wt2html
9665 !! wikitext
9666 <div class="foo"style="color:red">red</div>
9667 !! html/php+tidy
9668 <div class="foo" style="color:red">red</div>
9669 !! html/parsoid
9670 <div class="foo" style="color:red">red</div>
9671 !! end
9672
9673 !! test
9674 Horizontal ruler (should it add that extra space?)
9675 !! wikitext
9676 <hr>
9677 <hr >
9678 foo <hr
9679 > bar
9680 !! html+tidy
9681 <hr />
9682 <hr /><p>
9683 foo </p><hr /><p> bar</p>
9684 !! end
9685
9686 !! test
9687 Horizontal ruler -- 4+ dashes render hr
9688 !! wikitext
9689 ----
9690 !! html
9691 <hr />
9692 !! end
9693
9694 !! test
9695 Horizontal ruler -- eats additional dashes on the same line
9696 !! wikitext
9697 ---------
9698 !! html
9699 <hr />
9700 !! end
9701
9702 !! test
9703 Horizontal ruler -- does not collapse dashes on consecutive lines
9704 !! wikitext
9705 ----
9706 ----
9707 !! html
9708 <hr />
9709 <hr />
9710 !! end
9711
9712 !! test
9713 Horizontal ruler -- <4 dashes render as plain text
9714 !! wikitext
9715 ---
9716 !! html
9717 <p>---
9718 </p>
9719 !! end
9720
9721 !! test
9722 Horizontal ruler -- Supports content following dashes on same line
9723 !! wikitext
9724 ---- Foo
9725 !! html
9726 <hr /> Foo
9727 !! html+tidy
9728 <hr /><p> Foo</p>
9729 !! end
9730
9731 ###
9732 ### Block-level elements
9733 ###
9734 !! test
9735 Common list
9736 !! wikitext
9737 *Common list
9738 *item 2
9739 *item 3
9740 !! html
9741 <ul><li>Common list</li>
9742 <li>item 2</li>
9743 <li>item 3</li></ul>
9744 !! end
9745
9746 !! test
9747 Numbered list
9748 !! wikitext
9749 #Numbered list
9750 #item 2
9751 #item 3
9752 !! html
9753 <ol><li>Numbered list</li>
9754 <li>item 2</li>
9755 <li>item 3</li></ol>
9756 !! end
9757
9758 # the switch from level 3 to ordered should not introduce a newline between
9759 !! test
9760 Mixed list
9761 !! wikitext
9762 *Mixed list
9763 *#with numbers
9764 **and bullets
9765 *#and numbers
9766 *bullets again
9767 **bullet level 2
9768 ***bullet level 3
9769 ***#Number on level 4
9770 **bullet level 2
9771 **#Number on level 3
9772 **#Number on level 3
9773 *#number level 2
9774 *Level 1
9775 ***Level 3
9776 #**Level 3, but ordered
9777 !! html
9778 <ul><li>Mixed list
9779 <ol><li>with numbers</li></ol>
9780 <ul><li>and bullets</li></ul>
9781 <ol><li>and numbers</li></ol></li>
9782 <li>bullets again
9783 <ul><li>bullet level 2
9784 <ul><li>bullet level 3
9785 <ol><li>Number on level 4</li></ol></li></ul></li>
9786 <li>bullet level 2
9787 <ol><li>Number on level 3</li>
9788 <li>Number on level 3</li></ol></li></ul>
9789 <ol><li>number level 2</li></ol></li>
9790 <li>Level 1
9791 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9792 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9793 !! end
9794
9795 !! test
9796 1. Nested mixed wikitext and html list
9797 !! wikitext
9798 *hi
9799 *<ul><li>ho</li></ul>
9800 *hi
9801 **ho
9802 !! html/php
9803 <ul><li>hi</li>
9804 <li><ul><li>ho</li></ul></li>
9805 <li>hi
9806 <ul><li>ho</li></ul></li></ul>
9807 !! html/parsoid
9808 <ul><li>hi</li>
9809 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9810 <li>hi
9811 <ul><li>ho</li></ul></li></ul>
9812 !! end
9813
9814 !! test
9815 2. Nested mixed wikitext and html list (incompatible)
9816 !! wikitext
9817 ;hi
9818 :{{echo|<li>ho</li>}}
9819 !! html/php
9820 <dl><dt>hi</dt>
9821 <dd><li>ho</li></dd></dl>
9822 !! html/parsoid
9823 <dl><dt>hi</dt>
9824 <dd><li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
9825 !! end
9826
9827 !! test
9828 Nested lists 1
9829 !! wikitext
9830 *foo
9831 **bar
9832 !! html
9833 <ul><li>foo
9834 <ul><li>bar</li></ul></li></ul>
9835 !! end
9836
9837 !! test
9838 Nested lists 2
9839 !! wikitext
9840 **foo
9841 *bar
9842 !! html
9843 <ul><li><ul><li>foo</li></ul></li>
9844 <li>bar</li></ul>
9845 !! end
9846
9847 !! test
9848 Nested lists 3 (first element empty)
9849 !! wikitext
9850 *
9851 **bar
9852 !! html
9853 <ul><li>
9854 <ul><li>bar</li></ul></li></ul>
9855 !! end
9856
9857 !! test
9858 Nested lists 4 (first element empty)
9859 !! wikitext
9860 **
9861 *bar
9862 !! html
9863 <ul><li><ul><li></li></ul></li>
9864 <li>bar</li></ul>
9865 !! end
9866
9867 !! test
9868 Nested lists 5 (both elements empty)
9869 !! wikitext
9870 **
9871 *
9872 !! html
9873 <ul><li><ul><li></li></ul></li>
9874 <li></li></ul>
9875 !! end
9876
9877 !! test
9878 Nested lists 6 (both elements empty)
9879 !! wikitext
9880 *
9881 **
9882 !! html
9883 <ul><li>
9884 <ul><li></li></ul></li></ul>
9885 !! end
9886
9887 !! test
9888 Nested lists 7 (skip initial nesting levels)
9889 !! wikitext
9890 ***foo
9891 !! html
9892 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9893 !! end
9894
9895 !! test
9896 Nested lists 8 (multiple nesting transitions)
9897 !! wikitext
9898 *foo
9899 ***bar
9900 **baz
9901 *boo
9902 !! html
9903 <ul><li>foo
9904 <ul><li><ul><li>bar</li></ul></li>
9905 <li>baz</li></ul></li>
9906 <li>boo</li></ul>
9907 !! end
9908
9909 # XXX this test should be moved to citeParserTests, since it depends
9910 # on the Cite extension, which is "built in" to Parsoid.
9911 !! test
9912 Nested lists 9 (extension interaction)
9913 !! wikitext
9914 *<references />
9915 !! html/php+tidy-DISABLED
9916 <ul><li class="mw-empty-elt"></li></ul>
9917 !! html/parsoid
9918 <ul><li data-parsoid='{}'><ol class="mw-references references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9919 !! end
9920
9921 !! test
9922 1. Lists with start-of-line-transparent tokens before bullets: Comments
9923 !! wikitext
9924 *foo
9925 *<!--cmt-->bar
9926 <!--cmt-->*baz
9927 !! html
9928 <ul><li>foo</li>
9929 <li>bar</li>
9930 <li>baz</li></ul>
9931 !! end
9932
9933 !! test
9934 Nested lists 10 (list and span siblings: wt2wt regression)
9935 !! wikitext
9936 *a <span>x</span>
9937 **b <span>y</span>
9938 !! html/parsoid
9939 <ul><li>a <span>x</span>
9940 <ul><li>b <span>y</span></li></ul></li></ul>
9941 !! end
9942
9943 !! test
9944 2. Lists with start-of-line-transparent tokens before bullets: Template close
9945 !! wikitext
9946 *foo {{echo|bar
9947 }}*baz
9948 !! html
9949 <ul><li>foo bar</li>
9950 <li>baz</li></ul>
9951 !! end
9952
9953 !! test
9954 List items are not parsed correctly following a <pre> block (T2785)
9955 !! wikitext
9956 *<pre>foo</pre>
9957 *<pre>bar</pre>
9958 *zar
9959 !! html/php
9960 <ul><li><pre>foo</pre></li>
9961 <li><pre>bar</pre></li>
9962 <li>zar</li></ul>
9963 !! html/parsoid
9964 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9965 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9966 <li>zar</li></ul>
9967 !! end
9968
9969 # FIXME: Might benefit from a html/parsoid since this has a template
9970 !! test
9971 List items from template
9972 !! wikitext
9973
9974 {{inner list}}
9975 *item 2
9976
9977 *item 0
9978 {{inner list}}
9979 *item 2
9980
9981 *item 0
9982 *notSOL{{inner list}}
9983 *item 2
9984 !! html
9985 <ul><li>item 1</li>
9986 <li>item 2</li></ul>
9987 <ul><li>item 0</li>
9988 <li>item 1</li>
9989 <li>item 2</li></ul>
9990 <ul><li>item 0</li>
9991 <li>notSOL</li>
9992 <li>item 1</li>
9993 <li>item 2</li></ul>
9994 !! end
9995
9996 !! test
9997 List interrupted by empty line or heading
9998 !! wikitext
9999 *foo
10000
10001 **bar
10002 ==A heading==
10003 *Another list item
10004 !! html
10005 <ul><li>foo</li></ul>
10006 <ul><li><ul><li>bar</li></ul></li></ul>
10007 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
10008 <ul><li>Another list item</li></ul>
10009 !!end
10010
10011 !! test
10012 Multiple list tags generated by templates
10013 !! wikitext
10014 {{echo|<li>}}a
10015 {{echo|<li>}}b
10016 {{echo|<li>}}c
10017 !! html
10018 <li>a
10019 <li>b
10020 <li>c</li>
10021 </li>
10022 </li>
10023
10024 !! html+tidy
10025 <li>a
10026 </li><li>b
10027 </li><li>c</li>
10028 !! html/parsoid
10029 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"a"]}'>a</li>
10030 <li about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"b"]}'>b</li>
10031 <li about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"c"]}'>c</li>
10032 !! end
10033
10034 !! test
10035 Multiple newlines in between HTML list items don't induce paragraph wrapping
10036 !! wikitext
10037 <ul>
10038 <li>hi</li>
10039
10040
10041
10042
10043 <li>ho</li>
10044 </ul>
10045
10046 <dl>
10047 <dt>hi</dt>
10048 <dd>ho<div>123</div>
10049 </dd>
10050
10051
10052 </dl>
10053 !! html/php+tidy
10054 <ul>
10055 <li>hi</li>
10056
10057
10058
10059
10060 <li>ho</li>
10061 </ul>
10062 <dl>
10063 <dt>hi</dt>
10064 <dd>ho<div>123</div>
10065 </dd>
10066
10067
10068 </dl>
10069 !! end
10070
10071 !!test
10072 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
10073 !! wikitext
10074 *a
10075 <!--This line will NOT split the list-->
10076 *b
10077 <!--This line will NOT split the list either-->
10078 *c
10079 <!--foo--> <!----> <!--This line NOT split the list either-->
10080 *d
10081 !! html
10082 <ul><li>a</li>
10083 <li>b</li>
10084 <li>c</li>
10085 <li>d</li></ul>
10086 !!end
10087
10088 !!test
10089 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
10090 !! wikitext
10091 *a
10092 <!--This line will NOT split the list-->
10093 *b
10094 <!--This line will NOT split the list either-->
10095 *c
10096 <!--foo--> <!----> <!--This line NOT split the list
10097 either-->
10098 *d
10099 !! html
10100 <ul><li>a</li>
10101 <li>b</li>
10102 <li>c</li>
10103 <li>d</li></ul>
10104 !!end
10105
10106 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
10107 # That pass could possibly be removed.
10108 !!test
10109 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
10110 !!options
10111 parsoid=wt2html,wt2wt
10112 !! wikitext
10113 *foo
10114 *<li>li-hack
10115 *{{echo|<li>templated li-hack}}
10116 *<!--foo--><li> unsupported li-hack with preceding comments
10117
10118 <ul>
10119 <li><li>not a li-hack
10120 </li>
10121 </ul>
10122 !! html+tidy
10123 <ul><li>foo</li>
10124 <li class="mw-empty-elt"></li><li>li-hack</li>
10125 <li class="mw-empty-elt"></li><li>templated li-hack</li>
10126 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
10127 <ul>
10128 <li class="mw-empty-elt"></li><li>not a li-hack
10129 </li>
10130 </ul>
10131 !! html/parsoid
10132 <ul><li> foo</li>
10133 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
10134 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["*",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>templated li-hack"}},"i":0}}]}'>templated li-hack</li>
10135 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
10136
10137 <ul data-parsoid='{"stx":"html"}'>
10138 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
10139 </li>
10140 </ul>
10141 !! end
10142
10143 !! test
10144 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
10145 !! wikitext
10146 #foo
10147 ##bar
10148
10149 *foo
10150 **bar
10151
10152 :foo
10153 ::bar
10154 !! html/php+tidy
10155 <ol><li>foo
10156 <ol><li>bar</li></ol></li></ol>
10157 <ul><li>foo
10158 <ul><li>bar</li></ul></li></ul>
10159 <dl><dd>foo
10160 <dl><dd>bar</dd></dl></dd></dl>
10161 !! html/parsoid
10162 <ol>
10163 <li>foo<ol>
10164 <li>bar</li>
10165 </ol></li>
10166 </ol><ul>
10167 <li>foo<ul>
10168 <li>bar</li>
10169 </ul></li>
10170 </ul><dl>
10171 <dd>foo<dl>
10172 <dd>bar</dd>
10173 </dl></dd>
10174 </dl>
10175 !! end
10176
10177 !! test
10178 Parsoid: Test of whitespace serialization with Templated bullets
10179 !! options
10180 parsoid=wt2html
10181 !! wikitext
10182 * {{bullet}}
10183 !! html/parsoid
10184 <ul>
10185 <li class="mw-empty-elt"> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
10186 </ul>
10187 !! end
10188
10189 # ------------------------------------------------------------------------
10190 # The next set of tests are about Parsoid's ability to handle badly nested
10191 # tags (parse, minimize scope of fixup, and roundtrip back)
10192 # ------------------------------------------------------------------------
10193
10194 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
10195 # Parsoid's list handling is more aware of block structure.
10196 !! test
10197 Unbalanced closing block tags break a list
10198 !! wikitext
10199 <div>
10200 *a</div><div>
10201 *b</div>
10202 !! html+tidy
10203 <div>
10204 <ul><li>a</li></ul></div><div>
10205 <li>b</li></div>
10206 !! html/parsoid
10207 <div><ul>
10208 <li>a</li>
10209 </ul></div>
10210 <div><ul>
10211 <li>b</li>
10212 </ul></div>
10213 !! end
10214
10215 !! test
10216 Unbalanced closing non-block tags don't break a list
10217 !! options
10218 parsoid=wt2html,html2html
10219 !! wikitext
10220 <span>
10221 *a</span><span>
10222 *b</span>
10223 !! html/php+tidy
10224 <p><span>
10225 </span></p>
10226 <ul><li>a<span></span></li>
10227 <li>b</li></ul>
10228 !! html/parsoid
10229 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></p>
10230 <ul><li>a<span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></li>
10231 <li>b</li></ul>
10232 !! end
10233
10234 # Parsoid does some post-dom-building cleanup
10235 # which is why its output differs from Remex.
10236 !! test
10237 Unclosed formatting tags that straddle lists are closed and reopened
10238 !! options
10239 parsoid=wt2html,wt2wt,html2html
10240 !! wikitext
10241 #<s> a
10242 #b </s>
10243 !! html/php+tidy
10244 <ol><li><s> a</s></li><s>
10245 </s><li><s>b </s></li></ol>
10246 !! html/parsoid
10247 <ol><li><s> a</s></li>
10248 <li><s>b </s></li></ol>
10249 !! end
10250
10251 # Output is ugly because of all the misnested tag fixups.
10252 !! test
10253 1. List embedded in a formatting tag
10254 !! wikitext
10255 <small>
10256 *foo
10257 </small>
10258 !! html/php+tidy
10259 <p><small>
10260 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10261 </p>
10262 !! html/parsoid
10263 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
10264 <ul><li data-parsoid='{}'>foo</li></ul></small>
10265 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p>
10266 !! end
10267
10268 # Output is ugly because of all the misnested tag fixups.
10269 !! test
10270 2. List embedded in a formatting tag in a misnested way
10271 !! wikitext
10272 <small>
10273 *a
10274 *b</small>
10275 !! html/php+tidy
10276 <p><small>
10277 </small></p><small></small><ul><small><li>a</li>
10278 </small><li><small>b</small></li></ul>
10279 !! html/parsoid
10280 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10281 <ul><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'><li>a</li></small>
10282 <li><small data-parsoid='{"stx":"html","autoInsertedStart":true}'>b</small></li></ul>
10283 !! end
10284
10285 # Output is ugly because of all the misnested tag fixups.
10286 !! test
10287 3. List embedded in a formatting tag in a misnested way
10288 !! wikitext
10289 <small>
10290
10291 ** 123</small>
10292 !! html/php+tidy
10293 <p><small>
10294 </small></p><small></small><ul><small></small><li><small></small><ul><small></small><li><small>123</small></li></ul></li></ul>
10295 !! html/parsoid
10296 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10297
10298 <ul><li><ul><li data-parsoid='{}'><small data-parsoid='{"stx":"html","autoInsertedStart":true}'> 123</small></li></ul></li></ul>
10299 !! end
10300
10301 ###
10302 ### Magic Words
10303 ###
10304
10305 # Note that the current date is hard-coded as
10306 # 1970-01-01T00:02:03Z (a Thursday)
10307 # when running parser tests. The timezone is also fixed to GMT, so
10308 # local date will be identical to current date.
10309
10310 !! test
10311 Magic Word: {{CURRENTDAY}}
10312 !! wikitext
10313 {{CURRENTDAY}}
10314 !! html
10315 <p>1
10316 </p>
10317 !! end
10318
10319 !! test
10320 Magic Word: {{CURRENTDAY2}}
10321 !! wikitext
10322 {{CURRENTDAY2}}
10323 !! html
10324 <p>01
10325 </p>
10326 !! end
10327
10328 !! test
10329 Magic Word: {{CURRENTDAYNAME}}
10330 !! wikitext
10331 {{CURRENTDAYNAME}}
10332 !! html
10333 <p>Thursday
10334 </p>
10335 !! end
10336
10337 !! test
10338 Magic Word: {{CURRENTDOW}}
10339 !! wikitext
10340 {{CURRENTDOW}}
10341 !! html
10342 <p>4
10343 </p>
10344 !! end
10345
10346 !! test
10347 Magic Word: {{CURRENTMONTH}}
10348 !! wikitext
10349 {{CURRENTMONTH}}
10350 !! html
10351 <p>01
10352 </p>
10353 !! end
10354
10355 !! test
10356 Magic Word: {{CURRENTMONTH1}}
10357 !! wikitext
10358 {{CURRENTMONTH1}}
10359 !! html
10360 <p>1
10361 </p>
10362 !! end
10363
10364 !! test
10365 Magic Word: {{CURRENTMONTHABBREV}}
10366 !! wikitext
10367 {{CURRENTMONTHABBREV}}
10368 !! html
10369 <p>Jan
10370 </p>
10371 !! end
10372
10373 !! test
10374 Magic Word: {{CURRENTMONTHNAME}}
10375 !! wikitext
10376 {{CURRENTMONTHNAME}}
10377 !! html
10378 <p>January
10379 </p>
10380 !! end
10381
10382 !! test
10383 Magic Word: {{CURRENTMONTHNAMEGEN}}
10384 !! wikitext
10385 {{CURRENTMONTHNAMEGEN}}
10386 !! html
10387 <p>January
10388 </p>
10389 !! end
10390
10391 !! test
10392 Magic Word: {{CURRENTTIME}}
10393 !! wikitext
10394 {{CURRENTTIME}}
10395 !! html
10396 <p>00:02
10397 </p>
10398 !! end
10399
10400 !! test
10401 Magic Word: {{CURRENTHOUR}}
10402 !! wikitext
10403 {{CURRENTHOUR}}
10404 !! html
10405 <p>00
10406 </p>
10407 !! end
10408
10409 !! test
10410 Magic Word: {{CURRENTWEEK}} (T6594)
10411 !! wikitext
10412 {{CURRENTWEEK}}
10413 !! html
10414 <p>1
10415 </p>
10416 !! end
10417
10418 !! test
10419 Magic Word: {{CURRENTYEAR}}
10420 !! wikitext
10421 {{CURRENTYEAR}}
10422 !! html
10423 <p>1970
10424 </p>
10425 !! end
10426
10427 !! test
10428 Magic Word: {{CURRENTTIMESTAMP}}
10429 !! wikitext
10430 {{CURRENTTIMESTAMP}}
10431 !! html
10432 <p>19700101000203
10433 </p>
10434 !! end
10435
10436 !! test
10437 Magic Words LOCAL (UTC)
10438 !! wikitext
10439 *{{LOCALMONTH}}
10440 *{{LOCALMONTH1}}
10441 *{{LOCALMONTHNAME}}
10442 *{{LOCALMONTHNAMEGEN}}
10443 *{{LOCALMONTHABBREV}}
10444 *{{LOCALDAY}}
10445 *{{LOCALDAY2}}
10446 *{{LOCALDAYNAME}}
10447 *{{LOCALYEAR}}
10448 *{{LOCALTIME}}
10449 *{{LOCALHOUR}}
10450 *{{LOCALWEEK}}
10451 *{{LOCALDOW}}
10452 *{{LOCALTIMESTAMP}}
10453 !! html
10454 <ul><li>01</li>
10455 <li>1</li>
10456 <li>January</li>
10457 <li>January</li>
10458 <li>Jan</li>
10459 <li>1</li>
10460 <li>01</li>
10461 <li>Thursday</li>
10462 <li>1970</li>
10463 <li>00:02</li>
10464 <li>00</li>
10465 <li>1</li>
10466 <li>4</li>
10467 <li>19700101000203</li></ul>
10468 !! end
10469
10470 !! test
10471 Magic Word: {{FULLPAGENAME}}
10472 !! options
10473 title=[[User:Ævar Arnfjörð Bjarmason]]
10474 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10475 !! wikitext
10476 {{FULLPAGENAME}}
10477 !! html/*
10478 <p>User:Ævar Arnfjörð Bjarmason
10479 </p>
10480 !! end
10481
10482 !! test
10483 Magic Word: {{FULLPAGENAMEE}}
10484 !! options
10485 title=[[User:Ævar Arnfjörð Bjarmason]]
10486 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10487 !! wikitext
10488 {{FULLPAGENAMEE}}
10489 !! html/*
10490 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10491 </p>
10492 !! end
10493
10494 !! test
10495 Magic Word: {{TALKSPACE}}
10496 !! options
10497 title=[[User:Ævar Arnfjörð Bjarmason]]
10498 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10499 !! wikitext
10500 {{TALKSPACE}}
10501 !! html/*
10502 <p>User talk
10503 </p>
10504 !! end
10505
10506 !! test
10507 Magic Word: {{TALKSPACE}}, same namespace
10508 !! options
10509 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10510 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10511 !! wikitext
10512 {{TALKSPACE}}
10513 !! html/*
10514 <p>User talk
10515 </p>
10516 !! end
10517
10518 !! test
10519 Magic Word: {{TALKSPACE}}, main namespace
10520 !! options
10521 title=[[Parser Test]]
10522 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10523 !! wikitext
10524 {{TALKSPACE}}
10525 !! html/*
10526 <p>Talk
10527 </p>
10528 !! end
10529
10530 !! test
10531 Magic Word: {{TALKSPACEE}}
10532 !! options
10533 title=[[User:Ævar Arnfjörð Bjarmason]]
10534 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10535 !! wikitext
10536 {{TALKSPACEE}}
10537 !! html/*
10538 <p>User_talk
10539 </p>
10540 !! end
10541
10542 !! test
10543 Magic Word: {{SUBJECTSPACE}}
10544 !! options
10545 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10546 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10547 !! wikitext
10548 {{SUBJECTSPACE}}
10549 !! html/*
10550 <p>User
10551 </p>
10552 !! end
10553
10554 !! test
10555 Magic Word: {{SUBJECTSPACE}}, same namespace
10556 !! options
10557 title=[[User:Ævar Arnfjörð Bjarmason]]
10558 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10559 !! wikitext
10560 {{SUBJECTSPACE}}
10561 !! html/*
10562 <p>User
10563 </p>
10564 !! end
10565
10566 !! test
10567 Magic Word: {{SUBJECTSPACE}}, main namespace
10568 !! options
10569 title=[[Parser Test]]
10570 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10571 !! wikitext
10572 {{SUBJECTSPACE}}
10573 !! html/*
10574 !! end
10575
10576 !! test
10577 Magic Word: {{SUBJECTSPACEE}}
10578 !! options
10579 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10580 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10581 !! wikitext
10582 {{SUBJECTSPACEE}}
10583 !! html/*
10584 <p>User
10585 </p>
10586 !! end
10587
10588 !! test
10589 Magic Word: {{NAMESPACE}}
10590 !! options
10591 title=[[User:Ævar Arnfjörð Bjarmason]]
10592 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10593 !! wikitext
10594 {{NAMESPACE}}
10595 !! html/*
10596 <p>User
10597 </p>
10598 !! end
10599
10600 !! test
10601 Magic Word: {{NAMESPACEE}}
10602 !! options
10603 title=[[User:Ævar Arnfjörð Bjarmason]]
10604 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10605 !! wikitext
10606 {{NAMESPACEE}}
10607 !! html/*
10608 <p>User
10609 </p>
10610 !! end
10611
10612 !! test
10613 Magic Word: {{NAMESPACENUMBER}}
10614 !! options
10615 title=[[User:Ævar Arnfjörð Bjarmason]]
10616 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10617 !! wikitext
10618 {{NAMESPACENUMBER}}
10619 !! html/*
10620 <p>2
10621 </p>
10622 !! end
10623
10624 !! test
10625 Magic Word: {{SUBPAGENAME}}
10626 !! options
10627 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10628 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10629 !! wikitext
10630 {{SUBPAGENAME}}
10631 !! html/*
10632 <p>sub ö
10633 </p>
10634 !! end
10635
10636 !! test
10637 Magic Word: {{SUBPAGENAMEE}}
10638 !! options
10639 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10640 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10641 !! wikitext
10642 {{SUBPAGENAMEE}}
10643 !! html/*
10644 <p>sub_%C3%B6
10645 </p>
10646 !! end
10647
10648 !! test
10649 Magic Word: {{ROOTPAGENAME}}
10650 !! options
10651 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10652 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10653 !! wikitext
10654 {{ROOTPAGENAME}}
10655 !! html/*
10656 <p>Ævar Arnfjörð Bjarmason
10657 </p>
10658 !! end
10659
10660 !! test
10661 Magic Word: {{ROOTPAGENAMEE}}
10662 !! options
10663 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10664 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10665 !! wikitext
10666 {{ROOTPAGENAMEE}}
10667 !! html/*
10668 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10669 </p>
10670 !! end
10671
10672 !! test
10673 Magic Word: {{BASEPAGENAME}}
10674 !! options
10675 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10676 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10677 !! wikitext
10678 {{BASEPAGENAME}}
10679 !! html/*
10680 <p>Ævar Arnfjörð Bjarmason
10681 </p>
10682 !! end
10683
10684 !! test
10685 Magic Word: {{BASEPAGENAMEE}}
10686 !! options
10687 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10688 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10689 !! wikitext
10690 {{BASEPAGENAMEE}}
10691 !! html/*
10692 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10693 </p>
10694 !! end
10695
10696 !! test
10697 Magic Word: {{TALKPAGENAME}}
10698 !! options
10699 title=[[User:Ævar Arnfjörð Bjarmason]]
10700 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10701 !! wikitext
10702 {{TALKPAGENAME}}
10703 !! html/*
10704 <p>User talk:Ævar Arnfjörð Bjarmason
10705 </p>
10706 !! end
10707
10708 !! test
10709 Magic Word: {{TALKPAGENAMEE}}
10710 !! options
10711 title=[[User:Ævar Arnfjörð Bjarmason]]
10712 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10713 !! wikitext
10714 {{TALKPAGENAMEE}}
10715 !! html/*
10716 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10717 </p>
10718 !! end
10719
10720 !! test
10721 Magic Word: {{SUBJECTPAGENAME}}
10722 !! options
10723 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10724 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10725 !! wikitext
10726 {{SUBJECTPAGENAME}}
10727 !! html/*
10728 <p>User:Ævar Arnfjörð Bjarmason
10729 </p>
10730 !! end
10731
10732 !! test
10733 Magic Word: {{SUBJECTPAGENAMEE}}
10734 !! options
10735 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10736 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10737 !! wikitext
10738 {{SUBJECTPAGENAMEE}}
10739 !! html/*
10740 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10741 </p>
10742 !! end
10743
10744 !! test
10745 Magic Word: {{NUMBEROFFILES}}
10746 !! options
10747 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10748 !! wikitext
10749 {{NUMBEROFFILES}}
10750 !! html/*
10751 <p>7
10752 </p>
10753 !! end
10754
10755 !! test
10756 Magic Word: {{PAGENAME}}
10757 !! options
10758 title=[[User:Ævar Arnfjörð Bjarmason]]
10759 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10760 !! wikitext
10761 {{PAGENAME}}
10762 !! html/*
10763 <p>Ævar Arnfjörð Bjarmason
10764 </p>
10765 !! end
10766
10767 !! test
10768 Magic Word: {{PAGENAME}} with metacharacters
10769 !! options
10770 title=[['foo & bar = baz']]
10771 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10772 !! wikitext
10773 ''{{PAGENAME}}''
10774 !! html+tidy
10775 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10776 </p>
10777 !! end
10778
10779 !! test
10780 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10781 !! options
10782 title=[[*RFC 1234 http://example.com/]]
10783 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10784 !! wikitext
10785 {{PAGENAME}}
10786 !! html+tidy
10787 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10788 </p>
10789 !! end
10790
10791 !! test
10792 Magic Word: {{PAGENAMEE}}
10793 !! options
10794 title=[[User:Ævar Arnfjörð Bjarmason]]
10795 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10796 !! wikitext
10797 {{PAGENAMEE}}
10798 !! html/*
10799 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10800 </p>
10801 !! end
10802
10803 !! test
10804 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10805 !! options
10806 title=[[*RFC 1234 http://example.com/]]
10807 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10808 !! wikitext
10809 {{PAGENAMEE}}
10810 !! html+tidy
10811 <p>&#42;RFC_1234_http&#58;//example.com/
10812 </p>
10813 !! end
10814
10815 !! test
10816 Magic Word: {{REVISIONID}}
10817 !! options
10818 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10819 showflags
10820 !! wikitext
10821 {{REVISIONID}}
10822 !! html/*
10823 <p>1337
10824 </p>
10825 flags=vary-revision-id
10826 !! end
10827
10828 !! test
10829 Magic Word: {{SCRIPTPATH}}
10830 !! options
10831 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10832 !! wikitext
10833 {{SCRIPTPATH}}
10834 !! html/*
10835 !! end
10836
10837 !! test
10838 Magic Word: {{STYLEPATH}}
10839 !! options
10840 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10841 !! wikitext
10842 {{STYLEPATH}}
10843 !! html/*
10844 <p>/skins
10845 </p>
10846 !! end
10847
10848 !! test
10849 Magic Word: {{SERVER}}
10850 !! options
10851 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10852 !! wikitext
10853 {{SERVER}}
10854 !! html/*
10855 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10856 </p>
10857 !! end
10858
10859 !! test
10860 Magic Word: {{SERVERNAME}}
10861 !! options
10862 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10863 !! wikitext
10864 {{SERVERNAME}}
10865 !! html/*
10866 <p>example.org
10867 </p>
10868 !! end
10869
10870 !! test
10871 Magic Word: {{SITENAME}}
10872 !! options
10873 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10874 !! wikitext
10875 {{SITENAME}}
10876 !! html/*
10877 <p>MediaWiki
10878 </p>
10879 !! end
10880
10881 !! test
10882 Magic Word: {{PAGELANGUAGE}}
10883 !! options
10884 language=fr
10885 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10886 !! wikitext
10887 {{PAGELANGUAGE}}
10888 !! html/*
10889 <p>fr
10890 </p>
10891 !! end
10892
10893 !! test
10894 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10895 !! options
10896 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10897 !! wikitext
10898 {{PAGELANGUAGE}}
10899 !! html/*
10900 <p>en
10901 </p>
10902 !! end
10903
10904 !! test
10905 Case-sensitive magic words, when cased differently, should just be template transclusions
10906 !! wikitext
10907 {{CurrentMonth}}
10908 {{currentday}}
10909 {{cURreNTweEK}}
10910 {{currentHour}}
10911 !! html
10912 <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>
10913 <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>
10914 <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>
10915 <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>
10916 </p>
10917 !! end
10918
10919 !! test
10920 Case-insensitive magic words should still work with weird casing.
10921 !! wikitext
10922 {{sErVeRNaMe}}
10923 {{LCFirst:AOEU}}
10924 {{ucFIRST:aoeu}}
10925 {{SERver}}
10926 !! html
10927 <p>example.org
10928 aOEU
10929 Aoeu
10930 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10931 </p>
10932 !! end
10933
10934 # From plwiki:PLOS_ONE
10935 !! test
10936 Parsoid: Page property magic word with magic word contents
10937 !! options
10938 showtitle
10939 !! config
10940 wgAllowDisplayTitle=true
10941 wgRestrictDisplayTitle=false
10942 !! wikitext
10943 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10944 !! html/php+tidy
10945 <i>Parser test</i>
10946
10947 !! html/parsoid
10948 <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>"}]]}'/>
10949 !! end
10950
10951 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10952 # But, this is a limitation of our representation and is documented in
10953 # TemplateHandler.js in processSpecialMagicWord
10954 !! test
10955 Parsoid: Template-generated DISPLAYTITLE
10956 !! wikitext
10957 {{{{echo|DISPLAYTITLE}}:Foo}}
10958 !! options
10959 showtitle
10960 !! config
10961 wgAllowDisplayTitle=true
10962 wgRestrictDisplayTitle=false
10963 !! html/php
10964 Foo
10965
10966 !! html/parsoid
10967 <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"}]]}'/>
10968 !! end
10969
10970 !! test
10971 Namespace 1 {{ns:1}}
10972 !! wikitext
10973 {{ns:1}}
10974 !! html
10975 <p>Talk
10976 </p>
10977 !! end
10978
10979 !! test
10980 Namespace 1 {{ns:01}}
10981 !! wikitext
10982 {{ns:01}}
10983 !! html
10984 <p>Talk
10985 </p>
10986 !! end
10987
10988 !! test
10989 Namespace 0 {{ns:0}} (T6783)
10990 !! wikitext
10991 {{ns:0}}
10992 !! html
10993 !! end
10994
10995 !! test
10996 Namespace 0 {{ns:00}} (T6783)
10997 !! wikitext
10998 {{ns:00}}
10999 !! html
11000 !! end
11001
11002 !! test
11003 Namespace -1 {{ns:-1}}
11004 !! wikitext
11005 {{ns:-1}}
11006 !! html
11007 <p>Special
11008 </p>
11009 !! end
11010
11011 !! test
11012 Namespace User {{ns:User}}
11013 !! wikitext
11014 {{ns:User}}
11015 !! html
11016 <p>User
11017 </p>
11018 !! end
11019
11020 !! test
11021 Namespace User talk {{ns:User_talk}}
11022 !! wikitext
11023 {{ns:User_talk}}
11024 !! html
11025 <p>User talk
11026 </p>
11027 !! end
11028
11029 !! test
11030 Namespace User talk {{ns:uSeR tAlK}}
11031 !! wikitext
11032 {{ns:uSeR tAlK}}
11033 !! html
11034 <p>User talk
11035 </p>
11036 !! end
11037
11038 !! test
11039 Namespace File {{ns:File}}
11040 !! wikitext
11041 {{ns:File}}
11042 !! html
11043 <p>File
11044 </p>
11045 !! end
11046
11047 !! test
11048 Namespace File {{ns:Image}}
11049 !! wikitext
11050 {{ns:Image}}
11051 !! html
11052 <p>File
11053 </p>
11054 !! end
11055
11056 !! test
11057 Namespace (lang=de) Benutzer {{ns:User}}
11058 !! options
11059 language=de
11060 !! wikitext
11061 {{ns:User}}
11062 !! html
11063 <p>Benutzer
11064 </p>
11065 !! end
11066
11067 !! test
11068 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
11069 !! options
11070 language=de
11071 !! wikitext
11072 {{ns:3}}
11073 !! html
11074 <p>Benutzer Diskussion
11075 </p>
11076 !! end
11077
11078 !! test
11079 Urlencode
11080 !! wikitext
11081 {{urlencode:hi world?!}}
11082 {{urlencode:hi world?!|WIKI}}
11083 {{urlencode:hi world?!|PATH}}
11084 {{urlencode:hi world?!|QUERY}}
11085 !! html/php
11086 <p>hi+world%3F%21
11087 hi_world%3F!
11088 hi%20world%3F%21
11089 hi+world%3F%21
11090 </p>
11091 !! end
11092
11093 !! test
11094 Magic Word: prioritize type info over data-parsoid
11095 !! options
11096 parsoid=html2wt
11097 !! html/parsoid
11098 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
11099 !! wikitext
11100 __FORCETOC__
11101 !! end
11102
11103 !! test
11104 Magic Word: serialize on separate line (parsoid)
11105 !! options
11106 parsoid=wt2wt,html2wt
11107 !! wikitext
11108 foo
11109 __NOTOC__
11110 bar
11111 !! html/parsoid
11112 foo<meta property="mw:PageProp/notoc"/>bar
11113 !! end
11114
11115 !! test
11116 Magic Word: rt non-english wikis
11117 !! options
11118 parsoid=wt2wt
11119 language=de
11120 !! wikitext
11121 __NOEDITSECTION__
11122 !! html/parsoid
11123 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
11124 !! end
11125
11126 !!test
11127 __proto__ is treated as normal wikitext (T105997)
11128 !!wikitext
11129 __proto__
11130 !!html
11131 <p>__proto__
11132 </p>
11133 !!end
11134
11135 ###
11136 ### Magic links
11137 ###
11138 !! test
11139 Magic links: internal link to RFC (T2479)
11140 !! wikitext
11141 [[RFC 123]]
11142 !! html/php
11143 <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>
11144 </p>
11145 !! html/parsoid
11146 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
11147 !! end
11148
11149 !! test
11150 Magic links: RFC (T2479)
11151 !! wikitext
11152 RFC 822
11153 !! html/php
11154 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11155 </p>
11156 !! html/parsoid
11157 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
11158 !! end
11159
11160 !! test
11161 Magic links: RFC (T67278)
11162 !! wikitext
11163 This is RFC 822 but thisRFC 822 is not RFC 822linked.
11164 !! html/php
11165 <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.
11166 </p>
11167 !! html/parsoid
11168 <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>
11169 !! end
11170
11171 !! test
11172 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
11173 !! wikitext
11174 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
11175 RFC
11176 822
11177 !! html/php
11178 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11179 RFC
11180 822
11181 </p>
11182 !! html/parsoid
11183 <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>
11184 RFC
11185 822</p>
11186 !! end
11187
11188 !! test
11189 Magic links: ISBN (T3937)
11190 !! wikitext
11191 ISBN 0-306-40615-2
11192 !! html/php
11193 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
11194 </p>
11195 !! html/parsoid
11196 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
11197 !! end
11198
11199 !! test
11200 Magic links: ISBN (T67278)
11201 !! wikitext
11202 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11203 !! html/php
11204 <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.
11205 </p>
11206 !! html/parsoid
11207 <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>
11208 !! end
11209
11210 !! test
11211 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
11212 !! wikitext
11213 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
11214 ISBN
11215 9780316098113
11216 ISBN 978
11217 0316098113
11218 !! html/php
11219 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11220 ISBN
11221 9780316098113
11222 ISBN 978
11223 0316098113
11224 </p>
11225 !! html/parsoid
11226 <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>
11227 ISBN
11228 9780316098113
11229 ISBN 978
11230 0316098113</p>
11231 !! end
11232
11233 !! test
11234 Magic links: PMID incorrectly converts space to underscore
11235 !! wikitext
11236 PMID 1234
11237 !! html/php
11238 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11239 </p>
11240 !! html/parsoid
11241 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
11242 !! end
11243
11244 !! test
11245 Magic links: PMID (T67278)
11246 !! wikitext
11247 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11248 !! html/php
11249 <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.
11250 </p>
11251 !! html/parsoid
11252 <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>
11253 !! end
11254
11255 !! test
11256 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11257 !! wikitext
11258 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11259 PMID
11260 1234
11261 !! html/php
11262 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11263 PMID
11264 1234
11265 </p>
11266 !! html/parsoid
11267 <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>
11268 PMID
11269 1234</p>
11270 !! end
11271
11272 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11273 # since these are ExtLinkText, not MagicLinkText
11274 !! test
11275 Magic links: use appropriate serialization for "almost" magic links.
11276 !! wikitext
11277 X[[Special:BookSources/0978739256|foo]]
11278
11279 X[https://tools.ietf.org/html/rfc1234 foo]
11280 !! html/php
11281 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11282 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11283 </p>
11284 !! html/parsoid
11285 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11286 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11287 !! end
11288
11289 !! test
11290 Magic links: All disabled (T47942)
11291 !! options
11292 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11293 !! wikitext
11294 ISBN 0-306-40615-2
11295 PMID 1234
11296 RFC 4321
11297 !! html/php
11298 <p>ISBN 0-306-40615-2
11299 PMID 1234
11300 RFC 4321
11301 </p>
11302 !! end
11303
11304 ###
11305 ### Templates
11306 ####
11307
11308 !! test
11309 Nonexistent template
11310 !! wikitext
11311 {{thistemplatedoesnotexist}}
11312 !! html
11313 <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>
11314 </p>
11315 !! end
11316
11317 !! test
11318 Template with invalid target containing tags
11319 !! wikitext
11320 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11321 !! html
11322 <p>{{a<b>b</b>|foo|a=b|a = b}}
11323 </p>
11324 !! end
11325
11326 !! test
11327 Template with invalid target containing unclosed tag
11328 !! wikitext
11329 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11330 !! html
11331 <p>{{a<b>|foo|a=b|a = b}}</b>
11332 </p>
11333 !! end
11334
11335 !! test
11336 Template with invalid target containing wikilink
11337 !! wikitext
11338 {{[[Main Page]]}}
11339 !! html/php
11340 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11341 </p>
11342 !! html/parsoid
11343 <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>
11344 !! end
11345
11346 !! test
11347 Template with just whitespace in it, T70421
11348 !! wikitext
11349 {{echo|{{ }}}}
11350 !! html/parsoid
11351 <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>
11352 !! end
11353
11354 !! article
11355 Template:test
11356 !! text
11357 This is a test template
11358 !! endarticle
11359
11360 !! test
11361 Simple template
11362 !! wikitext
11363 {{test}}
11364 !! html
11365 <p>This is a test template
11366 </p>
11367 !! end
11368
11369 !! test
11370 Template with explicit namespace
11371 !! wikitext
11372 {{Template:test}}
11373 !! html
11374 <p>This is a test template
11375 </p>
11376 !! end
11377
11378
11379 !! article
11380 Template:paramtest
11381 !! text
11382 This is a test template with parameter {{{param}}}
11383 !! endarticle
11384
11385 !! test
11386 Template parameter
11387 !! wikitext
11388 {{paramtest|param=foo}}
11389 !! html
11390 <p>This is a test template with parameter foo
11391 </p>
11392 !! end
11393
11394 !! article
11395 Template:paramtestnum
11396 !! text
11397 [[{{{1}}}|{{{2}}}]]
11398 !! endarticle
11399
11400 !! test
11401 Template unnamed parameter
11402 !! wikitext
11403 {{paramtestnum|Main Page|the main page}}
11404 !! html
11405 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11406 </p>
11407 !! end
11408
11409 !! article
11410 Template:templatesimple
11411 !! text
11412 (test)
11413 !! endarticle
11414
11415 !! article
11416 Template:templateredirect
11417 !! text
11418 #redirect [[Template:templatesimple]]
11419 !! endarticle
11420
11421 !! article
11422 Template:templateasargtestnum
11423 !! text
11424 {{{{{1}}}}}
11425 !! endarticle
11426
11427 !! article
11428 Template:templateasargtest
11429 !! text
11430 {{template{{{templ}}}}}
11431 !! endarticle
11432
11433 !! article
11434 Template:templateasargtest2
11435 !! text
11436 {{{{{templ}}}}}
11437 !! endarticle
11438
11439 !! test
11440 Template with template name as unnamed argument
11441 !! wikitext
11442 {{templateasargtestnum|templatesimple}}
11443 !! html
11444 <p>(test)
11445 </p>
11446 !! end
11447
11448 !! test
11449 Template with template name as argument
11450 !! wikitext
11451 {{templateasargtest|templ=simple}}
11452 !! html
11453 <p>(test)
11454 </p>
11455 !! end
11456
11457 !! test
11458 Template with template name as argument (2)
11459 !! wikitext
11460 {{templateasargtest2|templ=templatesimple}}
11461 !! html
11462 <p>(test)
11463 </p>
11464 !! end
11465
11466 !! article
11467 Template:templateasargtestdefault
11468 !! text
11469 {{{{{templ|templatesimple}}}}}
11470 !! endarticle
11471
11472 !! article
11473 Template:templa
11474 !! text
11475 '''templ'''
11476 !! endarticle
11477
11478 !! test
11479 Template with default value
11480 !! wikitext
11481 {{templateasargtestdefault}}
11482 !! html
11483 <p>(test)
11484 </p>
11485 !! end
11486
11487 !! test
11488 Template with default value (value set)
11489 !! wikitext
11490 {{templateasargtestdefault|templ=templa}}
11491 !! html
11492 <p><b>templ</b>
11493 </p>
11494 !! end
11495
11496 !! test
11497 Template redirect
11498 !! wikitext
11499 {{templateredirect}}
11500 !! html/php
11501 <p>(test)
11502 </p>
11503 !! html/parsoid
11504 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11505 !! end
11506
11507 !! test
11508 Template with argument in separate line
11509 !! wikitext
11510 {{ templateasargtest |
11511 templ = simple }}
11512 !! html
11513 <p>(test)
11514 </p>
11515 !! end
11516
11517 !! test
11518 Template with complex template as argument
11519 !! wikitext
11520 {{paramtest|
11521 param ={{ templateasargtest |
11522 templ = simple }}}}
11523 !! html
11524 <p>This is a test template with parameter (test)
11525 </p>
11526 !! end
11527
11528 !! test
11529 Templates with templated name
11530 !! wikitext
11531 {{{{echo|echo}}|foo}}
11532 {{{{echo|inner list}} }}
11533 !! html
11534 <p>foo
11535 </p>
11536 <ul><li>item 1</li></ul>
11537 !! html/parsoid
11538 <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>
11539 <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>
11540 !! end
11541
11542 ## Regression test; the output here isn't really that interesting.
11543 !! test
11544 Templates with templated name and top level template args
11545 !! wikitext
11546 {{1{{2{{{3}}}|4=5}}}}
11547 !! html/parsoid
11548 <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>
11549 !! end
11550
11551 # Parsoid markup is deliberate "broken". This is an edge case.
11552 # See long comment in TemplateHandler.js:convertAttribsToString.
11553 !! test
11554 Templates with invalid templated targets
11555 !! wikitext
11556 {{echo
11557 {{echo|foo}}
11558 }}
11559 !! html/php
11560 <p>{{echo
11561 foo
11562 }}
11563 </p>
11564 !! html/parsoid
11565 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11566 foo }}</p>
11567 !! end
11568
11569 !! test
11570 Template with thumb image (with link in description)
11571 !! wikitext
11572 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11573 !! html/php
11574 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>
11575 !! html+tidy
11576 <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>
11577 !! html/parsoid
11578 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Noimage.png"><span resource="./File:Noimage.png" data-width="220">File:Noimage.png</span></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
11579 !! end
11580
11581 !! article
11582 Template:complextemplate
11583 !! text
11584 {{{1}}} {{paramtest|
11585 param ={{{param}}}}}
11586 !! endarticle
11587
11588 !! test
11589 Template with complex arguments
11590 !! wikitext
11591 {{complextemplate|
11592 param ={{ templateasargtest |
11593 templ = simple }}|[[Template:complextemplate|link]]}}
11594 !! html
11595 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11596 </p>
11597 !! end
11598
11599 !! test
11600 T2553: link with two variables in a piped link
11601 !! wikitext
11602 {|
11603 |[[{{{1}}}|{{{2}}}]]
11604 |}
11605 !! html/php
11606 <table>
11607 <tr>
11608 <td>[[{{{1}}}|{{{2}}}]]
11609 </td></tr></table>
11610 !! html/parsoid
11611 <table>
11612 <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>
11613 </tbody></table>
11614 !! end
11615
11616 # See: T2553
11617 !! test
11618 Abort table cell attribute parsing on wikilink
11619 !! wikitext
11620 {|
11621 |testing [[one|two]] |three||four
11622 |testing one two |three||four
11623 |testing="[[one|two]]" |three||four
11624 |}
11625 !! html/php
11626 <table>
11627 <tr>
11628 <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>
11629 <td>four
11630 </td>
11631 <td>three</td>
11632 <td>four
11633 </td>
11634 <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>
11635 <td>four
11636 </td></tr></table>
11637 !! html/parsoid
11638 <table>
11639 <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>
11640 <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>
11641 <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>
11642 </tbody></table>
11643 !! end
11644
11645 !! test
11646 Don't abort table cell attribute parsing if wikilink is found in template arg
11647 !! wikitext
11648 {|
11649 |Test {{#tag:ref|One two "[[three]]" four}}
11650 |}
11651 !! html/parsoid
11652 <table>
11653 <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>
11654 </tbody></table>
11655 !! end
11656
11657 !! test
11658 Magic variable as template parameter
11659 !! wikitext
11660 {{paramtest|param={{SITENAME}}}}
11661 !! html
11662 <p>This is a test template with parameter MediaWiki
11663 </p>
11664 !! end
11665
11666 !! article
11667 Template:linktest
11668 !! text
11669 [[{{{param}}}|link]]
11670 !! endarticle
11671
11672 !! test
11673 Template parameter as link source
11674 !! wikitext
11675 {{linktest|param=Main Page}}
11676 !! html
11677 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11678 </p>
11679 !! end
11680
11681 !!article
11682 Template:paramtest2
11683 !! text
11684 including another template, {{paramtest|param={{{arg}}}}}
11685 !! endarticle
11686
11687 !! test
11688 Template passing argument to another template
11689 !! wikitext
11690 {{paramtest2|arg='hmm'}}
11691 !! html
11692 <p>including another template, This is a test template with parameter 'hmm'
11693 </p>
11694 !! end
11695
11696 !! article
11697 Template:Linktest2
11698 !! text
11699 Main Page
11700 !! endarticle
11701
11702 !! test
11703 Template as link source
11704 !! wikitext
11705 [[{{linktest2}}]]
11706
11707 [[{{linktest2}}|Main Page]]
11708
11709 [[{{linktest2}}]]Page
11710 !! html
11711 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11712 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11713 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11714 </p>
11715 !! end
11716
11717
11718 !! article
11719 Template:loop1
11720 !! text
11721 {{loop2}}
11722 !! endarticle
11723
11724 !! article
11725 Template:loop2
11726 !! text
11727 {{loop1}}
11728 !! endarticle
11729
11730 !! test
11731 Template infinite loop
11732 !! wikitext
11733 {{loop1}}
11734 !! html
11735 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11736 </p>
11737 !! end
11738
11739 !! test
11740 Template from main namespace
11741 !! wikitext
11742 {{:Main Page}}
11743 !! html
11744 <p>blah blah
11745 </p>
11746 !! end
11747
11748 !! test
11749 Template from non-includable namespace
11750 !! options
11751 wgNonincludableNamespaces=10
11752 !! wikitext
11753 {{echo|uh oh!}}
11754 !! html
11755 <p><a href="/wiki/Template:Echo" title="Template:Echo">Template:Echo</a>
11756 </p>
11757 !! end
11758
11759 !! article
11760 Template:table
11761 !! text
11762 {|
11763 | 1 || 2
11764 |-
11765 | 3 || 4
11766 |}
11767 !! endarticle
11768
11769 !! test
11770 T2529: Template with table, not included at beginning of line
11771 !! wikitext
11772 foo {{table}}
11773 !! html
11774 <p>foo
11775 </p>
11776 <table>
11777 <tr>
11778 <td>1</td>
11779 <td>2
11780 </td></tr>
11781 <tr>
11782 <td>3</td>
11783 <td>4
11784 </td></tr></table>
11785 !! end
11786
11787 !! test
11788 T2523: Template shouldn't eat newline (or add an extra one before table)
11789 !! wikitext
11790 foo
11791 {{table}}
11792 !! html
11793 <p>foo
11794 </p>
11795 <table>
11796 <tr>
11797 <td>1</td>
11798 <td>2
11799 </td></tr>
11800 <tr>
11801 <td>3</td>
11802 <td>4
11803 </td></tr></table>
11804 !! end
11805
11806 !! test
11807 T2041: Template parameters shown as broken links
11808 !! wikitext
11809 {{{parameter}}}
11810 !! html
11811 <p>{{{parameter}}}
11812 </p>
11813 !! end
11814
11815 !! test
11816 Template with targets containing wikilinks
11817 !! options
11818 parsoid=wt2html
11819 !! wikitext
11820 {{[[foo]]}}
11821
11822 {{[[{{echo|foo}}]]}}
11823
11824 {{{{echo|[[foo}}]]}}
11825 !! html/php
11826 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11827 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11828 </p><p>{{[[foo}}]]
11829 </p>
11830 !! html/parsoid
11831 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11832 <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>
11833 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11834 !! end
11835
11836 !! article
11837 Template:''
11838 !! text
11839 bar
11840 !! endarticle
11841
11842 !! test
11843 Templates: Double quotes as template target
11844 !! wikitext
11845 foo {{''}} baz
11846 !! html/php
11847 <p>foo bar baz
11848 </p>
11849 !! html/parsoid
11850 <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
11851 </p>
11852 !! end
11853
11854 ## This test is about making sure Parsoid's data-mw is well formed in the
11855 ## face of multiple templates with intersecting and overlapping ranges. The
11856 ## wikitext itself is wretched.
11857 !! test
11858 Templates with intersecting and overlapping ranges
11859 !! wikitext
11860 {|{{echo|
11861 <p>ha</p>}}
11862 {|{{echo|
11863 <p>ho</p>}}
11864 {{echo|{{!}}hi}}
11865 |}
11866 !! html/php+tidy
11867 <p>ha</p><table>
11868
11869 </table><p>ho</p><table>
11870
11871 <tbody><tr>
11872 <td>hi
11873 </td></tr></tbody></table>
11874 !! html/parsoid
11875 <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":""}]]}'>
11876
11877 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11878
11879 <tbody><tr><td>hi</td></tr>
11880 </tbody></table>
11881 !! end
11882
11883 !! article
11884 Template:MSGNW test
11885 !! text
11886 ''None'' of '''this''' should be
11887 * interpreted
11888 but rather passed unmodified
11889 {{test}}
11890 <gallery>
11891 File:Foobar.jpg
11892 </gallery>
11893 <!-- comment -->
11894 !! endarticle
11895
11896 # hmm, fix this or just deprecate msgnw and document its behavior?
11897 !! test
11898 msgnw keyword
11899 !! wikitext
11900 {{msgnw:MSGNW test}}
11901 !! html/php
11902 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11903 &#42; interpreted
11904 &#32;but rather passed unmodified
11905 &#123;&#123;test&#125;&#125;
11906 &#60;gallery&#62;
11907 File:Foobar.jpg
11908 &#60;/gallery&#62;
11909 &#60;!-- comment --&#62;
11910 </p>
11911 !! end
11912
11913 !! test
11914 int keyword
11915 !! wikitext
11916 {{int:youhavenewmessages|lots of money|not!}}
11917 !! html
11918 <p>You have lots of money (not!).
11919 </p>
11920 !! end
11921
11922 !! test
11923 int keyword - non-existing message
11924 !! wikitext
11925 {{int:var}}
11926 !! html
11927 <p>⧼var⧽
11928 </p>
11929 !! end
11930
11931 !! article
11932 Template:Includes
11933 !! text
11934 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11935 !! endarticle
11936
11937 !! test
11938 <includeonly> and <noinclude> being included
11939 !! wikitext
11940 {{Includes}}
11941 !! html
11942 <p>Foobar
11943 </p>
11944 !! end
11945
11946 !! article
11947 Template:Includes2
11948 !! text
11949 <onlyinclude>Foo</onlyinclude>bar
11950 !! endarticle
11951
11952 !! test
11953 <onlyinclude> being included
11954 !! wikitext
11955 {{Includes2}}
11956 !! html
11957 <p>Foo
11958 </p>
11959 !! end
11960
11961
11962 !! article
11963 Template:Includes3
11964 !! text
11965 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11966 !! endarticle
11967
11968 !! test
11969 <onlyinclude> and <includeonly> being included
11970 !! wikitext
11971 {{Includes3}}
11972 !! html
11973 <p>Foo
11974 </p>
11975 !! end
11976
11977 # FIXME: Parsoid's markup for this is quite ugly.
11978 !! test
11979 <includeonly> and <noinclude> on a page
11980 !! wikitext
11981 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11982 !! html/php+tidy
11983 <p>Foozar
11984 </p>
11985 !! html/parsoid
11986 <p>Foo<meta typeof="mw:Includes/NoInclude" data-parsoid="{}"/>zar</p><meta typeof="mw:Includes/NoInclude/End" data-parsoid="{}"/><meta typeof="mw:Includes/IncludeOnly" data-mw='{"src":"&lt;includeonly>bar&lt;/includeonly>"}' data-parsoid="{}"/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid="{}"/>
11987 !! end
11988
11989 !! test
11990 Un-closed <noinclude>
11991 !! wikitext
11992 <noinclude>
11993 !! html
11994 !! end
11995
11996 !! test
11997 <onlyinclude> on a page
11998 !! wikitext
11999 <onlyinclude>Foo</onlyinclude>bar
12000 !! html
12001 <p>Foobar
12002 </p>
12003 !! end
12004
12005 !! test
12006 Un-closed <onlyinclude>
12007 !! wikitext
12008 <onlyinclude>
12009 !! html
12010 !! end
12011
12012 !!test
12013 Self-closed noinclude, includeonly, onlyinclude tags
12014 !! wikitext
12015 <noinclude />
12016 <includeonly />
12017 <onlyinclude />
12018 !! html
12019 <p><br />
12020 </p>
12021 !!end
12022
12023 !!test
12024 Unbalanced includeonly and noinclude tags
12025 !! wikitext
12026 {|
12027 |a</noinclude>
12028 |b</noinclude></noinclude>
12029 |c</noinclude></includeonly>
12030 |d</includeonly></includeonly>
12031 |}
12032 !! html
12033 <table>
12034 <tr>
12035 <td>a
12036 </td>
12037 <td>b
12038 </td>
12039 <td>c&lt;/includeonly&gt;
12040 </td>
12041 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
12042 </td></tr></table>
12043 !!end
12044
12045 !! article
12046 Template:Includeonly section
12047 !! text
12048 <includeonly>
12049 ==Includeonly section==
12050 </includeonly>
12051 ==Section T-1==
12052 !!endarticle
12053
12054 !! test
12055 T8563: Edit link generation for section shown by <includeonly>
12056 !! wikitext
12057 {{includeonly section}}
12058 !! html
12059 <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>
12060 <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>
12061 !! end
12062
12063 # Uses same input as the contents of [[Template:Includeonly section]]
12064 !! test
12065 T8563: Section extraction for section shown by <includeonly>
12066 !! options
12067 section=T-2
12068 !! wikitext
12069 <includeonly>
12070 ==Includeonly section==
12071 </includeonly>
12072 ==Section T-2==
12073 !! html
12074 ==Section T-2==
12075 !! end
12076
12077 !! test
12078 T8563: Edit link generation for section suppressed by <includeonly>
12079 !! wikitext
12080 <includeonly>
12081 ==Includeonly section==
12082 </includeonly>
12083 ==Section 1==
12084 !! html
12085 <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>
12086 !! end
12087
12088 !! test
12089 T8563: Section extraction for section suppressed by <includeonly>
12090 !! options
12091 section=1
12092 !! wikitext
12093 <includeonly>
12094 ==Includeonly section==
12095 </includeonly>
12096 ==Section 1==
12097 !! html
12098 ==Section 1==
12099 !! end
12100
12101 !! test
12102 Un-closed <includeonly>
12103 !! wikitext
12104 <includeonly>
12105 !! html/php
12106 !! html/parsoid
12107 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}' data-mw='{"src":"&lt;includeonly>"}'/>
12108 !! end
12109
12110 ## We used to, but no longer wt2wt this test since the default serializer
12111 ## will normalize the include directives to serialize on their own line.
12112 ## Selser will take care of preserving formatting in scenarios where they
12113 ## intermingled with other wikitext.
12114 !! test
12115 Includes and comments at SOL
12116 !! options
12117 parsoid=wt2html,html2html
12118 !! wikitext
12119 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
12120
12121 <noinclude>
12122 some
12123 </noinclude>*stuff
12124 *here
12125
12126 <noinclude>
12127 some</noinclude>* stuff
12128 * here
12129
12130 <includeonly>can have stuff</includeonly>===here===
12131
12132 !! html/php
12133 <h2><span class="mw-headline" id="hu">hu</span></h2>
12134 <p>some
12135 </p>
12136 <ul><li>stuff</li>
12137 <li>here</li></ul>
12138 <p><br />
12139 some* stuff
12140 </p>
12141 <ul><li>here</li></ul>
12142 <h3><span class="mw-headline" id="here">here</span></h3>
12143 !! html/parsoid
12144 <!-- 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>
12145
12146 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12147 <p>some</p>
12148 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
12149 <li>here</li></ul>
12150
12151 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12152 <p>some<meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>* stuff</p>
12153 <ul><li>here</li></ul>
12154
12155 <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>
12156 !! end
12157
12158 # TODO: test with DOM fragment reuse!
12159 !! test
12160 Parsoid: DOM fragment reuse
12161 !! options
12162 parsoid=wt2wt,wt2html
12163 !! wikitext
12164 a{{echo|b<table></table>c}}d
12165
12166 a{{echo|b
12167 <table></table>
12168 c}}d
12169
12170 {{echo|a
12171
12172 <table></table>
12173
12174 b}}
12175 !! html/php+tidy
12176 <p>ab</p><table></table><p>cd
12177 </p><p>ab
12178 </p>
12179 <table></table>
12180 <p>cd
12181 </p><p>a
12182 </p>
12183 <table></table>
12184 <p>b
12185 </p>
12186 !! html/parsoid
12187 <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>
12188
12189 <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">
12190 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
12191 </span><p about="#mwt2">cd</p>
12192
12193 <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">
12194
12195 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
12196
12197 </span><p about="#mwt3">b</p>
12198 !! end
12199
12200 !! test
12201 Parsoid: Merge double tds (T52603)
12202 !! wikitext
12203 {|
12204 |{{echo|{{!}} foo}}
12205 |}
12206 !! html/php+tidy
12207 <table>
12208 <tbody><tr>
12209 <td>foo
12210 </td></tr></tbody></table>
12211 !! html/parsoid
12212 <table><tbody>
12213 <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>
12214 </tbody></table>
12215 !! end
12216
12217 !! test
12218 Parsoid: Merge double tds in nested transclusion content (T52603)
12219 !! wikitext
12220 {{echo|<div>}}
12221 {|
12222 |{{echo|{{!}} foo}}
12223 |}
12224 {{echo|</div>}}
12225 !! html/php+tidy
12226 <div>
12227 <table>
12228 <tbody><tr>
12229 <td>foo
12230 </td></tr></tbody></table>
12231 </div>
12232 !! html/parsoid
12233 <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}}]}'>
12234 <table><tbody>
12235 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
12236 </tbody></table>
12237 </div>
12238 !! end
12239
12240 ###
12241 ### <includeonly> and <noinclude> in attributes
12242 ###
12243 !!test
12244 0. includeonly around the entire attribute
12245 !! wikitext
12246 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12247 !! html
12248 <p><span id="v2">bar</span>
12249 </p>
12250 !!end
12251
12252 !!test
12253 1. includeonly in html attr key
12254 !! wikitext
12255 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12256 !! html
12257 <p><span id="foo">bar</span>
12258 </p>
12259 !!end
12260
12261 !!test
12262 2. includeonly in html attr value
12263 !! wikitext
12264 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12265 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12266 !! html
12267 <p><span id="v1">bar</span>
12268 <span id="v1">bar</span>
12269 </p>
12270 !!end
12271
12272 !!test
12273 3. includeonly in part of an attr value
12274 !! wikitext
12275 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12276 !! html
12277 <p><span style="color:red;">bar</span>
12278 </p>
12279 !!end
12280
12281 !!test
12282 4. includeonly in table attributes
12283 !! wikitext
12284 {|
12285 |- <noinclude>
12286 |-
12287 |a
12288 </noinclude>
12289 |- <includeonly>
12290 |-
12291 |b
12292 </includeonly>
12293 |}
12294 !! html
12295 <table>
12296
12297
12298 <tr>
12299 <td>a
12300 </td></tr>
12301 </table>
12302 !!end
12303
12304 ###
12305 ### Preprocessor precedence tests
12306 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12307 ###
12308 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12309 !! test
12310 Preprocessor precedence 1: link is rightmost opening
12311 !! options
12312 parsoid=wt2html
12313 !! wikitext
12314 {{[[Foo|bar}}]]
12315
12316 But close-brace is not a valid character in a link title:
12317 {{[[Foo}}|bar]]
12318
12319 However, we can still tell this was handled as a link in the preprocessor:
12320 {{echo|[[Foo}}|bar]]|bat}}
12321 !! html/php
12322 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12323 </p><p>But close-brace is not a valid character in a link title:
12324 {{[[Foo}}|bar]]
12325 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12326 [[Foo}}|bar]]
12327 </p>
12328 !! html/parsoid
12329 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12330 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12331 <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>
12332 !! end
12333
12334 !! test
12335 Preprocessor precedence 2: template is rightmost opening
12336 !! options
12337 language=zh
12338 !! wikitext
12339 -{{echo|foo}-}}-
12340 !! html/php
12341 <p>-foo}--
12342 </p>
12343 !! html/parsoid
12344 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12345 !! end
12346
12347 !! test
12348 Preprocessor precedence 3: language converter is rightmost opening
12349 !! options
12350 language=zh
12351 parsoid=wt2html
12352 !! wikitext
12353 {{echo|hi}}
12354
12355 {{-{R|echo|hi}}}-
12356
12357 [[-{R|raw]]}-
12358 !! html/php
12359 <p>hi
12360 </p><p>{{echo|hi}}
12361 </p><p>[[raw]]
12362 </p>
12363 !! html/parsoid
12364 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12365 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12366 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12367 !! end
12368
12369 !! test
12370 Preprocessor precedence 4: left-most angle bracket
12371 !! options
12372 language=zh
12373 !! wikitext
12374 <!--{raw}-->
12375 !! html/php
12376 !! html/parsoid
12377 <!--{raw}-->
12378 !! end
12379
12380 !! article
12381 Template:Precedence5
12382 !! text
12383 {{{{{1}}}}}
12384 !! endarticle
12385
12386 !! test
12387 Preprocessor precedence 5: tplarg takes precedence over template
12388 !! wikitext
12389 {{Precedence5|Bullet}}
12390 !! html/php
12391 <ul><li>Bar</li></ul>
12392 !! html/parsoid
12393 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12394 !! end
12395
12396 !! test
12397 Preprocessor precedence 6: broken link is rightmost opening
12398 !! options
12399 parsoid=wt2html
12400 !! wikitext
12401 {{echo|[[Foo}}
12402
12403 {{echo|[[Foo|bar|bat=baz}}
12404 !! html/php
12405 <p>{{echo|[[Foo}}
12406 </p><p>{{echo|[[Foo|bar|bat=baz}}
12407 </p>
12408 !! html/parsoid
12409 <p>{{echo|[[Foo}}</p>
12410 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12411 !! end
12412
12413 # This next test exposes a difference between PHP and Parsoid:
12414 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12415 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12416 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12417 # outer `[[Foo` extends until the `y]]`
12418 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12419 # intermediate result (after template expansion), and link processing
12420 # happens on this intermediate result, which moves the wikilink
12421 # boundary leftward to `[[Foo|Bar]]`
12422 # 2b) Parsoid works in a single step, so it's going to keep the
12423 # wikilink as extending to the `y]]`
12424 # 3a) Then PHP does linktrail processing which slurps up the trailing
12425 # `xy` inside the link.
12426 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12427 # `z` inside the link.
12428 # This is "correct" behavior. Parsoid's basic worldview is that the
12429 # `]]` inside the template shouldn't be allowed to leak out to affect
12430 # the surrounding wikilink. PHP may match Parsoid (in the future)
12431 # if you use {{#balance}} (T114445).
12432
12433 !! test
12434 Preprocessor precedence 7: broken template is rightmost opening
12435 !! options
12436 parsoid=wt2html
12437 !! wikitext
12438 [[Foo|{{echo|Bar]]
12439
12440 [[Foo|{{echo|Bar]]-x}}-y]]-z
12441
12442 Careful: linktrails can move the end of the wikilink:
12443 [[Foo|{{echo|y']]a}}l]]l
12444 !! html/php
12445 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12446 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12447 </p><p>Careful: linktrails can move the end of the wikilink:
12448 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12449 </p>
12450 !! html/parsoid
12451 <p>[[Foo|{{echo|Bar]]</p>
12452 <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>
12453 <p>Careful: linktrails can move the end of the wikilink:
12454 <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>
12455 !! end
12456
12457 !! test
12458 Preprocessor precedence 8: broken language converter is rightmost opening
12459 !! options
12460 language=zh
12461 !! wikitext
12462 [[Foo-{R|raw]]
12463 !! html
12464 <p>[[Foo-{R|raw]]
12465 </p>
12466 !! end
12467
12468 !! article
12469 Template:Preprocessor_precedence_9
12470 !! text
12471 ;4: {{{{1}}}}
12472 ;5: {{{{{2}}}}}
12473 ;6: {{{{{{3}}}}}}
12474 ;7: {{{{{{{4}}}}}}}
12475 !! endarticle
12476
12477 !! test
12478 Preprocessor precedence 9: groups of braces
12479 !! wikitext
12480 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12481 !! html/php
12482 <dl><dt>4</dt>
12483 <dd>{Four}</dd>
12484 <dt>5</dt>
12485 <dd></dd></dl>
12486 <ul><li>Bar</li></ul>
12487 <dl><dt>6</dt>
12488 <dd>Four</dd>
12489 <dt>7</dt>
12490 <dd>{Bullet}</dd></dl>
12491 !! html/parsoid
12492 <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}}]}'>
12493 <dt>4</dt>
12494 <dd>{Four}</dd>
12495 <dt>5</dt>
12496 <dd></dd>
12497 </dl><ul about="#mwt1">
12498 <li>Bar</li>
12499 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12500 <dt>6</dt>
12501 <dd>Four</dd>
12502 <dt>7</dt>
12503 <dd>{Bullet}</dd>
12504 </dl>
12505 !! end
12506
12507 !! article
12508 Template:Preprocessor_precedence_10
12509 !! text
12510 ;1: -{R|raw}-
12511 ;2: -{{Bullet}}-
12512 ;3: -{{{1}}}-
12513 ;4: -{{{{2}}}}-
12514 ;5: -{{{{{3}}}}}-
12515 ;6: -{{{{{{4}}}}}}-
12516 ;7: -{{{{{{{5}}}}}}}-
12517 !! endarticle
12518
12519 !! test
12520 Preprocessor precedence 10: groups of braces with leading dash
12521 !! options
12522 language=zh
12523 !! wikitext
12524 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12525 !! html/php
12526 <dl><dt>1</dt>
12527 <dd>raw</dd>
12528 <dt>2</dt>
12529 <dd>-</dd></dl>
12530 <ul><li>Bar-</li></ul>
12531 <dl><dt>3</dt>
12532 <dd>-Three-</dd>
12533 <dt>4</dt>
12534 <dd>raw2</dd>
12535 <dt>5</dt>
12536 <dd>-</dd></dl>
12537 <ul><li>Bar-</li></ul>
12538 <dl><dt>6</dt>
12539 <dd>-Three-</dd>
12540 <dt>7</dt>
12541 <dd>raw2</dd></dl>
12542 !! html/parsoid
12543 <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}}]}'>
12544 <dt>1</dt>
12545 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12546 <dt>2</dt>
12547 <dd>-</dd>
12548 </dl><ul about="#mwt1">
12549 <li>Bar-</li>
12550 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12551 <dt>3</dt>
12552 <dd>-Three-</dd>
12553 <dt>4</dt>
12554 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12555 <dt>5</dt>
12556 <dd>-</dd>
12557 </dl><ul about="#mwt1">
12558 <li>Bar-</li>
12559 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12560 <dt>6</dt>
12561 <dd>-Three-</dd>
12562 <dt>7</dt>
12563 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12564 </dl>
12565 !! end
12566
12567 !! test
12568 Preprocessor precedence 11: found during visual diff testing
12569 !! wikitext
12570 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12571
12572 {{echo|-{{echo|-{{echo|x}}}}}}
12573
12574 {{echo|-{{echo|x}}}}
12575 !! html/php
12576 <p><span>-<span>-x</span></span>
12577 </p><p>--x
12578 </p><p>-x
12579 </p>
12580 !! html/parsoid
12581 <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>
12582
12583 <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>
12584
12585 <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>
12586 !! end
12587
12588 !! test
12589 Preprocessor precedence 12: broken language converter closed by brace.
12590 !! options
12591 parsoid=wt2html
12592 !! wikitext
12593 This form breaks the template, which is unfortunate:
12594 *{{echo|foo-{bar}bat}}
12595
12596 But if the broken language converter markup is inside an extension
12597 tag, nothing bad happens:
12598 *<nowiki>foo-{bar}bat</nowiki>
12599 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12600 *<pre>foo-{bar}bat</pre>
12601 *{{echo|<pre>foo-{bar}bat</pre>}}
12602
12603 <tag>foo-{bar}bat</tag>
12604 {{echo|<tag>foo-{bar}bat</tag>}}
12605
12606 !! html/php+tidy
12607 <p>This form breaks the template, which is unfortunate:
12608 </p>
12609 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12610 <p>But if the broken language converter markup is inside an extension
12611 tag, nothing bad happens:
12612 </p>
12613 <ul><li>foo-&#123;bar}bat</li>
12614 <li>foo-&#123;bar}bat</li>
12615 <li><pre>foo-{bar}bat</pre></li>
12616 <li><pre>foo-{bar}bat</pre></li></ul>
12617 <pre>'foo-{bar}bat'
12618 array (
12619 )
12620 </pre>
12621 <pre>'foo-{bar}bat'
12622 array (
12623 )
12624 </pre>
12625 !! html/parsoid
12626 <p>This form breaks the template, which is unfortunate:</p>
12627 <ul>
12628 <li>{{echo|foo-{bar}bat}}</li>
12629 </ul>
12630 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12631 <ul>
12632 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12633 <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>
12634 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12635 <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>
12636 </ul>
12637 <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>
12638 !! end
12639
12640 !! test
12641 Preprocessor precedence 13: broken language converter in external link
12642 !! options
12643 parsoid=wt2html
12644 !! wikitext
12645 *[http://example.com/-{foo Example in URL]
12646 *[http://example.com Example in -{link} description]
12647 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12648 !! html/php+tidy
12649 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12650 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12651 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12652 !! html/parsoid
12653 <ul>
12654 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12655 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12656 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12657 </ul>
12658 !! end
12659
12660 !! test
12661 Preprocessor precedence 14: broken language converter in comment
12662 !! wikitext
12663 *<!--{{foo}}-->...should be ok
12664 *<!---{{foo}}-->...extra dashes
12665 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12666 !! html/php+tidy
12667 <ul><li>...should be ok</li>
12668 <li>...extra dashes</li>
12669 <li>foobat...should be ok</li></ul>
12670 !! html/parsoid
12671 <ul>
12672 <li><!--{{foo}}-->...should be ok</li>
12673 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12674 <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>
12675 </ul>
12676 !! end
12677
12678 !! test
12679 Preprocessor precedence 15: broken brace markup in headings
12680 !! config
12681 wgFragmentMode=[ 'html5', 'legacy' ]
12682 !! options
12683 parsoid=wt2html
12684 !! wikitext
12685 __NOTOC__ __NOEDITSECTION__
12686 ===1 foo[bar 1===
12687 1
12688 ===2 foo[[bar 2===
12689 2
12690 ===3 foo{bar 3===
12691 3
12692 ===4 foo{{bar 4===
12693 4
12694 ===5 foo{{{bar 5===
12695 5
12696 ===6 foo-{bar 6===
12697 6
12698 !! html/php+tidy
12699 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12700 <p>1
12701 </p>
12702 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12703 <p>2
12704 </p>
12705 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12706 <p>3
12707 </p>
12708 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12709 <p>4
12710 </p>
12711 <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>
12712 <p>5
12713 </p>
12714 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12715 <p>6
12716 </p>
12717 !! html/parsoid
12718 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12719 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12720 <p>1</p>
12721 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12722 <p>2</p>
12723 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12724 <p>3</p>
12725 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12726 <p>4</p>
12727 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12728 <p>5</p>
12729 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12730 <p>6</p>
12731 !! end
12732
12733 !! test
12734 Preprocessor precedence 16: matching closing braces to opening braces
12735 !! options
12736 language=zh
12737 parsoid=wt2html
12738 !! wikitext
12739 -{{{echo|foo}}bar}-
12740 !! html/php
12741 <p>foobar
12742 </p>
12743 !! html/parsoid
12744 <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>
12745 !! end
12746
12747 !! test
12748 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12749 !! options
12750 parsoid=wt2html
12751 !! wikitext
12752 {{echo|hi {{}}}}
12753 !! html/php
12754 <p>hi {{}}
12755 </p>
12756 !! html/parsoid
12757 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12758 !! end
12759
12760 # Ensure we're using a language without variants for this test; even
12761 # if $wgUsePigLatinVariant is true. We've picked `de` arbitrarily.
12762 !! test
12763 Preprocessor precedence 18: another rightmost wins scenario
12764 !! options
12765 parsoid=wt2html
12766 language=de
12767 !! wikitext
12768 {{ -{{{{1|tplarg}}} }} }-
12769 !! html/php
12770 <p>{{ -{tplarg }} }-
12771 </p>
12772 !! html/parsoid
12773 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12774 !! end
12775
12776 !! test
12777 Preprocessor precedence 19: break syntax
12778 !! options
12779 parsoid=wt2html
12780 !! wikitext
12781 -{{
12782 !! html/php
12783 <p>-{{
12784 </p>
12785 !! html/parsoid
12786 <p>-{{</p>
12787 !! end
12788
12789 ###
12790 ### Token Stream Patcher tests
12791 ###
12792 ### These tests won't always pass wt2wt and other modes because
12793 ### on serialization, the table will be output on a new line.
12794 ### For now, we are blacklisting them, and using this to test selser.
12795 ###
12796
12797 !!test
12798 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12799 !!options
12800 parsoid=wt2html,wt2wt
12801 !!wikitext
12802 {{echo|}}{| width = '100%'
12803 |foo
12804 |}
12805 !!html/parsoid
12806 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12807 <tbody><tr><td>foo</td></tr>
12808 </tbody></table>
12809 !!end
12810
12811 ## We used to, but no longer wt2wt this test since the default serializer
12812 ## will normalize the include directives to serialize on their own line.
12813 ## Selser will take care of preserving formatting in scenarios where they
12814 ## intermingled with other wikitext.
12815 !!test
12816 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12817 !!options
12818 parsoid=wt2html
12819 !!wikitext
12820 <includeonly>a</includeonly>{| {{{b}}}
12821 |c
12822 |}
12823 !!html/parsoid
12824 <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":""}]]}'>
12825 <tbody><tr><td>c</td></tr>
12826 </tbody></table>
12827 !!end
12828
12829 !! test
12830 Table wikitext syntax outside wiki-tables
12831 !! wikitext
12832 a
12833 |+ not a caption
12834 ! not a table heading
12835 |- not a table row
12836 | not a table cell
12837 | class="foo bar" | baz
12838 b
12839 |}
12840 |-
12841 c
12842 !! html
12843 <p>a
12844 |+ not a caption
12845 ! not a table heading
12846 |- not a table row
12847 | not a table cell
12848 | class="foo bar" | baz
12849 b
12850 |}
12851 |-
12852 c
12853 </p>
12854 !! end
12855
12856 ###
12857 ### Testing parsing of templates where a template arg
12858 ### has the same name as the template itself.
12859 ###
12860
12861 !! article
12862 Template:quote
12863 !! text
12864 {{{quote|{{{1}}}}}}
12865 !! endarticle
12866
12867 !!test
12868 Templates: Template Name/Arg clash: 1. Use of positional param
12869 !! wikitext
12870 {{quote|foo}}
12871 !! html
12872 <p>foo
12873 </p>
12874 !!end
12875
12876 !!test
12877 Templates: Template Name/Arg clash: 2. Use of named param
12878 !! wikitext
12879 {{quote|quote=foo}}
12880 !! html
12881 <p>foo
12882 </p>
12883 !!end
12884
12885 !!test
12886 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12887 !! wikitext
12888 {{quote|quote}}
12889 !! html
12890 <p>quote
12891 </p>
12892 !!end
12893
12894 ###
12895 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12896 ###
12897
12898 !!test
12899 Templates: 1. Simple use
12900 !! wikitext
12901 {{echo|Foo}}
12902 !! html
12903 <p>Foo
12904 </p>
12905 !!end
12906
12907 !!test
12908 Templates: 2. Inside a block tag
12909 !! wikitext
12910 <div>{{echo|Foo}}</div>
12911 <blockquote>{{echo|Foo}}</blockquote>
12912 !! html
12913 <div>Foo</div>
12914 <blockquote>Foo</blockquote>
12915 !! html+tidy
12916 <div>Foo</div>
12917 <blockquote><p>Foo</p></blockquote>
12918 !!end
12919
12920 !!test
12921 Templates: P-wrapping: 1a. Templates on consecutive lines
12922 !! wikitext
12923 {{echo|Foo}}
12924 {{echo|bar}}
12925 !! html
12926 <p>Foo
12927 bar
12928 </p>
12929 !!end
12930
12931 !!test
12932 Templates: P-wrapping: 1b. Templates on consecutive lines
12933 !! wikitext
12934 Foo
12935
12936 {{echo|bar}}
12937 {{echo|baz}}
12938 !! html
12939 <p>Foo
12940 </p><p>bar
12941 baz
12942 </p>
12943 !!end
12944
12945 !!test
12946 Templates: P-wrapping: 1c. Templates on consecutive lines
12947 !! wikitext
12948 {{echo|Foo}}
12949 {{echo|bar}} <div>baz</div>
12950 !! html
12951 <p>Foo
12952 </p>
12953 bar <div>baz</div>
12954 !! html+tidy
12955 <p>Foo
12956 </p><p>
12957 bar </p><div>baz</div>
12958 !! end
12959
12960 !! test
12961 Templates: P-wrapping: 1d. Template preceded by comment-only line
12962 !! wikitext
12963 <!-- foo -->
12964 {{echo|Bar}}
12965 !! html/php+tidy
12966 <p>Bar
12967 </p>
12968 !! html/parsoid
12969 <!-- foo -->
12970
12971 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12972 !!end
12973
12974 !! test
12975 Templates: Scopes should not be expanded unnecessarily
12976 !! options
12977 parsoid=wt2html,wt2wt
12978 !! wikitext
12979 {{echo|<div>a</div>}}b{{echo|
12980 <div>c</div>}}
12981 !! html/php+tidy
12982 <div>a</div><p>b
12983 </p><div>c</div>
12984 !! html/parsoid
12985 <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}}]}'>
12986 </span><div about="#mwt2">c</div>
12987 !! end
12988
12989 !!test
12990 Templates: Inline Text: 1. Multiple template uses
12991 !! wikitext
12992 {{echo|Foo}}bar{{echo|baz}}
12993 !! html
12994 <p>Foobarbaz
12995 </p>
12996 !!end
12997
12998 !!test
12999 Templates: Inline Text: 2. Back-to-back template uses
13000 !! wikitext
13001 {{echo|Foo}}{{echo|bar}}
13002 !! html
13003 <p>Foobar
13004 </p>
13005 !!end
13006
13007 !!test
13008 Templates: Block Tags: 1. Multiple template uses
13009 !! wikitext
13010 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
13011 !! html
13012 <div>Foo</div><div>bar</div><div>baz</div>
13013 !!end
13014
13015 !!test
13016 Templates: Block Tags: 2. Back-to-back template uses
13017 !! wikitext
13018 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
13019 !! html
13020 <div>Foo</div><div>bar</div>
13021 !!end
13022
13023 ## Parsoid drops empty elements in templates.
13024 !! test
13025 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
13026 !! wikitext
13027 {{echo|a
13028 b</p>}}
13029 !! html/php+tidy
13030 <p>a
13031 </p><p>
13032 b</p><p class="mw-empty-elt"></p>
13033 !! html/parsoid
13034 <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">
13035 </span><p about="#mwt1">b</p>
13036 !! end
13037
13038 !!test
13039 Templates: Links: 1. Simple example
13040 !! wikitext
13041 {{echo|[[Foo|bar]]}}
13042 !! html
13043 <p><a href="/wiki/Foo" title="Foo">bar</a>
13044 </p>
13045 !!end
13046
13047 !!test
13048 Templates: Links: 2. Generation of link href
13049 !! wikitext
13050 [[{{echo|Foo}}|bar]]
13051 !! html
13052 <p><a href="/wiki/Foo" title="Foo">bar</a>
13053 </p>
13054 !!end
13055
13056 !!test
13057 Templates: Links: 3. Generation of part of a link href
13058 !! wikitext
13059 [[Fo{{echo|o}}|bar]]
13060
13061 [[Foo{{echo|bar}}]]
13062
13063 [[Foo{{echo|bar}}baz]]
13064
13065 [[Foo{{echo|bar}}|bar]]
13066
13067 [[:Foo{{echo|bar}}]]
13068
13069 [[:Foo{{echo|bar}}|bar]]
13070 !! html
13071 <p><a href="/wiki/Foo" title="Foo">bar</a>
13072 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13073 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
13074 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13075 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13076 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13077 </p>
13078 !!end
13079
13080 !!test
13081 Templates: Links: 4. Multiple templates generating link href
13082 !! wikitext
13083 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
13084 !! html
13085 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13086 </p>
13087 !!end
13088
13089 !!test
13090 Templates: Links: 5. Generation of link text
13091 !! wikitext
13092 [[Foo|{{echo|bar}}]]
13093 !! html
13094 <p><a href="/wiki/Foo" title="Foo">bar</a>
13095 </p>
13096 !!end
13097
13098 !!test
13099 Templates: Links: 5. Nested templates (only outermost template should be marked)
13100 !! wikitext
13101 {{echo|[[{{echo|Foo}}|bar]]}}
13102 !! html
13103 <p><a href="/wiki/Foo" title="Foo">bar</a>
13104 </p>
13105 !!end
13106
13107 !! test
13108 File with template filename
13109 !! wikitext
13110 [[File:{{echo|Foobar.jpg}}]]
13111 !! html/parsoid
13112 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"href"},{"html":"File:&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[7,26,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foobar.jpg\"}},\"i\":0}}]}&apos;>Foobar.jpg&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:{{echo|Foobar.jpg}}"}}'/></a></figure-inline></p>
13113 !! end
13114
13115 !!test
13116 Templates: HTML Tag: 1. Generation of HTML attr. key
13117 !! wikitext
13118 <div {{echo|style}}="color:red;">foo</div>
13119 !! html
13120 <div style="color:red;">foo</div>
13121 !!end
13122
13123 !!test
13124 Templates: HTML Tag: 2. Generation of HTML attr. value
13125 !! wikitext
13126 <div style={{echo|'color:red;'}}>foo</div>
13127 !! html
13128 <div style="color:red;">foo</div>
13129 !!end
13130
13131 !!test
13132 Templates: HTML Tag: 3. Generation of HTML attr key and value
13133 !! wikitext
13134 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
13135 !! html
13136 <div style="color:red;">foo</div>
13137 !!end
13138
13139 !!test
13140 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
13141 !! wikitext
13142 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
13143 !! html
13144 <div title="This is a long title with just one piece templated">foo</div>
13145 !!end
13146
13147 !!test
13148 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
13149 !! wikitext
13150 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
13151 !! html
13152 <div title="This is a long title with just one piece templated">foo</div>
13153 !!end
13154
13155 !!test
13156 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
13157 !! wikitext
13158 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
13159 !! html
13160 <div title="This is a long title with just one piece templated">foo</div>
13161 !!end
13162
13163 # SSS FIXME: While it is great we added support for all this,
13164 # do we want to make this part of the spec? Maybe we want to
13165 # deprecate this kind of usage in the future?
13166 !!test
13167 Templates: HTML Tag: 7. Generation of partial attribute key string
13168 !! wikitext
13169 <div st{{echo|yle}}="color:red;">foo</div>
13170 !! html
13171 <div style="color:red;">foo</div>
13172 !!end
13173
13174 !! test
13175 Templates: HTML Tag: 8. Template-generated attribute (k=v)
13176 !! wikitext
13177 <div {{echo|1=id="v1"}}>bar</div>
13178 !! html
13179 <div id="v1">bar</div>
13180 !!end
13181
13182 !! test
13183 Templates: HTML Tag: 9. Multiple template-generated attributes
13184 !! wikitext
13185 <div {{echo|1=id="v1" title="foo"}}>bar</div>
13186 !! html
13187 <div id="v1" title="foo">bar</div>
13188 !!end
13189
13190 !! test
13191 Templates: Support for templates generating attributes and content
13192 !! wikitext
13193 {| {{mixed_attr_content_template}}
13194 |-
13195 |bar
13196 |}
13197 !! html/php
13198 <table style="color:red;" title="T48811">
13199
13200 <tr>
13201 <td>foo
13202 </td></tr>
13203 <tr>
13204 <td>bar
13205 </td></tr></table>
13206 !! html/parsoid
13207 <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|}"]}'>
13208 <tbody><tr>
13209 <td>foo</td></tr>
13210 <tr>
13211 <td>bar</td></tr>
13212 </tbody></table>
13213 !!end
13214
13215 !! article
13216 Template:attribute_from_template
13217 !! text
13218 class="123"
13219 !! endarticle
13220
13221 !! test
13222 Table cell with attribute before expanded attribute
13223 !! wikitext
13224 {|
13225 | align="center" {{attribute_from_template}} |456
13226 |}
13227 !! html/parsoid
13228 <table>
13229 <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>
13230 </tbody></table>
13231 !! end
13232
13233 !! test
13234 1. Entities and nowikis inside templated attributes should be handled correctly
13235 !! wikitext
13236 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
13237 !! html/php
13238 <div style="background:#f9f9f9;">foo</div>
13239 !! html/parsoid
13240 <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>
13241 !! end
13242
13243 !! test
13244 2. Entities and nowikis inside templated attributes should be handled correctly
13245 !! wikitext
13246 {|
13247 |{{table_attribs_3}}
13248 |}
13249 !! html/php
13250 <table>
13251 <tr>
13252 <td style="background:#f9f9f9;">Foo
13253 </td></tr></table>
13254 !! html/parsoid
13255 <table>
13256 <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>
13257 </tbody></table>
13258 !! end
13259
13260 !! test
13261 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13262 !! wikitext
13263 {{tbl-start}}
13264 |{{table_attribs_3}}
13265 {{tbl-end}}
13266 !! html/php
13267 <table>
13268 <tr>
13269 <td style="background:#f9f9f9;">Foo
13270 </td></tr></table>
13271 !! html/parsoid
13272 <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}}]}'>
13273 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
13274 </tbody></table>
13275 !! end
13276
13277 # T107622
13278 !! test
13279 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13280 !! wikitext
13281 {|
13282 |{{table_attribs_6}} hi
13283 |}
13284 !! html/php
13285 <table>
13286 <tr>
13287 <td style="background: red;">hi
13288 </td></tr></table>
13289 !! html/parsoid
13290 <table>
13291 <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>
13292 </tbody></table>
13293 !! end
13294
13295 !!test
13296 Templates: HTML Tables: 1. Generating start of a HTML table
13297 !! wikitext
13298 {{echo|<table><tr><td>foo</td>}}</tr></table>
13299 !! html
13300 <table><tr><td>foo</td></tr></table>
13301 !!end
13302
13303 !!test
13304 Templates: HTML Tables: 2a. Generating middle of a HTML table
13305 !! wikitext
13306 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13307 !! html
13308 <table><tr><td>foo</td></tr></table>
13309 !!end
13310
13311 !!test
13312 Templates: HTML Tables: 2b. Generating middle 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: 3. Generating end 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: 4a. Generating a single tag of a HTML table
13329 !! wikitext
13330 {{echo|<table>}}<tr><td>foo</td></tr></table>
13331 !! html
13332 <table><tr><td>foo</td></tr></table>
13333 !! end
13334
13335 !!test
13336 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13337 !! wikitext
13338 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13339 !! html
13340 <table><tr><td>foo</td></tr></table>
13341 !! end
13342
13343 !!test
13344 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13345 !! wikitext
13346 <table><tr>{{echo|<td>}}foo</td></tr></table>
13347 !! html
13348 <table><tr><td>foo</td></tr></table>
13349 !! end
13350
13351 !!test
13352 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13353 !! wikitext
13354 <table><tr><td>foo{{echo|</td>}}</tr></table>
13355 !! html
13356 <table><tr><td>foo</td></tr></table>
13357 !! end
13358
13359 !!test
13360 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13361 !! wikitext
13362 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13363 !! html
13364 <table><tr><td>foo</td></tr></table>
13365 !! end
13366
13367 !!test
13368 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13369 !! wikitext
13370 <table><tr><td>foo</td></tr>{{echo|</table>}}
13371 !! html
13372 <table><tr><td>foo</td></tr></table>
13373 !! end
13374
13375 !!test
13376 Templates: HTML Tables: 5. Proper fostering of categories from inside
13377 !!options
13378 parsoid=wt2html,wt2wt
13379 !! wikitext
13380 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13381 <!--Two categories (T52330)-->
13382 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13383 !! html/php+tidy
13384 <table><tbody><tr><td>foo</td></tr></tbody></table>
13385 <table><tbody><tr><td>foo</td></tr></tbody></table>
13386 !! html/parsoid
13387 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13388 <!--Two categories (T52330)-->
13389 <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>
13390 !!end
13391
13392 ## Remex doesn't account for fostered content.
13393 !! test
13394 Templates: Wiki Tables: 1a. Fostering of entire template content
13395 !! wikitext
13396 {|
13397 {{echo|a}}
13398 |}
13399 !! html/php
13400 <table>
13401 a
13402 <tr><td></td></tr></table>
13403 !! html/php+tidy
13404
13405 a
13406 <table><tbody><tr><td></td></tr></tbody></table>
13407 !! html/parsoid
13408 <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">
13409
13410 </table>
13411 !! end
13412
13413 !!test
13414 Templates: Wiki Tables: 1b. Fostering of entire template content
13415 !! wikitext
13416 {|
13417 {{echo|<div>}}
13418 foo
13419 {{echo|</div>}}
13420 |}
13421 !! html
13422 <table>
13423 <div>
13424 <p>foo
13425 </p>
13426 </div>
13427 <tr><td></td></tr></table>
13428 !! html/php+tidy
13429 <div>
13430 <p>foo
13431 </p>
13432 </div><table>
13433
13434 <tbody><tr><td></td></tr></tbody></table>
13435 !! html/parsoid
13436 <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|}"]}'>
13437 <p>foo</p>
13438 </div><table about="#mwt3">
13439
13440 </table>
13441 !! end
13442
13443 ## Remex doesn't account for fostered content.
13444 !! test
13445 Templates: Wiki Tables: 2. Fostering of partial template content
13446 !! wikitext
13447 {|
13448 {{echo|a
13449 <div>b</div>}}
13450 |}
13451 !! html/php
13452 <table>
13453 a
13454 <div>b</div>
13455 <tr><td></td></tr></table>
13456 !! html/php+tidy
13457
13458 a
13459 <div>b</div><table>
13460 <tbody><tr><td></td></tr></tbody></table>
13461 !! html/parsoid
13462 <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">
13463
13464
13465 </table>
13466 !! end
13467
13468 !!test
13469 Templates: Wiki Tables: 3. td-content via multiple templates
13470 !! wikitext
13471 {|
13472 {{echo|{{pipe}}a}}{{echo|b}}
13473 |}
13474 !! html
13475 <table>
13476 <tr>
13477 <td>ab
13478 </td></tr></table>
13479 !! end
13480
13481 !!test
13482 Templates: Wiki Tables: 4. Templated tags, no content
13483 !! wikitext
13484 {{tbl-start}}
13485 {{tbl-end}}
13486 !! html
13487 <table>
13488 <tr><td></td></tr></table>
13489 !! end
13490
13491 !!test
13492 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13493 !! wikitext
13494 {{tbl-start}}
13495 |foo
13496 {{tbl-end}}
13497 !! html
13498 <table>
13499 <tr>
13500 <td>foo
13501 </td></tr></table>
13502 !! end
13503
13504 !!test
13505 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13506 !! wikitext
13507 {{tbl-start}}
13508 {{!}}foo
13509 {{tbl-end}}
13510 !! html
13511 <table>
13512 <tr>
13513 <td>foo
13514 </td></tr></table>
13515 !! end
13516
13517 ## This test case is very specific to Parsoid's internals
13518 ## and is hence only tested for Parsoid's code. Parsoid uses
13519 ## a <meta> marker tag for <ref> tags and they are expanded
13520 ## much later. We are verifying that this <meta> tag usage
13521 ## doesn't prevent foster parenting.
13522 !! test
13523 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13524 !! wikitext
13525 {{PartialTable}}<ref>foo</ref>
13526 |}
13527
13528 <references />
13529 !! html/parsoid
13530 <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">
13531 <tbody>
13532 </tbody></table>
13533
13534 <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>
13535 !! end
13536
13537 !! test
13538 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13539 !! wikitext
13540 {{echo|
13541 {{{!}}
13542 {{!}}-}}
13543 <onlyinclude>
13544 |foo
13545 </onlyinclude>
13546 {{!}}}
13547 !! html/parsoid
13548 <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{{!}}}"]}'>
13549 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13550 <tbody><tr>
13551
13552 <td>foo
13553 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13554 </tbody></table>
13555 !! end
13556
13557 !!test
13558 Templates: Lists: Multi-line list-items via templates
13559 !! wikitext
13560 *{{echo|a {{nonexistent|
13561 unused}}}}
13562 *{{echo|b {{nonexistent|
13563 unused}}}}
13564 !! html
13565 <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>
13566 <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>
13567 !!end
13568
13569 !!test
13570 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13571 !! wikitext
13572 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13573 !! html
13574 <p><i>ab</i>c<i>d</i>e
13575 </p>
13576 !!end
13577
13578 !!test
13579 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13580 (PHP parser generates misnested html)
13581 !! wikitext
13582 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13583 !! html/parsoid
13584 <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>
13585 !!end
13586
13587 !!test
13588 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13589 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13590 !! options
13591 parsoid=wt2html,wt2wt
13592 !! wikitext
13593 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13594 !! html/php+tidy
13595 <div><i>a</i></div><div><i>b</i>c<i>d</i></div><div>e</div>
13596 !! html/parsoid
13597 <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>
13598 <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>
13599 <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>
13600 !!end
13601
13602 !!test
13603 Templates: Ugly nesting: 4. Divs opened/closed across templates
13604 !! wikitext
13605 a<div>b{{echo|c</div>d}}e
13606 !! html
13607 a<div>bc</div>de
13608 !! html+tidy
13609 <p>a</p><div>bc</div><p>de</p>
13610 !! end
13611
13612 !! test
13613 Templates: Ugly templates: 3. newline-only template parameter
13614 !! wikitext
13615 foo {{echo|
13616 }}
13617 !! html
13618 <p>foo
13619 </p>
13620 !! end
13621
13622 # This looks like a bug: a single newline triggers p/br for some reason.
13623 !! test
13624 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13625 !! wikitext
13626 {{echo|
13627 }}
13628 !! html
13629 <p><br />
13630 </p>
13631 !! end
13632
13633 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13634 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13635 !! test
13636 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13637 !! wikitext
13638 {{echo|<table>}}
13639 {{echo|<div>foo}}
13640 {{echo|</table>}}
13641 !! html/parsoid
13642 <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">
13643 </span><table about="#mwt1">
13644 </table>
13645 !! end
13646
13647 # T66017 -- ugly wikitext with fostered content generates two template ranges
13648 # that are "identical" and generate nesting cycles in the algorithm
13649 !! test
13650 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13651 !! wikitext
13652 {{echo|<table><tr><td><table>}}
13653 {{echo|<div>}}
13654 {{echo|</div>}}
13655 !! html/parsoid
13656 <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"}'>
13657 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13658 </table></td></tr></tbody></table>
13659 !! end
13660
13661 !! test
13662 Templates: Parameters substituted at the top-level
13663 !! wikitext
13664 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13665
13666 {{{foo|bar|baz}}}
13667 !! html/php
13668 <p><i>who</i> me? <b>never!</b>
13669 </p><p>bar
13670 </p>
13671 !! html/parsoid
13672 <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>
13673
13674 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13675 !! end
13676
13677 !! test
13678 Templates: Param with empty arg in the final position
13679 !! wikitext
13680 {{{hi|}}}
13681 !! html/parsoid
13682 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13683 !! end
13684
13685 !!test
13686 Parser Functions: 1. Simple example
13687 !! wikitext
13688 {{uc:foo}}
13689 !! html
13690 <p>FOO
13691 </p>
13692 !!end
13693
13694 !!test
13695 Parser Functions: 2. Nested use (only outermost should be marked up)
13696 !! wikitext
13697 {{uc:{{lc:FOO}}}}
13698 !! html
13699 <p>FOO
13700 </p>
13701 !!end
13702
13703 ## Note that the templates inside the references are not wrapped
13704 !! test
13705 Template nested in extension tag in template
13706 !! options
13707 title=[[Main Page]]
13708 language=zh
13709 !! wikitext
13710 {{echo|hi<ref>[[ho|{{echo|hi}}]]</ref>}}
13711 {{echo|hi<ref>[http://test.com?q={{echo|ho}}]</ref>}}
13712 {{echo|hi<ref>-{ho|{{echo|hi}}}-</ref>}}
13713 <references />
13714 !! html/parsoid
13715 <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>
13716 <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>
13717 <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>
13718 <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>
13719 !! end
13720
13721 ###
13722 ### Pre-save transform tests
13723 ###
13724
13725 !! test
13726 pre-save transform: subst:
13727 !! options
13728 pst
13729 !! wikitext
13730 {{subst:test}}
13731 !! html/php
13732 This is a test template
13733 !! end
13734
13735 !! test
13736 pre-save transform: normal template
13737 !! options
13738 pst
13739 !! wikitext
13740 {{test}}
13741 !! html/php
13742 {{test}}
13743 !! end
13744
13745 !! test
13746 pre-save transform: nonexistent template
13747 !! options
13748 pst
13749 !! wikitext
13750 {{thistemplatedoesnotexist}}
13751 !! html/php
13752 {{thistemplatedoesnotexist}}
13753 !! end
13754
13755 !! test
13756 pre-save transform: subst magic variables
13757 !! options
13758 pst
13759 !! wikitext
13760 {{subst:SITENAME}}
13761 !! html/php
13762 MediaWiki
13763 !! end
13764
13765 # This is T2089, which I fixed. -- wtm
13766 !! test
13767 pre-save transform: subst: templates with parameters
13768 !! options
13769 pst
13770 !! wikitext
13771 {{subst:paramtest|param="something else"}}
13772 !! html/php
13773 This is a test template with parameter "something else"
13774 !! end
13775
13776 !! article
13777 Template:nowikitest
13778 !! text
13779 <nowiki>'''not wiki'''</nowiki>
13780 !! endarticle
13781
13782 !! test
13783 pre-save transform: nowiki in subst (T3188)
13784 !! options
13785 pst
13786 !! wikitext
13787 {{subst:nowikitest}}
13788 !! html/php
13789 <nowiki>'''not wiki'''</nowiki>
13790 !! end
13791
13792 !! article
13793 Template:commenttest
13794 !! text
13795 This template has <!-- a comment --> in it.
13796 !! endarticle
13797
13798 !! test
13799 pre-save transform: comment in subst (T3936)
13800 !! options
13801 pst
13802 !! wikitext
13803 {{subst:commenttest}}
13804 !! html/php
13805 This template has <!-- a comment --> in it.
13806 !! end
13807
13808 !! test
13809 pre-save transform: unclosed tag
13810 !! options
13811 pst
13812 !! wikitext
13813 <nowiki>'''not wiki'''
13814 !! html/php
13815 <nowiki>'''not wiki'''
13816 !! end
13817
13818 !! test
13819 pre-save transform: mixed tag case
13820 !! options
13821 pst
13822 !! wikitext
13823 <NOwiki>'''not wiki'''</noWIKI>
13824 !! html/php
13825 <NOwiki>'''not wiki'''</noWIKI>
13826 !! end
13827
13828 !! test
13829 pre-save transform: unclosed comment in <nowiki>
13830 !! options
13831 pst
13832 !! wikitext
13833 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13834 !! html/php
13835 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13836 !!end
13837
13838 # Leading @ in this template definition works around a limitation
13839 # in parsoid's parserTests which otherwise strips the <span> from the
13840 # result (confusing it for a template wrapper)
13841 !! article
13842 Template:dangerous
13843 !!text
13844 @<span onmouseover="alert('crap')">Oh no</span>
13845 !!endarticle
13846
13847 !!test
13848 (confirming safety of fix for subst T3936)
13849 !! wikitext
13850 {{Template:dangerous}}
13851 !! html
13852 <p>@<span>Oh no</span>
13853 </p>
13854 !! end
13855
13856 !! test
13857 pre-save transform: comment containing gallery (T7024)
13858 !! options
13859 pst
13860 !! wikitext
13861 <!-- <gallery>data</gallery> -->
13862 !! html/php
13863 <!-- <gallery>data</gallery> -->
13864 !!end
13865
13866 !! test
13867 pre-save transform: comment containing extension
13868 !! options
13869 pst
13870 !! wikitext
13871 <!-- <tag>data</tag> -->
13872 !! html/php
13873 <!-- <tag>data</tag> -->
13874 !!end
13875
13876 !! test
13877 pre-save transform: comment containing nowiki
13878 !! options
13879 pst
13880 !! wikitext
13881 <!-- <nowiki>data</nowiki> -->
13882 !! html/php
13883 <!-- <nowiki>data</nowiki> -->
13884 !!end
13885
13886 !! test
13887 pre-save transform: <noinclude> in subst (T5298)
13888 !! options
13889 pst
13890 !! wikitext
13891 {{subst:Includes}}
13892 !! html/php
13893 Foobar
13894 !! end
13895
13896 !! test
13897 pre-save transform: <onlyinclude> in subst (T5298)
13898 !! options
13899 pst
13900 !! wikitext
13901 {{subst:Includes2}}
13902 !! html/php
13903 Foo
13904 !! end
13905
13906 !! article
13907 Template:SubstTest
13908 !!text
13909 {{<includeonly>subst:</includeonly>Includes}}
13910 !! endarticle
13911
13912 !! article
13913 Template:SafeSubstTest
13914 !! text
13915 {{<includeonly>safesubst:</includeonly>Includes}}
13916 !! endarticle
13917
13918 !! test
13919 T24297: safesubst: works during PST
13920 !! options
13921 pst
13922 !! wikitext
13923 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13924 !! html/php
13925 FoobarFoobar
13926 !! end
13927
13928 !! test
13929 T24297: safesubst: works during normal parse
13930 !! wikitext
13931 {{SafeSubstTest}}
13932 !! html
13933 <p>Foobar
13934 </p>
13935 !! end
13936
13937 !! test
13938 subst: does not work during normal parse
13939 !! wikitext
13940 {{SubstTest}}
13941 !! html
13942 <p>{{subst:Includes}}
13943 </p>
13944 !! end
13945
13946 !! test
13947 pre-save transform: context links ("pipe trick")
13948 !! options
13949 pst
13950 !! wikitext
13951 [[Article (context)|]]
13952 [[Bar:Article|]]
13953 [[:Bar:Article|]]
13954 [[Bar:Article (context)|]]
13955 [[:Bar:Article (context)|]]
13956 [[|Article]]
13957 [[|Article (context)]]
13958 [[Bar:X (Y) Z|]]
13959 [[:Bar:X (Y) Z|]]
13960 !! html/php
13961 [[Article (context)|Article]]
13962 [[Bar:Article|Article]]
13963 [[:Bar:Article|Article]]
13964 [[Bar:Article (context)|Article]]
13965 [[:Bar:Article (context)|Article]]
13966 [[Article]]
13967 [[Article (context)]]
13968 [[Bar:X (Y) Z|X (Y) Z]]
13969 [[:Bar:X (Y) Z|X (Y) Z]]
13970 !! end
13971
13972 !! test
13973 pre-save transform: context links ("pipe trick") with interwiki prefix
13974 !! options
13975 pst
13976 !! wikitext
13977 [[interwiki:Article|]]
13978 [[:interwiki:Article|]]
13979 [[interwiki:Bar:Article|]]
13980 [[:interwiki:Bar:Article|]]
13981 !! html/php
13982 [[interwiki:Article|Article]]
13983 [[:interwiki:Article|Article]]
13984 [[interwiki:Bar:Article|Bar:Article]]
13985 [[:interwiki:Bar:Article|Bar:Article]]
13986 !! end
13987
13988 !! test
13989 pre-save transform: context links ("pipe trick") with parens in title
13990 !! options
13991 pst title=[[Somearticle (context)]]
13992 !! wikitext
13993 [[|Article]]
13994 !! html/php
13995 [[Article (context)|Article]]
13996 !! end
13997
13998 !! test
13999 pre-save transform: context links ("pipe trick") with comma in title
14000 !! options
14001 pst title=[[Someplace, Somewhere]]
14002 !! wikitext
14003 [[|Otherplace]]
14004 [[Otherplace, Elsewhere|]]
14005 [[Otherplace, Elsewhere, Anywhere|]]
14006 !! html/php
14007 [[Otherplace, Somewhere|Otherplace]]
14008 [[Otherplace, Elsewhere|Otherplace]]
14009 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
14010 !! end
14011
14012 !! test
14013 pre-save transform: context links ("pipe trick") with parens and comma
14014 !! options
14015 pst title=[[Someplace (IGNORED), Somewhere]]
14016 !! wikitext
14017 [[|Otherplace]]
14018 [[Otherplace (place), Elsewhere|]]
14019 !! html/php
14020 [[Otherplace, Somewhere|Otherplace]]
14021 [[Otherplace (place), Elsewhere|Otherplace]]
14022 !! end
14023
14024 !! test
14025 pre-save transform: context links ("pipe trick") with comma and parens
14026 !! options
14027 pst title=[[Who, me? (context)]]
14028 !! wikitext
14029 [[|Yes, you.]]
14030 [[Me, Myself, and I (1937 song)|]]
14031 !! html/php
14032 [[Yes, you. (context)|Yes, you.]]
14033 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
14034 !! end
14035
14036 !! test
14037 pre-save transform: context links ("pipe trick") with namespace
14038 !! options
14039 pst title=[[Ns:Somearticle]]
14040 !! wikitext
14041 [[|Article]]
14042 !! html/php
14043 [[Ns:Article|Article]]
14044 !! end
14045
14046 !! test
14047 pre-save transform: context links ("pipe trick") with namespace and parens
14048 !! options
14049 pst title=[[Ns:Somearticle (context)]]
14050 !! wikitext
14051 [[|Article]]
14052 !! html/php
14053 [[Ns:Article (context)|Article]]
14054 !! end
14055
14056 !! test
14057 pre-save transform: context links ("pipe trick") with namespace and comma
14058 !! options
14059 pst title=[[Ns:Somearticle, Context, Whatever]]
14060 !! wikitext
14061 [[|Article]]
14062 !! html/php
14063 [[Ns:Article, Context, Whatever|Article]]
14064 !! end
14065
14066 !! test
14067 pre-save transform: context links ("pipe trick") with namespace, comma and parens
14068 !! options
14069 pst title=[[Ns:Somearticle, Context (context)]]
14070 !! wikitext
14071 [[|Article]]
14072 !! html/php
14073 [[Ns:Article (context)|Article]]
14074 !! end
14075
14076 !! test
14077 pre-save transform: context links ("pipe trick") with namespace, parens and comma
14078 !! options
14079 pst title=[[Ns:Somearticle (IGNORED), Context]]
14080 !! wikitext
14081 [[|Article]]
14082 !! html/php
14083 [[Ns:Article, Context|Article]]
14084 !! end
14085
14086 !! test
14087 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
14088 !! options
14089 pst
14090 !! wikitext
14091 [[Article(context)|]]
14092 [[Bar:Article(context)|]]
14093 [[:Bar:Article(context)|]]
14094 [[|Article(context)]]
14095 [[Bar:X(Y)Z|]]
14096 [[:Bar:X(Y)Z|]]
14097 !! html/php
14098 [[Article(context)|Article]]
14099 [[Bar:Article(context)|Article]]
14100 [[:Bar:Article(context)|Article]]
14101 [[Article(context)]]
14102 [[Bar:X(Y)Z|X(Y)Z]]
14103 [[:Bar:X(Y)Z|X(Y)Z]]
14104 !! end
14105
14106 !! test
14107 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
14108 !! options
14109 pst
14110 !! wikitext
14111 [[Article (context)|]]
14112 [[Bar:Article (context)|]]
14113 [[:Bar:Article (context)|]]
14114 [[|Article (context)]]
14115 [[Bar:X (Y) Z|]]
14116 [[:Bar:X (Y) Z|]]
14117 !! html/php
14118 [[Article (context)|Article]]
14119 [[Bar:Article (context)|Article]]
14120 [[:Bar:Article (context)|Article]]
14121 [[Article (context)]]
14122 [[Bar:X (Y) Z|X (Y) Z]]
14123 [[:Bar:X (Y) Z|X (Y) Z]]
14124 !! end
14125
14126 !! test
14127 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
14128 !! options
14129 pst
14130 !! wikitext
14131 [[Article(context)|]]
14132 [[Bar:Article(context)|]]
14133 [[:Bar:Article(context)|]]
14134 [[|Article(context)]]
14135 [[Bar:X(Y)Z|]]
14136 [[:Bar:X(Y)Z|]]
14137 !! html/php
14138 [[Article(context)|Article]]
14139 [[Bar:Article(context)|Article]]
14140 [[:Bar:Article(context)|Article]]
14141 [[Article(context)]]
14142 [[Bar:X(Y)Z|X(Y)Z]]
14143 [[:Bar:X(Y)Z|X(Y)Z]]
14144 !! end
14145
14146 !! test
14147 pre-save transform: context links ("pipe trick") with commas (T23660)
14148 !! options
14149 pst
14150 !! wikitext
14151 [[Article (context), context|]]
14152 [[Article (context),context|]]
14153 [[Bar:Article (context), context|]]
14154 [[Bar:Article (context),context|]]
14155 [[:Bar:Article (context), context|]]
14156 [[:Bar:Article (context),context|]]
14157 !! html/php
14158 [[Article (context), context|Article]]
14159 [[Article (context),context|Article]]
14160 [[Bar:Article (context), context|Article]]
14161 [[Bar:Article (context),context|Article]]
14162 [[:Bar:Article (context), context|Article]]
14163 [[:Bar:Article (context),context|Article]]
14164 !! end
14165
14166 !! test
14167 Parsoid: backwards pipe trick
14168 !! wikitext
14169 [[|'''bar''']]
14170 !! html/php
14171 <p>[[|<b>bar</b>]]
14172 </p>
14173 !! html/parsoid
14174 <p>[[|<b>bar</b>]]</p>
14175 !! end
14176
14177 !! test
14178 pre-save transform: trim trailing empty lines
14179 !! options
14180 pst
14181 !! wikitext
14182 Empty lines are trimmed
14183
14184
14185
14186
14187 !! html/php
14188 Empty lines are trimmed
14189 !! end
14190
14191 !! test
14192 pre-save transform: Signature expansion
14193 !! options
14194 pst
14195 !! wikitext
14196 * ~~~
14197 * ~~~~
14198 * ~~~~~
14199 * <noinclude>~~~</noinclude>
14200 * <includeonly>~~~</includeonly>
14201 * <onlyinclude>~~~</onlyinclude>
14202 !! html/php
14203 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
14204 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14205 * 00:02, 1 January 1970 (UTC)
14206 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
14207 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
14208 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
14209 !! end
14210
14211
14212 !! test
14213 ParserOutput flags from signature expansion (T84843)
14214 !! options
14215 pst
14216 showflags
14217 !! wikitext
14218 ~~~~
14219 !! html/php
14220 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14221 flags=user-signature
14222 !! end
14223
14224
14225 !! test
14226 pre-save transform: Signature expansion in nowiki tags (T2093)
14227 !! options
14228 pst disabled
14229 !! wikitext
14230 Shall not expand:
14231
14232 <nowiki>~~~~</nowiki>
14233
14234 <includeonly><nowiki>~~~~</nowiki></includeonly>
14235
14236 <noinclude><nowiki>~~~~</nowiki></noinclude>
14237
14238 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14239
14240 {{subst:Foo}} shall be converted to FOO
14241
14242 As well as inside noinclude/onlyinclude
14243 <noinclude>{{subst:Foo}}</noinclude>
14244 <onlyinclude>{{subst:Foo}}</onlyinclude>
14245
14246 But not inside includeonly
14247 <includeonly>{{subst:Foo}}</includeonly>
14248 !! html/php
14249 Shall not expand:
14250
14251 <nowiki>~~~~</nowiki>
14252
14253 <includeonly><nowiki>~~~~</nowiki></includeonly>
14254
14255 <noinclude><nowiki>~~~~</nowiki></noinclude>
14256
14257 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14258
14259 FOO shall be converted to FOO
14260
14261 As well as inside noinclude/onlyinclude
14262 <noinclude>FOO</noinclude>
14263 <onlyinclude>FOO</onlyinclude>
14264
14265 But not inside includeonly
14266 <includeonly>{{subst:Foo}}</includeonly>
14267 !! end
14268
14269 !! test
14270 Parsoid: Recognize nowiki with trailing space in tags
14271 !! options
14272 parsoid=wt2html
14273 !! wikitext
14274 <nowiki ><div>[[foo]]</nowiki >
14275
14276 a<nowiki / >b
14277
14278 c<nowiki />d
14279
14280 e<nowiki/ >f
14281 !! html/php+tidy
14282 <p>&lt;div&gt;[[foo]]
14283 </p><p>a&lt;nowiki / &gt;b
14284 </p><p>cd
14285 </p><p>e&lt;nowiki/ &gt;f
14286 </p>
14287 !! html/parsoid
14288 <p><span typeof="mw:Nowiki">&lt;div>[[foo]]</span></p>
14289
14290 <p>a&lt;nowiki / >b</p>
14291
14292 <p>c<span typeof="mw:Nowiki"></span>d</p>
14293
14294 <p>e&lt;nowiki/ >f</p>
14295 !! end
14296
14297 !! test
14298 Parsoid: Recognize nowiki with odd capitalization
14299 !! options
14300 parsoid=wt2html
14301 !! wikitext
14302 <noWikI ><div>[[foo]]</Nowiki >
14303 !! html/php+tidy
14304 <p>&lt;div&gt;[[foo]]
14305 </p>
14306 !! html/parsoid
14307 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14308 !! end
14309
14310
14311 !! test
14312 Parsoid: Escape nowiki with trailing space in tags
14313 !! options
14314 parsoid=html2wt
14315 !! html/parsoid
14316 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14317 <p>a&lt;nowiki /&gt;b</p>
14318 <p>c&lt;nowiki/ &gt;d</p>
14319 !! wikitext
14320 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14321
14322 a&lt;nowiki /&gt;b
14323
14324 c&lt;nowiki/ &gt;d
14325 !! end
14326
14327 !! test
14328 Parsoid: Escape weird noWikI capitalizations
14329 !! options
14330 parsoid=html2wt
14331 !! html/parsoid
14332 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14333 !! wikitext
14334 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14335 !! end
14336
14337 ###
14338 ### Message transform tests
14339 ###
14340 !! test
14341 message transform: magic variables
14342 !! options
14343 msg
14344 !! wikitext
14345 {{SITENAME}}
14346 !! html
14347 MediaWiki
14348 !! end
14349
14350 !! test
14351 message transform: should not transform wiki markup
14352 !! options
14353 msg
14354 !! wikitext
14355 ''test''
14356 !! html
14357 ''test''
14358 !! end
14359
14360 !! test
14361 message transform: <noinclude> in transcluded template (T6926)
14362 !! options
14363 msg
14364 !! wikitext
14365 {{Includes}}
14366 !! html
14367 Foobar
14368 !! end
14369
14370 !! test
14371 message transform: <onlyinclude> in transcluded template (T6926)
14372 !! options
14373 msg
14374 !! wikitext
14375 {{Includes2}}
14376 !! html
14377 Foo
14378 !! end
14379
14380 !! test
14381 {{#special:}} page name, known
14382 !! options
14383 msg
14384 !! wikitext
14385 {{#special:Recentchanges}}
14386 !! html
14387 Special:RecentChanges
14388 !! end
14389
14390 !! test
14391 {{#special:}} page name with subpage, known
14392 !! options
14393 msg
14394 !! wikitext
14395 {{#special:Recentchanges/param}}
14396 !! html
14397 Special:RecentChanges/param
14398 !! end
14399
14400 !! test
14401 {{#special:}} page name, unknown
14402 !! options
14403 msg
14404 !! wikitext
14405 {{#special:foobar nonexistent}}
14406 !! html
14407 Special:Foobar nonexistent
14408 !! end
14409
14410 !! test
14411 {{#speciale:}} page name, known
14412 !! options
14413 msg
14414 !! wikitext
14415 {{#speciale:Recentchanges}}
14416 !! html
14417 Special:RecentChanges
14418 !! end
14419
14420 !! test
14421 {{#speciale:}} page name with subpage, known
14422 !! options
14423 msg
14424 !! wikitext
14425 {{#speciale:Recentchanges/param}}
14426 !! html
14427 Special:RecentChanges/param
14428 !! end
14429
14430 !! test
14431 {{#speciale:}} page name, unknown
14432 !! options
14433 msg
14434 !! wikitext
14435 {{#speciale:foobar nonexistent}}
14436 !! html
14437 Special:Foobar_nonexistent
14438 !! end
14439
14440 ###
14441 ### Images
14442 ###
14443 ### For Parsoid-specific tests, see
14444 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14445
14446 !! test
14447 Simple image
14448 !! options
14449 parsoid=wt2html,wt2wt,html2html
14450 !! wikitext
14451 [[Image:foobar.jpg]]
14452 !! html/php
14453 <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>
14454 </p>
14455 !! html/parsoid
14456 <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>
14457 !! end
14458
14459 !! test
14460 Serialize simple image with span wrapper
14461 !! options
14462 parsoid=html2wt
14463 !! html/parsoid
14464 <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>
14465 !! wikitext
14466 [[File:Foobar.jpg]]
14467 !! end
14468
14469 !! test
14470 Simple image (using File: namespace, now canonical)
14471 !! wikitext
14472 [[File:Foobar.jpg]]
14473 !! html/php
14474 <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>
14475 </p>
14476 !! html/parsoid
14477 <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>
14478 !! end
14479
14480 !! test
14481 Right-aligned image
14482 !! wikitext
14483 [[File:Foobar.jpg|right]]
14484 !! html/php
14485 <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>
14486 !! html/parsoid
14487 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption></figcaption></figure>
14488 !! end
14489
14490 !! test
14491 Image with caption
14492 !! wikitext
14493 [[File:Foobar.jpg|right|Caption text]]
14494 !! html/php
14495 <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>
14496 !! html/parsoid
14497 <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>
14498 !! end
14499
14500 !! test
14501 Image with caption, T55312 #1
14502 !! wikitext
14503 [[File:Foobar.jpg|right|Caption page stuff]]
14504 !! html/php
14505 <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>
14506 !! html/parsoid
14507 <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>
14508 !! end
14509
14510 !! test
14511 Image with caption, T55312 #2
14512 !! wikitext
14513 [[File:Foobar.jpg|right|Caption page=]]
14514 !! html/php
14515 <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>
14516 !! html/parsoid
14517 <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>
14518 !! end
14519
14520 !! test
14521 Image with caption, T55312 #3
14522 !! wikitext
14523 [[File:Foobar.jpg|right|Caption page=stuff]]
14524 !! html/php
14525 <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>
14526 !! html/parsoid
14527 <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>
14528 !! end
14529
14530 !! test
14531 Image caption with pipe entity
14532 !! wikitext
14533 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14534 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14535 !! html/php
14536 <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>
14537 <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>
14538 !! html/parsoid
14539 <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>
14540 <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>
14541 !! end
14542
14543 !! test
14544 Allow empty links in image captions (T62753)
14545 !! options
14546 thumbsize=220
14547 !! wikitext
14548 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14549 [[]]
14550 [[Link2]]
14551 ]]
14552 !! html/php
14553 <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>
14554 !! html/parsoid
14555 <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>
14556 [[]]
14557 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14558 </figcaption></figure>
14559 !! end
14560
14561 !! test
14562 Titles in unlinked images (T23454)
14563 !! wikitext
14564 [[File:Foobar.jpg|link=|stuff]]
14565 !! html/php
14566 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" title="stuff" width="1941" height="220" />
14567 </p>
14568 !! html/parsoid
14569 <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>
14570 !! end
14571
14572 !! test
14573 Link with empty target
14574 !! wikitext
14575 [[]]
14576 !! html
14577 <p>[[]]
14578 </p>
14579 !! end
14580
14581 !! test
14582 Image with link trail
14583 !! wikitext
14584 Linktrails should not work for images: [[File:Foobar.jpg]]s
14585 !! html/php
14586 <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
14587 </p>
14588 !! html/parsoid
14589 <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>
14590 !! end
14591
14592 !! test
14593 Image with empty attribute
14594 !! options
14595 parsoid=wt2html,wt2wt,html2html
14596 !! wikitext
14597 [[File:Foobar.jpg|right||Caption text]]
14598 !! html/php
14599 <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>
14600 !! html/parsoid
14601 <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>
14602 !! end
14603
14604 !! test
14605 1. Block image with individual attributes from templates
14606 !! wikitext
14607 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14608 !! html/php
14609 <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>
14610 !! html/parsoid
14611 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
14612 !! end
14613
14614 !! test
14615 2. Block Image with individual attributes from templates
14616 !! wikitext
14617 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14618 !! html/php
14619 <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>
14620 !! html/parsoid
14621 <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>
14622 !! end
14623
14624 !! test
14625 3. Inline image with individual attributes from templates
14626 !! wikitext
14627 [[File:Foobar.jpg|{{echo|50px}}]]
14628 !! html/php
14629 <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>
14630 </p>
14631 !! html/parsoid
14632 <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>
14633 !! end
14634
14635 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14636 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14637 !! test
14638 Image with multiple attributes from the same template
14639 !! wikitext
14640 [[File:Foobar.jpg|{{image_attribs}}]]
14641 !! html/php
14642 <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>
14643 !! html/parsoid
14644 <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>
14645 !! end
14646
14647 !! test
14648 Image with link tails
14649 !! options
14650 thumbsize=220
14651 !! wikitext
14652 123[[File:Foobar.jpg]]456
14653 123[[File:Foobar.jpg|right]]456
14654 123[[File:Foobar.jpg|thumb]]456
14655 !! html/php
14656 <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
14657 </p>
14658 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
14659 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
14660 !! html/php+tidy
14661 <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
14662 </p><p>
14663 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
14664 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>
14665 !! html/parsoid
14666 <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>
14667 <p>123</p><figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption></figcaption></figure><p>456
14668 123</p><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption></figcaption></figure><p>456</p>
14669 !! end
14670
14671 !! test
14672 Image with multiple captions -- only last one is accepted
14673 !! wikitext
14674 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14675 !! html/php
14676 <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>
14677 !! html/parsoid
14678 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption3 - accepted</figcaption></figure>
14679 !! end
14680
14681 !! test
14682 Image with multiple widths -- use last
14683 !! wikitext
14684 [[File:Foobar.jpg|200px|300px|caption]]
14685 !! html/php
14686 <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>
14687 </p>
14688 !! html/parsoid
14689 <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>
14690 !! end
14691
14692 !! test
14693 Image with multiple alignments -- use first (T50664)
14694 !! options
14695 thumbsize=220
14696 !! wikitext
14697 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14698
14699 [[File:Foobar.jpg|middle|text-top|caption]]
14700 !! html/php
14701 <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>
14702 <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>
14703 </p>
14704 !! html/parsoid
14705 <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>
14706 <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>
14707 !! end
14708
14709 !! test
14710 Image with width attribute at different positions
14711 !! wikitext
14712 [[File:Foobar.jpg|200px|right|Caption]]
14713 [[File:Foobar.jpg|right|200px|Caption]]
14714 [[File:Foobar.jpg|right|Caption|200px]]
14715 !! html/php
14716 <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>
14717 <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>
14718 <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>
14719 !! html/parsoid
14720 <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>
14721 <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>
14722 <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>
14723 !! end
14724
14725 # a sad bit of backward-compatibility
14726 !! test
14727 Image with size specified with pxpx (T15500, T53628)
14728 !! options
14729 parsoid=wt2html,wt2wt,html2html
14730 !! wikitext
14731 [[File:Foobar.jpg|20pxpx]]
14732 [[File:Foobar.jpg|200x20pxpx]]
14733 !! html/php
14734 <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>
14735 <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>
14736 </p>
14737 !! html/parsoid
14738 <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>
14739 !! end
14740
14741 !! test
14742 Image with link parameter, wiki target
14743 !! wikitext
14744 [[File:Foobar.jpg|link=Main Page]]
14745 !! html/php
14746 <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>
14747 </p>
14748 !! html/parsoid
14749 <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>
14750 !! end
14751
14752 # parsoid T51293 (part 1)
14753 !! test
14754 Image with link parameter, URL target
14755 !! wikitext
14756 [[File:Foobar.jpg|link=http://example.com/]]
14757 !! html/php
14758 <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>
14759 </p>
14760 !! html/parsoid
14761 <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>
14762 !! end
14763
14764 # parsoid T51293 (part 2)
14765 !! test
14766 Image with link parameter, protocol-less URL target
14767 !! wikitext
14768 [[File:Foobar.jpg|link=//example.com/]]
14769 !! html/php
14770 <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>
14771 </p>
14772 !! html/parsoid
14773 <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>
14774 !! end
14775
14776 !! test
14777 Escaping non-block captions (T107435)
14778 !! options
14779 parsoid={
14780 "modes": ["wt2wt"],
14781 "changes": [
14782 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14783 ]
14784 }
14785 !! wikitext
14786 [[Image:Foobar.jpg|caption]]
14787 !! wikitext/edited
14788 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14789 !! end
14790
14791 # wgExternalLinkTarget not supported by Parsoid
14792 !! test
14793 Image with link parameter, wgExternalLinkTarget
14794 !! wikitext
14795 [[Image:foobar.jpg|link=http://example.com/]]
14796 !! config
14797 wgExternalLinkTarget='foobar'
14798 !! html/php
14799 <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>
14800 </p>
14801 !! end
14802
14803 !! test
14804 Image with link parameter, wgNoFollowLinks set to false
14805 !! wikitext
14806 [[Image:foobar.jpg|link=http://example.com/]]
14807 !! config
14808 wgNoFollowLinks=false
14809 !! html/php
14810 <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>
14811 </p>
14812 !! end
14813
14814 !! test
14815 Image with link parameter, wgNoFollowDomainExceptions
14816 !! wikitext
14817 [[Image:foobar.jpg|link=http://example.com/]]
14818 !! config
14819 wgNoFollowDomainExceptions='example.com'
14820 !! html/php
14821 <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>
14822 </p>
14823 !! end
14824
14825 # wgExternalLinkTarget not supported by Parsoid
14826 !! test
14827 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14828 !! wikitext
14829 [[Image:foobar.jpg|link=http://example.com/|Title]]
14830 !! config
14831 wgExternalLinkTarget='foobar'
14832 !! html/php
14833 <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>
14834 </p>
14835 !! end
14836
14837 !! test
14838 Image with empty link parameter
14839 !! wikitext
14840 [[File:Foobar.jpg|link=]]
14841 !! html/php
14842 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" />
14843 </p>
14844 !! html/parsoid
14845 <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>
14846 !! end
14847
14848 !! test
14849 Image with link parameter (wiki target) and unnamed parameter
14850 !! wikitext
14851 [[File:Foobar.jpg|link=Main_Page|Title]]
14852 !! html/php
14853 <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>
14854 </p>
14855 !! html/parsoid
14856 <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>
14857 !! end
14858
14859 !! test
14860 Image with link parameter (URL target) and unnamed parameter
14861 !! wikitext
14862 [[File:Foobar.jpg|link=http://example.com/|Title]]
14863 !! html/php
14864 <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>
14865 </p>
14866 !! html/parsoid
14867 <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>
14868 !! end
14869
14870 !! test
14871 Thumbnail image with link parameter
14872 !! options
14873 thumbsize=220
14874 parsoid=wt2html,wt2wt,html2html
14875 !! wikitext
14876 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14877 !! html/php
14878 <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>
14879 !! html/parsoid
14880 <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>
14881 !! end
14882
14883 !! test
14884 Manually-specified thumbnail image
14885 !! options
14886 thumbsize=220
14887 !! wikitext
14888 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14889 !! html/php
14890 <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>
14891 !! html/parsoid
14892 <figure class="mw-default-size" typeof="mw:Image/Thumb" about="#mwt1" data-mw='{"attribs":[["manualthumb",{"txt":"Thumb.png"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14893 !! end
14894
14895 !! test
14896 Manually-specified thumbnail image (backwards compat)
14897 !! options
14898 thumbsize=220
14899 parsoid=html2wt
14900 !! wikitext
14901 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14902 !! html/php
14903 <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>
14904 !! html/parsoid
14905 <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>
14906 !! end
14907
14908 !! test
14909 Manually-specified thumbnail image with explicit link to wiki page
14910 !! options
14911 thumbsize=220
14912 parsoid=wt2html,wt2wt,html2html
14913 !! wikitext
14914 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14915 !! html/php
14916 <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>
14917 !! html/parsoid
14918 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"attribs":[["manualthumb",{"txt":"Thumb.png"}]]}'><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14919 !! end
14920
14921 !! test
14922 Manually-specified thumbnail image with explicit link to url
14923 !! options
14924 thumbsize=220
14925 parsoid=wt2html,wt2wt,html2html
14926 !! wikitext
14927 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14928 !! html/php
14929 <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>
14930 !! html/parsoid
14931 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"attribs":[["manualthumb",{"txt":"Thumb.png"}]]}'><a href="http://example.com"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14932 !! end
14933
14934 !! test
14935 Manually-specified thumbnail image with explicit no link
14936 !! options
14937 thumbsize=220
14938 parsoid=wt2html,wt2wt,html2html
14939 !! wikitext
14940 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14941 !! html/php
14942 <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>
14943 !! html/parsoid
14944 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"attribs":[["manualthumb",{"txt":"Thumb.png"}]]}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
14945 !! end
14946
14947 !! test
14948 Manually-specified thumbnail image with explicit link and alt text
14949 !! options
14950 thumbsize=220
14951 parsoid=wt2html,wt2wt,html2html
14952 !! wikitext
14953 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14954 !! html/php
14955 <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>
14956 !! html/parsoid
14957 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"attribs":[["manualthumb",{"txt":"Thumb.png"}]]}'><a href="./Main_Page"><img alt="alttext" resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14958 !! end
14959
14960 !! test
14961 Image with frame and link
14962 !! options
14963 parsoid=wt2html,wt2wt,html2html
14964 !! wikitext
14965 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14966 !! html/php
14967 <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>
14968 !! html/parsoid
14969 <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>
14970 !! end
14971
14972 !! test
14973 Image with frame and link and explicit alt
14974 !! options
14975 parsoid=wt2html,wt2wt,html2html
14976 !! wikitext
14977 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14978 !! html/php
14979 <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>
14980 !! html/parsoid
14981 <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>
14982 !! end
14983
14984 !! test
14985 Image with wiki markup in implicit alt
14986 !! wikitext
14987 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14988
14989 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14990 !! html/php
14991 <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>
14992 </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>
14993 </p>
14994 !! html/parsoid
14995 <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>
14996
14997 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt1" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=testing &apos;&apos;&apos;bold&apos;&apos;&apos; in alt"}]}' data-mw='{"attribs":[["alt",{"html":"alt=testing &lt;b data-parsoid=&apos;{\"dsr\":[79,89,3,3]}&apos;>bold&lt;/b> in alt","txt":"testing bold in alt"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"Image:Foobar.jpg"}}'><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></figure-inline></p>
14998 !! end
14999
15000 !! test
15001 Alt image option should handle most kinds of wikitext without barfing
15002 !! wikitext
15003 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
15004 !! html/php
15005 <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>
15006 !! html/parsoid
15007 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&apos;&apos;bold template&apos;&apos;}}."}]}' data-mw='{"attribs":[["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&apos;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&apos;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;apos;&amp;apos;bold template&amp;apos;&amp;apos;\"}},\"i\":0}}]}&apos;>bold template&lt;/i>.","txt":"This is a link and a bold template."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"Image:Foobar.jpg"}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
15008 !! end
15009
15010 !! test
15011 Ampersand in alt attribute (T206940)
15012 !! wikitext
15013 [[File:Foobar.jpg|alt=&amp;amp;]]
15014
15015 <!-- consistency with gallery extension -->
15016 <gallery>
15017 File:Foobar.jpg|alt=&amp;amp;
15018 </gallery>
15019 !! html/php+tidy
15020 <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>
15021 </p>
15022 <ul class="gallery mw-gallery-traditional">
15023 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15024 <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>
15025 <div class="gallerytext">
15026 </div>
15027 </div></li>
15028 </ul>
15029 !! html/parsoid
15030 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt1" data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:Entity\" data-parsoid=&apos;{\"src\":\"&amp;amp;amp;\",\"srcContent\":\"&amp;amp;\",\"dsr\":[22,27,null,null]}&apos;>&amp;amp;&lt;/span>amp;","txt":"&amp;amp;"}]]}'><a href="./File:Foobar.jpg"><img alt="&amp;amp;" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
15031
15032 <!-- consistency with gallery extension -->
15033 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt5" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15034 <li class="gallerybox" style="width: 155px;">
15035 <div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image mw:ExpandedAttrs" data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:Entity\" data-parsoid=&apos;{\"src\":\"&amp;amp;amp;\",\"srcContent\":\"&amp;amp;\",\"dsr\":[109,114,null,null]}&apos;>&amp;amp;&lt;/span>amp;","txt":"&amp;amp;"}]]}'><a href="./File:Foobar.jpg"><img alt="&amp;amp;" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div>
15036 <div class="gallerytext"></div>
15037 </li>
15038 </ul>
15039 !! end
15040
15041 ## FIXME: The inconsistency in the gallery extension on the php side is T49646
15042 !! test
15043 Link with encoded pipe in alt option
15044 !! options
15045 parsoid={
15046 "modes": ["wt2html", "html2html"]
15047 }
15048 !! wikitext
15049 [[File:Foobar.jpg|alt=http://testing.123?4=5&vert;6|caption]]
15050
15051 <!-- consistency with gallery extension -->
15052 <gallery>
15053 File:Foobar.jpg|alt=http://testing.123?4=5&vert;6|caption
15054 </gallery>
15055 !! html/php+tidy
15056 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="http://testing.123?4=5|6" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15057 </p>
15058 <ul class="gallery mw-gallery-traditional">
15059 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15060 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="http://testing.123?4=5&amp;vert;6%7Ccaption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
15061 <div class="gallerytext">
15062 </div>
15063 </div></li>
15064 </ul>
15065 !! html/parsoid
15066 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt1" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=http://testing.123?4=5&amp;vert;6"},{"ck":"caption","ak":"caption"}]}' data-mw='{"attribs":[["alt",{"html":"alt=&lt;a rel=\"mw:ExtLink\" href=\"http://testing.123?4=5%7C6\" data-parsoid=&apos;{\"stx\":\"url\",\"a\":{\"href\":\"http://testing.123?4=5%7C6\"},\"sa\":{\"href\":\"http://testing.123?4=5&amp;amp;vert;6\"},\"dsr\":[22,51,0,0]}&apos;>http://testing.123?4=5%7C6&lt;/a>","txt":"http://testing.123?4=5|6"}]],"caption":"caption"}'><a href="./File:Foobar.jpg"><img alt="http://testing.123?4=5|6" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
15067
15068 <!-- consistency with gallery extension -->
15069 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt5" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15070 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image mw:ExpandedAttrs" data-mw='{"attribs":[["alt",{"html":"alt=&lt;a rel=\"mw:ExtLink\" href=\"http://testing.123?4=5%7C6\" data-parsoid=&apos;{\"stx\":\"url\",\"a\":{\"href\":\"http://testing.123?4=5%7C6\"},\"sa\":{\"href\":\"http://testing.123?4=5&amp;amp;vert;6\"},\"dsr\":[137,166,0,0]}&apos;>http://testing.123?4=5%7C6&lt;/a>","txt":"http://testing.123?4=5|6"}]]}'><a href="./File:Foobar.jpg"><img alt="http://testing.123?4=5|6" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
15071 !! end
15072
15073 !! test
15074 Italics markup in alt attribute (T206940)
15075 !! options
15076 parsoid=wt2html,html2html
15077 !! wikitext
15078 [[File:Foobar.jpg|alt=''x''|caption]]
15079
15080 <!-- consistency with gallery extension -->
15081 <gallery>
15082 File:Foobar.jpg|alt=''x''|caption
15083 </gallery>
15084 !! html/php+tidy
15085 <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>
15086 </p>
15087 <ul class="gallery mw-gallery-traditional">
15088 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15089 <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>
15090 <div class="gallerytext">
15091 <p>caption
15092 </p>
15093 </div>
15094 </div></li>
15095 </ul>
15096 !! html/parsoid
15097 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt1" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=&apos;&apos;x&apos;&apos;"},{"ck":"caption","ak":"caption"}]}' data-mw='{"attribs":[["alt",{"html":"alt=&lt;i data-parsoid=&apos;{\"dsr\":[22,27,2,2]}&apos;>x&lt;/i>","txt":"x"}]],"caption":"caption"}'><a href="./File:Foobar.jpg"><img alt="x" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
15098
15099 <!-- consistency with gallery extension -->
15100 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt5" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15101 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image mw:ExpandedAttrs" data-mw='{"attribs":[["alt",{"html":"alt=&lt;i data-parsoid=&apos;{\"dsr\":[113,118,2,2]}&apos;>x&lt;/i>","txt":"x"}]]}'><a href="./File:Foobar.jpg"><img alt="x" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
15102 </ul>
15103 !! end
15104
15105 ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
15106 ## are no longer in storage.
15107 !! test
15108 Nowiki markup in alt attribute (T206940)
15109 !! options
15110 parsoid=html2wt
15111 !! wikitext
15112 [[File:Foobar.jpg|alt=<nowiki>''</nowiki>x<nowiki>''</nowiki>|caption]]
15113
15114 <!-- consistency with gallery extension -->
15115 <gallery>
15116 File:Foobar.jpg|alt=<nowiki>''</nowiki>x<nowiki>''</nowiki>|caption
15117 </gallery>
15118 !! html/php+tidy
15119 <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>
15120 </p>
15121 <ul class="gallery mw-gallery-traditional">
15122 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15123 <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>
15124 <div class="gallerytext">
15125 <p>caption
15126 </p>
15127 </div>
15128 </div></li>
15129 </ul>
15130 !! html/parsoid
15131 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt5" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=&lt;nowiki>&apos;&apos;&lt;/nowiki>x&lt;nowiki>&apos;&apos;&lt;/nowiki>"},{"ck":"caption","ak":"caption"}]}' data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:Nowiki\" data-parsoid=&apos;{\"dsr\":[22,41,8,9]}&apos;>&apos;&apos;&lt;/span>x&lt;span typeof=\"mw:Nowiki\" data-parsoid=&apos;{\"dsr\":[42,61,8,9]}&apos;>&apos;&apos;&lt;/span>","txt":"&apos;&apos;x&apos;&apos;"}]],"caption":"caption"}'><a href="./File:Foobar.jpg"><img alt="''x''" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" /></a></figure-inline></p>
15132
15133 <!-- consistency with gallery extension -->
15134 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt13" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|alt=&lt;nowiki>&apos;&apos;&lt;/nowiki>x&lt;nowiki>&apos;&apos;&lt;/nowiki>|caption\n"}}'>
15135 <li class="gallerybox" style="width: 155px;">
15136 <div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image mw:ExpandedAttrs" data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:Nowiki\" data-parsoid=&apos;{\"dsr\":[147,166,8,9]}&apos;>&apos;&apos;&lt;/span>x&lt;span typeof=\"mw:Nowiki\" data-parsoid=&apos;{\"dsr\":[167,186,8,9]}&apos;>&apos;&apos;&lt;/span>","txt":"&apos;&apos;x&apos;&apos;"}]]}'><a href="./File:Foobar.jpg"><img alt="''x''" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div>
15137 <div class="gallerytext">caption</div>
15138 </li>
15139 </ul>
15140 !! end
15141
15142 !! test
15143 Nowiki markup in alt attribute (edited html, no data-parsoid) (T206940)
15144 !! wikitext
15145 [[File:Foobar.jpg|alt=<nowiki>''x''</nowiki>|caption]]
15146
15147 <!-- consistency with gallery extension -->
15148 <gallery>
15149 File:Foobar.jpg|alt=<nowiki>''x''</nowiki>|caption
15150 </gallery>
15151 !! html/php+tidy
15152 <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>
15153 </p>
15154 <ul class="gallery mw-gallery-traditional">
15155 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15156 <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>
15157 <div class="gallerytext">
15158 <p>caption
15159 </p>
15160 </div>
15161 </div></li>
15162 </ul>
15163 !! html/parsoid
15164 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:Nowiki\" data-parsoid=&apos;{\"dsr\":[22,44,8,9]}&apos;>&apos;&apos;x&apos;&apos;&lt;/span>","txt":"&apos;&apos;x&apos;&apos;"}]],"caption":"caption"}'><a href="./File:Foobar.jpg"><img alt="''x''" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
15165
15166 <!-- consistency with gallery extension -->
15167 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt9" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15168 <li class="gallerybox" style="width: 155px;">
15169 <div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image mw:ExpandedAttrs" data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:Nowiki\" data-parsoid=&apos;{\"dsr\":[130,152,8,9]}&apos;>&apos;&apos;x&apos;&apos;&lt;/span>","txt":"&apos;&apos;x&apos;&apos;"}]]}'><a href="./File:Foobar.jpg"><img alt="''x''" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div>
15170 <div class="gallerytext">caption</div>
15171 </li>
15172 </ul>
15173 !! end
15174
15175 ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
15176 ## are no longer in storage.
15177 !! test
15178 Ampersand in link attribute (T206940)
15179 !! options
15180 parsoid=html2wt
15181 !! wikitext
15182 [[File:Foobar.jpg|link=Foo &amp; bar]]
15183
15184 <!-- consistency with gallery extension -->
15185 <gallery>
15186 File:Foobar.jpg|link=Foo &amp; bar
15187 </gallery>
15188 !! html/php+tidy
15189 <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>
15190 </p>
15191 <ul class="gallery mw-gallery-traditional">
15192 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15193 <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>
15194 <div class="gallerytext">
15195 </div>
15196 </div></li>
15197 </ul>
15198 !! html/parsoid
15199 <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>
15200
15201 <!-- consistency with gallery extension -->
15202 <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"}}'>
15203 <li class="gallerybox">
15204 <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>
15205 <div class="gallerytext"></div>
15206 </li>
15207 </ul>
15208 !! end
15209
15210 !! test
15211 Ampersand in link attribute (edited html, no data-parsoid) (T206940)
15212 !! wikitext
15213 [[File:Foobar.jpg|link=Foo_&_bar]]
15214
15215 <!-- consistency with gallery extension -->
15216 <gallery>
15217 File:Foobar.jpg|link=Foo_&_bar
15218 </gallery>
15219 !! html/php+tidy
15220 <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>
15221 </p>
15222 <ul class="gallery mw-gallery-traditional">
15223 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15224 <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>
15225 <div class="gallerytext">
15226 </div>
15227 </div></li>
15228 </ul>
15229 !! html/parsoid
15230 <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>
15231
15232 <!-- consistency with gallery extension -->
15233 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15234 <li class="gallerybox">
15235 <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>
15236 <div class="gallerytext"></div>
15237 </li>
15238 </ul>
15239 !! end
15240
15241 !! test
15242 Italics markup in link attribute (T206940)
15243 !! options
15244 parsoid=wt2html,html2html
15245 !! wikitext
15246 [[Foo''s bar''s]]
15247
15248 <!-- Note that "italics" are stripped, even though this is a valid page title -->
15249 [[File:Foobar.jpg|link=Foo''s bar''s|caption1]]
15250
15251 [[File:Foobar.jpg|link=''Main Page''|caption2]]
15252
15253 <!-- consistency with gallery extension -->
15254 <gallery>
15255 File:Foobar.jpg|link=Foo''s bar''s|caption1
15256 File:Foobar.jpg|link=''Main Page''|caption2
15257 </gallery>
15258 !! html/php+tidy
15259 <p><a href="/wiki/Foo%27%27s_bar%27%27s" title="Foo&#39;&#39;s bar&#39;&#39;s">Foo''s bar''s</a>
15260 </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>
15261 </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>
15262 </p>
15263 <ul class="gallery mw-gallery-traditional">
15264 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15265 <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>
15266 <div class="gallerytext">
15267 <p>caption1
15268 </p>
15269 </div>
15270 </div></li>
15271 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15272 <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>
15273 <div class="gallerytext">
15274 <p>caption2
15275 </p>
15276 </div>
15277 </div></li>
15278 </ul>
15279 !! html/parsoid
15280 <p><a rel="mw:WikiLink" href="./Foo''s_bar''s" title="Foo''s bar''s">Foo''s bar''s</a></p>
15281
15282 <!-- Note that "italics" are stripped, even though this is a valid page title -->
15283 <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>
15284
15285 <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>
15286
15287 <!-- consistency with gallery extension -->
15288 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15289 <li class="gallerybox">
15290 <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>
15291 <div class="gallerytext">caption1</div>
15292 </li>
15293 <li class="gallerybox">
15294 <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>
15295 <div class="gallerytext">caption2</div>
15296 </li>
15297 </ul>
15298 !! end
15299
15300 ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
15301 ## are no longer in storage.
15302 !! test
15303 Nowiki markup in link attribute (T206940)
15304 !! options
15305 parsoid=html2wt
15306 !! wikitext
15307 [[File:Foobar.jpg|link=Foo<nowiki>''</nowiki>s_bar<nowiki>''</nowiki>s|caption]]
15308
15309 <!-- consistency with gallery extension -->
15310 <gallery>
15311 File:Foobar.jpg|link=Foo<nowiki>''</nowiki>s_bar<nowiki>''</nowiki>s|caption
15312 </gallery>
15313 !! html/php+tidy
15314 <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>
15315 </p>
15316 <ul class="gallery mw-gallery-traditional">
15317 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15318 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
15319 <div class="gallerytext">
15320 <p>caption
15321 </p>
15322 </div>
15323 </div></li>
15324 </ul>
15325 !! html/parsoid
15326 <p><figure-inline class="mw-default-size" typeof="mw:Image" 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>
15327
15328 <!-- consistency with gallery extension -->
15329 <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"}}'>
15330 <li class="gallerybox">
15331 <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>
15332 <div class="gallerytext">caption</div>
15333 </li>
15334 </ul>
15335 !! end
15336
15337 !! test
15338 Nowiki markup in link attribute (edited html, no data-parsoid) (T206940)
15339 !! wikitext
15340 [[File:Foobar.jpg|link=Foo<nowiki>''s_bar''</nowiki>s|caption]]
15341
15342 <!-- consistency with gallery extension -->
15343 <gallery>
15344 File:Foobar.jpg|link=Foo<nowiki>''s_bar''</nowiki>s|caption
15345 </gallery>
15346 !! html/php+tidy
15347 <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>
15348 </p>
15349 <ul class="gallery mw-gallery-traditional">
15350 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15351 <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>
15352 <div class="gallerytext">
15353 <p>caption
15354 </p>
15355 </div>
15356 </div></li>
15357 </ul>
15358 !! html/parsoid
15359 <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>
15360
15361 <!-- consistency with gallery extension -->
15362 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15363 <li class="gallerybox">
15364 <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>
15365 <div class="gallerytext">caption</div>
15366 </li>
15367 </ul>
15368 !! end
15369
15370 !! test
15371 HTML entity prefix in link markup (T209236)
15372 !! wikitext
15373 [[File:Foobar.jpg|link=https://example.com?foo&params=bar]]
15374
15375 <!-- consistency with gallery extension -->
15376 <gallery>
15377 File:Foobar.jpg|link=https://example.com?foo&params=bar
15378 </gallery>
15379 !! html/php+tidy
15380 <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>
15381 </p>
15382 <ul class="gallery mw-gallery-traditional">
15383 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15384 <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>
15385 <div class="gallerytext">
15386 </div>
15387 </div></li>
15388 </ul>
15389 !! html/parsoid
15390 <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>
15391
15392 <!-- consistency with gallery extension -->
15393 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15394 <li class="gallerybox">
15395 <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>
15396 <div class="gallerytext"></div>
15397 </li>
15398 </ul>
15399 !! end
15400
15401 !! test
15402 Image with table with attributes in caption
15403 !! options
15404 parsoid=wt2html,html2html
15405 !! wikitext
15406 [[File:Foobar.jpg|thumb|
15407 {| class="123" |
15408 |- class="456" |
15409 | ha
15410 |}
15411 ]]
15412 !! html/parsoid
15413 <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>
15414 <table class="123">
15415 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
15416 <td> ha</td></tr>
15417 </tbody></table>
15418 </figcaption></figure>
15419 !! end
15420
15421 !! test
15422 Image with table with rows from templates in caption
15423 !! wikitext
15424 [[File:Foobar.jpg|thumb|
15425 {|
15426 {{echo|{{!}} hi}}
15427 |}
15428 ]]
15429 !! html/parsoid
15430 <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>
15431 <table>
15432 <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>
15433 </tbody></table>
15434 </figcaption></figure>
15435 !! end
15436
15437 !! test
15438 Image with nested tables in caption
15439 !! wikitext
15440 [[File:Foobar.jpg|thumb|Foo<br />
15441 {|
15442 |
15443 {|
15444 |z
15445 |}
15446 |}
15447 ]]
15448 !! html/parsoid
15449 <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}'/>
15450 <table>
15451 <tbody><tr><td>
15452 <table>
15453 <tbody><tr><td>z</td></tr>
15454 </tbody></table></td></tr>
15455 </tbody></table>
15456 </figcaption></figure>
15457 !! end
15458
15459 !! test
15460 Image with heading and horizontal rule in caption
15461 !! wikitext
15462 [[File:Foobar.jpg|thumb|
15463 ===Testing===
15464 123
15465 --------------
15466 ]]
15467 !! html/php
15468 <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>
15469 !! html/parsoid
15470 <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>
15471 <h3 id="Testing">Testing</h3>
15472 123
15473 <hr data-parsoid='{"extra_dashes":10}'/>
15474 </figcaption></figure>
15475 !! end
15476
15477 ###################
15478 # Conflicting image format options.
15479 # First option specified should 'win'.
15480 # All three cases in each test should be identical.
15481
15482 !! test
15483 Image with 'frameless' first.
15484 !! options
15485 parsoid=wt2html,wt2wt,html2html
15486 !! wikitext
15487 [[File:Foobar.jpg|frameless|caption]]
15488
15489 [[File:Foobar.jpg|frameless|frame|caption]]
15490
15491 [[File:Foobar.jpg|frameless|thumb|caption]]
15492 !! html/php
15493 <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>
15494 </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>
15495 </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>
15496 </p>
15497 !! html/parsoid
15498 <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>
15499 <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>
15500 <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>
15501 !! end
15502
15503 !! test
15504 Image with 'frame' first.
15505 !! options
15506 parsoid=wt2html,wt2wt,html2html
15507 !! wikitext
15508 [[File:Foobar.jpg|frame|caption]]
15509 [[File:Foobar.jpg|frame|frameless|caption]]
15510 [[File:Foobar.jpg|frame|thumb|caption]]
15511 !! html/php
15512 <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>
15513 <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>
15514 <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>
15515 !! html/parsoid
15516 <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>
15517 <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>
15518 <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>
15519 !! end
15520
15521 !! test
15522 Image with 'thumb' first.
15523 !! options
15524 parsoid=wt2html,wt2wt,html2html
15525 !! wikitext
15526 [[File:Foobar.jpg|thumb|caption]]
15527 [[File:Foobar.jpg|thumb|frameless|caption]]
15528 [[File:Foobar.jpg|thumb|frame|caption]]
15529 !! html/php
15530 <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>
15531 <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>
15532 <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>
15533 !! html/parsoid
15534 <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>
15535 <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>
15536 <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>
15537 !! end
15538
15539 ###################
15540 # Image sizing.
15541 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
15542 # and https://phabricator.wikimedia.org/T64258
15543 # Foobar has actual size of 1941x220
15544 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
15545 # a scalable format.
15546 # 2. Framed images always ignore size options; always render at default size.
15547 # 3. "Unspecified format" and border are the only types which can be
15548 # enlarged.
15549
15550 !! test
15551 Image: unspecified format and border enlarge
15552 !! options
15553 parsoid=wt2html,wt2wt,html2html
15554 !! wikitext
15555 [[File:Foobar.jpg|2000px]]
15556
15557 [[File:Foobar.jpg|border|2000px]]
15558 !! html/php
15559 <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>
15560 </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>
15561 </p>
15562 !! html/parsoid
15563 <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>
15564 <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>
15565 !! end
15566
15567 !! test
15568 Image: "unspecified format" and border reduce
15569 !! options
15570 parsoid=wt2html,wt2wt,html2html
15571 !! wikitext
15572 [[File:Foobar.jpg|1000px]]
15573
15574 [[File:Foobar.jpg|border|1000px]]
15575 !! html/php
15576 <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>
15577 </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>
15578 </p>
15579 !! html/parsoid
15580 <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>
15581 <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>
15582 !! end
15583
15584 !! test
15585 Image: thumbs reduce
15586 !! options
15587 parsoid=wt2html,wt2wt,html2html
15588 !! wikitext
15589 [[File:Foobar.jpg|thumb|50px]]
15590 !! html/php
15591 <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>
15592 !! html/parsoid
15593 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a><figcaption></figcaption></figure>
15594 !! end
15595
15596 !! test
15597 Image: bitmap thumbs can't be enlarged past original size, but vector can.
15598 !! options
15599 parsoid=wt2html,wt2wt,html2html
15600 !! wikitext
15601 [[File:Foobar.jpg|thumb|2000px]]
15602
15603 [[File:Foobar.svg|thumb|2000px]]
15604 !! html/php
15605 <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>
15606 <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>
15607 !! html/parsoid
15608 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption></figcaption></figure>
15609 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a><figcaption></figcaption></figure>
15610 !! end
15611
15612 !! test
15613 Image: frameless can reduce in size
15614 !! options
15615 parsoid=wt2html,wt2wt,html2html
15616 !! wikitext
15617 [[File:Foobar.jpg|frameless|50px]]
15618 !! html/php
15619 <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>
15620 </p>
15621 !! html/parsoid
15622 <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>
15623 !! end
15624
15625 !! test
15626 Image: bitmap frameless can't be enlarged past original size, but vector can
15627 !! options
15628 parsoid=wt2html,wt2wt,html2html
15629 !! wikitext
15630 [[File:Foobar.jpg|frameless|2000px]]
15631
15632 [[File:Foobar.svg|frameless|2000px]]
15633 !! html/php
15634 <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>
15635 </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>
15636 </p>
15637 !! html/parsoid
15638 <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>
15639 <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>
15640 !! end
15641
15642 !! test
15643 Image: framed images are always unscaled.
15644 !! options
15645 parsoid=wt2html,wt2wt,html2html
15646 !! wikitext
15647 [[File:Foobar.jpg|frame]]
15648
15649 [[File:Foobar.jpg|frame|50px]]
15650
15651 [[File:Foobar.jpg|frame|50x50px]]
15652
15653 [[File:Foobar.jpg|frame|2000px]]
15654 !! html/php
15655 <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>
15656 <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>
15657 <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>
15658 <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>
15659 !! html/parsoid
15660 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption></figcaption></figure>
15661 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption></figcaption></figure>
15662 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption></figcaption></figure>
15663 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption></figcaption></figure>
15664 !! end
15665
15666 ###################
15667
15668 !! test
15669 Link to image page- image page normally doesn't exists, hence edit link
15670 Add test with existing image page
15671 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
15672 !! wikitext
15673 [[:Image:test]]
15674 !! html
15675 <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>
15676 </p>
15677 !! end
15678
15679 !! test
15680 T20784 Link to non-existent image page with caption should use caption as link text
15681 !! wikitext
15682 [[:Image:test|caption]]
15683 !! html
15684 <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>
15685 </p>
15686 !! end
15687
15688 !! test
15689 Frameless image caption with a free URL
15690 !! wikitext
15691 [[File:Foobar.jpg|http://example.com]]
15692 !! html/php
15693 <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>
15694 </p>
15695 !! html/parsoid
15696 <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>
15697 !! end
15698
15699 !! test
15700 Thumbnail image caption with a free URL
15701 !! options
15702 thumbsize=220
15703 !! wikitext
15704 [[File:Foobar.jpg|thumb|http://example.com]]
15705 !! html/php
15706 <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>
15707 !! html/parsoid
15708 <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>
15709 !! end
15710
15711 !! test
15712 Thumbnail image caption with a free URL and explicit alt
15713 !! options
15714 thumbsize=220
15715 parsoid=wt2html,wt2wt,html2html
15716 !! wikitext
15717 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15718 !! html/php
15719 <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>
15720 !! html/parsoid
15721 <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>
15722 !! end
15723
15724 !! test
15725 SVG thumbnails with no language set
15726 !! options
15727 !! wikitext
15728 [[File:Foobar.svg|thumb|caption]]
15729 !! html/php
15730 <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>
15731 !! html/parsoid
15732 <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>
15733 !! end
15734
15735 !! test
15736 SVG thumbnails with language de
15737 !! options
15738 parsoid=wt2html,wt2wt,html2html
15739 !! wikitext
15740 [[File:Foobar.svg|thumb|caption|lang=de]]
15741 !! html/php
15742 <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>
15743 !! html/parsoid
15744 <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>
15745 !! end
15746
15747 !! test
15748 SVG thumbnails with invalid language code
15749 !! options
15750 parsoid=wt2html,wt2wt,html2html
15751 !! wikitext
15752 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15753 !! html/php
15754 <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>
15755 !! html/parsoid
15756 <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>
15757 !! end
15758
15759 !! test
15760 SVG thumbnails in page language
15761 !! options
15762 language=ru
15763 !! wikitext
15764 [[File:Foobar.svg]] [[File:Foobar.svg|lang=en]]
15765 !! html/php
15766 <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>
15767 </p>
15768 !! end
15769
15770 !! test
15771 SVG thumbnails in page language not present in the file
15772 !! options
15773 language=de
15774 !! wikitext
15775 [[File:Foobar.svg]] [[File:Foobar.svg|lang=ru]]
15776 !! html/php
15777 <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>
15778 </p>
15779 !! end
15780
15781 !! test
15782 T3887: A ISBN with a thumbnail
15783 !! wikitext
15784 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15785 !! html/php
15786 <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>
15787 !! html/parsoid
15788 <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>
15789 !! end
15790
15791 !! test
15792 T3887: A RFC with a thumbnail
15793 !! wikitext
15794 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15795 !! html/php
15796 <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>
15797 !! html/parsoid
15798 <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>
15799 !! end
15800
15801 !! test
15802 T3887: A mailto link with a thumbnail
15803 !! wikitext
15804 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15805 !! html/php
15806 <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>
15807 !! html/parsoid
15808 <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>
15809 !! end
15810
15811 # Pending resolution to T2368
15812 !! test
15813 T2648: Frameless image caption with a link
15814 !! wikitext
15815 [[File:Foobar.jpg|text with a [[link]] in it]]
15816 !! html/php
15817 <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>
15818 </p>
15819 !! html/parsoid
15820 <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>
15821 !! end
15822
15823 !! test
15824 T2648: Frameless image caption with a link (suffix)
15825 !! wikitext
15826 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15827 !! html/php
15828 <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>
15829 </p>
15830 !! html/parsoid
15831 <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>
15832 !! end
15833
15834 !! test
15835 T2648: Frameless image caption with an interwiki link
15836 !! wikitext
15837 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15838 !! html/php
15839 <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>
15840 </p>
15841 !! html/parsoid
15842 <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>
15843 !! end
15844
15845 !! test
15846 T2648: Frameless image caption with a piped interwiki link
15847 !! wikitext
15848 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15849 !! html/php
15850 <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>
15851 </p>
15852 !! html/parsoid
15853 <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>
15854 !! end
15855
15856 !! test
15857 T107474: Frameless image caption with <nowiki>
15858 !! wikitext
15859 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15860 !! html/parsoid
15861 <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>
15862 !! end
15863
15864 !! test
15865 Escape HTML special chars in image alt text
15866 !! wikitext
15867 [[File:Foobar.jpg|& < > "]]
15868 !! html/php
15869 <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>
15870 </p>
15871 !! html/parsoid
15872 <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>
15873 !! end
15874
15875 !! test
15876 Escape HTML special chars in image alt text with LanguageConverter
15877 !! options
15878 language=zh
15879 !! wikitext
15880 [[File:Foobar.jpg|& < > "]]
15881 !! html/php
15882 <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>
15883 </p>
15884 !! html/parsoid
15885 <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>
15886 !! end
15887
15888 !! test
15889 Entities in file name and attributes
15890 !! wikitext
15891 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15892 !! html/php
15893 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15894 </p>
15895 !! html/parsoid
15896 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"manualthumb=7%25 solution.gif"},{"ck":"link","ak":"link=7%25 solution"},{"ck":"caption","ak":"[[7%25 solution]]"}]}' data-mw='{"attribs":[["link",{"txt":"7%25 solution"}]],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&apos;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&apos;>7% solution&lt;/a>","errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/7%25_solution.gif"><span resource="./File:7%25_solution.gif" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif"},"sa":{"resource":"File:7%25 solution.gif"}}'>File:7% solution.gif</span></a></figure-inline></p>
15897 !! end
15898
15899 !! test
15900 T2499: Alt text should have &#1234;, not &amp;1234;
15901 !! wikitext
15902 [[File:Foobar.jpg|&#9792;]]
15903 !! html/php
15904 <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>
15905 </p>
15906 !! html/parsoid
15907 <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>
15908 !! end
15909
15910 !! test
15911 Broken image caption with link
15912 !! options
15913 parsoid=wt2html,wt2wt,html2html
15914 !! wikitext
15915 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15916 !! html/php
15917 <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.
15918 </p>
15919 !! html/parsoid
15920 <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>
15921 !! end
15922
15923 !! test
15924 Image caption containing another image
15925 !! wikitext
15926 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15927 !! html/php
15928 <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>
15929 !! html/parsoid
15930 <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>
15931 !! end
15932
15933 !! test
15934 Image: caption containing a newline
15935 !! wikitext
15936 [[File:Foobar.jpg|This
15937 *is some text]]
15938 !! html/php
15939 <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>
15940 </p>
15941 !! html/parsoid
15942 <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>
15943 !!end
15944
15945 !!test
15946 Image: caption containing leading space
15947 (The leading space should not trigger nowiki escaping in wt2wt mode)
15948 !! wikitext
15949 [[File:Foobar.jpg|thumb| bar]]
15950 !! html/php
15951 <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>
15952 !! html/parsoid
15953 <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>
15954 !!end
15955
15956 # html/php output not have newlines after table, td, th, etc. because
15957 # Linker::makeThumbLink2() replaces the newlines with spaces since
15958 # the table is inside a caption.
15959 # FIXME: Verify if that circa 2004 fix is still required.
15960 !! test
15961 Image: caption containing a table
15962 !! options
15963 parsoid=wt2html,wt2wt,html2html
15964 !! wikitext
15965 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15966 {|
15967 !Foo!!Bar
15968 |-
15969 |Foo1||Bar1
15970 |}
15971 and some more text.]]
15972 !! html/php
15973 <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>
15974 !! html/parsoid
15975 <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
15976 <table>
15977 <tbody>
15978 <tr><th>Foo</th><th>Bar</th></tr>
15979 <tr>
15980 <td>Foo1</td>
15981 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15982 !! end
15983
15984 !! test
15985 T5090: External links other than http: in image captions
15986 !! wikitext
15987 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15988 !! html/php
15989 <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>
15990 !! html/parsoid
15991 <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>
15992 !! end
15993
15994 !! test
15995 Custom class
15996 !! options
15997 parsoid=wt2html,wt2wt,html2html
15998 !! wikitext
15999 [[Image:foobar.jpg|a|class=b]]
16000 !! html/php
16001 <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>
16002 </p>
16003 !! html/parsoid
16004 <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>
16005 !! end
16006
16007 !! test
16008 Localized image handling (1).
16009 !! options
16010 parsoid=wt2html,wt2wt,html2html
16011 language=es
16012 !! wikitext
16013 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
16014 !! html/php
16015 <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>
16016 !! html/parsoid
16017 <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>
16018 !! end
16019
16020 !! test
16021 Localized image handling (2).
16022 !! options
16023 thumbsize=220
16024 parsoid=wt2html,wt2wt,html2html
16025 language=es
16026 !! wikitext
16027 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
16028 !! html/php
16029 <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>
16030 !! html/parsoid
16031 <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>
16032 !! end
16033
16034 !! test
16035 Localized image handling (3).
16036 !! options
16037 language=fa
16038 parsoid=html2wt
16039 !! html/parsoid
16040 <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>
16041 !! wikitext
16042 [[File:Foobar.jpg|بندانگشتی]]
16043 !! end
16044
16045 !! test
16046 "border", "frameless" and "class" attributes on an image.
16047 !! options
16048 thumbsize=220
16049 parsoid=wt2html,wt2wt,html2html
16050 !! wikitext
16051 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
16052 !! html/php
16053 <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>
16054 </p>
16055 !! html/parsoid
16056 <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>
16057 !! end
16058
16059 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
16060 !! test
16061 Invalid image attributes (T64500)
16062 !! options
16063 thumbsize=220
16064 parsoid=wt2html,wt2wt,html2html
16065 !! wikitext
16066 [[File:Foobar.jpg|thumb|float|left|caption]]
16067
16068 [[File:Foobar.jpg|thumb|righ|caption]]
16069
16070 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
16071 !! html/php
16072 <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>
16073 <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>
16074 <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>
16075 !! html/parsoid
16076 <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>
16077 <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>
16078 <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>
16079 !! end
16080
16081 !! article
16082 File:Barfoo.jpg
16083 !! text
16084 #REDIRECT [[File:Barfoo.jpg]]
16085 !! endarticle
16086
16087 # FIXME: Parsoid should run this test -- but we'd need to teach the
16088 # mockAPI about the redirected Barfoo.jpg image.
16089 !! test
16090 Redirected image
16091 !! wikitext
16092 [[Image:Barfoo.jpg]]
16093 !! html/php
16094 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
16095 </p>
16096 !! end
16097
16098 ## FIXME: Parsoid needs to learn about this flag.
16099 !! test
16100 Missing image with uploads disabled
16101 !! options
16102 wgEnableUploads=0
16103 !! wikitext
16104 [[File:Foobaz.jpg]]
16105 !! html/php
16106 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
16107 </p>
16108 !! html/parsoid
16109 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Foobaz.jpg"><span resource="./File:Foobaz.jpg">File:Foobaz.jpg</span></a></figure-inline></p>
16110 !! end
16111
16112 # Parsoid-specific testing for images
16113 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
16114 # Currently imperfect due to a flaw in the Parsoid testrunner
16115 # Work in progress
16116 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
16117 # image tests.
16118
16119 !! test
16120 Parsoid-specific image handling - simple image with size and middle alignment
16121 !! wikitext
16122 [[File:Foobar.jpg|middle|50px]]
16123 !! html/parsoid
16124 <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>
16125 !! end
16126
16127 !! test
16128 Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
16129 !! options
16130 parsoid=wt2wt,wt2html,html2html
16131 !! wikitext
16132 [[Image:Foobar.jpg|middle|50px]]
16133 !! html/parsoid
16134 <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>
16135 !! end
16136
16137 !! test
16138 Parsoid-specific image handling - simple image with size and middle alignment (existing content)
16139 !! wikitext
16140 [[File:Foobar.jpg|50px|middle]]
16141 !! html/parsoid
16142 <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>
16143 !! end
16144
16145 !! test
16146 Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
16147 !! options
16148 parsoid=wt2html,wt2wt,html2html
16149 !! wikitext
16150 [[Image:Foobar.jpg|50px|middle]]
16151 !! html/parsoid
16152 <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>
16153 !! end
16154
16155 !! test
16156 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
16157 !! wikitext
16158 [[File:Foobar.jpg|500x10px|baseline|caption]]
16159 !! html/parsoid
16160 <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>
16161 !! end
16162
16163 !! test
16164 Parsoid-specific image handling - simple image with border and size spec
16165 !! wikitext
16166 [[File:Foobar.jpg|50px|border|caption]]
16167 !! html/parsoid
16168 <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>
16169 !! end
16170
16171 !! test
16172 Parsoid-specific image handling - thumbnail with halign, valign, and caption
16173 !! options
16174 parsoid=wt2html,html2html
16175 !! wikitext
16176 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
16177 !! html/parsoid
16178 <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>
16179 !! end
16180
16181 !! test
16182 Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
16183 !! options
16184 parsoid=wt2html,html2html
16185 !! wikitext
16186 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
16187 !! html/parsoid
16188 <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>
16189 !! end
16190
16191 !! test
16192 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
16193 !! options
16194 parsoid=wt2html,html2html
16195 !! wikitext
16196 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
16197 !! html/parsoid
16198 <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>
16199 !! end
16200
16201 !! test
16202 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
16203 !! options
16204 parsoid=wt2html,html2html
16205 !! wikitext
16206 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
16207 !! html/parsoid
16208 <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>
16209 !! end
16210
16211 !! test
16212 Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
16213 !! options
16214 parsoid=wt2html,wt2wt,html2html
16215 !! wikitext
16216 [[File:Foobar.jpg|frame|500x50px|caption]]
16217 !! html/parsoid
16218 <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>
16219 !! end
16220
16221 !! test
16222 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
16223 !! options
16224 parsoid=wt2html,html2html
16225 !! wikitext
16226 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
16227 !! html/parsoid
16228 <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>
16229 !! end
16230
16231 !! test
16232 Parsoid-specific image handling - frameless image with specific size, border, and caption
16233 !! wikitext
16234 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
16235 !! html/parsoid
16236 <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>
16237 !! end
16238
16239 !! test
16240 Parsoid-specific image handling - simple image with a formatted caption
16241 !! wikitext
16242 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
16243 !! html/parsoid
16244 <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>
16245 !! end
16246
16247 !! test
16248 Parsoid-specific image handling - caption with a template in it
16249 !! wikitext
16250 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
16251 !! html/parsoid
16252 <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>
16253 !! end
16254
16255 !! test
16256 Parsoid-specific image handling - caption with unbalanced tags in it
16257 !! options
16258 parsoid=wt2html,wt2wt,html2html
16259 !! wikitext
16260 foo
16261 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
16262 bar
16263 !! html/parsoid
16264 <p>foo</p>
16265 <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>
16266 <p>bar</p>
16267 !! end
16268
16269 !! test
16270 Parsoid-specific image handling - empty caption (1)
16271 !! options
16272 parsoid=wt2html,wt2wt
16273 !! wikitext
16274 [[File:Foobar.jpg|thumb|]]
16275 !! html/parsoid
16276 <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>
16277 !! end
16278
16279 # empty captions don't get serialized unless we're in the "round trip" case
16280 !! test
16281 Parsoid-specific image handling - empty caption (2)
16282 !! options
16283 parsoid=html2wt
16284 !! html/parsoid
16285 <figure class="mw-default-size" typeof="mw:Image/Thumb">
16286 <a href="./File:Foobar.jpg">
16287 <img resource="./File:Foobar.jpg"
16288 src="//example.com/images/3/3a/Foobar.jpg"
16289 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
16290 height="25" width="220"/>
16291 </a>
16292 <figcaption></figcaption>
16293 </figure>
16294 !! wikitext
16295 [[File:Foobar.jpg|thumb]]
16296 !! end
16297
16298 !! test
16299 Parsoid-specific image handling - whitespace caption
16300 !! wikitext
16301 [[File:Foobar.jpg|thumb| ]]
16302 !! html/parsoid
16303 <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>
16304 !! end
16305
16306 !! test
16307 Parsoid-specific image handling - lang option
16308 !! wikitext
16309 foo
16310 [[File:Foobar.svg|lang=de|caption]]
16311 bar
16312 !! html/parsoid
16313 <p>foo
16314 <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>
16315 bar</p>
16316 !! end
16317
16318 ## Edge case bugs in Parsoid from T93580
16319 !! test
16320 T93580: 1. Templated <ref> inside block images
16321 !! wikitext
16322 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
16323
16324 <references />
16325 !! html/parsoid
16326 <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>
16327
16328 <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>
16329 !! end
16330
16331 !! test
16332 T93580: 2. <ref> inside inline images
16333 !! wikitext
16334 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
16335
16336 <references />
16337 !! html/parsoid
16338 <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>
16339
16340 <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>
16341 !! end
16342
16343 !! test
16344 T93580: 3. Templated <ref> inside inline images
16345 !! wikitext
16346 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
16347
16348 <references />
16349 !! html/parsoid
16350 <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>
16351
16352 <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>
16353 !! end
16354
16355 ###
16356 ### Subpages
16357 ###
16358 !! article
16359 Subpage test/subpage
16360 !! text
16361 foo
16362 !! endarticle
16363
16364 !! test
16365 Subpage link
16366 !! options
16367 subpage title=[[Subpage test]]
16368 !! wikitext
16369 [[/subpage]]
16370 !! html
16371 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
16372 </p>
16373 !! end
16374
16375 !! test
16376 Subpage noslash link
16377 !! options
16378 subpage title=[[Subpage test]]
16379 !! wikitext
16380 [[/subpage/]]
16381 !! html
16382 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
16383 </p>
16384 !! end
16385
16386 !! article
16387 Subpage test/1/2/subpage
16388 !! text
16389 blah
16390 !! endarticle
16391
16392 !! test
16393 Relative subpage noslash link
16394 !! options
16395 parsoid=wt2wt,wt2html,html2html
16396 subpage title=[[Subpage test/1/2/3/4]]
16397 !! wikitext
16398 [[../../subpage/]]
16399
16400 [[../../subpage]]
16401 !! html/php
16402 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
16403 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
16404 </p>
16405 !! html/parsoid
16406 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
16407 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
16408 !! end
16409
16410 !! test
16411 Parsoid: dot-slash prefixed wikilinks
16412 !! wikitext
16413 [[./foo]]
16414
16415 [[././bar]]
16416
16417 [[././baz/]]
16418 !! html/php
16419 <p>[[./foo]]
16420 </p><p>[[././bar]]
16421 </p><p>[[././baz/]]
16422 </p>
16423 !! html/parsoid
16424 <p>[[./foo]]
16425 </p><p>[[././bar]]
16426 </p><p>[[././baz/]]
16427 </p>
16428 !! end
16429
16430 !! test
16431 Render invalid page names as plain text (T53090)
16432 !! wikitext
16433 [[./../foo|bar]]
16434 [[foo�|bar]]
16435 [[foo/.|bar]]
16436 [[foo/..|bar]]
16437 [[foo~~~bar]]
16438 [[foo>bar]]
16439 [[foo[bar]]
16440 [[.]]
16441 [[..]]
16442 [[foo././bar]]
16443 [[foo[http://example.com]xyz]]
16444
16445 [[{{echo|./../foo}}|bar]]
16446 [[{{echo|foo/.}}|bar]]
16447 [[{{echo|foo/..}}|bar]]
16448 [[{{echo|foo~~~~bar}}]]
16449 [[{{echo|foo>bar}}]]
16450 [[{{echo|foo././bar}}]]
16451 [[{{echo|foo{bar}}]]
16452 [[{{echo|foo}bar}}]]
16453 [[{{echo|foo[bar}}]]
16454 [[{{echo|foo]bar}}]]
16455 [[{{echo|foo<bar}}]]
16456 !!html/php
16457 <p>[[./../foo|bar]]
16458 [[foo�|bar]]
16459 [[foo/.|bar]]
16460 [[foo/..|bar]]
16461 [[foo~~~bar]]
16462 [[foo&gt;bar]]
16463 [[foo[bar]]
16464 [[.]]
16465 [[..]]
16466 [[foo././bar]]
16467 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
16468 </p><p>[[./../foo|bar]]
16469 [[foo/.|bar]]
16470 [[foo/..|bar]]
16471 [[foo~~~~bar]]
16472 [[foo&gt;bar]]
16473 [[foo././bar]]
16474 [[foo{bar]]
16475 [[foo}bar]]
16476 [[foo[bar]]
16477 [[foo]bar]]
16478 [[foo&lt;bar]]
16479 </p>
16480 !!html/parsoid
16481 <p>[[./../foo|bar]]
16482 [[foo�|bar]]
16483 [[foo/.|bar]]
16484 [[foo/..|bar]]
16485 [[foo~~~bar]]
16486 [[foo>bar]]
16487 [[foo[bar]]
16488 [[.]]
16489 [[..]]
16490 [[foo././bar]]
16491 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
16492
16493 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
16494 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
16495 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
16496 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
16497 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
16498 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
16499 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
16500 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
16501 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
16502 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
16503 [[<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>
16504 !!end
16505
16506 !! test
16507 Disabled subpages
16508 !! wikitext
16509 [[/subpage]]
16510 !! html
16511 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
16512 </p>
16513 !! end
16514
16515 !! test
16516 T2561: {{/Subpage}}
16517 !! options
16518 subpage title=[[Page]]
16519 !! wikitext
16520 {{/Subpage}}
16521 !! html
16522 <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>
16523 </p>
16524 !! end
16525
16526 ###
16527 ### Categories
16528 ###
16529 !! article
16530 Category:MediaWiki User's Guide
16531 !! text
16532 blah
16533 !! endarticle
16534
16535 !! test
16536 Link to category
16537 !! wikitext
16538 [[:Category:MediaWiki User's Guide]]
16539 !! html
16540 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
16541 </p>
16542 !! end
16543
16544 !! test
16545 Simple category
16546 !! options
16547 cat
16548 !! wikitext
16549 [[Category:MediaWiki User's Guide]]
16550 !! html/php
16551 cat=MediaWiki_User's_Guide sort=
16552 !! html/parsoid
16553 <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"}}'/>
16554 !! end
16555
16556 !! test
16557 PAGESINCATEGORY invalid title fatal (r33546 fix)
16558 !! wikitext
16559 {{PAGESINCATEGORY:<bogus>}}
16560 !! html
16561 <p>0
16562 </p>
16563 !! end
16564
16565 !! test
16566 Category with different sort key
16567 !! options
16568 cat
16569 !! wikitext
16570 [[Category:MediaWiki User's Guide|Foo]]
16571 !! html/php
16572 cat=MediaWiki_User's_Guide sort=Foo
16573 !! html/parsoid
16574 <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"}}'/>
16575 !! end
16576
16577 !! test
16578 Category with identical sort key
16579 !! options
16580 cat
16581 !! wikitext
16582 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16583 !! html/php
16584 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
16585 !! html/parsoid
16586 <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"}}'/>
16587 !! end
16588
16589 !! test
16590 Category with empty sort key
16591 !! options
16592 cat
16593 pst
16594 !! wikitext
16595 [[Category:MediaWiki User's Guide|]]
16596 !! html/php
16597 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16598 !! end
16599
16600 !! test
16601 Category with empty sort key and parentheses
16602 !! options
16603 cat
16604 pst
16605 !! wikitext
16606 [[Category:Foo (bar)|]]
16607 !! html/php
16608 [[Category:Foo (bar)|Foo]]
16609 !! end
16610
16611 !! test
16612 Category with link tail
16613 !! options
16614 cat
16615 pst
16616 !! wikitext
16617 123[[Category:Foo]]456
16618 !! html/php
16619 123[[Category:Foo]]456
16620 !! end
16621
16622 !! test
16623 Category with template
16624 !! options
16625 cat
16626 pst
16627 !! wikitext
16628 [[Category:{{echo|Foo}}]]
16629 !! html/php
16630 [[Category:{{echo|Foo}}]]
16631 !! end
16632
16633 !! test
16634 Category with template in sort key
16635 !! options
16636 cat
16637 pst
16638 !! wikitext
16639 [[Category:Foo|{{echo|Bar}}]]
16640 !! html/php
16641 [[Category:Foo|{{echo|Bar}}]]
16642 !! end
16643
16644 !! test
16645 Category with template in sort key and title
16646 !! options
16647 cat
16648 pst
16649 !! wikitext
16650 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16651 !! html/php
16652 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16653 !! end
16654
16655 ## We used to, but no longer wt2wt this test since the default serializer
16656 ## will normalize all categories to serialize on their own line.
16657 ## This wikitext usage is going to be fairly uncommon in production and
16658 ## selser will take care of preserving formatting in those scenarios.
16659 !! test
16660 Category / paragraph interactions
16661 !! options
16662 parsoid=wt2html
16663 !! wikitext
16664 Foo [[Category:Baz]] Bar
16665
16666 Foo [[Category:Baz]]
16667 Bar
16668
16669 Foo
16670 [[Category:Baz]]
16671 Bar
16672
16673 Foo
16674 [[Category:Baz]] Bar
16675
16676 Foo
16677 [[Category:Baz]]
16678 [[Category:Baz]]
16679 [[Category:Baz]]
16680 Bar
16681
16682 [[Category:Baz]]
16683 [[Category:Baz]]
16684 [[Category:Baz]]
16685
16686 [[Category:Baz]]
16687 {{echo|[[Category:Baz]]}}
16688 [[Category:Baz]]
16689 !! html/php
16690 <p>Foo Bar
16691 </p><p>Foo
16692 Bar
16693 </p><p>Foo
16694 Bar
16695 </p><p>Foo Bar
16696 </p><p>Foo
16697 Bar
16698 </p>
16699 !! html/parsoid
16700 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16701 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16702 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16703 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16704 <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>
16705 <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}}]}'/>
16706 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16707 !! end
16708
16709 ## We used to, but no longer wt2wt this test since the default serializer
16710 ## will normalize all categories to serialize on their own line.
16711 ## This wikitext usage is going to be fairly uncommon in production and
16712 ## selser will take care of preserving formatting in those scenarios.
16713 ##
16714 ## The whitespace on the empty line is part of the test. Please do not delete
16715 !! test
16716 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16717 !! options
16718 parsoid=wt2html
16719 !! wikitext
16720 This
16721
16722 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16723
16724 {{echo|[[Category:Foo]] and so should this!}}
16725 !! html/php
16726 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16727 </p>
16728 !! html/parsoid
16729 <p>This
16730
16731 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16732
16733 <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>
16734 !! end
16735
16736 ## Parsoid will not try to wt2wt this while preserving newlines because
16737 ## it suppresses excess newlines within list items -- and we don't want to
16738 ## introduce a special case just for categories, which is, in reality somewhat
16739 ## odd behavior -- categories are unlikely to be used in list items like this
16740 ## in top-level pages and are only likely to show up in template-generated
16741 ## list items where this RT-ing is a non-issue.
16742 ##
16743 ## The whitespace on the empty line is part of the test. Please do not delete
16744 !! test
16745 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16746 !! options
16747 parsoid=wt2html
16748 !! wikitext
16749 * This
16750
16751 [[Category:Foo]] and this should be part of the same list item
16752 * So should this
16753
16754 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16755 !! html/php+tidy
16756 <ul><li>This and this should be part of the same list item</li>
16757 <li>So should this and this should be part of the same list item</li></ul>
16758 !! html/parsoid
16759 <ul>
16760 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16761 <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>
16762 </ul>
16763 !! end
16764
16765 ## Newlines and categories that follow the last item of a list
16766 ## are treated differently because this (list followed by categories)
16767 ## is an extremely common pattern on wikis.
16768 !! test
16769 3. Categories and newlines: newline suppression for last list item should RT properly
16770 !! wikitext
16771 *a
16772 *b
16773
16774 [[Category:Foo]]
16775
16776 [[Category:Bar]]
16777 [[Category:Baz]]
16778
16779 :c
16780
16781 [[Category:C]]
16782
16783 ;d
16784
16785 [[Category:D]]
16786 !! html/parsoid
16787 <ul><li>a</li>
16788 <li>b</li></ul>
16789
16790 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16791
16792 <link rel="mw:PageProp/Category" href="./Category:Bar"/>
16793 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16794
16795 <dl><dd>c</dd></dl>
16796
16797 <link rel="mw:PageProp/Category" href="./Category:C"/>
16798
16799 <dl><dt>d</dt></dl>
16800
16801 <link rel="mw:PageProp/Category" href="./Category:D"/>
16802 !! end
16803
16804 !! test
16805 4. Categories and newlines: newline suppression for last list item should RT properly
16806 !! wikitext
16807 *a
16808 ****b
16809
16810 [[Category:Foo]]
16811 !! html/parsoid
16812 <ul><li>a
16813 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
16814
16815 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16816 !! end
16817
16818 ## only wt2html for this to make sure the algo only applies to the rightmost path
16819 !! test
16820 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16821 !! options
16822 parsoid=wt2html
16823 !! wikitext
16824 *a
16825 **b
16826 [[Category:Foo]]
16827 *c
16828 **d
16829 [[Category:Foo]]
16830 !! html/parsoid
16831 <ul><li>a
16832 <ul><li>b
16833 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16834 <li>c
16835 <ul><li>d</li></ul></li></ul>
16836 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16837 !! end
16838
16839 ## We used to, but no longer wt2wt this test since the default serializer
16840 ## will normalize all categories to serialize on their own line.
16841 ## This wikitext usage is going to be fairly uncommon in production and
16842 ## selser will take care of preserving formatting in those scenarios.
16843 !! test
16844 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16845 !! options
16846 parsoid=wt2html
16847 !! wikitext
16848 *a [[Category:Foo]]
16849 !! html/parsoid
16850 <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>
16851 !! end
16852
16853 # This test also demonstrates because of newline+category tunneling
16854 # through the list hander, template wrapping doesn't expand to the
16855 # containing list when the list item swallows the category.
16856 !! test
16857 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16858 !! wikitext
16859 *{{echo|a
16860 [[Category:Foo]]}}
16861 !! html/parsoid
16862 <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
16863 </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>
16864 !! end
16865
16866 !! test
16867 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16868 !! wikitext
16869 *a
16870
16871 {{echo|[[Category:Foo]]
16872 [[Category:Bar]]}}
16873 [[Category:Baz]]
16874 !! html/parsoid
16875 <ul><li>a</li></ul>
16876
16877 <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">
16878 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16879 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16880 !! end
16881
16882 !! test
16883 Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
16884 !! wikitext
16885 *a
16886
16887 [[Category:Bar]]<!--boo1--> <!--boo2-->
16888 [[Category:Baz]]<!--boo3--> <!--boo4-->
16889 !! html/parsoid
16890 <ul><li>a</li></ul>
16891
16892 <link rel="mw:PageProp/Category" href="./Category:Bar"/><!--boo1--> <!--boo2-->
16893 <link rel="mw:PageProp/Category" href="./Category:Baz"/><!--boo3--> <!--boo4-->
16894 !! end
16895
16896 !! test
16897 Categories and newlines: should behave properly with linkprefix (T87753)
16898 !! options
16899 language=ar
16900 !! wikitext
16901 foo bar
16902 foo bar
16903 [[تصنيف:Foo]]
16904 [[تصنيف:Bar]]
16905 !! html/php
16906 <p>foo bar
16907 foo bar
16908 </p>
16909 !! html/parsoid
16910 <p>foo bar
16911 foo bar</p>
16912 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16913 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16914 !! end
16915
16916 !! test
16917 No regressions on internal links following category (T174639)
16918 !! options
16919 parsoid=wt2html,html2html
16920 !! wikitext
16921 [[Category:Foo]]<div>a
16922
16923 [[Foo]]</div>
16924 !! html/php
16925 <div>a
16926 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16927 !! html/parsoid
16928 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16929
16930 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16931 !! end
16932
16933 # Note that Parsoid differs slightly from PHP due to T175421
16934 !! test
16935 11. Special case where only newlines separate links (T175416)
16936 !! options
16937 parsoid=wt2html,html2html
16938 !! wikitext
16939 [[Category:Foo]]
16940
16941 [[Foo]][[es:Alimento]]
16942
16943 [[Foo]]
16944 !! html/php
16945 <p><br />
16946 <a href="/wiki/Foo" title="Foo">Foo</a>
16947 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16948 </p>
16949 !! html/parsoid
16950 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16951
16952 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16953
16954 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16955 !! end
16956
16957 !! test
16958 Category links with multiple namespaces
16959 !! wikitext
16960 [[Category:Project:Foo]]
16961 !! html/parsoid
16962 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16963 !! end
16964
16965 !! test
16966 Parsoid: Serialize link to category page with colon escape
16967 !! wikitext
16968
16969 [[:Category:Foo]]
16970 [[:Category:Foo|Bar]]
16971 !! html/php+tidy
16972 <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>
16973 <a href="/index.php?title=Category:Foo&amp;action=edit&amp;redlink=1" class="new" title="Category:Foo (page does not exist)">Bar</a>
16974 </p>
16975 !! html/parsoid
16976 <p>
16977 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16978 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16979 </p>
16980 !! end
16981
16982 # We used to, but no longer wt2wt this test since the default serializer
16983 # will normalize all categories to serialize on their own line.
16984 # This wikitext usage is going to be fairly uncommon in production and
16985 # selser will take care of preventing whitespace insertion if this
16986 # occurs in an article.
16987 #
16988 # html2html disabled for the same reason (whitespace insertion between
16989 # x and y).
16990 #
16991 # html2wt disabled because it localizes the "Category" namespace.
16992 !! test
16993 Link prefix/suffixes aren't applied to category links
16994 !! options
16995 parsoid=wt2html
16996 language=is
16997 !! wikitext
16998 x[[Category:Foo]]y
16999 !! html/php
17000 <p>xy
17001 </p>
17002 !! html/parsoid
17003 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
17004 !! end
17005
17006 !! test
17007 Link prefix/suffixes aren't applied to language links
17008 !! options
17009 parsoid=wt2html
17010 language=is
17011 !! wikitext
17012 x[[es:Foo]]y
17013 !! html/php
17014 <p>xy
17015 </p>
17016 !! html/parsoid
17017 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
17018 !! end
17019
17020 !! test
17021 Parsoid: Serialize link to file page with colon escape
17022 !! wikitext
17023
17024 [[:File:Foo.png]]
17025 [[:File:Foo.png|Bar]]
17026 !! html/php+tidy
17027 <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>
17028 <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>
17029 </p>
17030 !! html/parsoid
17031 <p>
17032 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
17033 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
17034 </p>
17035 !! end
17036
17037 !! test
17038 Parsoid: Serialize a genuine category link without colon escape
17039 !! wikitext
17040 [[Category:Foo]]
17041 [[Category:Foo|Bar]]
17042 !! html/php+tidy
17043 !! html/parsoid
17044 <link rel="mw:PageProp/Category" href="./Category:Foo">
17045 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
17046 !! end
17047
17048 !! test
17049 Normalize hrefs properly before testing for invalid link targets (T72894)
17050 !! options
17051 parsoid=html2wt
17052 !! html/parsoid
17053 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
17054 !! wikitext
17055 [[Category:Toxine bactérienne]]
17056 !! end
17057
17058 !! test
17059 Parsoid: Defaultsort
17060 !! wikitext
17061 {{DEFAULTSORT:Foo}}
17062 !! html/parsoid
17063 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
17064 !! end
17065
17066 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
17067 # But, this is a limitation of our representation and is documented in
17068 # TemplateHandler.js in processSpecialMagicWord
17069 !! test
17070 Parsoid: Defaultsort (template-generated)
17071 !! wikitext
17072 {{{{echo|DEFAULTSORT}}:Foo}}
17073 !! html/parsoid
17074 <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"}]]}'/>
17075 !! end
17076
17077 ###
17078 ### Inter-language links
17079 ###
17080 !! test
17081 Interlanguage links
17082 !! options
17083 ill
17084 !! wikitext
17085 [[es:Alimento]]
17086 [[fr:Nourriture]]
17087 [[zh:食品]]
17088 !! html/php
17089 es:Alimento fr:Nourriture zh:食品
17090 !! html/parsoid
17091 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
17092 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
17093 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
17094 !! end
17095
17096 !! test
17097 Duplicate interlanguage links (T26502)
17098 !! options
17099 ill
17100 !! wikitext
17101 [[es:1]]
17102 [[es:2]]
17103 [[fr:1]]
17104 [[fr:2]]
17105 !! html/php
17106 es:1 fr:1
17107 !! html/parsoid
17108 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
17109 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
17110 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
17111 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
17112 !! end
17113
17114 ###
17115 ### Sections
17116 ###
17117 !! test
17118 Basic section headings
17119 !! wikitext
17120 ==Headline 1==
17121 Some text
17122
17123 ==Headline 2==
17124 More
17125 ===Smaller headline===
17126 Blah blah
17127 !! html
17128 <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>
17129 <p>Some text
17130 </p>
17131 <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>
17132 <p>More
17133 </p>
17134 <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>
17135 <p>Blah blah
17136 </p>
17137 !! end
17138
17139 !! test
17140 Section headings with TOC
17141 !! wikitext
17142 ==Headline 1==
17143 ===Subheadline 1===
17144 =====Skipping a level=====
17145 ======Skipping a level======
17146
17147 ==Headline 2==
17148 Some text
17149 ===Another headline===
17150 !! html
17151 <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>
17152 <ul>
17153 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
17154 <ul>
17155 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
17156 <ul>
17157 <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>
17158 <ul>
17159 <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>
17160 </ul>
17161 </li>
17162 </ul>
17163 </li>
17164 </ul>
17165 </li>
17166 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
17167 <ul>
17168 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
17169 </ul>
17170 </li>
17171 </ul>
17172 </div>
17173
17174 <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>
17175 <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>
17176 <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>
17177 <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>
17178 <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>
17179 <p>Some text
17180 </p>
17181 <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>
17182 !! end
17183
17184 !! test
17185 TOC anchors don't collide
17186 !! wikitext
17187 __FORCETOC__
17188 ==Headline 2==
17189 ==Headline==
17190 ==Headline 2==
17191 ==Headline==
17192 !! html/php
17193 <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>
17194 <ul>
17195 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
17196 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
17197 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
17198 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
17199 </ul>
17200 </div>
17201
17202 <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>
17203 <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>
17204 <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>
17205 <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>
17206 !! end
17207
17208 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
17209 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
17210 !! test
17211 Handling of sections up to level 6 and beyond
17212 !! options
17213 parsoid=wt2html
17214 !! wikitext
17215 =Level 1 Heading=
17216 ==Level 2 Heading==
17217 ===Level 3 Heading===
17218 ====Level 4 Heading====
17219 =====Level 5 Heading=====
17220 ======Level 6 Heading======
17221 =======Level 7 Heading=======
17222 ========Level 8 Heading========
17223 =========Level 9 Heading=========
17224 ==========Level 10 Heading==========
17225 !! html/php
17226 <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>
17227 <ul>
17228 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
17229 <ul>
17230 <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>
17231 <ul>
17232 <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>
17233 <ul>
17234 <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>
17235 <ul>
17236 <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>
17237 <ul>
17238 <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>
17239 <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>
17240 <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>
17241 <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>
17242 <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>
17243 </ul>
17244 </li>
17245 </ul>
17246 </li>
17247 </ul>
17248 </li>
17249 </ul>
17250 </li>
17251 </ul>
17252 </li>
17253 </ul>
17254 </div>
17255
17256 <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>
17257 <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>
17258 <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>
17259 <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>
17260 <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>
17261 <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>
17262 <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>
17263 <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>
17264 <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>
17265 <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>
17266 !! html/parsoid
17267 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
17268 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
17269 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
17270 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
17271 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
17272 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
17273 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
17274 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
17275 <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>
17276 <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>
17277 !! end
17278
17279 !! test
17280 TOC regression (T11764)
17281 !! wikitext
17282 ==title 1==
17283 ===title 1.1===
17284 ====title 1.1.1====
17285 ===title 1.2===
17286 ==title 2==
17287 ===title 2.1===
17288 !! html
17289 <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>
17290 <ul>
17291 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17292 <ul>
17293 <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>
17294 <ul>
17295 <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>
17296 </ul>
17297 </li>
17298 <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>
17299 </ul>
17300 </li>
17301 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
17302 <ul>
17303 <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>
17304 </ul>
17305 </li>
17306 </ul>
17307 </div>
17308
17309 <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>
17310 <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>
17311 <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>
17312 <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>
17313 <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>
17314 <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>
17315 !! end
17316
17317 !! test
17318 TOC for heading containing <span id="..."></span> (T96153)
17319 !! wikitext
17320 __FORCETOC__
17321 ==<span id="old-anchor"></span>New title==
17322 !! html/php
17323 <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>
17324 <ul>
17325 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
17326 </ul>
17327 </div>
17328
17329 <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>
17330 !! end
17331
17332 !! test
17333 TOC with wgMaxTocLevel=3 (T8204)
17334 !! options
17335 wgMaxTocLevel=3
17336 !! wikitext
17337 ==title 1==
17338 ===title 1.1===
17339 ====title 1.1.1====
17340 ===title 1.2===
17341 ==title 2==
17342 ===title 2.1===
17343 !! html
17344 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17345 <ul>
17346 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17347 <ul>
17348 <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>
17349 <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>
17350 </ul>
17351 </li>
17352 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
17353 <ul>
17354 <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>
17355 </ul>
17356 </li>
17357 </ul>
17358 </div>
17359
17360 <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>
17361 <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>
17362 <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>
17363 <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>
17364 <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>
17365 <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>
17366 !! end
17367
17368 !! test
17369 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
17370 !! options
17371 wgMaxTocLevel=3
17372 !! wikitext
17373 ==Section 1==
17374 ===Section 1.1===
17375 ====Section 1.1.1====
17376 ====Section 1.1.1.1====
17377 ==Section 2==
17378 !! html
17379 <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>
17380 <ul>
17381 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
17382 <ul>
17383 <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>
17384 </ul>
17385 </li>
17386 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
17387 </ul>
17388 </div>
17389
17390 <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>
17391 <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>
17392 <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>
17393 <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>
17394 <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>
17395 !! end
17396
17397
17398 !! test
17399 Resolving duplicate section names
17400 !! wikitext
17401 ==Foo bar==
17402 ==Foo bar==
17403 !! html
17404 <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>
17405 <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>
17406 !! end
17407
17408 !! test
17409 Resolving duplicate section names with differing case (T12721)
17410 !! wikitext
17411 ==Foo bar==
17412 ==Foo Bar==
17413 !! html
17414 <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>
17415 <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>
17416 !! end
17417
17418 !! article
17419 Template:sections
17420 !! text
17421 ===Section 1===
17422 ==Section 2==
17423 !! endarticle
17424
17425 !! test
17426 Template with sections, __NOTOC__
17427 !! wikitext
17428 __NOTOC__
17429 ==Section 0==
17430 {{sections}}
17431 ==Section 4==
17432 !! html
17433 <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>
17434 <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>
17435 <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>
17436 <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>
17437 !! end
17438
17439 !! test
17440 __NOEDITSECTION__ keyword
17441 !! wikitext
17442 __NOEDITSECTION__
17443 ==Section 1==
17444 ==Section 2==
17445 !! html
17446 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
17447 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
17448 !! end
17449
17450 !! test
17451 Link inside a section heading
17452 !! wikitext
17453 ==Section with a [[Main Page|link]] in it==
17454 !! html
17455 <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>
17456 !! end
17457
17458 !! test
17459 TOC regression (T14077)
17460 !! wikitext
17461 __TOC__
17462 ==title 1==
17463 ===title 1.1===
17464 ==title 2==
17465 !! html
17466 <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>
17467 <ul>
17468 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17469 <ul>
17470 <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>
17471 </ul>
17472 </li>
17473 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
17474 </ul>
17475 </div>
17476
17477 <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>
17478 <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>
17479 <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>
17480 !! end
17481
17482 !! test
17483 T3219 URL next to image (good)
17484 !! wikitext
17485 http://example.com [[File:Foobar.jpg]]
17486 !! html/php
17487 <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>
17488 </p>
17489 !! html/parsoid
17490 <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>
17491 !!end
17492
17493 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
17494 !! test
17495 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
17496 !! options
17497 parsoid=wt2html,html2html
17498 !! wikitext
17499 ===
17500 The line above must have a trailing space!
17501 === <!--
17502 --> <!-- -->
17503 But just in case it doesn't...
17504 !! html/php
17505 <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>
17506 <p>The line above must have a trailing space!
17507 </p>
17508 <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>
17509 <p>But just in case it doesn't...
17510 </p>
17511 !! html/parsoid
17512 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
17513 <p>The line above must have a trailing space!</p>
17514 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
17515 --> <!-- -->
17516 <p>But just in case it doesn't...</p>
17517 !! end
17518
17519 !! test
17520 Header with special characters (T27462)
17521 !! wikitext
17522 The tooltips shall not show entities to the user (ie. be double escaped)
17523
17524 ==text > text==
17525 section 1
17526
17527 ==text < text==
17528 section 2
17529
17530 ==text & text==
17531 section 3
17532
17533 ==text ' text==
17534 section 4
17535
17536 ==text " text==
17537 section 5
17538 !! html/php
17539 <p>The tooltips shall not show entities to the user (ie. be double escaped)
17540 </p>
17541 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17542 <ul>
17543 <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
17544 <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>
17545 <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>
17546 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
17547 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
17548 </ul>
17549 </div>
17550
17551 <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>
17552 <p>section 1
17553 </p>
17554 <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>
17555 <p>section 2
17556 </p>
17557 <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>
17558 <p>section 3
17559 </p>
17560 <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>
17561 <p>section 4
17562 </p>
17563 <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>
17564 <p>section 5
17565 </p>
17566 !! html/parsoid
17567 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
17568
17569 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
17570 <p>section 1</p>
17571
17572 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
17573 <p>section 2</p>
17574
17575 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
17576 <p>section 3</p>
17577
17578 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
17579 <p>section 4</p>
17580
17581 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
17582 <p>section 5</p>
17583 !! end
17584
17585 !! test
17586 Header with space, plus and underscore as entity
17587 !! wikitext
17588 Id should not contain + for spaces
17589
17590 ==Space between Text==
17591 section 1
17592
17593 ==Space-Entity&#32;between&#32;Text==
17594 section 2
17595
17596 ==Plus+between+Text==
17597 section 3
17598
17599 ==Plus-Entity&#43;between&#43;Text==
17600 section 4
17601
17602 ==Underscore_between_Text==
17603 section 5
17604
17605 ==Underscore-Entity&#95;between&#95;Text==
17606 section 6
17607
17608 [[#Space between Text]]
17609 [[#Space-Entity&#32;between&#32;Text]]
17610 [[#Plus+between+Text]]
17611 [[#Plus-Entity&#43;between&#43;Text]]
17612 [[#Underscore_between_Text]]
17613 [[#Underscore-Entity&#95;between&#95;Text]]
17614 !! html/php
17615 <p>Id should not contain + for spaces
17616 </p>
17617 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17618 <ul>
17619 <li class="toclevel-1 tocsection-1"><a href="#Space_between_Text"><span class="tocnumber">1</span> <span class="toctext">Space between Text</span></a></li>
17620 <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>
17621 <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>
17622 <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>
17623 <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>
17624 <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>
17625 </ul>
17626 </div>
17627
17628 <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>
17629 <p>section 1
17630 </p>
17631 <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>
17632 <p>section 2
17633 </p>
17634 <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>
17635 <p>section 3
17636 </p>
17637 <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>
17638 <p>section 4
17639 </p>
17640 <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>
17641 <p>section 5
17642 </p>
17643 <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>
17644 <p>section 6
17645 </p><p><a href="#Space_between_Text">#Space between Text</a>
17646 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
17647 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
17648 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
17649 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17650 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17651 </p>
17652 !! html/parsoid
17653 <p>Id should not contain + for spaces</p>
17654
17655 <h2 id="Space_between_Text">Space between Text</h2>
17656 <p>section 1</p>
17657
17658 <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>
17659 <p>section 2</p>
17660
17661 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
17662 <p>section 3</p>
17663
17664 <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>
17665 <p>section 4</p>
17666
17667 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
17668 <p>section 5</p>
17669
17670 <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>
17671 <p>section 6</p>
17672
17673 <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>
17674 <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>
17675 <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>
17676 <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>
17677 <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>
17678 <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>
17679 !! end
17680
17681 # Parsoid html2wt disabled because it adds padding spaces around =
17682 !! test
17683 Headers with excess '=' characters
17684 (Are similar tests necessary beyond the 1st level?)
17685 !! options
17686 parsoid=wt2html,wt2wt,html2html
17687 !! wikitext
17688 =foo==
17689 ==foo=
17690 =''italic'' heading==
17691 ==''italic'' heading=
17692 !! html/php
17693 <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>
17694 <ul>
17695 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17696 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17697 <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>
17698 <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>
17699 </ul>
17700 </div>
17701
17702 <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>
17703 <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>
17704 <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>
17705 <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>
17706 !! html/parsoid
17707 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
17708 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
17709 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
17710 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
17711 !! end
17712
17713 !! test
17714 HTML headers vs TOC (T25393)
17715 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17716 !! wikitext
17717 <h1>Header 1</h1>
17718 ==Header 1.1==
17719 ==Header 1.2==
17720
17721 <h1>Header 2
17722 </h1>
17723 ==Header 2.1==
17724 ==Header 2.2==
17725 __NOEDITSECTION__
17726 !! html/php
17727 <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>
17728 <ul>
17729 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17730 <ul>
17731 <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>
17732 <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>
17733 </ul>
17734 </li>
17735 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
17736 <ul>
17737 <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>
17738 <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>
17739 </ul>
17740 </li>
17741 </ul>
17742 </div>
17743
17744 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17745 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17746 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17747 <h1><span class="mw-headline" id="Header_2">Header 2
17748 </span></h1>
17749 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17750 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17751 !! html/parsoid
17752 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17753 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17754 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17755
17756 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17757 </h1>
17758 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17759 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17760 <meta property="mw:PageProp/noeditsection"/>
17761 !! end
17762
17763 !! test
17764 Single-line or multiline-comments can follow headings
17765 !! options
17766 parsoid=wt2html,wt2wt
17767 !! wikitext
17768 ==foo==<!---->
17769 ==bar==<!--c1-->
17770 ==baz==<!--
17771 c2
17772 c3-->
17773 !! html/php
17774 <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>
17775 <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>
17776 <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>
17777 !! html/parsoid
17778 <h2 id="foo">foo</h2><!---->
17779 <h2 id="bar">bar</h2><!--c1-->
17780 <h2 id="baz">baz</h2><!--
17781 c2
17782 c3-->
17783 !! end
17784
17785 !! test
17786 T3219 URL next to image (broken)
17787 !! wikitext
17788 http://example.com[[File:Foobar.jpg]]
17789 !! html/php
17790 <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>
17791 </p>
17792 !! html/parsoid
17793 <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>
17794 !!end
17795
17796 !! test
17797 T3186 news: in the middle of text
17798 !! wikitext
17799 http://en.wikinews.org/wiki/Wikinews:Workplace
17800 !! html
17801 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17802 </p>
17803 !!end
17804
17805
17806 !! test
17807 Namespaced link must have a title
17808 !! wikitext
17809 [[Project:]]
17810 !! html
17811 <p>[[Project:]]
17812 </p>
17813 !!end
17814
17815 !! test
17816 Namespaced link must have a title (bad fragment version)
17817 !! wikitext
17818 [[Project:#fragment]]
17819 !! html
17820 <p>[[Project:#fragment]]
17821 </p>
17822 !!end
17823
17824
17825 ###
17826 ### HTML tags and HTML attributes
17827 ###
17828
17829 !! test
17830 div with no attributes
17831 !! wikitext
17832 <div>HTML rocks</div>
17833 !! html
17834 <div>HTML rocks</div>
17835 !! end
17836
17837 !! test
17838 div with double-quoted attribute
17839 !! wikitext
17840 <div id="rock">HTML rocks</div>
17841 !! html
17842 <div id="rock">HTML rocks</div>
17843 !! end
17844
17845 !! test
17846 div with single-quoted attribute
17847 !! wikitext
17848 <div id='rock'>HTML rocks</div>
17849 !! html
17850 <div id="rock">HTML rocks</div>
17851 !! end
17852
17853 !! test
17854 div with unquoted attribute
17855 !! wikitext
17856 <div id=rock>HTML rocks</div>
17857 !! html
17858 <div id="rock">HTML rocks</div>
17859 !! end
17860
17861 !! test
17862 div with illegal double attributes
17863 !! wikitext
17864 <div id="a" id="b">HTML rocks</div>
17865 !! html
17866 <div id="b">HTML rocks</div>
17867 !! end
17868
17869 !! test
17870 div with empty attribute value, space before equals
17871 !! options
17872 parsoid=wt2html,html2html
17873 !! wikitext
17874 <div class =>HTML rocks</div>
17875 !! html/php
17876 <div class="">HTML rocks</div>
17877 !! html/parsoid
17878 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17879 !! end
17880
17881 !! test
17882 div with multiple empty attribute values
17883 !! config
17884 wgFragmentMode=[ 'html5', 'legacy' ]
17885 !! options
17886 parsoid=wt2html,html2html
17887 !! wikitext
17888 <div id= title=>HTML rocks</div>
17889 !! html/php
17890 <div id="title=">HTML rocks</div>
17891 !! html/parsoid
17892 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17893 !! end
17894
17895 # FIXME Parsoid doesn't actually match PHP here.
17896 !! test
17897 Extension tag in attribute value
17898 !! options
17899 wgRawHtml=1
17900 !! wikitext
17901 <span title="<html><div>123</div></html>">ok</span>
17902 !! html/php+tidy
17903 <p><span title="&lt;div&gt;123&lt;/div&gt;">ok</span>
17904 </p>
17905 !! html/parsoid
17906 <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>
17907 !! end
17908
17909 !! test
17910 table with multiple empty attribute values
17911 !! options
17912 parsoid=wt2html,html2html
17913 !! wikitext
17914 {| title= id=
17915 |hi
17916 |}
17917 !! html/php
17918 <table title="id=">
17919 <tr>
17920 <td>hi
17921 </td></tr></table>
17922 !! html/parsoid
17923 <table title="id=">
17924 <tbody><tr><td>hi</td></tr>
17925 </tbody></table>
17926 !! end
17927
17928 !! test
17929 div with braces in attribute value
17930 !! wikitext
17931 <div title="{}">Foo</div>
17932 !! html/php
17933 <div title="&#123;&#125;">Foo</div>
17934 !! html/parsoid
17935 <div title="{}">Foo</div>
17936 !! end
17937
17938 !! test
17939 div with empty attribute value, no space before equals
17940 !! options
17941 parsoid=wt2html,html2html
17942 !! wikitext
17943 <div class=>HTML rocks</div>
17944 !! html/php
17945 <div class="">HTML rocks</div>
17946 !! html/parsoid
17947 <div class="">HTML rocks</div>
17948 !! end
17949
17950 !! test
17951 HTML multiple attributes correction
17952 !! wikitext
17953 <p class="error" class="awesome">Awesome!</p>
17954 !! html
17955 <p class="awesome">Awesome!</p>
17956 !! end
17957
17958 !! test
17959 Table multiple attributes correction
17960 !! wikitext
17961 {|
17962 !+ class="error" class="awesome"|status
17963 |}
17964 !! html
17965 <table>
17966 <tr>
17967 <th class="awesome">status
17968 </th></tr></table>
17969 !! end
17970
17971 !! test
17972 DIV IN UPPERCASE
17973 !! wikitext
17974 <DIV ID="x">HTML ROCKS</DIV>
17975 !! html
17976 <div id="x">HTML ROCKS</div>
17977 !! end
17978
17979 !! test
17980 Non-ASCII pseudo-tags are rendered as text
17981 !! wikitext
17982 <khyô>
17983 !! html
17984 <p>&lt;khyô&gt;
17985 </p>
17986 !! end
17987
17988 !! test
17989 Pseudo-tag with URL 'name' renders as url link
17990 !! wikitext
17991 <http://example.com/>
17992 !! html
17993 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17994 </p>
17995 !! end
17996
17997 !! test
17998 text with amp in the middle of nowhere
17999 !! wikitext
18000 Remember AT&T?
18001 !! html
18002 <p>Remember AT&amp;T?
18003 </p>
18004 !! end
18005
18006 !! test
18007 text with character entity: eacute
18008 !! wikitext
18009 I always thought &eacute; was a cute letter.
18010 !! html+tidy
18011 <p>I always thought &#233; was a cute letter.
18012 </p>
18013 !! end
18014
18015 !! test
18016 text with entity-escaped character entity-like string: eacute
18017 !! wikitext
18018 I always thought &amp;eacute; was a cute letter.
18019 !! html
18020 <p>I always thought &amp;eacute; was a cute letter.
18021 </p>
18022 !! end
18023
18024 !! test
18025 text with undefined character entity: xacute
18026 !! wikitext
18027 I always thought &xacute; was a cute letter.
18028 !! html
18029 <p>I always thought &amp;xacute; was a cute letter.
18030 </p>
18031 !! end
18032
18033 !! test
18034 HTML5 tags
18035 !! wikitext
18036 <data value="5">five</data>
18037 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
18038 <mark>This highlighted text</mark>
18039 !! html
18040 <p><data value="5">five</data>
18041 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
18042 <mark>This highlighted text</mark>
18043 </p>
18044 !! end
18045
18046 !! test
18047 HTML tag with leading space is parsed as text
18048 !! wikitext
18049 < div>foo< /div>
18050 !! html
18051 <p>&lt; div&gt;foo&lt; /div&gt;
18052 </p>
18053 !! end
18054
18055 ## FIXME: The untrimmed attribute in Parsoid is T205737
18056 !! test
18057 Element with broken attribute syntax
18058 !! options
18059 parsoid=wt2html
18060 !! wikitext
18061 <div style=" style="123">hi</div>
18062 <div =>ho</div>
18063 !! html/php
18064 <div style="style=">hi</div>
18065 <div>ho</div>
18066 !! html/parsoid
18067 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
18068 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
18069 !! end
18070
18071 ###
18072 ### Nesting tests (see T43545, T52604, T53081)
18073 ###
18074
18075 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
18076 # Note that html2wt is considerably more difficult if we use <b> in
18077 # the test case, instead of <small>
18078 !! test
18079 Ensure that HTML adoption agency algorithm is properly implemented.
18080 !! wikitext
18081 <small>X<small>Y</small>Z</small>
18082 !! html
18083 <p><small>X<small>Y</small>Z</small>
18084 </p>
18085 !! end
18086
18087 # This was T43545 in the PHP parser.
18088 !! test
18089 Nesting of <kbd>
18090 !! wikitext
18091 <kbd>X<kbd>Y</kbd>Z</kbd>
18092 !! html+tidy
18093 <p><kbd>X<kbd>Y</kbd>Z</kbd>
18094 </p>
18095 !! end
18096
18097 # The following cases were T53081 in the PHP parser.
18098 # Note that there are some other nestable tags (b, i, etc) which are
18099 # not covered; see T53081 for discussion.
18100
18101 !! test
18102 Nesting of <em>
18103 !! wikitext
18104 <em>X<em>Y</em>Z</em>
18105 !! html+tidy
18106 <p><em>X<em>Y</em>Z</em>
18107 </p>
18108 !! end
18109
18110 !! test
18111 Nesting of <strong>
18112 !! wikitext
18113 <strong>X<strong>Y</strong>Z</strong>
18114 !! html+tidy
18115 <p><strong>X<strong>Y</strong>Z</strong>
18116 </p>
18117 !! end
18118
18119 !! test
18120 Nesting of <q>
18121 !! wikitext
18122 <q>X<q>Y</q>Z</q>
18123 !! html+tidy
18124 <p><q>X<q>Y</q>Z</q>
18125 </p>
18126 !! end
18127
18128 !! test
18129 Nesting of <ruby>
18130 !! wikitext
18131 <ruby>X<ruby>Y</ruby>Z</ruby>
18132 !! html
18133 <p><ruby>X<ruby>Y</ruby>Z</ruby>
18134 </p>
18135 !! end
18136
18137 !! test
18138 Nesting of <bdo>
18139 !! wikitext
18140 <bdo>X<bdo>Y</bdo>Z</bdo>
18141 !! html
18142 <p><bdo>X<bdo>Y</bdo>Z</bdo>
18143 </p>
18144 !! end
18145
18146
18147 ###
18148 ### Media links
18149 ###
18150
18151 !! test
18152 Media link
18153 !! wikitext
18154 [[Media:Foobar.jpg]]
18155 [[Media:Video.ogv]]
18156 [[:Media:Video.ogv]]
18157 !! html/php
18158 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
18159 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
18160 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
18161 </p>
18162 !! html/parsoid
18163 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
18164 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" resource="./Media:Video.ogv" title="Video.ogv">Media:Video.ogv</a>
18165 <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>
18166 !! end
18167
18168 !! test
18169 Media link with text
18170 !! wikitext
18171 [[Media:Foobar.jpg|A neat file to look at]]
18172 !! html/php
18173 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
18174 </p>
18175 !! html/parsoid
18176 <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>
18177 !! end
18178
18179 !! test
18180 Localized media link
18181 !! options
18182 language=is
18183 !! wikitext
18184 [[Miðill:Foobar.jpg]]
18185
18186 [[Miðill:Foobar.jpg|Icelandic]]
18187 !! html/php
18188 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Miðill:Foobar.jpg</a>
18189 </p><p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Icelandic</a>
18190 </p>
18191 !! html/parsoid
18192 <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>
18193 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Miðill:Foobar.jpg" title="Foobar.jpg">Icelandic</a></p>
18194 !! end
18195
18196 # FIXME: this is still bad HTML tag nesting
18197 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
18198 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
18199 !! test
18200 Media link with nasty text
18201 !! options
18202 parsoid=wt2html,html2html
18203 !! wikitext
18204 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
18205 !! html/php
18206 <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>
18207 !! html/php+tidy
18208 <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>
18209 !! html/parsoid
18210 <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>
18211 !! end
18212
18213 !! test
18214 Media link from missing resource (parsoid-only)
18215 !! options
18216 parsoid=html2wt
18217 !! html/parsoid
18218 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
18219 !! wikitext
18220 [[Media:Foobar.jpg|Bat!]]
18221 !! end
18222
18223 !! test
18224 Media link from missing resource, localized (parsoid-only)
18225 !! options
18226 parsoid=html2wt
18227 language=is
18228 !! html/parsoid
18229 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
18230 !! wikitext
18231 [[Miðill:Foobar.jpg|Bat!]]
18232 !! end
18233
18234 # This is a sanity test to ensure we don't crash or choke when given
18235 # old cached 1.7.0 HTML for media links; we don't require that the
18236 # result be "valid" because wt2wt was completely broken in 1.7.0
18237 !! test
18238 Media link from old 1.7.0 DOM spec (crash test, parsoid-only) T198511
18239 !! options
18240 parsoid=html2wt
18241 !! html/parsoid
18242 <p>This is what Parsoid would emit (and we still handle this HTML fine):</p>
18243 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18244 <p>But VisualEditor would mangle the rel attribute, and give us back this:</p>
18245 <p><a rel="mw:ExtLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18246 <p>But at least we don't crash when trying to handle the mangled HTML!</p>
18247 !! wikitext
18248 This is what Parsoid would emit (and we still handle this HTML fine):
18249
18250 [[Media:Foobar.jpg|A neat file to look at]]
18251
18252 But VisualEditor would mangle the rel attribute, and give us back this:
18253
18254 [//example.com/images/3/3a/Foobar.jpg A neat file to look at]
18255
18256 But at least we don't crash when trying to handle the mangled HTML!
18257 !! end
18258
18259 !! test
18260 Media link to nonexistent file (T3702)
18261 !! wikitext
18262 [[Media:No such.jpg]]
18263 [[Media:No_such file.jpg]]
18264 !! html/php
18265 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
18266 <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>
18267 </p>
18268 !! html/parsoid
18269 <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>
18270 <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>
18271 !! end
18272
18273 !! test
18274 Image link to nonexistent file (T3850 - good)
18275 !! wikitext
18276 [[File:No_such.jpg]]
18277 !! html/php
18278 <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>
18279 </p>
18280 !! html/parsoid
18281 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/No_such.jpg"><span resource="./File:No_such.jpg">File:No such.jpg</span></a></figure-inline></p>
18282 !! end
18283
18284 !! test
18285 :Image link to nonexistent file (T3850 - bad)
18286 !! wikitext
18287 [[:Image:No such.jpg]]
18288 !! html/php
18289 <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>
18290 </p>
18291 !! html/parsoid
18292 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
18293 !! end
18294
18295 !! test
18296 Character reference normalization in link text (T3938)
18297 !! wikitext
18298 [[Main Page|this&that]]
18299 !! html
18300 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
18301 </p>
18302 !!end
18303
18304 !! article
18305 אַ
18306 !! text
18307 Test for unicode normalization
18308
18309 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
18310 !! endarticle
18311
18312 !! test
18313 (T21451) Links should refer to the normalized form.
18314 !! wikitext
18315 [[&#xFB2E;]]
18316 [[&#x5d0;&#x5b7;]]
18317 [[&#x5d0;ַ]]
18318 [[א&#x5b7;]]
18319 [[אַ]]
18320 !! html
18321 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
18322 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
18323 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
18324 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
18325 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
18326 </p>
18327 !! end
18328
18329 !! test
18330 Empty attribute crash test (T4067)
18331 !! wikitext
18332 <font color="">foo</font>
18333 !! html
18334 <p><font color="">foo</font>
18335 </p>
18336 !! end
18337
18338 !! test
18339 Empty attribute crash test single-quotes (T4067)
18340 !! wikitext
18341 <font color=''>foo</font>
18342 !! html
18343 <p><font color="">foo</font>
18344 </p>
18345 !! end
18346
18347 !! test
18348 Attribute test: equals, then nothing
18349 !! options
18350 parsoid=wt2html,html2html
18351 !! wikitext
18352 <font color=>foo</font>
18353 !! html/php
18354 <p><font color="">foo</font>
18355 </p>
18356 !! html/parsoid
18357 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
18358 !! end
18359
18360 !! test
18361 Attribute test: unquoted value
18362 !! options
18363 parsoid=wt2html,html2html
18364 !! wikitext
18365 <font color=x>foo</font>
18366 !! html/php
18367 <p><font color="x">foo</font>
18368 </p>
18369 !! html/parsoid
18370 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
18371 !! end
18372
18373 !! test
18374 Attribute test: unquoted but illegal value (hash)
18375 !! wikitext
18376 <font color=#x>foo</font>
18377 !! html
18378 <p><font color="#x">foo</font>
18379 </p>
18380 !! end
18381
18382 # Parsoid does not serialize to empty attribute syntax,
18383 # so wt2wt and html2wt cases are skipped
18384 !! test
18385 Attribute test: no value (T54330)
18386 !! options
18387 parsoid=wt2html,html2html
18388 !! wikitext
18389 <font color>foo</font>
18390 !! html/php
18391 <p><font color="">foo</font>
18392 </p>
18393 !! html/parsoid
18394 <p><font color="">foo</font></p>
18395 !! end
18396
18397 !! test
18398 T4095: link with three closing brackets
18399 !! wikitext
18400 [[Main Page]]]
18401 !! html/php
18402 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
18403 </p>
18404 !! html/parsoid
18405 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
18406 !! end
18407
18408 !! test
18409 T4095: link with pipe and three closing brackets
18410 !! wikitext
18411 [[Main Page|link]]]
18412 !! html/php
18413 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
18414 </p>
18415 !! html/parsoid
18416 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
18417 !! end
18418
18419 !! test
18420 T4095: link with pipe and three closing brackets, version 2
18421 !! wikitext
18422 [[Main Page|[http://example.com/]]]
18423 !! html/php
18424 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
18425 </p>
18426 !! html/parsoid
18427 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
18428 !! end
18429
18430
18431 ###
18432 ### Safety
18433 ###
18434
18435 !! article
18436 Template:Dangerous attribute
18437 !! text
18438 " onmouseover="alert(document.cookie)
18439 !! endarticle
18440
18441 !! article
18442 Template:Dangerous style attribute
18443 !! text
18444 border-size: expression(alert(document.cookie))
18445 !! endarticle
18446
18447 !! article
18448 Template:Div style
18449 !! text
18450 <div style="float: right; {{{1}}}">Magic div</div>
18451 !! endarticle
18452
18453 !! test
18454 T4304: HTML attribute safety (safe template; regression T4309)
18455 !! wikitext
18456 <div title="{{test}}"></div>
18457 !! html/php
18458 <div title="This is a test template"></div>
18459 !! html/parsoid
18460 <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>
18461 !! end
18462
18463 # Parsoid has enough context to handle this case
18464 !! test
18465 T4304: HTML attribute safety (dangerous template; 2309)
18466 !! wikitext
18467 <div title="{{dangerous attribute}}"></div>
18468 !! html/php
18469 <div title=""></div>
18470 !! html/parsoid
18471 <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>
18472 !! end
18473
18474 !! test
18475 T4304: HTML attribute safety (dangerous style template; 2309)
18476 !! wikitext
18477 <div style="{{dangerous style attribute}}"></div>
18478 !! html/php
18479 <div style="/* insecure input */"></div>
18480 !! html/parsoid
18481 <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>
18482 !! end
18483
18484 !! test
18485 T4304: HTML attribute safety (safe parameter; 2309)
18486 !! wikitext
18487 {{div style|width: 200px}}
18488 !! html/php
18489 <div style="float: right; width: 200px">Magic div</div>
18490 !! html/parsoid
18491 <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>
18492 !! end
18493
18494 !! test
18495 T4304: HTML attribute safety (unsafe parameter; 2309)
18496 !! wikitext
18497 {{div style|width: expression(alert(document.cookie))}}
18498 !! html/php
18499 <div style="/* insecure input */">Magic div</div>
18500 !! html/parsoid
18501 <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>
18502 !! end
18503
18504 ## Parsoid output here differs; needs investigation.
18505 !! test
18506 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
18507 !! wikitext
18508 {{div style|"><script>alert(document.cookie)</script>}}
18509 !! html
18510 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18511 !! end
18512
18513 ## Parsoid output here differs; needs investigation.
18514 !! test
18515 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
18516 !! wikitext
18517 {{div style|" ><script>alert(document.cookie)</script>}}
18518 !! html
18519 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18520 !! end
18521
18522 !! test
18523 T4304: HTML attribute safety (link)
18524 !! wikitext
18525 <div title="[[Main Page]]"></div>
18526 !! html/php
18527 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
18528 !! html/parsoid
18529 <div title="[[Main Page]]"></div>
18530 !! end
18531
18532 !! test
18533 T4304: HTML attribute safety (italics)
18534 !! wikitext
18535 <div title="''foobar''"></div>
18536 !! html
18537 <div title="&#39;&#39;foobar&#39;&#39;"></div>
18538 !! end
18539
18540 !! test
18541 T4304: HTML attribute safety (bold)
18542 !! wikitext
18543 <div title="'''foobar'''"></div>
18544 !! html
18545 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
18546 !! end
18547
18548 !! test
18549 T4304: HTML attribute safety (ISBN)
18550 !! wikitext
18551 <div title="ISBN 1234567890"></div>
18552 !! html
18553 <div title="&#73;SBN 1234567890"></div>
18554 !! end
18555
18556 !! test
18557 T4304: HTML attribute safety (RFC)
18558 !! wikitext
18559 <div title="RFC 1234"></div>
18560 !! html
18561 <div title="&#82;FC 1234"></div>
18562 !! end
18563
18564 !! test
18565 T4304: HTML attribute safety (PMID)
18566 !! wikitext
18567 <div title="PMID 1234567890"></div>
18568 !! html
18569 <div title="&#80;MID 1234567890"></div>
18570 !! end
18571
18572 !! test
18573 T4304: HTML attribute safety (web link)
18574 !! wikitext
18575 <div title="http://example.com/"></div>
18576 !! html
18577 <div title="http&#58;//example.com/"></div>
18578 !! end
18579
18580 !! test
18581 T4304: HTML attribute safety (named web link)
18582 !! wikitext
18583 <div title="[http://example.com/ link]"></div>
18584 !! html/php
18585 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
18586 !! html/parsoid
18587 <div title="[http://example.com/ link]"></div>
18588 !! end
18589
18590 !! test
18591 T5244: HTML attribute safety (extension; safe)
18592 !! wikitext
18593 <div style="<nowiki>background:blue</nowiki>"></div>
18594 !! html/php
18595 <div style="background:blue"></div>
18596 !! html/parsoid
18597 <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>
18598 !! end
18599
18600 !! test
18601 T5244: HTML attribute safety (extension; unsafe)
18602 !! wikitext
18603 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
18604 !! html/php
18605 <div style="/* insecure input */"></div>
18606 !! html/parsoid
18607 <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>
18608 !! end
18609
18610 # More MSIE fun discovered by Tom Gilder
18611
18612 !! test
18613 MSIE CSS safety test: spurious slash
18614 !! wikitext
18615 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
18616 !! html/php
18617 <div style="/* insecure input */">evil</div>
18618 !! html/parsoid
18619 <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>
18620 !! end
18621
18622 !! test
18623 MSIE CSS safety test: hex code
18624 !! wikitext
18625 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
18626 !! html/php
18627 <div style="/* insecure input */">evil</div>
18628 !! html/parsoid
18629 <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>
18630 !! end
18631
18632 !! test
18633 MSIE CSS safety test: comment in url
18634 !! wikitext
18635 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
18636 !! html/php
18637 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
18638 !! html/parsoid
18639 <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>
18640 !! end
18641
18642 !! test
18643 MSIE CSS safety test: comment in expression
18644 !! wikitext
18645 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
18646 !! html/php
18647 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
18648 !! html/parsoid
18649 <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>
18650 !! end
18651
18652 !! test
18653 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
18654 !! wikitext
18655 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
18656 !! html/php
18657 <p style="/* invalid control char */">A</p>
18658 !! html/parsoid
18659 <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>
18660 !! end
18661
18662 !! test
18663 MSIE 6 CSS safety test: Fullwidth (T57332)
18664 !! wikitext
18665 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
18666 <div style="top:EXPRESSION(alert())">B</div>
18667 !! html/php
18668 <p style="/* insecure input */">A</p>
18669 <div style="/* insecure input */">B</div>
18670 !! html/parsoid
18671 <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>
18672 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
18673 !! end
18674
18675 !! test
18676 MSIE 6 CSS safety test: IPA extensions (T57332)
18677 !! wikitext
18678 <div style="background-image:uʀʟ(javascript:alert())">A</div>
18679 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
18680 !! html/php
18681 <div style="/* insecure input */">A</div>
18682 <p style="/* insecure input */">B</p>
18683 !! html/parsoid
18684 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
18685 <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>
18686 !! end
18687
18688 !! test
18689 MSIE 6 CSS safety test: sup/sub script (T57332)
18690 !! wikitext
18691 <div style="background-image:url⁽javascript:alert())">A</div>
18692 <div style="background-image:url₍javascript:alert())">B</div>
18693 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
18694 !! html/php
18695 <div style="/* insecure input */">A</div>
18696 <div style="/* insecure input */">B</div>
18697 <p style="/* insecure input */">C</p>
18698 !! html/parsoid
18699 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
18700 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
18701 <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>
18702 !! end
18703
18704 !! test
18705 Opera -o-link CSS
18706 !! options
18707 parsoid=wt2html,html2html
18708 !! wikitext
18709 <div
18710 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;"
18711 style="-o-link:attr(title);-o-link-source:current">X</div>
18712 !! html/php
18713 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
18714 !! html/parsoid
18715 <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>
18716 !! end
18717
18718 !! test
18719 MSIE 6 CSS safety test: Repetition markers (T57332)
18720 !! wikitext
18721 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
18722 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
18723 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
18724 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
18725 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
18726 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
18727 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
18728 !! html/php
18729 <p style="/* insecure input */">A</p>
18730 <p style="/* insecure input */">B</p>
18731 <p style="/* insecure input */">C</p>
18732 <p style="/* insecure input */">D</p>
18733 <p style="/* insecure input */">E</p>
18734 <p style="/* insecure input */">F</p>
18735 <p style="/* insecure input */">G</p>
18736 !! html/parsoid
18737 <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>
18738 <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>
18739 <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>
18740 <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>
18741 <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>
18742 <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>
18743 <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>
18744 !! end
18745
18746 !! test
18747 Table attribute legitimate extension
18748 !! wikitext
18749 {|
18750 !+ style="<nowiki>color:blue</nowiki>"|status
18751 |}
18752 !! html
18753 <table>
18754 <tr>
18755 <th style="color:blue">status
18756 </th></tr></table>
18757 !! end
18758
18759 !! test
18760 Table attribute safety
18761 !! wikitext
18762 {|
18763 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18764 |}
18765 !! html
18766 <table>
18767 <tr>
18768 <th style="/* insecure input */">status
18769 </th></tr></table>
18770 !! end
18771
18772 !! test
18773 CSS line continuation 1
18774 !! wikitext
18775 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18776 !! html
18777 <div style="/* insecure input */"></div>
18778 !! end
18779
18780 !! test
18781 CSS line continuation 2
18782 !! wikitext
18783 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18784 !! html
18785 <div style="/* invalid control char */"></div>
18786 !! end
18787
18788 !! article
18789 Template:Identity
18790 !! text
18791 {{{1}}}
18792 !! endarticle
18793
18794 !! test
18795 Expansion of multi-line templates in attribute values (T8255)
18796 !! wikitext
18797 <div style="background: {{identity|#00FF00}}">-</div>
18798 !! html
18799 <div style="background: #00FF00">-</div>
18800 !! end
18801
18802 !! test
18803 Expansion of multi-line templates in attribute values (T8255 sanity check)
18804 !! wikitext
18805 <div style="background:
18806 #00FF00">-</div>
18807 !! html/php
18808 <div style="background: #00FF00">-</div>
18809 !! html/parsoid
18810 <div style="background:
18811 #00FF00">-</div>
18812 !! end
18813
18814 !! test
18815 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18816 !! wikitext
18817 <div style="background: &#10;#00FF00">-</div>
18818 !! html
18819 <div style="background: &#10;#00FF00">-</div>
18820 !! end
18821
18822 !! test
18823 Tags which are hidden from tidiers cannot pass through the Sanitizer
18824 !! wikitext
18825 <mw:toc><script>alert();</script></mw:toc>
18826 !! html+tidy
18827 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18828 </p>
18829 !! end
18830
18831 ###
18832 ### Parser hooks (see tests/parser/ParserTestParserHook.php for the <tag> extension)
18833 ###
18834
18835 !! test
18836 Parser hook: empty input
18837 !! wikitext
18838 <tag></tag>
18839 !! html/php
18840 <pre>
18841 ''
18842 array (
18843 )
18844 </pre>
18845 !! html/parsoid
18846 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18847 !! end
18848
18849 ## Don't expect parsoid to rt this form.
18850 !! test
18851 Parser hook: empty input using terminated empty elements
18852 !! options
18853 parsoid=wt2html,html2html
18854 !! wikitext
18855 <tag/>
18856 !! html/php
18857 <pre>
18858 NULL
18859 array (
18860 )
18861 </pre>
18862 !! html/parsoid
18863 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
18864 !! end
18865
18866 !! test
18867 Parser hook: empty input using terminated empty elements (space before)
18868 !! wikitext
18869 <tag />
18870 !! html/php
18871 <pre>
18872 NULL
18873 array (
18874 )
18875 </pre>
18876 !! html/parsoid
18877 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
18878 !! end
18879
18880 !! test
18881 Parser hook: basic input
18882 !! wikitext
18883 <tag>input</tag>
18884 !! html/php
18885 <pre>
18886 'input'
18887 array (
18888 )
18889 </pre>
18890 !! html/parsoid
18891 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18892 !! end
18893
18894 ## Don't expect parsoid to rt this form.
18895 !! test
18896 Parser hook: case insensitive
18897 !! options
18898 parsoid=wt2html,html2html
18899 !! wikitext
18900 <TAG>input</TAG>
18901 !! html/php
18902 <pre>
18903 'input'
18904 array (
18905 )
18906 </pre>
18907 !! html/parsoid
18908 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18909 !! end
18910
18911 ## Don't expect parsoid to rt this form.
18912 !! test
18913 Parser hook: case insensitive, redux
18914 !! options
18915 parsoid=wt2html,html2html
18916 !! wikitext
18917 <TaG>input</TAg>
18918 !! html/php
18919 <pre>
18920 'input'
18921 array (
18922 )
18923 </pre>
18924 !! html/parsoid
18925 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18926 !! end
18927
18928 !! test
18929 Parser hook: nested tags
18930 !! options
18931 parsoid=wt2html
18932 !! wikitext
18933 <tag><tag></tag></tag>
18934 !! html/php
18935 <pre>
18936 '<tag>'
18937 array (
18938 )
18939 </pre>&lt;/tag&gt;
18940 !! html/php+tidy
18941 <pre>'<tag>'
18942 array (
18943 )
18944 </tag></pre><p>&lt;/tag&gt;</p>
18945 !! html/parsoid
18946 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}'></pre><p>&lt;/tag></p>
18947 !! end
18948
18949 !! test
18950 Parser hook: basic arguments
18951 !! wikitext
18952 <tag width="200" height="100" depth="50" square=""></tag>
18953 !! html/php
18954 <pre>
18955 ''
18956 array (
18957 'width' => '200',
18958 'height' => '100',
18959 'depth' => '50',
18960 'square' => '',
18961 )
18962 </pre>
18963 !! html/parsoid
18964 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18965 !! end
18966
18967 ## Don't expect parsoid to rt this form.
18968 !! test
18969 Parser hook: basic arguments, variations
18970 !! options
18971 parsoid=wt2html,html2html
18972 !! wikitext
18973 <tag width=200 height = "100" depth = '50' square></tag>
18974 !! html/php
18975 <pre>
18976 ''
18977 array (
18978 'width' => '200',
18979 'height' => '100',
18980 'depth' => '50',
18981 'square' => '',
18982 )
18983 </pre>
18984 !! html/parsoid
18985 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18986 !! end
18987
18988 !! test
18989 Parser hook: argument containing a forward slash (T7344)
18990 !! wikitext
18991 <tag filename="/tmp/bla"></tag>
18992 !! html/php
18993 <pre>
18994 ''
18995 array (
18996 'filename' => '/tmp/bla',
18997 )
18998 </pre>
18999 !! html/parsoid
19000 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19001 !! end
19002
19003 ## Don't expect parsoid to rt this form.
19004 !! test
19005 Parser hook: empty input using terminated empty elements (T4374)
19006 !! options
19007 parsoid=wt2html,html2html
19008 !! wikitext
19009 <tag foo=bar/>text
19010 !! html/php
19011 <pre>
19012 NULL
19013 array (
19014 'foo' => 'bar',
19015 )
19016 </pre>text
19017 !! html/parsoid
19018 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{"foo":"bar"}}'></pre><p>text</p>
19019 !! end
19020
19021 ## </tag> should be output literally since there is no matching tag that begins it
19022 ## Don't expect parsoid to rt this form.
19023 !! test
19024 Parser hook: basic arguments using terminated empty elements (T4374)
19025 !! options
19026 parsoid=wt2html
19027 !! wikitext
19028 <tag width=200 height = "100" depth = '50' square/>
19029 other stuff
19030 </tag>
19031 !! html/php
19032 <pre>
19033 NULL
19034 array (
19035 'width' => '200',
19036 'height' => '100',
19037 'depth' => '50',
19038 'square' => '',
19039 )
19040 </pre>
19041 <p>other stuff
19042 &lt;/tag&gt;
19043 </p>
19044 !! html/parsoid
19045 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""}}' about="#mwt2"></pre><p>other stuff
19046 &lt;/tag></p>
19047 !! end
19048
19049 ## Don't expect parsoid to rt this form.
19050 !! test
19051 Parser hook: Don't allow unclosed extension tags
19052 !! options
19053 parsoid=wt2html
19054 !! wikitext
19055 test <tag>123
19056
19057 this is a '''test'''
19058 !! html/php
19059 <p>test &lt;tag&gt;123
19060 </p><p>this is a <b>test</b>
19061 </p>
19062 !! html/parsoid
19063 <p>test &lt;tag>123</p>
19064
19065 <p>this is a <b>test</b></p>
19066 !! end
19067
19068 !! test
19069 Parser hook: horizontal rule inside extension tag that outputs <pre>
19070 !! wikitext
19071 <tag>
19072 Hello
19073 <hr/>
19074 Goodbye
19075 </tag>
19076 !! html/php
19077 <pre>
19078 '
19079 Hello
19080 <hr/>
19081 Goodbye
19082 '
19083 array (
19084 )
19085 </pre>
19086 !! end
19087
19088 ###
19089 ### (see tests/parser/ParserTestParserHook.php for the <statictag> extension)
19090 ###
19091
19092 !! test
19093 Parser hook: static parser hook not inside a comment
19094 !! wikitext
19095 <statictag>hello, world</statictag>
19096
19097 <statictag action="flush" />
19098 !! html/php
19099 <p><br />
19100 hello, world
19101 </p>
19102 !! html/parsoid
19103 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' about="#mwt2"></span></p>
19104 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"}}' about="#mwt4">hello, world</span></p>
19105 !! end
19106
19107 !! test
19108 Parser hook: static parser hook inside a comment
19109 !! wikitext
19110 <!-- <statictag>hello, world</statictag> -->
19111 <statictag action="flush" />
19112 !! html/php
19113 <p><br />
19114 </p>
19115 !! html/parsoid
19116 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
19117 <p><span typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about='#mwt2'></span></p>
19118 !! end
19119
19120 # Nested template calls; this case was broken by Parser.php rev 1.506,
19121 # since reverted.
19122
19123 !! article
19124 Template:One-parameter
19125 !! text
19126 (My parameter is: {{{1}}})
19127 !! endarticle
19128
19129 !! article
19130 Template:Map-one-parameter
19131 !! text
19132 {{{{{1}}}|{{{2}}}}}
19133 !! endarticle
19134
19135 !! test
19136 Nested template calls
19137 !! wikitext
19138 {{Map-one-parameter|One-parameter|param}}
19139 !! html
19140 <p>(My parameter is: param)
19141 </p>
19142 !! end
19143
19144
19145 ###
19146 ### Sanitizer
19147 ###
19148
19149 !! test
19150 Sanitizer: Closing of open tags
19151 !! wikitext
19152 <s></s><table></table>
19153 !! html/php+tidy
19154 <p><s></s></p><table></table>
19155 !! html/parsoid
19156 <p><s data-parsoid='{"stx":"html"}'></s></p><table data-parsoid='{"stx":"html"}'></table>
19157 !! end
19158
19159 !! test
19160 Sanitizer: Closing of open but not closed tags
19161 !! wikitext
19162 <s>foo
19163 !! html
19164 <p><s>foo</s>
19165 </p>
19166 !! end
19167
19168 !! test
19169 Sanitizer: Closing of closed but not open tags
19170 !! options
19171 parsoid=wt2html
19172 !! wikitext
19173 </s>
19174 !! html+tidy
19175 <p class="mw-empty-elt">
19176 </p>
19177 !! end
19178
19179 !! test
19180 Sanitizer: Closing of closed but not open table tags
19181 !! options
19182 parsoid=wt2html
19183 !! wikitext
19184 Table not started</td></tr></table>
19185 !! html+tidy
19186 <p>Table not started</p>
19187 !! end
19188
19189 !! test
19190 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
19191 !! options
19192 title=[[Main Page]]
19193 !! config
19194 wgFragmentMode=[ 'html5', 'legacy' ]
19195 !! wikitext
19196 <span id="æ: v">byte</span>[[#æ: v|backlink]]
19197 !! html/php
19198 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
19199 </p>
19200 !! html/parsoid
19201 <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>
19202 !! end
19203
19204 !! test
19205 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
19206 !! config
19207 wgFragmentMode=[ 'legacy' ]
19208 !! wikitext
19209 <span id="æ: v">byte</span>[[#æ: v|backlink]]
19210 !! html/php
19211 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
19212 </p>
19213 !! end
19214
19215 # In HTML5, the restrictions are that id must contain at least one character,
19216 # and must not contain any space characters.
19217 !! test
19218 Sanitizer: Validating the contents of the id attribute (T6515)
19219 !! options
19220 disabled
19221 !! wikitext
19222 <br id="" /><br id="a space" />
19223 !! html
19224 Something ...
19225 !! end
19226
19227 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
19228 !! test
19229 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
19230 !! options
19231 disabled
19232 !! wikitext
19233 <br id="foo" /><br id="foo" />
19234 !! html
19235 Something need to be done. foo-2 ?
19236 !! end
19237
19238 !! test
19239 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
19240 !! wikitext
19241 <div itemscope>
19242 <meta itemprop="hello" content="world">
19243 <meta http-equiv="refresh" content="5">
19244 <meta itemprop="hello" http-equiv="refresh" content="5">
19245 <link itemprop="hello" href="{{SERVER}}">
19246 <link rel="stylesheet" href="{{SERVER}}">
19247 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
19248 </div>
19249 !! html
19250 <div itemscope="">
19251 <p> <meta itemprop="hello" content="world" />
19252 &lt;meta http-equiv="refresh" content="5"&gt;
19253 <meta itemprop="hello" content="5" />
19254 <link itemprop="hello" href="http&#58;//example.org" />
19255 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
19256 <link itemprop="hello" href="http&#58;//example.org" />
19257 </p>
19258 </div>
19259 !! end
19260
19261 !! test
19262 Sanitizer: Strip comments from CSS attributes
19263 !! options
19264 parsoid=wt2html,wt2wt
19265 !! wikitext
19266 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
19267 !! html/php
19268 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
19269 </p>
19270 !! html/parsoid
19271 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
19272 !! end
19273
19274 !! test
19275 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
19276 !! wikitext
19277 [[meatball:Soft"Security]]
19278 !! html/php
19279 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
19280 </p>
19281 !! html/parsoid
19282 <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>
19283 !! end
19284
19285 !! test
19286 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
19287 !! wikitext
19288 [[meatball:Foo<Bar]]
19289 [[meatball:Foo>Bar]]
19290 [[meatball:Foo&lt;bar]]
19291 [[meatball:Foo&gt;bar]]
19292 !! html/php
19293 <p>[[meatball:Foo&lt;Bar]]
19294 [[meatball:Foo&gt;Bar]]
19295 [[meatball:Foo&lt;bar]]
19296 [[meatball:Foo&gt;bar]]
19297 </p>
19298 !! html/parsoid
19299 <p>[[meatball:Foo&lt;Bar]]
19300 [[meatball:Foo>Bar]]
19301 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
19302 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
19303 !! end
19304
19305 !! test
19306 Language converter: output gets cut off unexpectedly (T7757)
19307 !! options
19308 language=zh
19309 !! wikitext
19310 this bit is safe: }-
19311
19312 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
19313
19314 then we get cut off here: }-
19315
19316 all additional text is vanished
19317 !! html/php
19318 <p>this bit is safe: }-
19319 </p><p>but if we add a conversion instance: xxx
19320 </p><p>then we get cut off here: }-
19321 </p><p>all additional text is vanished
19322 </p>
19323 !! html/parsoid
19324 <p>this bit is safe: }-</p>
19325 <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>
19326 <p>then we get cut off here: }-</p>
19327 <p>all additional text is vanished</p>
19328 !! end
19329
19330 !! test
19331 Language converter glossary rules inside attributes (T119158)
19332 !! options
19333 language=sr variant=sr-el
19334 !! wikitext
19335 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
19336
19337 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
19338 !! html/php
19339 <p>
19340 </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>
19341 </p>
19342 !! html/parsoid
19343 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
19344
19345 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt1" data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&apos;{\"disabled\":{\"t\":\"\"}}&apos; data-parsoid=&apos;{\"fl\":[],\"dsr\":[76,80,null,2]}&apos;>&lt;/span>foAjrjvi&lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&apos;{\"disabled\":{\"t\":\"\"}}&apos; data-parsoid=&apos;{\"fl\":[],\"dsr\":[88,92,null,2]}&apos;>&lt;/span>","txt":"foAjrjvi"}]]}'><a href="./Датотека:Foobar.jpg"><img alt="foAjrjvi" resource="./Датотека:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./Датотека:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
19346 !! end
19347
19348 !! test
19349 Self closed html pairs (T7487)
19350 !! wikitext
19351 <center><font id="bug" />Centered text</center>
19352 <div><font id="bug2" />In div text</div>
19353 !! html+tidy
19354 <center><font id="bug"></font>Centered text</center>
19355 <div><font id="bug2"></font>In div text</div>
19356 !! end
19357
19358 !! test
19359 Punctuation: nbsp before exclamation
19360 !! wikitext
19361 C'est grave !
19362 !! html
19363 <p>C'est grave&#160;!
19364 </p>
19365 !! end
19366
19367 !! test
19368 Punctuation: CSS !important (T13874)
19369 !! wikitext
19370 <div style="width:50% !important">important</div>
19371 !! html
19372 <div style="width:50% !important">important</div>
19373 !! end
19374
19375 !! test
19376 Punctuation: CSS ! important (T13874; with space after)
19377 !! wikitext
19378 <div style="width:50% ! important">important</div>
19379 !! html
19380 <div style="width:50%&#32;! important">important</div>
19381 !! end
19382
19383 !! test
19384 HTML bullet list, closed tags (T7497)
19385 !! wikitext
19386 <ul>
19387 <li>One</li>
19388 <li>Two</li>
19389 </ul>
19390 !! html/php
19391 <ul>
19392 <li>One</li>
19393 <li>Two</li>
19394 </ul>
19395 !! html/parsoid
19396 <ul data-parsoid='{"stx":"html"}'>
19397 <li data-parsoid='{"stx":"html"}'>One</li>
19398 <li data-parsoid='{"stx":"html"}'>Two</li>
19399 </ul>
19400 !! end
19401
19402 !! test
19403 HTML bullet list, unclosed tags (T7497)
19404 !! wikitext
19405 <ul>
19406 <li>One
19407 <li>Two
19408 </ul>
19409 !! html/php+tidy
19410 <ul>
19411 <li>One
19412 </li><li>Two
19413 </li></ul>
19414 !! html/parsoid
19415 <ul data-parsoid='{"stx":"html"}'>
19416 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19417 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19418 </ul>
19419 !! end
19420
19421 !! test
19422 HTML ordered list, closed tags (T7497)
19423 !! wikitext
19424 <ol>
19425 <li>One</li>
19426 <li>Two</li>
19427 </ol>
19428 !! html/php
19429 <ol>
19430 <li>One</li>
19431 <li>Two</li>
19432 </ol>
19433 !! html/parsoid
19434 <ol data-parsoid='{"stx":"html"}'>
19435 <li data-parsoid='{"stx":"html"}'>One</li>
19436 <li data-parsoid='{"stx":"html"}'>Two</li>
19437 </ol>
19438 !! end
19439
19440 !! test
19441 HTML ordered list, unclosed tags (T7497)
19442 !! options
19443 !! wikitext
19444 <ol>
19445 <li>One
19446 <li>Two
19447 </ol>
19448 !! html/php+tidy
19449 <ol>
19450 <li>One
19451 </li><li>Two
19452 </li></ol>
19453 !! html/parsoid
19454 <ol data-parsoid='{"stx":"html"}'>
19455 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19456 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19457 </ol>
19458 !! end
19459
19460 !! test
19461 HTML nested bullet list, closed tags (T7497)
19462 !! wikitext
19463 <ul>
19464 <li>One</li>
19465 <li>Two:
19466 <ul>
19467 <li>Sub-one</li>
19468 <li>Sub-two</li>
19469 </ul>
19470 </li>
19471 </ul>
19472 !! html/php
19473 <ul>
19474 <li>One</li>
19475 <li>Two:
19476 <ul>
19477 <li>Sub-one</li>
19478 <li>Sub-two</li>
19479 </ul>
19480 </li>
19481 </ul>
19482 !! html/parsoid
19483 <ul data-parsoid='{"stx":"html"}'>
19484 <li data-parsoid='{"stx":"html"}'>One</li>
19485 <li data-parsoid='{"stx":"html"}'>Two:
19486 <ul data-parsoid='{"stx":"html"}'>
19487 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
19488 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
19489 </ul>
19490 </li>
19491 </ul>
19492 !! end
19493
19494 !! test
19495 HTML nested bullet list, open tags (T7497)
19496 !! wikitext
19497 <ul>
19498 <li>One
19499 <li>Two:
19500 <ul>
19501 <li>Sub-one
19502 <li>Sub-two
19503 </ul>
19504 </ul>
19505 !! html+tidy
19506 <ul>
19507 <li>One
19508 </li><li>Two:
19509 <ul>
19510 <li>Sub-one
19511 </li><li>Sub-two
19512 </li></ul>
19513 </li></ul>
19514 !! end
19515
19516 !! test
19517 HTML nested ordered list, closed tags (T7497)
19518 !! wikitext
19519 <ol>
19520 <li>One</li>
19521 <li>Two:
19522 <ol>
19523 <li>Sub-one</li>
19524 <li>Sub-two</li>
19525 </ol>
19526 </li>
19527 </ol>
19528 !! html
19529 <ol>
19530 <li>One</li>
19531 <li>Two:
19532 <ol>
19533 <li>Sub-one</li>
19534 <li>Sub-two</li>
19535 </ol>
19536 </li>
19537 </ol>
19538 !! end
19539
19540 !! test
19541 HTML nested ordered list, open tags (T7497)
19542 !! wikitext
19543 <ol>
19544 <li>One
19545 <li>Two:
19546 <ol>
19547 <li>Sub-one
19548 <li>Sub-two
19549 </ol>
19550 </ol>
19551 !! html/php
19552 <ol>
19553 <li>One
19554 <li>Two:
19555 <ol>
19556 <li>Sub-one
19557 <li>Sub-two
19558 </ol>
19559 </ol>
19560 !! html/parsoid
19561 <ol>
19562 <li>One
19563 </li>
19564 <li>Two:
19565 <ol>
19566 <li>Sub-one
19567 </li>
19568 <li>Sub-two
19569 </li>
19570 </ol>
19571 </li>
19572 </ol>
19573 !! end
19574
19575 !! test
19576 HTML ordered list item with parameters oddity
19577 !! wikitext
19578 <ol><li id="fragment">One</li>
19579 </ol>
19580 !! html
19581 <ol><li id="fragment">One</li>
19582 </ol>
19583 !! end
19584
19585 # parsoid doesn't explicitly mark autonumbered links, see T55505
19586 !!test
19587 T7918: autonumbering
19588 !! wikitext
19589 [http://first/] [http://second] [ftp://ftp]
19590
19591 ftp://inlineftp
19592
19593 [mailto:enclosed@mail.tld With target]
19594
19595 [mailto:enclosed@mail.tld]
19596
19597 mailto:inline@mail.tld
19598 !! html/php
19599 <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>
19600 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
19601 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
19602 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
19603 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
19604 </p>
19605 !! html/parsoid
19606 <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>
19607 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
19608 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
19609 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
19610 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
19611 !! end
19612
19613
19614 #
19615 # Security and HTML correctness
19616 # From Nick Jenkins' fuzz testing
19617 #
19618
19619 !! test
19620 Fuzz testing: Parser13
19621 !! wikitext
19622 {|
19623 | http://a|
19624 !! html
19625 <table>
19626 <tr>
19627 <td>
19628 </td>
19629 </tr>
19630 </table>
19631 !! end
19632
19633 # Note that Parsoid output differs from the PHP parser here: the PHP
19634 # parser breaks the URL for the magic word, while in Parsoid the URL
19635 # production takes precedence.
19636 !! test
19637 Fuzz testing: Parser14
19638 !! wikitext
19639 ==onmouseover===
19640 http://__TOC__
19641 !! html/php
19642 <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>
19643 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>
19644 <ul>
19645 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19646 </ul>
19647 </div>
19648
19649 !! html/php+tidy
19650 <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>
19651 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>
19652 <ul>
19653 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19654 </ul>
19655 </div>
19656 !! html/parsoid
19657 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
19658 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
19659 !! end
19660
19661 !! test
19662 Fuzz testing: Parser14-table
19663 !! options
19664 parsoid=wt2html,html2html
19665 !! wikitext
19666 ==a==
19667 {| STYLE=__TOC__
19668 !! html/php
19669 <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>
19670 <table style="&#95;_TOC&#95;_">
19671 <tr><td></td></tr>
19672 </table>
19673 !! html/php+tidy
19674 <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>
19675 <table style="&#95;_TOC&#95;_">
19676 <tbody><tr><td></td></tr>
19677 </tbody></table>
19678 !! html/parsoid
19679 <h2 id="a">a</h2>
19680 <table style="__TOC__"></table>
19681 !! end
19682
19683 # Known to produce bogus xml (extra </td>)
19684 # Don't add the html/php section since it generates broken HTML
19685 !! test
19686 Fuzz testing: Parser16
19687 !! wikitext
19688 {|
19689 !https://||||||
19690 !! html+tidy
19691 <table>
19692 <tbody><tr>
19693 <th>https://</th>
19694 <th></th>
19695 <th></th>
19696 <th>
19697
19698 </th></tr>
19699 </tbody></table>
19700 !! end
19701
19702 !! test
19703 Fuzz testing: Parser21
19704 !! wikitext
19705 {|
19706 !irc://{{ftp://a" onmouseover="alert('hello world');"
19707 |
19708 !! html
19709 <table>
19710 <tr>
19711 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
19712 </th>
19713 <td>
19714 </td>
19715 </tr>
19716 </table>
19717 !! end
19718
19719 !! test
19720 Fuzz testing: Parser22
19721 !! wikitext
19722 http://===r:::https://b
19723
19724 {|
19725 !! html
19726 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
19727 </p>
19728 <table>
19729 <tr><td></td></tr>
19730 </table>
19731 !! end
19732
19733 ## Remex doesn't account for fostered content.
19734 ## Known to produce bad XML for now
19735 !! test
19736 Fuzz testing: Parser24
19737 !! options
19738 parsoid=wt2html
19739 !! wikitext
19740 {|
19741 {{{|
19742 <u CLASS=
19743 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19744 <br style="onmouseover='alert(document.cookie);' " />
19745
19746 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19747 |
19748 !! html/php
19749 <table>
19750 {{{|
19751 <u class="&#124;">}}}} &gt;
19752 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19753
19754 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19755 <tr>
19756 <td></u>
19757 </td>
19758 </tr>
19759 </table>
19760 !! html/php+tidy
19761
19762 {{{|
19763 <u class="&#124;">}}}} &gt;
19764 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19765
19766 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19767 </u><table><tbody><tr>
19768 <td>
19769 </td>
19770 </tr>
19771 </tbody></table>
19772 !! html/parsoid
19773 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
19774 {{{|
19775 <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>"}'/>}}}} >
19776 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/>
19777
19778 MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p>
19779 <table data-parsoid='{"autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedStart":true}'><td></td></tr></tbody></table>
19780 !! end
19781
19782 # Note: the current result listed for this is not what the original one was,
19783 # but the original bug was JavaScript injection, which is fixed in any case.
19784 # It's not clear that the original result listed was any more correct than the
19785 # current one. Original result:
19786 # <p>{{{|
19787 # </p>
19788 # <li class="&#124;&#124;">
19789 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19790 !!test
19791 Fuzz testing: Parser25 (T8055)
19792 !! wikitext
19793 {{{
19794 |
19795 <LI CLASS=||
19796 >
19797 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19798 !! html/php
19799 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19800 </p>
19801 !! html/parsoid
19802 <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"]}'>
19803 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19804 !! end
19805
19806 !!test
19807 Fuzz testing: URL adjacent extension (with space, clean)
19808 !! wikitext
19809 http://example.com <nowiki>junk</nowiki>
19810 !! html/php
19811 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19812 </p>
19813 !! html/parsoid
19814 <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>
19815 !! end
19816
19817 !!test
19818 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19819 !! wikitext
19820 http://example.com<nowiki>junk</nowiki>
19821 !! html/php
19822 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19823 </p>
19824 !! html/parsoid
19825 <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>
19826 !! end
19827
19828 !! test
19829 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19830 !! wikitext
19831 http://example.com<pre>junk</pre>
19832 !! html/php
19833 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19834 !! html/php+tidy
19835 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19836 !! html/parsoid
19837 <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>
19838 !! end
19839
19840 !! test
19841 Fuzz testing: image with bogus manual thumbnail
19842 !! wikitext
19843 [[Image:foobar.jpg|thumbnail= ]]
19844 !! html/php
19845 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19846 !! html/parsoid
19847 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' data-mw='{"attribs":[["manualthumb",{"txt":""}]],"errors":[{"key":"apierror-invalidtitle","message":"Invalid thumbnail title.","params":{"name":""}}]}'><a href="./Special:FilePath/Foobar.jpg"><span resource="./File:Foobar.jpg" data-parsoid='{"a":{"resource":"./File:Foobar.jpg"},"sa":{"resource":"Image:foobar.jpg"}}'>File:Foobar.jpg</span></a><figcaption></figcaption></figure>
19848 !! end
19849
19850 # Parsoid will emit the newline literally in wt2wt; see next test case.
19851 !! test
19852 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19853 !! options
19854 parsoid=wt2html
19855 !! wikitext
19856 <pre dir="&#10;"></pre>
19857 !! html/php
19858 <pre dir="&#10;"></pre>
19859 !! html/parsoid
19860 <pre dir="
19861 " typeof="mw:Extension/pre" about="#mwt2"data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19862 !! end
19863
19864 !! test
19865 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19866 !! options
19867 parsoid=html2wt
19868 !! html/parsoid
19869 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19870 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19871 !! wikitext
19872 <pre dir="
19873 "></pre>
19874 !! html/php
19875 <pre dir=""></pre>
19876 !! end
19877
19878 !! test
19879 Templates in extension attributes are not expanded
19880 !! wikitext
19881 <pre dir="{{echo|ltr}}"></pre>
19882 !! html/php
19883 <pre dir="{{echo|ltr}}"></pre>
19884 !! html/parsoid
19885 <pre dir="{{echo|ltr}}" typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19886 !! end
19887
19888 !! test
19889 Parsing optional HTML elements (T8171)
19890 !! options
19891 !! wikitext
19892 <table>
19893 <tr>
19894 <td> Some tabular data</td>
19895 <td> More tabular data ...
19896 <td> And yet som tabular data</td>
19897 </tr>
19898 </table>
19899 !! html
19900 <table>
19901 <tr>
19902 <td> Some tabular data</td>
19903 <td> More tabular data ...
19904 </td><td> And yet som tabular data</td>
19905 </tr>
19906 </table>
19907 !! end
19908
19909 !! test
19910 Correct handling of <td>, <tr> (T8171)
19911 !! options
19912 !! wikitext
19913 <table>
19914 <tr>
19915 <td> Some tabular data</td>
19916 <td> More tabular data ...</td>
19917 <td> And yet som tabular data</td>
19918 </tr>
19919 </table>
19920 !! html
19921 <table>
19922 <tr>
19923 <td> Some tabular data</td>
19924 <td> More tabular data ...</td>
19925 <td> And yet som tabular data</td>
19926 </tr>
19927 </table>
19928 !! end
19929
19930
19931 !! test
19932 Parsing crashing regression (fr:JavaScript)
19933 !! wikitext
19934 </body></x>
19935 !! html
19936 <p>&lt;/body&gt;&lt;/x&gt;
19937 </p>
19938 !! end
19939
19940 !! test
19941 Inline wiki vs wiki block nesting
19942 !! wikitext
19943 '''Bold paragraph
19944
19945 New wiki paragraph
19946 !! html
19947 <p><b>Bold paragraph</b>
19948 </p><p>New wiki paragraph
19949 </p>
19950 !! end
19951
19952 # FIXME: The current php output is documented
19953 # and desired output is the parsoid target.
19954 !! test
19955 Inline HTML vs wiki block nesting
19956 !! wikitext
19957 <b>Bold paragraph
19958
19959 New wiki paragraph
19960 !! html/php
19961 <p><b>Bold paragraph
19962 </p><p>New wiki paragraph</b>
19963 </p>
19964 !! html/php+tidy
19965 <p><b>Bold paragraph
19966 </b></p><p><b>New wiki paragraph
19967 </b></p>
19968 !! html/parsoid
19969 <p><b>Bold paragraph</b>
19970 </p><p>New wiki paragraph
19971 </p>
19972 !! end
19973
19974 # Original result was this:
19975 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19976 # </p>
19977 # While that might be marginally more intuitive, maybe, the six-apostrophe
19978 # construct is clearly pathological and the result stated here (which is what
19979 # the parser actually does) is about as reasonable as anything.
19980 !!test
19981 Mixing markup for italics and bold
19982 !! options
19983 !! wikitext
19984 '''bold''''''bold''bolditalics'''''
19985 !! html
19986 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19987 </p>
19988 !! end
19989
19990
19991 !! article
19992 Xyzzyx
19993 !! text
19994 Article for special page transclusion test
19995 !! endarticle
19996
19997 !! test
19998 Special page transclusion
19999 !! options
20000 !! wikitext
20001 {{Special:Prefixindex/Xyzzyx}}
20002 !! html
20003 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20004 </ul>
20005 !! end
20006
20007 !! test
20008 Special page transclusion twice (T7021)
20009 !! options
20010 !! wikitext
20011 {{Special:Prefixindex/Xyzzyx}}
20012 {{Special:Prefixindex/Xyzzyx}}
20013 !! html
20014 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20015 </ul>
20016 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20017 </ul>
20018 !! end
20019
20020 !! test
20021 Transclusion of default MediaWiki message
20022 !! wikitext
20023 {{MediaWiki:Mainpage}}
20024 !! html
20025 <p>Main Page
20026 </p>
20027 !! end
20028
20029 !! test
20030 Transclusion of nonexistent MediaWiki message
20031 !! wikitext
20032 {{MediaWiki:Mainpagexxx}}
20033 !! html
20034 <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>
20035 </p>
20036 !! end
20037
20038 !! test
20039 Transclusion of MediaWiki message with underscore
20040 !! wikitext
20041 {{MediaWiki:history_short}}
20042 !! html
20043 <p>History
20044 </p>
20045 !! end
20046
20047 !! test
20048 Transclusion of MediaWiki message with space
20049 !! wikitext
20050 {{MediaWiki:history short}}
20051 !! html
20052 <p>History
20053 </p>
20054 !! end
20055
20056 !! test
20057 Invalid header with following text
20058 !! wikitext
20059 = x = y
20060 !! html
20061 <p>= x = y
20062 </p>
20063 !! end
20064
20065
20066 !! test
20067 Section extraction test (section 0)
20068 !! options
20069 section=0
20070 !! wikitext
20071 start
20072 ==a==
20073 ===aa===
20074 ====aaa====
20075 ==b==
20076 ===ba===
20077 ===bb===
20078 ====bba====
20079 ===bc===
20080 ==c==
20081 ===ca===
20082 !! html/php
20083 start
20084 !! end
20085
20086 !! test
20087 Section extraction test (section 1)
20088 !! options
20089 section=1
20090 !! wikitext
20091 start
20092 ==a==
20093 ===aa===
20094 ====aaa====
20095 ==b==
20096 ===ba===
20097 ===bb===
20098 ====bba====
20099 ===bc===
20100 ==c==
20101 ===ca===
20102 !! html/php
20103 ==a==
20104 ===aa===
20105 ====aaa====
20106 !! end
20107
20108 !! test
20109 Section extraction test (section 2)
20110 !! options
20111 section=2
20112 !! wikitext
20113 start
20114 ==a==
20115 ===aa===
20116 ====aaa====
20117 ==b==
20118 ===ba===
20119 ===bb===
20120 ====bba====
20121 ===bc===
20122 ==c==
20123 ===ca===
20124 !! html/php
20125 ===aa===
20126 ====aaa====
20127 !! end
20128
20129 !! test
20130 Section extraction test (section 3)
20131 !! options
20132 section=3
20133 !! wikitext
20134 start
20135 ==a==
20136 ===aa===
20137 ====aaa====
20138 ==b==
20139 ===ba===
20140 ===bb===
20141 ====bba====
20142 ===bc===
20143 ==c==
20144 ===ca===
20145 !! html/php
20146 ====aaa====
20147 !! end
20148
20149 !! test
20150 Section extraction test (section 4)
20151 !! options
20152 section=4
20153 !! wikitext
20154 start
20155 ==a==
20156 ===aa===
20157 ====aaa====
20158 ==b==
20159 ===ba===
20160 ===bb===
20161 ====bba====
20162 ===bc===
20163 ==c==
20164 ===ca===
20165 !! html/php
20166 ==b==
20167 ===ba===
20168 ===bb===
20169 ====bba====
20170 ===bc===
20171 !! end
20172
20173 !! test
20174 Section extraction test (section 5)
20175 !! options
20176 section=5
20177 !! wikitext
20178 start
20179 ==a==
20180 ===aa===
20181 ====aaa====
20182 ==b==
20183 ===ba===
20184 ===bb===
20185 ====bba====
20186 ===bc===
20187 ==c==
20188 ===ca===
20189 !! html/php
20190 ===ba===
20191 !! end
20192
20193 !! test
20194 Section extraction test (section 6)
20195 !! options
20196 section=6
20197 !! wikitext
20198 start
20199 ==a==
20200 ===aa===
20201 ====aaa====
20202 ==b==
20203 ===ba===
20204 ===bb===
20205 ====bba====
20206 ===bc===
20207 ==c==
20208 ===ca===
20209 !! html/php
20210 ===bb===
20211 ====bba====
20212 !! end
20213
20214 !! test
20215 Section extraction test (section 7)
20216 !! options
20217 section=7
20218 !! wikitext
20219 start
20220 ==a==
20221 ===aa===
20222 ====aaa====
20223 ==b==
20224 ===ba===
20225 ===bb===
20226 ====bba====
20227 ===bc===
20228 ==c==
20229 ===ca===
20230 !! html/php
20231 ====bba====
20232 !! end
20233
20234 !! test
20235 Section extraction test (section 8)
20236 !! options
20237 section=8
20238 !! wikitext
20239 start
20240 ==a==
20241 ===aa===
20242 ====aaa====
20243 ==b==
20244 ===ba===
20245 ===bb===
20246 ====bba====
20247 ===bc===
20248 ==c==
20249 ===ca===
20250 !! html/php
20251 ===bc===
20252 !! end
20253
20254 !! test
20255 Section extraction test (section 9)
20256 !! options
20257 section=9
20258 !! wikitext
20259 start
20260 ==a==
20261 ===aa===
20262 ====aaa====
20263 ==b==
20264 ===ba===
20265 ===bb===
20266 ====bba====
20267 ===bc===
20268 ==c==
20269 ===ca===
20270 !! html/php
20271 ==c==
20272 ===ca===
20273 !! end
20274
20275 !! test
20276 Section extraction test (section 10)
20277 !! options
20278 section=10
20279 !! wikitext
20280 start
20281 ==a==
20282 ===aa===
20283 ====aaa====
20284 ==b==
20285 ===ba===
20286 ===bb===
20287 ====bba====
20288 ===bc===
20289 ==c==
20290 ===ca===
20291 !! html/php
20292 ===ca===
20293 !! end
20294
20295 !! test
20296 Section extraction test (nonexistent section 11)
20297 !! options
20298 section=11
20299 !! wikitext
20300 start
20301 ==a==
20302 ===aa===
20303 ====aaa====
20304 ==b==
20305 ===ba===
20306 ===bb===
20307 ====bba====
20308 ===bc===
20309 ==c==
20310 ===ca===
20311 !! html/php
20312 !! end
20313
20314 !! test
20315 Section extraction test with bogus heading (section 1)
20316 !! options
20317 section=1
20318 !! wikitext
20319 ==a==
20320 ==bogus== not a legal section
20321 ==b==
20322 !! html/php
20323 ==a==
20324 ==bogus== not a legal section
20325 !! end
20326
20327 !! test
20328 Section extraction test with bogus heading (section 2)
20329 !! options
20330 section=2
20331 !! wikitext
20332 ==a==
20333 ==bogus== not a legal section
20334 ==b==
20335 !! html/php
20336 ==b==
20337 !! end
20338
20339 !! test
20340 Section extraction test with comment after heading (section 1)
20341 !! options
20342 section=1
20343 !! wikitext
20344 ==a==
20345 ==b== <!-- -->
20346 ==c==
20347 !! html/php
20348 ==a==
20349 !! end
20350
20351 !! test
20352 Section extraction test with comment after heading (section 2)
20353 !! options
20354 section=2
20355 !! wikitext
20356 ==a==
20357 ==b== <!-- -->
20358 ==c==
20359 !! html/php
20360 ==b== <!-- -->
20361 !! end
20362
20363 !! test
20364 Section extraction test with bogus <nowiki> heading (section 1)
20365 !! options
20366 section=1
20367 !! wikitext
20368 ==a==
20369 ==bogus== <nowiki>not a legal section</nowiki>
20370 ==b==
20371 !! html/php
20372 ==a==
20373 ==bogus== <nowiki>not a legal section</nowiki>
20374 !! end
20375
20376 !! test
20377 Section extraction test with bogus <nowiki> heading (section 2)
20378 !! options
20379 section=2
20380 !! wikitext
20381 ==a==
20382 ==bogus== <nowiki>not a legal section</nowiki>
20383 ==b==
20384 !! html/php
20385 ==b==
20386 !! end
20387
20388 # Formerly testing for T4587, now resolved by the use of unmarked sections
20389 # instead of respecting commented sections
20390 !! test
20391 Section extraction prefixed by comment (section 1)
20392 !! options
20393 section=1
20394 !! wikitext
20395 <!-- -->==sec1==
20396 ==sec2==
20397 !! html/php
20398 ==sec2==
20399 !!end
20400
20401 !! test
20402 Section extraction prefixed by comment (section 2)
20403 !! options
20404 section=2
20405 !! wikitext
20406 <!-- -->==sec1==
20407 ==sec2==
20408 !! html/php
20409 !! end
20410
20411 # Formerly testing for T4607, now resolved by the use of unmarked sections
20412 # instead of respecting HTML-style headings
20413 !! test
20414 Section extraction, mixed wiki and html (section 1)
20415 !! options
20416 section=1
20417 !! wikitext
20418 <h2>unmarked</h2>
20419 unmarked
20420 ==1==
20421 one
20422 ==2==
20423 two
20424 !! html/php
20425 ==1==
20426 one
20427 !! end
20428
20429 !! test
20430 Section extraction, mixed wiki and html (section 2)
20431 !! options
20432 section=2
20433 !! wikitext
20434 <h2>unmarked</h2>
20435 unmarked
20436 ==1==
20437 one
20438 ==2==
20439 two
20440 !! html/php
20441 ==2==
20442 two
20443 !! end
20444
20445
20446 # Formerly testing for T5342
20447 !! test
20448 Section extraction, heading surrounded by <noinclude>
20449 !! options
20450 section=1
20451 !! wikitext
20452 <noinclude>==unmarked==</noinclude>
20453 ==marked==
20454 !! html/php
20455 ==marked==
20456 !!end
20457
20458 # Test behavior of T21910
20459 !! test
20460 Sectiion with all-equals
20461 !! options
20462 section=2
20463 !! wikitext
20464 ===
20465 The line above must have a trailing space
20466 === <!--
20467 --> <!-- -->
20468 But just in case it doesn't...
20469 !! html/php
20470 === <!--
20471 --> <!-- -->
20472 But just in case it doesn't...
20473 !! end
20474
20475 !! test
20476 Section replacement test (section 0)
20477 !! options
20478 replace=0,"xxx"
20479 !! wikitext
20480 start
20481 ==a==
20482 ===aa===
20483 ====aaa====
20484 ==b==
20485 ===ba===
20486 ===bb===
20487 ====bba====
20488 ===bc===
20489 ==c==
20490 ===ca===
20491 !! html/php
20492 xxx
20493
20494 ==a==
20495 ===aa===
20496 ====aaa====
20497 ==b==
20498 ===ba===
20499 ===bb===
20500 ====bba====
20501 ===bc===
20502 ==c==
20503 ===ca===
20504 !! end
20505
20506 !! test
20507 Section replacement test (section 1)
20508 !! options
20509 replace=1,"xxx"
20510 !! wikitext
20511 start
20512 ==a==
20513 ===aa===
20514 ====aaa====
20515 ==b==
20516 ===ba===
20517 ===bb===
20518 ====bba====
20519 ===bc===
20520 ==c==
20521 ===ca===
20522 !! html/php
20523 start
20524 xxx
20525
20526 ==b==
20527 ===ba===
20528 ===bb===
20529 ====bba====
20530 ===bc===
20531 ==c==
20532 ===ca===
20533 !! end
20534
20535 !! test
20536 Section replacement test (section 2)
20537 !! options
20538 replace=2,"xxx"
20539 !! wikitext
20540 start
20541 ==a==
20542 ===aa===
20543 ====aaa====
20544 ==b==
20545 ===ba===
20546 ===bb===
20547 ====bba====
20548 ===bc===
20549 ==c==
20550 ===ca===
20551 !! html/php
20552 start
20553 ==a==
20554 xxx
20555
20556 ==b==
20557 ===ba===
20558 ===bb===
20559 ====bba====
20560 ===bc===
20561 ==c==
20562 ===ca===
20563 !! end
20564
20565 !! test
20566 Section replacement test (section 3)
20567 !! options
20568 replace=3,"xxx"
20569 !! wikitext
20570 start
20571 ==a==
20572 ===aa===
20573 ====aaa====
20574 ==b==
20575 ===ba===
20576 ===bb===
20577 ====bba====
20578 ===bc===
20579 ==c==
20580 ===ca===
20581 !! html/php
20582 start
20583 ==a==
20584 ===aa===
20585 xxx
20586
20587 ==b==
20588 ===ba===
20589 ===bb===
20590 ====bba====
20591 ===bc===
20592 ==c==
20593 ===ca===
20594 !! end
20595
20596 !! test
20597 Section replacement test (section 4)
20598 !! options
20599 replace=4,"xxx"
20600 !! wikitext
20601 start
20602 ==a==
20603 ===aa===
20604 ====aaa====
20605 ==b==
20606 ===ba===
20607 ===bb===
20608 ====bba====
20609 ===bc===
20610 ==c==
20611 ===ca===
20612 !! html/php
20613 start
20614 ==a==
20615 ===aa===
20616 ====aaa====
20617 xxx
20618
20619 ==c==
20620 ===ca===
20621 !! end
20622
20623 !! test
20624 Section replacement test (section 5)
20625 !! options
20626 replace=5,"xxx"
20627 !! wikitext
20628 start
20629 ==a==
20630 ===aa===
20631 ====aaa====
20632 ==b==
20633 ===ba===
20634 ===bb===
20635 ====bba====
20636 ===bc===
20637 ==c==
20638 ===ca===
20639 !! html/php
20640 start
20641 ==a==
20642 ===aa===
20643 ====aaa====
20644 ==b==
20645 xxx
20646
20647 ===bb===
20648 ====bba====
20649 ===bc===
20650 ==c==
20651 ===ca===
20652 !! end
20653
20654 !! test
20655 Section replacement test (section 6)
20656 !! options
20657 replace=6,"xxx"
20658 !! wikitext
20659 start
20660 ==a==
20661 ===aa===
20662 ====aaa====
20663 ==b==
20664 ===ba===
20665 ===bb===
20666 ====bba====
20667 ===bc===
20668 ==c==
20669 ===ca===
20670 !! html/php
20671 start
20672 ==a==
20673 ===aa===
20674 ====aaa====
20675 ==b==
20676 ===ba===
20677 xxx
20678
20679 ===bc===
20680 ==c==
20681 ===ca===
20682 !! end
20683
20684 !! test
20685 Section replacement test (section 7)
20686 !! options
20687 replace=7,"xxx"
20688 !! wikitext
20689 start
20690 ==a==
20691 ===aa===
20692 ====aaa====
20693 ==b==
20694 ===ba===
20695 ===bb===
20696 ====bba====
20697 ===bc===
20698 ==c==
20699 ===ca===
20700 !! html/php
20701 start
20702 ==a==
20703 ===aa===
20704 ====aaa====
20705 ==b==
20706 ===ba===
20707 ===bb===
20708 xxx
20709
20710 ===bc===
20711 ==c==
20712 ===ca===
20713 !! end
20714
20715 !! test
20716 Section replacement test (section 8)
20717 !! options
20718 replace=8,"xxx"
20719 !! wikitext
20720 start
20721 ==a==
20722 ===aa===
20723 ====aaa====
20724 ==b==
20725 ===ba===
20726 ===bb===
20727 ====bba====
20728 ===bc===
20729 ==c==
20730 ===ca===
20731 !! html/php
20732 start
20733 ==a==
20734 ===aa===
20735 ====aaa====
20736 ==b==
20737 ===ba===
20738 ===bb===
20739 ====bba====
20740 xxx
20741
20742 ==c==
20743 ===ca===
20744 !!end
20745
20746 !! test
20747 Section replacement test (section 9)
20748 !! options
20749 replace=9,"xxx"
20750 !! wikitext
20751 start
20752 ==a==
20753 ===aa===
20754 ====aaa====
20755 ==b==
20756 ===ba===
20757 ===bb===
20758 ====bba====
20759 ===bc===
20760 ==c==
20761 ===ca===
20762 !! html/php
20763 start
20764 ==a==
20765 ===aa===
20766 ====aaa====
20767 ==b==
20768 ===ba===
20769 ===bb===
20770 ====bba====
20771 ===bc===
20772 xxx
20773 !! end
20774
20775 !! test
20776 Section replacement test (section 10)
20777 !! options
20778 replace=10,"xxx"
20779 !! wikitext
20780 start
20781 ==a==
20782 ===aa===
20783 ====aaa====
20784 ==b==
20785 ===ba===
20786 ===bb===
20787 ====bba====
20788 ===bc===
20789 ==c==
20790 ===ca===
20791 !! html/php
20792 start
20793 ==a==
20794 ===aa===
20795 ====aaa====
20796 ==b==
20797 ===ba===
20798 ===bb===
20799 ====bba====
20800 ===bc===
20801 ==c==
20802 xxx
20803 !! end
20804
20805 !! test
20806 Section replacement test with initial whitespace (T15728)
20807 !! options
20808 replace=2,"xxx"
20809 !! wikitext
20810 Preformatted initial line
20811 ==a==
20812 ===a===
20813 !! html/php
20814 Preformatted initial line
20815 ==a==
20816 xxx
20817 !! end
20818
20819
20820 !! test
20821 Section extraction, heading followed by pre with 20 spaces (T8398)
20822 !! options
20823 section=1
20824 !! wikitext
20825 ==a==
20826 a
20827 !! html/php
20828 ==a==
20829 a
20830 !! end
20831
20832 !! test
20833 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20834 !! options
20835 section=1
20836 !! wikitext
20837 ==a==
20838 a
20839 !! html/php
20840 ==a==
20841 a
20842 !! end
20843
20844
20845 !! test
20846 Section extraction, <pre> around bogus header (T12309)
20847 !! options
20848 section=2
20849 !! wikitext
20850 == Section One ==
20851 <pre>
20852 =======
20853 </pre>
20854
20855 == Section Two ==
20856 stuff
20857 !! html/php
20858 == Section Two ==
20859 stuff
20860 !! end
20861
20862 !! test
20863 Section replacement, <pre> around bogus header (T12309)
20864 !! options
20865 replace=2,"xxx"
20866 !! wikitext
20867 == Section One ==
20868 <pre>
20869 =======
20870 </pre>
20871
20872 == Section Two ==
20873 stuff
20874 !! html/php
20875 == Section One ==
20876 <pre>
20877 =======
20878 </pre>
20879
20880 xxx
20881 !! end
20882
20883 !! test
20884 Handling of &#x0A; in URLs
20885 !! wikitext
20886 *irc://&#x0A;a
20887 !! html/php
20888 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20889 !! html/parsoid
20890 <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>
20891 !! end
20892
20893 !! test
20894 Handling of %0A in URLs
20895 !! wikitext
20896 *irc://%0Aa
20897 !! html/php
20898 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20899 !! html/parsoid
20900 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20901 !! end
20902
20903 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20904 !! test
20905 5 quotes, code coverage +1 line
20906 !! options
20907 parsoid=wt2html
20908 !! wikitext
20909 '''''
20910 !! html/php
20911 !! html/parsoid
20912 <p><b><i></i></b></p>
20913 !! end
20914
20915 # same html as previous, but wikitext adjusted to match parsoid html2wt
20916 # note that wt2html and html2html will put the <i> before the <b>
20917 !! test
20918 5 quotes, code coverage +1 line w/ nowiki (1)
20919 !! options
20920 parsoid=wt2wt,html2wt
20921 !! wikitext
20922 '''''<nowiki/>'''''
20923 !! html/php
20924 <p><i></i>
20925 </p>
20926 !! html/parsoid
20927 <p><b><i></i></b></p>
20928 !! end
20929
20930 # same as previous, just swapping the <i> and <b>
20931 !! test
20932 5 quotes, code coverage +1 line w/ nowiki (2)
20933 !! wikitext
20934 '''''<nowiki/>'''''
20935 !! html/php
20936 <p><i></i>
20937 </p>
20938 !! html/parsoid
20939 <p><i><b></b></i></p>
20940 !! end
20941
20942 !! test
20943 Special:Search page linking.
20944 !! wikitext
20945 {{Special:search}}
20946 !! html
20947 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20948 </p>
20949 !! end
20950
20951 !! test
20952 {{!}} is a magic word
20953 !! wikitext
20954 {{!}} is a magic word there and {{!}} is still a magic word here
20955 | is not a magic word here but {{!}} is still a magic word here
20956 !! html/php
20957 <p>| is a magic word there and | is still a magic word here
20958 | is not a magic word here but | is still a magic word here
20959 </p>
20960 !! html/parsoid
20961 <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
20962 | 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>
20963 !! end
20964
20965 !! test
20966 Say the magic word
20967 !! options
20968 title=[[Parser test]]
20969 !! wikitext
20970 *{{PAGENAME}}
20971 *{{PAGENAMEE}}
20972 *{{FULLPAGENAME}}
20973 *{{FULLPAGENAMEE}}
20974 *{{BASEPAGENAME}}
20975 *{{BASEPAGENAMEE}}
20976 *{{SUBPAGENAME}}
20977 *{{SUBPAGENAMEE}}
20978 *{{ROOTPAGENAME}}
20979 *{{ROOTPAGENAMEE}}
20980 *{{TALKPAGENAME}}
20981 *{{TALKPAGENAMEE}}
20982 *{{SUBJECTPAGENAME}}
20983 *{{SUBJECTPAGENAMEE}}
20984 *{{NAMESPACEE}}
20985 *{{NAMESPACE}}
20986 *{{NAMESPACENUMBER}}
20987 *{{TALKSPACE}}
20988 *{{TALKSPACEE}}
20989 *{{SUBJECTSPACE}}
20990 *{{SUBJECTSPACEE}}
20991 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20992 !! html
20993 <ul><li>Parser test</li>
20994 <li>Parser_test</li>
20995 <li>Parser test</li>
20996 <li>Parser_test</li>
20997 <li>Parser test</li>
20998 <li>Parser_test</li>
20999 <li>Parser test</li>
21000 <li>Parser_test</li>
21001 <li>Parser test</li>
21002 <li>Parser_test</li>
21003 <li>Talk:Parser test</li>
21004 <li>Talk:Parser_test</li>
21005 <li>Parser test</li>
21006 <li>Parser_test</li>
21007 <li></li>
21008 <li></li>
21009 <li>0</li>
21010 <li>Talk</li>
21011 <li>Talk</li>
21012 <li></li>
21013 <li></li>
21014 <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>
21015 !! end
21016 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
21017
21018 !! test
21019 Gallery with valid attributes
21020 !! wikitext
21021 <gallery type="123" summary="345">
21022 File:File:Foobar.jpg
21023 </gallery>
21024 !! html/php
21025 <ul class="gallery mw-gallery-traditional" type="123">
21026 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21027 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
21028 <div class="gallerytext">
21029 </div>
21030 </div></li>
21031 </ul>
21032 !! html/parsoid
21033 <ul class="gallery mw-gallery-traditional" type="123" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"type":"123","summary":"345"},"body":{}}'>
21034 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/File:Foobar.jpg"><span resource="./File:File:Foobar.jpg" data-width="120" data-height="120">File:File:Foobar.jpg</span></a></figure-inline></div><div class="gallerytext"></div></li>
21035 </ul>
21036 !! end
21037
21038 ## Parsoid thinks the "centre" here is a property, not a caption.
21039 !! test
21040 Gallery
21041 !! options
21042 parsoid={
21043 "modes": ["wt2html"]
21044 }
21045 !! wikitext
21046 <gallery>
21047 image1.png |
21048 image2.gif|||||
21049
21050 image3|
21051 image4 |300px| centre
21052 image5.svg| http://///////
21053 [[x|xx]]]]
21054 * image6
21055 </gallery>
21056 !! html/php
21057 <ul class="gallery mw-gallery-traditional">
21058 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21059 <div class="thumb" style="height: 150px;">Image1.png</div>
21060 <div class="gallerytext">
21061 </div>
21062 </div></li>
21063 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21064 <div class="thumb" style="height: 150px;">Image2.gif</div>
21065 <div class="gallerytext">
21066 </div>
21067 </div></li>
21068 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21069 <div class="thumb" style="height: 150px;">Image3</div>
21070 <div class="gallerytext">
21071 </div>
21072 </div></li>
21073 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21074 <div class="thumb" style="height: 150px;">Image4</div>
21075 <div class="gallerytext">
21076 <pre>centre
21077 </pre>
21078 </div>
21079 </div></li>
21080 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21081 <div class="thumb" style="height: 150px;">Image5.svg</div>
21082 <div class="gallerytext">
21083 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
21084 </p>
21085 </div>
21086 </div></li>
21087 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21088 <div class="thumb" style="height: 150px;">* image6</div>
21089 <div class="gallerytext">
21090 </div>
21091 </div></li>
21092 </ul>
21093 !! html/parsoid
21094 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21095 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Image1.png"><span resource="./File:Image1.png" data-width="120" data-height="120">File:Image1.png</span></a></figure-inline></div><div class="gallerytext"></div></li>
21096 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Image2.gif"><span resource="./File:Image2.gif" data-width="120" data-height="120">File:Image2.gif</span></a></figure-inline></div><div class="gallerytext"></div></li>
21097 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Image3"><span resource="./File:Image3" data-width="120" data-height="120">File:Image3</span></a></figure-inline></div><div class="gallerytext"></div></li>
21098 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Image4"><span resource="./File:Image4" data-width="300">File:Image4</span></a></figure-inline></div><div class="gallerytext"></div></li>
21099 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Image5.svg"><span resource="./File:Image5.svg" data-width="120" data-height="120">File:Image5.svg</span></a></figure-inline></div><div class="gallerytext"> <a rel="mw:ExtLink" class="external free" href="http://///////">http://///////</a></div></li>
21100 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/*_image6"><span resource="./File:*_image6" data-width="120" data-height="120">File:* image6</span></a></figure-inline></div><div class="gallerytext"></div></li>
21101 </ul>
21102 !! end
21103
21104 !! test
21105 Gallery (with options, html)
21106 !! options
21107 parsoid={
21108 "modes": ["wt2html", "html2html"]
21109 }
21110 !! wikitext
21111 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
21112 File:Nonexistent.jpg|caption
21113 File:Nonexistent.jpg
21114 image:foobar.jpg|some '''caption''' [[Main Page]]
21115 image:foobar.jpg
21116 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
21117 </gallery>
21118 !! html/php
21119 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
21120 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
21121 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21122 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21123 <div class="gallerytext">
21124 <p>caption
21125 </p>
21126 </div>
21127 </div></li>
21128 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21129 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21130 <div class="gallerytext">
21131 </div>
21132 </div></li>
21133 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21134 <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>
21135 <div class="gallerytext">
21136 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21137 </p>
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="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>
21142 <div class="gallerytext">
21143 </div>
21144 </div></li>
21145 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21146 <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>
21147 <div class="gallerytext">
21148 <p>blabla.
21149 </p>
21150 </div>
21151 </div></li>
21152 </ul>
21153 !! html/parsoid
21154 <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":{}}'>
21155 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
21156 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent.jpg"><span resource="./File:Nonexistent.jpg" data-width="70" data-height="40">File:Nonexistent.jpg</span></a></figure-inline></div><div class="gallerytext">caption</div></li>
21157 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent.jpg"><span resource="./File:Nonexistent.jpg" data-width="70" data-height="40">File:Nonexistent.jpg</span></a></figure-inline></div><div class="gallerytext"></div></li>
21158 <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>
21159 <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>
21160 <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>
21161 </ul>
21162 !! end
21163
21164 ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
21165 ## are no longer in storage.
21166 !! test
21167 Gallery (with options, extsrc)
21168 !! options
21169 parsoid=html2wt
21170 !! wikitext
21171 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
21172 File:Nonexistent.jpg|caption
21173 File:Nonexistent.jpg
21174 image:foobar.jpg|some '''caption''' [[Main Page]]
21175 image:foobar.jpg
21176 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
21177 </gallery>
21178 !! html/php
21179 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
21180 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
21181 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21182 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21183 <div class="gallerytext">
21184 <p>caption
21185 </p>
21186 </div>
21187 </div></li>
21188 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21189 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21190 <div class="gallerytext">
21191 </div>
21192 </div></li>
21193 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21194 <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>
21195 <div class="gallerytext">
21196 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21197 </p>
21198 </div>
21199 </div></li>
21200 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21201 <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>
21202 <div class="gallerytext">
21203 </div>
21204 </div></li>
21205 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21206 <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>
21207 <div class="gallerytext">
21208 <p>blabla.
21209 </p>
21210 </div>
21211 </div></li>
21212 </ul>
21213 !! html/parsoid
21214 <ul class="gallery mw-gallery-traditional" style="max-width: 226px; _width: 226px;" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"widths":"70px","heights":"40px","perrow":"2","caption":"Foo [[Main Page]]"},"body":{"extsrc":"\nFile:Nonexistent.jpg|caption\nFile:Nonexistent.jpg\nimage:foobar.jpg|some &apos;&apos;&apos;caption&apos;&apos;&apos; [[Main Page]]\nimage:foobar.jpg\nimage:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.\n"}}'>
21215 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
21216 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent.jpg"><span resource="./File:Nonexistent.jpg" data-width="70" data-height="40">File:Nonexistent.jpg</span></a></figure-inline></div><div class="gallerytext">caption</div></li>
21217 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent.jpg"><span resource="./File:Nonexistent.jpg" data-width="70" data-height="40">File:Nonexistent.jpg</span></a></figure-inline></div><div class="gallerytext"></div></li>
21218 <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>
21219 <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>
21220 <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>
21221 </ul>
21222 !! end
21223
21224 !! test
21225 Gallery (without px units)
21226 !! wikitext
21227 <gallery widths="70" heights="40">
21228 File:Foobar.jpg
21229 </gallery>
21230 !! html/php
21231 <ul class="gallery mw-gallery-traditional">
21232 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21233 <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>
21234 <div class="gallerytext">
21235 </div>
21236 </div></li>
21237 </ul>
21238 !! html/parsoid
21239 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70","heights":"40"},"body":{}}'>
21240 <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>
21241 </ul>
21242 !! end
21243
21244 !! test
21245 Gallery (with invalid units)
21246 !! wikitext
21247 <gallery widths="70em" heights="40em">
21248 File:Foobar.jpg
21249 </gallery>
21250 !! html/php
21251 <ul class="gallery mw-gallery-traditional">
21252 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21253 <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>
21254 <div class="gallerytext">
21255 </div>
21256 </div></li>
21257 </ul>
21258 !! html/parsoid
21259 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70em","heights":"40em"},"body":{}}'>
21260 <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>
21261 </ul>
21262 !! end
21263
21264 !! test
21265 Gallery with link that has fragment
21266 !! options
21267 parsoid={
21268 "modes": ["wt2html", "html2html"]
21269 }
21270 !! wikitext
21271 <gallery>
21272 image:foobar.jpg|link=Main_Page
21273 image:foobar.jpg|link=Main_Page#section
21274 image:foobar.jpg|link=Main Page#section|caption
21275 </gallery>
21276 !! html/php
21277 <ul class="gallery mw-gallery-traditional">
21278 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21279 <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>
21280 <div class="gallerytext">
21281 </div>
21282 </div></li>
21283 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21284 <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>
21285 <div class="gallerytext">
21286 </div>
21287 </div></li>
21288 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21289 <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>
21290 <div class="gallerytext">
21291 <p>caption
21292 </p>
21293 </div>
21294 </div></li>
21295 </ul>
21296 !! html/parsoid
21297 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21298 <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>
21299 <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>
21300 <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>
21301 </ul>
21302 !! end
21303
21304 !! test
21305 Gallery with template inside caption
21306 !! wikitext
21307 <gallery caption="{{echo|hi}}">
21308 File:Foobar.jpg|{{echo|ho}}
21309 </gallery>
21310 !! html/php
21311 <ul class="gallery mw-gallery-traditional">
21312 <li class='gallerycaption'>hi</li>
21313 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21314 <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>
21315 <div class="gallerytext">
21316 <p>ho
21317 </p>
21318 </div>
21319 </div></li>
21320 </ul>
21321 !! html/parsoid
21322 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21323 <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>
21324 <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>
21325 </ul>
21326 !! end
21327
21328 !! test
21329 Gallery with wikitext inside gallery caption
21330 !! options
21331 parsoid={
21332 "modes": ["wt2html", "html2html"]
21333 }
21334 !! wikitext
21335 <gallery caption="# This should not be a list item
21336
21337 Text '''bold''' [[link]] {{ns:-1}}
21338
21339 [[File:Foobar.jpg|thumb|File in gallery caption]]">
21340 File:Foobar.jpg|Image caption
21341 </gallery>
21342 !! html/php
21343 <ul class="gallery mw-gallery-traditional">
21344 <li class='gallerycaption'># This should not be a list item Text <b>bold</b> <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">link</a> Special <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" decoding="async" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>File in gallery caption</div></div></div></li>
21345 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21346 <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>
21347 <div class="gallerytext">
21348 <p>Image caption
21349 </p>
21350 </div>
21351 </div></li>
21352 </ul>
21353 !! html/parsoid
21354 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21355 <li class="gallerycaption"># This should not be a list item Text <b>bold</b> <a rel="mw:WikiLink" href="./Link" title="Link">link</a> <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ns:-1","function":"ns"},"params":{},"i":0}}]}'>-1</span> <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>File in gallery caption</figcaption></figure></li>
21356 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">Image caption</div></li>
21357 </ul>
21358 !! end
21359
21360 !! test
21361 Gallery with wikitext inside caption
21362 !! wikitext
21363 <gallery>
21364 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
21365 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
21366 </gallery>
21367 !! html/php
21368 <ul class="gallery mw-gallery-traditional">
21369 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21370 <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>
21371 <div class="gallerytext">
21372 <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>
21373 </p>
21374 </div>
21375 </div></li>
21376 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21377 <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>
21378 <div class="gallerytext">
21379 <p>This is a test template
21380 </p>
21381 </div>
21382 </div></li>
21383 </ul>
21384 !! html/parsoid
21385 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21386 <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>
21387 <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>
21388 </ul>
21389 !! end
21390
21391 !! test
21392 Gallery (with showfilename option)
21393 !! wikitext
21394 <gallery showfilename="">
21395 File:Nonexistent.jpg|caption
21396 File:Nonexistent.jpg
21397 File:Foobar.jpg|some '''caption''' [[Main Page]]
21398 File:Foobar.jpg
21399 </gallery>
21400 !! html/php
21401 <ul class="gallery mw-gallery-traditional">
21402 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21403 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21404 <div class="gallerytext">
21405 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21406 caption
21407 </p>
21408 </div>
21409 </div></li>
21410 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21411 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21412 <div class="gallerytext">
21413 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21414 </p>
21415 </div>
21416 </div></li>
21417 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21418 <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>
21419 <div class="gallerytext">
21420 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21421 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21422 </p>
21423 </div>
21424 </div></li>
21425 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21426 <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>
21427 <div class="gallerytext">
21428 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21429 </p>
21430 </div>
21431 </div></li>
21432 </ul>
21433 !! html/parsoid
21434 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
21435 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent.jpg"><span resource="./File:Nonexistent.jpg" data-width="120" data-height="120">File:Nonexistent.jpg</span></a></figure-inline></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a>caption</div></li>
21436 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent.jpg"><span resource="./File:Nonexistent.jpg" data-width="120" data-height="120">File:Nonexistent.jpg</span></a></figure-inline></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a></div></li>
21437 <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>
21438 <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>
21439 </ul>
21440 !! end
21441
21442 ## Should Parsoid be preserving these variations? See T151367
21443 !! test
21444 Gallery (with namespace-less filenames)
21445 !! options
21446 parsoid={
21447 "modes": ["wt2html", "html2html"]
21448 }
21449 !! wikitext
21450 <gallery>
21451 File:Nonexistent.jpg
21452 Nonexistent.jpg
21453 image:foobar.jpg
21454 foobar.jpg
21455 </gallery>
21456 !! html/php
21457 <ul class="gallery mw-gallery-traditional">
21458 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21459 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21460 <div class="gallerytext">
21461 </div>
21462 </div></li>
21463 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21464 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21465 <div class="gallerytext">
21466 </div>
21467 </div></li>
21468 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21469 <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>
21470 <div class="gallerytext">
21471 </div>
21472 </div></li>
21473 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21474 <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>
21475 <div class="gallerytext">
21476 </div>
21477 </div></li>
21478 </ul>
21479 !! html/parsoid
21480 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21481 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent.jpg"><span resource="./File:Nonexistent.jpg" data-width="120" data-height="120">File:Nonexistent.jpg</span></a></figure-inline></div><div class="gallerytext"></div></li>
21482 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent.jpg"><span resource="./File:Nonexistent.jpg" data-width="120" data-height="120">File:Nonexistent.jpg</span></a></figure-inline></div><div class="gallerytext"></div></li>
21483 <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>
21484 <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>
21485 </ul>
21486 !! end
21487
21488 !! test
21489 Gallery override link with wikilink (T36852)
21490 !! wikitext
21491 <gallery>
21492 File:Foobar.jpg|alt=galleryalt|link=Wikilink
21493 </gallery>
21494 !! html/php
21495 <ul class="gallery mw-gallery-traditional">
21496 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21497 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
21498 <div class="gallerytext">
21499 </div>
21500 </div></li>
21501 </ul>
21502 !! html/parsoid
21503 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21504 <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>
21505 </ul>
21506 !! end
21507
21508 !! test
21509 Gallery override link with absolute external link (T36852)
21510 !! wikitext
21511 <gallery>
21512 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
21513 </gallery>
21514 !! html/php
21515 <ul class="gallery mw-gallery-traditional">
21516 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21517 <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>
21518 <div class="gallerytext">
21519 </div>
21520 </div></li>
21521 </ul>
21522 !! html/parsoid
21523 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21524 <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>
21525 </ul>
21526 !! end
21527
21528 ## Putting the caption at the end here runs into T49646 on the php side
21529 ## so reducing the modes this runs in Parsoid
21530 !! test
21531 Gallery override link with absolute external link with LanguageConverter
21532 !! options
21533 language=zh
21534 parsoid=wt2html,html2html
21535 !! wikitext
21536 <gallery>
21537 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21538 </gallery>
21539 !! html/php
21540 <ul class="gallery mw-gallery-traditional">
21541 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21542 <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>
21543 <div class="gallerytext">
21544 <p>caption
21545 </p>
21546 </div>
21547 </div></li>
21548 </ul>
21549 !! html/parsoid
21550 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21551 <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>
21552 </ul>
21553 !! end
21554
21555 !! test
21556 Gallery override link with malicious javascript (T36852)
21557 !! options
21558 parsoid={
21559 "modes": ["wt2html", "html2html"]
21560 }
21561 !! wikitext
21562 <gallery>
21563 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21564 </gallery>
21565 !! html/php
21566 <ul class="gallery mw-gallery-traditional">
21567 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21568 <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>
21569 <div class="gallerytext">
21570 </div>
21571 </div></li>
21572 </ul>
21573 !! html/parsoid
21574 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21575 <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>
21576 </ul>
21577 !! end
21578
21579 !! test
21580 Gallery with invalid title as link (T45964)
21581 !! options
21582 parsoid={
21583 "modes": ["wt2html", "html2html"]
21584 }
21585 !! wikitext
21586 <gallery>
21587 File:Foobar.jpg|link=<
21588 </gallery>
21589 !! html/php
21590 <ul class="gallery mw-gallery-traditional">
21591 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21592 <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>
21593 <div class="gallerytext">
21594 </div>
21595 </div></li>
21596 </ul>
21597 !! html/parsoid
21598 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21599 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image" data-mw='{"attribs":[["link",{"txt":"&lt;"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21600 </ul>
21601 !! end
21602
21603 !! test
21604 Serialize gallery without attrs in data-mw
21605 !! options
21606 parsoid={
21607 "modes": ["html2wt"]
21608 }
21609 !! html/parsoid
21610 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
21611 <li class="gallerycaption">123</li>
21612 <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>
21613 </ul>
21614 !! wikitext
21615 <gallery caption="123">
21616 File:Test.png
21617 </gallery>
21618 !! end
21619
21620 !! test
21621 Gallery with class and style attributes
21622 !! wikitext
21623 <gallery class="center" style="text-align: center;">
21624 File:Foobar.jpg
21625 </gallery>
21626 !! html/php
21627 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
21628 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21629 <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>
21630 <div class="gallerytext">
21631 </div>
21632 </div></li>
21633 </ul>
21634 !! html/parsoid
21635 <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":{}}'>
21636 <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>
21637 </ul>
21638 !! end
21639
21640 !! test
21641 Gallery in slideshow mode
21642 !! wikitext
21643 <gallery mode="slideshow" showthumbnails="">
21644 File:Foobar.jpg
21645 </gallery>
21646 !! html/php
21647 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
21648 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21649 <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>
21650 <div class="gallerytext">
21651 </div>
21652 </div></li>
21653 </ul>
21654 !! html/parsoid
21655 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
21656 <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>
21657 </ul>
21658 !! end
21659
21660 !! test
21661 Gallery in packed mode
21662 !! wikitext
21663 <gallery mode="packed">
21664 File:Foobar.jpg
21665 </gallery>
21666 !! html/php
21667 <ul class="gallery mw-gallery-packed">
21668 <li class="gallerybox" style="width: 1061.3333333333px"><div style="width: 1061.3333333333px">
21669 <div class="thumb" style="width: 1059.3333333333px;"><div style="margin:0px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1589px-Foobar.jpg" decoding="async" width="1060" height="120" srcset="http://example.com/images/3/3a/Foobar.jpg 1.5x" /></a></div></div>
21670 <div class="gallerytext">
21671 </div>
21672 </div></li>
21673 </ul>
21674 !! html/parsoid
21675 <ul class="gallery mw-gallery-packed" typeof="mw:Extension/gallery" about="#mwt3" data-parsoid='{"dsr":[0,50,23,10]}' data-mw='{"name":"gallery","attrs":{"mode":"packed"},"body":{}}'>
21676 <li class="gallerybox" style="width: 1061px;"><div class="thumb" style="width: 1059px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1589px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="120" width="1059"/></a></figure-inline></div><div class="gallerytext"></div></li>
21677 </ul>
21678 !! end
21679
21680 !! test
21681 Serialize gallery image captions on a line
21682 !! options
21683 parsoid={
21684 "modes": ["html2wt"]
21685 }
21686 !! html/parsoid
21687 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21688 <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>
21689 <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>
21690 </ul>
21691 !! wikitext
21692 <gallery>
21693 File:Foobar.jpg| hi ho
21694 File:Foobar.jpg|hi<br />ho
21695 </gallery>
21696 !! end
21697
21698 !! test
21699 HTML Hex character encoding (spells the word "JavaScript")
21700 !! options
21701 parsoid=wt2html,wt2wt,html2html
21702 !! wikitext
21703 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
21704 !! html/php
21705 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
21706 </p>
21707 !! html/parsoid
21708 <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>
21709 !! end
21710
21711 !! test
21712 HTML Hex character encoding bogus encoding (T28437 regression check)
21713 !! wikitext
21714 &#xsee;&#XSEE;
21715 !! html
21716 <p>&amp;#xsee;&amp;#XSEE;
21717 </p>
21718 !! end
21719
21720 !! test
21721 HTML Hex character encoding mixed case
21722 !! options
21723 parsoid=wt2html,wt2wt,html2html
21724 !! wikitext
21725 &#xEE;&#Xee;
21726 !! html/php
21727 <p>&#xee;&#xee;
21728 </p>
21729 !! html/parsoid
21730 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
21731 !! end
21732
21733 # See: https://www.w3.org/TR/html5/syntax.html#character-references
21734 # Note that U+000C (form feed) is not a valid XML character, so
21735 # it is banned even though allowed in HTML5.
21736 !! test
21737 Illegal character references (T106578)
21738 !! wikitext
21739 ; Null: &#00;
21740 ; FF: &#xC;
21741 ; CR: &#xD;
21742 ; Control (low): &#8;
21743 ; Control (high): &#x7F; &#x9F;
21744 ; Surrogate: &#xD83D;&#xDCA9;
21745 ; This is an okay astral character: &#x1F4A9;
21746 !! html+tidy
21747 <dl><dt>Null</dt>
21748 <dd>&amp;#00;</dd>
21749 <dt>FF</dt>
21750 <dd>&amp;#xC;</dd>
21751 <dt>CR</dt>
21752 <dd>&amp;#xD;</dd>
21753 <dt>Control (low)</dt>
21754 <dd>&amp;#8;</dd>
21755 <dt>Control (high)</dt>
21756 <dd>&amp;#x7F; &amp;#x9F;</dd>
21757 <dt>Surrogate</dt>
21758 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
21759 <dt>This is an okay astral character</dt>
21760 <dd>&#x1f4a9;</dd></dl>
21761 !! end
21762
21763 !! test
21764 __FORCETOC__ override
21765 !! wikitext
21766 __NEWSECTIONLINK__
21767 __FORCETOC__
21768 !! html/php
21769 <p><br />
21770 </p>
21771 !! end
21772
21773 !! test
21774 ISBN code coverage
21775 !! wikitext
21776 ISBN 978-0-1234-56&#x20;789
21777 !! html/php
21778 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21779 </p>
21780 !! html/parsoid
21781 <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>
21782 !! end
21783
21784 !! test
21785 ISBN followed by 5 spaces
21786 !! wikitext
21787 ISBN
21788 !! html
21789 <p>ISBN
21790 </p>
21791 !! end
21792
21793 !! test
21794 Double ISBN
21795 !! wikitext
21796 ISBN ISBN 1234567890
21797 !! html/php
21798 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21799 </p>
21800 !! html/parsoid
21801 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21802 !! end
21803
21804 # Uppercase X and lowercase x as well
21805 !! test
21806 ISBN with an X
21807 !! wikitext
21808 ISBN 3-462-04561-X
21809 ISBN 3-462-04561-x
21810 ISBN 080442957X
21811 ISBN 080442957x
21812 ISBN 978080442957X
21813 ISBN 978080442957x
21814 !! html/php
21815 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21816 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21817 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21818 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21819 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21820 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21821 </p>
21822 !! html/parsoid
21823 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21824 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21825 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21826 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21827 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21828 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21829 !! end
21830
21831 !! test
21832 ISBN with empty prefix (parsoid test)
21833 !! wikitext
21834 ISBN 1234567890
21835 !! html/php
21836 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21837 </p>
21838 !! html/parsoid
21839 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21840 !! end
21841
21842 !! test
21843 T24905: <abbr> followed by ISBN followed by </a>
21844 !! wikitext
21845 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21846 !! html/php
21847 <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>
21848 </p>
21849 !! html/parsoid
21850 <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>
21851 !! end
21852
21853 !! test
21854 Double RFC
21855 !! wikitext
21856 RFC RFC 1234
21857 !! html/php
21858 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21859 </p>
21860 !! html/parsoid
21861 <p>RFC <a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
21862 !! end
21863
21864 !! test
21865 Double RFC with a wiki link
21866 !! wikitext
21867 RFC [[RFC 1234]]
21868 !! html/php
21869 <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>
21870 </p>
21871 !! html/parsoid
21872 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234" title="RFC 1234">RFC 1234</a></p>
21873 !! end
21874
21875 !! test
21876 RFC code coverage
21877 !! wikitext
21878 RFC 983&#x20;987
21879 !! html/php
21880 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21881 </p>
21882 !! html/parsoid
21883 <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>
21884 !! end
21885
21886 !! test
21887 Centre-aligned image
21888 !! wikitext
21889 [[Image:foobar.jpg|centre]]
21890 !! html/php
21891 <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>
21892 !! html/parsoid
21893 <figure class="mw-default-size mw-halign-center" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"center","ak":"centre"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:foobar.jpg"}}'/></a><figcaption></figcaption></figure>
21894 !! end
21895
21896 !! test
21897 None-aligned image
21898 !! wikitext
21899 [[Image:foobar.jpg|none]]
21900 !! html/php
21901 <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>
21902 !! html/parsoid
21903 <figure class="mw-default-size mw-halign-none" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:foobar.jpg"}}'/></a><figcaption></figcaption></figure>
21904 !! end
21905
21906 !! test
21907 Width + Height sized image (using px) (height is ignored)
21908 !! wikitext
21909 [[Image:foobar.jpg|640x480px]]
21910 !! html/php
21911 <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>
21912 </p>
21913 !! html/parsoid
21914 <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>
21915 !! end
21916
21917 !! test
21918 Width-sized image (using px, no following whitespace)
21919 !! wikitext
21920 [[Image:foobar.jpg|640px]]
21921 !! html/php
21922 <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>
21923 </p>
21924 !! html/parsoid
21925 <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>
21926 !! end
21927
21928 !! test
21929 Width-sized image (using px, with following whitespace - test regression from r39467)
21930 !! wikitext
21931 [[Image:foobar.jpg|640px ]]
21932 !! html/php
21933 <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>
21934 </p>
21935 !! html/parsoid
21936 <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>
21937 !!end
21938
21939 !! test
21940 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21941 !! wikitext
21942 [[Image:foobar.jpg| 640px]]
21943 !! html/php
21944 <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>
21945 </p>
21946 !! html/parsoid
21947 <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>
21948 !! end
21949
21950 ## FIXME: Parsoid mocking should include the page in the url to catch regressions
21951 !! test
21952 Image with page parameter
21953 !! options
21954 djvu
21955 !! wikitext
21956 [[File:LoremIpsum.djvu|page=2]]
21957 !! html/php
21958 <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>
21959 </p>
21960 !! html/parsoid
21961 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"attribs":[["page",{"txt":"2"}]]}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{"href":"File:LoremIpsum.djvu"}}'><img resource="./File:LoremIpsum.djvu" src="//example.com/images/5/5f/LoremIpsum.djvu" data-file-width="2480" data-file-height="3508" data-file-type="bitmap" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></figure-inline></p>
21962 !! end
21963
21964 !! test
21965 Another italics / bold test
21966 !! wikitext
21967 ''' ''x'
21968 !! html
21969 <pre>'<i> </i>x'
21970 </pre>
21971 !!end
21972
21973 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21974 !! test
21975 dt/dd/dl test
21976 !! wikitext
21977 :;;;::
21978 !! html/php
21979 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21980 !! html/parsoid
21981 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21982 !! end
21983
21984 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21985 !! test
21986 Images with the "|" character in the comment
21987 !! wikitext
21988 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21989 !! html/php
21990 <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>
21991 !! html/parsoid
21992 <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>
21993 !! end
21994
21995 !! test
21996 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21997 !! wikitext
21998 <html><script>alert(1);</script></html>
21999 !! html
22000 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
22001 </p>
22002 !! end
22003
22004 !! test
22005 HTML with raw HTML ($wgRawHtml==true)
22006 !! options
22007 wgRawHtml=1
22008 !! wikitext
22009 <html><script>alert(1);</script></html>
22010 !! html/php
22011 <p><script>alert(1);</script>
22012 </p>
22013 !! html/parsoid
22014 <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>
22015 !! end
22016
22017 !! test
22018 Parents of subpages, one level up
22019 !! options
22020 subpage title=[[Subpage test/L1/L2/L3]]
22021 !! wikitext
22022 [[../|L2]]
22023 !! html
22024 <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>
22025 </p>
22026 !! end
22027
22028
22029 !! test
22030 Parents of subpages, one level up, not named
22031 !! options
22032 subpage title=[[Subpage test/L1/L2/L3]]
22033 !! wikitext
22034 [[../]]
22035 !! html
22036 <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>
22037 </p>
22038 !! end
22039
22040
22041
22042 !! test
22043 Parents of subpages, two levels up
22044 !! options
22045 subpage title=[[Subpage test/L1/L2/L3]]
22046 !! wikitext
22047 [[../../|L1]]2
22048
22049 [[../../|L1]]l
22050 !! html
22051 <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
22052 </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>
22053 </p>
22054 !! end
22055
22056 !! test
22057 Parents of subpages, two levels up, without trailing slash or name.
22058 !! options
22059 subpage title=[[Subpage test/L1/L2/L3]]
22060 !! wikitext
22061 [[../..]]
22062 !! html
22063 <p>[[../..]]
22064 </p>
22065 !! end
22066
22067 !! test
22068 Parents of subpages, two levels up, with lots of extra trailing slashes.
22069 !! options
22070 subpage title=[[Subpage test/L1/L2/L3]]
22071 !! wikitext
22072 [[../../////]]
22073 !! html
22074 <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>
22075 </p>
22076 !! end
22077
22078 !! article
22079 Subpage test/L1/L2/L3Sibling
22080 !! text
22081 Sibling article
22082 !! endarticle
22083
22084 !! test
22085 Transclusion of a sibling page (one level up)
22086 !! options
22087 subpage title=[[Subpage test/L1/L2/L3]]
22088 !! wikitext
22089 {{../L3Sibling}}
22090 !! html
22091 <p>Sibling article
22092 </p>
22093 !! end
22094
22095 !! test
22096 Transclusion of a child page
22097 !! options
22098 subpage title=[[Subpage test/L1/L2]]
22099 !! wikitext
22100 {{/L3Sibling}}
22101 !! html
22102 <p>Sibling article
22103 </p>
22104 !! end
22105
22106 # This is wt2html only in Parsoid because we add <nowiki>
22107 # because of {{..}} and we don't expect to fix that to
22108 # eliminate the nowikis selective for {{..}} markup.
22109 !! test
22110 Non-transclusion because of too many up levels
22111 !! options
22112 subpage title=[[Subpage test/L1/L2/L3]]
22113 parsoid=wt2html
22114 !! wikitext
22115 {{../../../../More than parent}}
22116 !! html/php
22117 <p>{{../../../../More than parent}}
22118 </p>
22119 !! html/parsoid
22120 <p>{{../../../../More than parent}}</p>
22121 !! end
22122
22123 !! test
22124 Definition list code coverage
22125 !! wikitext
22126 ;title :def
22127 ;title :def
22128 ;title:def
22129 !! html/php
22130 <dl><dt>title</dt>
22131 <dd>def</dd>
22132 <dt>title</dt>
22133 <dd>def</dd>
22134 <dt>title</dt>
22135 <dd>def</dd></dl>
22136 !! html/parsoid
22137 <dl><dt>title </dt><dd>def</dd>
22138 <dt>title </dt><dd>def</dd>
22139 <dt>title</dt><dd>def</dd></dl>
22140 !! end
22141
22142 !! test
22143 Don't fall for the self-closing div
22144 !! wikitext
22145 <div>hello world</div/>
22146 !! html
22147 <div>hello world</div>
22148 !! end
22149
22150 !! test
22151 MSGNW magic word
22152 !! wikitext
22153 {{MSGNW:msg}}
22154 !! html/php
22155 <p>&#91;&#91;:Template:Msg&#93;&#93;
22156 </p>
22157 !! end
22158
22159 !! test
22160 RAW magic word
22161 !! wikitext
22162 {{RAW:QUERTY}}
22163 !! html
22164 <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>
22165 </p>
22166 !! end
22167
22168 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
22169 !! test
22170 Always escape literal '>' in output, not just after '<'
22171 !! wikitext
22172 ><>
22173 !! html
22174 <p>&gt;&lt;&gt;
22175 </p>
22176 !! end
22177
22178 !! test
22179 Template caching
22180 !! wikitext
22181 {{Test}}
22182 {{Test}}
22183 !! html
22184 <p>This is a test template
22185 This is a test template
22186 </p>
22187 !! end
22188
22189
22190 !! article
22191 MediaWiki:Fake
22192 !! text
22193 ==header==
22194 !! endarticle
22195
22196 !! test
22197 Inclusion of !userCanEdit() content
22198 !! wikitext
22199 {{MediaWiki:Fake}}
22200 !! html
22201 <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>
22202 !! end
22203
22204
22205 !! test
22206 Out-of-order TOC heading levels
22207 !! wikitext
22208 ==2==
22209 ======6======
22210 ===3===
22211 =1=
22212 =====5=====
22213 ==2==
22214 !! html
22215 <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>
22216 <ul>
22217 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
22218 <ul>
22219 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
22220 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
22221 </ul>
22222 </li>
22223 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
22224 <ul>
22225 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
22226 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
22227 </ul>
22228 </li>
22229 </ul>
22230 </div>
22231
22232 <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>
22233 <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>
22234 <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>
22235 <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>
22236 <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>
22237 <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>
22238 !! end
22239
22240
22241 !! test
22242 ISBN with a dummy number
22243 !! wikitext
22244 ISBN ---
22245 !! html
22246 <p>ISBN ---
22247 </p>
22248 !! end
22249
22250
22251 !! test
22252 ISBN with space-delimited number
22253 !! wikitext
22254 ISBN 92 9017 032 8
22255 !! html/php
22256 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
22257 </p>
22258 !! html/parsoid
22259 <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>
22260 !! end
22261
22262
22263 !! test
22264 ISBN with multiple spaces, no number
22265 !! wikitext
22266 ISBN foo
22267 !! html
22268 <p>ISBN foo
22269 </p>
22270 !! end
22271
22272
22273 !! test
22274 ISBN length
22275 !! wikitext
22276 ISBN 123456789
22277
22278 ISBN 1234567890
22279
22280 ISBN 12345678901
22281 !! html/php
22282 <p>ISBN 123456789
22283 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22284 </p><p>ISBN 12345678901
22285 </p>
22286 !! html/parsoid
22287 <p>ISBN 123456789</p>
22288
22289 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
22290
22291 <p>ISBN 12345678901</p>
22292 !! end
22293
22294
22295 !! test
22296 ISBN with trailing year (T9110)
22297 !! wikitext
22298 ISBN 1-234-56789-0 - 2006
22299
22300 ISBN 1 234 56789 0 - 2006
22301 !! html/php
22302 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
22303 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
22304 </p>
22305 !! html/parsoid
22306 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
22307
22308 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
22309 !! end
22310
22311
22312 !! test
22313 anchorencode
22314 !! config
22315 wgFragmentMode=[ 'html5', 'legacy' ]
22316 !! wikitext
22317 {{anchorencode:foo bar©#%n}}
22318 !! html/php
22319 <p>foo_bar©#%n
22320 </p>
22321 !! html/parsoid
22322 <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>
22323 !! end
22324
22325 !! test
22326 anchorencode (legacy)
22327 !! config
22328 wgFragmentMode=[ 'legacy' ]
22329 !! wikitext
22330 {{anchorencode:foo bar©#%n}}
22331 !! html/php
22332 <p>foo_bar.C2.A9.23.25n
22333 </p>
22334 !! end
22335
22336 !! test
22337 anchorencode trims spaces
22338 !! config
22339 wgFragmentMode=[ 'html5', 'legacy' ]
22340 !! wikitext
22341 {{anchorencode: __pretty__please__}}
22342 !! html/php
22343 <p>pretty_please
22344 </p>
22345 !! html/parsoid
22346 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
22347 !! end
22348
22349 !! test
22350 anchorencode deals with links
22351 !! config
22352 wgFragmentMode=[ 'html5', 'legacy' ]
22353 !! wikitext
22354 {{anchorencode: [[hello|world]] [[hi]]}}
22355 !! html/php
22356 <p>world_hi
22357 </p>
22358 !! html/parsoid
22359 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
22360 !! end
22361
22362 !! test
22363 anchorencode deals with templates
22364 !! config
22365 wgFragmentMode=[ 'html5', 'legacy' ]
22366 !! wikitext
22367 {{anchorencode: {{Foo}} x}}
22368 !! html/php
22369 <p>FOO_x
22370 </p>
22371 !! html/parsoid
22372 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
22373 !! end
22374
22375 !! test
22376 anchorencode encodes like the TOC generator: (T20431)
22377 !! config
22378 wgFragmentMode=[ 'html5', 'legacy' ]
22379 !! wikitext
22380 ===_ +:.3A%3A _ &&amp;]] x===
22381 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
22382 __NOEDITSECTION__
22383 !! html/php
22384 <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>
22385 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
22386 </p>
22387 !! html/parsoid
22388 <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>
22389 <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>
22390 <meta property="mw:PageProp/noeditsection"/>
22391 !! end
22392
22393 !! test
22394 anchorencode encodes like the TOC generator: (T20431) (legacy)
22395 !! config
22396 wgFragmentMode=[ 'legacy' ]
22397 !! wikitext
22398 ===_ +:.3A%3A&&amp;]]===
22399 {{anchorencode: _ +:.3A%3A&&amp;]] }}
22400 __NOEDITSECTION__
22401 !! html/php
22402 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
22403 <p>.2B:.3A.253A.26.26.5D.5D
22404 </p>
22405 !! end
22406
22407 !! test
22408 T8200: blockquotes and paragraph formatting
22409 !! wikitext
22410 <blockquote>
22411 foo
22412 </blockquote>
22413
22414 bar
22415
22416 baz
22417 !! html
22418 <blockquote>
22419 <p>foo
22420 </p>
22421 </blockquote>
22422 <p>bar
22423 </p>
22424 <pre>baz
22425 </pre>
22426 !! end
22427
22428 !! test
22429 T10293: Use of center tag ruins paragraph formatting
22430 !! wikitext
22431 <center>
22432 foo
22433 </center>
22434
22435 bar
22436
22437 baz
22438 !! html
22439 <center>
22440 <p>foo
22441 </p>
22442 </center>
22443 <p>bar
22444 </p>
22445 <pre>baz
22446 </pre>
22447 !! end
22448
22449 !!test
22450 Parsing of overlapping (improperly nested) inline html tags
22451 !! wikitext
22452 <span><s>x</span></s>
22453 !! html/php
22454 <p><span><s>x&lt;/span&gt;</s></span>
22455 </p>
22456 !! html/parsoid
22457 <p><span><s>x</s></span>
22458 </p>
22459 !!end
22460
22461 ###
22462 ### Language variants related tests
22463 ###
22464
22465 # Parsoid does not mark self-links.
22466 # Parsoid does not convert links; PHP will do any necessary redirects.
22467
22468 !! test
22469 Self-link in language variants
22470 !! options
22471 title=[[Dunav]] language=sr
22472 !! wikitext
22473 Both [[Dunav]] and [[Дунав]] are names for this river.
22474 !! html/php
22475 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
22476 </p>
22477 !! html/parsoid
22478 <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>
22479 !! end
22480
22481 !! article
22482 Дуна
22483 !! text
22484 content
22485 !! endarticle
22486
22487 !! test
22488 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
22489 !! options
22490 title=[[Duna]] language=sr
22491 !! wikitext
22492 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
22493 !! html/php
22494 <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.
22495 </p>
22496 !! html/parsoid
22497 <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>
22498 !! end
22499
22500 !! test
22501 Link to a section of a variant of this title shouldn't be parsed as self-link
22502 !! options
22503 title=[[Duna]] language=sr
22504 !! wikitext
22505 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
22506 !! html/php
22507 <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.
22508 </p>
22509 !! html/parsoid
22510 <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>
22511 !! end
22512
22513 !! test
22514 Link to pages in language variants
22515 !! options
22516 language=sr
22517 !! wikitext
22518 Main Page can be written as [[Маин Паге]]
22519 !! html/php
22520 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
22521 </p>
22522 !! html/parsoid
22523 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
22524 !! end
22525
22526
22527 !! test
22528 Multiple links to pages in language variants
22529 !! options
22530 language=sr
22531 !! wikitext
22532 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
22533 !! html/php
22534 <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>.
22535 </p>
22536 !! html/parsoid
22537 <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>
22538 !! end
22539
22540
22541 !! test
22542 Simple template in language variants
22543 !! options
22544 language=sr
22545 !! wikitext
22546 {{тест}}
22547 !! html/php
22548 <p>This is a test template
22549 </p>
22550 !! end
22551
22552
22553 !! test
22554 Template with explicit namespace in language variants
22555 !! options
22556 language=sr
22557 !! wikitext
22558 {{Template:тест}}
22559 !! html/php
22560 <p>This is a test template
22561 </p>
22562 !! end
22563
22564
22565 !! test
22566 Basic test for template parameter in language variants
22567 !! options
22568 language=sr
22569 !! wikitext
22570 {{парамтест|param=foo}}
22571 !! html/php
22572 <p>This is a test template with parameter foo
22573 </p>
22574 !! end
22575
22576 !! test
22577 Simple category in language variants
22578 !! options
22579 language=sr cat
22580 !! wikitext
22581 [[Category:МедиаWики Усер'с Гуиде]]
22582 !! html/php
22583 cat=МедиаWики_Усер'с_Гуиде sort=
22584 !! html/parsoid
22585 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
22586 !! end
22587
22588 !! article
22589 Category:分类
22590 !! text
22591 blah
22592 !! endarticle
22593
22594 !! article
22595 Category:分類
22596 !! text
22597 blah
22598 !! endarticle
22599
22600 ## We used to, but no longer wt2wt this test since the default serializer
22601 ## will normalize all categories to serialize on their own line.
22602 ## This wikitext usage is going to be fairly uncommon in production and
22603 ## selser will take care of preserving formatting in those scenarios.
22604 !! test
22605 Don't convert blue categorylinks to another variant (T35210)
22606 !! options
22607 cat
22608 language=zh
22609 parsoid=wt2html
22610 !! wikitext
22611 [[A]][[Category:分类]]
22612 !! html/php
22613 cat=分类 sort=
22614 !! html/parsoid
22615 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
22616 <link rel="mw:PageProp/Category" href="./Category:分类"/>
22617 !! end
22618
22619 !! test
22620 Stripping -{}- tags (language variants)
22621 !! options
22622 language=sr
22623 !! wikitext
22624 Latin proverb: -{Ne nuntium necare}-
22625 !! html/php
22626 <p>Latin proverb: Ne nuntium necare
22627 </p>
22628 !! html/parsoid
22629 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22630 !! end
22631
22632
22633 !! test
22634 Prevent conversion with -{}- tags (language variants)
22635 !! options
22636 language=sr variant=sr-ec
22637 !! wikitext
22638 Latinski: -{Ne nuntium necare}-
22639 !! html/php
22640 <p>Латински: Ne nuntium necare
22641 </p>
22642 !! html/parsoid
22643 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22644 !! end
22645
22646
22647 !! test
22648 Prevent conversion of text with -{}- tags (language variants)
22649 !! options
22650 language=sr variant=sr-ec
22651 !! wikitext
22652 Latinski: -{Ne nuntium necare}-
22653 !! html/php
22654 <p>Латински: Ne nuntium necare
22655 </p>
22656 !! html/parsoid
22657 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22658 !! end
22659
22660
22661 !! test
22662 Prevent conversion of links with -{}- tags (language variants)
22663 !! options
22664 language=sr variant=sr-ec
22665 !! wikitext
22666 -{[[Main Page]]}-
22667 !! html/php
22668 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22669 </p>
22670 !! html/parsoid
22671 <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>
22672 !! end
22673
22674
22675 !! test
22676 -{}- tags within headlines (within html for parserConvert())
22677 !! config
22678 wgFragmentMode=[ 'html5', 'legacy' ]
22679 !! options
22680 language=sr variant=sr-ec
22681 !! wikitext
22682 ==-{Naslov}-==
22683
22684 Note that even an unprotected headline ID is not affected by language
22685 conversion:
22686
22687 ==Latinski==
22688 !! html/php
22689 <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>
22690 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
22691 цонверсион:
22692 </p>
22693 <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>
22694 !! html/parsoid
22695 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
22696
22697 <p>Note that even an unprotected headline ID is not affected by language
22698 conversion:</p>
22699
22700 <h2 id="Latinski">Latinski</h2>
22701 !! end
22702
22703 !! test
22704 Explicit definition of language variant alternatives
22705 !! options
22706 language=zh variant=zh-tw
22707 !! wikitext
22708 -{zh:China;zh-tw:Taiwan}-, not China
22709 !! html/php
22710 <p>Taiwan, not China
22711 </p>
22712 !! html/parsoid
22713 <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>
22714 !! end
22715
22716 !! test
22717 Explicit definition of language variant alternatives (BCP 47 codes)
22718 !! options
22719 language=zh variant=zh-tw
22720 !! wikitext
22721 -{zh:China;zh-Hant-TW:Taiwan}-, not China
22722 !! html/php
22723 <p>Taiwan, not China
22724 </p>
22725 !! html/parsoid
22726 <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>
22727 !! end
22728
22729 !! test
22730 Filter syntax for language variants
22731 !! options
22732 language=zh variant=zh-tw
22733 !! wikitext
22734 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
22735 !! html/php
22736 <p>fooblog, WEBJOURNAL, WEBLOGquux
22737 </p>
22738 !! html/parsoid
22739 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
22740 !! end
22741
22742 # Note that Parsoid post-processing for language variants needs to
22743 # update the `title` attribute here, based on the mw:ExpandedAttrs property
22744 !! test
22745 Conversion around HTML tags
22746 !! options
22747 language=sr variant=sr-ec
22748 !! wikitext
22749 -{H|span=>sr-ec:script;title=>sr-ec:src}-
22750 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
22751 !! html/php
22752 <p>
22753 <span title="ЛаCтин">ски</span>
22754 </p>
22755 !! html/parsoid
22756 <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"}]}'/>
22757 <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>
22758 !! end
22759
22760 !! test
22761 Explicit session-wise two-way language variant mapping (A flag and - flag)
22762 !! options
22763 language=zh variant=zh-tw
22764 !! wikitext
22765 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
22766
22767 Taiwan is not China.
22768
22769 But -{A|zh:China; zh-tw:Taiwan}- is China,
22770
22771 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
22772
22773 and -{China}- is China.
22774 !! html/php
22775 <p>This is Taiwan, but we'll forget that now.
22776 </p><p>Taiwan is not China.
22777 </p><p>But Taiwan is Taiwan,
22778 </p><p>(This should be stripped!)
22779 </p><p>and China is China.
22780 </p>
22781 !! html/parsoid
22782 <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>
22783 <p>Taiwan is not China.</p>
22784 <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>
22785 <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>
22786 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22787 !! end
22788
22789 !! test
22790 Explicit session-wise one-way language variant mapping (A flag and - flag)
22791 !! options
22792 language=zh variant=zh-tw
22793 !! wikitext
22794 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
22795
22796 COUNTRY is China or Taiwan.
22797
22798 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
22799
22800 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22801
22802 and -{COUNTRY}- is COUNTRY.
22803 !! html/php
22804 <p>This is Taiwan, but we'll forget that now.
22805 </p><p>COUNTRY is China or Taiwan.
22806 </p><p>But Taiwan is Taiwan,
22807 </p><p>(This should be stripped!)
22808 </p><p>and COUNTRY is COUNTRY.
22809 </p>
22810 !! html/parsoid
22811 <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>
22812 <p>COUNTRY is China or Taiwan.</p>
22813 <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>
22814 <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>
22815 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22816 !! end
22817
22818 !! test
22819 Explicit session-wise two-way language variant mapping (H flag for hide)
22820 !! options
22821 language=zh variant=zh-tw
22822 !! wikitext
22823 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22824
22825 Taiwan is China.
22826 !! html/php
22827 <p>(This should be stripped!)
22828 </p><p>Taiwan is Taiwan.
22829 </p>
22830 !! html/parsoid
22831 <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>
22832 <p>Taiwan is China.</p>
22833 !! end
22834
22835 !! test
22836 Explicit session-wise one-way language variant mapping (H flag for hide)
22837 !! options
22838 language=zh variant=zh-tw
22839 !! wikitext
22840 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22841
22842 COUNTRY is Taiwan or China.
22843 !! html/php
22844 <p>(This should be stripped!)
22845 </p><p>Taiwan is Taiwan or China.
22846 </p>
22847 !! html/parsoid
22848 <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>
22849 <p>COUNTRY is Taiwan or China.</p>
22850 !! end
22851
22852 ## Note that parsoid test runner does not support 'showtitle' option.
22853 !! test
22854 Adding explicit conversion rule for title (T flag)
22855 !! options
22856 language=zh variant=zh-tw showtitle
22857 !! wikitext
22858 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22859
22860 Taiwan is China.
22861 !! html/php
22862 Taiwan
22863 <p>Should be stripped!
22864 </p><p>Taiwan is China.
22865 </p>
22866 !! html/parsoid
22867 <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>
22868 <p>Taiwan is China.</p>
22869 !! end
22870
22871 !! test
22872 Code coverage: T combined with H flag
22873 !! options
22874 language=zh variant=zh-tw showtitle
22875 !! wikitext
22876 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22877
22878 Taiwan is China.
22879 !! html/php
22880 Taiwan
22881 <p>Should be stripped!
22882 </p><p>Taiwan is Taiwan.
22883 </p>
22884 !! html/parsoid
22885 <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>
22886 <p>Taiwan is China.</p>
22887 !! end
22888
22889 !! test
22890 Code coverage: T with no variants
22891 !! options
22892 language=zh variant=zh-tw showtitle
22893 !! wikitext
22894 -{H|zh:China; zh-tw:Taiwan}-
22895 Taiwan is China.-{T|Taiwan is China}-
22896 !! html/php
22897 Taiwan is China
22898 <p>
22899 Taiwan is Taiwan.
22900 </p>
22901 !! html/parsoid
22902 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22903 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22904 !! end
22905
22906 !! test
22907 Code coverage: rules with no variants
22908 !! options
22909 language=zh variant=zh-tw
22910 !! wikitext
22911 -{H|zh:China; zh-tw:Taiwan}-
22912 Taiwan is China.
22913 -{H|China}-
22914 Taiwan is China.
22915 !! html/php
22916 <p>
22917 Taiwan is Taiwan.
22918
22919 Taiwan is China.
22920 </p>
22921 !! html/parsoid
22922 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22923 Taiwan is China.
22924 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22925 Taiwan is China.</p>
22926 !! end
22927
22928
22929 !! test
22930 Code coverage: D flag for conversion rule
22931 !! options
22932 language=zh variant=zh-tw
22933 !! wikitext
22934 -{D|zh-cn:XA; zh-tw:YA}-
22935 -{A;D|zh-cn:XB; zh-tw:YB}-
22936 -{D;H|zh-cn:XC; zh-tw:YC}-
22937
22938 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22939
22940 -{D|0=>zh-tw:1}-
22941 -{A;D|2=>zh-tw:3}-
22942 -{D;H|4=>zh-tw:5}-
22943
22944 XA XB XC YA YB YC FOO BAR BAT 012345
22945 !! html/php
22946 <p>大陆:XA;台灣:YA;
22947
22948 大陆:XC;台灣:YC;
22949 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22950 </p><p>0⇒台灣:1;
22951
22952 4⇒台灣:5;
22953 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22954 </p>
22955 !! html/parsoid
22956 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22957 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22958 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22959 <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>
22960 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22961 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22962 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22963 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22964 !! end
22965
22966 !! test
22967 Code coverage: N flag for conversion rule
22968 !! options
22969 language=zh variant=zh-cn
22970 !! wikitext
22971 -{N|zh-cn}-
22972
22973 -{N|zh-tw}-
22974
22975 -{N|sr-ec}-
22976 !! html/php
22977 <p>大陆
22978 </p><p>台灣
22979 </p><p>српски (ћирилица)‎
22980 </p>
22981 !! html/parsoid
22982 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22983 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22984 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22985 !! end
22986
22987 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22988 !! test
22989 Code coverage: N flag for conversion rule (wt2html only)
22990 !! options
22991 language=zh variant=zh-cn
22992 parsoid=wt2html,html2html
22993 !! wikitext
22994 -{D;N|en}-
22995 !! html/php
22996 <p>English
22997 </p>
22998 !! html/parsoid
22999 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
23000 !! end
23001
23002 !! test
23003 Testing that changing the language variant here in the tests actually works
23004 !! options
23005 language=zh variant=zh showtitle
23006 !! wikitext
23007 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
23008 !! html/php
23009 China
23010 <p>Should be stripped!
23011 </p>
23012 !! html/parsoid
23013 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
23014 !! end
23015
23016 !! test
23017 Recursive conversion of alt and title attrs shouldn't clear converter state
23018 !! options
23019 language=zh variant=zh-cn
23020 showtitle
23021 !! wikitext
23022 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
23023 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
23024 !! html/php
23025 China
23026 <p>
23027 Should be stripped<span title="Exclamation">!</span>
23028 </p>
23029 !! html/parsoid
23030 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
23031 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>
23032 !! end
23033
23034 !! test
23035 T26072: more test on conversion rule for title
23036 !! options
23037 language=zh variant=zh-tw showtitle
23038 !! wikitext
23039 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
23040
23041 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
23042 !! html/php
23043 Taiwan
23044 <p>This should be stripped!
23045 </p><p>This won't take interferes with the title rule.
23046 </p>
23047 !! html/parsoid
23048 <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>
23049 <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>
23050 !! end
23051
23052 !! test
23053 Partly disable title conversion if variant == main language code
23054 !! options
23055 language=zh variant=zh title=[[ZH]] showtitle
23056 !! wikitext
23057 -{T|zh-cn:CN;zh-tw:TW}-
23058 !! html/php
23059 ZH
23060 <p>
23061 </p>
23062 !! html/parsoid
23063 <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>
23064 !! end
23065
23066 !! test
23067 Partly disable title conversion if variant == main language code, more
23068 !! options
23069 language=zh variant=zh title=[[ZH]] showtitle
23070 !! wikitext
23071 -{T|TW}-
23072 !! html/php
23073 ZH
23074 <p>
23075 </p>
23076 !! html/parsoid
23077 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
23078 !! end
23079
23080 !! test
23081 Raw output of variant escape tags (R flag)
23082 !! options
23083 language=zh variant=zh-tw
23084 !! wikitext
23085 Raw: -{R|zh:China;zh-tw:Taiwan}-
23086 !! html/php
23087 <p>Raw: zh:China;zh-tw:Taiwan
23088 </p>
23089 !! html/parsoid
23090 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
23091 !! end
23092
23093 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
23094 !! test
23095 Raw output of variant escape tags (R flag) (wt2html only)
23096 !! options
23097 language=zh variant=zh-tw
23098 parsoid=wt2html,html2html
23099 !! wikitext
23100 -{Variant}- -{D|syntax}- -{D;R|options}-
23101 !! html/php
23102 <p>Variant syntax options
23103 </p>
23104 !! html/parsoid
23105 <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>
23106 !! end
23107
23108 !! test
23109 Nested markup inside raw output of variant escape tags (R flag)
23110 !! options
23111 language=zh variant=zh-tw
23112 !! wikitext
23113 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
23114 !! html/php
23115 <p>Nested raw: nested Taiwan nested
23116 </p>
23117 !! html/parsoid
23118 <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>
23119 !! end
23120
23121 !! test
23122 Nested markup and spaces inside raw output of variant escape tags (R flag)
23123 !! options
23124 language=zh variant=zh-tw
23125 !! wikitext
23126 X-{ outer -{ inner }- outer }-X
23127 !! html/php
23128 <p>X outer inner outer X
23129 </p>
23130 !! html/parsoid
23131 <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>
23132 !! end
23133
23134 !! test
23135 Templates inside raw output of variant escape tags (R flag)
23136 !! options
23137 language=zh variant=zh-tw
23138 !! wikitext
23139 Nested raw: -{R|nested {{echo|hi}} templates}-
23140 !! html/php
23141 <p>Nested raw: nested hi templates
23142 </p>
23143 !! html/parsoid
23144 <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>
23145 !! end
23146
23147 !! test
23148 Strings evaluating false shouldn't be ignored by Language converter (T51072)
23149 !! options
23150 language=zh variant=zh-cn
23151 !! wikitext
23152 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
23153 !! html/php
23154 <p>0
23155 </p>
23156 !! html/parsoid
23157 <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>
23158 !! end
23159
23160 !! test
23161 Conversion rules from [numeric-only string] to [something else] (T48634)
23162 !! options
23163 language=zh variant=zh-cn
23164 !! wikitext
23165 -{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
23166 !! html/php
23167 <p>D12345EE12345
23168 </p>
23169 !! html/parsoid
23170 <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>
23171 !! end
23172
23173 !! test
23174 Two-way converter rule entries with an empty value should be ignored (T53551)
23175 !! options
23176 language=zh variant=zh-cn
23177 !! wikitext
23178 -{H|zh-cn:foo;zh-tw:;}-foobar
23179 !! html/php
23180 <p>foobar
23181 </p>
23182 !! html/parsoid
23183 <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>
23184 !! end
23185
23186 !! test
23187 One-way converter rule entries with an empty "from" string should be ignored (T53551)
23188 !! options
23189 language=zh variant=zh-cn
23190 !! wikitext
23191 -{H|=>zh-cn:foo;}-foobar
23192 !! html/php
23193 <p>foobar
23194 </p>
23195 !! html/parsoid
23196 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
23197 !! end
23198
23199 !! test
23200 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
23201 !! options
23202 language=zh variant=zh-cn
23203 !! wikitext
23204 -{H|}-foobar
23205 !! html/php
23206 <p>foobar
23207 </p>
23208 !! html/parsoid
23209 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
23210 !! end
23211
23212 !! test
23213 Nested using of manual convert syntax
23214 !! options
23215 language=zh variant=zh-hk
23216 !! wikitext
23217 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
23218 !! html/php
23219 <p>Nested: Hello Hong Kong!
23220 </p>
23221 !! html/parsoid
23222 <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>
23223 !! end
23224
23225 !! test
23226 HTML markups with conversion syntax in attribs, nested in other conversion blocks
23227 !! options
23228 language=zh variant=zh-cn
23229 !! wikitext
23230 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
23231 !! html/php
23232 <p><span title="X">A</span>
23233 </p>
23234 !! html/parsoid
23235 <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>
23236 !! end
23237
23238 !! test
23239 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
23240 !! options
23241 language=zh variant=zh-cn
23242 !! wikitext
23243 -{<span title="-{X}-">A</span>}-
23244 !! html/php+disabled
23245 <p><span title="X">A</span>
23246 </p>
23247 !! html/parsoid
23248 <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>
23249 !! end
23250
23251 # Parsoid and PHP disagree on how to parse this example: Parsoid
23252 # insists that the content of a language converter element be a valid
23253 # DOM fragment or attribute string
23254 !! test
23255 Language converter markup with block content
23256 !! options
23257 language=zh variant=zh-cn
23258 !! wikitext
23259 <span>a-{b<div>c}-d
23260
23261 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
23262
23263 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
23264 !! html/php+tidy
23265 <span>ab<div>cd
23266 <span>ab<div>cd
23267 <span>ad</span></div></span></div></span>
23268 !! html/parsoid
23269 <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
23270
23271 <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
23272
23273 <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>
23274 !! end
23275
23276 !! test
23277 LanguageConverter selser (1)
23278 !! options
23279 language=zh variant=zh-cn
23280 parsoid={
23281 "modes": ["wt2wt", "selser"],
23282 "changes": [
23283 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23284 ]
23285 }
23286 !! wikitext
23287 -{raw}-
23288 !! wikitext/edited
23289 -{edited}-
23290 !! end
23291
23292 !! test
23293 LanguageConverter selser (2)
23294 !! options
23295 language=zh variant=zh-cn
23296 parsoid={
23297 "modes": ["wt2wt", "selser"],
23298 "changes": [
23299 ["span[class='x']", "contents", "text", "-{foo}-"],
23300 ["a", "contents", "text", "-{"],
23301 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
23302 ]
23303 }
23304 !! wikitext
23305 <span class="x">TEXT1</span>
23306 [http://example.com TEXT2]
23307 [[Foo|TEXT3]]
23308 {{echo|TEXT4}}
23309 !! wikitext/edited
23310 <span class="x"><nowiki>-{foo}-</nowiki></span>
23311 [http://example.com -{]
23312 [[Foo|<nowiki>-{</nowiki>]]
23313 {{1x|<nowiki>-{</nowiki>}}
23314 !! end
23315
23316 # Tests LanguageVariantText in ConstrainedText
23317 !! test
23318 LanguageConverter selser (3)
23319 !! options
23320 language=zh variant=zh-cn
23321 parsoid={
23322 "modes": ["wt2wt", "selser"],
23323 "changes": [
23324 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
23325 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23326 ]
23327 }
23328 !! wikitext
23329 {|
23330 |-
23331 |<span>Foo</span>
23332 |}
23333 !! wikitext/edited
23334 {|
23335 |-
23336 |<nowiki/>-{edited}-
23337 |}
23338 !! end
23339
23340 # Tests LanguageVariantText._fromSelSer
23341 !! test
23342 LanguageConverter selser (4)
23343 !! options
23344 language=zh variant=zh-cn
23345 parsoid={
23346 "modes": ["wt2wt", "selser"],
23347 "changes": [
23348 ["td > span.x", "remove"]
23349 ]
23350 }
23351 !! wikitext
23352 {|
23353 |-
23354 |<span class="x">Foo</span>-{Bar}-
23355 ||<span class="x">Foo</span>-{Bar}-
23356 |}
23357 !! wikitext/edited
23358 {|
23359 |-
23360 |<nowiki/>-{Bar}-
23361 ||-{Bar}-
23362 |}
23363 !! end
23364
23365 # Since Parsoid is starting to emit canonical wikitext for links,
23366 # [http://example.com http://example.com] will not RT back to that
23367 # form anymore.
23368 # Parsoid does not language-convert links (it is done in a
23369 # post-processing step)
23370 !! test
23371 Proper conversion of text in external links
23372 !! options
23373 language=sr variant=sr-ec
23374 parsoid=wt2html
23375 !! wikitext
23376 http://www.google.com
23377 gopher://www.google.com
23378 [http://www.google.com http://www.google.com]
23379 [gopher://www.google.com gopher://www.google.com]
23380 [https://www.google.com irc://www.google.com]
23381 [ftp://www.google.com www.google.com/ftp://dir]
23382 [//www.google.com www.google.com]
23383 !! html/php
23384 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
23385 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23386 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
23387 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23388 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
23389 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
23390 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
23391 </p>
23392 !! html/parsoid
23393 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
23394 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23395 <a rel="mw:ExtLink" class="external text" href="http://www.google.com">http://www.google.com</a>
23396 <a rel="mw:ExtLink" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23397 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
23398 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
23399 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
23400 !! end
23401
23402 !! test
23403 Do not convert roman numbers to language variants
23404 !! options
23405 language=sr variant=sr-ec
23406 !! wikitext
23407 Fridrih IV je car.
23408 !! html/php
23409 <p>Фридрих IV је цар.
23410 </p>
23411 !! html/parsoid
23412 <p>Fridrih IV je car.</p>
23413 !! end
23414
23415 !! test
23416 Unclosed language converter markup "-{"
23417 !! options
23418 language=sr
23419 !! wikitext
23420 -{T|hello
23421 !! html
23422 <p>-{T|hello
23423 </p>
23424 !! end
23425
23426 !! test
23427 Don't convert raw rule "-{R|=&gt;}-" to "=>"
23428 !! options
23429 language=sr
23430 !! wikitext
23431 -{R|=&gt;}-
23432 !! html/php
23433 <p>=&gt;
23434 </p>
23435 !! html/parsoid
23436 <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>
23437 !!end
23438
23439 !! test
23440 Don't break link parsing if language converter markup is in the caption.
23441 !! options
23442 language=sr variant=sr-ec
23443 !! wikitext
23444 [[Main Page|-{R|main page}-]]
23445 !! html/php
23446 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
23447 </p>
23448 !! html/parsoid
23449 <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>
23450 !! end
23451
23452 !! test
23453 T146304: Don't break template parsing if language converter markup is in the parameter.
23454 !! options
23455 language=sr variant=sr-ec
23456 !! wikitext
23457 {{echo|-{R|foo}-}}
23458 !! html/php
23459 <p>foo
23460 </p>
23461 !! html/parsoid
23462 <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>
23463 !! end
23464
23465 !! test
23466 T146305: Don't break image parsing if language converter markup is in the caption.
23467 !! options
23468 language=sr
23469 !! wikitext
23470 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
23471 !! html/php
23472 <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>
23473 !! html/parsoid
23474 <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>
23475 !! end
23476
23477 !! test
23478 T146305: Don't break image parsing if nested language converter markup is in the caption.
23479 !! options
23480 language=zh variant=zh-cn
23481 !! wikitext
23482 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
23483 !! html/php
23484 <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>
23485 !! html/parsoid
23486 <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>
23487 !! end
23488
23489 # XXX html2wt disabled because rich markup in alt is not preserved.
23490 !! test
23491 Don't break gallery if language converter markup is inside.
23492 !! options
23493 language=zh
23494 parsoid=wt2html,html2html
23495 !! wikitext
23496 <gallery>
23497 File:Foobar.jpg|alt=-{R|bat}-|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]
23498 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=-{R|param}-}}
23499 </gallery>
23500 !! html/php
23501 <ul class="gallery mw-gallery-traditional">
23502 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23503 <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>
23504 <div class="gallerytext">
23505 <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>
23506 </p>
23507 </div>
23508 </div></li>
23509 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23510 <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>
23511 <div class="gallerytext">
23512 <p>This is a test template
23513 </p>
23514 </div>
23515 </div></li>
23516 </ul>
23517 !! html/parsoid
23518 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
23519 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image mw:ExpandedAttrs" data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&apos;{\"disabled\":{\"t\":\"bat\"}}&apos; data-parsoid=&apos;{\"fl\":[\"R\"],\"dsr\":[84,93,null,2]}&apos;>&lt;/span>","txt":""}]]}'><a href="./File:Foobar.jpg"><img alt="" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><figure-inline typeof="mw:Image mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&apos;{\"disabled\":{\"t\":\"foo\"}}&apos; data-parsoid=&apos;{\"fl\":[\"R\"],\"dsr\":[58,67,null,2]}&apos;>&lt;/span>","txt":""}]],"caption":"&lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&apos;{\"disabled\":{\"t\":\"bar\"}}&apos; data-parsoid=&apos;{\"fl\":[\"R\"],\"dsr\":[68,77,null,2]}&apos;>&lt;/span>"}'><a href="./File:Foobar.jpg"><img alt="" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="2" width="20"/></a></figure-inline></div></li>
23520 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"unamedParam"},"alt":{"wt":"-{R|param}-"}},"i":0}}]}'>This is a test template</span></div></li>
23521 </ul>
23522 !! end
23523
23524 !! test
23525 T153135: Don't break list handling if language converter markup is in the item.
23526 !! options
23527 language=zh variant=zh-cn
23528 !! wikitext
23529 ;-{zh-cn:AAA;zh-tw:BBB}-
23530 ;-{R|foo:bar}-
23531 !! html/php
23532 <dl><dt>AAA</dt>
23533 <dt>foo:bar</dt></dl>
23534 !! html/parsoid
23535 <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>
23536 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
23537 </dl>
23538 !! end
23539
23540 // Note that parsoid does not protect colons unless language converter
23541 // markup is properly nested, because it is a backtracking parser.
23542 !! test
23543 T153135: Unclosed markup in definition list (code coverage)
23544 !! options
23545 language=zh variant=zh-cn
23546 !! wikitext
23547 ;<b>foo:bar
23548 ;-{zh-cn:AAA
23549 !! html/php+tidy
23550 <dl><dt><b>foo:bar</b></dt><b>
23551 <dt>-{zh-cn:AAA</dt></b></dl>
23552 !! html/parsoid
23553 <dl><dt data-parsoid='{}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
23554 <dt data-parsoid='{}'>-{zh-cn</dt><dd data-parsoid='{"stx":"row"}'>AAA</dd></b></dl>
23555 !! end
23556
23557 !! test
23558 T153135: Nested language converter markup in definition list (code coverage)
23559 !! options
23560 language=zh variant=zh-cn
23561 !! wikitext
23562 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
23563 !! html/php
23564 <dl><dt>AAA foo:bar bat:baz</dt>
23565 <dd>def</dd></dl>
23566 !! html/parsoid
23567 <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>
23568 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
23569 </dl>
23570 !! end
23571
23572 # html2wt mode disabled due to <nowiki> insertion.
23573 !! test
23574 T153140: Don't break table handling if language converter markup is in the cell.
23575 !! options
23576 language=sr variant=sr-ec
23577 parsoid=wt2html,wt2wt,html2html
23578 !! wikitext
23579 {|
23580 |-
23581 | -{R|B}-
23582 |}
23583 !! html/php
23584 <table>
23585
23586 <tr>
23587 <td>B
23588 </td></tr></table>
23589 !! html/parsoid
23590 <table>
23591 <tbody>
23592 <tr>
23593 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
23594 </tr>
23595 </tbody>
23596 </table>
23597 !! end
23598
23599 !! test
23600 Language converter tricky html2wt cases (1)
23601 !! options
23602 language=sr
23603 parsoid=html2wt,wt2wt
23604 !! html/parsoid
23605 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
23606 !! wikitext
23607 -{<nowiki>}-</nowiki>}-
23608 !! html/php
23609 <p>&#125;-
23610 </p>
23611 !! end
23612
23613 !! test
23614 Language converter tricky html2wt cases (2)
23615 !! options
23616 language=sr
23617 parsoid=html2wt,wt2wt
23618 !! html/parsoid
23619 <p>-{foo}-</p>
23620 !! wikitext
23621 <nowiki>-{foo}-</nowiki>
23622 !! html/php
23623 <p>-&#123;foo&#125;-
23624 </p>
23625 !! end
23626
23627 !! test
23628 Language converter tricky html2wt cases (3)
23629 !! options
23630 language=sr
23631 parsoid=html2wt,wt2wt
23632 !! html/parsoid
23633 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
23634 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
23635 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
23636 !! wikitext
23637 -{R||}-
23638
23639 -{R|R|raw}-
23640
23641 -{<nowiki>-{foo}-</nowiki>}-
23642 !! html/php
23643 <p>|
23644 </p><p>R|raw
23645 </p><p>-&#123;foo&#125;-
23646 </p>
23647 !! end
23648
23649 !! test
23650 Language converter tricky html2wt cases (4)
23651 !! options
23652 language=sr
23653 parsoid=html2wt,wt2wt
23654 !! html/parsoid
23655 <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>
23656 !! wikitext
23657 -{R|{{echo|hey}}}-
23658 !! html/php
23659 <p>hey
23660 </p>
23661 !! end
23662
23663 # Note that the <nowiki> escaping added by parsoid for source text,
23664 # destination text, and language names only works on the PHP side
23665 # for *destination text*. (HTML entity escaping wouldn't work
23666 # any better.) This is probably a bug, at least for source texts.
23667 # (For language names PHP uses a precise regexp based on the languages
23668 # it currently knows have variants, which is fragile since this set
23669 # can grow/shrink over time.)
23670 !! test
23671 Language converter tricky html2wt cases (5)
23672 !! options
23673 language=zh variant=zh-cn
23674 !! html/parsoid
23675 <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>
23676 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
23677 <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>
23678 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
23679 <p>a:b=>c xyz</p>
23680 !! wikitext
23681 -{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
23682
23683 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
23684
23685 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
23686
23687 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
23688
23689 a:b=>c xyz
23690 !! html/php+disabled
23691 <p>foobat;xyz=&gt;zh-cn:abc
23692 </p><p>A
23693 </p><p>0;zh-tw:bar
23694 </p><p>abc
23695 </p><p>a:b=&gt;c 0;zh-tw:bar
23696 </p>
23697 !! end
23698
23699 !! test
23700 T179579: Nowiki and lc interaction
23701 !! options
23702 parsoid=wt2html
23703 language=sr
23704 !! wikitext
23705 -{</nowiki>123}-
23706
23707 -{123<nowiki>|</nowiki>456}-
23708 !! html/parsoid
23709 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
23710
23711 <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>
23712 !! end
23713
23714 !! test
23715 T2529: Uncovered bullet
23716 !! wikitext
23717 *Foo {{bullet}}
23718 !! html
23719 <ul><li>Foo</li>
23720 <li>Bar</li></ul>
23721 !! end
23722
23723 !! test
23724 T2529: Uncovered bullet in a deeply nested list
23725 !! wikitext
23726 *******Foo {{bullet}}
23727 !! html
23728 <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>
23729 <li>Bar</li></ul>
23730 !! end
23731
23732 !! test
23733 T2529: Uncovered table already at line-start
23734 !! wikitext
23735 x
23736
23737 {{table}}
23738 y
23739 !! html
23740 <p>x
23741 </p>
23742 <table>
23743 <tr>
23744 <td>1</td>
23745 <td>2
23746 </td></tr>
23747 <tr>
23748 <td>3</td>
23749 <td>4
23750 </td></tr></table>
23751 <p>y
23752 </p>
23753 !! end
23754
23755 !! test
23756 T2529: Uncovered bullet in parser function result
23757 !! wikitext
23758 *Foo {{lc:{{bullet}} }}
23759 !! html
23760 <ul><li>Foo</li>
23761 <li>bar</li></ul>
23762 !! end
23763
23764 !! test
23765 T7678: Double-parsed template argument
23766 !! wikitext
23767 {{lc:{{{1}}}|hello}}
23768 !! html
23769 <p>{{{1}}}
23770 </p>
23771 !! end
23772
23773 !! test
23774 T7678: Double-parsed template invocation
23775 !! wikitext
23776 {{lc:{{paramtest {{!}} param = hello }} }}
23777 !! html
23778 <p>{{paramtest | param = hello }}
23779 </p>
23780 !! end
23781
23782 !! test
23783 Case insensitivity of parser functions for non-ASCII characters (T10143)
23784 !! options
23785 language=cs
23786 title=[[Main Page]]
23787 !! wikitext
23788 {{PRVNÍVELKÉ:ěščř}}
23789 {{prvnívelké:ěščř}}
23790 {{PRVNÍMALÉ:ěščř}}
23791 {{prvnímalé:ěščř}}
23792 {{MALÁ:ěščř}}
23793 {{malá:ěščř}}
23794 {{VELKÁ:ěščř}}
23795 {{velká:ěščř}}
23796 !! html
23797 <p>Ěščř
23798 Ěščř
23799 ěščř
23800 ěščř
23801 ěščř
23802 ěščř
23803 ĚŠČŘ
23804 ĚŠČŘ
23805 </p>
23806 !! end
23807
23808 !! test
23809 Morwen/13: Unclosed link followed by heading
23810 !! wikitext
23811 [[link
23812 ==heading==
23813 !! html
23814 <p>[[link
23815 </p>
23816 <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>
23817 !! end
23818
23819 !! test
23820 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23821 !! wikitext
23822 {{foo|
23823 =heading=
23824 !! html
23825 <p>{{foo|
23826 </p>
23827 <h1><span class="mw-headline" id="heading">heading</span></h1>
23828 !! end
23829
23830 !! test
23831 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23832 !! wikitext
23833 {{foo|
23834 ==heading==
23835 !! html
23836 <p>{{foo|
23837 </p>
23838 <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>
23839 !! end
23840
23841 !! test
23842 Tildes in comments
23843 !! options
23844 pst
23845 !! wikitext
23846 <!-- ~~~~ -->
23847 !! html/php
23848 <!-- ~~~~ -->
23849 !! end
23850
23851 !! test
23852 Paragraphs inside divs (no extra line breaks)
23853 !! wikitext
23854 <div>Line one
23855
23856 Line two</div>
23857 !! html
23858 <div>Line one
23859 Line two</div>
23860 !! end
23861
23862 !! test
23863 Paragraphs inside divs (extra line break on open)
23864 !! wikitext
23865 <div>
23866 Line one
23867
23868 Line two</div>
23869 !! html
23870 <div>
23871 <p>Line one
23872 </p>
23873 Line two</div>
23874 !! end
23875
23876 !! test
23877 Paragraphs inside divs (extra line break on close)
23878 !! wikitext
23879 <div>Line one
23880
23881 Line two
23882 </div>
23883 !! html
23884 <div>Line one
23885 <p>Line two
23886 </p>
23887 </div>
23888 !! end
23889
23890 !! test
23891 Paragraphs inside divs (extra line break on open and close)
23892 !! wikitext
23893 <div>
23894 Line one
23895
23896 Line two
23897 </div>
23898 !! html
23899 <div>
23900 <p>Line one
23901 </p><p>Line two
23902 </p>
23903 </div>
23904 !! end
23905
23906 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23907 !! test
23908 Nesting tags, paragraphs on lines which begin with <div>
23909 !! wikitext
23910 <div></div><strong>A
23911 B</strong>
23912 !! html/php+tidy
23913 <div></div><p><strong>A
23914 </strong></p><strong></strong><p><strong>B</strong>
23915 </p>
23916 !! html/parsoid
23917 <div data-parsoid='{"stx":"html"}'></div><p><strong data-parsoid='{"stx":"html","autoInsertedEnd":true}'>A</strong></p>
23918 <p><strong data-parsoid='{"stx":"html","autoInsertedStart":true}'>B</strong></p>
23919 !! end
23920
23921 # T8200: <blockquote> should behave like <div> with respect to line breaks
23922 !! test
23923 T8200: paragraphs inside blockquotes (no extra line breaks)
23924 !! wikitext
23925 <blockquote>Line one
23926
23927 Line two</blockquote>
23928 !! html
23929 <blockquote>Line one
23930 Line two</blockquote>
23931 !! html+tidy
23932 <blockquote><p>Line one
23933 Line two</p></blockquote>
23934 !! end
23935
23936 !! test
23937 T8200: paragraphs inside blockquotes (extra line break on open)
23938 !! wikitext
23939 <blockquote>
23940 Line one
23941
23942 Line two</blockquote>
23943 !! html
23944 <blockquote>
23945 <p>Line one
23946 </p>
23947 Line two</blockquote>
23948 !! html+tidy
23949 <blockquote>
23950 <p>Line one
23951 </p><p>
23952 Line two</p></blockquote>
23953 !! end
23954
23955 !! test
23956 T8200: paragraphs inside blockquotes (extra line break on close)
23957 !! wikitext
23958 <blockquote>Line one
23959
23960 Line two
23961 </blockquote>
23962 !! html
23963 <blockquote>Line one
23964 <p>Line two
23965 </p>
23966 </blockquote>
23967 !! html+tidy
23968 <blockquote><p>Line one
23969 </p><p>Line two
23970 </p>
23971 </blockquote>
23972 !! end
23973
23974 !! test
23975 T8200: paragraphs inside blockquotes (extra line break on open and close)
23976 !! wikitext
23977 <blockquote>
23978 Line one
23979
23980 Line two
23981 </blockquote>
23982 !! html
23983 <blockquote>
23984 <p>Line one
23985 </p><p>Line two
23986 </p>
23987 </blockquote>
23988 !! end
23989
23990 ## This is a corner case interaction between the paragraph wrapping in the
23991 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
23992 ## some tags which close paragraphs (and thus prevent wrapping on their line),
23993 ## of which "div" is one, but do p-wrapping inside them. These are referred
23994 ## to as "never suppressing". Remex, for its part, doesn't traverse into
23995 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
23996 !! test
23997 Paragraphs inside blockquotes/divs (no extra line breaks)
23998 !! wikitext
23999 <blockquote><div>Line one
24000
24001 Line two</div></blockquote>
24002 !! html
24003 <blockquote><div>Line one
24004 Line two</div></blockquote>
24005 !! end
24006
24007 !! test
24008 Paragraphs inside blockquotes/divs (extra line break on open)
24009 !! wikitext
24010 <blockquote><div>
24011 Line one
24012
24013 Line two</div></blockquote>
24014 !! html
24015 <blockquote><div>
24016 <p>Line one
24017 </p>
24018 Line two</div></blockquote>
24019 !! end
24020
24021 !! test
24022 Paragraphs inside blockquotes/divs (extra line break on close)
24023 !! wikitext
24024 <blockquote><div>Line one
24025
24026 Line two
24027 </div></blockquote>
24028 !! html
24029 <blockquote><div>Line one
24030 <p>Line two
24031 </p>
24032 </div></blockquote>
24033 !! end
24034
24035 !! test
24036 Paragraphs inside blockquotes/divs (extra line break on open and close)
24037 !! wikitext
24038 <blockquote><div>
24039 Line one
24040
24041 Line two
24042 </div></blockquote>
24043 !! html
24044 <blockquote><div>
24045 <p>Line one
24046 </p><p>Line two
24047 </p>
24048 </div></blockquote>
24049 !! end
24050
24051 !! test
24052 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
24053 !! options
24054 wgLinkHolderBatchSize=0
24055 !! wikitext
24056 [[meatball:1]]
24057 [[meatball:2]]
24058 [[meatball:3]]
24059 !! html
24060 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
24061 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
24062 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
24063 </p>
24064 !! end
24065
24066 !! test
24067 Free external link invading image caption
24068 !! wikitext
24069 [[Image:Foobar.jpg|thumb|http://x|hello]]
24070 !! html/php
24071 <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>
24072 !! html/parsoid
24073 <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>
24074 !! end
24075
24076 !! test
24077 T17196: localised external link numbers
24078 !! options
24079 language=fa
24080 !! wikitext
24081 [http://en.wikipedia.org/]
24082 !! html/php
24083 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
24084 </p>
24085 !! html/parsoid
24086 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
24087 !! end
24088
24089 !! test
24090 Multibyte character in padleft
24091 !! wikitext
24092 {{padleft:-Hello|7|Æ}}
24093 !! html/php
24094 <p>Æ-Hello
24095 </p>
24096 !! html/parsoid
24097 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
24098 !! end
24099
24100 !! test
24101 Multibyte character in padright
24102 !! wikitext
24103 {{padright:Hello-|7|Æ}}
24104 !! html/php
24105 <p>Hello-Æ
24106 </p>
24107 !! html/parsoid
24108 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
24109 !! end
24110
24111 !!test
24112 formatdate parser function
24113 !! wikitext
24114 {{#formatdate:2009-03-24}}
24115 !! html
24116 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
24117 </p>
24118 !! end
24119
24120 !!test
24121 formatdate parser function, with default format
24122 !! wikitext
24123 {{#formatdate:2009-03-24|mdy}}
24124 !! html
24125 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
24126 </p>
24127 !! end
24128
24129 !! test
24130 Spacing of numbers in formatted dates
24131 !! wikitext
24132 {{#formatdate:January 15}}
24133 !! html
24134 <p><span class="mw-formatted-date" title="01-15">January 15</span>
24135 </p>
24136 !! end
24137
24138 !! test
24139 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
24140 !! options
24141 language=nl title=[[MediaWiki:Common.css]]
24142 !! wikitext
24143 {{#formatdate:2009-03-24|dmy}}
24144 !! html
24145 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
24146 </p>
24147 !! end
24148
24149 #
24150 #
24151 #
24152
24153 #
24154 # Edit comments
24155 #
24156
24157 !! test
24158 Edit comment with link
24159 !! options
24160 comment
24161 !! wikitext
24162 I like the [[Main Page]] a lot
24163 !! html/php
24164 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
24165 !!end
24166
24167 !! test
24168 Edit comment with link and link text
24169 !! options
24170 comment
24171 !! wikitext
24172 I like the [[Main Page|best pages]] a lot
24173 !! html/php
24174 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
24175 !!end
24176
24177 !! test
24178 Edit comment with link and link text with suffix
24179 !! options
24180 comment
24181 !! wikitext
24182 I like the [[Main Page|best page]]s a lot
24183 !! html/php
24184 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
24185 !!end
24186
24187 !! test
24188 Edit comment with section link (non-local, eg in history list)
24189 !! options
24190 comment title=[[Main Page]]
24191 !! wikitext
24192 /* External links */ removed bogus entries
24193 !! html/php
24194 <span dir="auto"><span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→‎External links</a>: </span> removed bogus entries</span>
24195 !!end
24196
24197 !! test
24198 Edit comment with section link and text before it (non-local, eg in history list)
24199 !! options
24200 comment title=[[Main Page]]
24201 !! wikitext
24202 pre-comment text /* External links */ removed bogus entries
24203 !! html/php
24204 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>
24205 !!end
24206
24207 !! test
24208 Edit comment with section link (local, eg in diff view)
24209 !! options
24210 comment local title=[[Main Page]]
24211 !! wikitext
24212 /* External links */ removed bogus entries
24213 !! html/php
24214 <span dir="auto"><span class="autocomment"><a href="#External_links">→‎External links</a>: </span> removed bogus entries</span>
24215 !!end
24216
24217 !! test
24218 Edit comment with section link that has a link in it
24219 !! options
24220 comment local title=[[Main Page]]
24221 !! wikitext
24222 /* [[A link]] */
24223 !! html/php
24224 <span dir="auto"><span class="autocomment"><a href="#A_link">→‎&#91;[A link]]</a></span></span>
24225 !! end
24226
24227 !! test
24228 Edit comment with section link that has a template in it
24229 !! options
24230 comment local title=[[Main Page]]
24231 !! wikitext
24232 /* {{foobar|param}} */
24233 !! html/php
24234 <span dir="auto"><span class="autocomment"><a href="#.7B.7Bfoobar.7Cparam.7D.7D">→‎{{foobar|param}}</a></span></span>
24235 !! end
24236
24237 !! test
24238 Edit comment with subpage link (T16080)
24239 !! options
24240 comment
24241 subpage
24242 title=[[Subpage test]]
24243 !! wikitext
24244 Poked at a [[/subpage]] here...
24245 !! html/php
24246 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
24247 !!end
24248
24249 !! test
24250 Edit comment with subpage link and link text (T16080)
24251 !! options
24252 comment
24253 subpage
24254 title=[[Subpage test]]
24255 !! wikitext
24256 Poked at a [[/subpage|neat little page]] here...
24257 !! html/php
24258 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
24259 !!end
24260
24261 !! test
24262 Edit comment with bogus subpage link in non-subpage NS (T16080)
24263 !! options
24264 comment
24265 title=[[Subpage test]]
24266 !! wikitext
24267 Poked at a [[/subpage]] here...
24268 !! html/php
24269 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...
24270 !!end
24271
24272 !! test
24273 Edit comment with bare anchor link (local, as on diff)
24274 !! options
24275 comment
24276 local
24277 title=[[Main Page]]
24278 !! wikitext
24279 [[#section]]
24280 !! html/php
24281 <a href="#section">#section</a>
24282 !! end
24283
24284 !! test
24285 Edit comment with bare anchor link (non-local, as on history)
24286 !! options
24287 comment
24288 title=[[Main Page]]
24289 !! wikitext
24290 [[#section]]
24291 !! html/php
24292 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
24293 !! end
24294
24295 !! test
24296 Anchor starting with underscore
24297 !! options
24298 title=[[Foo]]
24299 !! wikitext
24300 [[#_ref|One]]
24301 !! html/php
24302 <p><a href="#_ref">One</a>
24303 </p>
24304 !! html/parsoid
24305 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
24306 !! end
24307
24308 !! test
24309 Id starting with underscore
24310 !! wikitext
24311 <div id="_ref"></div>
24312 !! html/*
24313 <div id="_ref"></div>
24314 !! end
24315
24316 !! test
24317 Edit comment with link with more than one pipe (T99346)
24318 !! options
24319 comment
24320 !! wikitext
24321 [[Main Page|Many|pipes]]
24322 !! html/php
24323 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
24324 !! end
24325
24326 !! test
24327 Complex edit comment with link with more than one pipe (T99346)
24328 !! options
24329 comment
24330 !! wikitext
24331 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
24332 !! html/php
24333 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;
24334 !! end
24335
24336 !! test
24337 Space normalisation on autocomment (T24784)
24338 !! options
24339 comment
24340 title=[[Main Page]]
24341 !! wikitext
24342 /* __hello__world__ */
24343 !! html/php
24344 <span dir="auto"><span class="autocomment"><a href="/wiki/Main_Page#hello_world" title="Main Page">→‎__hello__world__</a></span></span>
24345 !! end
24346
24347 !! test
24348 percent-encoding and + signs in comments (T28410)
24349 !! options
24350 comment
24351 !! wikitext
24352 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
24353 !! html/php
24354 <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>
24355 !! end
24356
24357 # Parsoid doesn't support this yet: see T75581
24358 # but it *should* omit the 'src' attribute if the image is bad.
24359 # PHP side of tests was disabled in
24360 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
24361 # because of issues in the PHP parserTests infrastructure
24362 # (but the output below is indeed what the PHP side emits)
24363 !! test
24364 Bad images - basic functionality
24365 !! wikitext
24366 [[File:Bad.jpg]]
24367 !! html/php+disabled
24368 !! html/parsoid
24369 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Bad.jpg"><span resource="./File:Bad.jpg">File:Bad.jpg</span></a></figure-inline></p>
24370 !! end
24371
24372 !! test
24373 Bad images - T18039: text after bad image disappears
24374 !! wikitext
24375 Foo bar
24376 [[File:Bad.jpg]]
24377 Bar foo
24378 !! html/php+disabled
24379 <p>Foo bar
24380 </p><p>Bar foo
24381 </p>
24382 !! html/parsoid
24383 <p>Foo bar
24384 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Bad.jpg"><span resource="./File:Bad.jpg">File:Bad.jpg</span></a></figure-inline>
24385 Bar foo</p>
24386 !! end
24387
24388 !! test
24389 Verify that displaytitle works (T24501) no displaytitle
24390 !! options
24391 showtitle
24392 !! config
24393 wgAllowDisplayTitle=true
24394 wgRestrictDisplayTitle=false
24395 !! wikitext
24396 this is not the the title
24397 !! html/php
24398 Parser test
24399 <p>this is not the the title
24400 </p>
24401 !! end
24402
24403 !! test
24404 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
24405 !! options
24406 showtitle
24407 title=[[Screen]]
24408 !! config
24409 wgAllowDisplayTitle=true
24410 wgRestrictDisplayTitle=false
24411 !! wikitext
24412 this is not the the title
24413 {{DISPLAYTITLE:whatever}}
24414 !! html/php
24415 whatever
24416 <p>this is not the the title
24417 </p>
24418 !! end
24419
24420 !! test
24421 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
24422 !! options
24423 showtitle
24424 title=[[Screen]]
24425 !! config
24426 wgAllowDisplayTitle=true
24427 wgRestrictDisplayTitle=true
24428 !! wikitext
24429 this is not the the title
24430 {{DISPLAYTITLE:whatever}}
24431 !! html/php
24432 Screen
24433 <p>this is not the the title
24434 </p>
24435 !! end
24436
24437 !! test
24438 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
24439 !! options
24440 showtitle
24441 title=[[Screen]]
24442 !! config
24443 wgAllowDisplayTitle=true
24444 wgRestrictDisplayTitle=true
24445 !! wikitext
24446 this is not the the title
24447 {{DISPLAYTITLE:screen}}
24448 !! html/php
24449 screen
24450 <p>this is not the the title
24451 </p>
24452 !! end
24453
24454 !! test
24455 Verify that displaytitle works (T24501) AllowDisplayTitle=false
24456 !! options
24457 showtitle
24458 title=[[Screen]]
24459 !! config
24460 wgAllowDisplayTitle=false
24461 !! wikitext
24462 this is not the the title
24463 {{DISPLAYTITLE:screen}}
24464 !! html/php
24465 Screen
24466 <p>this is not the the title
24467 <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>
24468 </p>
24469 !! end
24470
24471 !! test
24472 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
24473 !! options
24474 showtitle
24475 title=[[Screen]]
24476 !! config
24477 wgAllowDisplayTitle=false
24478 !! wikitext
24479 this is not the the title
24480 !! html/php
24481 Screen
24482 <p>this is not the the title
24483 </p>
24484 !! end
24485
24486 !! test
24487 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
24488 !! options
24489 showtitle
24490 title=[[Screen]]
24491 !! config
24492 wgAllowDisplayTitle=true
24493 wgRestrictDisplayTitle=true
24494 !! wikitext
24495 this is not the the title
24496 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
24497 !! html/php
24498 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
24499 <p>this is not the the title
24500 </p>
24501 !! end
24502
24503 !! test
24504 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
24505 !! options
24506 showtitle
24507 title=[[Screen]]
24508 !! config
24509 wgAllowDisplayTitle=true
24510 wgRestrictDisplayTitle=true
24511 !! wikitext
24512 this is not the the title
24513 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
24514 !! html/php
24515 <span style="color: red;">s</span>creen
24516 <p>this is not the the title
24517 </p>
24518 !! end
24519
24520 !! test
24521 Page status indicators: Empty name is invalid
24522 !! options
24523 showindicators
24524 !! wikitext
24525 <indicator name=" "></indicator>
24526 <indicator></indicator>
24527 !! html/php
24528 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24529 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24530 </p>
24531 !! end
24532
24533 !! test
24534 Page status indicators: Weird syntaxes that are okay
24535 !! options
24536 showindicators
24537 !! wikitext
24538 <indicator name="empty" />
24539 <indicator name="name"></indicator>
24540 !! html/php
24541 empty=
24542 name=
24543 <p><br />
24544 </p>
24545 !! end
24546
24547 !! test
24548 Page status indicators: Torture test
24549 !! options
24550 showindicators
24551 !! wikitext
24552 <indicator name="01">hello world</indicator>
24553 <indicator name="02">[[Main Page]]</indicator>
24554 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
24555 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
24556 <indicator name="05">*foo
24557 *bar</indicator>
24558 <indicator name="06"><nowiki>foo</nowiki></indicator>
24559 <indicator name="07"> Preformatted</indicator>
24560 <indicator name="08"><div>Broken tag</indicator>
24561 <indicator name="09">{| class=wikitable
24562 |cell
24563 |}</indicator>
24564 <indicator name="10">Two
24565
24566 paragraphs</indicator>
24567 !! html/php
24568 01=hello world
24569 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
24570 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" />
24571 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>
24572 05=<ul><li>foo</li>
24573 <li>bar</li></ul>
24574 06=foo
24575 07=<pre>Preformatted
24576 </pre>
24577 08=<div>Broken tag</div>
24578
24579 09=<table class="wikitable">
24580 <tr>
24581 <td>cell
24582 </td></tr></table>
24583 10=<p>Two
24584 </p><p>paragraphs
24585 </p>
24586 <p><br />
24587 </p><p><br />
24588 </p><p><br />
24589 </p><p><br />
24590 </p><p><br />
24591 </p>
24592 !! end
24593
24594 !! test
24595 preload: check <noinclude> and <includeonly>
24596 !! options
24597 preload
24598 !! wikitext
24599 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
24600 !! html/php
24601 Hello kind world.
24602 !! end
24603
24604 !! test
24605 preload: check <onlyinclude>
24606 !! options
24607 preload
24608 !! wikitext
24609 Goodbye <onlyinclude>Hello world</onlyinclude>
24610 !! html/php
24611 Hello world
24612 !! end
24613
24614 !! test
24615 preload: can pass tags through if we want to
24616 !! options
24617 preload
24618 !! wikitext
24619 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
24620 !! html/php
24621 <includeonly>Hello world</includeonly>
24622 !! end
24623
24624 !! test
24625 preload: check that it doesn't try to do tricks
24626 !! options
24627 preload
24628 !! wikitext
24629 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24630 !! html/php
24631 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24632 !! end
24633
24634 !! test
24635 Play a bit with r67090 and T5158
24636 !! wikitext
24637 <div style="width:50% !important">&nbsp;</div>
24638 <div style="width:50%&nbsp;!important">&nbsp;</div>
24639 <div style="width:50%&#160;!important">&nbsp;</div>
24640 <div style="border : solid;">&nbsp;</div>
24641 !! html/php
24642 <div style="width:50% !important">&#160;</div>
24643 <div style="width:50% !important">&#160;</div>
24644 <div style="width:50% !important">&#160;</div>
24645 <div style="border&#32;: solid;">&#160;</div>
24646 !! html/parsoid
24647 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24648 <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>
24649 <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>
24650 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24651 !! end
24652
24653 !! test
24654 French spaces in wikitext
24655 !! wikitext
24656 foo ! bar ? bat 50 % is less than 75 %.
24657
24658 Hello : this ; is « something ‹ else › again »
24659 !! html
24660 <p>foo&#160;! bar&#160;? bat 50&#160;% is less than 75&#160;%.
24661 </p><p>Hello&#160;: this&#160;; is «&#160;something ‹&#160;else&#160;› again&#160;»
24662 </p>
24663 !! end
24664
24665 # It would be reasonable for Parsoid and PHP to differ here.
24666 # The PHP behavior is arguably a bug.
24667 !! test
24668 Corner case: french spaces in definition list
24669 !! wikitext
24670 ;foo : bar
24671 !! html+tidy
24672 <dl><dt>foo&#160;</dt>
24673 <dd>bar</dd></dl>
24674 !! end
24675
24676 !! test
24677 T5158: Test for French spaces in attributes
24678 !! wikitext
24679 <br style=" clear : both ; " />
24680 !! html/php
24681 <p><br style="clear&#32;: both&#32;;" />
24682 </p>
24683 !! end
24684
24685 !! test
24686 HTML5 data attributes
24687 !! wikitext
24688 <span data-foo="bar">Baz</span>
24689 <p data-abc-def_hij="">Quuz</p>
24690 !! html/php
24691 <p><span data-foo="bar">Baz</span>
24692 </p>
24693 <p data-abc-def_hij="">Quuz</p>
24694 !! html/parsoid
24695 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
24696 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
24697 !! end
24698
24699 !! test
24700 Strip reserved data attributes
24701 !! wikitext
24702 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-object-id="123" data-ooui="xyzzy" data-bad:ns="ns">d</div>
24703 !! html/php
24704 <div data-ok="fred" data-object-id="123">d</div>
24705 !! html/parsoid
24706 <div data-x-data-mw="foo" data-x-data-parsoid="bar" data-x-data-mw-someext="baz" data-ok="fred" data-x-data-object-id="123" data-parsoid='{"stx":"html","a":{"data-ooui":null,"data-bad:ns":null},"sa":{"data-ooui":"xyzzy","data-bad:ns":"ns"}}'>d</div>
24707 !! end
24708
24709 !! test
24710 percent-encoding and + signs in internal links (T28410)
24711 !! wikitext
24712 [[User:+%]] [[Page+title%]]
24713 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
24714 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
24715 [[%33%45]] [[%33%45+]]
24716 !! html/php
24717 <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>
24718 <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>
24719 <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>
24720 <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>
24721 </p>
24722 !! html/parsoid
24723 <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>
24724 <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>
24725 <a rel="mw:WikiLink" href="./%25" title="%" data-parsoid='{"stx":"simple","a":{"href":"./%25"},"sa":{"href":"%"}}'>%</a> <a rel="mw:WikiLink" href="./+" title="+" data-parsoid='{"stx":"simple","a":{"href":"./+"},"sa":{"href":"+"}}'>+</a> <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=&apos;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bar\"},\"sa\":{\"href\":\"bar\"},\"dsr\":[94,101,2,2]}&apos;>bar&lt;/a>","errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/%25+abc9"><span resource="./File:%25+abc9" data-parsoid='{"a":{"resource":"./File:%25+abc9"},"sa":{"resource":"File:%+abc%39"}}'>File:%+abc9</span></a></figure-inline>
24726 <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>
24727 !! end
24728
24729 !! test
24730 Special characters in embedded file links (T29679)
24731 !! wikitext
24732 [[File:Contains & ampersand.jpg]]
24733 [[File:Does not exist.jpg|Title with & ampersand]]
24734 !! html/php
24735 <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>
24736 <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>
24737 </p>
24738 !! html/parsoid
24739 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Contains_&amp;_ampersand.jpg"><span resource="./File:Contains_&amp;_ampersand.jpg" data-parsoid='{"a":{"resource":"./File:Contains_&amp;_ampersand.jpg"},"sa":{"resource":"File:Contains &amp; ampersand.jpg"}}'>File:Contains &amp; ampersand.jpg</span></a></figure-inline>
24740 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"caption":"Title with &amp;amp; ampersand","errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Does_not_exist.jpg"><span resource="./File:Does_not_exist.jpg" data-parsoid='{"a":{"resource":"./File:Does_not_exist.jpg"},"sa":{"resource":"File:Does not exist.jpg"}}'>File:Does not exist.jpg</span></a></figure-inline></p>
24741 !! end
24742
24743 !! test
24744 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
24745 !! wikitext
24746 Text&apos;s been normalized?
24747 !! html
24748 <p>Text&#39;s been normalized?
24749 </p>
24750 !! end
24751
24752 !! test
24753 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
24754 !! wikitext
24755 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
24756 !! html
24757 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
24758 </p>
24759 !! end
24760
24761 !! test
24762 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
24763 !! wikitext
24764 [http://www.example.org/ ideograms]
24765 !! html
24766 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
24767 </p>
24768 !! end
24769
24770 !! test
24771 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
24772 !! wikitext
24773 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
24774 !! html
24775 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
24776 </p>
24777 !! end
24778
24779 !! article
24780 Mediawiki:loop1
24781 !! text
24782 {{Identical|A}}
24783 !! endarticle
24784
24785 !! article
24786 Mediawiki:loop2
24787 !! text
24788 {{Identical|B}}
24789 !! endarticle
24790
24791 !! article
24792 Template:Identical
24793 !! text
24794 {{int:loop1}}
24795 {{int:loop2}}
24796 !! endarticle
24797
24798 !! test
24799 T33098 Template which includes system messages which includes the template
24800 !! wikitext
24801 {{Identical}}
24802 !! html
24803 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24804 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24805 </p>
24806 !! end
24807
24808 !! test
24809 T33490 Turkish: ucfirst 'blah'
24810 !! options
24811 language=tr
24812 !! wikitext
24813 {{ucfirst:blah}}
24814 !! html
24815 <p>Blah
24816 </p>
24817 !! end
24818
24819 !! test
24820 T33490 Turkish: ucfirst 'ix'
24821 !! options
24822 language=tr
24823 !! wikitext
24824 {{ucfirst:ix}}
24825 !! html
24826 <p>İx
24827 </p>
24828 !! end
24829
24830 !! test
24831 T33490 Turkish: lcfirst 'BLAH'
24832 !! options
24833 language=tr
24834 !! wikitext
24835 {{lcfirst:BLAH}}
24836 !! html
24837 <p>bLAH
24838 </p>
24839 !! end
24840
24841 !! test
24842 T33490 Turkish: ucfırst (with a dotless i)
24843 !! options
24844 language=tr
24845 !! wikitext
24846 {{ucfırst:blah}}
24847 !! html
24848 <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>
24849 </p>
24850 !! end
24851
24852 !! test
24853 T33490 ucfırst (with a dotless i) with English language
24854 !! options
24855 language=en
24856 !! wikitext
24857 {{ucfırst:blah}}
24858 !! html
24859 <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>
24860 </p>
24861 !! end
24862
24863 # Note that Parsoid doesn't emit an explicit TOC.
24864 # Note also that the html2wt direction tends to emit an extra newline
24865 # between the __TOC__ magicword and the first heading unless *both*
24866 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24867 # it's "{}").
24868
24869 !! test
24870 T28375: TOC with italics
24871 !! options
24872 title=[[Main Page]]
24873 !! wikitext
24874 __TOC__
24875 ==''Lost'' episodes==
24876 !! html/php
24877 <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>
24878 <ul>
24879 <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>
24880 </ul>
24881 </div>
24882
24883 <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>
24884 !! html/parsoid
24885 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24886 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24887 !! end
24888
24889 !! test
24890 T28375: TOC with bold
24891 !! options
24892 title=[[Main Page]]
24893 !! wikitext
24894 __TOC__
24895 =='''should be bold''' then normal text==
24896 !! html/php
24897 <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>
24898 <ul>
24899 <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>
24900 </ul>
24901 </div>
24902
24903 <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>
24904 !! html/parsoid
24905 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24906 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24907 !! end
24908
24909 !! test
24910 T35845: Headings become cursive in TOC when they contain an image
24911 !! options
24912 title=[[Main Page]]
24913 !! wikitext
24914 __TOC__
24915 ==Image [[Image:foobar.jpg]]==
24916 !! html/php
24917 <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>
24918 <ul>
24919 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24920 </ul>
24921 </div>
24922
24923 <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>
24924 !! html/parsoid
24925 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24926 <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>
24927 !! end
24928
24929 !! test
24930 T35845 (2): Headings become bold in TOC when they contain a blockquote
24931 !! options
24932 title=[[Main Page]]
24933 !! wikitext
24934 __TOC__
24935 ==<blockquote>Quote</blockquote>==
24936 !! html/php
24937 <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>
24938 <ul>
24939 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24940 </ul>
24941 </div>
24942
24943 <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>
24944 !! html/php+tidy
24945 <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>
24946 <ul>
24947 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24948 </ul>
24949 </div>
24950
24951 <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>
24952 !! html/parsoid
24953 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24954 <h2 id="Quote" data-parsoid='{}'><blockquote><p>Quote</p></blockquote></h2>
24955 !! end
24956
24957 !! test
24958 Unclosed tags in TOC
24959 !! config
24960 wgFragmentMode=[ 'html5', 'legacy' ]
24961 !! options
24962 title=[[Main Page]]
24963 !! wikitext
24964 __TOC__
24965 ==Proof: 2 < 3==
24966 <small>Hanc marginis exiguitas non caperet.</small>
24967 QED
24968 !! html/php
24969 <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>
24970 <ul>
24971 <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>
24972 </ul>
24973 </div>
24974
24975 <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>
24976 <p><small>Hanc marginis exiguitas non caperet.</small>
24977 QED
24978 </p>
24979 !! html/parsoid
24980 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24981 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24982 <p><small>Hanc marginis exiguitas non caperet.</small>
24983 QED</p>
24984 !! end
24985
24986 !! test
24987 Multiple tags in TOC
24988 !! wikitext
24989 __TOC__
24990 ==<i>Foo</i> <b>Bar</b>==
24991
24992 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24993 !! html/php
24994 <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>
24995 <ul>
24996 <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>
24997 <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>
24998 </ul>
24999 </div>
25000
25001 <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>
25002 <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>
25003 !! html/php+tidy
25004 <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>
25005 <ul>
25006 <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>
25007 <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>
25008 </ul>
25009 </div>
25010
25011 <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>
25012 <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>
25013 !! html/parsoid
25014 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25015 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
25016
25017 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote><p>Bar</p></blockquote></h2>
25018 !! end
25019
25020 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
25021 # html5 tag parsing.
25022 !! test
25023 Tags with parameters in TOC
25024 !! options
25025 parsoid=wt2html
25026 !! wikitext
25027 __TOC__
25028 ==<sup class="in-h2">Hello</sup>==
25029
25030 ==<sup class="a > b">Evilbye</sup>==
25031 !! html/php
25032 <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>
25033 <ul>
25034 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
25035 <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>
25036 </ul>
25037 </div>
25038
25039 <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>
25040 <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>
25041 !! html/parsoid
25042 <meta property="mw:PageProp/toc" />
25043 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
25044
25045 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
25046 !! end
25047
25048 !! test
25049 span tags with directionality in TOC
25050 !! wikitext
25051 __TOC__
25052 ==<span dir="ltr">C++</span>==
25053
25054 ==<span dir="rtl">זבנג!</span>==
25055
25056 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
25057
25058 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
25059
25060 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
25061 !! html/php
25062 <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>
25063 <ul>
25064 <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>
25065 <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>
25066 <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>
25067 <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>
25068 <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>
25069 </ul>
25070 </div>
25071
25072 <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>
25073 <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>
25074 <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>
25075 <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>
25076 <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>
25077 !! html/parsoid
25078 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25079 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
25080 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
25081 <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>
25082 <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>
25083 <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>
25084 !! end
25085
25086 !! test
25087 T74884: bdi element in ToC
25088 !! wikitext
25089 __TOC__
25090 ==<bdi>test</bdi>==
25091 !! html/php
25092 <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>
25093 <ul>
25094 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
25095 </ul>
25096 </div>
25097
25098 <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>
25099 !! html/parsoid
25100 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25101 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
25102 !! end
25103
25104 !! test
25105 T35715: s/strike element in ToC
25106 !! wikitext
25107 __TOC__
25108 ==<s>test</s> test <strike>test</strike>==
25109 !! html/php
25110 <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>
25111 <ul>
25112 <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>
25113 </ul>
25114 </div>
25115
25116 <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>
25117 !! html/parsoid
25118 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25119 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
25120 !! end
25121
25122 !! test
25123 T198618: style element in ToC
25124 !! options
25125 styletag=1
25126 !! wikitext
25127 __TOC__
25128 ==<style>.foo {}</style>Style<style>.bar {}</style>==
25129 !! html/php
25130 <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>
25131 <ul>
25132 <li class="toclevel-1 tocsection-1"><a href="#Style"><span class="tocnumber">1</span> <span class="toctext">Style</span></a></li>
25133 </ul>
25134 </div>
25135
25136 <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>
25137 !! html/parsoid
25138 <meta property="mw:PageProp/toc" data-parsoid="{}"/>
25139 <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>
25140 !! end
25141
25142 !! test
25143 T198618: script element in ToC
25144 !! options
25145 wgRawHtml=1
25146 !! wikitext
25147 __TOC__
25148 ==<html><script>alert(1);</script></html>Script<html><script>alert(1);</script></html>==
25149 !! html/php
25150 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
25151 <ul>
25152 <li class="toclevel-1 tocsection-1"><a href="#Script"><span class="tocnumber">1</span> <span class="toctext">Script</span></a></li>
25153 </ul>
25154 </div>
25155
25156 <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>
25157 !! html/parsoid
25158 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25159 <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>
25160 !! end
25161
25162 !! test
25163 Empty <p> tag in TOC, removed by Sanitizer (T92892)
25164 !! wikitext
25165 __TOC__
25166 ==x==
25167 !! html/php
25168 <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>
25169 <ul>
25170 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
25171 </ul>
25172 </div>
25173
25174 <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>
25175 !! html/parsoid
25176 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25177 <h2 id="x" data-parsoid='{}'>x</h2>
25178 !! end
25179
25180 !! article
25181 MediaWiki:T34057
25182 !! text
25183 == {{int:headline_sample}} ==
25184 !! endarticle
25185
25186 !! test
25187 T34057: Title needed when expanding <h> nodes.
25188 !! options
25189 title=[[Main Page]]
25190 !! wikitext
25191 {{int:T34057}}
25192 !! html
25193 <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>
25194 !! end
25195
25196 !! test
25197 Strip marker in urlencode
25198 !! wikitext
25199 {{urlencode:x<nowiki/>y}}
25200 {{urlencode:x<nowiki/>y|wiki}}
25201 {{urlencode:x<nowiki/>y|path}}
25202 {{urlencode:x<pre id="one">two</pre>y}}
25203 !! html/php
25204 <p>xy
25205 xy
25206 xy
25207 xy
25208 </p>
25209 !! end
25210
25211 !! test
25212 Strip marker in lc
25213 !! wikitext
25214 {{lc:x<nowiki/>y}}
25215 !! html
25216 <p>xy
25217 </p>
25218 !! end
25219
25220 !! test
25221 Strip marker in uc
25222 !! wikitext
25223 {{uc:x<nowiki/>y}}
25224 !! html
25225 <p>XY
25226 </p>
25227 !! end
25228
25229 !! test
25230 Strip marker in formatNum
25231 !! wikitext
25232 {{formatnum:1<nowiki/>2}}
25233 {{formatnum:1<nowiki/>2|R}}
25234 !! html
25235 <p>12
25236 12
25237 </p>
25238 !! end
25239
25240 !! test
25241 Check noCommafy in formatNum
25242 !! options
25243 language=be-tarask
25244 !! wikitext
25245 {{formatnum:123456.78}}
25246 {{formatnum:123456.78|NOSEP}}
25247 !! html
25248 <p>123 456,78
25249 123456.78
25250 </p>
25251 !! end
25252
25253 !! test
25254 Wrong option for formatNum (T58199)
25255 !! wikitext
25256 {{formatnum:1,234.56|Random}}
25257 {{formatnum:1,234.56|EVERYTHING}}
25258 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
25259 !! html
25260 <p>1,234.56
25261 1,234.56
25262 1,234.56
25263 </p>
25264 !! end
25265
25266 !! test
25267 Strip marker in grammar
25268 !! options
25269 language=fi
25270 !! wikitext
25271 {{grammar:elative|foo<nowiki/>bar}}
25272 !! html
25273 <p>foobarista
25274 </p>
25275 !! end
25276
25277 !! test
25278 Strip marker in padleft
25279 !! wikitext
25280 {{padleft:|2|x<nowiki/>y}}
25281 !! html
25282 <p>xy
25283 </p>
25284 !! end
25285
25286 !! test
25287 Strip marker in padright
25288 !! wikitext
25289 {{padright:|2|x<nowiki/>y}}
25290 !! html
25291 <p>xy
25292 </p>
25293 !! end
25294
25295 !! test
25296 Strip marker in anchorencode
25297 !! wikitext
25298 {{anchorencode:x<nowiki/>y}}
25299 !! html/php
25300 <p>xy
25301 </p>
25302 !! html/parsoid
25303 <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>
25304 !! end
25305
25306 !! test
25307 nowiki inside link inside heading (T20295)
25308 !! wikitext
25309 ==[[foo|x<nowiki>y</nowiki>z]]==
25310 !! html
25311 <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>
25312 !! end
25313
25314 !! test
25315 new support for bdi element (T33817)
25316 !! wikitext
25317 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25318 !! html
25319 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25320 !! end
25321
25322 !! test
25323 Ignore pipe between table row attributes
25324 !! wikitext
25325 {|
25326 |quux
25327 |- id=foo | style='color: red'
25328 |bar
25329 |}
25330 !! html
25331 <table>
25332 <tr>
25333 <td>quux
25334 </td></tr>
25335 <tr id="foo" style="color: red">
25336 <td>bar
25337 </td></tr></table>
25338 !! end
25339
25340 !!test
25341 Language parser function
25342 !! wikitext
25343 {{#language:ar}}
25344 !! html
25345 <p>العربية
25346 </p>
25347 !! end
25348
25349 !!test
25350 Padleft and padright (default 0-padding)
25351 !! wikitext
25352 {{padleft:xyz|5}}
25353 {{padright:xyz|5}}
25354 !! html/php
25355 <p>00xyz
25356 xyz00
25357 </p>
25358 !! html/parsoid
25359 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
25360 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
25361 !! end
25362
25363 !!test
25364 Padleft and padright (partial fill)
25365 !! wikitext
25366 {{padleft:xyz|6|ab}}
25367 {{padright:xyz|6|ab}}
25368 !! html/php
25369 <p>abaxyz
25370 xyzaba
25371 </p>
25372 !! html/parsoid
25373 <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>
25374 <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>
25375 !! end
25376
25377 !!test
25378 Padleft and padright as substr
25379 !! wikitext
25380 {{padleft:|3|abcde}}
25381 {{padright:|3|abcde}}
25382 !! html/php
25383 <p>abc
25384 abc
25385 </p>
25386 !! html/parsoid
25387 <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>
25388 <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>
25389 !! end
25390
25391 !! test
25392 Padleft and padright with non-numerical length (T180403)
25393 !! wikitext
25394 {{padleft:abcdef|junk}}
25395 {{padright:abcdef|junk}}
25396 !! html/php
25397 <p>abcdef
25398 abcdef
25399 </p>
25400 !! end
25401
25402 !!test
25403 Special parser function
25404 !! wikitext
25405 {{#special:RandomPage}}
25406 {{#special:BaDtItLe}}
25407 {{#special:Foobar}}
25408 !! html
25409 <p>Special:Random
25410 Special:Badtitle
25411 Special:Foobar
25412 </p>
25413 !! end
25414
25415 !!test
25416 T36939 - Case insensitive link parsing ([HttP://])
25417 !! wikitext
25418 [HttP://MediaWiki.Org/]
25419 !! html/php
25420 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
25421 </p>
25422 !! html/parsoid
25423 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
25424 !! end
25425
25426 !!test
25427 T36939 - Case insensitive link parsing ([HttP:// title])
25428 !! wikitext
25429 [HttP://MediaWiki.Org/ MediaWiki]
25430 !! html
25431 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
25432 </p>
25433 !! end
25434
25435 !!test
25436 T36939 - Case insensitive link parsing (HttP://)
25437 !! wikitext
25438 HttP://MediaWiki.Org/
25439 !! html/php
25440 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
25441 </p>
25442 !! html/parsoid
25443 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
25444 !! end
25445
25446 !!test
25447 Disable TOC
25448 !! options
25449 notoc
25450 !! wikitext
25451 Lead
25452 ==Section 1==
25453 ==Section 2==
25454 ==Section 3==
25455 ==Section 4==
25456 ==Section 5==
25457 !! html
25458 <p>Lead
25459 </p>
25460
25461 <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>
25462 <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>
25463 <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>
25464 <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>
25465 <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>
25466 !! end
25467
25468
25469 ###
25470 ### Parsoid-specific tests
25471 ### Parsoid-PHP parser incompatibilities
25472 ###
25473 !!test
25474 1. SOL-sensitive wikitext tokens as template-args
25475 !! options
25476 parsoid=wt2html,wt2wt
25477 !! wikitext
25478 {{echo|*a}}
25479 {{echo|#a}}
25480 {{echo|:a}}
25481 !! html/php+tidy
25482 <ul><li>a</li></ul>
25483 <ol><li>a</li></ol>
25484 <dl><dd>a</dd></dl>
25485 !! html/parsoid
25486 <span about="#mwt1" typeof="mw:Transclusion">
25487 </span><ul about="#mwt1"><li>a</li>
25488 </ul>
25489 <span about="#mwt2" typeof="mw:Transclusion">
25490 </span><ol about="#mwt2"><li>a</li>
25491 </ol>
25492 <span about="#mwt3" typeof="mw:Transclusion">
25493 </span><dl about="#mwt3"><dd>a</dd>
25494 </dl>
25495 !!end
25496
25497 #### -----------------------------------------------------------------
25498 #### Parsoid-specific functionality tests
25499 #### -----------------------------------------------------------------
25500
25501 # T65642/T68749: Formatting elt fixup around images.
25502 # We know wt2wt will fail, but we expect selser to pass.
25503 # Due to the nature of our testing, wt2wt and selser tests will enter the
25504 # blacklist and we'll catch selser regressions based on changes to the
25505 # blacklist entries for selser tests.
25506 !! test
25507 1. Treebuilder fixup of formatting elt
25508 !! options
25509 parsoid=wt2html,wt2wt
25510 !! wikitext
25511 {|
25512 |
25513 <small>
25514 [[Image:Foobar.jpg|right|Test]]
25515 </small>
25516 |}
25517 !! html/php+tidy
25518 <table>
25519 <tbody><tr>
25520 <td>
25521 <p><small>
25522 </small></p><small>
25523 <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>
25524 </small><p><small></small>
25525 </p>
25526 </td></tr></tbody></table>
25527 !! html/parsoid
25528 <table>
25529 <tbody><tr><td>
25530 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
25531 <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>
25532 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p></td></tr>
25533 </tbody></table>
25534 !! end
25535
25536 !! test
25537 2. Treebuilder fixup of formatting elt
25538 !! options
25539 parsoid=wt2html,wt2wt
25540 !! wikitext
25541 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
25542
25543 <small>[[Image:Foobar.jpg|right|300px]]</small>
25544 !! html/php+tidy
25545 <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>
25546 </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>
25547 !! html/parsoid
25548 <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>
25549
25550 <small><figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a><figcaption></figcaption></figure></small>
25551 !! end
25552
25553 !! test
25554 3. Treebuilder fixup of formatting elt
25555 !! options
25556 parsoid=wt2html,wt2wt
25557 !! wikitext
25558 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
25559 !! html/php+tidy
25560 <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>
25561 !! html/parsoid
25562 <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>
25563 !! end
25564
25565 !! test
25566 4. Treebuilder fixup of formatting elt: formatting tags around captionless images
25567 !! options
25568 parsoid=wt2html,wt2wt
25569 !! wikitext
25570 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
25571 !! html/php+tidy
25572 <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>
25573 !! html/parsoid
25574 <b><small><figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a><figcaption></figcaption></figure></small></b>
25575 !! end
25576
25577 #### ----------------------------------------------------------------
25578 #### Parsoid-only testing of Parsoid's impl of LST
25579 #### Not implemented yet, see
25580 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
25581 #### ----------------------------------------------------------------
25582
25583 ## We still need to support serializing the older format while content is stored.
25584 !! test
25585 LST Sections: Backwards compatibility
25586 !! options
25587 parsoid={
25588 "suppressErrors": true,
25589 "modes": ["html2wt"]
25590 }
25591 !! wikitext
25592 <section begin="2011-05-16" />
25593 <section end="2014-04-10 (MW 1.23wmf22)" />
25594 !! html/parsoid
25595 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
25596 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
25597 !! end
25598
25599 !! test
25600 LST Sections: Newfangled approach
25601 !! wikitext
25602 <section begin="2011-05-16" />
25603 <section end="2014-04-10 (MW 1.23wmf22)" />
25604 !! html/parsoid
25605 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"}}'>
25606 </span>
25607 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"}}'>
25608 </span></p>
25609 !! end
25610
25611 #--------- Test stripping of empty nodes in template content ----------
25612
25613 !! test
25614 Empty LI and TR nodes should be stripped from template content
25615 !! wikitext
25616 {{EmptyLITest}}
25617 {{EmptyTRTest}}
25618 !! html/parsoid
25619 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
25620 <li>a</li>
25621 <li>b</li>
25622 </ul>
25623 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
25624 <tbody>
25625 <tr>
25626 <td>foo</td>
25627 </tr>
25628 <tr>
25629 <td>bar</td>
25630 </tr>
25631 </tbody>
25632 </table>
25633 !! end
25634
25635 !! test
25636 Empty LI and TR nodes should not be stripped from top-level content
25637 !! wikitext
25638 *a
25639 *
25640 *b
25641
25642 {|
25643 |-
25644 |-
25645 |foo
25646 |}
25647 !! html/parsoid
25648 <ul>
25649 <li>a</li>
25650 <li class='mw-empty-elt'></li>
25651 <li>b</li>
25652 </ul>
25653 <table>
25654 <tbody>
25655 <tr class='mw-empty-elt'></tr>
25656 <tr>
25657 <td>foo</td>
25658 </tr>
25659 </tbody>
25660 </table>
25661 !! end
25662
25663 !! test
25664 Empty TR nodes should not be stripped if they have any attributes set
25665 !! wikitext
25666 {{EmptyTRWithHTMLAttrTest}}
25667 !! html/parsoid
25668 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
25669 <tr align='center'></tr>
25670 <tr><td>foo</td></tr>
25671 <tr align='center'></tr>
25672 <tr><td>bar</td></tr>
25673 </table>
25674 !! end
25675
25676 #### ----------------------------------------------------------------
25677 #### The following section of tests are primarily to test
25678 #### wikitext escaping capabilities of Parsoid. Given that
25679 #### escaping can be done any number of ways, the wikitext (input)
25680 #### is always adjusted to reflect how Parsoid adds nowiki
25681 #### escape tags.
25682 ####
25683 #### We are marking several tests as parsoid-only since the
25684 #### HTML in the result section is different from what the
25685 #### PHP parser generates for it.
25686 #### ----------------------------------------------------------------
25687
25688
25689 #### --------------- Headings ---------------
25690 #### 0. Unnested
25691 #### 1. Nested inside html <h1>=foo=</h1>
25692 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
25693 #### 3. Nested inside html with wikitext split by html tags
25694 #### 4. No escape needed
25695 #### 5. Empty headings <h1></h1>
25696 #### 6. Heading chars in SOL context
25697 #### ----------------------------------------
25698 !! test
25699 Headings: 0. Unnested
25700 !! options
25701 parsoid=html2wt
25702 !! html/parsoid
25703 <p>=foo=</p>
25704
25705 <p> =foo=
25706 <!--cmt-->
25707 =foo=</p>
25708
25709 <p>=foo<i>a</i>=</p>
25710 !! wikitext
25711 <nowiki>=foo=</nowiki>
25712
25713 <nowiki> </nowiki>=foo=
25714 <!--cmt-->
25715 <nowiki>=foo=</nowiki>
25716
25717 =foo''a''<nowiki>=</nowiki>
25718 !!end
25719
25720 # New headings and existing headings are handled differently
25721 !! test
25722 Headings: 1. Nested inside html
25723 !! options
25724 parsoid=html2wt
25725 !! html/parsoid
25726 <h1>=foo=</h1>
25727 <h2>=foo=</h2>
25728 <h3>=foo=</h3>
25729
25730 <h1 data-parsoid='{}'>=foo=</h1>
25731 <h2 data-parsoid='{}'>=foo=</h2>
25732 <h3 data-parsoid='{}'>=foo=</h3>
25733 <h4 data-parsoid='{}'>=foo=</h4>
25734 <h5 data-parsoid='{}'>=foo=</h5>
25735 <h6 data-parsoid='{}'>=foo=</h6>
25736 !! wikitext
25737 = =foo= =
25738
25739 == =foo= ==
25740
25741 === =foo= ===
25742
25743 =<nowiki>=foo=</nowiki>=
25744 ==<nowiki>=foo=</nowiki>==
25745 ===<nowiki>=foo=</nowiki>===
25746 ====<nowiki>=foo=</nowiki>====
25747 =====<nowiki>=foo=</nowiki>=====
25748 ======<nowiki>=foo=</nowiki>======
25749 !! end
25750
25751 !! test
25752 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
25753 !! options
25754 parsoid=html2wt
25755 !! html/parsoid
25756 <h1>foo</h1>*bar
25757 <h1>foo</h1>=bar
25758 <h1>foo</h1>=bar=
25759 !! wikitext
25760 = foo =
25761 <nowiki>*</nowiki>bar
25762
25763 = foo =
25764 =bar
25765
25766 = foo =
25767 <nowiki>=bar=</nowiki>
25768 !!end
25769
25770 !! test
25771 Headings: 3. Nested inside html with wikitext split by html tags
25772 !! options
25773 parsoid=html2wt
25774 !! html/parsoid
25775 <h1>=<b>bold</b>foo=</h1>
25776 !! wikitext
25777 = ='''bold'''foo= =
25778 !!end
25779
25780 !! test
25781 Headings: 4a. No escaping needed (testing just h1 and h2)
25782 !! options
25783 parsoid=html2wt
25784 !! html/parsoid
25785 <h1>=foo</h1>
25786 <h1>foo=</h1>
25787 <h1> =foo= </h1>
25788 <h1>=foo= bar</h1>
25789 <h2>=foo</h2>
25790 <h2>foo=</h2>
25791 <h1>=</h1>
25792 <h1><i>=</i>foo=</h1>
25793 !! wikitext
25794 = =foo =
25795
25796 = foo= =
25797
25798 = =foo= =
25799
25800 = =foo= bar =
25801
25802 == =foo ==
25803
25804 == foo= ==
25805
25806 = = =
25807
25808 = ''=''foo= =
25809 !!end
25810
25811 !! test
25812 Headings: 4b. No escaping needed (inside p-tags)
25813 !! options
25814 parsoid=html2wt
25815 !! html/parsoid
25816 <p>=foo= x
25817 =foo= <s></s>
25818 </p>
25819 !! wikitext
25820 =foo= x
25821 =foo= <s></s>
25822 !! html/php
25823 <p>=foo= x
25824 =foo= <s></s>
25825 </p>
25826 !!end
25827
25828 !! test
25829 Headings: 4c. Short headings (1)
25830 !! options
25831 parsoid=html2wt
25832 !! html/parsoid
25833 <p>===
25834 </p>
25835 !! wikitext
25836 <nowiki>===</nowiki>
25837 !! html/php
25838 <p>===
25839 </p>
25840 !! end
25841
25842 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
25843 !! test
25844 Headings: 4d. Short headings (2)
25845 !! options
25846 parsoid=wt2html,html2html
25847 !! wikitext
25848 =
25849 ==
25850 ===
25851 ====
25852 =====
25853 !! html/php
25854 <p>=
25855 ==
25856 </p>
25857 <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>
25858 <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>
25859 <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>
25860 !! html/parsoid
25861 <p>=
25862 ==</p>
25863 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
25864 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
25865 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
25866 !! end
25867
25868 !! test
25869 Headings: 5. Empty headings
25870 !! options
25871 parsoid=html2wt
25872 !! html/parsoid
25873 <h1 data-parsoid='{}'></h1>
25874
25875 <h2 data-parsoid='{}'></h2>
25876
25877 <h3 data-parsoid='{}'></h3>
25878
25879 <h4 data-parsoid='{}'></h4>
25880
25881 <h5 data-parsoid='{}'></h5>
25882
25883 <h6 data-parsoid='{}'></h6>
25884 !! wikitext
25885 =<nowiki/>=
25886
25887 ==<nowiki/>==
25888
25889 ===<nowiki/>===
25890
25891 ====<nowiki/>====
25892
25893 =====<nowiki/>=====
25894
25895 ======<nowiki/>======
25896 !!end
25897
25898 !! test
25899 Headings: 6a. Heading chars in SOL context (with trailing spaces)
25900 !! options
25901 parsoid=html2wt
25902 !! html/parsoid
25903 <p>=a=</p>
25904
25905 <p>=a=</p>
25906
25907 <p>=a=</p>
25908 !! wikitext
25909 <nowiki>=a=</nowiki>
25910
25911 <nowiki>=a=</nowiki>
25912
25913 <nowiki>=a=</nowiki>
25914 !!end
25915
25916 !! test
25917 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25918 !! options
25919 parsoid=html2wt
25920 !! html/parsoid
25921 <p>=a=
25922 b</p>
25923
25924 <p>=a=
25925 b</p>
25926
25927 <p>=a=
25928 b</p>
25929 !! wikitext
25930 <nowiki>=a=</nowiki>
25931 b
25932
25933 <nowiki>=a=</nowiki>
25934 b
25935
25936 <nowiki>=a=</nowiki>
25937 b
25938 !!end
25939
25940 !! test
25941 Headings: 6c. Heading chars in SOL context (leading newline break)
25942 !! options
25943 parsoid=html2wt
25944 !! html/parsoid
25945 <p>a
25946 =b=</p>
25947 !! wikitext
25948 a
25949 <nowiki>=b=</nowiki>
25950 !!end
25951
25952 !! test
25953 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25954 !! options
25955 parsoid=html2wt
25956 !! html/parsoid
25957 <!--c0--><p>=a=</p>
25958
25959 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25960 !! wikitext
25961 <!--c0--><nowiki>=a=</nowiki>
25962
25963 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25964 !!end
25965
25966 !! test
25967 Headings: 6d. Heading chars in SOL context (No escaping needed)
25968 !! options
25969 parsoid=html2wt
25970 !! html/parsoid
25971 =a=<div>b</div>
25972 !! wikitext
25973 =a=<div>b</div>
25974 !!end
25975
25976 !! test
25977 Headings: 7. Insert a newline between new content and headings
25978 !! options
25979 parsoid=html2wt
25980 !! html/parsoid
25981 <h2>NEW</h2>
25982 <p>new</p>
25983 <h2 data-parsoid='{}'>A</h2>
25984 <p data-parsoid='{}'>a</p>
25985 !! wikitext
25986 == NEW ==
25987 new
25988
25989 ==A==
25990 a
25991 !! end
25992
25993 !! test
25994 Headings: Used as horizontal rule
25995 !! config
25996 wgFragmentMode=[ 'html5', 'legacy' ]
25997 !! options
25998 parsoid=wt2html
25999 !! wikitext
26000 ===============
26001 !! html/php
26002 <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>
26003 !! html/parsoid
26004 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
26005 !! end
26006
26007 #### --------------- Lists ---------------
26008 #### 0. Outside nests (*foo, etc.)
26009 #### 1. Nested inside html <ul><li>*foo</li></ul>
26010 #### 2. Inside definition lists
26011 #### 3. Only bullets at start should be escaped
26012 #### 4. No escapes needed
26013 #### 5. No unnecessary escapes
26014 #### 6. Escape bullets in SOL position
26015 #### 7. Escape bullets in a multi-line context
26016 #### ----------------------------------------
26017
26018 !! test
26019 Lists: 0. Outside nests
26020 !! options
26021 parsoid=html2wt
26022 !! html/parsoid
26023 <p>*foo</p>
26024
26025 <p>#foo</p>
26026
26027 <p>;Foo:bar</p>
26028 !! wikitext
26029 <nowiki>*</nowiki>foo
26030
26031 <nowiki>#</nowiki>foo
26032
26033 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
26034 !!end
26035
26036 ## Making these next 3 tests Parsoid-only since they are html2wt tests
26037 ## to test wikitext escaping, and insignificant whitespace diffs
26038 ## cause PHP parser tests to barf
26039 !! test
26040 Lists: 1. Nested inside html (No unnecessary escapes)
26041 !! options
26042 parsoid=html2wt
26043 !! html/parsoid
26044 <ul>
26045 <li>*foo</li>
26046 <li>#foo</li>
26047 <li>:foo</li>
26048 <li>;foo</li>
26049 <li data-parsoid='{}'>*foo</li>
26050 <li data-parsoid='{}'>#foo</li>
26051 <li data-parsoid='{}'>:foo</li>
26052 <li data-parsoid='{}'>;foo</li>
26053 </ul>
26054
26055 <ol>
26056 <li>*foo</li>
26057 <li>#foo</li>
26058 <li>:foo</li>
26059 <li>;foo</li>
26060 <li data-parsoid='{}'>*foo</li>
26061 <li data-parsoid='{}'>#foo</li>
26062 <li data-parsoid='{}'>:foo</li>
26063 <li data-parsoid='{}'>;foo</li>
26064 </ol>
26065 !! wikitext
26066 * *foo
26067 * #foo
26068 * :foo
26069 * ;foo
26070 *<nowiki>*foo</nowiki>
26071 *<nowiki>#foo</nowiki>
26072 *<nowiki>:foo</nowiki>
26073 *<nowiki>;foo</nowiki>
26074
26075 # *foo
26076 # #foo
26077 # :foo
26078 # ;foo
26079 #<nowiki>*foo</nowiki>
26080 #<nowiki>#foo</nowiki>
26081 #<nowiki>:foo</nowiki>
26082 #<nowiki>;foo</nowiki>
26083 !!end
26084
26085 !! test
26086 Lists: 2. Inside definition lists
26087 !! options
26088 parsoid=html2wt
26089 !! html/parsoid
26090 <dl><dt>;foo</dt></dl>
26091 <dl><dt>:foo</dt></dl>
26092 <dl><dt>:foo</dt>
26093 <dd>bar</dd></dl>
26094 <dl><dd>:foo</dd></dl>
26095 !! wikitext
26096 ; ;foo
26097
26098 ; <nowiki>:foo</nowiki>
26099
26100 ; <nowiki>:foo</nowiki>
26101 : bar
26102
26103 : :foo
26104 !!end
26105
26106 !! test
26107 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
26108 !! options
26109 parsoid=html2wt
26110 !! html/parsoid
26111 <ul>
26112 <li>*foo*bar</li>
26113 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
26114 </ul>
26115 !! wikitext
26116 * *foo*bar
26117 *<nowiki>*foo</nowiki>''it''*bar
26118 !!end
26119
26120 !! test
26121 Lists: 4. No escapes needed
26122 !! options
26123 parsoid=html2wt
26124 !! html/parsoid
26125 <ul>
26126 <li>foo*bar
26127 </li>
26128 </ul>
26129 <ul>
26130 <li><i>foo</i>*bar
26131 </li>
26132 </ul>
26133 <ul>
26134 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
26135 </li>
26136 </ul>
26137 <ul>
26138 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
26139 </li>
26140 </ul>
26141 !! wikitext
26142 *foo*bar
26143
26144 *''foo''*bar
26145
26146 *[[Foo]]: bar
26147
26148 *[[Foo]]*bar
26149 !!end
26150
26151 !! test
26152 Lists: 5. No unnecessary escapes
26153 !! options
26154 parsoid=html2wt
26155 !! html/parsoid
26156 <ul><li> bar <span>[[foo]]</span></li></ul>
26157 <ul><li> =bar <span>[[foo]]</span></li></ul>
26158 <ul><li> [[bar <span>[[foo]]</span></li></ul>
26159 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
26160 <ul><li> =bar <span>foo]]</span>=</li></ul>
26161 <ul><li> <s></s>: a</li></ul>
26162 <ul><li> <i>* foo</i></li></ul>
26163
26164 !! wikitext
26165 * bar <span><nowiki>[[foo]]</nowiki></span>
26166
26167 * =bar <span><nowiki>[[foo]]</nowiki></span>
26168
26169 * [[bar <span><nowiki>[[foo]]</nowiki></span>
26170
26171 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
26172
26173 * =bar <span>foo]]</span>=
26174
26175 * <s></s>: a
26176
26177 * ''* foo''
26178 !!end
26179
26180 !! test
26181 Lists: 6. Escape bullets in SOL position
26182 !! options
26183 parsoid=html2wt
26184 !! html/parsoid
26185 <p><!--cmt-->*foo</p>
26186 !! wikitext
26187 <!--cmt--><nowiki>*</nowiki>foo
26188 !!end
26189
26190 !! test
26191 Lists: 7. Escape bullets in a multi-line context
26192 !! options
26193 parsoid=html2wt
26194 !! html/parsoid
26195 <p>a
26196 *b
26197 </p>
26198 !! wikitext
26199 a
26200 <nowiki>*</nowiki>b
26201 !!end
26202
26203 !! test
26204 Lists: 8. Escape colons only if not present in tags
26205 !! options
26206 parsoid=html2wt
26207 !! html/parsoid
26208 <dl><dt>a:b<i>c:d</i></dt></dl>
26209 !! wikitext
26210 ; <nowiki>a:b</nowiki>''c:d''
26211 !! end
26212
26213 #### --------------- HRs ---------------
26214 #### 1. Single line
26215 #### -----------------------------------
26216
26217 !! test
26218 HRs: 1. Single line
26219 !! options
26220 parsoid=html2wt
26221 !! html/parsoid
26222 <hr />----
26223 <hr />=foo=
26224 <hr />*foo
26225 !! wikitext
26226 ----<nowiki>----</nowiki>
26227 ----=foo=
26228 ----*foo
26229 !! end
26230
26231 #### --------------- Tables ---------------
26232 #### 1a. Simple example
26233 #### 1b. No escaping needed (!foo)
26234 #### 1c. No escaping needed (|foo)
26235 #### 1d. No escaping needed (|}foo)
26236 ####
26237 #### 2a. Nested in td (<td>foo|bar</td>)
26238 #### 2b. Nested in td (<td>foo||bar</td>)
26239 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
26240 ####
26241 #### 3a. Nested in th (<th>foo!bar</th>)
26242 #### 3b. Nested in th (<th>foo!!bar</th>)
26243 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
26244 ####
26245 #### 4a. Escape -
26246 #### 4b. Escape +
26247 #### 4c. No escaping needed
26248 #### --------------------------------------
26249
26250 !! test
26251 Tables: 1a. Simple example
26252 !! options
26253 parsoid=html2wt
26254 !! html/parsoid
26255 <p>{|
26256 |}
26257 </p>
26258 !! wikitext
26259 <nowiki>{|</nowiki>
26260 |}
26261 !! end
26262
26263 !! test
26264 Tables: 1b. No escaping needed
26265 !! options
26266 parsoid=html2wt
26267 !! html/parsoid
26268 <p>!foo
26269 </p>
26270 !! wikitext
26271 !foo
26272 !! end
26273
26274 !! test
26275 Tables: 1c. No escaping needed
26276 !! options
26277 parsoid=html2wt
26278 !! html/parsoid
26279 <p>|foo
26280 </p>
26281 !! wikitext
26282 |foo
26283 !! end
26284
26285 !! test
26286 Tables: 1d. No escaping needed
26287 !! options
26288 parsoid=html2wt
26289 !! html/parsoid
26290 <p>|}foo
26291 </p>
26292 !! wikitext
26293 |}foo
26294 !! end
26295
26296 !! test
26297 Tables: 2a. Nested in td
26298 !! options
26299 parsoid=html2wt
26300 !! html/parsoid
26301 <table><tbody><tr>
26302 <td>foo|bar</td></tr>
26303 <tr><td>x<div>a|b</div></td>
26304 </tbody></table>
26305 !! wikitext
26306 {|
26307 |<nowiki>foo|bar</nowiki>
26308 |-
26309 |x<div><nowiki>a|b</nowiki></div>
26310 |}
26311 !! html/php+tidy
26312 <table>
26313 <tbody><tr>
26314 <td>foo|bar
26315 </td></tr>
26316 <tr>
26317 <td>x<div>a|b</div>
26318 </td></tr></tbody></table>
26319 !! end
26320
26321 !! test
26322 Tables: 2b. Nested in td
26323 !! options
26324 parsoid=html2wt
26325 !! html/parsoid
26326 <table><tbody><tr>
26327 <td>foo||bar</td>
26328 <td>a<i>b||c</i></td>
26329 <td>a<i><div>b||c</div></i></td>
26330 </tr></tbody></table>
26331 !! wikitext
26332 {|
26333 |<nowiki>foo||bar</nowiki>
26334 |a''<nowiki>b||c</nowiki>''
26335 |a''<div><nowiki>b||c</nowiki></div>''
26336 |}
26337 !! html/php
26338 <table>
26339 <tr>
26340 <td>foo||bar
26341 </td>
26342 <td>a<i>b||c</i>
26343 </td>
26344 <td>a<i><div>b||c</div></i>
26345 </td></tr></table>
26346 !! end
26347
26348 !! test
26349 Tables: 2c. Nested in td -- no escaping needed
26350 !! options
26351 parsoid=html2wt
26352 !! html/*
26353 <table>
26354 <tr>
26355 <td>foo!!bar
26356 </td></tr></table>
26357 !! wikitext
26358 {|
26359 |foo!!bar
26360 |}
26361 !! end
26362
26363 !! test
26364 Tables: 3a. Nested in th
26365 !! options
26366 parsoid=html2wt
26367 !! html/*
26368 <table>
26369 <tr>
26370 <th>foo!bar
26371 </th></tr></table>
26372 !! wikitext
26373 {|
26374 !foo!bar
26375 |}
26376 !! end
26377
26378 !! test
26379 Tables: 3b. Nested in th
26380 !! options
26381 parsoid=html2wt
26382 !! html/parsoid
26383 <table><tbody>
26384 <tr><th>foo!!bar</th>
26385 <th><i>foo|bar</i></th>
26386 <th><i>foo!!bar</i></th>
26387 <th><i><span>foo!!bar</span></i></th>
26388 </tr></tbody></table>
26389 !! wikitext
26390 {|
26391 !<nowiki>foo!!bar</nowiki>
26392 !''<nowiki>foo|bar</nowiki>''
26393 !''<nowiki>foo!!bar</nowiki>''
26394 !''<span><nowiki>foo!!bar</nowiki></span>''
26395 |}
26396 !! html/php
26397 <table>
26398 <tr>
26399 <th>foo!!bar
26400 </th>
26401 <th><i>foo|bar</i>
26402 </th>
26403 <th><i>foo!!bar</i>
26404 </th>
26405 <th><i><span>foo!!bar</span></i>
26406 </th></tr></table>
26407 !! end
26408
26409 !! test
26410 Tables: 3c. Nested in th
26411 !! options
26412 parsoid=html2wt
26413 !! html/parsoid
26414 <table><tbody>
26415 <tr><th>foo||bar</th>
26416 <th><span typeof="mw:Nowiki">foo||bar</span></th>
26417 </tr></tbody></table>
26418 !! wikitext
26419 {|
26420 !<nowiki>foo||bar</nowiki>
26421 !<nowiki>foo||bar</nowiki>
26422 |}
26423 !! html/php
26424 <table>
26425 <tr>
26426 <th>foo||bar
26427 </th>
26428 <th>foo||bar
26429 </th></tr></table>
26430 !! end
26431
26432 !! test
26433 Tables: 4a. Escape -
26434 !! options
26435 parsoid=html2wt
26436 !! html/*
26437 <table>
26438 <tr>
26439 <th>-bar
26440 </th></tr>
26441 <tr>
26442 <td>-bar
26443 </td></tr></table>
26444 !! wikitext
26445 {|
26446 !-bar
26447 |-
26448 |<nowiki>-bar</nowiki>
26449 |}
26450 !! end
26451
26452 !! test
26453 Tables: 4b. Escape +
26454 !! options
26455 parsoid=html2wt
26456 !! html/*
26457 <table>
26458 <tr>
26459 <th>+bar
26460 </th></tr>
26461 <tr>
26462 <td>+bar
26463 </td></tr></table>
26464 !! wikitext
26465 {|
26466 !+bar
26467 |-
26468 |<nowiki>+bar</nowiki>
26469 |}
26470 !! end
26471
26472 !! test
26473 Tables: 4c. No escaping needed
26474 !! options
26475 parsoid=html2wt
26476 !! html/parsoid
26477 <table><tbody>
26478 <tr><td>foo-bar</td><td>foo+bar</td></tr>
26479 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
26480 <tr><td>foo
26481 <p>bar|baz
26482 +bar
26483 -bar</p></td></tr>
26484 <tr><td>x
26485 <div>a|b</div></td>
26486 </tbody></table>
26487 !! wikitext
26488 {|
26489 |foo-bar
26490 |foo+bar
26491 |-
26492 |''foo''-bar
26493 |''foo''+bar
26494 |-
26495 |foo
26496 bar|baz
26497 +bar
26498 -bar
26499 |-
26500 |x
26501 <div>a|b</div>
26502 |}
26503 !! html/php
26504 <table>
26505 <tr>
26506 <td>foo-bar
26507 </td>
26508 <td>foo+bar
26509 </td></tr>
26510 <tr>
26511 <td><i>foo</i>-bar
26512 </td>
26513 <td><i>foo</i>+bar
26514 </td></tr>
26515 <tr>
26516 <td>foo
26517 <p>bar|baz
26518 +bar
26519 -bar
26520 </p>
26521 </td></tr>
26522 <tr>
26523 <td>x
26524 <div>a|b</div>
26525 </td></tr></table>
26526 !! end
26527
26528 !! test
26529 Tables: 4d. No escaping needed
26530 !! options
26531 parsoid=html2wt
26532 !! html/parsoid
26533 <table>
26534 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
26535 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
26536 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
26537 </tbody></table>
26538 !! wikitext
26539 {|
26540 |[[Foo]]-bar
26541 ||+1
26542 ||-2
26543 |}
26544 !! html/php
26545 <table>
26546 <tr>
26547 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
26548 </td>
26549 <td>+1
26550 </td>
26551 <td>-2
26552 </td></tr></table>
26553 !! end
26554
26555 !! test
26556 Tables: 4e. Escape }
26557 !! options
26558 parsoid=html2wt
26559 !! html/parsoid
26560 <table>
26561 <tr><td>}</td></tr>
26562 <tr><td>x</td><td data-parsoid='{"stx":"row"}'>}</td></tr></table>
26563 </table>
26564 !! wikitext
26565 {|
26566 |<nowiki>}</nowiki>
26567 |-
26568 |x||}
26569 |}
26570 !! html/php
26571 <table>
26572 <tr>
26573 <td>}
26574 </td></tr>
26575 <tr>
26576 <td>x</td>
26577 <td>}
26578 </td></tr></table>
26579 !! end
26580
26581 !! test
26582 Tables: 5. Empty table cells should get whitespace to avoid need for nowikis
26583 !! options
26584 parsoid=html2wt
26585 !! html/parsoid
26586 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26587
26588 <table><tr><td></td><td align="center"></td><td></td></tr></table>
26589
26590 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26591
26592 <table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table>
26593 !! wikitext
26594 {|
26595 | || align="center" | ||
26596 |}
26597
26598 {|
26599 |
26600 | align="center" |
26601 |
26602 |}
26603
26604 {|
26605 | {{!}}{{!}} align="center" | ||
26606 |}
26607
26608 {|
26609 ! !! align="center" | !!
26610 |}
26611 !! html/php+tidy
26612 <table>
26613 <tbody><tr>
26614 <td></td>
26615 <td align="center"></td>
26616 <td>
26617 </td></tr></tbody></table>
26618 <table>
26619 <tbody><tr>
26620 <td>
26621 </td>
26622 <td align="center">
26623 </td>
26624 <td>
26625 </td></tr></tbody></table>
26626 <table>
26627 <tbody><tr>
26628 <td></td>
26629 <td align="center"></td>
26630 <td>
26631 </td></tr></tbody></table>
26632 <table>
26633 <tbody><tr>
26634 <th></th>
26635 <th align="center"></th>
26636 <th>
26637 </th></tr></tbody></table>
26638 !! end
26639
26640 !! test
26641 T97430: Don't emit empty nowiki pairs around marker meta tags
26642 !! options
26643 parsoid=html2wt
26644 !! html/parsoid
26645 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26646 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
26647 !! wikitext
26648 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26649 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
26650 !! end
26651
26652 !! test
26653 Unclosed xmlish element in table line shouldn't eat end delimiters
26654 !! options
26655 parsoid=html2wt
26656 !! html/parsoid
26657 <table>
26658 <tbody><tr><td> &lt;foo</td>
26659 <td> bar></td></tr>
26660 </tbody></table>
26661 !! wikitext
26662 {|
26663 | <foo
26664 | bar>
26665 |}
26666 !! html/php
26667 <table>
26668 <tr>
26669 <td>&lt;foo
26670 </td>
26671 <td>bar&gt;
26672 </td></tr></table>
26673 !! end
26674
26675 #### --------------- Links ----------------
26676 #### 1. Quote marks in link text
26677 #### 2. Wikilinks: Escapes needed
26678 #### 3. Wikilinks: No escapes needed
26679 #### 4. Extlinks: Escapes needed
26680 #### 5. Extlinks: No escapes needed
26681 #### --------------------------------------
26682 !! test
26683 Links 1. WikiLinks: No escapes needed
26684 !! options
26685 parsoid=html2wt
26686 !! html/parsoid
26687 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
26688 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
26689 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
26690 !! wikitext
26691 [[Foo|Foo''boo'']]
26692 [[Foo|[Foobar]]]
26693 [[Foo|x [Foobar] x]]
26694 !! html/php
26695 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
26696 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
26697 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
26698 </p>
26699 !! end
26700
26701 !! test
26702 Links 2. WikiLinks: Escapes needed
26703 !! options
26704 parsoid=html2wt
26705 !! html/parsoid
26706 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
26707 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
26708 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
26709 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
26710 <a href="Foo" rel="mw:WikiLink">|Bar</a>
26711 <a href="Foo" rel="mw:WikiLink">]]bar</a>
26712 <a href="Foo" rel="mw:WikiLink">[[bar</a>
26713 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
26714 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
26715 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
26716 !! wikitext
26717 [[Foo|<nowiki>Foobar]</nowiki>]]
26718 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
26719 [[Foo|<nowiki>[[Bar]]</nowiki>]]
26720 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
26721 [[Foo||Bar]]
26722 [[Foo|<nowiki>]]bar</nowiki>]]
26723 [[Foo|<nowiki>[[bar</nowiki>]]
26724 [[Foo|<nowiki>x [[ y</nowiki>]]
26725 [[Foo|<nowiki>x ]] y</nowiki>]]
26726 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
26727 !! html/php
26728 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
26729 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
26730 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
26731 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
26732 <a href="/wiki/Foo" title="Foo">|Bar</a>
26733 <a href="/wiki/Foo" title="Foo">]]bar</a>
26734 <a href="/wiki/Foo" title="Foo">[[bar</a>
26735 <a href="/wiki/Foo" title="Foo">x [[ y</a>
26736 <a href="/wiki/Foo" title="Foo">x ]] y</a>
26737 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
26738 </p>
26739 !! end
26740
26741 !! test
26742 Links 3. WikiLinks: No escapes needed
26743 !! options
26744 parsoid=html2wt
26745 !! html/parsoid
26746 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
26747 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
26748 !! wikitext
26749 [[Foo|[Foobar]]
26750 [[Foo|foo|bar]]
26751 !! html/php
26752 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
26753 <a href="/wiki/Foo" title="Foo">foo|bar</a>
26754 </p>
26755 !! end
26756
26757 !! test
26758 Links 4. ExtLinks: Escapes needed
26759 !! options
26760 parsoid=html2wt
26761 !! html/parsoid
26762 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
26763 <a rel="mw:ExtLink" href="http://google.com">google]</a>
26764 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
26765 <p>[http://google.com]</p>
26766 <p>[http://google.com google]</p>
26767 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
26768 <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>
26769 !! wikitext
26770 [http://google.com <nowiki>[google]</nowiki>]
26771 [http://google.com <nowiki>google]</nowiki>]
26772 [http://google.com <nowiki>goog] le</nowiki>]
26773
26774 <nowiki>[http://google.com]</nowiki>
26775
26776 <nowiki>[http://google.com google]</nowiki>
26777
26778 [http://google.com<nowiki>]</nowiki>
26779
26780 [{{echo|http://google.com}}<nowiki>]</nowiki>
26781 !! html/php
26782 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
26783 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
26784 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
26785 </p><p>[http://google.com]
26786 </p><p>[http://google.com google]
26787 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26788 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26789 </p>
26790 !! end
26791
26792 !! test
26793 Links 5. ExtLinks: No escapes needed
26794 !! options
26795 parsoid=html2wt
26796 !! html/parsoid
26797 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
26798 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
26799 !! wikitext
26800 [http://google.com [google]
26801
26802 [[http://google.com]]
26803 !! html/php
26804 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
26805 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
26806 </p>
26807 !! end
26808
26809 !! test
26810 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
26811 !! options
26812 parsoid=html2wt
26813 !! html/parsoid
26814 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
26815 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
26816 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
26817 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
26818 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
26819 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
26820 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26821 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
26822 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26823 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
26824 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
26825 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
26826 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
26827 </p>
26828 !! wikitext
26829 x<nowiki/>http://example.com<nowiki/>y
26830 http://example.com<nowiki/>?x
26831 http://example.com<nowiki/>&x
26832 http://example.com<nowiki/>'x
26833 http://example.com<nowiki/>,x
26834 http://example.com<nowiki/>.x
26835 http://example.com<nowiki/>;x
26836 http://example.com<nowiki/>:x
26837 http://example.com<nowiki/>;x
26838 http://example.com<nowiki/>!x
26839 http://example.com<nowiki/>=x
26840 http://example.com<nowiki/>(x)
26841 http://example.com(x<nowiki/>)
26842 !! end
26843
26844 !! test
26845 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26846 !! options
26847 parsoid=html2wt
26848 !! html/parsoid
26849 <p>x
26850 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
26851 y
26852 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
26853 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
26854 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
26855 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
26856 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
26857 </p>
26858 !! wikitext
26859 x
26860 http://example.com
26861 y
26862 "http://example.com"
26863 (http://example.com)
26864 (http://example.com) foo
26865 http://example.com,
26866 http://example.com, foo
26867 !! html/php
26868 <p>x
26869 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
26870 y
26871 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
26872 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
26873 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
26874 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
26875 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
26876 </p>
26877 !! end
26878
26879 !! test
26880 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26881 !! options
26882 parsoid=html2wt
26883 !! html/parsoid
26884 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
26885 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
26886 !! wikitext
26887 http://example.com.,;:!?\
26888 -http://example.com:
26889 !! html/php
26890 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
26891 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
26892 </p>
26893 !! end
26894
26895 !! test
26896 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
26897 !! options
26898 parsoid=html2wt
26899 !! html/parsoid
26900 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
26901 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
26902 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
26903 !! wikitext
26904 RFC 123<nowiki/>4
26905 RFC 123<nowiki/>y
26906 X<nowiki/>RFC 123<nowiki/>y
26907 !! end
26908
26909 !! test
26910 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
26911 !! options
26912 parsoid=html2wt
26913 !! html/parsoid
26914 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
26915 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
26916 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
26917 </p>
26918 !! wikitext
26919 RFC 123?foo
26920 RFC 123&foo
26921 -RFC 123-
26922 !! html/php
26923 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
26924 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
26925 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
26926 </p>
26927 !! end
26928
26929 !! test
26930 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
26931 !! options
26932 parsoid=html2wt
26933 !! html/parsoid
26934 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
26935 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26936 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26937 !! wikitext
26938 PMID 123<nowiki/>4
26939 PMID 123<nowiki/>y
26940 X<nowiki/>PMID 123<nowiki/>y
26941 !! end
26942
26943 !! test
26944 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
26945 !! options
26946 parsoid=html2wt
26947 !! html/parsoid
26948 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
26949 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
26950 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
26951 </p>
26952 !! wikitext
26953 PMID 123?foo
26954 PMID 123&foo
26955 -PMID 123-
26956 !! html/php
26957 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
26958 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
26959 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
26960 </p>
26961 !! end
26962
26963 !! test
26964 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
26965 !! options
26966 parsoid=html2wt
26967 !! html/parsoid
26968 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
26969 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
26970 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
26971 </p>
26972 !! wikitext
26973 ISBN 1234567890<nowiki/>1
26974 ISBN 1234567890<nowiki/>x
26975 a<nowiki/>ISBN 1234567890<nowiki/>b
26976 !! end
26977
26978 !! test
26979 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
26980 !! options
26981 parsoid=html2wt
26982 !! html/parsoid
26983 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26984 !! wikitext
26985 -ISBN 1234567890's
26986 !! html/php
26987 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26988 </p>
26989 !! end
26990
26991 !! test
26992 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26993 !! options
26994 parsoid=html2wt
26995 !! html/*
26996 <p>this is not a link: http://example.com
26997 </p>
26998 !! wikitext
26999 this is not a link: <nowiki>http://example.com</nowiki>
27000 !! end
27001
27002 !! test
27003 Links 15. Link trails can't become link prefixes.
27004 !! options
27005 language=is
27006 parsoid=html2wt
27007 !! html/parsoid
27008 <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>
27009 !! wikitext
27010 [[Söfnuður]]-[[00]]
27011 !! html/php
27012 <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>
27013 </p>
27014 !! end
27015
27016 #### --------------- Quotes ---------------
27017 #### 1. Quotes inside <b> and <i>
27018 #### 2. Link fragments separated by <i> and <b> tags
27019 #### 3. Link fragments inside <i> and <b>
27020 #### 4. No escaping needed
27021 #### --------------------------------------
27022 !! test
27023 1a. Quotes inside <b> and <i>
27024 !! options
27025 parsoid=html2wt
27026 !! html/*
27027 <p><i>'foo'</i>
27028 <i>''foo''</i>
27029 <i>'''foo'''</i>
27030 <i>foo</i>'s
27031 <b>'foo'</b>
27032 <b>''foo''</b>
27033 <b>'''foo'''</b>
27034 <b>foo'<i>bar'</i>baz</b>
27035 <b>foo</b>'s
27036 '<i>foo</i>
27037 <i>foo</i>'
27038 <i>foo'</i>'
27039 '<i>foo</i>'
27040 '<b>foo</b>
27041 <b>foo</b>'
27042 '<b>foo</b>'
27043 <i>fools'<span> errand</span></i>
27044 <i><span>fool</span>'s errand</i>
27045 '<i>foo</i> bar '<i>baz</i>
27046 a|!*#-:;+-~[]{}b'<i>x</i>
27047 </p>
27048 !! wikitext
27049 ''<nowiki/>'foo'''
27050 ''<nowiki>''foo''</nowiki>''
27051 ''<nowiki>'''foo'''</nowiki>''
27052 ''foo''<nowiki/>'s
27053 '''<nowiki/>'foo''''
27054 '''<nowiki>''foo''</nowiki>'''
27055 '''<nowiki>'''foo'''</nowiki>'''
27056 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
27057 '''foo'''<nowiki/>'s
27058 '''foo''
27059 ''foo''<nowiki/>'
27060 ''foo'''<nowiki/>'
27061 '''foo''<nowiki/>'
27062 ''''foo'''
27063 '''foo'''<nowiki/>'
27064 ''''foo'''<nowiki/>'
27065 ''fools'<span> errand</span>''
27066 ''<span>fool</span>'s errand''
27067 '<nowiki/>''foo'' bar '''baz''
27068 a|!*#-:;+-~[]{}b'''x''
27069 !! end
27070
27071 !! test
27072 1b. Quotes inside <b> and <i> with other tags on same line
27073 !! options
27074 parsoid=html2wt
27075 !! html/parsoid
27076 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
27077 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
27078 <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>
27079 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
27080 '<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>
27081 '<i>foo</i> <div title="name">test</div>
27082 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
27083 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
27084 <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>
27085 </ol>
27086 !! wikitext
27087 '''a'' foo ''[[bar]]''
27088 ''a''' foo ''[[bar]]''
27089 ''a''' foo '''{{echo|[[bar]]}}'''
27090 [[foo]] x'''[[bar]]''
27091 '''foo'' <ref>test</ref>
27092 '''foo'' <div title="name">test</div>
27093 '''foo'' and <br> bar
27094 <references />
27095 !! end
27096
27097 !! test
27098 2. Link fragments separated by <i> and <b> tags
27099 !! options
27100 parsoid=html2wt
27101 !! html/parsoid
27102 <p>[[<i>foo</i>hello]]</p>
27103 <p>[[<b>foo</b>hello]]</p>
27104 !! wikitext
27105 [[''foo''<nowiki>hello]]</nowiki>
27106
27107 [['''foo'''<nowiki>hello]]</nowiki>
27108 !! end
27109
27110 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
27111 # this is one of the shortcomings of this format
27112 !! test
27113 3. Link fragments inside <i> and <b>
27114 !! options
27115 parsoid=html2wt
27116 !! html/parsoid
27117 <p><i>[[foo</i>]]</p>
27118 <p><b>[[foo</b>]]</p>
27119 !! wikitext
27120 ''[[foo''<nowiki>]]</nowiki>
27121
27122 '''[[foo'''<nowiki>]]</nowiki>
27123 !! end
27124
27125 !! test
27126 4. No escaping needed
27127 !! options
27128 parsoid=html2wt
27129 !! html/parsoid
27130 <p>'<span><i>bar</i></span>'
27131 '<span><b>bar</b></span>'
27132 'a:b'foo
27133 </p>
27134 !! wikitext
27135 '<span>''bar''</span>'
27136 '<span>'''bar'''</span>'
27137 'a:b'foo
27138 !! end
27139
27140 #### ----------- Paragraphs ---------------
27141 #### 1. No unnecessary escapes
27142 #### --------------------------------------
27143
27144 !! test
27145 1. No unnecessary escapes
27146 !! options
27147 parsoid=html2wt
27148 !! html/parsoid
27149 <p>bar <span>[[foo]]</span>
27150 </p><p>=bar <span>[[foo]]</span>
27151 </p><p>[[bar <span>[[foo]]</span>
27152 </p><p>]]bar <span>[[foo]]</span>
27153 </p><p>=bar <span>foo]]</span>=
27154 </p>
27155 !! wikitext
27156 bar <span><nowiki>[[foo]]</nowiki></span>
27157
27158 =bar <span><nowiki>[[foo]]</nowiki></span>
27159
27160 [[bar <span><nowiki>[[foo]]</nowiki></span>
27161
27162 ]]bar <span><nowiki>[[foo]]</nowiki></span>
27163
27164 =bar <span>foo]]</span><nowiki>=</nowiki>
27165 !!end
27166
27167 #### ----------------------- PRE --------------------------
27168 !! test
27169 1. Leading whitespace in SOL context should be escaped
27170 !! options
27171 parsoid=html2wt
27172 !! html/parsoid
27173 <p> a</p>
27174
27175 <p> a</p>
27176
27177 <p> a(tab)</p>
27178
27179 <p> a
27180 <!--cmt-->
27181 a</p>
27182
27183 <p>a
27184 b</p>
27185
27186 <p>a
27187 b</p>
27188
27189 <p>a
27190 b</p>
27191 !! wikitext
27192 <nowiki> </nowiki>a
27193
27194 <nowiki> </nowiki> a
27195
27196 a(tab)
27197
27198 <nowiki> </nowiki> a
27199 <!--cmt-->
27200 <nowiki> </nowiki>a
27201
27202 a
27203 <nowiki> </nowiki>b
27204
27205 a
27206 b
27207
27208 a
27209 b
27210 !! html/php
27211 <p> a
27212 </p><p> a
27213 </p><p> a(tab)
27214 </p><p> a
27215 a
27216 </p><p>a
27217 b
27218 </p><p>a
27219 b
27220 </p><p>a
27221 b
27222 </p>
27223 !! end
27224
27225 !! test
27226 2. Leading whitespace in non-indent-pre contexts should not be escaped
27227 !! options
27228 parsoid=html2wt
27229 !! html/parsoid
27230 <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>
27231 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
27232 <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>
27233 b</span></li>
27234 </ol>
27235 !! wikitext
27236 foo <ref>''a''
27237 b</ref>
27238 <references />
27239 !! end
27240
27241 !! test
27242 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
27243 !! options
27244 parsoid=html2wt
27245 !! html/parsoid
27246 <blockquote>
27247 <p>
27248 a
27249 <span>b</span>
27250 c</p>
27251 </blockquote>
27252 !! wikitext
27253 <blockquote>
27254 a
27255 <span>b</span>
27256 c
27257 </blockquote>
27258 !! end
27259
27260 !! test
27261 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
27262 !! options
27263 parsoid=html2wt
27264 !! html/parsoid
27265 <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>
27266 !! wikitext
27267 [[File:Foobar.jpg|thumb|caption]]
27268 !! end
27269
27270 !! test
27271 5. Nowiki escaping should account for indent-pres
27272 !! options
27273 parsoid=html2wt
27274 !! html/parsoid
27275 <pre>==foo==</pre>
27276 !! wikitext
27277 ==foo==
27278 !! end
27279
27280 !! test
27281 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
27282 !! options
27283 parsoid=html2wt
27284 !! html/parsoid
27285 <pre>
27286 * foo
27287 * bar
27288 </pre>
27289 !! wikitext
27290 * foo
27291 * bar
27292 !! end
27293
27294 !! test
27295 Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup
27296 !! options
27297 parsoid = {
27298 "modes": ["html2wt"],
27299 "scrubWikitext": true
27300 }
27301 !! html/parsoid
27302 <p> foo</p>
27303 <p> %foo</p>
27304 <p> *foo</p>
27305 <p> #foo</p>
27306 <p> =foo=</p>
27307 <p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p>
27308 <p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p>
27309 <p> <!--boo-->*foo</p>
27310 <p><!--boo--> *foo</p>
27311 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p>
27312 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p>
27313 !! wikitext
27314 foo
27315
27316 %foo
27317
27318 <nowiki/>*foo
27319
27320 <nowiki/>#foo
27321
27322 <nowiki/>=foo=
27323
27324 [[Category:Foo]]
27325 <nowiki/>*foo
27326
27327 [[Category:Foo]]
27328 <nowiki>*</nowiki>foo
27329
27330 <nowiki/><!--boo-->*foo
27331
27332 <!--boo--><nowiki/>*foo
27333
27334 <!--a--><!--b--><!--c--><!--d--><!--e-->foo
27335
27336 <!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo
27337 !! end
27338
27339 #### --------------- Behavior Switches --------------------
27340
27341 !! test
27342 1. Valid behavior switches should be escaped
27343 !! options
27344 parsoid=html2wt
27345 !! html/parsoid
27346 __TOC__
27347 <i>__TOC__</i>
27348 !! wikitext
27349 <nowiki>__TOC__</nowiki>
27350 ''<nowiki>__TOC__</nowiki>''
27351 !! end
27352
27353 !! test
27354 2. Invalid behavior switches should not be escaped
27355 !! options
27356 parsoid=html2wt
27357 !! html/parsoid
27358 __TOO__
27359 __|__
27360 !! wikitext
27361 __TOO__
27362 __|__
27363 !! end
27364
27365 # We use indent-pre as an indirect way to test for sol-transparent behavior.
27366 !! test
27367 Behavior switches should be SOL-transparent
27368 !! options
27369 parsoid=html2wt
27370 !! html/parsoid
27371 <meta property="mw:PageProp/toc" />
27372
27373 <!-- this one's bogus -->
27374 <pre>__TOO__</pre>
27375
27376 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
27377
27378 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
27379 !! wikitext
27380 __TOC__
27381
27382 <!-- this one's bogus -->
27383 __TOO__
27384
27385 __TOC__ foo
27386
27387 __TOC__
27388 bar
27389 !! end
27390
27391 #### --------------- HTML tags ---------------
27392 #### 1. a tags
27393 #### 2. other tags
27394 #### 3. multi-line html tag
27395 #### 4. extension tags
27396 #### -----------------------------------------
27397 !! test
27398 1. a tags
27399 !! options
27400 parsoid=html2wt
27401 !! html/parsoid
27402 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
27403 !! wikitext
27404 <a href="http://google.com">google</a>
27405 !! end
27406
27407 !! test
27408 2. other tags
27409 !! options
27410 parsoid=html2wt
27411 !! html/parsoid
27412 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
27413 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
27414 <li> &lt;td&gt;</li></ul>
27415
27416 !! wikitext
27417 * <nowiki><div>foo</div></nowiki>
27418 * <nowiki><div style="color:red">foo</div></nowiki>
27419 * <nowiki><td></nowiki>
27420 !! end
27421
27422 !! test
27423 3. multi-line html tag
27424 !! options
27425 parsoid=html2wt
27426 !! html/parsoid
27427 <p>&lt;div
27428 &gt;foo&lt;/div
27429 &gt;
27430 </p>
27431 !! wikitext
27432 <nowiki><div
27433 >foo</div
27434 ></nowiki>
27435 !! end
27436
27437 !! test
27438 4. extension tags
27439 !! options
27440 parsoid=html2wt
27441 !! html/parsoid
27442 <p>&lt;ref&gt;foo&lt;/ref&gt;
27443 </p><p>&lt;ref&gt;bar
27444 </p><p>baz&lt;/ref&gt;
27445 </p>
27446 !! wikitext
27447 <nowiki><ref>foo</ref></nowiki>
27448
27449 <nowiki><ref>bar</nowiki>
27450
27451 baz<nowiki></ref></nowiki>
27452 !! end
27453
27454 !! test
27455 Parsoid: newline inducing block nodes don't suppress <nowiki>
27456 !! options
27457 parsoid=html2wt
27458 !! html/parsoid
27459 a<h1>foo</h1>
27460 !! wikitext
27461 <nowiki> </nowiki>a
27462
27463 = foo =
27464 !! end
27465
27466 #### --------------- Others ---------------
27467 !! test
27468 Escaping nowikis
27469 !! options
27470 parsoid=html2wt
27471 !! html/parsoid
27472 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
27473 </p>
27474 !! wikitext
27475 &lt;nowiki&gt;foo&lt;/nowiki&gt;
27476 !! end
27477
27478 ## The quote-char in the input is necessary for triggering the bug
27479 !! test
27480 (T54035) Nowiki-escaping should not get tripped by " :" in text
27481 !! options
27482 parsoid=html2wt
27483 !! html/parsoid
27484 <p>foo's bar :</p>
27485 !! wikitext
27486 foo's bar :
27487 !! end
27488
27489 #----------- End of wikitext escaping tests --------------
27490
27491 !! test
27492
27493 Tag-like HTML structures are passed through as text
27494 !! wikitext
27495 <x y>
27496
27497 <x.y>
27498
27499 <x-y>
27500
27501 1>2
27502
27503 x<y
27504
27505 a>b
27506
27507 1<d e>f
27508 !! html
27509 <p>&lt;x y&gt;
27510 </p><p>&lt;x.y&gt;
27511 </p><p>&lt;x-y&gt;
27512 </p><p>1&gt;2
27513 </p><p>x&lt;y
27514 </p><p>a&gt;b
27515 </p><p>1&lt;d e&gt;f
27516 </p>
27517 !! end
27518
27519 !! test
27520 HTML tag with necessary entities in attributes
27521 !! wikitext
27522 <span title="&amp;amp;">foo</span>
27523 !! html
27524 <p><span title="&amp;amp;">foo</span>
27525 </p>
27526 !! end
27527
27528 !! test
27529 HTML tag with 'unnecessary' entity encoding in attributes
27530 !! wikitext
27531 <span title="&amp;">foo</span>
27532 !! html
27533 <p><span title="&amp;">foo</span>
27534 </p>
27535 !! end
27536
27537 !! test
27538 HTML tag with broken attribute value quoting
27539 !! options
27540 parsoid=wt2html,html2html
27541 !! wikitext
27542 <span title="Hello world>Foo</span>
27543 !! html/php
27544 <p><span title="Hello world">Foo</span>
27545 </p>
27546 !! html/parsoid
27547 <p><span title="Hello world">Foo</span></p>
27548 !! end
27549
27550 !! test
27551 Self-closed tag with broken attribute value quoting
27552 !! options
27553 parsoid=wt2html,html2html
27554 !! wikitext
27555 <div title="Hello world />Foo
27556 !! html/php+tidy
27557 <div title="Hello world"></div><p>Foo</p>
27558 !! html/parsoid
27559 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
27560 !! end
27561
27562 !! test
27563 Table with broken attribute value quoting
27564 !! options
27565 parsoid=wt2html,html2html
27566 !! wikitext
27567 {|
27568 | title="Hello world|Foo
27569 |}
27570 !! html/php
27571 <table>
27572 <tr>
27573 <td title="Hello world">Foo
27574 </td></tr></table>
27575 !! html/parsoid
27576 <table>
27577 <tr>
27578 <td title="Hello world">Foo
27579 </td></tr></table>
27580 !! end
27581
27582 !! test
27583 Table with broken attribute value quoting on consecutive lines
27584 !! options
27585 parsoid=wt2html,html2html
27586 !! wikitext
27587 {|
27588 | title="Hello world|Foo
27589 | style="color:red|Bar
27590 |}
27591 !! html/php
27592 <table>
27593 <tr>
27594 <td title="Hello world">Foo
27595 </td>
27596 <td style="color:red">Bar
27597 </td></tr></table>
27598 !! html/parsoid
27599 <table><tbody>
27600 <tr>
27601 <td title="Hello world">Foo
27602 </td><td style="color: red">Bar
27603 </td></tr></tbody></table>
27604 !! end
27605
27606 !!test
27607 Accept empty td cell attribute
27608 !! wikitext
27609 {|
27610 | align="center" |foo|| |
27611 |}
27612 !! html
27613 <table>
27614 <tr>
27615 <td align="center">foo</td>
27616 <td>
27617 </td></tr></table>
27618 !! end
27619
27620 !!test
27621 Non-empty attributes in th-cells
27622 !! wikitext
27623 {|
27624 !Foo!! style="color: red" |Bar
27625 |}
27626 !! html
27627 <table>
27628 <tr>
27629 <th>Foo</th>
27630 <th style="color: red">Bar
27631 </th></tr></table>
27632 !! end
27633
27634 !!test
27635 Accept empty attributes in th-cells
27636 !! wikitext
27637 {|
27638 !|foo!!|bar
27639 |}
27640 !! html
27641 <table>
27642 <tr>
27643 <th>foo</th>
27644 <th>bar
27645 </th></tr></table>
27646 !! end
27647
27648 !!test
27649 Empty table rows go away
27650 !! wikitext
27651 {|
27652 |Hello
27653 |there
27654 |- class="foo"
27655 |-
27656 |}
27657 !! html
27658 <table>
27659 <tr>
27660 <td>Hello
27661 </td>
27662 <td>there
27663 </td></tr>
27664
27665 </table>
27666 !! end
27667
27668 ###
27669 ### Parsoid-centric tests for testing RTing of inter-element separators
27670 ### Edge cases not tested by existing parser tests and specific to
27671 ### Parsoid-specific serialization strategies.
27672 ###
27673
27674 !!test
27675 RT-ed inter-element separators should be valid separators
27676 !! wikitext
27677 {|
27678 |- [[foo]]
27679 |}
27680 !! html/php
27681 <table>
27682
27683 </table>
27684 !! html/parsoid
27685 <table>
27686 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
27687 </tbody></table>
27688 !!end
27689
27690 # Parsoid-only test of a DOM pass
27691 !!test
27692 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
27693 !! wikitext
27694 {|
27695 |<small>foo
27696 bar
27697 |}
27698
27699 {|
27700 |<small>foo<small>
27701 |}
27702 !! html/parsoid
27703 <table>
27704 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
27705 <p>bar</p></small></td></tr>
27706 </tbody></table>
27707
27708 <table>
27709 <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>
27710 </tbody></table>
27711 !!end
27712
27713 # Note that the "style" attribute is really a template parameter here.
27714 # The = would have to be {{=}} if you wanted the literal.
27715 !!test
27716 Empty TD followed by TD with tpl-generated attribute
27717 !! wikitext
27718 {|
27719 |-
27720 |
27721 |{{echo|style='color:red'}}|foo
27722 |}
27723 !! html
27724 <table>
27725
27726 <tr>
27727 <td>
27728 </td>
27729 <td>foo
27730 </td></tr></table>
27731 !! end
27732
27733 !!test
27734 Indented table with an empty td
27735 !! wikitext
27736 {|
27737 |-
27738 |
27739 |foo
27740 |}
27741 !! html
27742 <table>
27743
27744 <tr>
27745 <td>
27746 </td>
27747 <td>foo
27748 </td></tr></table>
27749 !! end
27750
27751 !! test
27752 Indented table with blank lines in between (T85627)
27753 !! wikitext
27754 {|
27755 |foo
27756
27757
27758 |}
27759 !! html/php
27760 <table>
27761 <tr>
27762 <td>foo
27763 <p><br />
27764 </p>
27765 </td></tr></table>
27766 !! html/parsoid
27767 <table>
27768 <tbody><tr><td>foo
27769 <p>
27770 <br /></p></td></tr>
27771 </tbody></table>
27772 !! end
27773
27774 !!test
27775 Indented block & table
27776 !! wikitext
27777 <div>foo</div>
27778 {|
27779 |foo
27780 |}
27781 !! html/php
27782 <div>foo</div>
27783 <table>
27784 <tr>
27785 <td>foo
27786 </td></tr></table>
27787 !! html/parsoid
27788 <div data-parsoid='{"stx":"html"}'>foo</div>
27789 <table><tbody>
27790 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
27791 </tbody></table>
27792 !!end
27793
27794 !! test
27795 Indent and comment before table row
27796 !! wikitext
27797 {|
27798 <!--hi-->|-
27799 |there
27800 |}
27801 !! html/php
27802 <table>
27803
27804 <tr>
27805 <td>there
27806 </td></tr></table>
27807 !! html/parsoid
27808 <table>
27809 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
27810 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
27811 </tbody></table>
27812 !! end
27813
27814 # PHP parser omits empty TR
27815 !!test
27816 Empty TR followed by a template-generated TR
27817 !! wikitext
27818 {|
27819 |-
27820 {{echo|<tr><td>foo</td></tr>}}
27821 |}
27822 !! html/php+tidy
27823 <table>
27824
27825 <tbody><tr><td>foo</td></tr>
27826 </tbody></table>
27827 !! html/parsoid
27828 <table>
27829 <tbody>
27830 <tr class='mw-empty-elt'></tr>
27831 <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}}]}'>
27832 <td>foo</td></tr>
27833 </tbody></table>
27834 !!end
27835
27836 ## PHP and parsoid output differ for this; as usual PHP omits empty
27837 ## elements, and since it strips the comments the TR is empty.
27838 !!test
27839 Empty TR followed by mixed-ws-comment line should RT correctly
27840 !! wikitext
27841 {|
27842 |-
27843 <!--c-->
27844 |-
27845 <!--c--> <!--d-->
27846 |}
27847 !! html/php+tidy
27848 <table>
27849
27850
27851 </table>
27852 !! html/parsoid
27853 <table>
27854 <tbody>
27855 <tr class='mw-empty-elt'></tr>
27856 <!--c-->
27857 <tr>
27858 <!--c--> </tr><!--d-->
27859 </tbody></table>
27860 !! end
27861
27862 !!test
27863 Multi-line image caption generated by templates with/without trailing newlines
27864 !! wikitext
27865 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
27866 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
27867 !! html/parsoid
27868 <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>
27869 <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>
27870 !!end
27871
27872 !! test
27873 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
27874 !! options
27875 parsoid=html2wt
27876 !! html/parsoid
27877 <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>
27878
27879 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
27880 !! wikitext
27881 <includeonly>foo</includeonly>
27882 new para
27883
27884 [[Category:Foo]]
27885
27886 = new heading =
27887 !! end
27888
27889 ## PHP emits broken html for this, and since this is primarily
27890 ## a Parsoid serializer test, marking this Parsoid only
27891 !!test
27892 Improperly nested inline or quotes tags with whitespace in between
27893 !! wikitext
27894 <span> <s>x</span> </s>
27895 ''' ''x''' ''
27896 !! html/parsoid
27897 <p><span> <s>x</s></span><s> </s>
27898 <b> <i>x</i></b><i> </i>
27899 </p>
27900 !!end
27901
27902 !!test
27903 Encapsulate protected attributes from wt
27904 !! wikitext
27905 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
27906
27907 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
27908 |ok
27909 |}
27910 !! html/parsoid
27911 <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>
27912
27913 <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">
27914 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'>ok</td></tr>
27915 </tbody></table>
27916 !!end
27917
27918 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
27919 ## Having nested or stray pre tags results in the attempt to add duplicates,
27920 ## causing an assertion fail. This test tries to prevent that situation.
27921 !! test
27922 Ensure ParagraphWrapper can deal with stray closing pre tags
27923 !! options
27924 parsoid=wt2html
27925 !! wikitext
27926 plain text</pre>
27927 !! html/parsoid
27928 <p>plain text</p>
27929 !! end
27930
27931 ## Remex doesn't account for fostered content.
27932 !! test
27933 1. Ensure fostered text content is wrapped in element nodes
27934 !! options
27935 parsoid=wt2html
27936 !! wikitext
27937 <table>hi</table><table>ho</table>
27938 !! html/php+tidy
27939 hi<table></table>ho<table></table>
27940 !! html/parsoid
27941 <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>
27942 !! end
27943
27944 ## Remex doesn't account for fostered content.
27945 !! test
27946 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
27947 !! options
27948 parsoid=wt2html,wt2wt
27949 !! wikitext
27950 <table>
27951 <tr> || ||
27952 <td> a
27953 </table>
27954 !! html/php+tidy
27955 || ||
27956 <table>
27957 <tbody><tr><td> a
27958 </td></tr></tbody></table>
27959 !! html/parsoid
27960 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||</p>
27961 <table data-parsoid='{"stx":"html"}'>
27962 <tbody><tr data-parsoid='{"stx":"html","autoInsertedEnd":true}'><td data-parsoid='{"stx":"html","autoInsertedEnd":true}'> a
27963 </td></tr></tbody></table>
27964 !! end
27965
27966 ## Remex doesn't account for fostered content.
27967 !! test
27968 Encapsulation properly handles null DSR information from foster box
27969 !! options
27970 parsoid=wt2html,wt2wt
27971 !! wikitext
27972 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
27973 !! html/parsoid
27974 <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>
27975 !! end
27976
27977 ## Remex doesn't account for fostered content.
27978 !! test
27979 1. Encapsulate foster-parented transclusion content
27980 !! options
27981 parsoid=wt2wt,wt2html
27982 !! wikitext
27983 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
27984 !! html/php+tidy
27985 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
27986 !! html/parsoid
27987 <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>
27988 !! end
27989
27990 !! test
27991 2. Encapsulate foster-parented transclusion content
27992 !! options
27993 parsoid=wt2wt,wt2html
27994 !! wikitext
27995 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
27996 !! html/parsoid
27997 <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>
27998 <table>
27999 <tbody>
28000 <tr>
28001 <td>bar</td>
28002 </tr>
28003 </tbody>
28004 </table>
28005 !! end
28006
28007 !! test
28008 3. Encapsulate foster-parented transclusion content
28009 !! options
28010 parsoid=wt2wt,wt2html
28011 !! wikitext
28012 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
28013 !! html/parsoid
28014 <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;]}">
28015 <p>foo</p>
28016 </div>
28017 <table>
28018 <tbody>
28019 <tr>
28020 <td>bar</td>
28021 </tr>
28022 </tbody>
28023 </table>
28024 !! end
28025
28026 !! test
28027 4. Encapsulate foster-parented transclusion content
28028 !! options
28029 parsoid=wt2wt,wt2html
28030 !! wikitext
28031 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
28032 !! html/parsoid
28033 <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;]}">
28034 <p>foo</p>
28035 </div>
28036 <table>
28037 <tbody>
28038 <tr>
28039 <td>bar</td>
28040 </tr>
28041 </tbody>
28042 </table>
28043 !! end
28044
28045 ## Remex doesn't account for fostered content.
28046 !! test
28047 5. Encapsulate foster-parented transclusion content
28048 !!options
28049 parsoid=wt2wt,wt2html
28050 !! wikitext
28051 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
28052 !! html/php+tidy
28053 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
28054 !! html/parsoid
28055 <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>
28056 !! end
28057
28058 ## Remex doesn't account for fostered content.
28059 !! test
28060 6. Encapsulate foster-parented transclusion content
28061 !! options
28062 parsoid=wt2wt,wt2html
28063 !! wikitext
28064 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
28065 !! html/php+tidy
28066 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
28067 !! html/parsoid
28068 <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>
28069 !! end
28070
28071 !! test
28072 7. Encapsulate foster-parented transclusion content
28073 !!options
28074 parsoid=wt2wt,wt2html
28075 !! wikitext
28076 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
28077 !! html/parsoid
28078 <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>
28079 <table>
28080 <tbody>
28081 <tr>
28082 <td>bar</td>
28083 </tr>
28084 </tbody>
28085 </table>
28086 !! end
28087
28088 ## Remex doesn't account for fostered content.
28089 # Note that the wt is broken on purpose: the = should be {{=}} if you
28090 # don't want it to be a template parameter key.
28091 !! test
28092 8. Encapsulate foster-parented transclusion content
28093 !! options
28094 parsoid=wt2wt,wt2html
28095 !! wikitext
28096 {{echo|a
28097 }}{|{{echo|style='color:red'}}
28098 |-
28099 |b
28100 |}
28101 !! html/php+tidy
28102 <p>a
28103 </p>
28104 <table>
28105
28106 <tbody><tr>
28107 <td>b
28108 </td></tr></tbody></table>
28109 !! html/parsoid
28110 <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">
28111 </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">
28112 <tbody><tr>
28113 <td>b
28114 </td></tr></tbody></table>
28115 !! end
28116
28117 ## Remex doesn't account for fostered content.
28118 !! test
28119 9. Encapsulate foster-parented transclusion content
28120 !!options
28121 parsoid=wt2wt,wt2html
28122 !! wikitext
28123 <table>{{echo|hi</table>hello}}
28124 !! html/php+tidy
28125 hi<table></table><p>hello</p>
28126 !! html/parsoid
28127 <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>
28128 !! end
28129
28130 !! test
28131 Table in fosterable position
28132 !!options
28133 parsoid=wt2html
28134 !! wikitext
28135 {{OpenTable}}
28136 <div>
28137 {|
28138 |}
28139 </div>
28140 |}
28141 !! html/parsoid
28142 <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">
28143 </span>
28144 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
28145
28146 <table>
28147 </table>
28148 !! end
28149
28150 # Parsoid only for T66747
28151 # (Also core doesn't define {{#if}} in default install)
28152 !! test
28153 Properly encapsulate empty-content transclusions in fosterable positions
28154 !! wikitext
28155 <table>
28156 {{#if:|
28157 <td>foo</td>
28158 }}
28159 </table>
28160 !! html/parsoid
28161 <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"}]]}'>
28162
28163 </table>
28164 !! end
28165
28166 ## No longer captures its original intention
28167 !! test
28168 Always encapsulate foster box when template range is expanded to table
28169 !! options
28170 disabled
28171 parsoid=wt2wt
28172 !! wikitext
28173 {|
28174 hello
28175 {{OpenTable}}
28176 |}
28177 !! html/parsoid
28178 !! end
28179
28180 !! test
28181 T115289: Unclosed table
28182 !! wikitext
28183 {{echo|<table>}}<!--c-->[[Category:Two]]
28184 !! html/parsoid
28185 <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>
28186 !! end
28187
28188 !! test
28189 T115289: Don't migrate newlines out of tables with fostered content
28190 !! wikitext
28191 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
28192 !! html/parsoid
28193 <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>
28194 !! end
28195
28196 !! test
28197 T73074: More fostering fun
28198 !! wikitext
28199 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
28200 !! html/parsoid
28201 <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>
28202 !! end
28203
28204 !!test
28205 Support <object> element with .data attribute
28206 !!options
28207 parsoid=html2wt
28208 !! html/parsoid
28209 <object data="test.swf"></object>
28210 !! wikitext
28211 <object data="test.swf"></object>
28212 !!end
28213
28214 !! test
28215 Don't block XML namespace declaration
28216 !! wikitext
28217 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
28218 !! html/php
28219 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
28220 </p>
28221 !! html/parsoid
28222 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
28223 !! end
28224
28225 # -----------------------------------------------------------------
28226 # The following section of tests are primarily to spec requirements
28227 # around Parsoid's serialization (old, new, edited content)
28228 #
28229 # All these tests are marked Parsoid html2wt and html2html only
28230 # ----------------------------------------------------------------
28231
28232 !! test
28233 Ignore rel attribute in a-tags during serialization to url-links
28234 !! options
28235 parsoid=html2wt
28236 !! html/parsoid
28237 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
28238 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
28239 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
28240 !! wikitext
28241 http://en.wikipedia.org/wiki/Foobar
28242 http://en.wikipedia.org/wiki/Foobar
28243 http://en.wikipedia.org/wiki/Foobar
28244 !! end
28245
28246 # 'mi' is a localinterwiki prefix as well as a language
28247 !! test
28248 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
28249 !! options
28250 parsoid=html2wt
28251 !! html/parsoid
28252 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
28253 !! wikitext
28254 [[Foo]]
28255 !! end
28256
28257 !! test
28258 Parsoid should accept interwiki shortcuts
28259 !! options
28260 parsoid=html2wt
28261 !! html/parsoid
28262 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
28263 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
28264 <a href='./fr:Foo'>Foo</a></p>
28265 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
28266 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
28267 <a href='fr%3AFoo'>Foo</a></p>
28268 <p><a href='FR%3AFoo'>Foo</a>
28269 <a href='./FR:Foo'>Foo</a></p>
28270 !! wikitext
28271 [[:fr:Foo|Foo]]
28272 [[:fr:Foo|Foo]]
28273 [[:fr:Foo|Foo]]
28274
28275 [[:fr:Foo|Foo]]
28276 [[:fr:Foo|Foo]]
28277 [[:fr:Foo|Foo]]
28278
28279 [[:fr:Foo|Foo]]
28280 [[:fr:Foo|Foo]]
28281 !! end
28282
28283 !! test
28284 Parsoid should not accept invalid interwiki shortcuts
28285 !! options
28286 parsoid=html2wt
28287 !! html/parsoid
28288 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
28289 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
28290 <a href='news:Foo'>Foo</a></p>
28291 !! wikitext
28292 [news:Foo Foo]
28293 [news:Foo Foo]
28294 [news:Foo Foo]
28295 !! end
28296
28297 # See T93839
28298 !! test
28299 New wikilinks should be serialized properly
28300 !! options
28301 parsoid=html2wt
28302 !! html/parsoid
28303 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
28304 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
28305 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
28306 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
28307 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
28308 !! wikitext
28309 [[Foo]]
28310 [[Foo]]
28311 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
28312 http://en.wikipedia.org/wiki/Foo
28313 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
28314 !! end
28315
28316 !! test
28317 New wiki links (href variations)
28318 !! options
28319 parsoid=html2wt
28320 !! html/parsoid
28321 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28322 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
28323 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
28324 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
28325 !! wikitext
28326 [[Foo_bar]]
28327 [[Foo_bar]]
28328 [[Foo_bar]]
28329 [[Toxine bactérienne]]
28330 !! end
28331
28332 !! test
28333 New wiki links (content string variations)
28334 !! options
28335 parsoid=html2wt
28336 !! html/parsoid
28337 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28338 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
28339 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
28340 !! wikitext
28341 [[Foo_bar]]
28342 [[Foo bar]]
28343 [[Foo_bar|./Foo_bar]]
28344 !! end
28345
28346 !! test
28347 New category links (href variations)
28348 !! options
28349 parsoid=html2wt
28350 !! html/parsoid
28351 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
28352 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
28353 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
28354 !! wikitext
28355 [[Category:Toxine bactérienne]]
28356 [[Category:Toxine bactérienne]]
28357 [[Category:Toxine bactérienne]]
28358 !! end
28359
28360 !! test
28361 New sol transparent links don't need indent-pre nowiki protection
28362 !! options
28363 parsoid=html2wt
28364 language=de
28365 !! html/parsoid
28366 <link rel="mw:PageProp/redirect" href="./Main_Page">
28367 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
28368 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
28369 !! wikitext
28370 #WEITERLEITUNG [[Main Page]]
28371 <!-- this is good --> [[Category:Good]]
28372 <!-- this is great --> [[Kategorie:Great]]
28373 !! end
28374
28375 !! test
28376 New interlanguage links (href variations)
28377 !! options
28378 parsoid=html2wt
28379 !! html/parsoid
28380 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
28381 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
28382 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
28383 !! wikitext
28384 [[es:Toxine bactérienne]]
28385 [[es:Toxine_bactérienne]]
28386 [[es:Toxine_bactérienne]]
28387 !! end
28388
28389 !! test
28390 Image: Modifying size of an image (1)
28391 !! options
28392 parsoid={
28393 "modes": ["wt2wt"],
28394 "changes": [
28395 ["img[height]", "attr", "height", "22"],
28396 ["img[width]", "attr", "width", "200"]
28397 ]
28398 }
28399 !! wikitext
28400 [[Image:Foobar.jpg|230x230px]]
28401 !! wikitext/edited
28402 [[Image:Foobar.jpg|200x200px]]
28403 !!end
28404
28405 !! test
28406 Image: Modifying size of an image (2)
28407 !! options
28408 parsoid={
28409 "modes": ["wt2wt"],
28410 "changes": [
28411 ["img[height]", "attr", "height", "100"],
28412 ["img[width]", "attr", "width", "500"]
28413 ]
28414 }
28415 !! wikitext
28416 [[Image:Foobar.jpg|230x230px]]
28417 !! wikitext/edited
28418 [[Image:Foobar.jpg|500x500px]]
28419 !!end
28420
28421 # Change in size is ignored so long as class='mw-default-size'
28422 !! test
28423 Image: Modifying size of an image (3)
28424 !! options
28425 parsoid={
28426 "modes": ["wt2wt"],
28427 "changes": [
28428 ["figure[class]", "removeClass", "mw-default-size"],
28429 ["figure img", "attr", "height", "19"],
28430 ["figure img", "attr", "width", "170"]
28431 ]
28432 }
28433 !! wikitext
28434 [[Image:Foobar.jpg|thumb]]
28435 !! wikitext/edited
28436 [[Image:Foobar.jpg|thumb|170x170px]]
28437 !!end
28438
28439 !! test
28440 Image: Modifying alignment of an image (T50665)
28441 !! options
28442 parsoid={
28443 "modes": ["wt2wt"],
28444 "changes": [
28445 ["figure[class]", "removeClass", "mw-halign-right"],
28446 ["figure[class]", "addClass", "mw-halign-left"]
28447 ]
28448 }
28449 !! wikitext
28450 [[Image:Foobar.jpg|thumb|caption|right]]
28451 !! wikitext/edited
28452 [[Image:Foobar.jpg|thumb|caption|left]]
28453 !! end
28454
28455 !! test
28456 Image: Modifying mw-default-size of an frameless image (T64805)
28457 !! options
28458 parsoid={
28459 "modes": ["wt2wt"],
28460 "changes": [
28461 ["figure.mw-default-size", "removeClass", "mw-default-size"]
28462 ]
28463 }
28464 !! wikitext
28465 [[Image:Foobar.jpg|frameless|right]]
28466 !! wikitext/edited
28467 [[Image:Foobar.jpg|frameless|right|220x220px]]
28468 !! end
28469
28470 !! test
28471 Image: Modifying valign of an image (T51221)
28472 !! options
28473 parsoid={
28474 "modes": ["wt2wt"],
28475 "changes": [
28476 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
28477 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
28478 ]
28479 }
28480 !! wikitext
28481 [[File:Foobar.jpg|20px|middle]]
28482 !! wikitext/edited
28483 [[File:Foobar.jpg|20px|text-top]]
28484 !! end
28485
28486 !! test
28487 Image: Modifying alt attribute of an image (T58400)
28488 !! options
28489 disabled
28490 parsoid={
28491 "modes": ["wt2wt"],
28492 "changes": [
28493 ["img[alt]", "attr", "alt", "some alternate edited text"]
28494 ]
28495 }
28496 !! wikitext
28497 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
28498 !! wikitext/edited
28499 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
28500 !!end
28501
28502 !! test
28503 Image: Modifying caption of an image
28504 !! options
28505 parsoid={
28506 "modes": ["wt2wt"],
28507 "changes": [
28508 ["figcaption", "text", "new caption"]
28509 ]
28510 }
28511 !! wikitext
28512 [[Image:Foobar.jpg|thumb|original caption]]
28513 !! wikitext/edited
28514 [[Image:Foobar.jpg|thumb|new caption]]
28515 !!end
28516
28517 !! test
28518 Image: empty alt attribute (T50924)
28519 !! wikitext
28520 [[File:Foobar.jpg|thumb|alt=|bar]]
28521 !! html/php+tidy
28522 <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>
28523 !! html/parsoid
28524 <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>
28525 !! end
28526
28527 !! test
28528 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
28529 !! options
28530 parsoid=html2wt
28531 language=ar
28532 disabled
28533 !! html/parsoid
28534 <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>
28535 !! wikitext
28536 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
28537 !! end
28538
28539 !! test
28540 Image: Block level image should have \n before and after
28541 !! wikitext
28542 123
28543 [[File:Foobar.jpg|right|thumb|150x150px]]
28544 456
28545 !! html/parsoid
28546 <p>123</p>
28547 <figure class="mw-halign-right" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150"/></a><figcaption></figcaption></figure>
28548 <p>456</p>
28549 !! end
28550
28551 !! test
28552 Image: New block level image should have \n before and after (existing content)
28553 !! wikitext
28554 123
28555 [[File:Foobar.jpg|right|thumb|150x150px]]
28556 456
28557 !! html/parsoid
28558 <p>123</p>
28559 <figure class="mw-halign-right" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"right","ak":"right"},{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"150x150px"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"17","width":"150"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption></figcaption></figure>
28560 <p>456</p>
28561 !! end
28562
28563 !! test
28564 Image: upright option (parsoid)
28565 !! wikitext
28566 [[File:Foobar.jpg|thumb|upright|caption]]
28567 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
28568 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
28569 !! html/parsoid
28570 <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>
28571 <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>
28572 <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>
28573 !! end
28574
28575 !! test
28576 Image: upright option is ignored on inline and frame images (parsoid)
28577 !! wikitext
28578 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
28579 !! html/parsoid
28580 <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>
28581 !! end
28582
28583 !! test
28584 Image: in template parameter with empty parameter
28585 !! wikitext
28586 {{echo|[[File:Foobar.jpg|link=]]}}
28587 !! html/parsoid
28588 <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>
28589 !! end
28590
28591 !! test
28592 Image: from basic HTML (1)
28593 !! options
28594 parsoid=html2wt
28595 !! html/parsoid
28596 <span typeof="mw:Image">
28597 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28598 </span>
28599 !! wikitext
28600 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28601 !! end
28602
28603 !! test
28604 Image: from basic HTML (2)
28605 !! options
28606 parsoid=html2wt
28607 !! html/parsoid
28608 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28609 !! wikitext
28610 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28611 !! end
28612
28613 !! test
28614 Image: from basic HTML (3)
28615 !! options
28616 parsoid=html2wt
28617 !! html/parsoid
28618 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
28619 !! wikitext
28620 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
28621 !! end
28622
28623 !! test
28624 Image: from basic HTML (4)
28625 !! options
28626 parsoid=html2wt
28627 !! html/parsoid
28628 <img src="./File:Foobar.jpg">
28629 !! wikitext
28630 [[File:Foobar.jpg|link=]]
28631 !! end
28632
28633 !! test
28634 Image: Invalid title as link
28635 !! wikitext
28636 [[File:Foobar.jpg|link=<]]
28637 !! html/php
28638 <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>
28639 </p>
28640 !! html/parsoid
28641 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=&lt;"}]}' data-mw='{"attribs":[["link",{"txt":"&lt;"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
28642 !! end
28643
28644 !! test
28645 Various link types in alt and link options
28646 !! wikitext
28647 [[File:Foobar.jpg|link=[[Main Page]]|alt=[[Main Page]]|caption]]
28648
28649 [[File:Foobar.jpg|link=[[Media:Thumb.png]]|alt=[[Media:Thumb.png]]|caption]]
28650
28651 [[File:Foobar.jpg|link=[[wikipedia:Foo]]|alt=[[wikipedia:Foo]]|caption]]
28652 !! html/php+tidy
28653 <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>
28654 </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>
28655 </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>
28656 </p>
28657 !! html/parsoid
28658 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt1" data-mw='{"attribs":[["alt",{"html":"alt=&lt;a rel=\"mw:WikiLink\" href=\"./Main_Page\" title=\"Main Page\" data-parsoid=&apos;{\"stx\":\"simple\",\"a\":{\"href\":\"./Main_Page\"},\"sa\":{\"href\":\"Main Page\"},\"dsr\":[41,216,2,2]}&apos;>Main Page&lt;/a>","txt":"Main Page"}]],"caption":"caption"}'><a href="./Main_Page" data-parsoid='{"a":{"href":"./Main_Page"},"sa":{"href":"link=[[Main Page]]"}}'><img alt="Main Page" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
28659
28660 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["alt",{"html":"alt=&lt;a rel=\"mw:MediaLink\" href=\"//example.com/images/e/ea/Thumb.png\" resource=\"./Media:Thumb.png\" title=\"Thumb.png\" data-parsoid=&apos;{\"a\":{\"resource\":\"./Media:Thumb.png\"},\"sa\":{\"resource\":\"Media:Thumb.png\"},\"dsr\":[113,216,null,null]}&apos;>Media:Thumb.png&lt;/a>","txt":"Media:Thumb.png"}]],"caption":"caption"}'><a href="./Media:Thumb.png" data-parsoid='{"a":{"href":"./Media:Thumb.png"},"sa":{"href":"link=[[Media:Thumb.png]]"}}'><img alt="Media:Thumb.png" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
28661
28662 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["alt",{"html":"alt=&lt;a rel=\"mw:WikiLink/Interwiki\" href=\"http://en.wikipedia.org/wiki/Foo\" title=\"wikipedia:Foo\" data-parsoid=&apos;{\"stx\":\"simple\",\"a\":{\"href\":\"http://en.wikipedia.org/wiki/Foo\"},\"sa\":{\"href\":\"wikipedia:Foo\"},\"isIW\":true,\"dsr\":[189,216,2,2]}&apos;>wikipedia:Foo&lt;/a>","txt":"wikipedia:Foo"}]],"caption":"caption"}'><a href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"link=[[wikipedia:Foo]]"}}'><img alt="wikipedia:Foo" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
28663 !! end
28664
28665 !! test
28666 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
28667 !! options
28668 parsoid=html2wt
28669 !! html/parsoid
28670 <ul>
28671 <li><p>foo</p></li>
28672 </ul>
28673 !! wikitext
28674 * foo
28675 !! end
28676
28677 !! test
28678 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
28679 !! options
28680 parsoid=html2wt
28681 !! html/parsoid
28682 <ul> <li>foo</li></ul>
28683 !! wikitext
28684 * foo
28685 !! end
28686
28687 !! test
28688 Don't strip leading whitespace when handling indent-pre suppressing tags
28689 !! options
28690 parsoid=html2wt
28691 !! html/parsoid
28692 <table>
28693 <tr><td> indented row</td></tr>
28694 </table>
28695 <blockquote><p>
28696 <b>This is very bold of you!</b>
28697 </p>
28698 <table><tr><td>
28699 indented cell (no pre-wrapping!)
28700 </td></tr></table>
28701 </blockquote>
28702 <p>foo</p>
28703 <div>bar</div>
28704 !! wikitext
28705 {|
28706 | indented row
28707 |}
28708 <blockquote>
28709 '''This is very bold of you!'''
28710
28711 {|
28712 |
28713 indented cell (no pre-wrapping!)
28714 |}
28715 </blockquote>
28716 foo
28717 <div>bar</div>
28718 !! end
28719
28720 !! test
28721 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
28722 !! options
28723 parsoid=html2wt
28724 !! html/parsoid
28725 <p>foo</p>
28726 <span>bar</span>
28727
28728 <span>foo2
28729 </span>bar2
28730
28731 <div>foo</div>
28732 <span>bar</span>
28733
28734 <div>
28735 <span>foo</span>
28736 </div>
28737 !! wikitext
28738 foo
28739
28740 <span>bar</span>
28741
28742 <span>foo2
28743 <nowiki> </nowiki></span>bar2
28744
28745 <div>foo</div>
28746 <nowiki> </nowiki><span>bar</span>
28747
28748 <div>
28749 <nowiki> </nowiki><span>foo</span>
28750 </div>
28751 !! end
28752
28753 !! test
28754 Lists: Dont insert newlines in a serialized list item.
28755 !! options
28756 parsoid=html2wt
28757 !! html/parsoid
28758 <ul><li>a<br>b</li><li>c</li></ul>
28759 !! wikitext
28760 * a<br />b
28761 * c
28762 !! end
28763
28764 !! test
28765 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
28766 !! options
28767 parsoid={
28768 "modes": ["html2wt"],
28769 "scrubWikitext": false
28770 }
28771 !! html/parsoid
28772 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28773 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28774
28775 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28776 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28777
28778 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
28779
28780 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28781 !! wikitext
28782 == hello there [[Category:A1]] ==
28783
28784 == [[Category:A2]] hi pal ==
28785
28786 == <!--foo--> [[Category:A3]] how goes it ==
28787
28788 == it goes well [[Category:A4]] <!--bar--> ==
28789
28790 ==howdy [[Category:A5]]==
28791
28792 == __TOC__ ok ==
28793 !! end
28794
28795 !! test
28796 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
28797 !! options
28798 parsoid={
28799 "modes": ["html2wt"],
28800 "scrubWikitext": true
28801 }
28802 !! html/parsoid
28803 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28804 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28805
28806 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28807 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28808
28809 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28810 !! wikitext
28811 == hello there ==
28812 [[Category:A1]]
28813 [[Category:A2]]
28814
28815 == hi pal ==
28816
28817 <!--foo-->[[Category:A3]]
28818
28819 == how goes it ==
28820
28821 == it goes well ==
28822 [[Category:A4]] <!--bar-->
28823
28824 __TOC__
28825
28826 == ok ==
28827 !! end
28828
28829 !! test
28830 Headings: Don't hoist metas that come from templates
28831 !! options
28832 parsoid={
28833 "modes": ["html2wt"],
28834 "scrubWikitext": true
28835 }
28836 !! html/parsoid
28837 <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>
28838 !! wikitext
28839 == {{echo|foo [[Category:Foo]]}} ==
28840 !! end
28841
28842 !! test
28843 Headings: Category in ref isn't hoisted
28844 !! options
28845 parsoid={
28846 "modes": ["html2wt"],
28847 "scrubWikitext": true
28848 }
28849 !! html/parsoid
28850 <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>
28851
28852 <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>
28853 !! wikitext
28854 == foo <ref>bar
28855 [[Category:Baz]] </ref> ==
28856
28857 <references />
28858 !! end
28859
28860 !! test
28861 Parsoid: Serialize positional parameters with = in them as named parameter
28862 !! options
28863 parsoid=html2wt
28864 !! html/parsoid
28865 <p about="#mwt1" typeof="mw:Transclusion"
28866 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
28867
28868 <p about="#mwt1" typeof="mw:Transclusion"
28869 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
28870
28871 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28872 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28873 <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>
28874 !! wikitext
28875 {{echo|1=f=oo}}
28876
28877 {{echo|1=f=oo|2=bar}}
28878
28879 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28880 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28881 {{echo|<nowiki>f=oo</nowiki>|bar}}
28882 !! end
28883
28884 !! test
28885 Parsoid: Serialize positional parameters with = in extlink as named parameter
28886 !! options
28887 parsoid=html2wt
28888 !! html/parsoid
28889 <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>
28890 !! wikitext
28891 {{echo|1=http://stuff?is=ok}}
28892 !! end
28893
28894 !! test
28895 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
28896 !! options
28897 parsoid=html2wt
28898 !! html/parsoid
28899 <div>a<p>b</p></div>
28900 <div>a
28901 <p>b</p></div>
28902 <div>
28903 a
28904 <p>b</p></div>
28905 !! wikitext
28906 <div>a
28907 b
28908 </div>
28909 <div>a
28910 b
28911 </div>
28912 <div>
28913 a
28914
28915 b
28916 </div>
28917 !! end
28918
28919 !! test
28920 Substrings resembling wikitext in hrefs should not get nowiki escapes
28921 !! options
28922 parsoid=html2wt
28923 !! html/parsoid
28924 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
28925 !! wikitext
28926 [[Foo''bar''baz]]
28927 !! end
28928
28929 !! test
28930 Enforce single-line context in the serializer
28931 !! options
28932 parsoid=html2wt
28933 !! html/parsoid
28934 <h2>testing
28935 123</h2>
28936
28937 <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">
28938 </span><span about="#mwt1">you</span> </h2>
28939
28940 <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>
28941
28942 <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
28943 there</span></li></ol>
28944
28945 <ul><li>asd
28946 sdf</li></ul>
28947
28948 <ul><li>foo
28949 bar
28950 baz</li>
28951 <li>foo <b>bar</b>
28952 baz</li></ul>
28953
28954 <dl><dt>hi
28955 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
28956 ho</dd></dl>
28957
28958 <dl><dd> <table>
28959 <tbody><tr><td> ha
28960 ha
28961 ha</td></tr>
28962 </tbody></table></dd></dl>
28963 !! wikitext
28964 == testing 123 ==
28965
28966 == hi {{bogus|there
28967 you}} ==
28968
28969 == foo <ref>hello
28970 there</ref> ==
28971
28972 <references />
28973
28974 * asd sdf
28975
28976 * foo bar baz
28977 * foo '''bar''' baz
28978
28979 ; hi ho : hi ho
28980
28981 : {|
28982 | ha
28983 ha
28984 ha
28985 |}
28986 !! end
28987
28988 !! test
28989 Serialize new placeholder space without spans
28990 !! options
28991 parsoid=html2wt
28992 !! html/parsoid
28993 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
28994
28995 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
28996
28997 <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>
28998 !! wikitext
28999 foo : bar
29000
29001 foo : bar
29002
29003 <ref>foo : bar</ref>ok
29004 !! end
29005
29006
29007 #-----------------------
29008 # Tag minimization tests
29009 #-----------------------
29010
29011 !! test
29012 1. I/B quote minimization: wikitext-only tags should be combined
29013 !! options
29014 parsoid=html2wt
29015 !! html/parsoid
29016 <p><i>A</i><i>B</i></p>
29017 <p><b>A</b><b>B</b></p>
29018 <p><i>A</i><b><i>B</i></b></p>
29019 <p><b>A</b><i><b>B</b></i></p>
29020 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
29021 <p><i><b>A</b></i><i><b>B</b></i></p>
29022 <p><i><b>A</b></i><b><i>B</i></b></p>
29023 <p><b><i>A</i></b><i><b>B</b></i></p>
29024 !! wikitext
29025 ''AB''
29026
29027 '''AB'''
29028
29029 ''A'''B'''''
29030
29031 '''A''B'''''
29032
29033 '''A''BC''D'''
29034
29035 '''''AB'''''
29036
29037 '''''AB'''''
29038
29039 '''''AB'''''
29040 !! end
29041
29042 !! test
29043 2. I/B quote minimization: wikitext and html tags should not be combined
29044 !! options
29045 parsoid=html2wt
29046 !! html/parsoid
29047 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
29048 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
29049 !! wikitext
29050 ''A''<i>B</i>
29051
29052 ''A''<nowiki/>'''<i>B</i>'''
29053 !! end
29054
29055 !! test
29056 3. I/B quote minimization: templated content stops minimization
29057 !! options
29058 parsoid=html2wt
29059 !! html/parsoid
29060 <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>
29061 <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>
29062 !! wikitext
29063 ''A''{{echo|''B''}}
29064
29065 ''A''{{echo|'''''B'''''}}
29066 !! end
29067
29068 !! test
29069 4. I/B quote minimization: new content should be mimimized with adjacent old content
29070 !! options
29071 parsoid=html2wt
29072 !! html/parsoid
29073 <p><i>A</i><i>B</i></p>
29074 <p><b>A</b><b>B</b></p>
29075 <p><i>A</i><b><i>B</i></b></p>
29076 !! wikitext
29077 ''AB''
29078
29079 '''AB'''
29080
29081 ''A'''B'''''
29082 !! end
29083
29084 !! test
29085 5a. Merge adjacent quote nodes if they've been edited
29086 !! options
29087 parsoid={
29088 "modes": ["wt2wt", "selser"],
29089 "changes": [
29090 ["p", "contents", "remove", ":contains('b')"]
29091 ]
29092 }
29093 !! wikitext
29094 ''a''b''c''
29095 !! wikitext/edited
29096 ''ac''
29097 !! end
29098
29099 !! test
29100 5b. Merge adjacent quote nodes if they've been edited
29101 !! options
29102 parsoid={
29103 "modes": ["wt2wt", "selser"],
29104 "changes": [
29105 ["#x", "remove"]
29106 ]
29107 }
29108 !! wikitext
29109 ''a''<span id="x">b</span>''c''
29110 !! wikitext/edited
29111 ''ac''
29112 !! end
29113
29114 !! test
29115 1. Merge adjacent link nodes as long as at least one element is new
29116 !! options
29117 parsoid={
29118 "modes": ["html2wt"],
29119 "scrubWikitext": true
29120 }
29121 !! html/parsoid
29122 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29123 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29124 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
29125 !! wikitext
29126 [[Football]]
29127 [[Football]]
29128 [[Football|Foot]][[Football|ball]]
29129 !! end
29130
29131 !! test
29132 2. Merge adjacent link nodes and enable additional normalizations
29133 !! options
29134 parsoid={
29135 "modes": ["html2wt"],
29136 "scrubWikitext": true
29137 }
29138 !! html/parsoid
29139 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
29140 !! wikitext
29141 ''[[Football]]''
29142 !! end
29143
29144 !! test
29145 3. Don't merge adjacent link nodes if scrubWikitext is false
29146 !! options
29147 parsoid={
29148 "modes": ["html2wt"],
29149 "scrubWikitext": false
29150 }
29151 !! html/parsoid
29152 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29153 !! wikitext
29154 [[Football|Foot]][[Football|ball]]
29155 !! end
29156
29157 !! test
29158 1. Move format tags outside of WikiLink
29159 !! options
29160 parsoid={
29161 "modes": ["html2wt"],
29162 "scrubWikitext": true
29163 }
29164 !! html/parsoid
29165 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
29166 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
29167 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
29168 !! wikitext
29169 ''[[Football]]''
29170 '''''[[Football]]'''''
29171 <u>'''''[[Football]]'''''</u>
29172 !! end
29173
29174 !! test
29175 2. Move format tags outside of WikiLink with mergable A tags
29176 !! options
29177 parsoid={
29178 "modes": ["html2wt"],
29179 "scrubWikitext": true
29180 }
29181 !! html/parsoid
29182 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
29183 !! wikitext
29184 '''''[[Football]]'''''
29185 !! end
29186
29187 !! test
29188 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
29189 !! options
29190 parsoid={
29191 "modes": ["html2wt"],
29192 "scrubWikitext": true
29193 }
29194 !! html/parsoid
29195 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
29196 !! wikitext
29197 <font color="red"><u>'''[[Foo]]'''</u></font>
29198 !! end
29199
29200 !! test
29201 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
29202 !! options
29203 parsoid={
29204 "modes": ["html2wt"],
29205 "scrubWikitext": true
29206 }
29207 !! html/parsoid
29208 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
29209 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
29210 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
29211 !! wikitext
29212 [[Foo|<font color="red">Foo</font>]]
29213 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
29214 [[Foo|<span class="Bar">Foo</span>]]
29215 !! end
29216
29217 !! test
29218 5. T194083 Regression test: Manual edit test that also enables scrubWikitext to move format tags outside wikilinks
29219 !! options
29220 parsoid={
29221 "modes": ["selser"],
29222 "scrubWikitext": true,
29223 "changes": [
29224 ["a", "html", "<i>Foo</i>"]
29225 ]
29226 }
29227 !! wikitext
29228 [[Foo]]
29229 !! wikitext/edited
29230 ''[[Foo]]''
29231 !! end
29232
29233 !! test
29234 6. Regression test: Manual edit test to ensure diff markers are not lost
29235 !! options
29236 parsoid={
29237 "modes": ["selser"],
29238 "scrubWikitext": true,
29239 "changes": [
29240 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
29241 ]
29242 }
29243 !! wikitext
29244 ''Foo''
29245 !! wikitext/edited
29246 ''[[Foo]]''
29247 !! end
29248
29249 !! test
29250 7. T194083 Regression test: Manual edit test to ensure nested diff markers aren't inserted
29251 !! options
29252 parsoid={
29253 "modes": ["selser"],
29254 "scrubWikitext": true,
29255 "changes": [
29256 ["div", "after", "\n<p><a href='./Foo' rel='mw:WikiLink'>Foo </a>, placeholder</p>"]
29257 ]
29258 }
29259 !! wikitext
29260 <div>placeholder</div>
29261 !! wikitext/edited
29262 <div>placeholder</div>
29263 [[Foo]] , placeholder
29264 !! end
29265
29266 #------------------------------
29267 # End of tag minimization tests
29268 #------------------------------
29269
29270 !!test
29271 T56262: New entities
29272 !! options
29273 parsoid=html2wt
29274 !! html/parsoid
29275 <span typeof="mw:Entity">&nbsp;</span>
29276 !! wikitext
29277 &nbsp;
29278 !! end
29279
29280 ## Note that there is no wikitext output for 'unknownproperty' ##
29281 ## Unknown magic words are silently dropped ##
29282
29283 !! test
29284 Magic words
29285 !! options
29286 parsoid=html2wt
29287 !! html/parsoid
29288 <meta property='mw:PageProp/toc' />
29289 <meta property='mw:PageProp/notoc' />
29290 <meta property='mw:PageProp/forcetoc' />
29291 <meta property='mw:PageProp/index' />
29292 <meta property='mw:PageProp/noindex' />
29293 <meta property='mw:PageProp/nogallery' />
29294 <meta property='mw:PageProp/noeditsection' />
29295 <meta property='mw:PageProp/notitleconvert' />
29296 <meta property='mw:PageProp/nocontentconvert' />
29297 <meta property='mw:PageProp/unknownproperty' />
29298 !! wikitext
29299 __TOC__
29300 __NOTOC__
29301 __FORCETOC__
29302 __INDEX__
29303 __NOINDEX__
29304 __NOGALLERY__
29305 __NOEDITSECTION__
29306 __NOTITLECONVERT__
29307 __NOCONTENTCONVERT__
29308 !! end
29309
29310 !! test
29311 Consecutive <pre>s should not get merged
29312 !! options
29313 parsoid=html2wt,html2html
29314 !! html/parsoid
29315 <pre>a</pre><pre>b</pre>
29316
29317 <pre>c
29318 </pre><pre>
29319 d</pre>
29320
29321 <pre>e
29322
29323 </pre><pre>
29324
29325 f</pre>
29326 !! wikitext
29327 a
29328
29329 b
29330
29331 c
29332
29333 d
29334
29335 e
29336
29337
29338
29339 f
29340 !! end
29341
29342 !! test
29343 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
29344 !! options
29345 parsoid=html2wt
29346 !! html/parsoid
29347 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
29348 !! wikitext
29349 [[Special:BookSources/1234567890|ISBN 1234567895]]
29350 !! end
29351
29352 !! test
29353 Edited RFC links not serializable as RFC links should serialize as extlinks
29354 !! options
29355 parsoid=html2wt
29356 !! html/parsoid
29357 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
29358 !! wikitext
29359 [https://tools.ietf.org/html/rfc123 New RFC]
29360 !! end
29361
29362 !! test
29363 Edited PMID links not serializable as PMID links should serialize as extlinks
29364 !! options
29365 parsoid=html2wt
29366 !! html/parsoid
29367 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
29368 !! wikitext
29369 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
29370 !! end
29371
29372 !! test
29373 WTS of autolinks with trailing/surrounding context
29374 !! options
29375 parsoid=html2wt
29376 !! html/parsoid
29377 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
29378 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
29379 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
29380 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
29381 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
29382 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
29383 !! wikitext
29384 http://cscott.net'''foo'''
29385
29386 http://cscott.net<b>foo</b>
29387
29388 '''http://cscott.net'''
29389
29390 '''http://cscott.net '''
29391
29392 '''http://cscott.net<nowiki/>x'''
29393
29394 http://cscott.net<nowiki/>x
29395 !! end
29396
29397 !! test
29398 WTS of autolinks with nowikis (round-trip)
29399 !! wikitext
29400 x<nowiki/>http://cscott.net<nowiki/>x
29401 !! html/parsoid
29402 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
29403 !! end
29404
29405 # this is the "easy" test because it leaves in place all the
29406 # data-parsoid information indicating this is an autolink
29407 !! test
29408 WTS of autolinks with escapes (editing)
29409 !! options
29410 parsoid={
29411 "modes": ["wt2wt"],
29412 "changes": [
29413 [ "span", "remove" ]
29414 ]
29415 }
29416 !! wikitext
29417 x<nowiki/>http://cscott.net<nowiki/>x
29418 !! wikitext/edited
29419 x<nowiki/>http://cscott.net<nowiki/>x
29420 !! end
29421
29422 !! test
29423 WTS of edited autolink-like text (T103364)
29424 !! options
29425 parsoid={
29426 "modes": ["wt2wt"],
29427 "changes": [
29428 [ "span[typeof]", "removeAttr", "typeof" ]
29429 ]
29430 }
29431 !! wikitext
29432 Not a link: <nowiki>http://example.com</nowiki>.
29433 !! wikitext/edited
29434 Not a link: <span><nowiki>http://example.com</nowiki></span>.
29435 !! end
29436
29437 !! test
29438 WTS of newly-authored autolink-like text (T103364)
29439 !! options
29440 parsoid=html2wt
29441 !! html/parsoid
29442 <p>http://example.com is not a link.</p>
29443 !! wikitext
29444 <nowiki>http://example.com</nowiki> is not a link.
29445 !! end
29446
29447 !! test
29448 WTS of autolink-like text after an autolink (T108563)
29449 !! options
29450 parsoid=html2wt
29451 !! html/parsoid
29452 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
29453 !! wikitext
29454 http://example.com <nowiki>http://example.com</nowiki> is not a link.
29455 !! end
29456
29457 !! test
29458 Magic links inside links (not autolinked)
29459 !! wikitext
29460 [[Foo|http://example.com]]
29461 [[Foo|RFC 1234]]
29462 [[Foo|PMID 1234]]
29463 [[Foo|ISBN 123456789x]]
29464
29465 [http://foo.com http://example.com]
29466 [http://foo.com RFC 1234]
29467 [http://foo.com PMID 1234]
29468 [http://foo.com ISBN 123456789x]
29469 !! html+tidy
29470 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
29471 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
29472 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
29473 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
29474 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
29475 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
29476 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
29477 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
29478 </p>
29479 !! html/parsoid
29480 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
29481 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
29482 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
29483 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
29484
29485 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
29486 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
29487 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
29488 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
29489 !! end
29490
29491 !! test
29492 Magic links inside image captions (autolinked)
29493 !! wikitext
29494 [[File:Foobar.jpg|thumb|http://example.com]]
29495 [[File:Foobar.jpg|thumb|RFC 1234]]
29496 [[File:Foobar.jpg|thumb|PMID 1234]]
29497 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
29498 !! html+tidy
29499 <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>
29500 <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>
29501 <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>
29502 <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>
29503 !! html/parsoid
29504 <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>
29505 <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>
29506 <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>
29507 <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>
29508 !! end
29509
29510 !! test
29511 WTS of magic word text (T109371)
29512 !! options
29513 parsoid=html2wt
29514 !! html/parsoid
29515 <p>RFC 1234</p>
29516 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
29517 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
29518 !! wikitext
29519 <nowiki>RFC 1234</nowiki>
29520
29521 [http://foo.com RFC 1234]
29522
29523 [[Foo|RFC 1234]]
29524 !! end
29525
29526 !! test
29527 Edited Redirect link should emit a non-piped wikitext link
29528 !! options
29529 parsoid=html2wt
29530 !! html/parsoid
29531 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
29532 !! wikitext
29533 #REDIRECT [[Bar]]
29534 !! end
29535
29536 !! test
29537 T75121: Infer extension name from typeOf if data-mw is not present
29538 !! options
29539 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29540 !! html/parsoid
29541 <div typeOf="mw:Extension/foo"></div>
29542 !! wikitext
29543 <foo />
29544 !! end
29545
29546 # Note that the <p> wrapping isn't present in PHP parser output
29547 # The important thing for this test is that P-wrapping doesn't
29548 # interfere with the <nowiki> protection for leading - in <td>
29549 # (which isn't necessary for <th>).
29550 !! test
29551 T88318: p-wrapped dash in table.
29552 !! options
29553 parsoid=html2wt,wt2wt
29554 !! html/parsoid
29555 <table><tbody>
29556 <tr><th><p>-</p></th><th><p>- </p></th></tr>
29557 <tr><td><p>-</p></td><td><p>- </p></td></tr>
29558 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
29559 </tbody></table>
29560 !! wikitext
29561 {|
29562 !-
29563 !-
29564 |-
29565 |<nowiki>-</nowiki>
29566 |<nowiki>- </nowiki>
29567 |-
29568 |<small>-</small>
29569 |<br />
29570 -
29571 |<br />-
29572 |}
29573 !! html/php+tidy
29574 <table>
29575 <tbody><tr>
29576 <th>-
29577 </th>
29578 <th>-
29579 </th></tr>
29580 <tr>
29581 <td>-
29582 </td>
29583 <td>-
29584 </td></tr>
29585 <tr>
29586 <td><small>-</small>
29587 </td>
29588 <td><br />
29589 <p>-
29590 </p>
29591 </td>
29592 <td><br />-
29593 </td></tr></tbody></table>
29594 !! end
29595
29596 !! test
29597 T149209: WTS: Handle newlines in table cells properly
29598 !! options
29599 parsoid=html2wt
29600 !! html/parsoid
29601 <table>
29602 <tbody>
29603 <tr><td>a
29604 b
29605 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
29606 <tr><td><p>x</p>
29607 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
29608 </tbody></table>
29609 <table>
29610 <tbody>
29611 <tr><th>a
29612 b
29613 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
29614 <tr><th><p>x</h>
29615 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
29616 </tbody></table>
29617 !! wikitext
29618 {|
29619 |a
29620 b
29621 |c
29622 |-
29623 |x
29624 {{!}}y
29625 |}
29626 {|
29627 !a
29628 b
29629 !c
29630 |-
29631 !x
29632 !y
29633 |}
29634 !! end
29635
29636 !! test
29637 T149209: Selser: Handle newlines in table cells properly
29638 !! options
29639 parsoid={
29640 "modes": ["selser"],
29641 "changes": [
29642 [ "#h1", "html", "a\nb\n" ],
29643 [ "#h2", "html", "a\nb\n" ],
29644 [ "#c1", "html", "a\nb\n" ],
29645 [ "#c2", "html", "<p>a</p>" ],
29646 [ "#c3", "html", "<p>a</p>" ],
29647 [ "#c4", "html", "edit-me<p>a</p>" ]
29648 ]
29649 }
29650 !! wikitext
29651 {|
29652 ! id="h1" |edit-me!!1
29653 |-
29654 ! id="h2" |edit-me||2
29655 |-
29656 | id="c1" |edit-me||3
29657 |-
29658 | id="c2" |edit-me||4
29659 |-
29660 | id="c3" |edit-me||p||q||r
29661 |-
29662 | id="c4" |edit-me||p||q||r
29663 |}
29664 !! wikitext/edited
29665 {|
29666 ! id="h1" |a
29667 b
29668 !1
29669 |-
29670 ! id="h2" |a
29671 b
29672 !2
29673 |-
29674 | id="c1" |a
29675 b
29676 |3
29677 |-
29678 | id="c2" |a
29679 |4
29680 |-
29681 | id="c3" |a
29682 |p||q||r
29683 |-
29684 | id="c4" |edit-me
29685 a
29686 |p||q||r
29687 |}
29688 !! end
29689
29690 !! test
29691 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
29692 !! options
29693 parsoid=html2wt
29694 !! html/parsoid
29695 <table id='mwAb'>
29696 <td id='mwAc'>foo</td>
29697 <td id='serialize-this'>bar</td>
29698 </table>
29699 !! wikitext
29700 {|
29701 |foo
29702 | id="serialize-this" |bar
29703 |}
29704 !! end
29705
29706 !! test
29707 Parsoid-like element ids should not be serialized to wikitext unless shadowed
29708 !! options
29709 parsoid=html2wt
29710 !! html/parsoid
29711 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
29712 !! wikitext
29713 <div id="hello">ok</div>
29714 !! end
29715
29716 !! test
29717 Testing serialization after deletion in references
29718 !! options
29719 parsoid={
29720 "modes": ["wt2wt"],
29721 "changes": [
29722 ["#x", "remove"]
29723 ]
29724 }
29725 !! wikitext
29726 hi <ref><div id="x">ho</div></ref>
29727
29728 <references />
29729 !! wikitext/edited
29730 hi <ref></ref>
29731
29732 <references />
29733 !! end
29734
29735 !!test
29736 Testing serialization after deletion of table cells
29737 !!options
29738 parsoid={
29739 "modes": ["wt2wt", "selser"],
29740 "changes": [
29741 ["#x", "remove"]
29742 ]
29743 }
29744 !!wikitext
29745 {|
29746 !h1 !!h2 !!h3
29747 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
29748 |}
29749 !! wikitext/edited
29750 {|
29751 !h1!!h2!!h3
29752 |c2|||c3
29753 |}
29754 !!end
29755
29756 !! test
29757 Testing selser after addition of new row before first row (T125419)
29758 !! options
29759 parsoid={
29760 "modes": ["wt2wt", "selser"],
29761 "changes": [
29762 [ "tr", "before", "<tr><td>X</td></tr>" ]
29763 ]
29764 }
29765 !! wikitext
29766 {|
29767 |a
29768 |}
29769 !! wikitext/edited
29770 {|
29771 |X
29772 |-
29773 |a
29774 |}
29775 !! end
29776
29777 !! test
29778 Serialize new table rows in a HTML table using HTML tags
29779 !! options
29780 parsoid={
29781 "modes": ["wt2wt", "selser"],
29782 "changes": [
29783 [ "tr", "before", "<tr><td>X</td></tr>" ]
29784 ]
29785 }
29786 !! wikitext
29787 <table><tr><td>a</td></tr></table>
29788 !! wikitext/edited
29789 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
29790 !! end
29791
29792 !! test
29793 Serialize new table cells in a HTML row using HTML tags
29794 !! options
29795 parsoid={
29796 "modes": ["wt2wt", "selser"],
29797 "changes": [
29798 [ "td", "before", "<td>X</td>" ]
29799 ]
29800 }
29801 !! wikitext
29802 <table><tr><td>a</td></tr></table>
29803 !! wikitext/edited
29804 <table><tr><td>X</td><td>a</td></tr></table>
29805 !! end
29806
29807 !! test
29808 Serialize wikitext list items as HTML list items when embedded in a HTML list
29809 !! options
29810 parsoid=html2wt
29811 !! html/parsoid
29812 <ul data-parsoid='{"stx": "html"}'>
29813 <li data-parsoid='{}'>a</li>
29814 <li>b</li>
29815 </ul>
29816 !! wikitext
29817 <ul>
29818 <li>a</li>
29819 <li>b</li>
29820 </ul>
29821 !! html/php+tidy
29822 <ul>
29823 <li>a</li>
29824 <li>b</li>
29825 </ul>
29826 !! end
29827
29828 # Nested list should be inside <li>, that is
29829 # <ul><li>foo<ul>..</ul></li></ul> instead of
29830 # <ul><li>foo</li><ul>..</ul></ul>
29831 # See https://stackoverflow.com/questions/5899337/proper-way-to-make-html-nested-list
29832 !! test
29833 Wikitext lists can be nested inside HTML lists
29834 !! options
29835 parsoid=html2wt
29836 !! html/parsoid
29837 <ul data-parsoid='{"stx": "html"}'>
29838 <li data-parsoid='{"stx": "html"}'>a
29839 <ul><li>b</li></ul>
29840 </li>
29841 </ul>
29842
29843 <ul data-parsoid='{"stx": "html"}'>
29844 <li>x
29845 <ul><li>y</li></ul>
29846 </li>
29847 </ul>
29848 !! wikitext
29849 <ul>
29850 <li>a
29851 * b
29852 </li>
29853 </ul>
29854
29855 <ul>
29856 <li>x
29857 * y
29858 </li>
29859 </ul>
29860 !! html/php+tidy
29861 <ul>
29862 <li>a
29863 <ul><li>b</li></ul>
29864 </li>
29865 </ul>
29866 <ul>
29867 <li>x
29868 <ul><li>y</li></ul>
29869 </li>
29870 </ul>
29871 !! end
29872
29873 !! test
29874 WTS change modes
29875 !! options
29876 parsoid={
29877 "modes": ["wt2wt"],
29878 "changes": [
29879 [ "#xyz", "before", "<b>before</b> stuff " ],
29880 [ "#xyz", "after", " stuff <i>after</i>" ],
29881 [ "#xyz", "html", "x <b>y</b> z" ]
29882 ]
29883 }
29884 !! wikitext
29885 <span id="xyz">hello</span>
29886 !! wikitext/edited
29887 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
29888 !! end
29889
29890 !! test
29891 Never serialize a-tag as html, regardless of what data-parsoid has to say
29892 !! options
29893 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29894 !! html/parsoid
29895 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
29896 !! wikitext
29897 [[Foo]]
29898 !! end
29899
29900 ## SSS FIXME: This is broken output nevertheless.
29901 ## What might be a reasonable non-broken output for this?
29902 ## This is an edge case unlikely to be seen in production
29903 ## that I am not wasting more time on this right now.
29904 !! test
29905 Never serialize a-tag as html, no matter what attributes it has
29906 !! options
29907 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29908 !! html/parsoid
29909 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
29910 !! wikitext
29911 [http://boo.org http://boohoo.org]
29912 !! end
29913
29914 # Misnested is an indication that selser can reuse the source but these have
29915 # shown to sneak through on occasion. See T101768.
29916 # The original wikitext here is: [http://test.com [[one]] two three]
29917 !! test
29918 Strip span tags added to mark misnested links
29919 !! options
29920 parsoid=html2wt
29921 !! html/parsoid
29922 <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>
29923 !! wikitext
29924 [http://test.com][[one]] two three
29925 !! end
29926
29927 !! test
29928 Catch regression when unpacking misnested links
29929 !! options
29930 parsoid=wt2html
29931 !! wikitext
29932 {{echo|hi}}[http://example.com [[ho]]]
29933 !! html/parsoid
29934 <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>
29935 !! end
29936
29937 !! test
29938 Catch regression when unpacking with trailing content
29939 !! wikitext
29940 {{echo|Foo <references/> bar}}
29941 !! html/parsoid
29942 <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>
29943 !! end
29944
29945 !! test
29946 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
29947 !! options
29948 parsoid=html2wt
29949 !! html/parsoid
29950 <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|}"]}'>
29951 <tbody><tr><td>d
29952 </td></tr>
29953 </tbody></table>
29954 !! wikitext
29955 {{echo|a}}
29956 {|{{echo|c
29957 {{!}}d
29958 }}
29959 |}
29960 !! end
29961
29962 ## This test verifies the presence and computation of this attribute indirectly
29963 ## by making an edit and ensuring that the serialization is correct (which it would be
29964 ## only if firstWikitextNode is properly set).
29965 !! test
29966 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
29967 !! options
29968 parsoid= {
29969 "modes": ["wt2wt"],
29970 "changes": [
29971 [ "div#x", "remove" ],
29972 [ "div", "before", "<div>new</div>" ]
29973 ]
29974 }
29975 !! wikitext
29976 <div id="x">foo</div>
29977 {|
29978 {{echo|<div>boo</div>
29979 {{!}}b}}
29980 |c
29981 |}
29982 !! wikitext/edited
29983
29984 <div>new</div>
29985 {|
29986 {{echo|<div>boo</div>
29987 {{!}}b}}
29988 |c
29989 |}
29990 !! end
29991
29992 ## Don't necessarily expect this to roundtrip, but run serialization to catch crashers
29993 !! test
29994 File in link scenarios
29995 !! options
29996 parsoid={
29997 "modes": ["wt2html","html2wt"],
29998 "suppressErrors": true
29999 }
30000 !! wikitext
30001 [http://www.google.com [[File:Foobar.jpg|123]]]
30002
30003 [http://www.google.com [[File:Foobar.jpg|thumb|123]]]
30004 !! html/php+tidy
30005 <p><a rel="nofollow" class="external text" href="http://www.google.com"></a><a href="/wiki/File:Foobar.jpg" class="image" title="123"><img alt="123" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
30006 </p>
30007 <a rel="nofollow" class="external text" href="http://www.google.com"></a><div class="thumb tright"><a rel="nofollow" class="external text" href="http://www.google.com"></a><div class="thumbinner" style="width:182px;"><a rel="nofollow" class="external text" href="http://www.google.com"></a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" decoding="async" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>123</div></div></div>
30008 !! html/parsoid
30009 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com" data-parsoid='{"targetOff":23,"contentOffsets":[23,46]}'><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"123"}]}' data-mw='{"caption":"123"}'></figure-inline></a><a href="./File:Foobar.jpg" data-parsoid='{"misnested":true}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"},"misnested":true}'/></a></p>
30010
30011 <a rel="mw:ExtLink" class="external autonumber" href="http://www.google.com" data-parsoid='{"targetOff":72,"contentOffsets":[72,101]}'></a><figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"123"}]}'><a rel="mw:ExtLink" class="external autonumber" href="http://www.google.com" data-parsoid='{"targetOff":72,"contentOffsets":[72,101]}'></a><a href="./File:Foobar.jpg" data-parsoid='{"misnested":true}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"},"misnested":true}'/></a><figcaption data-parsoid='{"misnested":true}'>123</figcaption></figure>
30012 !! end
30013
30014 # --------------------------------------------
30015 # Tests spec'ing wikitext serialization norms |
30016 # --------------------------------------------
30017
30018 !! test
30019 Serialize multi-line indent-pre starting with wikitext syntax
30020 !! options
30021 parsoid=html2wt
30022 !! html/parsoid
30023 <pre>* 1
30024 ** 2
30025 * 3</pre>
30026 !! wikitext
30027 * 1
30028 ** 2
30029 * 3
30030 !! end
30031
30032 !! test
30033 1. Categories should always be serialized on their own line
30034 !! options
30035 parsoid=html2wt
30036 !! html/parsoid
30037 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
30038 !! wikitext
30039 foo
30040 [[Category:Foo]]
30041 bar
30042 !! end
30043
30044 !! test
30045 2. Categories that are part of templates should not introduce a line break
30046 !! wikitext
30047 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
30048 !! html/parsoid
30049 <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>
30050 !! end
30051
30052 # Careful while editing these next 2 tests. There are \u200f characters
30053 # before and after the <link> tags in the HTML and following some
30054 # of the categories in wikitext
30055 # Do not remove these characters in edits.
30056 #
30057 # As part of the serialization, these bidi characters will get stripped.
30058 !! test
30059 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
30060 !! options
30061 parsoid={
30062 "modes": ["html2wt"],
30063 "scrubWikitext": true
30064 }
30065 !! html/parsoid
30066 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
30067 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
30068 !! wikitext
30069 [[קטגוריה:טקסים]]
30070 [[קטגוריה: שיטות משפט]]
30071 !! end
30072
30073 !! test
30074 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
30075 !! options
30076 parsoid={
30077 "modes": ["html2wt"],
30078 "scrubWikitext": true
30079 }
30080 !! html/parsoid
30081 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
30082 !! wikitext
30083 [[קטגוריה:טקסים]]
30084 ‏y
30085 !! end
30086
30087 !! test
30088 Lists: Add space after bullets
30089 !! options
30090 parsoid=html2wt
30091 !! html/parsoid
30092 <ul>
30093 <li>foo</li>
30094 <li> bar</li>
30095 <li><span> baz</span></li>
30096 </ul>
30097 !! wikitext
30098 * foo
30099 * bar
30100 * <span> baz</span>
30101 !! end
30102
30103 !! test
30104 1. Headings: Add space before/after == (T53744)
30105 !! options
30106 parsoid=html2wt
30107 !! html/parsoid
30108 <h2>foo</h2>
30109 <h2> bar</h2>
30110 <h2>baz </h2>
30111 <h2><span> baz</span></h2>
30112 !! wikitext
30113 == foo ==
30114
30115 == bar ==
30116
30117 == baz ==
30118
30119 == <span> baz</span> ==
30120 !! end
30121
30122 !! test
30123 2. Headings: Add space before/after == even after hoisted content
30124 !! options
30125 parsoid={
30126 "modes": ["html2wt"],
30127 "scrubWikitext": true
30128 }
30129 !! html/parsoid
30130 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
30131 !! wikitext
30132 [[Category:A2]]
30133
30134 == ok ==
30135 !! end
30136
30137 !! test
30138 1. Headings: suppress newly created empty headings
30139 !! options
30140 parsoid={
30141 "modes": ["html2wt"],
30142 "scrubWikitext": true
30143 }
30144 !! html/parsoid
30145 <h2></h2>
30146 !! wikitext
30147 !! end
30148
30149 !! test
30150 2. Headings: don't suppress empty headings if scrubWikitext is false
30151 !! options
30152 parsoid=html2wt
30153 !! html/parsoid
30154 <h2></h2>
30155 !! wikitext
30156 ==<nowiki/>==
30157 !! end
30158
30159 !! test
30160 3. Headings: suppress empty headings on edits
30161 !! options
30162 parsoid={
30163 "modes": ["selser"],
30164 "scrubWikitext": true,
30165 "changes": [
30166 [ "#x", "remove"]
30167 ]
30168 }
30169 !! wikitext
30170 ==<span id="x">foo</span>==
30171 !! wikitext/edited
30172 !! end
30173
30174 !! test
30175 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
30176 !! options
30177 parsoid={
30178 "modes": ["html2wt"],
30179 "scrubWikitext": true
30180 }
30181 !! html/parsoid
30182 <h2>foo<br/>bar</h2>
30183 <h2>foo <span><br/>bar</span> baz</h2>
30184 !! wikitext
30185 == foo bar ==
30186
30187 == foo <span> bar</span> baz ==
30188 !! end
30189
30190 !! test
30191 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
30192 !! options
30193 parsoid={
30194 "modes": ["html2wt"],
30195 "scrubWikitext": false
30196 }
30197 !! html/parsoid
30198 <h2>foo<br/>bar</h2>
30199 !! wikitext
30200 == foo<br />bar ==
30201 !! end
30202
30203 !! test
30204 1. WT Quote Tags: suppress newly created empty style tags
30205 !! options
30206 parsoid={
30207 "modes": ["html2wt"],
30208 "scrubWikitext": true
30209 }
30210 !! html/parsoid
30211 <i></i><b></b>
30212 !! wikitext
30213 !! end
30214
30215 !! test
30216 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
30217 !! options
30218 parsoid=html2wt
30219 !! html/parsoid
30220 <i></i><b></b>
30221 !! wikitext
30222 ''<nowiki/>'''''<nowiki/>'''
30223 !! end
30224
30225 !! test
30226 3. WT Quote Tags: suppress empty style tags on edits
30227 !! options
30228 parsoid={
30229 "modes": ["selser"],
30230 "scrubWikitext": true,
30231 "changes": [
30232 [ "#x", "remove"]
30233 ]
30234 }
30235 !! wikitext
30236 '''<span id="x">foo</span>'''
30237 !! wikitext/edited
30238 !! end
30239
30240 !! test
30241 1. Anchors: suppress newly created empty anchors
30242 !! options
30243 parsoid={
30244 "modes": ["html2wt"],
30245 "scrubWikitext": true
30246 }
30247 !! html/parsoid
30248 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
30249 !! wikitext
30250 !! end
30251
30252 !! test
30253 2. Anchors: don't suppress empty anchors if scrubWikitext is false
30254 !! options
30255 parsoid={
30256 "modes": ["html2wt"],
30257 "scrubWikitext": false
30258 }
30259 !! html/parsoid
30260 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
30261 !! wikitext
30262 [[Test|<nowiki/>]]
30263 !! end
30264
30265 !! test
30266 3. Anchors: suppress empty anchors on edits
30267 !! options
30268 parsoid={
30269 "modes": ["selser"],
30270 "scrubWikitext": true,
30271 "changes": [
30272 [ "#x", "remove"]
30273 ]
30274 }
30275 !! wikitext
30276 [[Test|<span id="x">foo</span>]]
30277 !! wikitext/edited
30278 !! end
30279
30280 !! test
30281 3a. Anchors: do not suppress numbered extlinks
30282 !! options
30283 parsoid={
30284 "modes": ["wt2wt"],
30285 "scrubWikitext": true
30286 }
30287 !! wikitext
30288 [http://foo.com]
30289 !! html/parsoid
30290 <a rel="mw:ExtLink" href="http://foo.com"></a>
30291 !! end
30292
30293 !! test
30294 3b. Anchors: do not suppress numbered extlinks
30295 !! options
30296 parsoid={
30297 "modes": ["wt2wt"],
30298 "scrubWikitext": true,
30299 "changes": [
30300 [ "#x", "remove"]
30301 ]
30302 }
30303 !! wikitext
30304 [http://foo.com <span id="x">foo</span>]
30305 !! wikitext/edited
30306 [http://foo.com]
30307 !! end
30308
30309 !!test
30310 Normalizations should be restricted to edited content
30311 !!options
30312 parsoid={
30313 "modes": ["selser"],
30314 "scrubWikitext": true,
30315 "changes": [
30316 [ "h1", "before", "<i></i>"]
30317 ]
30318 }
30319 !!wikitext
30320 a
30321 = =
30322 b
30323 !!wikitext/edited
30324 a
30325 = =
30326 b
30327 !!end
30328
30329 !! test
30330 1. Multiple normalizations (html2wt)
30331 !! options
30332 parsoid={
30333 "modes": ["html2wt"],
30334 "scrubWikitext": true
30335 }
30336 !! html/parsoid
30337 <h2><i></i></h2>
30338 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
30339 </a><b><i></i></b>x</p>
30340 !! wikitext
30341
30342 [[foo]]
30343 x
30344 !! end
30345
30346 !! test
30347 2. Multiple normalizations (selser)
30348 !! options
30349 parsoid={
30350 "modes": ["selser"],
30351 "scrubWikitext": true,
30352 "changes": [
30353 [ "#x", "after", "<h1><i></i></h1>\n<p> bar<b></b></p>"]
30354 ]
30355 }
30356 !! wikitext
30357 <div id="x">foo</div>
30358 !! wikitext/edited
30359 <div id="x">foo</div>
30360 bar
30361 !! end
30362
30363 !! test
30364 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
30365 !! options
30366 parsoid={
30367 "modes": ["html2wt"],
30368 "scrubWikitext": true
30369 }
30370 !! html/parsoid
30371 <p> hi</p>
30372 <p> hello</p>
30373 !! wikitext
30374 hi
30375
30376 hello
30377 !! end
30378
30379 !! test
30380 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
30381 !! options
30382 parsoid=html2wt
30383 !! html/parsoid
30384 <p> hi</p>
30385 <p> hello</p>
30386 !! wikitext
30387 <nowiki> </nowiki>hi
30388
30389 <nowiki> </nowiki> hello
30390 !! end
30391
30392 !! test
30393 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
30394 !! options
30395 parsoid={
30396 "modes": ["html2wt"],
30397 "scrubWikitext": true
30398 }
30399 !! html/parsoid
30400 <p>Foo
30401 bar
30402 baz</p>
30403
30404 <table><tr><td>Foo
30405 bar
30406 baz bang</td></tr></table>
30407
30408 <p><!--boo--> foo
30409 bar</p>
30410
30411 <p> foo
30412 bar<span>boo</span></p>
30413 !! wikitext
30414 Foo
30415 bar
30416 baz
30417
30418 {|
30419 |Foo
30420 bar
30421 baz bang
30422 |}
30423
30424 <!--boo-->foo
30425 bar
30426
30427 foo
30428 bar<span>boo</span>
30429 !! end
30430
30431 !! test
30432 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
30433 !! options
30434 parsoid={
30435 "modes": ["selser"],
30436 "scrubWikitext": true,
30437 "changes": [
30438 [ "p", "html", " a\n b" ]
30439 ]
30440 }
30441 !! wikitext
30442 xyz
30443 !! wikitext/edited
30444 a
30445 b
30446 !! end
30447
30448 !! test
30449 1. New links that end in spaces
30450 !! options
30451 parsoid={
30452 "modes": ["html2wt"],
30453 "scrubWikitext": false
30454 }
30455 !! html/parsoid
30456 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30457 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30458 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30459 !! wikitext
30460 [[Berlin ]]<nowiki/>is the capital of Germany.
30461
30462 [[Foo ]]'''bar'''
30463
30464 [[Boston ]] is a city.
30465 !! end
30466
30467 !! test
30468 2. New links that end in spaces
30469 !! options
30470 parsoid={
30471 "modes": ["html2wt"],
30472 "scrubWikitext": true
30473 }
30474 !! html/parsoid
30475 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30476 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30477 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30478 !! wikitext
30479 [[Berlin]] is the capital of Germany.
30480
30481 [[Foo]] '''bar'''
30482
30483 [[Boston]] is a city.
30484 !! end
30485
30486 !! test
30487 1. Table cells with escapable prefixes
30488 !! options
30489 parsoid={
30490 "modes": ["html2wt"],
30491 "scrubWikitext": false
30492 }
30493 !! html/parsoid
30494 <table>
30495 <tr><td>a</td></tr>
30496 <tr><td>-</td></tr>
30497 <tr><td>+</td></tr>
30498 <tr><td>}</td></tr>
30499 </table>
30500 !! wikitext
30501 {|
30502 |a
30503 |-
30504 |<nowiki>-</nowiki>
30505 |-
30506 |<nowiki>+</nowiki>
30507 |-
30508 |<nowiki>}</nowiki>
30509 |}
30510 !! end
30511
30512 !! test
30513 2. Table cells with escapable prefixes
30514 !! options
30515 parsoid={
30516 "modes": ["html2wt"],
30517 "scrubWikitext": true
30518 }
30519 !! html/parsoid
30520 <table>
30521 <tr><td>a</td></tr>
30522 <tr><td>-</td></tr>
30523 <tr><td>+</td></tr>
30524 <tr><td>}</td></tr>
30525 </table>
30526 !! wikitext
30527 {|
30528 |a
30529 |-
30530 | -
30531 |-
30532 | +
30533 |-
30534 | }
30535 |}
30536 !! end
30537
30538 !! test
30539 3a. Table cells with escapable prefixes after edits
30540 !! options
30541 parsoid={
30542 "modes": ["selser"],
30543 "scrubWikitext": true,
30544 "changes": [
30545 [ "table tbody tr:first-child td:first-child", "remove"]
30546 ]
30547 }
30548 !! wikitext
30549 {|
30550 |a||-
30551 |}
30552 !! wikitext/edited
30553 {|
30554 | -
30555 |}
30556 !! end
30557
30558 !! test
30559 3b. Table cells with escapable prefixes after edits
30560 !! options
30561 parsoid={
30562 "modes": ["selser"],
30563 "scrubWikitext": true,
30564 "changes": [
30565 [ "table tbody tr:first-child td:first-child", "html", "-" ],
30566 [ "#x", "remove" ]
30567 ]
30568 }
30569 !! wikitext
30570 {|
30571 |pqr
30572 |<span id="x">foo</span>+
30573 |}
30574 !! wikitext/edited
30575 {|
30576 | -
30577 | +
30578 |}
30579 !! end
30580
30581 # FIXME: This test will fail because
30582 # normalization doesn't realize that the id attribute
30583 # will eliminate the escapable scenario
30584 !! test
30585 4a. Table cells without escapable prefixes after edits
30586 !! options
30587 parsoid={
30588 "modes": ["selser"],
30589 "scrubWikitext": true,
30590 "changes": [
30591 [ "#x", "html", "-" ]
30592 ]
30593 }
30594 !! wikitext
30595 {|
30596 | id="x" |abcd
30597 |}
30598 !! wikitext/edited
30599 {|
30600 | id="x" |-
30601 |}
30602 !! end
30603
30604 ## This tests normalizer's ability to discriminate between
30605 ## cells having identical content.
30606 !! test
30607 4b. Table cells without escapable prefixes after edits
30608 !! options
30609 parsoid={
30610 "modes": ["selser"],
30611 "scrubWikitext": true,
30612 "changes": [
30613 [ "td", "html", "-" ]
30614 ]
30615 }
30616 !! wikitext
30617 {|
30618 |a||b
30619 |}
30620 !! wikitext/edited
30621 {|
30622 | -||-
30623 |}
30624 !! end
30625
30626 ## This tests normalizer's ability to not be tripped by
30627 ## comments (and whitespace)
30628 !! test
30629 4c. Table cells without escapable prefixes after edits
30630 !! options
30631 parsoid={
30632 "modes": ["selser"],
30633 "scrubWikitext": true,
30634 "changes": [
30635 [ "table tbody tr td:first-child", "remove" ]
30636 ]
30637 }
30638 !! wikitext
30639 {|
30640 |-
30641 <!--foo--> |a||-
30642 |}
30643 !! wikitext/edited
30644 {|
30645 |-
30646 <!--foo--> | -
30647 |}
30648 !! end
30649
30650 ## This tests normalizer's ability to handle HTML cells
30651 !! test
30652 4d. Table cells without escapable prefixes after edits
30653 !! options
30654 parsoid={
30655 "modes": ["selser"],
30656 "scrubWikitext": true,
30657 "changes": [
30658 [ "td", "html", "-" ]
30659 ]
30660 }
30661 !! wikitext
30662 <table>
30663 <tr><td>a</td></tr>
30664 </table>
30665 !! wikitext/edited
30666 <table>
30667 <tr><td>-</td></tr>
30668 </table>
30669 !! end
30670
30671 ## T111151 Remove font elements without attributes
30672 !! test
30673 5a. font tags without attributes should be dropped in scrubWikitext mode
30674 !! options
30675 parsoid={
30676 "modes": ["html2wt"],
30677 "scrubWikitext": true
30678 }
30679 !! html/parsoid
30680 <font>foo</font>
30681 <font><font>bar</font></font>
30682 <font class="x">boo</font>
30683 !! wikitext
30684 foo
30685 bar
30686 <font class="x">boo</font>
30687 !! end
30688
30689 !! test
30690 5b. font tags should not be dropped without scrubWikitext being enabled
30691 !! options
30692 parsoid={
30693 "modes": ["html2wt"],
30694 "scrubWikitext": false
30695 }
30696 !! html/parsoid
30697 <font>foo</font>
30698 !! wikitext
30699 <font>foo</font>
30700 !! end
30701
30702 !! test
30703 Ignore empty <p></p> when scrubWikitext is false
30704 !! options
30705 parsoid={
30706 "modes": ["html2wt"],
30707 "scrubWikitext": false
30708 }
30709 !! html/parsoid
30710 <div>1</div>
30711 <p>a</p><p></p><p>b</p>
30712 <div>2</div>
30713 <p>a</p>
30714 <p></p>
30715 <p>b</p>
30716 <div>3</div>
30717 <p>a</p>
30718 <p></p>
30719 <p></p>
30720 <p></p>
30721 <p></p>
30722 <p>b</p>
30723 !! wikitext
30724 <div>1</div>
30725 a
30726
30727 b
30728 <div>2</div>
30729 a
30730
30731 b
30732 <div>3</div>
30733 a
30734
30735 b
30736 !! html/php+tidy
30737 <div>1</div>
30738 <p>a
30739 </p><p>b
30740 </p>
30741 <div>2</div>
30742 <p>a
30743 </p><p>b
30744 </p>
30745 <div>3</div>
30746 <p>a
30747 </p><p>b
30748 </p>
30749 !! end
30750
30751 !! test
30752 Normalize empty paragraphs to HTML form that html2wt expects
30753 !! options
30754 parsoid={
30755 "modes": ["html2wt"],
30756 "scrubWikitext": true
30757 }
30758 !! html/parsoid
30759 <div>1</div>
30760 <p>a</p><p></p><p>b</p>
30761 <div>2</div>
30762 <p>a</p>
30763 <p></p>
30764 <p>b</p>
30765 <div>3</div>
30766 <p>a</p>
30767 <p></p>
30768 <p></p>
30769 <p></p>
30770 <p></p>
30771 <p>b</p>
30772 <div>4</div>
30773 <p>a</p>
30774 <p></p>
30775 <div>foo</div>
30776 !! wikitext
30777 <div>1</div>
30778 a
30779
30780
30781 b
30782 <div>2</div>
30783 a
30784
30785
30786 b
30787 <div>3</div>
30788 a
30789
30790
30791
30792
30793
30794 b
30795 <div>4</div>
30796 a
30797
30798 <br />
30799 <div>foo</div>
30800 !! html/php+tidy
30801 <div>1</div>
30802 <p>a
30803 </p><p><br />
30804 b
30805 </p>
30806 <div>2</div>
30807 <p>a
30808 </p><p><br />
30809 b
30810 </p>
30811 <div>3</div>
30812 <p>a
30813 </p><p><br />
30814 </p><p><br />
30815 </p><p>b
30816 </p>
30817 <div>4</div>
30818 <p>a
30819 </p><p><br />
30820 </p>
30821 <div>foo</div>
30822 !! end
30823
30824 !! test
30825 Empty paragraphs (marked with mw-empty-elt) found in source should not be normalized away
30826 !! options
30827 parsoid={
30828 "modes": ["html2wt"],
30829 "scrubWikitext": true
30830 }
30831 !! html/parsoid
30832 <table>
30833 <tbody>
30834 <tr>
30835 <td><div>foo
30836 </div>
30837 <p class="mw-empty-elt"></p>
30838 </td>
30839 </tr>
30840 </tbody>
30841 <caption></caption>
30842 </table>
30843 !! wikitext
30844 {|
30845 |<div>foo
30846 </div>
30847 |+
30848 |}
30849 !! end
30850
30851 !! test
30852 Templated content should be skipped over by normalization
30853 !! options
30854 parsoid={
30855 "modes": ["html2wt"],
30856 "scrubWikitext": true
30857 }
30858 !! html/parsoid
30859 <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">
30860 </span><p about="#mwt2"></p><span about="#mwt2">
30861 </span>
30862 !! wikitext
30863 {{SomeTemplate1|boo}}{{SomeTemplate2|booboo}}
30864 !! end
30865
30866 !! test
30867 Escape nowiki DOM elements
30868 !! options
30869 parsoid=html2wt
30870 !! html/parsoid
30871 <nowiki><i>foo</i></nowiki>
30872 !! wikitext
30873 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
30874 !! end
30875
30876 # This is meant to be an interim fix while we go about figuring out
30877 # how to not introduce these trailing <nowiki/>s in the first place.
30878 !! test
30879 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
30880 !! options
30881 parsoid=html2wt
30882 !! html/parsoid
30883 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
30884 y</p>
30885 <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>
30886 <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>
30887 !! wikitext
30888 x
30889 y
30890
30891 {{echo|
30892 1 = <nowiki/>}}
30893
30894 {{echo|
30895 1 = <nowiki/>
30896 }}
30897 !! end
30898
30899 !! test
30900 New list is serialized on newlines
30901 !! options
30902 parsoid=html2wt
30903 !! html/parsoid
30904 <p>The quick brown fox jumps over the lazy dog.</p><ul>
30905 <li>Yesterday</li>
30906 <li>Today</li>
30907 <li>Tomorrow</li>
30908 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
30909 !! wikitext
30910 The quick brown fox jumps over the lazy dog.
30911
30912 * Yesterday
30913 * Today
30914 * Tomorrow
30915
30916 The quick onyx goblin jumps over the lazy dwarf.
30917 !! end
30918
30919 !! test
30920 New lists in formatting elements serialized w/o newlines
30921 !! options
30922 parsoid=html2wt
30923 !! html/parsoid
30924 <small>
30925
30926 <ul>
30927 <li>123</li>
30928 </ul>
30929
30930 </small>
30931
30932 <small><ul><li>hi</li></ul></small>
30933 !! wikitext
30934 <small>
30935 * 123
30936 </small>
30937
30938 <small>
30939 * hi
30940 </small>
30941 !! end
30942
30943 !! test
30944 New list in table doesn't need newlines
30945 !! options
30946 parsoid=html2wt
30947 !! html/parsoid
30948 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
30949 !! wikitext
30950 {|
30951 |
30952 * test
30953 * 123
30954 |}
30955 !! end
30956
30957 # ---------------------------------------------------
30958 # End of tests spec'ing wikitext serialization norms |
30959 # ---------------------------------------------------
30960
30961 # T104032
30962 !! test
30963 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
30964 !! options
30965 parsoid=html2wt
30966 !! html/parsoid
30967 a<p>b</p>
30968 <b>c</b><p>d</p>
30969 <table><tr>
30970 <td>a<p>b</p></td>
30971 <td><b>c</b><p>d</p></td>
30972 </tr></table>
30973 !! wikitext
30974 a
30975
30976 b
30977
30978 '''c'''
30979
30980 d
30981 {|
30982 |a
30983 b
30984 |'''c'''
30985 d
30986 |}
30987 !! end
30988
30989 !! test
30990 Anchor without href scenarios
30991 !! options
30992 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30993 !! html/parsoid
30994 <a class="bc"></a>
30995 <a class="no">dice</a>
30996 <a name="foo"></a>
30997 !! wikitext
30998
30999 dice
31000 <span name="foo"></span>
31001 !! end
31002
31003 !! test
31004 New transclusion added after a list should be serialized after the list
31005 !! options
31006 parsoid=html2wt
31007 !! html/parsoid
31008 <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>
31009 !! wikitext
31010 * a
31011 {{echo|foo}}
31012 !! end
31013
31014 # -----------------------------------------------------------------
31015 # End of section for Parsoid-only html2wt tests for serialization
31016 # of new content
31017 # -----------------------------------------------------------------
31018
31019 # -----------------------------------------------------------------
31020 # The following section of tests are primarily to spec behavior of
31021 # the selective serializer. All these tests have manual selser
31022 # changes. The automated selser changes for all tests handle the
31023 # wide variation of changes, but these tests here capture specs
31024 # deterministically.
31025 # ----------------------------------------------------------------
31026
31027 ## T90517
31028 !! test
31029 Selser: New comments should not be lost
31030 !! options
31031 parsoid={
31032 "modes": ["selser"],
31033 "changes": [
31034 [ "#a", "after", "<!--c1-->" ],
31035 [ "#b", "before", "<!--c2-->" ]
31036 ]
31037 }
31038 !! wikitext
31039 <span id="a">a</span>
31040
31041 <span id="b">b</span>
31042 !! wikitext/edited
31043 <span id="a">a</span><!--c1-->
31044
31045 <!--c2--><span id="b">b</span>
31046 !! end
31047
31048 ## T89383
31049 !! test
31050 Selser: Check for validity of DSR before using it
31051 !! options
31052 parsoid={
31053 "modes": ["selser"],
31054 "changes": [
31055 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
31056 ]
31057 }
31058 !! wikitext
31059 <span id="a">a</span>
31060 !! wikitext/edited
31061 {{DISPLAYTITLE:foo}}
31062 <span id="a">a</span>
31063 !! end
31064
31065 !! test
31066 1. DOMDiff: Changes to <ref> content should be looked up using id
31067 !! options
31068 parsoid={
31069 "modes": ["selser"],
31070 "changes": [
31071 ["#X", "after", "bar"],
31072 ["#Y", "after", "baz"]
31073 ]
31074 }
31075 !! wikitext
31076 X <ref><span id="X">foo</span></ref>
31077 Y <ref name="a" />
31078 <references>
31079 <ref name="a"><span id="Y">foo</span></ref>
31080 </references>
31081 !! wikitext/edited
31082 X <ref><span id="X">foo</span>bar</ref>
31083 Y <ref name="a" />
31084 <references>
31085 <ref name="a"><span id="Y">foo</span>baz</ref>
31086 </references>
31087 !! end
31088
31089 !! test
31090 2. DOMDiff: Changes to <ref> content should be looked up using id
31091 !! options
31092 parsoid={
31093 "modes": ["selser"],
31094 "changes": [
31095 ["#Z", "after", "bar"]
31096 ]
31097 }
31098 !! wikitext
31099 A <ref>foo bar for a</ref>
31100 B <ref group="X" name="b" />
31101
31102 <references />
31103
31104 <references group="X">
31105 <ref name="b"><span id="Z">foo</span></ref>
31106 </references>
31107 !! wikitext/edited
31108 A <ref>foo bar for a</ref>
31109 B <ref group="X" name="b" />
31110
31111 <references />
31112
31113 <references group="X">
31114 <ref name="b"><span id="Z">foo</span>bar</ref>
31115 </references>
31116 !! end
31117
31118 !! test
31119 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
31120 !! options
31121 parsoid={
31122 "modes": ["selser"],
31123 "changes": [
31124 [ "div:first-child", "text", "bar" ]
31125 ]
31126 }
31127 !! wikitext
31128 <div style="{{1x|color:red;}}%">foo</div>
31129 !! wikitext/edited
31130 <div style="{{1x|color:red;}}%">bar</div>
31131 !! end
31132
31133 !! test
31134 Empty LI (T49673)
31135 !! wikitext
31136 *a
31137 *
31138 *
31139 *b
31140 !! html+tidy
31141 <ul><li>a</li>
31142 <li class="mw-empty-elt"></li>
31143 <li class="mw-empty-elt"></li>
31144 <li>b</li></ul>
31145 !! end
31146
31147 !! test
31148 Thumbnail output
31149 !! wikitext
31150 [[File:Thumb.png|thumb]]
31151 !! html/php+tidy
31152 <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>
31153 !! html/parsoid
31154 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Thumb.png"><img resource="./File:Thumb.png" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption></figcaption></figure>
31155 !! end
31156
31157 !! test
31158 unclosed internal link XSS (T137264)
31159 !! wikitext
31160 [[#%3Cscript%3Ealert(1)%3C/script%3E|
31161 !! html/php
31162 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
31163 </p>
31164 !! html/parsoid
31165 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
31166 !! end
31167
31168 !! test
31169 Validating that <style> isn't eaten by tidy (T167349)
31170 !! options
31171 styletag=1
31172 !! wikitext
31173 <div class="foo">
31174 <style>.foo::before { content: "<foo>"; }</style>
31175 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
31176 </div>
31177 !! html/php+tidy
31178 <div class="foo">
31179 <style>.foo::before { content: "<foo>"; }</style>
31180 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
31181 </div>
31182 !! html/parsoid
31183 <div class="foo">
31184 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31185 <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>
31186 </div>
31187 !! end
31188
31189 ## Right now, Parsoid doesn't de-duplicate style tags.
31190 ## So, we shouldn't see link tags that need to bypass the sanitizer.
31191 ## In a followup patch, when we de-duplicate style tags and
31192 ## introduce link tags, we'll add a hook for link tags in
31193 ## the parser test runner script.
31194 !! test
31195 Validating that <style> isn't wrapped in a paragraph (T186965)
31196 !! options
31197 styletag=1
31198 !! wikitext
31199 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31200
31201 <style>.foo::before { content: "<foo>"; }</style>
31202
31203 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
31204
31205 But if it's on a line with other content, let it be wrapped.
31206
31207 <style>.foo::before { content: "<foo>"; }</style> bar
31208
31209 foo <style>.foo::before { content: "<foo>"; }</style>
31210
31211 foo <style>.foo::before { content: "<foo>"; }</style> bar
31212
31213 And the same if we have non-paragraph-breaking whitespace
31214
31215 foo
31216 <style>.foo::before { content: "<foo>"; }</style>
31217 bar
31218 !! html/php
31219 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31220 </p>
31221 <style>.foo::before { content: "<foo>"; }</style>
31222 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
31223 <p>But if it's on a line with other content, let it be wrapped.
31224 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
31225 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
31226 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
31227 </p><p>And the same if we have non-paragraph-breaking whitespace
31228 </p><p>foo
31229 <style>.foo::before { content: "<foo>"; }</style>
31230 bar
31231 </p>
31232 !! html/parsoid
31233 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph</p>
31234
31235 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31236
31237 <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>
31238
31239 <p>But if it's on a line with other content, let it be wrapped.</p>
31240
31241 <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>
31242
31243 <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>
31244
31245 <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>
31246
31247 <p>And the same if we have non-paragraph-breaking whitespace</p>
31248
31249 <p>foo
31250 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31251 bar</p>
31252 !! end
31253
31254 !! test
31255 Validating that <link> isn't wrapped in a paragraph (T186965)
31256 !! options
31257 styletag=1
31258 !! wikitext
31259 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31260
31261 <link rel="foo" href="bar"/>
31262
31263 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
31264
31265 But if it's on a line with other content, let it be wrapped.
31266
31267 <link rel="foo" href="bar"/> bar
31268
31269 foo <link rel="foo" href="bar"/>
31270
31271 foo <link rel="foo" href="bar"/> bar
31272
31273 And the same if we have non-paragraph-breaking whitespace
31274
31275 foo
31276 <link rel="foo" href="bar"/>
31277 bar
31278 !! html/php
31279 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31280 </p>
31281 <link rel="foo" href="bar"/>
31282 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
31283 <p>But if it's on a line with other content, let it be wrapped.
31284 </p><p><link rel="foo" href="bar"/> bar
31285 </p><p>foo <link rel="foo" href="bar"/>
31286 </p><p>foo <link rel="foo" href="bar"/> bar
31287 </p><p>And the same if we have non-paragraph-breaking whitespace
31288 </p><p>foo
31289 <link rel="foo" href="bar"/>
31290 bar
31291 </p>
31292 !! end
31293
31294 !! test
31295 Extension returning multiple nodes starting with a style tag roundtrips
31296 !! options
31297 wgRawHtml=1
31298 !! wikitext
31299 <table>
31300 {{echo|<html><style>.hi { color: red; }</style>
31301 </html>}}
31302 <tr><td class="hi">ho</td></tr>
31303 </table>
31304 !! html/parsoid
31305 <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">
31306 </span></p><table about="#mwt5" data-parsoid='{"stx":"html"}'>
31307
31308 <tbody><tr><td class="hi">ho</td></tr>
31309 </tbody></table>
31310 !! end
31311
31312 !! test
31313 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
31314 !! config
31315 wgFragmentMode=[ 'html5', 'legacy' ]
31316 !! wikitext
31317 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
31318 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
31319 !! html/php
31320 <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>
31321 <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>
31322 </p>
31323 !! html/parsoid
31324 <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>
31325 <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>
31326 !! end
31327
31328 !! test
31329 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
31330 !! config
31331 wgFragmentMode=[ 'legacy' ]
31332 !! wikitext
31333 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
31334 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
31335 !! html/php
31336 <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>
31337 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
31338 </p>
31339 !! end
31340
31341 !! test
31342 Decoding of HTML entities in embedded HTML tags
31343 !! wikitext
31344 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
31345 !! html/php
31346 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
31347 !! html/parsoid
31348 <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>
31349 !! end
31350
31351 !! test
31352 Decoding of HTML entities in indicator names for IDs (T104196)
31353 !! options
31354 parsoid=wt2html,html2html
31355 showindicators
31356 !! wikitext
31357 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
31358 !! html/php
31359 1&2&3&amp;4&amp;amp;5=Indicator
31360
31361 !! html/parsoid
31362 <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>
31363 !! end
31364
31365 # this version of the test strips out the ambiguity so Parsoid rts cleanly
31366 !! test
31367 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
31368 !! options
31369 showindicators
31370 !! wikitext
31371 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
31372 !! html/php
31373 1&2&3&amp;4&amp;amp;5=Indicator
31374
31375 !! html/parsoid
31376 <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>
31377 !! end
31378
31379 # This fragment mode is what Parsoid supports.
31380 !! test
31381 HTML5 ids: fallback to legacy
31382 !! config
31383 wgFragmentMode=[ 'html5', 'legacy' ]
31384 !! wikitext
31385 ==Foo bar==
31386
31387 ==foo Bar==
31388
31389 ==Тест==
31390
31391 ==Тест==
31392
31393 ==тест==
31394
31395 ==Hey < # " > % : '==
31396 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31397
31398 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31399
31400 <!-- These two links should produce identical HTML -->
31401 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31402
31403 !! html/php
31404 <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>
31405 <ul>
31406 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31407 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31408 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
31409 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
31410 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
31411 <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>
31412 </ul>
31413 </div>
31414
31415 <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>
31416 <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>
31417 <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>
31418 <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>
31419 <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>
31420 <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>
31421 <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>
31422 </p><p>💩 <span id="💩"></span>
31423 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
31424 </p>
31425 !! html/parsoid
31426 <h2 id="Foo_bar">Foo bar</h2>
31427
31428 <h2 id="foo_Bar_2">foo Bar</h2>
31429
31430 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
31431
31432 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
31433
31434 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
31435
31436 <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>
31437 <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>
31438
31439 <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>
31440
31441 <!-- These two links should produce identical HTML -->
31442 <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>
31443 !! end
31444
31445 # Parsoid doesn't support this mode
31446 !! test
31447 HTML5 ids: legacy with a fallback to modern
31448 !! config
31449 wgFragmentMode=[ 'legacy', 'html5' ]
31450 !! wikitext
31451 ==Foo bar==
31452
31453 ==foo Bar==
31454
31455 ==Тест==
31456
31457 ==Тест==
31458
31459 ==тест==
31460
31461 ==Hey < # " > % : '==
31462 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31463
31464 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31465
31466 <!-- These two links should produce identical HTML -->
31467 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31468
31469 !! html/php
31470 <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>
31471 <ul>
31472 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31473 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31474 <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>
31475 <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>
31476 <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>
31477 <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>
31478 </ul>
31479 </div>
31480
31481 <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>
31482 <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>
31483 <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>
31484 <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>
31485 <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>
31486 <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>
31487 <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>
31488 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
31489 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
31490 </p>
31491 !! end
31492
31493 # Parsoid doesn't support this mode.
31494 !! test
31495 HTML5 ids: no legacy
31496 !! config
31497 wgFragmentMode=[ 'html5' ]
31498 !! wikitext
31499 ==Foo bar==
31500
31501 ==foo Bar==
31502
31503 ==Тест==
31504
31505 ==Тест==
31506
31507 ==тест==
31508
31509 ==Hey < # " > % : '==
31510 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31511
31512 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31513
31514 <!-- These two links should produce identical HTML -->
31515 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31516
31517 !! html/php
31518 <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>
31519 <ul>
31520 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31521 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31522 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
31523 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
31524 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
31525 <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>
31526 </ul>
31527 </div>
31528
31529 <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>
31530 <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>
31531 <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>
31532 <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>
31533 <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>
31534 <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>
31535 <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>
31536 </p><p>💩 <span id="💩"></span>
31537 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
31538 </p>
31539 !! end
31540
31541 !! test
31542 T90902: Normalize weird characters in section IDs
31543 !! config
31544 wgFragmentMode=[ 'html5', 'legacy' ]
31545 !! wikitext
31546 ==Foo&nbsp;bar==
31547 [[#Foo&nbsp;bar]]
31548
31549 !! html/php
31550 <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>
31551 <p><a href="#Foo_bar">#Foo&#160;bar</a>
31552 </p>
31553 !! html/parsoid
31554 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
31555 <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>
31556 !! end
31557
31558 !! test
31559 T51672: Test for brackets in attributes of elements in external link texts
31560 !! wikitext
31561 [http://example.com/ link <span title="title with [brackets]">span</span>]
31562 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
31563
31564 !! html/php
31565 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31566 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31567 </p>
31568 !! html/parsoid
31569 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
31570 <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>
31571 !! end
31572
31573 !! test
31574 T72875: Test for brackets in attributes of elements in internal link texts
31575 !! wikitext
31576 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
31577 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
31578
31579 !! html/php
31580 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31581 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31582 </p>
31583 !! html/parsoid
31584 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
31585 <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>
31586 !! end
31587
31588 !! test
31589 T199926: html arrow wt: Parsoid sometimes trips up on verticalbar chars in hrefs
31590 !! options
31591 parsoid={
31592 "modes": ["html2wt"]
31593 }
31594 !! html/parsoid
31595 <a href="https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total">9</a>
31596 <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>
31597 !! wikitext
31598 [https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total 9]
31599 [[stats:v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total|10]]
31600 !! end
31601
31602 ## FIXME: "gerrit" isn't in PHP's setupInterwikis
31603 !! test
31604 T199926: Hash only interwiki link
31605 !! wikitext
31606 [[meatball:Test#1/2]]
31607 [[gerrit:#/q/project:mediawiki/services/parsoid|Gerrit]]
31608 !! html/php+tidy
31609 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Test#1.2F2" class="extiw" title="meatball:Test">meatball:Test#1/2</a>
31610 <a href="/index.php?title=Gerrit:&amp;action=edit&amp;redlink=1" class="new" title="Gerrit: (page does not exist)">Gerrit</a>
31611 </p>
31612 !! html/parsoid
31613 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Test#1.2F2" title="meatball:Test" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Test#1.2F2"},"sa":{"href":"meatball:Test#1/2"},"isIW":true}'>meatball:Test#1/2</a>
31614 <a rel="mw:WikiLink/Interwiki" href="https://gerrit.wikimedia.org/#/q/project:mediawiki/services/parsoid">Gerrit</a></p>
31615 !! end
31616
31617 !! test
31618 T179544: {{anchorencode:}} output should be always usable in links
31619 !! config
31620 wgFragmentMode=[ 'html5' ]
31621 !! wikitext
31622 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
31623 !! html/php
31624 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
31625 </p>
31626 !! html/parsoid
31627 <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>
31628 !! end
31629
31630 ## ------------------------------
31631 ## Parsoid section-wrapping tests
31632 ## ------------------------------
31633 !! test
31634 Section wrapping for well-nested sections (no leading content)
31635 !! options
31636 notoc
31637 parsoid={
31638 "wrapSections": true
31639 }
31640 !! wikitext
31641 =1=
31642 a
31643
31644 =2=
31645 b
31646
31647 ==2.1==
31648 c
31649
31650 ==2.2==
31651 d
31652
31653 ===2.2.1===
31654 e
31655
31656 =3=
31657 f
31658 !! html/php+tidy
31659
31660 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
31661 <p>a
31662 </p>
31663 <h1><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
31664 <p>b
31665 </p>
31666 <h2><span class="mw-headline" id="2.1">2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
31667 <p>c
31668 </p>
31669 <h2><span class="mw-headline" id="2.2">2.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 2.2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
31670 <p>d
31671 </p>
31672 <h3><span class="mw-headline" id="2.2.1">2.2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 2.2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
31673 <p>e
31674 </p>
31675 <h1><span class="mw-headline" id="3">3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
31676 <p>f
31677 </p>
31678 !! html/parsoid
31679 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
31680 <p>a</p>
31681
31682 </section><section data-mw-section-id="2"><h1 id="2" data-parsoid="{}">2</h1>
31683 <p>b</p>
31684
31685 <section data-mw-section-id="3"><h2 id="2.1" data-parsoid="{}">2.1</h2>
31686 <p>c</p>
31687
31688 </section><section data-mw-section-id="4"><h2 id="2.2" data-parsoid="{}">2.2</h2>
31689 <p>d</p>
31690
31691 <section data-mw-section-id="5"><h3 id="2.2.1" data-parsoid="{}">2.2.1</h3>
31692 <p>e</p>
31693
31694 </section></section></section><section data-mw-section-id="6"><h1 id="3" data-parsoid="{}">3</h1>
31695 <p>f</p>
31696
31697 </section>
31698 !! end
31699
31700 !! test
31701 Section wrapping for well-nested sections (with leading content)
31702 !! options
31703 notoc
31704 parsoid={
31705 "wrapSections": true
31706 }
31707 !! wikitext
31708 Para 1.
31709
31710 Para 2 with a <div>nested in it</div>
31711
31712 Para 3.
31713
31714 =1=
31715 a
31716
31717 =2=
31718 b
31719
31720 ==2.1==
31721 c
31722 !! html/php+tidy
31723 <p>Para 1.
31724 </p><p>
31725 Para 2 with a </p><div>nested in it</div>
31726 <p>Para 3.
31727 </p>
31728 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
31729 <p>a
31730 </p>
31731 <h1><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
31732 <p>b
31733 </p>
31734 <h2><span class="mw-headline" id="2.1">2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
31735 <p>c
31736 </p>
31737 !! html/parsoid
31738 <section data-mw-section-id="0"><p>Para 1.</p>
31739
31740 <p>Para 2 with a </p><div>nested in it</div>
31741
31742 <p>Para 3.</p>
31743
31744 </section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
31745 <p>a</p>
31746
31747 </section><section data-mw-section-id="2"><h1 id="2" data-parsoid="{}">2</h1>
31748 <p>b</p>
31749
31750 <section data-mw-section-id="3"><h2 id="2.1" data-parsoid="{}">2.1</h2>
31751 <p>c</p>
31752
31753 </section></section>
31754 !! end
31755
31756 !! test
31757 Section wrapping with template-generated sections (good nesting 1)
31758 !! options
31759 notoc
31760 parsoid={
31761 "wrapSections": true
31762 }
31763 !! wikitext
31764 =1=
31765 a
31766
31767 {{echo|1=
31768 ==1.1==
31769 b
31770 }}
31771 ==1.2==
31772 c
31773
31774 =2=
31775 d
31776 !! html/php+tidy
31777
31778 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
31779 <p>a
31780 </p>
31781 <h2><span class="mw-headline" id="1.1">1.1</span></h2>
31782 <p>b
31783 </p>
31784 <h2><span class="mw-headline" id="1.2">1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
31785 <p>c
31786 </p>
31787 <h1><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
31788 <p>d
31789 </p>
31790 !! html/parsoid
31791 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
31792 <p>a</p>
31793
31794 <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">
31795 </span><p about="#mwt1">b</p>
31796 </section><section data-mw-section-id="3"><h2 id="1.2" data-parsoid="{}">1.2</h2>
31797 <p>c</p>
31798
31799 </section></section><section data-mw-section-id="4"><h1 id="2" data-parsoid="{}">2</h1>
31800 <p>d</p></section>
31801 !! end
31802
31803 # In this example, the template scope is mildly expanded to incorporate the
31804 # trailing newline after the transclusion since that is part of section 1.1.1
31805 !! test
31806 Section wrapping with template-generated sections (good nesting 2)
31807 !! options
31808 notoc
31809 parsoid={
31810 "wrapSections": true,
31811 "modes": ["wt2html", "wt2wt"]
31812 }
31813 !! wikitext
31814 =1=
31815 a
31816
31817 {{echo|1=
31818 ==1.1==
31819 b
31820 ===1.1.1===
31821 d
31822 }}
31823 =2=
31824 e
31825 !! html/php+tidy
31826
31827 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
31828 <p>a
31829 </p>
31830 <h2><span class="mw-headline" id="1.1">1.1</span></h2>
31831 <p>b
31832 </p>
31833 <h3><span class="mw-headline" id="1.1.1">1.1.1</span></h3>
31834 <p>d
31835 </p>
31836 <h1><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
31837 <p>e
31838 </p>
31839 !! html/parsoid
31840 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31841 <p>a</p>
31842
31843 <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">
31844 </span><p about="#mwt1">b</p><span about="#mwt1">
31845 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
31846 </span><p about="#mwt1">d</p><span about="#mwt1">
31847 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
31848 <p>e</p></section>
31849 !! end
31850
31851 # In this example, the template scope is mildly expanded to incorporate the
31852 # trailing newline after the transclusion since that is part of section 1.2.1
31853 !! test
31854 Section wrapping with template-generated sections (good nesting 3)
31855 !! options
31856 notoc
31857 parsoid={
31858 "wrapSections": true,
31859 "modes": ["wt2html", "wt2wt"]
31860 }
31861 !! wikitext
31862 =1=
31863 a
31864
31865 {{echo|1=
31866 x
31867 ==1.1==
31868 b
31869 ==1.2==
31870 c
31871 ===1.2.1===
31872 d
31873 }}
31874 =2=
31875 e
31876 !! html/php+tidy
31877
31878 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
31879 <p>a
31880 </p><p>x
31881 </p>
31882 <h2><span class="mw-headline" id="1.1">1.1</span></h2>
31883 <p>b
31884 </p>
31885 <h2><span class="mw-headline" id="1.2">1.2</span></h2>
31886 <p>c
31887 </p>
31888 <h3><span class="mw-headline" id="1.2.1">1.2.1</span></h3>
31889 <p>d
31890 </p>
31891 <h1><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
31892 <p>e
31893 </p>
31894 !! html/parsoid
31895 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
31896 <p>a</p>
31897
31898 <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">
31899 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
31900 </span><p about="#mwt1">b</p><span about="#mwt1">
31901 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
31902 </span><p about="#mwt1">c</p><span about="#mwt1">
31903 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
31904 </span><p about="#mwt1">d</p><span about="#mwt1">
31905 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
31906 <p>e</p></section>
31907 !! end
31908
31909 # Because of section-wrapping and template-wrapping interactions,
31910 # the scope of the template is expanded so that the template markup
31911 # is valid in the presence of <section> tags.
31912 # This exercises the s1 is null scenario in the wrapSections code
31913 !! test
31914 Section wrapping with template-generated sections (bad nesting 1)
31915 !! options
31916 notoc
31917 parsoid={
31918 "wrapSections": true
31919 }
31920 !! wikitext
31921 <div>
31922 a
31923
31924 {{echo|1=
31925 =1=
31926 b
31927 }}
31928
31929 c
31930 </div>
31931 !! html/php+tidy
31932 <div>
31933 <p>a
31934 </p>
31935 <h1><span class="mw-headline" id="1">1</span></h1>
31936 <p>b
31937 </p><p>c
31938 </p>
31939 </div>
31940 !! html/parsoid
31941 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
31942 <p>a</p>
31943
31944 <section data-mw-section-id="-1"><h1 about="#mwt1" typeof="mw:Transclusion" id="1" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"=1=\nb"}},"i":0}}]}'>1</h1><span about="#mwt1">
31945 </span><p about="#mwt1">b</p>
31946
31947 <p>c</p>
31948 </section></div></section>
31949 !! end
31950
31951 # Because of section-wrapping and template-wrapping interactions,
31952 # the scope of the template is expanded so that the template markup
31953 # is valid in the presence of <section> tags.
31954 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
31955 !! test
31956 Section wrapping with template-generated sections (bad nesting 2)
31957 !! options
31958 notoc
31959 parsoid={
31960 "wrapSections": true
31961 }
31962 !! wikitext
31963 =1=
31964 a
31965
31966 {{echo|1=
31967 =2=
31968 b
31969 ==2.1==
31970 c
31971 }}
31972
31973 d
31974
31975 =3=
31976 e
31977 !! html/php+tidy
31978
31979 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
31980 <p>a
31981 </p>
31982 <h1><span class="mw-headline" id="2">2</span></h1>
31983 <p>b
31984 </p>
31985 <h2><span class="mw-headline" id="2.1">2.1</span></h2>
31986 <p>c
31987 </p><p>d
31988 </p>
31989 <h1><span class="mw-headline" id="3">3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
31990 <p>e
31991 </p>
31992 !! html/parsoid
31993 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
31994 <p>a</p>
31995
31996 </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">
31997 </span><p about="#mwt1">b</p><span about="#mwt1">
31998 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
31999 </span><p about="#mwt1">c</p><span about="#mwt1">
32000
32001 </span><p about="#mwt1">d</p><span about="#mwt1">
32002
32003 </span></section></section><section data-mw-section-id="4"><h1 id="3" data-parsoid="{}">3</h1>
32004 <p>e</p></section>
32005 !! end
32006
32007 # Because of section-wrapping and template-wrapping interactions,
32008 # additional template wrappers are added to <section> tags
32009 # so that template wrapping semantics are valid whether section
32010 # tags are retained or stripped. But, the template scope can expand
32011 # greatly when accounting for section tags.
32012 # This exercises the s1 and s2 are in different subtrees scenario
32013 !! test
32014 Section wrapping with template-generated sections (bad nesting 3)
32015 !! options
32016 notoc
32017 parsoid={
32018 "wrapSections": true,
32019 "modes": ["wt2html", "wt2wt"]
32020 }
32021 !! wikitext
32022 =1=
32023 a
32024
32025 {{echo|1=
32026 ==1.2==
32027 b
32028 =2=
32029 c
32030 }}
32031
32032 d
32033
32034 =3=
32035 e
32036 !! html/php+tidy
32037
32038 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32039 <p>a
32040 </p>
32041 <h2><span class="mw-headline" id="1.2">1.2</span></h2>
32042 <p>b
32043 </p>
32044 <h1><span class="mw-headline" id="2">2</span></h1>
32045 <p>c
32046 </p><p>d
32047 </p>
32048 <h1><span class="mw-headline" id="3">3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32049 <p>e
32050 </p>
32051 !! html/parsoid
32052 <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>
32053 <p>a</p>
32054
32055 <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">
32056 </span><p about="#mwt1">b</p><span about="#mwt1">
32057 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
32058 </span><p about="#mwt1">c</p>
32059
32060 <p>d</p>
32061 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
32062 <p>e</p></section>
32063 !! end
32064
32065 !! test
32066 Section wrapping with uneditable lead section + div wrapping multiple sections
32067 !! options
32068 notoc
32069 parsoid={
32070 "wrapSections": true
32071 }
32072 !! wikitext
32073 foo
32074
32075 <div style="border:1px solid red;">
32076 =1=
32077 a
32078
32079 ==1.1==
32080 b
32081
32082 =2=
32083 c
32084 </div>
32085
32086 =3=
32087 d
32088
32089 ==3.1==
32090 e
32091 !! html/php+tidy
32092 <p>foo
32093 </p>
32094 <div style="border:1px solid red;">
32095
32096 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32097 <p>a
32098 </p>
32099 <h2><span class="mw-headline" id="1.1">1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32100 <p>b
32101 </p>
32102 <h1><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32103 <p>c
32104 </p>
32105 </div>
32106 <h1><span class="mw-headline" id="3">3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32107 <p>d
32108 </p>
32109 <h2><span class="mw-headline" id="3.1">3.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 3.1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32110 <p>e
32111 </p>
32112 !! html/parsoid
32113 <section data-mw-section-id="-1"><p>foo</p>
32114
32115 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
32116 <section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
32117 <p>a</p>
32118
32119 <section data-mw-section-id="2"><h2 id="1.1" data-parsoid="{}">1.1</h2>
32120 <p>b</p>
32121
32122 </section></section><section data-mw-section-id="-1"><h1 id="2" data-parsoid="{}">2</h1>
32123 <p>c</p>
32124 </section></div>
32125
32126 </section><section data-mw-section-id="4"><h1 id="3" data-parsoid="{}">3</h1>
32127 <p>d</p>
32128
32129 <section data-mw-section-id="5"><h2 id="3.1" data-parsoid="{}">3.1</h2>
32130 <p>e</p>
32131 </section></section>
32132 !! end
32133
32134 !! test
32135 Section wrapping with editable lead section + div overlapping multiple sections
32136 !! options
32137 notoc
32138 parsoid={
32139 "wrapSections": true
32140 }
32141 !! wikitext
32142 foo
32143
32144 =1=
32145 a
32146 <div style="border:1px solid red;">
32147 b
32148
32149 ==1.1==
32150 c
32151
32152 =2=
32153 d
32154 </div>
32155 e
32156
32157 =3=
32158 f
32159
32160 ==3.1==
32161 g
32162 !! html/php+tidy
32163 <p>foo
32164 </p>
32165
32166 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32167 <p>a
32168 </p>
32169 <div style="border:1px solid red;">
32170 <p>b
32171 </p>
32172 <h2><span class="mw-headline" id="1.1">1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32173 <p>c
32174 </p>
32175 <h1><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32176 <p>d
32177 </p>
32178 </div>
32179 <p>e
32180 </p>
32181 <h1><span class="mw-headline" id="3">3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32182 <p>f
32183 </p>
32184 <h2><span class="mw-headline" id="3.1">3.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 3.1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32185 <p>g
32186 </p>
32187 !! html/parsoid
32188 <section data-mw-section-id="0"><p>foo</p>
32189
32190 </section><section data-mw-section-id="-1"><h1 id="1" data-parsoid="{}">1</h1>
32191 <p>a</p>
32192 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
32193 <p>b</p>
32194
32195 <section data-mw-section-id="2"><h2 id="1.1" data-parsoid="{}">1.1</h2>
32196 <p>c</p>
32197
32198 </section><section data-mw-section-id="-1"><h1 id="2" data-parsoid="{}">2</h1>
32199 <p>d</p>
32200 </section></div>
32201 <p>e</p>
32202
32203 </section><section data-mw-section-id="4"><h1 id="3" data-parsoid="{}">3</h1>
32204 <p>f</p>
32205
32206 <section data-mw-section-id="5"><h2 id="3.1" data-parsoid="{}">3.1</h2>
32207 <p>g</p>
32208 </section></section>
32209 !! end
32210
32211 !! test
32212 HTML header tags should not be wrapped in section tags
32213 !! options
32214 notoc
32215 parsoid={
32216 "wrapSections": true
32217 }
32218 !! wikitext
32219 foo
32220
32221 <h1>a</h1>
32222
32223 =b=
32224
32225 <h1>c</h1>
32226
32227 =d=
32228 !! html/php+tidy
32229 <p>foo
32230 </p>
32231
32232 <h1><span class="mw-headline" id="a">a</span></h1>
32233 <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>
32234 <h1><span class="mw-headline" id="c">c</span></h1>
32235 <h1><span class="mw-headline" id="d">d</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: d">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32236 !! html/parsoid
32237 <section data-mw-section-id="0"><p>foo</p>
32238
32239 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
32240
32241 </section><section data-mw-section-id="1"><h1 id="b" data-parsoid="{}">b</h1>
32242
32243 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
32244
32245 </section><section data-mw-section-id="2"><h1 id="d" data-parsoid="{}">d</h1></section>
32246 !! end
32247
32248 !! test
32249 Lead section containing only whitespace and comments.
32250 !! options
32251 notoc
32252 parsoid={
32253 "wrapSections": true
32254 }
32255 !! wikitext
32256
32257 <!-- this is a comment, presumably significant to editors -->
32258 =1=
32259 a
32260
32261 =2=
32262 b
32263 !! html/php+tidy
32264 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32265 <p>a
32266 </p>
32267 <h1><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32268 <p>b
32269 </p>
32270 !! html/parsoid
32271 <section data-mw-section-id="0" data-parsoid="{}">
32272 <!-- this is a comment, presumably significant to editors -->
32273 </section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
32274 <p>a</p>
32275
32276 </section><section data-mw-section-id="2"><h1 id="2" data-parsoid="{}">2</h1>
32277 <p>b</p>
32278 </section>
32279 !! end
32280
32281 !! test
32282 Pseudo-sections emitted by templates should have id -2
32283 !! options
32284 notoc
32285 parsoid={
32286 "wrapSections": true
32287 }
32288 !! wikitext
32289 foo
32290 {{echo|<div>
32291 ==a==
32292 ==b==
32293 </div>
32294 }}
32295 !! html/php+tidy
32296 <p>foo
32297 </p>
32298 <div>
32299 <h2><span class="mw-headline" id="a">a</span></h2>
32300 <h2><span class="mw-headline" id="b">b</span></h2>
32301 </div>
32302 !! html/parsoid
32303 <section data-mw-section-id="-1"><p>foo</p>
32304 </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}}]}'>
32305 <section data-mw-section-id="-1"><h2 id="a">a</h2>
32306 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
32307 </section></div><span about="#mwt1">
32308 </span></section>
32309 !! end
32310
32311 !! test
32312 T213468: Transcluded sections don't get PHP section numbers
32313 !! options
32314 notoc
32315 parsoid={
32316 "wrapSections": true
32317 }
32318 !! wikitext
32319 ==PHP section=1==
32320 {{echo|1=
32321 == This is counted as if it were section 2 ==
32322 }}
32323 ==PHP section=3==
32324 !! html/php+tidy
32325 <h2><span class="mw-headline" id="PHP_section.3D1">PHP section=1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: PHP section=1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32326 <h2><span class="mw-headline" id="This_is_counted_as_if_it_were_section_2">This is counted as if it were section 2</span></h2>
32327 <h2><span class="mw-headline" id="PHP_section.3D3">PHP section=3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: PHP section=3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32328 !! html/parsoid
32329 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h2 id="PHP_section=1" data-parsoid="{}"><span id="PHP_section.3D1" typeof="mw:FallbackId"></span>PHP section=1</h2>
32330 </section><section data-mw-section-id="-1"><h2 about="#mwt1" typeof="mw:Transclusion" id="This_is_counted_as_if_it_were_section_2" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"== This is counted as if it were section 2 =="}},"i":0}}]}'>This is counted as if it were section 2</h2>
32331 </section><section data-mw-section-id="3"><h2 id="PHP_section=3" data-parsoid="{}"><span id="PHP_section.3D3" typeof="mw:FallbackId"></span>PHP section=3</h2></section>
32332 !! end
32333
32334 !! test
32335 T213468: Corner cases in edit section ID assignment in tokenizer
32336 !! options
32337 notoc
32338 parsoid={
32339 "wrapSections": true
32340 }
32341 !! wikitext
32342 ==PHP section=1==
32343 {{echo|Not a section|
32344 == This is counted as if it were section 2 ==
32345 }}
32346 ==PHP section=3==
32347 {{echo3|1=
32348 == This is counted as if it were section 4 ==
32349 }}
32350 ==PHP section=5==
32351 {{#tag:p|Not a section|data-ignored=
32352 == This is counted as if it were section 6 ==
32353 }}
32354 ==PHP section=7==
32355 {{echo|1=Not a ==heading==}}
32356 ==PHP section=8==
32357 [[File:Foobar.jpg|thumb|
32358 ==This is section 9, even though it's in a caption==
32359 ]]
32360 ==PHP section=10==
32361 !! html/php+tidy
32362
32363 <h2><span class="mw-headline" id="PHP_section.3D1">PHP section=1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: PHP section=1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32364 <p>Not a section
32365 </p>
32366 <h2><span class="mw-headline" id="PHP_section.3D3">PHP section=3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: PHP section=3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32367 <h2><span class="mw-headline" id="This_is_counted_as_if_it_were_section_4">This is counted as if it were section 4</span></h2>
32368 <h2><span class="mw-headline" id="This_is_counted_as_if_it_were_section_4_2">This is counted as if it were section 4</span></h2>
32369 <h2><span class="mw-headline" id="This_is_counted_as_if_it_were_section_4_3">This is counted as if it were section 4</span></h2>
32370 <h2><span class="mw-headline" id="PHP_section.3D5">PHP section=5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: PHP section=5">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32371 <p data-ignored="== This is counted as if it were section 6 ==">Not a section</p>
32372 <h2><span class="mw-headline" id="PHP_section.3D7">PHP section=7</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: PHP section=7">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32373 <p>Not a ==heading==
32374 </p>
32375 <h2><span class="mw-headline" id="PHP_section.3D8">PHP section=8</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: PHP section=8">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32376 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" decoding="async" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><h2><span class="mw-headline" id="This_is_section_9.2C_even_though_it.27s_in_a_caption">This is section 9, even though it's in a caption</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: This is section 9, even though it&#039;s in a caption">edit</a><span class="mw-editsection-bracket">]</span></span></h2></div></div></div>
32377 <h2><span class="mw-headline" id="PHP_section.3D10">PHP section=10</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: PHP section=10">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32378 !! html/parsoid
32379 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h2 id="PHP_section=1" data-parsoid="{}"><span id="PHP_section.3D1" typeof="mw:FallbackId"></span>PHP section=1</h2>
32380 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Not a section"},"2":{"wt":"\n== This is counted as if it were section 2 ==\n"}},"i":0}}]}'>Not a section</p>
32381 </section><section data-mw-section-id="3"><h2 id="PHP_section=3" data-parsoid="{}"><span id="PHP_section.3D3" typeof="mw:FallbackId"></span>PHP section=3</h2>
32382 </section><section data-mw-section-id="-1" about="#mwt5" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":["",{"template":{"target":{"wt":"echo3","href":"./Template:Echo3"},"params":{"1":{"wt":"== This is counted as if it were section 4 =="}},"i":0}},"\n"]}'><h2 about="#mwt2" typeof="mw:Transclusion" id="This_is_counted_as_if_it_were_section_4" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo3","href":"./Template:Echo3"},"params":{"1":{"wt":"== This is counted as if it were section 4 =="}},"i":0}}]}'>This is counted as if it were section 4</h2><span about="#mwt2">
32383 </span></section><section data-mw-section-id="-1" about="#mwt5"><h2 about="#mwt2" id="This_is_counted_as_if_it_were_section_4_2">This is counted as if it were section 4</h2><span about="#mwt2">
32384 </span></section><section data-mw-section-id="-1" about="#mwt5"><h2 about="#mwt2" id="This_is_counted_as_if_it_were_section_4_3">This is counted as if it were section 4</h2>
32385 </section><section data-mw-section-id="5"><h2 id="PHP_section=5" data-parsoid="{}"><span id="PHP_section.3D5" typeof="mw:FallbackId"></span>PHP section=5</h2>
32386 <p data-ignored=" This is counted as if it were section 6 " about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"data-ignored","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:p","function":"tag"},"params":{"1":{"wt":"Not a section"},"data-ignored":{"wt":"== This is counted as if it were section 6 =="}},"i":0}}]}'>Not a section</p>
32387 </section><section data-mw-section-id="7"><h2 id="PHP_section=7" data-parsoid="{}"><span id="PHP_section.3D7" typeof="mw:FallbackId"></span>PHP section=7</h2>
32388 <p about="#mwt4" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Not a ==heading=="}},"i":0}}]}'>Not a ==heading==</p>
32389 </section><section data-mw-section-id="8"><h2 id="PHP_section=8" data-parsoid="{}"><span id="PHP_section.3D8" typeof="mw:FallbackId"></span>PHP section=8</h2>
32390 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"\n== This is counted as if it were section 9 ==\n"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>
32391 <section data-mw-section-id="-1"><h2 id="This_is_section_9,_even_though_it's_in_a_caption" data-parsoid="{}"><span id="This_is_section_9.2C_even_though_it.27s_in_a_caption" typeof="mw:FallbackId"></span>This is section 9, even though it's in a caption</h2>
32392 </section></figcaption></figure>
32393 </section><section data-mw-section-id="10"><h2 id="PHP_section=10" data-parsoid="{}"><span id="PHP_section.3D10" typeof="mw:FallbackId" data-parsoid='{"dsr":[412,412]}'></span>PHP section=10</h2></section>
32394 !! end
32395
32396 !! test
32397 T215628: Section numbering and <includeonly> and <noinclude> on a page
32398 !! options
32399 notoc
32400 parsoid={
32401 "wrapSections": true
32402 }
32403 !! wikitext
32404 ==PHP section=1==
32405 <noinclude>
32406 ==PHP section=2==
32407 </noinclude>
32408 ==PHP section=3==
32409 <includeonly>
32410 ==This is not counted as section 4==
32411 </includeonly>
32412 ==PHP section=4==
32413 !! html/php+tidy
32414
32415 <h2><span class="mw-headline" id="PHP_section.3D1">PHP section=1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: PHP section=1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32416 <h2><span class="mw-headline" id="PHP_section.3D2">PHP section=2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: PHP section=2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32417 <h2><span class="mw-headline" id="PHP_section.3D3">PHP section=3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: PHP section=3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32418 <h2><span class="mw-headline" id="PHP_section.3D4">PHP section=4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: PHP section=4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32419 !! html/parsoid
32420 PARSOID HAS A BUG HERE: T215628
32421 !! end
32422
32423 ##########################################################################
32424 Tests demonstrating white-space insensitivity in input wikitext
32425 for wikitext headings, wikitext list items, and wikitext table captions,
32426 headings, and cells. HTML versions of the same should preserve whitespace.
32427 ##########################################################################
32428 !! test
32429 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
32430 !! options
32431 parsoid={
32432 "modes": ["wt2html"],
32433 "preserveIEW": true
32434 }
32435 !! wikitext
32436 __NOTOC__
32437 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
32438 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
32439 == <!--Headings with fallback ids--> Личная жизнь ==
32440 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
32441 ; <!--term to define--> term : <!--term's definition--> definition
32442 {|
32443 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
32444 |-
32445 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
32446 |-
32447 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
32448 |-
32449 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
32450 |-
32451 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
32452 |}
32453 : {|
32454 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
32455 |} foo <!--c1-->
32456 !! html/php+tidy
32457 <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>
32458 <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>
32459 <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>
32460 <ul><li>List item</li></ul>
32461 <dl><dt>term&#160;</dt>
32462 <dd>definition</dd></dl>
32463 <table>
32464 <caption>Table Caption
32465 </caption>
32466 <tbody><tr>
32467 <th>Table Heading 1</th>
32468 <th>Table Heading 2
32469 </th></tr>
32470 <tr>
32471 <td>Table Cell 1</td>
32472 <td>Table Cell 2
32473 </td></tr>
32474 <tr>
32475 <td>class="foo"</td>
32476 <td>Table Cell 3
32477 </td></tr>
32478 <tr>
32479 <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
32480 </td></tr></tbody></table>
32481 <dl><dd><table>
32482 <tbody><tr>
32483 <td>Table Cell 1</td>
32484 <td>Table Cell 2
32485 </td></tr></tbody></table> foo</dd></dl>
32486 !! html/parsoid
32487 <meta property="mw:PageProp/notoc">
32488 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
32489 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
32490 <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>
32491 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
32492 <dl><dt><!--term to define-->term&nbsp;</dt><dd><!--term's definition-->definition</dd></dl>
32493 <table>
32494 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
32495 <tbody><tr>
32496 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th>Table Heading 2<!--c5--></th></tr>
32497 <tr>
32498 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
32499 <tr>
32500 <td>class="foo"</td><td><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
32501 <tr>
32502 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One">two</a> <!--c2--> | <!--c3--> some content</td></tr>
32503 </tbody></table>
32504 <dl><dd><table>
32505 <tbody><tr><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
32506 </tbody></table> foo<!--c1--></dd></dl>
32507 !! end
32508
32509 # Looks like <caption> is not accepted in HTML
32510 !! test
32511 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
32512 !! options
32513 parsoid={
32514 "modes": ["wt2html"],
32515 "preserveIEW": true
32516 }
32517 !! wikitext
32518 __NOTOC__
32519 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
32520 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
32521 <table>
32522 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
32523 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
32524 </table>
32525 !! html/php+tidy
32526 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
32527 <ul><li> List item </li></ul>
32528 <table>
32529 <tbody><tr><th> Table Heading </th><th></th></tr>
32530 <tr><td> Table Cell </td><th></th></tr>
32531 </tbody></table>
32532 !! html/parsoid
32533 <meta property="mw:PageProp/notoc"/>
32534 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
32535 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
32536 <table>
32537 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
32538 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
32539 </tbody></table>
32540 !! end
32541
32542 !! test
32543 Do not trim whitespace in links and quotes
32544 !! options
32545 parsoid={
32546 "modes": ["wt2html"],
32547 "preserveIEW": true
32548 }
32549 !! wikitext
32550 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
32551 [[Foo| some text ]]
32552 !! html/php+tidy
32553 <p>foo <i> italic </i> and <b> bold </b>
32554 <a href="/wiki/Foo" title="Foo"> some text </a>
32555 </p>
32556 !! html/parsoid
32557 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
32558 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
32559 !! end
32560
32561 !! test
32562 Remove p tags surrounding a single element in a figcaption
32563 !! options
32564 parsoid=html2wt
32565 !! wikitext
32566 [[File:Foobar.jpg|right|200x200px|Caption]]
32567 !! html/parsoid
32568 <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>
32569 !! end
32570
32571 !! test
32572 Selser preserves lack of newline before list and allows newline after the list
32573 !! options
32574 parsoid={
32575 "modes": ["selser"],
32576 "scrubWikitext": true,
32577 "changes": [
32578 [ "ul", "after", "<p>footer</p>" ]
32579 ]
32580 }
32581 !! wikitext
32582 header
32583 *foo
32584 *bar
32585 !! wikitext/edited
32586 header
32587 *foo
32588 *bar
32589
32590 footer
32591 !! end
32592
32593
32594 !! test
32595 Selser does not introduce newlines between unedited paragraph preceding the list
32596 !! options
32597 parsoid={
32598 "modes": ["selser"],
32599 "changes": [
32600 [ "table tbody tr td p:last-child", "empty" ]
32601 ]
32602 }
32603 !! wikitext
32604 {|
32605 |
32606 header
32607 *foo
32608 *bar
32609 footer
32610 |}
32611 !! wikitext/edited
32612 {|
32613 |
32614 header
32615 *foo
32616 *bar
32617
32618 |}
32619 !! end
32620
32621 !! test
32622 Selser does not introduce newlines between unedited paragraph following the list
32623 !! options
32624 parsoid={
32625 "modes": ["selser"],
32626 "changes": [
32627 [ "table tbody tr td p:first-child", "empty" ]
32628 ]
32629 }
32630 !! wikitext
32631 {|
32632 |
32633 header
32634 *foo
32635 *bar
32636 footer
32637 |}
32638 !! wikitext/edited
32639 {|
32640 |
32641
32642 *foo
32643 *bar
32644 footer
32645 |}
32646 !! end
32647
32648 !! test
32649 Remove a list item but do not insert newline above list
32650 !! options
32651 parsoid={
32652 "modes": ["selser"],
32653 "changes": [
32654 [ "ul li:last-child", "remove" ]
32655 ]
32656 }
32657 !! wikitext
32658 header
32659 *foo
32660 *bar
32661 footer
32662 !! wikitext/edited
32663 header
32664 *foo
32665 footer
32666 !! end