25ac5f5a1fa6414bc15914fbfb270db9fc870015
[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, wgMediaInTargetLanguage
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
435 !! end
436
437 !! test
438 Paragraphs with newline spacing with non-empty white-space lines in between
439 !! wikitext
440 ----
441 a
442
443 b
444 ----
445 a
446
447
448 b
449 ----
450 !! html
451 <hr />
452 <p>a
453 </p><p>b
454 </p>
455 <hr />
456 <p>a
457 </p><p><br />
458 b
459 </p>
460 <hr />
461
462 !! end
463
464 !! test
465 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
466 !! wikitext
467 ----
468 a
469 <!--foo-->
470 b
471 ----
472 a
473 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
474 b
475 ----
476 a
477
478 <!--foo-->
479 <!--bar-->
480 b
481 ----
482 a
483
484 <!--foo-->
485 <!--bar-->
486
487 b
488 ----
489 !! html
490 <hr />
491 <p>a
492 b
493 </p>
494 <hr />
495 <p>a
496 b
497 </p>
498 <hr />
499 <p>a
500 </p><p>b
501 </p>
502 <hr />
503 <p>a
504 </p><p><br />
505 b
506 </p>
507 <hr />
508
509 !! end
510
511 !! test
512 Extra newlines: More paragraphs with indented comment
513 !! wikitext
514 a
515
516 <!--boo-->
517
518 b
519 !! html
520 <p>a
521 </p><p><br />
522 b
523 </p>
524 !!end
525
526 !! test
527 Extra newlines followed by heading
528 !! wikitext
529 a
530
531
532 =b=
533 [[a]]
534
535
536 =b=
537 !! html
538 <p>a
539 </p><p><br />
540 </p>
541 <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>
542 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
543 </p><p><br />
544 </p>
545 <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>
546
547 !! end
548
549 !! test
550 Extra newlines between heading and content are swallowed (Parsoid does not)
551 !! wikitext
552 =b=
553
554
555
556 [[a]]
557 !! html/php+tidy
558 <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>
559 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
560 </p>
561 !! html/parsoid
562 <h1 id="b">b</h1>
563 <p>
564 <br></p>
565
566 <p><a rel="mw:WikiLink" href="./A" title="A">a</a></p>
567 !! end
568
569 !! test
570 Extra new lines before and after lists are preserved
571 !! wikitext
572 a
573
574
575 *b
576
577
578 c
579 !! html/php+tidy
580 <p>a
581 </p><p><br />
582 </p>
583 <ul><li>b</li></ul>
584 <p><br />
585 c
586 </p>
587 !! html/parsoid
588 <p>a</p>
589 <p>
590 <br></p>
591 <ul><li>b</li></ul>
592 <p>
593 <br>
594 c</p>
595 !! end
596
597 # Parsoid regression test
598 !!test
599 Multiple newlines after tables are converted to p-br-p tags
600 !!options
601 parsoid=wt2html,wt2wt
602 !!wikitext
603 {|
604 |x
605 |}
606
607
608
609
610 =b=
611 !!html/php+tidy
612 <table>
613 <tbody><tr>
614 <td>x
615 </td></tr></tbody></table>
616 <p><br />
617 </p><p><br />
618 </p>
619 <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>
620 !!html/parsoid
621 <table>
622 <tbody>
623 <tr>
624 <td>x</td>
625 </tr>
626 </tbody>
627 </table>
628 <p><br/></p>
629 <p><br/></p>
630 <h1 id="b">b</h1>
631 !!end
632
633 !! test
634 Heading with line break in nowiki
635 !! options
636 parsoid=wt2html
637 !! config
638 wgFragmentMode=[ 'html5', 'legacy' ]
639 !! wikitext
640 ==A <nowiki>B
641 C</nowiki>==
642 !! html/php
643 <h2><span id="A_B.0AC"></span><span class="mw-headline" id="A_B
644 C">A B
645 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>
646
647 !! html/parsoid
648 <h2 id="A_B
649 C"><span id="A_B.0AC" typeof="mw:FallbackId"></span>A <span typeof="mw:Nowiki">B
650 C</span></h2>
651 !! end
652
653 !! test
654 Parsing an URL
655 !! wikitext
656 http://fr.wikipedia.org/wiki/🍺
657 <!-- EasterEgg we love beer, better be able be able to link to it -->
658 !! html
659 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
660 </p>
661 !! end
662
663 !! test
664 Simple list
665 !! wikitext
666 *Item 1
667 *Item 2
668 !! html
669 <ul><li>Item 1</li>
670 <li>Item 2</li></ul>
671
672 !! end
673
674 !! test
675 Italics and bold
676 !! wikitext
677 *plain
678 *plain''italic''plain
679 *plain''italic''plain''italic''plain
680 *plain'''bold'''plain
681 *plain'''bold'''plain'''bold'''plain
682 *plain''italic''plain'''bold'''plain
683 *plain'''bold'''plain''italic''plain
684 *plain''italic'''bold-italic'''italic''plain
685 *plain'''bold''bold-italic''bold'''plain
686 *plain'''''bold-italic'''italic''plain
687 *plain'''''bold-italic''bold'''plain
688 *plain''italic'''bold-italic'''''plain
689 *plain'''bold''bold-italic'''''plain
690 *plain l'''italic''plain
691 *plain l''''bold''' plain
692 !! html
693 <ul><li>plain</li>
694 <li>plain<i>italic</i>plain</li>
695 <li>plain<i>italic</i>plain<i>italic</i>plain</li>
696 <li>plain<b>bold</b>plain</li>
697 <li>plain<b>bold</b>plain<b>bold</b>plain</li>
698 <li>plain<i>italic</i>plain<b>bold</b>plain</li>
699 <li>plain<b>bold</b>plain<i>italic</i>plain</li>
700 <li>plain<i>italic<b>bold-italic</b>italic</i>plain</li>
701 <li>plain<b>bold<i>bold-italic</i>bold</b>plain</li>
702 <li>plain<i><b>bold-italic</b>italic</i>plain</li>
703 <li>plain<b><i>bold-italic</i>bold</b>plain</li>
704 <li>plain<i>italic<b>bold-italic</b></i>plain</li>
705 <li>plain<b>bold<i>bold-italic</i></b>plain</li>
706 <li>plain l'<i>italic</i>plain</li>
707 <li>plain l'<b>bold</b> plain</li></ul>
708
709 !! end
710
711 # this example taken from the [[simple:Moon]] article (T49326)
712 !! test
713 Italics and possessives (1)
714 !! wikitext
715 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
716 !! html
717 <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
718 </p>
719 !! end
720
721 # this example taken from [[en:Flaming Pie]] (T51926)
722 !! test
723 Italics and possessives (2)
724 !! wikitext
725 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
726 !! html
727 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
728 </p>
729 !! end
730
731 # this example taken from [[en:Dictionary]] (T51926)
732 !! test
733 Italics and possessives (3)
734 !! wikitext
735 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''.
736 !! html
737 <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>.
738 </p>
739 !! end
740
741
742 ###
743 ### 2-quote opening sequence tests
744 ###
745 !! test
746 Italics and bold: 2-quote opening sequence: (2,2)
747 !! wikitext
748 ''foo''
749 !! html
750 <p><i>foo</i>
751 </p>
752 !!end
753
754 !! test
755 Italics and bold: 2-quote opening sequence: (2,3)
756 !! wikitext
757 ''foo'''
758 !! html/*
759 <p><i>foo'</i>
760 </p>
761 !!end
762
763 !! test
764 Italics and bold: 2-quote opening sequence: (2,4)
765 !! options
766 parsoid=wt2html
767 !! wikitext
768 ''foo''''
769 !! html/*
770 <p><i>foo''</i>
771 </p>
772 !!end
773
774 # same html as previous, but wikitext adjusted to match parsoid html2wt
775 !! test
776 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
777 !! wikitext
778 ''foo<nowiki>''</nowiki>''
779 !! html
780 <p><i>foo''</i>
781 </p>
782 !! end
783
784 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
785 !! test
786 Italics and bold: 2-quote opening sequence: (2,5)
787 !! options
788 parsoid=wt2html
789 !! wikitext
790 ''foo'''''
791 !! html/php
792 <p><i>foo</i>
793 </p>
794 !! html/parsoid
795 <p><i>foo</i><b></b>
796 </p>
797 !!end
798
799 # same html as previous, but wikitext adjusted to match parsoid html2wt
800 !! test
801 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
802 !! wikitext
803 ''foo'''''<nowiki/>'''
804 !! html/php
805 <p><i>foo</i>
806 </p>
807 !! html/parsoid
808 <p><i>foo</i><b></b>
809 </p>
810 !! end
811
812
813 ###
814 ### 3-quote opening sequence tests
815 ###
816
817 !! test
818 Italics and bold: 3-quote opening sequence: (3,2)
819 !! wikitext
820 '''foo''
821 !! html/*
822 <p>'<i>foo</i>
823 </p>
824 !!end
825
826 !! test
827 Italics and bold: 3-quote opening sequence: (3,3)
828 !! wikitext
829 '''foo'''
830 !! html
831 <p><b>foo</b>
832 </p>
833 !!end
834
835 !! test
836 Italics and bold: 3-quote opening sequence: (3,4)
837 !! wikitext
838 '''foo''''
839 !! html/*
840 <p><b>foo'</b>
841 </p>
842 !!end
843
844 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
845 !! test
846 Italics and bold: 3-quote opening sequence: (3,5)
847 !! options
848 parsoid=wt2html
849 !! wikitext
850 '''foo'''''
851 !! html/php
852 <p><b>foo</b>
853 </p>
854 !! html/parsoid
855 <p><b>foo</b><i></i>
856 </p>
857 !!end
858
859 # same html as previous, but wikitext adjusted to match parsoid html2wt
860 !! test
861 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
862 !! wikitext
863 '''foo'''''<nowiki/>''
864 !! html/php
865 <p><b>foo</b>
866 </p>
867 !! html/parsoid
868 <p><b>foo</b><i></i>
869 </p>
870 !! end
871
872
873 ###
874 ### 4-quote opening sequence tests
875 ###
876
877 !! test
878 Italics and bold: 4-quote opening sequence: (4,2)
879 !! options
880 parsoid=wt2html
881 !! wikitext
882 ''''foo''
883 !! html/*
884 <p>''<i>foo</i>
885 </p>
886 !!end
887
888 # same html as previous, but wikitext adjusted to match parsoid html2wt
889 !! test
890 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
891 !! wikitext
892 <nowiki>''</nowiki>''foo''
893 !! html
894 <p>''<i>foo</i>
895 </p>
896 !! end
897
898 !! test
899 Italics and bold: 4-quote opening sequence: (4,3)
900 !! wikitext
901 ''''foo'''
902 !! html/*
903 <p>'<b>foo</b>
904 </p>
905 !!end
906
907 !! test
908 Italics and bold: 4-quote opening sequence: (4,4)
909 !! options
910 parsoid=wt2html
911 !! wikitext
912 ''''foo''''
913 !! html/*
914 <p>'<b>foo'</b>
915 </p>
916 !!end
917
918 # same html as previous, but wikitext adjusted to match parsoid html2wt
919 !! test
920 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
921 !! wikitext
922 '<nowiki/>'''foo''''
923 !! html
924 <p>'<b>foo'</b>
925 </p>
926 !! end
927
928 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
929 !! test
930 Italics and bold: 4-quote opening sequence: (4,5)
931 !! options
932 parsoid=wt2html
933 !! wikitext
934 ''''foo'''''
935 !! html/php
936 <p>'<b>foo</b>
937 </p>
938 !! html/parsoid
939 <p>'<b>foo</b><i></i>
940 </p>
941 !!end
942
943 # same html as previous, but wikitext adjusted to match parsoid html2wt
944 !! test
945 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
946 !! wikitext
947 '<nowiki/>'''foo'''''<nowiki/>''
948 !! html/php
949 <p>'<b>foo</b>
950 </p>
951 !! html/parsoid
952 <p>'<b>foo</b><i></i>
953 </p>
954 !! end
955
956
957 ###
958 ### 5-quote opening sequence tests
959 ###
960
961 !! test
962 Italics and bold: 5-quote opening sequence: (5,2)
963 !! options
964 parsoid=wt2html
965 !! wikitext
966 '''''foo''
967 !! html/*
968 <p><b><i>foo</i></b>
969 </p>
970 !!end
971
972 # same html as previous, but wikitext adjusted to match parsoid html2wt
973 !! test
974 Italics and bold: 5-quote opening sequence: (5,2+3)
975 !! wikitext
976 '''''foo'''''
977 !! html/*
978 <p><i><b>foo</b></i>
979 </p>
980 !! end
981
982 !! test
983 Italics and bold: 5-quote opening sequence: (5,3)
984 !! options
985 parsoid=wt2html
986 !! wikitext
987 '''''foo'''
988 !! html/*
989 <p><i><b>foo</b></i>
990 </p>
991 !!end
992
993 # same html as previous, but wikitext adjusted to match parsoid html2wt
994 !! test
995 Italics and bold: 5-quote opening sequence: (5,3+2)
996 !! wikitext
997 '''''foo'''''
998 !! html
999 <p><i><b>foo</b></i>
1000 </p>
1001 !! end
1002
1003 !! test
1004 Italics and bold: 5-quote opening sequence: (5,4)
1005 !! options
1006 parsoid=wt2html
1007 !! wikitext
1008 '''''foo''''
1009 !! html/*
1010 <p><i><b>foo'</b></i>
1011 </p>
1012 !!end
1013
1014 !! test
1015 Italics and bold: 5-quote opening sequence: (5,5)
1016 !! wikitext
1017 '''''foo'''''
1018 !! html
1019 <p><i><b>foo</b></i>
1020 </p>
1021 !!end
1022
1023 !! test
1024 Italics and bold: 5-quote opening sequence: (5,6)
1025 !! wikitext
1026 '''''foo''''''
1027 !! html/*
1028 <p><i><b>foo'</b></i>
1029 </p>
1030 !! end
1031
1032 ###
1033 ### multiple quote sequences in a line
1034 ###
1035
1036 !! test
1037 Italics and bold: multiple quote sequences: (2,4,2)
1038 !! options
1039 parsoid=wt2html
1040 !! wikitext
1041 ''foo''''bar''
1042 !! html/*
1043 <p><i>foo'<b>bar</b></i>
1044 </p>
1045 !! end
1046
1047 # same html as previous, but wikitext adjusted to match parsoid html2wt
1048 !! test
1049 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
1050 !! wikitext
1051 ''foo'<nowiki/>'''bar'''''
1052 !! html
1053 <p><i>foo'<b>bar</b></i>
1054 </p>
1055 !! end
1056
1057 !! test
1058 Italics and bold: multiple quote sequences: (2,4,3)
1059 !! options
1060 parsoid=wt2html
1061 !! wikitext
1062 ''foo''''bar'''
1063 !! html/*
1064 <p><i>foo'<b>bar</b></i>
1065 </p>
1066 !! end
1067
1068 # same html as previous, but wikitext adjusted to match parsoid html2wt
1069 !! test
1070 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
1071 !! wikitext
1072 ''foo'<nowiki/>'''bar'''''
1073 !! html
1074 <p><i>foo'<b>bar</b></i>
1075 </p>
1076 !! end
1077
1078 !! test
1079 Italics and bold: multiple quote sequences: (2,4,4)
1080 !! options
1081 parsoid=wt2html
1082 !! wikitext
1083 ''foo''''bar''''
1084 !! html/*
1085 <p><i>foo'<b>bar'</b></i>
1086 </p>
1087 !! end
1088
1089 # same html as previous, but wikitext adjusted to match parsoid html2wt
1090 !! test
1091 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
1092 !! wikitext
1093 ''foo'<nowiki/>'''bar'<nowiki/>'''''
1094 !! html
1095 <p><i>foo'<b>bar'</b></i>
1096 </p>
1097 !! end
1098
1099 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1100 !! test
1101 Italics and bold: multiple quote sequences: (3,4,2)
1102 !! options
1103 parsoid=wt2html
1104 !! wikitext
1105 '''foo''''bar''
1106 !! html/php
1107 <p><b>foo'</b>bar
1108 </p>
1109 !! html/parsoid
1110 <p><b>foo'</b>bar<i></i>
1111 </p>
1112 !! end
1113
1114 # same html as previous, but wikitext adjusted to match parsoid html2wt
1115 !! test
1116 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1117 !! wikitext
1118 '''foo''''bar''<nowiki/>''
1119 !! html/php
1120 <p><b>foo'</b>bar
1121 </p>
1122 !! html/parsoid
1123 <p><b>foo'</b>bar<i></i>
1124 </p>
1125 !! end
1126
1127 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1128 !! test
1129 Italics and bold: multiple quote sequences: (3,4,3)
1130 !! options
1131 parsoid=wt2html
1132 !! wikitext
1133 '''foo''''bar'''
1134 !! html/php
1135 <p><b>foo'</b>bar
1136 </p>
1137 !! html/parsoid
1138 <p><b>foo'</b>bar<b></b>
1139 </p>
1140 !! end
1141
1142 # same html as previous, but wikitext adjusted to match parsoid html2wt
1143 !! test
1144 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1145 !! wikitext
1146 '''foo''''bar'''<nowiki/>'''
1147 !! html/php
1148 <p><b>foo'</b>bar
1149 </p>
1150 !! html/parsoid
1151 <p><b>foo'</b>bar<b></b>
1152 </p>
1153 !! end
1154
1155 ###
1156 ### other quote tests
1157 ###
1158 !! test
1159 Italics and bold: other quote tests: (2,3,5)
1160 !! wikitext
1161 ''this is about '''foo's family'''''
1162 !! html
1163 <p><i>this is about <b>foo's family</b></i>
1164 </p>
1165 !!end
1166
1167
1168 !! test
1169 Italics and bold: other quote tests: (2,(3,3),2)
1170 !! wikitext
1171 ''this is about '''foo's''' family''
1172 !! html
1173 <p><i>this is about <b>foo's</b> family</i>
1174 </p>
1175 !!end
1176
1177
1178 !! test
1179 Italics and bold: other quote tests: (3,2,3,2)
1180 !! options
1181 parsoid=wt2html
1182 !! wikitext
1183 '''this is about ''foo'''s family''
1184 !! html/*
1185 <p><b>this is about <i>foo</i></b><i>s family</i>
1186 </p>
1187 !!end
1188
1189
1190 # same html as previous, but wikitext adjusted to match parsoid html2wt
1191 !! test
1192 Italics and bold: other quote tests: (3,2,3+2+2,2)
1193 !! wikitext
1194 '''this is about ''foo'''''<nowiki/>''s family''
1195 !! html
1196 <p><b>this is about <i>foo</i></b><i>s family</i>
1197 </p>
1198 !! end
1199
1200
1201 !! test
1202 Italics and bold: other quote tests: (3,2,3,3)
1203 !! wikitext
1204 '''this is about ''foo'''s family'''
1205 !! html/*
1206 <p>'<i>this is about </i>foo<b>s family</b>
1207 </p>
1208 !!end
1209
1210
1211 !! test
1212 Italics and bold: other quote tests: (3,(2,2),3)
1213 !! wikitext
1214 '''this is about ''foo's'' family'''
1215 !! html
1216 <p><b>this is about <i>foo's</i> family</b>
1217 </p>
1218 !!end
1219
1220
1221 !! test
1222 Italicized possessive
1223 !! wikitext
1224 The ''[[Main Page]]'''s talk page.
1225 !! html/php
1226 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1227 </p>
1228 !! html/parsoid
1229 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1230 !! end
1231
1232 !! test
1233 Quote balancing context should be restricted to td/th cells on the same wikitext line
1234 !! options
1235 parsoid=wt2html,wt2wt
1236 !! wikitext
1237 {|
1238 !''a!!''b
1239 |''a||''b
1240 |}
1241 !! html+tidy
1242 <table>
1243 <tbody><tr>
1244 <th><i>a</i></th>
1245 <th><i>b</i>
1246 </th>
1247 <td><i>a</i></td>
1248 <td><i>b</i>
1249 </td></tr></tbody></table>
1250 !! end
1251
1252 ###
1253 ### Non-html5 tags
1254 ###
1255
1256 !! test
1257 Non-html5 tags should be accepted
1258 !! wikitext
1259 <center>''foo''</center>
1260 <big>''foo''</big>
1261 <font>''foo''</font>
1262 <strike>''foo''</strike>
1263 <tt>''foo''</tt>
1264 !! html
1265 <center><i>foo</i></center>
1266 <p><big><i>foo</i></big>
1267 <font><i>foo</i></font>
1268 <strike><i>foo</i></strike>
1269 <tt><i>foo</i></tt>
1270 </p>
1271 !! end
1272
1273 !! test
1274 <wbr> is valid wikitext (T54468)
1275 !! wikitext
1276 <wbr>
1277 !! html
1278 <p><wbr />
1279 </p>
1280 !! end
1281
1282 # <strike> is HTML4, <s> is HTML4/5.
1283 !! test
1284 <s> or <strike> for strikethrough
1285 !! wikitext
1286 <strike>strike</strike>
1287
1288 <s>s</s>
1289 !! html
1290 <p><strike>strike</strike>
1291 </p><p><s>s</s>
1292 </p>
1293 !! end
1294
1295 ## a not permitted
1296 ## i,b,br omitted
1297 !! test
1298 Text-level semantic html elements in wikitext
1299 !! wikitext
1300 <em>text</em>
1301 <strong>text</strong>
1302 <small>text</small>
1303 <s>text</s>
1304 <cite>text</cite>
1305 <q>text</q>
1306 <dfn>text</dfn>
1307 <abbr>text</abbr>
1308 <data>text</data>
1309 <time>text</time>
1310 <code>text</code>
1311 <var>text</var>
1312 <samp>text</samp>
1313 <kbd>text</kbd>
1314 <sub>text</sub>
1315 <u>text</u>
1316 <mark>text</mark>
1317 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1318 <bdi>text</bdi>
1319 <bdo>text</bdo>
1320 <span>text</span>
1321 <wbr />
1322 !! html
1323 <p><em>text</em>
1324 <strong>text</strong>
1325 <small>text</small>
1326 <s>text</s>
1327 <cite>text</cite>
1328 <q>text</q>
1329 <dfn>text</dfn>
1330 <abbr>text</abbr>
1331 <data>text</data>
1332 <time>text</time>
1333 <code>text</code>
1334 <var>text</var>
1335 <samp>text</samp>
1336 <kbd>text</kbd>
1337 <sub>text</sub>
1338 <u>text</u>
1339 <mark>text</mark>
1340 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1341 <bdi>text</bdi>
1342 <bdo>text</bdo>
1343 <span>text</span>
1344 <wbr />
1345 </p>
1346 !! end
1347
1348 # test cases taken from
1349 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1350 !! test
1351 Ruby markup (W3C-style)
1352 !! wikitext
1353 ;Mono-ruby for individual base characters
1354 :<ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1355 ;Group ruby
1356 :<ruby>今日<rt>きょう</rt></ruby>
1357 ;Jukugo ruby
1358 :<ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1359 ;Inline ruby
1360 :<ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1361 ;Double-sided ruby
1362 :<ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1363
1364 <ruby>
1365 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1366 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1367 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1368 </ruby>
1369 !! html
1370 <dl><dt>Mono-ruby for individual base characters</dt>
1371 <dd><ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1372 <dt>Group ruby</dt>
1373 <dd><ruby>今日<rt>きょう</rt></ruby></dd>
1374 <dt>Jukugo ruby</dt>
1375 <dd><ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1376 <dt>Inline ruby</dt>
1377 <dd><ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1378 <dt>Double-sided ruby</dt>
1379 <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>
1380 <p><ruby>
1381 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1382 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1383 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1384 </ruby>
1385 </p>
1386 !! end
1387
1388 # The next two test different paths in the sanitizer.
1389 !! test
1390 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1391 !! wikitext
1392 <blockquote|>a</blockquote>
1393
1394 <b→> doesn't terminate </b→>
1395
1396 <bä> doesn't terminate </bä>
1397
1398 <boo> doesn't terminate </boo>
1399
1400 <s.foo> doesn't terminate </s.foo>
1401
1402 <sub-ID#1>
1403 !! html/php
1404 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1405 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1406 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1407 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1408 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1409 </p><p>&lt;sub-ID#1&gt;
1410 </p>
1411 !! end
1412
1413 !! test
1414 Non-word characters don't terminate tag names
1415 !! wikitext
1416 <blockquote|>a</blockquote>
1417
1418 <b→> doesn't terminate </b→>
1419
1420 <bä> doesn't terminate </bä>
1421
1422 <boo> doesn't terminate </boo>
1423
1424 <s.foo> doesn't terminate </s.foo>
1425
1426 <sub-ID#1>
1427 !! html+tidy
1428 <p>&lt;blockquote|&gt;a
1429 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1430 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1431 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1432 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1433 </p><p>&lt;sub-ID#1&gt;
1434 </p>
1435 !! end
1436
1437 ###
1438 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1439 ### This checks that HTML5 tags (with non-word characters in the tag
1440 ### name) make it safely through the parser -- the Sanitizer will
1441 ### munge them later, as it should.
1442 ###
1443 !! test
1444 Non-word characters are valid in extension tags (T19663)
1445 !! wikitext
1446 <tåg>tåg</tåg>
1447 !! html/php
1448 <pre>
1449 'tåg'
1450 array (
1451 )
1452 </pre>
1453
1454 !! html/parsoid
1455 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1456 !! end
1457
1458 !! test
1459 Isolated close tags should be treated as literal text (T54760)
1460 !! options
1461 parsoid=wt2html
1462 !! wikitext
1463 </b>
1464
1465 <s.foo>s</s>
1466 !! html+tidy
1467 <p class="mw-empty-elt">
1468 </p><p>&lt;s.foo&gt;s
1469 </p>
1470 !! end
1471
1472 ###
1473 ### Special characters
1474 ###
1475
1476 !! test
1477 Bare pipe character (T54363)
1478 !! wikitext
1479 |
1480 !! html
1481 <p>|
1482 </p>
1483 !! end
1484
1485 !! test
1486 Bare pipe character from a template (T54363)
1487 !! wikitext
1488 {{pipe}}
1489 !! html
1490 <p>|
1491 </p>
1492 !! end
1493
1494 ###
1495 ### <nowiki> test cases
1496 ###
1497
1498 !! test
1499 <nowiki> unordered list
1500 !! wikitext
1501 <nowiki>* This is not an unordered list item.</nowiki>
1502 !! html/php
1503 <p>* This is not an unordered list item.
1504 </p>
1505 !! html/parsoid
1506 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1507 !! end
1508
1509 !! test
1510 <nowiki> spacing
1511 !! wikitext
1512 <nowiki>Lorem ipsum dolor
1513
1514 sed abit.
1515 sed nullum.
1516
1517 :and a colon
1518 </nowiki>
1519 !! html/php
1520 <p>Lorem ipsum dolor
1521
1522 sed abit.
1523 sed nullum.
1524
1525 :and a colon
1526
1527 </p>
1528 !! html/parsoid
1529 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1530
1531 sed abit.
1532 sed nullum.
1533
1534 :and a colon
1535 </span></p>
1536 !! end
1537
1538 !! test
1539 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1540 !! wikitext
1541 <nowiki><span class="error"></nowiki>
1542 !! html/php
1543 <p>&lt;span class="error"&gt;
1544 </p>
1545 !! html/parsoid
1546 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1547 !! end
1548
1549 !! test
1550 nowiki 3
1551 !! wikitext
1552 :There is not nowiki.
1553 :There is <nowiki>nowiki</nowiki>.
1554
1555 #There is not nowiki.
1556 #There is <nowiki>nowiki</nowiki>.
1557
1558 *There is not nowiki.
1559 *There is <nowiki>nowiki</nowiki>.
1560 !! html/php
1561 <dl><dd>There is not nowiki.</dd>
1562 <dd>There is nowiki.</dd></dl>
1563 <ol><li>There is not nowiki.</li>
1564 <li>There is nowiki.</li></ol>
1565 <ul><li>There is not nowiki.</li>
1566 <li>There is nowiki.</li></ul>
1567
1568 !! html/parsoid
1569 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1570 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1571
1572 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1573 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1574
1575 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1576 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1577 !! end
1578
1579 !! test
1580 Entities inside <nowiki>
1581 !! wikitext
1582 <nowiki>&lt;</nowiki>
1583 !! html/php
1584 <p>&lt;
1585 </p>
1586 !! html/parsoid
1587 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1588 !! end
1589
1590 !! test
1591 Entities inside template parameters
1592 !! wikitext
1593 {{echo|&ndash;}}
1594 !! html/php+tidy
1595 <p>&#8211;
1596 </p>
1597 !! html/parsoid
1598 <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>
1599 !! end
1600
1601 !! test
1602 Properly escape nowiki when combined with other wiki markup
1603 !! options
1604 parsoid=html2wt
1605 !! html/parsoid
1606 <p>* &lt;/nowiki&gt; tag</p>
1607 !! wikitext
1608 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1609 !! end
1610
1611 !! test
1612 T93824: Put escaped HTML tags inside nowiki
1613 !! options
1614 parsoid=html2wt
1615 !! html/parsoid
1616 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1617 !! wikitext
1618 <nowiki><h2>foo</h2></nowiki>
1619 !! end
1620
1621 !! test
1622 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1623 !! options
1624 parsoid=html2wt
1625 !! html/parsoid
1626 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1627 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1628 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1629 !! wikitext
1630 This text: L'[[Foo]]
1631 This text: L<nowiki>''</nowiki>[[Foo]]
1632 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1633 !! end
1634
1635 # This test fails because wikitext whitespace is not normalized before comparing.
1636 !! test
1637 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1638 !! options
1639 parsoid=html2wt
1640 !! html/parsoid
1641 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1642 </p>
1643 !! wikitext
1644 This text : L<nowiki>''</nowiki>[[Foo]]
1645 !! end
1646
1647 # This test and the next one are html2wt only as they test that incorrect wikitext
1648 # passed in template arguments gets escaped or wrapped in nowikis where required.
1649 !! test
1650 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1651 !! options
1652 parsoid=html2wt
1653 !! html/parsoid
1654 <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>
1655 <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>
1656 !! wikitext
1657 {{echo|foo{{!}}bar}}
1658 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1659 !! end
1660
1661 !! test
1662 T53961: Output correct nowikis in template arguments
1663 !! options
1664 parsoid=html2wt
1665 !! html/parsoid
1666 <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>
1667 <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>
1668 <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>
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 | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></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 }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1671 !! wikitext
1672 {{echo|a [ b}}
1673 {{echo|<nowiki>a }} b</nowiki>}}
1674 {{echo|<nowiki>a [[ b</nowiki>}}
1675 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1676 {{echo|a <nowiki>}</nowiki>}}
1677 !! end
1678
1679 !! test
1680 Cases where "!!" needs nowiki protection
1681 !! options
1682 parsoid=html2wt
1683 !! html/parsoid
1684 <table>
1685 <tr><th>this needs protection !! here</th></tr>
1686 </table>
1687
1688 <table>
1689 <tr><th>this does not need
1690 protection !! here</th></tr>
1691 </table>
1692 !! wikitext
1693 {|
1694 !<nowiki>this needs protection !! here</nowiki>
1695 |}
1696
1697 {|
1698 !this does not need
1699 protection !! here
1700 |}
1701 !! end
1702
1703 ###
1704 ### Comments
1705 ###
1706 !! test
1707 Comments and Indent-Pre
1708 !! wikitext
1709 <!-- comment 1 --> asdf
1710
1711 <!-- comment 1 --> asdf
1712 <!-- comment 2 -->
1713
1714 <!-- comment 1 --> asdf
1715 <!-- comment 2 -->xyz
1716
1717 <!-- comment 1 --> asdf
1718 <!-- comment 2 --> xyz
1719 !! html
1720 <pre>asdf
1721 </pre>
1722 <pre>asdf
1723 </pre>
1724 <pre>asdf
1725 </pre>
1726 <p>xyz
1727 </p>
1728 <pre>asdf
1729 xyz
1730 </pre>
1731 !! end
1732
1733 !! test
1734 Comment test 2a
1735 !! wikitext
1736 asdf
1737 <!-- comment 1 -->
1738 jkl
1739 !! html
1740 <p>asdf
1741 jkl
1742 </p>
1743 !! end
1744
1745 !! test
1746 Comment test 2b
1747 !! wikitext
1748 asdf
1749 <!-- comment 1 -->
1750
1751 jkl
1752 !! html
1753 <p>asdf
1754 </p><p>jkl
1755 </p>
1756 !! end
1757
1758 !! test
1759 Comment test 3
1760 !! wikitext
1761 asdf
1762 <!-- comment 1 -->
1763 <!-- comment 2 -->
1764 jkl
1765 !! html
1766 <p>asdf
1767 jkl
1768 </p>
1769 !! end
1770
1771 !! test
1772 Comment test 4
1773 !! wikitext
1774 asdf<!-- comment 1 -->jkl
1775 !! html
1776 <p>asdfjkl
1777 </p>
1778 !! end
1779
1780 !! test
1781 Comment spacing
1782 !! wikitext
1783 a
1784 <!-- foo --> b <!-- bar -->
1785 c
1786 !! html
1787 <p>a
1788 </p>
1789 <pre> b
1790 </pre>
1791 <p>c
1792 </p>
1793 !! end
1794
1795 !! test
1796 Comment whitespace
1797 !! wikitext
1798 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1799 !! html
1800
1801 !! end
1802
1803 !! test
1804 Comment semantics and delimiters
1805 !! wikitext
1806 <!-- --><!----><!-----><!------>
1807 !! html/php
1808
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
1820 !! html/parsoid
1821 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1822 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1823 !! end
1824
1825 !! test
1826 Comment semantics and delimiters: directors cut
1827 !! wikitext
1828 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1829 everything starting with < followed by !-- until the first -- and > we see,
1830 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1831 -->-->
1832 !! html/php
1833 <p>--&gt;
1834 </p>
1835 !! html/parsoid
1836 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1837 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1838 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1839 --><p>--></p>
1840 !! end
1841
1842 !! test
1843 Comment semantics: nesting
1844 !! wikitext
1845 <!--<!-- no, we're not going to do anything fancy here -->-->
1846 !! html/php
1847 <p>--&gt;
1848 </p>
1849 !! html/parsoid
1850 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1851 !! end
1852
1853 # Parsoid closes the unclosed comment, even if it means a slight
1854 # round-trip diff.
1855 !! test
1856 Comment semantics: unclosed comment at end
1857 !! options
1858 parsoid=wt2html,html2html
1859 !! wikitext
1860 <!--This comment will run out to the end of the document
1861 !! html/php
1862
1863 !! html/parsoid
1864 <!--This comment will run out to the end of the document-->
1865 !! end
1866
1867 !! test
1868 Comment semantics: normalize comments to play nice with XML and browsers
1869 !! wikitext
1870 <!-- Browsers --!> think this is closed -->
1871 <!--> This would normally be text -->
1872 <!---> As would this -->
1873 <!-- XML doesn't like trailing dashes -------->
1874 <!-- Nor doubled hyphens -- anywhere in the data -->
1875 But this is not a comment.
1876 !! html/php
1877 <p>But this is not a comment.
1878 </p>
1879 !! html/parsoid
1880 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1881 <!--&#x3E; This would normally be text -->
1882 <!--&#x2D;&#x3E; As would this -->
1883 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1884 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1885 <p>But this is not a comment.</p>
1886 !! end
1887
1888 !! test
1889 Comment semantics: round-trip even text which contains encoded -->
1890 !! wikitext
1891 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1892 !! html/parsoid
1893 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1894 !! end
1895
1896 !! test
1897 Comment in template title
1898 !! wikitext
1899 {{f<!---->oo}}
1900 !! html
1901 <p>FOO
1902 </p>
1903 !! end
1904
1905 !! test
1906 Comment on its own line post-expand
1907 !! wikitext
1908 a
1909 {{blank}}<!---->
1910 b
1911 !! html
1912 <p>a
1913 </p><p>b
1914 </p>
1915 !! end
1916
1917 !! test
1918 Comment on its own line post-expand with non-significant whitespace
1919 !! wikitext
1920 a
1921 {{blank}} <!---->
1922 b
1923 !! html
1924 <p>a
1925 </p><p>b
1926 </p>
1927 !! end
1928
1929 !! test
1930 post-expand include size being exceeded
1931 !! options
1932 maxincludesize=20
1933 !! wikitext
1934 {{echo3|1234567890}}
1935 !! html
1936 <p><a href="/wiki/Template:Echo3" title="Template:Echo3">Template:Echo3</a><!-- WARNING: template omitted, post-expand include size too large -->
1937 </p>
1938 !! end
1939
1940 !! test
1941 max template depth being reached
1942 !! options
1943 maxtemplatedepth=1
1944 !! wikitext
1945 {{echo with depth|too deep!}}
1946 !! html
1947 <p><span class="error">Template recursion depth limit exceeded (1)</span>
1948 </p>
1949 !! end
1950
1951 !! test
1952 multiple templates that are redirects
1953 !! wikitext
1954 {{redirect to foo}}
1955 {{redirect to foo}}
1956 !! html
1957 <p>FOO
1958 FOO
1959 </p>
1960 !! end
1961
1962 !! test
1963 Multiple comments should still parse as SOL-transparent
1964 !! options
1965 parsoid=wt2html,wt2wt
1966 !! wikitext
1967 <!--c1-->*a
1968 <!--c2--><!--c3--><!--c4-->*b
1969 !! html/php
1970 <ul><li>a</li>
1971 <li>b</li></ul>
1972
1973 !! html/parsoid
1974 <!--c1--><ul>
1975 <li>a
1976 </li>
1977 <!--c2--><!--c3--><!--c4-->
1978 <li>b
1979 </li>
1980 </ul>
1981 !! end
1982
1983 ## Make sure ">" gets escaped in comments to avoid XSS
1984 !! test
1985 IE conditional comments
1986 !! wikitext
1987 <!--[if lt IE 9]>
1988 <script>alert('hi');</script>
1989 <![endif]-->
1990 !! html/parsoid
1991 <!--[if lt IE 9]&#x3E;
1992 <script&#x3E;alert('hi');</script&#x3E;
1993 <![endif]-->
1994 !! end
1995
1996 ###
1997 ### paragraph wrapping tests
1998 ###
1999
2000 !! test
2001 No block tags
2002 !! wikitext
2003 a
2004
2005 b
2006 !! html
2007 <p>a
2008 </p><p>b
2009 </p>
2010 !! end
2011
2012 !! test
2013 Block tag on one line (<div>)
2014 !! wikitext
2015 a <div>foo</div>
2016
2017 b
2018 !! html
2019 a <div>foo</div>
2020 <p>b
2021 </p>
2022 !! html+tidy
2023 <p>a </p><div>foo</div>
2024 <p>b
2025 </p>
2026 !! end
2027
2028 !! test
2029 No p-wrappable content
2030 !! options
2031 parsoid=wt2html,html2html
2032 !! wikitext
2033 <span><div>x</div></span>
2034 <span><s><div>x</div></s></span>
2035 <small><em></em></small><span><s><div>x</div></s></span>
2036 !! html+tidy
2037 <span><div>x</div></span>
2038 <span><s><div>x</div></s></span>
2039 <p><small><em></em></small></p><span><s><div>x</div></s></span>
2040 !! end
2041
2042 # T177612: Parsoid-only test
2043 !! test
2044 Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code
2045 !! wikitext
2046 {{echo|<span><div>x</div></span>}}
2047 x
2048 !! html/parsoid
2049 <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>
2050 <p>x</p>
2051 !! end
2052
2053 !! test
2054 Block tag on one line (<blockquote>)
2055 !! wikitext
2056 a <blockquote>foo</blockquote>
2057
2058 b
2059 !! html
2060 a <blockquote>foo</blockquote>
2061 <p>b
2062 </p>
2063 !! html+tidy
2064 <p>a </p><blockquote><p>foo</p></blockquote>
2065 <p>b
2066 </p>
2067 !! end
2068
2069 !! test
2070 Block tag on both lines (<div>)
2071 !! wikitext
2072 a <div>foo</div>
2073
2074 b <div>foo</div>
2075 !! html
2076 a <div>foo</div>
2077 b <div>foo</div>
2078
2079 !! html+tidy
2080 <p>a </p><div>foo</div><p>
2081 b </p><div>foo</div>
2082 !! end
2083
2084 !! test
2085 Block tag on both lines (<blockquote>)
2086 !! wikitext
2087 a <blockquote>foo</blockquote>
2088
2089 b <blockquote>foo</blockquote>
2090 !! html
2091 a <blockquote>foo</blockquote>
2092 b <blockquote>foo</blockquote>
2093
2094 !! html+tidy
2095 <p>a </p><blockquote><p>foo</p></blockquote><p>
2096 b </p><blockquote><p>foo</p></blockquote>
2097 !! end
2098
2099 !! test
2100 Multiple lines without block tags
2101 !! wikitext
2102 <div>foo</div> a
2103 b
2104 c
2105 d<!--foo--> e
2106 x <div>foo</div> z
2107 !! html
2108 <div>foo</div> a
2109 <p>b
2110 c
2111 d e
2112 </p>
2113 x <div>foo</div> z
2114
2115 !! html+tidy
2116 <div>foo</div><p> a
2117 </p><p>b
2118 c
2119 d e
2120 </p><p>
2121 x </p><div>foo</div><p> z
2122 </p>
2123 !! end
2124
2125 !! test
2126 Empty lines between lines with block tags
2127 !! wikitext
2128 <div></div>
2129
2130
2131 <div></div>a
2132
2133 b
2134 <div>a</div>b
2135
2136 <div>b</div>d
2137
2138
2139 <div>e</div>
2140 !! html
2141 <div></div>
2142 <p><br />
2143 </p>
2144 <div></div>a
2145 <p>b
2146 </p>
2147 <div>a</div>b
2148 <div>b</div>d
2149 <p><br />
2150 </p>
2151 <div>e</div>
2152
2153 !! html+tidy
2154 <div></div>
2155 <p><br />
2156 </p>
2157 <div></div><p>a
2158 </p><p>b
2159 </p>
2160 <div>a</div><p>b
2161 </p><div>b</div><p>d
2162 </p><p><br />
2163 </p>
2164 <div>e</div>
2165 !! html/parsoid
2166 <div data-parsoid='{"stx":"html"}'></div>
2167
2168 <p><br /></p>
2169 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2170
2171 <p>b</p>
2172 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2173
2174 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2175
2176 <p><br /></p>
2177 <div data-parsoid='{"stx":"html"}'>e</div>
2178 !! end
2179
2180 !! test
2181 Unclosed HTML p-tags should be handled properly
2182 !! wikitext
2183 <div><p>foo</div>
2184 a
2185
2186 b
2187 !! html/php+tidy
2188 <div><p>foo</p></div>
2189 <p>a
2190 </p><p>b
2191 </p>
2192 !! html/parsoid
2193 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2194 <p>a</p>
2195 <p>b</p>
2196 !! end
2197
2198 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2199 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2200 ## them for now.
2201 !! test
2202 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2203 !! options
2204 parsoid=wt2html
2205 !! wikitext
2206 a [[Category:A1]] [[Category:A2]]
2207 [[Category:A3]]
2208 [[Category:A4]]
2209 !! html/parsoid
2210 <p>a</p>
2211 <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"/>
2212 !! end
2213
2214 !! test
2215 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2216 !! options
2217 parsoid=wt2html
2218 !! wikitext
2219 [[Category:A1]]a
2220 !! html/parsoid
2221 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2222 !! end
2223
2224 !! test
2225 No paragraph necessary for SOL transparent template
2226 !! wikitext
2227 <span><div>foo</div></span>
2228 [[Category:Foo]]
2229
2230 <span><div>foo</div></span>
2231 {{echo|[[Category:Foo]]}}
2232 !! html/php
2233 <span><div>foo</div></span>
2234 <span><div>foo</div></span>
2235
2236 !! html/parsoid
2237 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2238 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
2239
2240 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2241 <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}}]}'/>
2242 !! end
2243
2244 !! test
2245 Avoid expanding multiline sol transparent template ranges unnecessarily
2246 !! wikitext
2247 hi
2248
2249
2250 {{echo|<br/>
2251 }}
2252
2253 [[Category:Ho]]
2254 !! html/php
2255 <p>hi
2256 </p><p><br />
2257 <br />
2258 </p>
2259 !! html/parsoid
2260 <p>hi</p>
2261
2262 <p><br />
2263 <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">
2264 </span></p>
2265
2266 <link rel="mw:PageProp/Category" href="./Category:Ho" />
2267 !! end
2268
2269 !! test
2270 Paragraph wrapping following unclosed table
2271 !! options
2272 parsoid=wt2html,html2html
2273 !! wikitext
2274 {|
2275 |-
2276
2277 {|
2278 | x
2279 |}
2280
2281 a
2282
2283 b
2284
2285 c
2286 !! html/php+tidy
2287 <table>
2288
2289
2290 </table><table>
2291 <tbody><tr>
2292 <td>x
2293 </td></tr></tbody></table>
2294 <p>a
2295 </p><p>b
2296 </p><p>c
2297 </p>
2298 !! html/parsoid
2299 <table data-parsoid='{"autoInsertedEnd":true}'>
2300 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr>
2301
2302 </tbody></table><table>
2303 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>x</td></tr>
2304 </tbody></table>
2305
2306 <p>a</p>
2307
2308 <p>b</p>
2309
2310 <p>c</p>
2311 !! end
2312
2313 !! test
2314 Paragraph wrapping suppressed in html p
2315 !! options
2316 parsoid=wt2html,html2html
2317 !! wikitext
2318 <p>
2319
2320
2321 hi
2322
2323
2324
2325 </p>
2326 !! html/php+tidy
2327 <p>
2328
2329
2330 hi
2331
2332
2333
2334 </p>
2335 !! html/parsoid
2336 <p data-parsoid='{"stx":"html"}'>
2337
2338
2339 hi
2340
2341
2342
2343 </p>
2344 !! end
2345
2346 !! test
2347 Dangling table row doesn't prevent p-wrapping
2348 !! options
2349 parsoid=wt2html,html2html
2350 !! wikitext
2351 {|
2352 | hi
2353 |-
2354 |} ho
2355 !! html/parsoid
2356 <table>
2357 <tbody><tr><td>hi</td></tr>
2358 <tr class="mw-empty-elt"></tr>
2359 </tbody></table><p> ho</p>
2360 !! end
2361
2362 ###
2363 ### Preformatted text
2364 ###
2365
2366 !! test
2367 Preformatted text
2368 !! wikitext
2369 This is some
2370 Preformatted text
2371 With ''italic''
2372 And '''bold'''
2373 And a [[Main Page|link]]
2374 !! html
2375 <pre>This is some
2376 Preformatted text
2377 With <i>italic</i>
2378 And <b>bold</b>
2379 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2380 </pre>
2381 !! end
2382
2383 !! test
2384 Tabs don't trigger preformatted text
2385 !! wikitext
2386 This is not
2387 preformatted text.
2388 This is preformatted text.
2389 So is this.
2390 !! html/php
2391 <p> This is not
2392 preformatted text.
2393 </p>
2394 <pre>This is preformatted text.
2395 So is this.
2396 </pre>
2397 !! html/parsoid
2398 <p> This is not
2399 preformatted text.</p>
2400 <pre>This is preformatted text.
2401 So is this.</pre>
2402 !! end
2403
2404 !! test
2405 Space before tab needs nowiki pre protection
2406 !! options
2407 parsoid=html2wt
2408 !! html/parsoid
2409 <p> a</p>
2410 !! wikitext
2411 <nowiki> </nowiki> a
2412 !! end
2413
2414 !! test
2415 Ident preformatting with inline content
2416 !! wikitext
2417 a
2418 ''b''
2419 !! html
2420 <pre>a
2421 <i>b</i>
2422 </pre>
2423 !! end
2424
2425 !! test
2426 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2427 !! wikitext
2428 <pre><nowiki>
2429 <b>
2430 <cite>
2431 <em>
2432 </nowiki></pre>
2433 !! html
2434 <pre>
2435 &lt;b&gt;
2436 &lt;cite&gt;
2437 &lt;em&gt;
2438 </pre>
2439
2440 !! end
2441
2442 !! test
2443 Regression with preformatted in <center>
2444 !! wikitext
2445 <center>
2446 Blah
2447 </center>
2448 !! html
2449 <center>
2450 <pre>Blah
2451 </pre>
2452 </center>
2453
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
2478 !! end
2479
2480 !! test
2481 T53086: Double newlines in blockquotes should be turned into paragraphs
2482 !! wikitext
2483 <blockquote>
2484 Foo
2485
2486 Bar
2487 </blockquote>
2488 !! html
2489 <blockquote>
2490 <p>Foo
2491 </p><p>Bar
2492 </p>
2493 </blockquote>
2494
2495 !! end
2496
2497 !! test
2498 T17491: <ins>/<del> in blockquote
2499 !! wikitext
2500 <blockquote>
2501 Foo <del>bar</del> <ins>baz</ins> quux
2502 </blockquote>
2503 !! html
2504 <blockquote>
2505 <p>Foo <del>bar</del> <ins>baz</ins> quux
2506 </p>
2507 </blockquote>
2508
2509 !! html+tidy
2510 <blockquote>
2511 <p>Foo <del>bar</del> <ins>baz</ins> quux
2512 </p>
2513 </blockquote>
2514 !! end
2515
2516 !! test
2517 T17491: <ins>/<del> in blockquote (2)
2518 !! wikitext
2519 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2520 </blockquote>
2521 !! html
2522 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2523 </blockquote>
2524
2525 !! html+tidy
2526 <blockquote><p>Foo <del>bar</del> <ins>baz</ins> quux
2527 </p></blockquote>
2528 !! end
2529
2530 !! test
2531 <pre> with attributes (T5202)
2532 !! wikitext
2533 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2534 !! html
2535 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2536
2537 !! end
2538
2539 !! test
2540 <pre> with width attribute (T5202)
2541 !! wikitext
2542 <pre width="8">Narrow screen goodies</pre>
2543 !! html
2544 <pre width="8">Narrow screen goodies</pre>
2545
2546 !! end
2547
2548 !! test
2549 <pre> with forbidden attribute (T5202)
2550 !! wikitext
2551 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2552 !! html
2553 <pre width="8">Narrow screen goodies</pre>
2554
2555 !! end
2556
2557 !! test
2558 Entities inside <pre>
2559 !! wikitext
2560 <pre>&lt;</pre>
2561 !! html
2562 <pre>&lt;</pre>
2563
2564 !! end
2565
2566 !! test
2567 <pre> with forbidden attribute values (T5202)
2568 !! wikitext
2569 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2570 !! html
2571 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2572
2573 !! end
2574
2575 !! test
2576 <nowiki> inside <pre> (T15238)
2577 !! wikitext
2578 <pre>
2579 <nowiki>
2580 </pre>
2581 <pre>
2582 <nowiki></nowiki>
2583 </pre>
2584 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2585 !! html
2586 <pre>
2587 &lt;nowiki&gt;
2588 </pre>
2589 <pre>
2590
2591 </pre>
2592 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2593
2594 !! end
2595
2596 !! test
2597 <nowiki> inside of #tag:pre
2598 !! wikitext
2599 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2600 !! html/php
2601 <pre>Foo &#8594;bar</pre>
2602
2603 !! html/parsoid
2604 <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>
2605 !! end
2606
2607 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2608 ## aren't enclosed in nowikis.
2609 !! test
2610 <nowiki> and <pre> preference (first one wins)
2611 !! options
2612 parsoid=wt2html
2613 !! wikitext
2614 <pre>
2615 <nowiki>
2616 </pre>
2617 </nowiki>
2618 </pre>
2619
2620 <nowiki>
2621 <pre>
2622 <nowiki>
2623 </pre>
2624 </nowiki>
2625 </pre>
2626
2627 !! html/php
2628 <pre>
2629 &lt;nowiki&gt;
2630 </pre>
2631 <p>&lt;/nowiki&gt;
2632 &lt;/pre&gt;
2633 </p><p>
2634 &lt;pre&gt;
2635 &lt;nowiki&gt;
2636 &lt;/pre&gt;
2637
2638 &lt;/pre&gt;
2639 </p>
2640 !! html/parsoid
2641 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2642 </pre>
2643 <p>&lt;/nowiki></p>
2644
2645
2646 <p><span typeof="mw:Nowiki">
2647 &lt;pre>
2648 &lt;nowiki>
2649 &lt;/pre>
2650 </span></p>
2651 !! end
2652
2653 !! test
2654 </pre> inside nowiki
2655 !! wikitext
2656 <nowiki></pre></nowiki>
2657 !! html
2658 <p>&lt;/pre&gt;
2659 </p>
2660 !! end
2661
2662 !! test
2663 Empty pre; pre inside other HTML tags (T56946)
2664 !! wikitext
2665 a
2666
2667 <div><pre>
2668 foo
2669 </pre></div>
2670 <pre></pre>
2671 !! html/php+tidy
2672 <p>a
2673 </p>
2674 <div><pre>foo
2675 </pre></div>
2676 <pre></pre>
2677 !! html/parsoid
2678 <p>a</p>
2679
2680 <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
2681 </pre></div>
2682 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2683 !! end
2684
2685 !! test
2686 HTML pre followed by indent-pre
2687 !! wikitext
2688 <pre>foo</pre>
2689 bar
2690 !! html
2691 <pre>foo</pre>
2692 <pre>bar
2693 </pre>
2694 !! end
2695
2696 !! test
2697 Block tag pre
2698 !! wikitext
2699 <p><pre>foo</pre></p>
2700 !! html/php+tidy
2701 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2702 !! html/parsoid
2703 <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>
2704 !! end
2705
2706 !!test
2707 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2708 !! wikitext
2709 {{echo|}}
2710 !! html
2711
2712 !!end
2713
2714 !!test
2715 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2716 !! wikitext
2717 {{echo|
2718 foo}}
2719 !! html
2720 <p>foo
2721 </p>
2722 !!end
2723
2724 !! test
2725 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2726 !! wikitext
2727 {{echo|a
2728 b}}
2729 !! html
2730 <pre>a
2731 </pre>
2732 <p>b
2733 </p>
2734 !!end
2735
2736 !! test
2737 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2738 !! wikitext
2739 {{echo|a
2740 b
2741 c
2742 d
2743 e
2744 }}
2745 !! html
2746 <pre>a
2747 </pre>
2748 <p>b
2749 c
2750 </p>
2751 <pre>d
2752 </pre>
2753 <p>e
2754 </p>
2755 !!end
2756
2757 !!test
2758 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2759 !! wikitext
2760 {{echo| foo}}
2761
2762 {{echo| foo}}{{echo| bar}}
2763
2764 {{echo| foo}}
2765 {{echo| bar}}
2766
2767 {{echo|<!--cmt--> foo}}
2768
2769 <!--cmt-->{{echo| foo}}
2770
2771 {{echo|{{echo| }}bar}}
2772 !! html
2773 <pre>foo
2774 </pre>
2775 <pre>foo bar
2776 </pre>
2777 <pre>foo
2778 bar
2779 </pre>
2780 <pre>foo
2781 </pre>
2782 <pre>foo
2783 </pre>
2784 <pre>bar
2785 </pre>
2786 !!end
2787
2788 !! test
2789 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2790 !! wikitext
2791 {{echo| }}a
2792
2793 {{echo|
2794 }}a
2795
2796 {{echo|
2797 b}}
2798
2799 {{echo|a
2800 }}b
2801
2802 {{echo|a
2803 }} b
2804 !! html
2805 <pre>a
2806 </pre>
2807 <p><br />
2808 </p>
2809 <pre>a
2810 </pre>
2811 <p><br />
2812 </p>
2813 <pre>b
2814 </pre>
2815 <p>a
2816 </p>
2817 <pre>b
2818 </pre>
2819 <p>a
2820 </p>
2821 <pre>b
2822 </pre>
2823 !!end
2824
2825 ## Hmm, should Parsoid rt this?
2826 !! test
2827 Pres with newline attributes
2828 !! options
2829 parsoid=wt2html,html2html
2830 !! wikitext
2831 <pre class="one
2832 two">hi</pre>
2833 !! html/php
2834 <pre class="one two">hi</pre>
2835
2836 !! html/parsoid
2837 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2838 !! end
2839
2840 !! test
2841 Things that look like <pre> tags aren't treated as such
2842 !! wikitext
2843 Barack Obama <President> of the United States
2844 <President></President>
2845 !! html
2846 <p>Barack Obama &lt;President&gt; of the United States
2847 &lt;President&gt;&lt;/President&gt;
2848 </p>
2849 !! end
2850
2851 ## Remex doesn't account for fostered content.
2852 ## The difference between Parsoid and the PHP parser can be attributed to core
2853 ## commit 674e8388cba and 710618f89af in Parsoid's repo. Parsoid doesn't
2854 ## tokenize unmatched extension tags that shadow html tags as strings to ease
2855 ## an escaping mechanism. See the comment in `maybeExtensionTag`.
2856 !! test
2857 Handle broken pre-like tags (T66025)
2858 !! options
2859 parsoid=wt2html
2860 !! wikitext
2861 {{echo|<pre <pre>x</pre>}}
2862
2863 <table><pre </table>
2864 !! html/php
2865 <pre>x</pre>
2866 <table>&lt;pre </table>
2867
2868 !! html/php+tidy
2869 <pre>x</pre>
2870 &lt;pre <table></table>
2871 !! html/parsoid
2872 <pre typeof="mw:Transclusion mw:Extension/pre" 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>
2873
2874 <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>
2875 !! end
2876
2877 ## Similar to the above, but shows the difference between extension and html tags
2878 !! test
2879 Less than in attribute position
2880 !! wikitext
2881 <pre <pre>123</pre>
2882
2883 <div <div>123</div>
2884 !! html/php+tidy
2885 <pre>123</pre><p>
2886 &lt;div </p><div>123</div>
2887 !! html/parsoid
2888 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"&lt;pre":""},"body":{"extsrc":"123"}}'>123</pre><p>
2889
2890 &lt;div </p><div>123</div>
2891 !! end
2892
2893 !! test
2894 Parsoid: handle pre with space after attribute
2895 !! options
2896 parsoid=wt2html
2897 !! wikitext
2898 <pre style="width:50%;" >{{echo|foo}}</pre>
2899 !! html/php
2900 <pre style="width:50%;">{{echo|foo}}</pre>
2901
2902 !! html/parsoid
2903 <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>
2904 !! end
2905
2906 !! test
2907 Self-closed pre
2908 !! wikitext
2909 <pre />
2910 !! html/php
2911 <pre></pre>
2912
2913 !! html/parsoid
2914 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{}}'></pre>
2915 !! end
2916
2917 !! test
2918 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2919 !! options
2920 parsoid=wt2html
2921 !! wikitext
2922 {|
2923 <td>
2924 <td>
2925 </td>
2926
2927
2928
2929 |}
2930 !! html
2931 <table>
2932
2933 <tbody>
2934 <tr>
2935 <td></td>
2936
2937 <td>
2938 </td></tr>
2939
2940
2941
2942 </tbody></table>
2943 !! end
2944
2945
2946 #--------------------------------------------------------------------
2947 # Transclusion parameter whitespace stripping tests
2948 # Behavior is different for positional and named parameters
2949 #--------------------------------------------------------------------
2950 !! test
2951 Templates: Strip leading and trailing whitespace from named-param values
2952 !! wikitext
2953 {{echo|1= a }}
2954
2955 {{echo|1= {{echo|b}} }}
2956
2957 {{echo| 1 =
2958 c }}
2959
2960 {{echo| 1 =
2961 * d
2962 }}
2963 !! html
2964 <p>a
2965 </p><p>b
2966 </p><p>c
2967 </p>
2968 <ul><li>d</li></ul>
2969
2970 !! end
2971
2972 !! test
2973 Templates: Don't strip whitespace from positional-param values
2974 !! wikitext
2975 {{echo|a }}
2976
2977 {{echo|{{echo|b}} }}
2978
2979 {{echo| c
2980 }}
2981
2982 {{echo| {{echo|d}}
2983 }}
2984
2985 {{echo|
2986 e}}
2987
2988 {{echo|
2989 *f}}
2990
2991 {{echo|
2992 }}g
2993 !! html
2994 <p>a
2995 </p><p>b
2996 </p>
2997 <pre>c
2998 </pre>
2999 <p><br />
3000 </p>
3001 <pre>d
3002 </pre>
3003 <p><br />
3004 </p>
3005 <pre>e
3006 </pre>
3007 <p><br />
3008 </p>
3009 <ul><li>f</li></ul>
3010 <p><br />
3011 </p>
3012 <pre>g
3013 </pre>
3014 !! end
3015
3016 !! test
3017 Templates: Don't recognize targets split by newlines
3018 !! options
3019 parsoid=wt2html
3020 !! wikitext
3021 {{ech
3022 o|foo}}
3023 !! html/php
3024 <p>{{ech
3025 o|foo}}
3026 </p>
3027 !! html/parsoid
3028 <p>{{ech
3029 o|foo}}</p>
3030 !! end
3031
3032 !! test
3033 Templates: Recognize targets when newlines and comments don't split the target
3034 !! options
3035 parsoid=wt2html
3036 !! wikitext
3037 {{
3038 <!--X--> ech<!--X-->o<!--X-->
3039 <!--X--> <!--X-->
3040
3041 |foo}}
3042 !! html/php
3043 <p>foo
3044 </p>
3045 !! html/parsoid
3046 <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>
3047 !! end
3048
3049 !! test
3050 Templates: Handle empty comment-and-ws-only lines correctly
3051 !! wikitext
3052 {{echo|foo
3053 <!--should be ignored-->
3054 <!--should be ignored as well-->
3055 bar}}
3056 !! html/php
3057 <p>foo
3058 bar
3059 </p>
3060 !! html/parsoid
3061 <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>
3062 !! end
3063
3064 !! test
3065 Templates: Handle comments in the target
3066 !! wikitext
3067 {{echo
3068 <!-- should be ignored -->
3069 |foo}}
3070
3071 {{echo
3072 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
3073 |foo}}
3074
3075 {{echo<!-- should be ignored -->
3076 |foo}}
3077
3078 {{echo<!-- should be ignored -->|foo}}
3079
3080 {{<!-- should be ignored -->echo|foo}}
3081 !! html/php
3082 <p>foo
3083 </p><p>foo
3084 </p><p>foo
3085 </p><p>foo
3086 </p><p>foo
3087 </p>
3088 !! html/parsoid
3089 <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>
3090
3091 <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>
3092
3093 <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>
3094
3095 <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>
3096
3097 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3098 !! end
3099
3100 !! test
3101 Templates: Handle comments in parameter names (T69657)
3102 !! wikitext
3103 {{echo|1
3104 <!-- should be ignored -->
3105 =foo}}
3106
3107 {{echo|
3108 <!-- should be ignored -->
3109 1 = foo}}
3110
3111 {{echo|1<!-- should be ignored -->=foo}}
3112
3113 {{echo|<!-- should be ignored -->1=foo}}
3114 !! html/php
3115 <p>foo
3116 </p><p>foo
3117 </p><p>foo
3118 </p><p>foo
3119 </p>
3120 !! html/parsoid
3121 <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>
3122
3123 <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>
3124
3125 <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>
3126
3127 <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>
3128 !! end
3129
3130 !! test
3131 Templates: Other wikitext in parameter names (T69657)
3132 !! wikitext
3133 {{echo|''1''=foo}}
3134 !! html/php
3135 <p>{{{1}}}
3136 </p>
3137 !! html/parsoid
3138 <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>
3139 !! end
3140
3141 !! test
3142 Templates: With colons
3143 !! wikitext
3144 {{With: Colon}}
3145 !! html/php
3146 <p>Template with colon
3147 </p>
3148 !! html/parsoid
3149 <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>
3150 !! end
3151
3152 #--------------------------------------------------------------------
3153 # Transclusion parameter escaping tests
3154 #--------------------------------------------------------------------
3155
3156 !! test
3157 Templates: Parsoid parameter escaping test 1
3158 !! wikitext
3159 {{echo|[foo]|{{echo|[bar]}}}}
3160 !! html/php+tidy
3161 <p>[foo]
3162 </p>
3163 !! html/parsoid
3164 <p about="#mwt1" typeof="mw:Transclusion"
3165 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
3166 !! end
3167
3168 !! test
3169 Parsoid: Pipes in external links in template parameter
3170 !! wikitext
3171 {{echo|[{{echo|http://example.com}} link]}}
3172 !! html/php+tidy
3173 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
3174 </p>
3175 !! html/parsoid
3176 <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>
3177 !! end
3178
3179 !! test
3180 Parsoid: pipe in transclusion parameter
3181 !! wikitext
3182 {{echo|http://foo.com/a&#124;b}}
3183 !! html/php+tidy
3184 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
3185 </p>
3186 !! html/parsoid
3187 <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>
3188 !! end
3189
3190 !! test
3191 Parsoid: Pipe in external link target and content in template parameter
3192 !! options
3193 parsoid=html2wt,wt2wt
3194 !! wikitext
3195 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
3196 !! html/php+tidy
3197 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
3198 </p>
3199 !! html/parsoid
3200 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
3201 typeof="mw:Transclusion"
3202 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
3203 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
3204 !! end
3205
3206 !! test
3207 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
3208 !! options
3209 parsoid
3210 !! wikitext
3211 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
3212 !! html
3213 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
3214 !! end
3215
3216 !! test
3217 Templates: Don't escape already nowiki-escaped text in template parameters
3218 !! options
3219 parsoid=html2wt,wt2wt
3220 !! wikitext
3221 {{echo|foo<nowiki>|</nowiki>bar}}
3222 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3223 {{echo|<nowiki></nowiki>}}
3224 !! html/php+tidy
3225 <p>foo|bar
3226 &lt;div&gt;
3227
3228 </p>
3229 !! html/parsoid
3230 <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>
3231 <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>
3232 <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>
3233 </p>
3234 !! end
3235
3236 ## T54824
3237 !! test
3238 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3239 !! options
3240 parsoid=html2wt,wt2wt
3241 !! wikitext
3242 {{echo|{{echo|1=bar}}}}
3243 !! html/php+tidy
3244 <p>bar
3245 </p>
3246 !! html/parsoid
3247 <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>
3248 !! end
3249
3250 ## T58733
3251 !! test
3252 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3253 !! wikitext
3254 {{echo|a : b}}
3255 !! html/php+tidy
3256 <p>a&#160;: b
3257 </p>
3258 !! html/parsoid
3259 <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>
3260 !! end
3261
3262 ## T73412
3263 !! test
3264 Templates: Preserve blank parameter names
3265 !! wikitext
3266 {{echo|=foo}}
3267 !! html/php+tidy
3268 <p>{{{1}}}
3269 </p>
3270 !! html/parsoid
3271 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3272 !! end
3273
3274 !! test
3275 Templates: Preserve blank parameter names in other positions
3276 !! wikitext
3277 {{blank_param|bar|=foo}}
3278 !! html/php+tidy
3279 <p>bar
3280 foo
3281 </p>
3282 !! html/parsoid
3283 <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
3284 foo</p>
3285 !! end
3286
3287 ###
3288 ### Parsoid-centric tests for testing RT edge cases for pre
3289 ###
3290
3291 !!test
3292 1a. Indent-Pre and Comments
3293 !! wikitext
3294 a
3295 <!--a-->
3296 c
3297 !! html
3298 <pre>a
3299 </pre>
3300 <p>c
3301 </p>
3302 !!end
3303
3304 !!test
3305 1b. Indent-Pre and Comments
3306 !! wikitext
3307 a
3308 <!--a-->
3309 c
3310 !! html
3311 <pre>a
3312 </pre>
3313 <p>c
3314 </p>
3315 !!end
3316
3317 !!test
3318 1c. Indent-Pre and Comments
3319 !! wikitext
3320 <!--a--> a
3321
3322 <!--a--> a
3323 !! html
3324 <pre> a
3325 </pre>
3326 <pre> a
3327 </pre>
3328 !!end
3329
3330 !!test
3331 1d. Indent-Pre and Comments
3332 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3333 !! wikitext
3334 <!--a--> a
3335
3336 <!--b-->b
3337 !! html
3338 <pre>a
3339 </pre>
3340 <pre>b
3341 </pre>
3342 !!end
3343
3344 !!test
3345 2a. Indent-Pre and tables
3346 !! wikitext
3347 {|
3348 |-
3349 !h1!!h2
3350 |foo||bar
3351 |}
3352 !! html
3353 <table>
3354
3355 <tr>
3356 <th>h1</th>
3357 <th>h2
3358 </th>
3359 <td>foo</td>
3360 <td>bar
3361 </td></tr></table>
3362
3363 !!end
3364
3365 !!test
3366 2b. Indent-Pre and tables
3367 !! wikitext
3368 {|
3369 |-
3370 |foo
3371 |}
3372 !! html
3373 <table>
3374
3375 <tr>
3376 <td>foo
3377 </td></tr></table>
3378
3379 !!end
3380
3381 !!test
3382 2c. Indent-Pre and tables (T44252)
3383 !! wikitext
3384 {|
3385 |+foo
3386 ! |bar
3387 |}
3388 !! html
3389 <table>
3390 <caption>foo
3391 </caption>
3392 <tr>
3393 <th>bar
3394 </th></tr></table>
3395
3396 !!end
3397
3398 !!test
3399 2d. Indent-Pre and tables
3400 !! wikitext
3401 a
3402 {|
3403 |b
3404 |}
3405 !! html/php
3406 <pre>a
3407 </pre>
3408 <table>
3409 <tr>
3410 <td>b
3411 </td></tr></table>
3412
3413 !! html/parsoid
3414 <pre>a</pre>
3415 <table>
3416 <tbody><tr><td> b</td></tr>
3417 </tbody></table>
3418 !!end
3419
3420 !!test
3421 2e. Indent-Pre and table-line syntax
3422 !! wikitext
3423 a
3424 | b
3425 | c
3426 !! html/php
3427 <pre>a
3428 | b
3429 | c
3430 </pre>
3431 !!end
3432
3433 !!test
3434 2f. Indent-pre started by table-line syntax
3435 !! wikitext
3436 a
3437 | b
3438 | c
3439 !! html/php
3440 <p>a
3441 </p>
3442 <pre>| b
3443 | c
3444 </pre>
3445 !! html/parsoid
3446 <p>a</p>
3447 <pre>
3448 | b
3449 | c</pre>
3450 !!end
3451
3452 !! test
3453 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3454 !! wikitext
3455 <table>
3456 <tr>
3457 <td>
3458 Text that should be rendered preformatted
3459 </td>
3460 </tr>
3461 </table>
3462 !! html
3463 <table>
3464 <tr>
3465 <td>
3466 <pre>Text that should be rendered preformatted
3467 </pre>
3468 </td>
3469 </tr>
3470 </table>
3471
3472 !! end
3473
3474 !! test
3475 2h. Indent pre in tables
3476 !! options
3477 parsoid=wt2html,html2html
3478 !! wikitext
3479 {|
3480 !
3481 foo
3482 !
3483 bar
3484 |-
3485 |
3486 baz
3487 {{!}}
3488 bam
3489 |}
3490 !! html/php
3491 <table>
3492 <tr>
3493 <th>
3494 <pre>foo
3495 </pre>
3496 </th>
3497 <th>
3498 <pre>bar
3499 </pre>
3500 </th></tr>
3501 <tr>
3502 <td>
3503 <pre>baz
3504 </pre>
3505 </td>
3506 <td>
3507 <pre>bam
3508 </pre>
3509 </td></tr></table>
3510
3511 !! html/parsoid
3512 <table>
3513 <tbody><tr><th>
3514 <pre>foo</pre>
3515 </th><th>
3516 <pre>bar</pre>
3517 </th></tr><tr>
3518 <td>
3519 <pre>baz</pre>
3520 </td><td data-parsoid='{"startTagSrc":"{{!}}"}'>
3521 <pre>bam</pre>
3522 </td></tr></tbody></table>
3523 !! end
3524
3525 !! test
3526 3a. Indent-Pre and block tags (single-line html)
3527 !! wikitext
3528 a <p> foo </p>
3529 b <div> foo </div>
3530 c <blockquote> foo </blockquote>
3531 <span> foo </span>
3532 !! html
3533 a <p> foo </p>
3534 b <div> foo </div>
3535 c <blockquote> foo </blockquote>
3536 <pre><span> foo </span>
3537 </pre>
3538 !! html/php+tidy
3539 <p> a </p><p> foo </p><p>
3540 b </p><div> foo </div><p>
3541 c </p><blockquote><p> foo </p></blockquote>
3542 <pre><span> foo </span>
3543 </pre>
3544 !! html/parsoid
3545 <p> a </p><p data-parsoid='{"stx":"html"}'> foo </p><p>
3546 b </p><div data-parsoid='{"stx":"html"}'> foo </div><p>
3547 c </p><blockquote data-parsoid='{"stx":"html"}'><p> foo </p></blockquote>
3548 <pre><span data-parsoid='{"stx":"html"}'> foo </span></pre>
3549 !! end
3550
3551 !! test
3552 3b. Indent-Pre and block tags (multi-line html)
3553 !! wikitext
3554 a <span>foo</span>
3555 <!-- comment --> b <div> foo </div>
3556 !! html/php
3557 <pre>a <span>foo</span>
3558 </pre>
3559 b <div> foo </div>
3560
3561 !! html/parsoid
3562 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3563 <!-- comment --> <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3564 !! html/php+tidy
3565 <pre>a <span>foo</span>
3566 </pre><p>
3567 b </p><div> foo </div>
3568 !! end
3569
3570 !!test
3571 3c. Indent-Pre and block tags (pre-content on separate line)
3572 !! wikitext
3573 <p>
3574 foo
3575 </p>
3576
3577 <div>
3578 foo
3579 </div>
3580
3581 <center>
3582 foo
3583 </center>
3584
3585 <blockquote>
3586 foo
3587 </blockquote>
3588
3589 <blockquote>
3590 <pre>
3591 foo
3592 </pre>
3593 </blockquote>
3594
3595 <table><tr><td>
3596 foo
3597 </td></tr></table>
3598
3599 <ul><li>
3600 foo
3601 </li></ul>
3602
3603 !! html
3604 <p>
3605 foo
3606 </p>
3607 <div>
3608 <pre>foo
3609 </pre>
3610 </div>
3611 <center>
3612 <pre>foo
3613 </pre>
3614 </center>
3615 <blockquote>
3616 <p> foo
3617 </p>
3618 </blockquote>
3619 <blockquote>
3620 <pre>
3621 foo
3622 </pre>
3623 </blockquote>
3624 <table><tr><td>
3625 <pre>foo
3626 </pre>
3627 </td></tr></table>
3628 <ul><li>
3629 foo
3630 </li></ul>
3631
3632 !!end
3633
3634 !! test
3635 4. Indent-Pre and extension tags
3636 !! options
3637 parsoid=wt2html,html2html
3638 !! wikitext
3639 a <tag />
3640 !! html/php+tidy
3641 <p> a </p><pre>NULL
3642 array (
3643 )
3644 </pre>
3645 !! html/parsoid
3646 <p> a </p><pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{}}'></pre>
3647 !! end
3648
3649 !! test
3650 5. Indent-Pre and html pre
3651 !! wikitext
3652 <pre class="123">hi</pre>
3653 !! html/php
3654 <pre class="123">hi</pre>
3655
3656 !! html/parsoid
3657 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3658 !! end
3659
3660 !!test
3661 Render paragraphs when indent-pre is suppressed in blocklevels
3662 !! wikitext
3663 <blockquote>
3664 foo
3665
3666 bar
3667 </blockquote>
3668 !! html
3669 <blockquote>
3670 <p> foo
3671 </p><p> bar
3672 </p>
3673 </blockquote>
3674
3675 !!end
3676
3677 !!test
3678 4. Multiple spaces at start-of-line
3679 !! wikitext
3680 <p> foo </p>
3681 foo
3682 {|
3683 |foo
3684 |}
3685 !! html
3686 <p> foo </p>
3687 <pre> foo
3688 </pre>
3689 <table>
3690 <tr>
3691 <td>foo
3692 </td></tr></table>
3693
3694 !!end
3695
3696 ## NOTE: the leading white-space chars on empty line are significant
3697 !! test
3698 5a. White-space in indent-pre
3699 !! wikitext
3700 a<br />
3701
3702 b
3703 !! html
3704 <pre>a<br />
3705
3706 b
3707 </pre>
3708 !! end
3709
3710 ## NOTE: the leading white-space chars on empty line are significant
3711 !! test
3712 5b. White-space in indent-pre
3713 !! wikitext
3714 a
3715
3716 b
3717
3718
3719 c
3720 !! html
3721 <pre>a
3722
3723 b
3724
3725
3726 c
3727 </pre>
3728 !! end
3729
3730 !! test
3731 5c. White-space in indent-pre
3732 !! wikitext
3733 ''a''
3734 ''b''
3735 ''c''
3736 !! html
3737 <pre><i>a</i>
3738 <i>b</i>
3739 <i>c</i>
3740 </pre>
3741 !! end
3742
3743 !! test
3744 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3745 !! wikitext
3746 a
3747
3748 <!-- continue -->
3749 b
3750
3751 c
3752
3753 d
3754 !! html
3755 <pre>a
3756
3757 b
3758 </pre>
3759 <pre>c
3760
3761 </pre>
3762 <p>d
3763 </p>
3764 !! end
3765
3766 !! test
3767 7a. Indent-pre and category links
3768 !! options
3769 parsoid=wt2html,wt2wt
3770 !! wikitext
3771 [[Category:foo]] <!-- No pre-wrapping -->
3772 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3773 !! html/php+tidy
3774 !! html/parsoid
3775 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3776 <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 -->
3777 !! end
3778
3779 ## We used to, but no longer wt2wt this test since the default serializer
3780 ## will normalize all categories to serialize on their own line.
3781 ## This wikitext usage is going to be fairly uncommon in production and
3782 ## selser will take care of preserving formatting in those scenarios.
3783 !! test
3784 7b. Indent-pre and category links
3785 !! options
3786 parsoid=wt2html
3787 !! wikitext
3788 [[Category:foo]] a
3789 [[Category:foo]] {{echo|b}}
3790 !! html/parsoid
3791 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3792 <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>
3793 !! end
3794
3795 !! test
3796 Indent-Pre: Newlines in comments shouldn't affect sol state
3797 !! wikitext
3798 a <!--
3799 foo
3800 --> b
3801 !! html/php+tidy
3802 <p>a b
3803 </p>
3804 !! html/parsoid
3805 <p>a <!--
3806 foo
3807 --> b</p>
3808 !! end
3809
3810 ###
3811 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3812 ###
3813
3814 !!test
3815 HTML-pre: 1. embedded newlines
3816 !! wikitext
3817 <pre>foo</pre>
3818
3819 <pre>
3820 foo
3821 </pre>
3822
3823 <pre>
3824
3825 foo
3826 </pre>
3827
3828 <pre>
3829
3830
3831 foo
3832 </pre>
3833 !! html/php+tidy
3834 <pre>foo</pre>
3835 <pre>foo
3836 </pre>
3837 <pre>
3838
3839 foo
3840 </pre>
3841 <pre>
3842
3843
3844 foo
3845 </pre>
3846 !! html/parsoid
3847 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3848
3849 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3850 </pre>
3851
3852 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3853
3854 foo
3855 </pre>
3856
3857 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3858
3859
3860 foo
3861 </pre>
3862 !!end
3863
3864 !! test
3865 HTML-pre: big spaces
3866 !! wikitext
3867 <pre>
3868
3869
3870
3871
3872 haha
3873
3874
3875
3876
3877 haha
3878
3879
3880
3881
3882 </pre>
3883 !! html/php+tidy
3884 <pre>
3885
3886
3887
3888
3889 haha
3890
3891
3892
3893
3894 haha
3895
3896
3897
3898
3899 </pre>
3900 !! html/parsoid
3901 <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"}}'>
3902
3903
3904
3905
3906 haha
3907
3908
3909
3910
3911 haha
3912
3913
3914
3915
3916 </pre>
3917 !! end
3918
3919 !!test
3920 HTML-pre: 2: indented text
3921 !! wikitext
3922 <pre>
3923 foo
3924 </pre>
3925 !! html
3926 <pre>
3927 foo
3928 </pre>
3929
3930 !!end
3931
3932 !!test
3933 HTML-pre: 3: other wikitext
3934 !! wikitext
3935 <pre>
3936 * foo
3937 # bar
3938 = no-h =
3939 '' no-italic ''
3940 [[ NoLink ]]
3941 </pre>
3942 !! html/php
3943 <pre>
3944 * foo
3945 # bar
3946 = no-h =
3947 '' no-italic ''
3948 [[ NoLink ]]
3949 </pre>
3950
3951 !! html/parsoid
3952 <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
3953 # bar
3954 = no-h =
3955 '' no-italic ''
3956 [[ NoLink ]]
3957 </pre>
3958 !!end
3959
3960 ###
3961 ### Definition lists
3962 ###
3963 !! test
3964 Simple definition
3965 !! wikitext
3966 ;name :Definition
3967 !! html
3968 <dl><dt>name</dt>
3969 <dd>Definition</dd></dl>
3970
3971 !! end
3972
3973 !! test
3974 Definition list for indentation only
3975 !! wikitext
3976 :Indented text
3977 !! html
3978 <dl><dd>Indented text</dd></dl>
3979
3980 !! end
3981
3982 !! test
3983 Definition list with no space
3984 !! wikitext
3985 ;name:Definition
3986 !! html
3987 <dl><dt>name</dt>
3988 <dd>Definition</dd></dl>
3989
3990 !!end
3991
3992 !! test
3993 Definition list with URL link
3994 !! wikitext
3995 ;http://example.com/ :definition
3996 !! html
3997 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a></dt>
3998 <dd>definition</dd></dl>
3999
4000 !! end
4001
4002 !! test
4003 Definition list with bracketed URL link
4004 !! wikitext
4005 ;[http://www.example.com/ Example]:Something about it
4006 !! html
4007 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
4008 <dd>Something about it</dd></dl>
4009
4010 !! end
4011
4012 !! test
4013 Definition list with wikilink containing colon
4014 !! wikitext
4015 ;[[Help:FAQ]]:The least-read page on Wikipedia
4016 !! html
4017 <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>
4018 <dd>The least-read page on Wikipedia</dd></dl>
4019
4020 !! end
4021
4022 # At Brion's and JeLuF's insistence... :)
4023 !! test
4024 Definition list with news link containing colon
4025 !! wikitext
4026 ;news:alt.wikipedia.rox :This isn't even a real newsgroup!
4027 !! html/php
4028 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
4029 <dd>This isn't even a real newsgroup!</dd></dl>
4030
4031 !! html/parsoid
4032 <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>
4033 !! end
4034
4035 !! test
4036 Malformed definition list with colon
4037 !! wikitext
4038 ;news:alt.wikipedia.rox -- don't crash or enter an infinite loop
4039 !! html
4040 <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>
4041
4042 !! end
4043
4044 !! test
4045 Definition lists: colon in external link text
4046 !! wikitext
4047 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
4048 !! html
4049 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia :The Next Generation</a></dt>
4050 <dd>OK, I made that up</dd></dl>
4051
4052 !! end
4053
4054 !! test
4055 Definition lists: colon in HTML attribute
4056 !! wikitext
4057 ;<b style="display: inline">bold</b>
4058 !! html
4059 <dl><dt><b style="display: inline">bold</b></dt></dl>
4060
4061 !! end
4062
4063 !! test
4064 Definition lists: self-closed tag
4065 !! wikitext
4066 ;one<br/>two :two-line fun
4067 !! html
4068 <dl><dt>one<br />two</dt>
4069 <dd>two-line fun</dd></dl>
4070
4071 !! end
4072
4073 !! test
4074 Definition lists: ignore colons inside tags
4075 !! wikitext
4076 ;one <b>two : tag <i>fun:</i>:</b>:def
4077 !! html
4078 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
4079 <dd>def</dd></dl>
4080
4081 !! end
4082
4083 !! test
4084 Definition lists: excess closed tags
4085 !! wikitext
4086 ;one</b>two :bad tag fun
4087 !! html/php+tidy
4088 <dl><dt>onetwo</dt>
4089 <dd>bad tag fun</dd></dl>
4090 !! html/parsoid
4091 <dl>
4092 <dt>onetwo</dt>
4093 <dd>bad tag fun</dd>
4094 </dl>
4095 !! end
4096
4097 !! test
4098 T13748: Literal closing tags
4099 !! wikitext
4100 <dl>
4101 <dt>test 1</dt>
4102 <dd>test test test test test</dd>
4103 <dt>test 2</dt>
4104 <dd>test test test test test</dd>
4105 </dl>
4106 !! html
4107 <dl>
4108 <dt>test 1</dt>
4109 <dd>test test test test test</dd>
4110 <dt>test 2</dt>
4111 <dd>test test test test test</dd>
4112 </dl>
4113
4114 !! end
4115
4116 !! test
4117 Definition and unordered list using wiki syntax nested in unordered list using html tags.
4118 !! wikitext
4119 <ul><li>
4120 ;term :description
4121 *unordered
4122 </li></ul>
4123 !! html
4124 <ul><li>
4125 <dl><dt>term</dt>
4126 <dd>description</dd></dl>
4127 <ul><li>unordered</li></ul>
4128 </li></ul>
4129
4130 !! end
4131
4132 !! test
4133 Definition list with empty definition and following paragraph
4134 !! wikitext
4135 ;term:
4136
4137 Paragraph text
4138 !! html
4139 <dl><dt>term</dt>
4140 <dd></dd></dl>
4141 <p>Paragraph text
4142 </p>
4143 !! end
4144
4145 !! test
4146 Nested definition lists using html syntax
4147 !! wikitext
4148 <dl><dt>x</dt>
4149 <dd>a</dd>
4150 <dd>b</dd></dl>
4151 !! html
4152 <dl><dt>x</dt>
4153 <dd>a</dd>
4154 <dd>b</dd></dl>
4155
4156 !! end
4157
4158 !! test
4159 Definition Lists: No nesting: Multiple dd's
4160 !! wikitext
4161 ;x
4162 :a
4163 :b
4164 !! html
4165 <dl><dt>x</dt>
4166 <dd>a</dd>
4167 <dd>b</dd></dl>
4168
4169 !! end
4170
4171 !! test
4172 Definition Lists: Indentation: Regular
4173 !! wikitext
4174 :i1
4175 ::i2
4176 :::i3
4177 !! html
4178 <dl><dd>i1
4179 <dl><dd>i2
4180 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4181
4182 !! end
4183
4184 !! test
4185 Definition Lists: Indentation: Missing 1st level
4186 !! wikitext
4187 ::i2
4188 :::i3
4189 !! html
4190 <dl><dd><dl><dd>i2
4191 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4192
4193 !! end
4194
4195 !! test
4196 Definition Lists: Indentation: Multi-level indent
4197 !! wikitext
4198 :::i3
4199 !! html
4200 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
4201
4202 !! end
4203
4204 !! test
4205 Definition Lists: Hacky use to indent tables
4206 !! wikitext
4207 ::{|
4208 |foo
4209 |bar
4210 |}
4211 this text
4212 should be left alone
4213 !! html
4214 <dl><dd><dl><dd><table>
4215 <tr>
4216 <td>foo
4217 </td>
4218 <td>bar
4219 </td></tr></table></dd></dl></dd></dl>
4220 <p>this text
4221 should be left alone
4222 </p>
4223 !! end
4224
4225 !! test
4226 Definition Lists: Hacky use to indent tables (with content following table)
4227 !! wikitext
4228 :{|
4229 |foo
4230 |bar
4231 |} <!--c1--> this text should be part of the dl
4232 !! html/php+tidy
4233 <dl><dd><table>
4234 <tbody><tr>
4235 <td>foo
4236 </td>
4237 <td>bar
4238 </td></tr></tbody></table> this text should be part of the dl</dd></dl>
4239 !! html/parsoid
4240 <dl><dd><table>
4241 <tbody><tr>
4242 <td>foo
4243 </td>
4244 <td>bar
4245 </td></tr></tbody></table> <!--c1--> this text should be part of the dl</dd></dl>
4246 !! end
4247
4248 !! test
4249 Definition Lists: Hacky use to indent tables, with comments (T65979)
4250 !! wikitext
4251 <!-- foo -->
4252 ::{|
4253 |foo
4254 |bar
4255 |}<!-- bar -->
4256 this text
4257 should be left alone
4258 !! html/parsoid
4259 <!-- foo -->
4260 <dl><dd><dl><dd><table><tr>
4261 <td>foo</td>
4262 <td>bar</td>
4263 </tr></table><!-- bar --></dd></dl></dd></dl>
4264 <p>this text
4265 should be left alone</p>
4266 !! end
4267
4268 !! test
4269 Definition Lists: Hacky use to indent tables, with comment before table
4270 !!options
4271 parsoid=wt2html
4272 !! wikitext
4273 ::<!-- foo -->{|
4274 |foo
4275 |}
4276 !! html/parsoid
4277 <dl><dd><dl><dd><!-- foo --><table><tr>
4278 <td>foo</td>
4279 </tr></table></dd></dl></dd></dl>
4280 !! end
4281
4282 # The trailing whitespace in this test is to catch a regression in
4283 # Parsoid after T54473.
4284 !! test
4285 Definition Lists: Hacky use to indent tables (WS-insensitive)
4286 !! wikitext
4287 :{|
4288 |a
4289 |}
4290 !! html/php
4291 <dl><dd><table>
4292 <tr>
4293 <td>a
4294 </td></tr></table></dd></dl>
4295
4296 !! html/parsoid
4297 <dl><dd><table>
4298 <tbody><tr><td>a</td></tr>
4299 </tbody></table></dd></dl>
4300 !! end
4301
4302 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4303 ## as an empty dt item. It also ignores all but the last ";" when followed
4304 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4305 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4306 ## ";"s.
4307 ##
4308 ## Ex: ";;t2 ::d2" is transformed into:
4309 ##
4310 ## <dl>
4311 ## <dt>t2 </dt>
4312 ## <dd>
4313 ## <dl>
4314 ## <dt></dt>
4315 ## <dd>d2</dd>
4316 ## </dl>
4317 ## </dd>
4318 ## </dl>
4319 ##
4320 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4321 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4322 ##
4323 ## <dl>
4324 ## <dt>
4325 ## <dl>
4326 ## <dt>t2 </dt>
4327 ## <dd>:d2</dd>
4328 ## </dl>
4329 ## </dt>
4330 ## </dl>
4331 ##
4332 ## All Parsoid only definition list tests have this difference.
4333 ##
4334 ## See also: https://phabricator.wikimedia.org/T8569
4335 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4336
4337 !! test
4338 Table / list interaction: indented table with lists in table contents
4339 !! wikitext
4340 :{|
4341 |-
4342 |a
4343
4344 *b
4345 |-
4346 |c
4347
4348 *d
4349 |}
4350 !! html
4351 <dl><dd><table>
4352
4353 <tr>
4354 <td>a
4355 <ul><li>b</li></ul>
4356 </td></tr>
4357 <tr>
4358 <td>c
4359 <ul><li>d</li></ul>
4360 </td></tr></table></dd></dl>
4361
4362 !! end
4363
4364 !!test
4365 Table / list interaction: lists nested in tables nested in indented lists
4366 !! wikitext
4367 :{|
4368 |
4369 :a
4370 :b
4371 |
4372 *c
4373 *d
4374 |}
4375
4376 *e
4377 *f
4378 !! html
4379 <dl><dd><table>
4380 <tr>
4381 <td>
4382 <dl><dd>a</dd>
4383 <dd>b</dd></dl>
4384 </td>
4385 <td>
4386 <ul><li>c</li>
4387 <li>d</li></ul>
4388 </td></tr></table></dd></dl>
4389 <ul><li>e</li>
4390 <li>f</li></ul>
4391
4392 !!end
4393
4394 !! test
4395 Definition Lists: Nesting: Multi-level (Parsoid only)
4396 !! wikitext
4397 ;t1 :d1
4398 ;;t2 ::d2
4399 ;;;t3 :::d3
4400 !! html/parsoid
4401 <dl>
4402 <dt>t1 </dt>
4403 <dd>d1</dd>
4404 <dt>
4405 <dl>
4406 <dt>t2 </dt>
4407 <dd>:d2</dd>
4408 <dt>
4409 <dl>
4410 <dt>t3 </dt>
4411 <dd>::d3</dd>
4412 </dl>
4413 </dt>
4414 </dl>
4415 </dt>
4416 </dl>
4417
4418
4419 !! end
4420
4421
4422 !! test
4423 Definition Lists: Nesting: Test 2
4424 !! wikitext
4425 ;t1
4426 ::d2
4427 !! html+tidy
4428 <dl><dt>t1</dt>
4429 <dd>
4430 <dl><dd>d2</dd></dl></dd></dl>
4431 !! end
4432
4433
4434 !! test
4435 Definition Lists: Nesting: Test 3
4436 !! wikitext
4437 :;t1
4438 ::::d2
4439 !! html+tidy
4440 <dl><dd><dl><dt>t1</dt>
4441 <dd>
4442 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4443 !! end
4444
4445
4446 !! test
4447 Definition Lists: Nesting: Test 4
4448 !! wikitext
4449 ::;t3
4450 :::d3
4451 !! html
4452 <dl><dd><dl><dd><dl><dt>t3</dt>
4453 <dd>d3</dd></dl></dd></dl></dd></dl>
4454
4455 !! end
4456
4457
4458 ## The Parsoid team believes the following three test exposes a
4459 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4460 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4461 ## It also exposes a "misfeature" in tidy, which doesn't like
4462 ## <dl> tags with a single <dt> child; it converts the <dt> into
4463 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4464 !! test
4465 Definition Lists: Mixed Lists: Test 1
4466 !! wikitext
4467 :;*foo
4468 ::*bar
4469 :;baz
4470 !! html/php
4471 <dl><dd><dl><dt><ul><li>foo</li>
4472 <li>bar</li></ul></dt></dl>
4473 <dl><dt>baz</dt></dl></dd></dl>
4474
4475 !! html/php+tidy
4476 <dl><dd><dl><dt><ul><li>foo</li>
4477 <li>bar</li></ul></dt></dl>
4478 <dl><dt>baz</dt></dl></dd></dl>
4479 !! html/parsoid
4480 <dl>
4481 <dd><dl>
4482 <dt><ul>
4483 <li>foo
4484 </li>
4485 </ul></dt>
4486 <dd><ul>
4487 <li>bar
4488 </li>
4489 </ul></dd>
4490 <dt>baz</dt>
4491 </dl></dd>
4492 </dl>
4493 !! end
4494
4495 !! test
4496 Definition Lists: Mixed Lists: Test 2
4497 !! wikitext
4498 *:d1
4499 *:d2
4500 !! html
4501 <ul><li><dl><dd>d1</dd>
4502 <dd>d2</dd></dl></li></ul>
4503
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
4516 !! end
4517
4518
4519 !! test
4520 Definition Lists: Mixed Lists: Test 4
4521 !! wikitext
4522 *;d1 :d2
4523 *;d3 :d4
4524 !! html
4525 <ul><li><dl><dt>d1</dt>
4526 <dd>d2</dd>
4527 <dt>d3</dt>
4528 <dd>d4</dd></dl></li></ul>
4529
4530 !! end
4531
4532
4533 !! test
4534 Definition Lists: Mixed Lists: Test 5
4535 !! wikitext
4536 *:d1
4537 *::d2
4538 !! html
4539 <ul><li><dl><dd>d1
4540 <dl><dd>d2</dd></dl></dd></dl></li></ul>
4541
4542 !! end
4543
4544
4545 !! test
4546 Definition Lists: Mixed Lists: Test 6
4547 !! wikitext
4548 #*:d1
4549 #*:::d3
4550 !! html
4551 <ol><li><ul><li><dl><dd>d1
4552 <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4553
4554 !! end
4555
4556
4557 !! test
4558 Definition Lists: Mixed Lists: Test 7
4559 !! wikitext
4560 :*d1
4561 :*d2
4562 !! html
4563 <dl><dd><ul><li>d1</li>
4564 <li>d2</li></ul></dd></dl>
4565
4566 !! end
4567
4568
4569 !! test
4570 Definition Lists: Mixed Lists: Test 8
4571 !! wikitext
4572 :*d1
4573 ::*d2
4574 !! html
4575 <dl><dd><ul><li>d1</li></ul>
4576 <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
4577
4578 !! end
4579
4580
4581 !! test
4582 Definition Lists: Mixed Lists: Test 9
4583 !! wikitext
4584 *;foo :bar
4585 !! html
4586 <ul><li><dl><dt>foo</dt>
4587 <dd>bar</dd></dl></li></ul>
4588
4589 !! end
4590
4591
4592 !! test
4593 Definition Lists: Mixed Lists: Test 10
4594 !! wikitext
4595 *#;foo :bar
4596 !! html
4597 <ul><li><ol><li><dl><dt>foo</dt>
4598 <dd>bar</dd></dl></li></ol></li></ul>
4599
4600 !! end
4601
4602 # The Parsoid team disagrees with the PHP parser's seemingly-random
4603 # rules regarding dd/dt on the next few tests. Parsoid is more
4604 # consistent, and recognizes the shared nesting and keeps the
4605 # still-open tags around until the nesting is complete.
4606
4607 # This is a regression test for T175099
4608 !! test
4609 Definition Lists: Mixed Lists: Test 11
4610 !! wikitext
4611 ;a
4612 :*b
4613 !! html/php
4614 <dl><dt>a</dt>
4615 <dd>
4616 <ul><li>b</li></ul></dd></dl>
4617
4618 !! html/parsoid
4619 <dl><dt>a
4620 <dd><ul><li>b</li></ul></dd></dl>
4621 !! end
4622
4623 # FIXME: Maybe get rid of this test?
4624 !! test
4625 Definition Lists: Mixed Lists: Test 12
4626 !! wikitext
4627 *#*#;*;;foo :bar
4628 *#*#;boo :baz
4629 !! html/php
4630 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4631 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4632 <dl><dt>boo</dt>
4633 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4634
4635 !! html/php+tidy
4636 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4637 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4638 <dl><dt>boo</dt>
4639 <dd>baz</dd></dl></li></ol></li></ul>
4640 !! html/parsoid
4641 <ul>
4642 <li>
4643 <ol>
4644 <li>
4645 <ul>
4646 <li>
4647 <ol>
4648 <li>
4649 <dl>
4650 <dt>
4651 <ul>
4652 <li>
4653 <dl>
4654 <dt>
4655 <dl>
4656 <dt>foo</dt>
4657 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4658 </dl></dt>
4659 </dl></li>
4660 </ul></dt>
4661 <dt>boo</dt>
4662 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4663 </dl></li>
4664 </ol></li>
4665 </ul></li>
4666 </ol></li>
4667 </ul>
4668 !! end
4669
4670 !! test
4671 Definition Lists: Mixed Lists: Test 13
4672 !! wikitext
4673 *#*#;*;;foo : bar
4674 *#*#;boo : baz
4675 !! html+tidy
4676 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4677 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4678 <dl><dt>boo&#160;</dt>
4679 <dd>baz</dd></dl></li></ol></li></ul>
4680 !! end
4681
4682 # FIXME: Maybe get rid of this test?
4683 # From whitelist:
4684 # * The test is wrong, there are two colons where there should be :;
4685 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4686 !! test
4687 Definition Lists: Weird Ones: Test 1
4688 !! wikitext
4689 *#;*::;;foo :bar (who uses this?)
4690 !! html/php+tidy
4691 <ul><li><ol><li><dl><dt>foo</dt>
4692 <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>
4693 !! html/parsoid
4694 <ul>
4695 <li>
4696 <ol>
4697 <li>
4698 <dl>
4699 <dt>
4700 <ul>
4701 <li>
4702 <dl>
4703 <dd>
4704 <dl>
4705 <dd>
4706 <dl>
4707 <dt>
4708 <dl>
4709 <dt>foo</dt>
4710 <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
4711 </dl></dt>
4712 </dl></dd>
4713 </dl></dd>
4714 </dl></li>
4715 </ul></dt>
4716 </dl></li>
4717 </ol></li>
4718 </ul>
4719 !! end
4720
4721 !! test
4722 Definition Lists: colons occurring in tags
4723 !! wikitext
4724 ;a:b
4725 ;'''a:b'''
4726 ;<i>a:b</i>
4727 ;<span>a:b</span>
4728 ;<div>a:b</div>
4729 ;<div>a
4730 :b</div>
4731 ;{{echo|a:b}}
4732 ;{{echo|''a:b''}}
4733 ;;;''a:b''
4734 !! html+tidy
4735 <dl><dt>a</dt>
4736 <dd>b</dd>
4737 <dt><b>a:b</b></dt>
4738 <dt><i>a:b</i></dt>
4739 <dt><span>a:b</span></dt>
4740 <dt><div>a:b</div></dt>
4741 <dt><div>a</div></dt>
4742 <dd>b</dd>
4743 <dt>a</dt>
4744 <dd>b</dd>
4745 <dt><i>a:b</i></dt></dl>
4746 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4747 !! html/parsoid
4748 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4749 <dt><b>a:b</b></dt>
4750 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4751 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4752 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4753 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4754 <dd>b</dd>
4755 <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>
4756 <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>
4757 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4758 !! end
4759
4760 # Parsoid's output differs here again because it shares
4761 # nesting between the two lists unlike the PHP parser.
4762 # Unsure which is more desirable.
4763 !! test
4764 Definition Lists: colons and tables 1
4765 !! wikitext
4766 :{|
4767 |x
4768 |}
4769 :{|
4770 |y
4771 |}
4772 !! html/php
4773 <dl><dd><table>
4774 <tr>
4775 <td>x
4776 </td></tr></table></dd></dl>
4777 <dl><dd><table>
4778 <tr>
4779 <td>y
4780 </td></tr></table></dd></dl>
4781
4782 !! html/parsoid
4783 <dl><dd><table>
4784 <tr>
4785 <td>x
4786 </td></tr></table></dd>
4787 <dd><table>
4788 <tr>
4789 <td>y
4790 </td></tr></table></dd></dl>
4791 !! end
4792
4793 # FIXME: Does this need a html/php section?
4794 !! test
4795 Definition Lists: template interaction
4796 !! wikitext
4797 ::{{definition_list}}
4798
4799 :one
4800 ::{{definition_list}}
4801 :::two
4802 :::three
4803 ::four
4804 !! html/parsoid
4805 <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">
4806 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4807
4808 <dl><dd data-parsoid='{}'>one
4809 <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">
4810 </span><dd about="#mwt2">two
4811 <dl><dd>two</dd>
4812 <dd>three</dd></dl></dd>
4813 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4814 !! end
4815
4816
4817 ###
4818 ### External links
4819 ###
4820 !! test
4821 External links: non-bracketed
4822 !! wikitext
4823 Non-bracketed: http://example.com
4824 !! html
4825 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4826 </p>
4827 !! end
4828
4829 # parsoid doesn't explicitly mark autonumbered links, see T55505
4830 !! test
4831 External links: numbered
4832 !! wikitext
4833 Numbered: [http://example.com]
4834 Numbered: [http://example.net]
4835 Numbered: [http://example.com]
4836 !! html/php
4837 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4838 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4839 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4840 </p>
4841 !! html/parsoid
4842 <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
4843 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4844 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
4845 !!end
4846
4847 !! test
4848 External links: specified text
4849 !! wikitext
4850 Specified text: [http://example.com link]
4851 !! html
4852 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4853 </p>
4854 !!end
4855
4856 !! test
4857 External links: trail
4858 !! wikitext
4859 Linktrails should not work for external links: [http://example.com link]s
4860 !! html
4861 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4862 </p>
4863 !! end
4864
4865 !! test
4866 External links: dollar sign in URL
4867 !! wikitext
4868 http://example.com/1$2345
4869 !! html
4870 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4871 </p>
4872 !! end
4873
4874 # parsoid doesn't explicitly mark autonumbered links, see T55505
4875 !! test
4876 External links: dollar sign in URL (autonumber)
4877 !! wikitext
4878 [http://example.com/1$2345]
4879 !! html/php
4880 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4881 </p>
4882 !! html/parsoid
4883 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
4884 !!end
4885
4886 !! test
4887 External links: open square bracket forbidden in URL (T6377)
4888 !! options
4889 parsoid=wt2html,wt2wt,html2html
4890 !! wikitext
4891 http://example.com/1[2345
4892 !! html/php
4893 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4894 </p>
4895 !! html/parsoid
4896 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
4897 !! end
4898
4899 !! test
4900 External links: open square bracket forbidden in URL (named) (T6377)
4901 !! options
4902 parsoid=wt2html,html2html
4903 !! wikitext
4904 [http://example.com/1[2345]
4905 !! html/php
4906 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4907 </p>
4908 !! html/parsoid
4909 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
4910 !!end
4911
4912 # parsoid adds a space before the link name
4913 !! test
4914 External links: open square bracket forbidden in URL (named) (T6377)
4915 Parsoid variant.
4916 !! wikitext
4917 [http://example.com/1 [2345]
4918 !! html
4919 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4920 </p>
4921 !!end
4922
4923 !! test
4924 External links: nowiki in URL link text (T8230)
4925 !! wikitext
4926 [http://example.com/ <nowiki>''example site''</nowiki>]
4927 !! html
4928 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4929 </p>
4930 !! end
4931
4932 !! test
4933 External links: newline forbidden in text (T8230 regression check)
4934 !! wikitext
4935 [http://example.com/ first
4936 second]
4937 !! html
4938 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4939 second]
4940 </p>
4941 !!end
4942
4943 !! test
4944 External links: Pipe char between url and text
4945 !! wikitext
4946 [http://example.com | link]
4947 !! html
4948 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4949 </p>
4950 !!end
4951
4952 !! test
4953 External links: protocol-relative URL in brackets
4954 !! wikitext
4955 [//example.com/ Test]
4956 !! html
4957 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4958 </p>
4959 !! end
4960
4961 # parsoid doesn't explicitly mark autonumbered links, see T55505
4962 !! test
4963 External links: protocol-relative URL in brackets without text
4964 !! wikitext
4965 [//example.com]
4966 !! html/php
4967 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4968 </p>
4969 !! html/parsoid
4970 <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
4971 !! end
4972
4973 !! test
4974 External links: protocol-relative URL in free text is left alone
4975 !! wikitext
4976 //example.com/Foo
4977 !! html
4978 <p>//example.com/Foo
4979 </p>
4980 !!end
4981
4982 !! test
4983 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4984 !! wikitext
4985 foo//example.com/Foo
4986 !! html
4987 <p>foo//example.com/Foo
4988 </p>
4989 !! end
4990
4991 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
4992 !! test
4993 External links: with no contents
4994 !! options
4995 parsoid=wt2html,wt2wt
4996 !! wikitext
4997 [http://en.wikipedia.org/wiki/Foo]
4998
4999 [[wikipedia:Foo|Bar]]
5000
5001 [[wikipedia:Foo|<span>Bar</span>]]
5002 !! html/php
5003 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
5004 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
5005 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
5006 </p>
5007 !! html/parsoid
5008 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
5009 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
5010 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
5011 !! end
5012
5013 !! test
5014 External links: Free with trailing punctuation
5015 !! wikitext
5016 http://example.com,
5017 http://example.com;
5018 http://example.com\
5019 http://example.com.
5020 http://example.com:
5021 http://example.com!
5022 http://example.com?
5023 http://example.com)
5024 http://example.com/url_with_(brackets)
5025 (http://example.com/url_without_brackets)
5026 http://example.com/url_with_entity&amp;
5027 http://example.com/url_with_entity&#x26;
5028 http://example.com/url_with_entity&#038;
5029 http://example.com/url_with_entity&nbsp;
5030 http://example.com/url_with_entity&#xA0;
5031 http://example.com/url_with_entity&#160;
5032 http://example.com/url_with_entity&lt;
5033 http://example.com/url_with_entity&#x3C;
5034 http://example.com/url_with_entity&#60;
5035 !! html/php
5036 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
5037 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
5038 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
5039 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
5040 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
5041 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
5042 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
5043 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5044 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5045 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5046 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5047 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5048 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5049 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5050 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
5051 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5052 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
5053 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
5054 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
5055 </p>
5056 !! html/parsoid
5057 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
5058 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
5059 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
5060 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
5061 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
5062 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
5063 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
5064 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
5065 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5066 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5067 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5068 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5069 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5070 <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>
5071 <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>
5072 <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>
5073 <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>
5074 <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>
5075 <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>
5076 !! end
5077
5078 !! test
5079 External links: tricky Parsoid html2html case
5080 !! options
5081 parsoid=wt2html,wt2wt,html2html
5082 !! wikitext
5083 http://example.com/url_with_entity&amp;amp;
5084 !! html/php
5085 <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>;
5086 </p>
5087 !! html/parsoid
5088 <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>
5089 !! end
5090
5091 !! test
5092 External links: Free with trailing quotes (T113666)
5093 !! wikitext
5094 '''News:''' Stuff here
5095
5096 news:'a'b''c''d e
5097 !! html/php
5098 <p><b>News:</b> Stuff here
5099 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
5100 </p>
5101 !! html/parsoid
5102 <p><b>News:</b> Stuff here</p>
5103 <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
5104 !! end
5105
5106 !! test
5107 External links: with entity
5108 !! wikitext
5109 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
5110 !! html/php
5111 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
5112 </p>
5113 !! html/parsoid
5114 <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>
5115 !! end
5116
5117 !! test
5118 External links: Lone protocols are never linked (T105697)
5119 !! wikitext
5120 http://
5121 http://;
5122 (http://)
5123 bitcoin:
5124 bitcoin:;
5125 (bitcoin:)
5126 !! html
5127 <p>http://
5128 http://;
5129 (http://)
5130 bitcoin:
5131 bitcoin:;
5132 (bitcoin:)
5133 </p>
5134 !! end
5135
5136 !! test
5137 External links: No preceding word characters allowed (T67278)
5138 !! wikitext
5139 NOPEhttp://example.com
5140 N0http://example.com
5141 ok:http://example.com
5142 ok-http://example.com
5143 !! html
5144 <p>NOPEhttp://example.com
5145 N0http://example.com
5146 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5147 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5148 </p>
5149 !! end
5150
5151 !! test
5152 External links: nofollow domain exception
5153 !! wikitext
5154 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
5155 !! html
5156 <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>.
5157 </p>
5158 !!end
5159
5160 !! test
5161 External image
5162 !! wikitext
5163 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5164 !! html
5165 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5166 </p>
5167 !! end
5168
5169 !! test
5170 External image from https
5171 !! wikitext
5172 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5173 !! html
5174 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5175 </p>
5176 !! end
5177
5178 !! test
5179 External image (when not allowed)
5180 !! options
5181 wgAllowExternalImages=0
5182 !! wikitext
5183 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5184 !! html
5185 <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>
5186 </p>
5187 !! end
5188
5189 !! test
5190 Link to non-http image, no img tag
5191 !! wikitext
5192 Link to non-http image, no img tag: ftp://example.com/test.jpg
5193 !! html
5194 <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>
5195 </p>
5196 !! end
5197
5198 !! test
5199 External links: terminating separator
5200 !! wikitext
5201 Terminating separator: http://example.com/thing,
5202 !! html
5203 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
5204 </p>
5205 !! end
5206
5207 !! test
5208 External links: intervening separator
5209 !! wikitext
5210 Intervening separator: http://example.com/1,2,3
5211 !! html
5212 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
5213 </p>
5214 !! end
5215
5216 !! test
5217 External links: old bug with URL in query
5218 !! wikitext
5219 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
5220 !! html
5221 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
5222 </p>
5223 !! end
5224
5225 !! test
5226 External links: old URL-in-URL bug, mixed protocols
5227 !! wikitext
5228 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
5229 !! html
5230 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
5231 </p>
5232 !!end
5233
5234 # Since Parsoid is starting to emit canonical wikitext for links,
5235 # [http://example.com http://example.com] will not RT back to that
5236 # form anymore.
5237 !! test
5238 External links: URL in text
5239 !! options
5240 parsoid=wt2html
5241 !! wikitext
5242 URL in text: [http://example.com http://example.com]
5243 !! html/php
5244 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
5245 </p>
5246 !! html/parsoid
5247 <p>URL in text: <a rel="mw:ExtLink" class="external text" href="http://example.com">http://example.com</a></p>
5248 !! end
5249
5250 !! test
5251 External links: Clickable images
5252 !! wikitext
5253 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5254 !! html/php
5255 <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>
5256 </p>
5257 !! html/parsoid
5258 <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>
5259 !! end
5260
5261 !! test
5262 External links: raw ampersand
5263 !! wikitext
5264 Old &amp; use: http://x&y
5265 !! html
5266 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5267 </p>
5268 !! end
5269
5270 !! test
5271 External links: encoded ampersand
5272 !! wikitext
5273 Old &amp; use: http://x&amp;y
5274 !! html/php
5275 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5276 </p>
5277 !! html/parsoid
5278 <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>
5279 !! end
5280
5281 !! test
5282 External links: encoded equals (T8102)
5283 !! wikitext
5284 http://example.com/?foo&#61;bar
5285 !! html/php
5286 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5287 </p>
5288 !! html/parsoid
5289 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5290 !! end
5291
5292 ##
5293 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5294 ## does it number them. As discussed in T55505, we can identify
5295 ## autonumbered links via CSS.
5296 ##
5297
5298 !! test
5299 External links: [raw ampersand]
5300 !! wikitext
5301 Old &amp; use: [http://x&y]
5302 !! html/php
5303 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5304 </p>
5305 !! html/parsoid
5306 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5307 !! end
5308
5309 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5310 # mode will return the [raw ampersand] wikitext
5311 !! test
5312 External links: [encoded ampersand]
5313 !! options
5314 parsoid=wt2html,wt2wt,html2html
5315 !! wikitext
5316 Old &amp; use: [http://x&amp;y]
5317 !! html/php
5318 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5319 </p>
5320 !! html/parsoid
5321 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5322 !! end
5323
5324 !! test
5325 External links: [raw equals]
5326 !! wikitext
5327 [http://example.com/?foo=bar]
5328 !! html/php
5329 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5330 </p>
5331 !! html/parsoid
5332 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5333 !! end
5334
5335 # note that parsoid html is identical to [raw equals] case; so html2wt
5336 # mode will return the [raw equals] wikitext
5337 !! test
5338 External links: [encoded equals] (T8102)
5339 !! options
5340 parsoid=wt2html,wt2wt,html2html
5341 !! wikitext
5342 [http://example.com/?foo&#61;bar]
5343 !! html/php
5344 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5345 </p>
5346 !! html/parsoid
5347 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5348 !! end
5349
5350 # xxx parsoid strips the IDN character, so the round-trip tests will
5351 # obviously fail and are disabled. --cscott
5352 !! test
5353 External links: [IDN ignored character reference in hostname; strip it right off]
5354 !! options
5355 parsoid=wt2html,wt2wt,html2html
5356 !! wikitext
5357 [http://e&zwnj;xample.com/]
5358 !! html/php
5359 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5360 </p>
5361 !! html/parsoid
5362 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
5363 !! end
5364
5365 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5366 # Where an external link could easily circumvent the sanitization of the text of
5367 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5368 # test demands a higher standard. That's a bit strange.
5369 #
5370 # Example:
5371 #
5372 # http://e‌xample.com -> [http://example.com|http://example.com]
5373 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5374 #
5375 # The first example is sanitized, but the second is not. Any security benefits
5376 # from this production are trivial to circumvent. Either remove this test and
5377 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5378 # the test accordingly.
5379 #
5380 # All our love,
5381 # The Parsoid team.
5382 # xxx parsoid strips the IDN character, so the round-trip tests will
5383 # obviously fail and are disabled. --cscott
5384 !! test
5385 External links: IDN ignored character reference in hostname; strip it right off
5386 !! options
5387 parsoid=wt2html,html2html
5388 !! wikitext
5389 http://e&zwnj;xample.com/
5390 !! html/php
5391 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5392 </p>
5393 !! html/parsoid
5394 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
5395 !! end
5396
5397 !! test
5398 External links: www.jpeg.org (T2554)
5399 !! wikitext
5400 http://www.jpeg.org
5401 !! html
5402 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5403 </p>
5404 !! end
5405
5406 # parsoid doesn't explicitly mark autonumbered links, see T55505
5407 !! test
5408 External links: URL within URL (T2002)
5409 !! wikitext
5410 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5411 !! html/php
5412 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5413 </p>
5414 !! html/parsoid
5415 <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>
5416 !! end
5417
5418 !! test
5419 T2361: URL inside bracketed URL
5420 !! wikitext
5421 [http://www.example.com/foo http://www.example.com/bar]
5422 !! html
5423 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5424 </p>
5425 !! end
5426
5427 !! test
5428 T2361: URL within URL, not bracketed
5429 !! wikitext
5430 http://www.example.com/foo?=http://www.example.com/bar
5431 !! html
5432 <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>
5433 </p>
5434 !! end
5435
5436 !! test
5437 T2289: ">"-token in URL-tail
5438 !! wikitext
5439 http://www.example.com/<hello>
5440 !! html
5441 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5442 </p>
5443 !!end
5444
5445 !! test
5446 T2289: literal ">"-token in URL-tail
5447 !! wikitext
5448 http://www.example.com/<b>html</b>
5449 !! html/php
5450 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5451 </p>
5452 !! html/parsoid
5453 <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>
5454 !! end
5455
5456 !! test
5457 T2289: ">"-token in bracketed URL
5458 !! wikitext
5459 [http://www.example.com/<hello> stuff]
5460 !! html
5461 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5462 </p>
5463 !!end
5464
5465 !! test
5466 T2289: literal ">"-token in bracketed URL
5467 !! wikitext
5468 [http://www.example.com/<b>html</b> stuff]
5469 !! html
5470 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5471 </p>
5472 !!end
5473
5474 !! test
5475 T2289: literal double quote at end of URL
5476 !! wikitext
5477 http://www.example.com/"hello"
5478 !! html
5479 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5480 </p>
5481 !!end
5482
5483 !! test
5484 T2289: literal double quote in bracketed URL
5485 !! wikitext
5486 [http://www.example.com/"hello" stuff]
5487 !! html
5488 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5489 </p>
5490 !!end
5491
5492 !! test
5493 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5494 !! wikitext
5495 [http://www.example.com test]
5496 !! html
5497 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5498 </p>
5499 !! end
5500
5501 !! test
5502 External links: link text with spaces
5503 !! wikitext
5504 [http://www.example.com a b c]
5505 [http://www.example.com ''a'' ''b'']
5506 !! html
5507 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5508 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5509 </p>
5510 !! end
5511
5512 # Note edge case difference between PHP and Parsoid here.
5513 !! test
5514 External links: wiki links within external link (T5695)
5515 !! options
5516 parsoid=wt2html,html2html
5517 !! wikitext
5518 [http://example.com [[wikilink]] embedded in ext link]
5519
5520 [http://example.com test [[wikilink]] embedded in ext link]
5521 !! html/php
5522 <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>
5523 </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>
5524 </p>
5525 !! html/parsoid
5526 <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>
5527 <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>
5528 !! end
5529
5530 !! test
5531 T2787: Links with one slash after the url protocol are invalid
5532 !! wikitext
5533 http:/example.com
5534
5535 [http:/example.com title]
5536 !! html
5537 <p>http:/example.com
5538 </p><p>[http:/example.com title]
5539 </p>
5540 !! end
5541
5542 !! test
5543 Bracketed external links with template-generated invalid target
5544 !! wikitext
5545 [{{echo|http:/example.com}} title]
5546 !! html
5547 <p>[http:/example.com title]
5548 </p>
5549 !! end
5550
5551 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5552 !! test
5553 Broken wikilinks (but not external links) prevent templates from closing
5554 !! options
5555 parsoid=wt2html
5556 !! wikitext
5557 [http://example.com x
5558
5559 {{echo|[http://example.com x}}
5560
5561 [[Foo
5562
5563 {{echo|[[Foo}}
5564 !! html/php
5565 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5566 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5567 </p><p>[[Foo
5568 </p><p>{{echo|[[Foo}}
5569 </p>
5570 !! html/parsoid
5571 <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5572 <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>
5573 <p>[[Foo</p>
5574 <p>{{echo|[[Foo}}</p>
5575 !! end
5576
5577 !! test
5578 Wikilinks with embedded newlines are not broken
5579 !! wikitext
5580 {{echo|[[ Foo
5581 B
5582 C]]}}
5583 !! html/php
5584 <p>[[ Foo
5585 B
5586 C]]
5587 </p>
5588 !! html/parsoid
5589 <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>
5590 !! end
5591
5592 !! test
5593 Broken templates
5594 !! options
5595 parsoid=wt2html
5596 !! wikitext
5597 {{echo|[[Foo|}}]]
5598
5599 [[Foo|{{echo|]]}}
5600 !! html/php
5601 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5602 </p><p>[[Foo|]]
5603 </p>
5604 !! html/parsoid
5605 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5606 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5607 !! end
5608
5609 !! test
5610 T4702: Mismatched <i>, <b> and <a> tags are invalid
5611 !! wikitext
5612 ''[http://example.com text'']
5613 [http://example.com '''text]'''
5614 ''Something [http://example.com in italic'']
5615 ''Something [http://example.com mixed''''', even bold]'''
5616 '''''Now [http://example.com both''''']
5617 !! html
5618 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5619 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5620 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5621 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5622 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5623 </p>
5624 !! end
5625
5626
5627 !! test
5628 T6781: %26 in URL
5629 !! wikitext
5630 http://www.example.com/?title=AT%26T
5631 !! html/php
5632 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5633 </p>
5634 !! html/parsoid
5635 <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>
5636 !! end
5637
5638 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5639 # % is actually legal in HTML5. Any change in output would need testing though.
5640 !! test
5641 T6781, T7267: %25 in URL
5642 !! wikitext
5643 http://www.example.com/?title=100%25_Bran
5644 !! html/php
5645 <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>
5646 </p>
5647 !! html/parsoid
5648 <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>
5649 !! end
5650
5651 !! test
5652 T6781, T7267: %28, %29 in URL
5653 !! wikitext
5654 http://www.example.com/?title=Ben-Hur_%281959_film%29
5655 !! html/php
5656 <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>
5657 </p>
5658 !! html/parsoid
5659 <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>
5660 !! end
5661
5662
5663 !! test
5664 T6781: %26 in autonumber URL
5665 !! wikitext
5666 [http://www.example.com/?title=AT%26T]
5667 !! html/php
5668 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5669 </p>
5670 !! html/parsoid
5671 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5672 !! end
5673
5674 !! test
5675 T6781, T7267: %26 in autonumber URL
5676 !! wikitext
5677 [http://www.example.com/?title=100%25_Bran]
5678 !! html/php
5679 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5680 </p>
5681 !! html/parsoid
5682 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5683 !! end
5684
5685 !! test
5686 T6781, T7267: %28, %29 in autonumber URL
5687 !! wikitext
5688 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5689 !! html/php
5690 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5691 </p>
5692 !! html/parsoid
5693 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5694 !! end
5695
5696
5697 !! test
5698 T6781: %26 in bracketed URL
5699 !! wikitext
5700 [http://www.example.com/?title=AT%26T link]
5701 !! html/php
5702 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5703 </p>
5704 !! html/parsoid
5705 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5706 !! end
5707
5708 !! test
5709 T6781, T7267: %25 in bracketed URL
5710 !! wikitext
5711 [http://www.example.com/?title=100%25_Bran link]
5712 !! html
5713 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5714 </p>
5715 !! end
5716
5717 !! test
5718 T6781, T7267: %28, %29 in bracketed URL
5719 !! wikitext
5720 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5721 !! html/php
5722 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5723 </p>
5724 !! html/parsoid
5725 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5726 !! end
5727
5728 !! test
5729 External link containing a period in the anchor. (T65947)
5730 !! wikitext
5731 [//foo.org/bar#baz. bang]
5732
5733 [//foo.org/bar. bang]
5734 !! html/php
5735 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5736 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5737 </p>
5738 !! html/parsoid
5739 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5740 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5741 !! end
5742
5743 !! test
5744 External link containing a single quote. (T65947)
5745 !! wikitext
5746 [//foo.org/bar'baz]
5747
5748 [//foo.org/bar'baz bang]
5749 !! html/php
5750 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5751 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5752 </p>
5753 !! html/parsoid
5754 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5755 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5756 !! end
5757
5758 !! test
5759 External link containing double-single-quotes in text '' (T6598 sanity check)
5760 !! wikitext
5761 Some [http://example.com/ pretty ''italics'' and stuff]!
5762 !! html
5763 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5764 </p>
5765 !! end
5766
5767 !! test
5768 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5769 !! wikitext
5770 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5771 !! html
5772 <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>
5773 </p>
5774 !! end
5775
5776 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5777 !! test
5778 External link containing double-single-quotes with no space separating the url from text in italics
5779 !! wikitext
5780 [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]].]
5781 !! html/php+tidy
5782 <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>.
5783 </p>
5784 !! html/parsoid
5785 <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>
5786 !! end
5787
5788 !! test
5789 External link with comments in link text
5790 !! wikitext
5791 [http://www.google.com Google <!-- comment -->]
5792 !! html/php
5793 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5794 </p>
5795 !! html/parsoid
5796 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5797 !! end
5798
5799 !! test
5800 External link to bare IPv4 address
5801 !! wikitext
5802 [http://192.168.0.1 Link]
5803 !! html/php
5804 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5805 </p>
5806 !! html/parsoid
5807 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5808 !! end
5809
5810 !! test
5811 URL-encoding in URL functions (single parameter)
5812 !! wikitext
5813 {{localurl:Some page|amp=&}}
5814 !! html
5815 <p>/index.php?title=Some_page&amp;amp=&amp;
5816 </p>
5817 !! end
5818
5819 !! test
5820 URL-encoding in URL functions (multiple parameters)
5821 !! wikitext
5822 {{localurl:Some page|q=?&amp=&}}
5823 !! html
5824 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5825 </p>
5826 !! end
5827
5828 !! test
5829 Brackets in urls
5830 !! wikitext
5831 http://example.com/index.php?foozoid%5B%5D=bar
5832
5833 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5834 !! html/php
5835 <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>
5836 </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>
5837 </p>
5838 !! html/parsoid
5839 <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>
5840
5841 <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>
5842 !! end
5843
5844 !! test
5845 IPv6 urls, autolink format (T23261)
5846 !! wikitext
5847 http://[2404:130:0:1000::187:2]/index.php
5848
5849 Examples from RFC 2373, section 2.2:
5850
5851 *http://[1080::8:800:200C:417A]/unicast
5852 *http://[FF01::101]/multicast
5853 *http://[::1]/loopback
5854 *http://[::]/unspecified
5855 *http://[::13.1.68.3]/ipv4compat
5856 *http://[::FFFF:129.144.52.38]/ipv4compat
5857
5858 Examples from RFC 2732, section 2:
5859
5860 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5861 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5862 *http://[3ffe:2a00:100:7031::1]
5863 *http://[1080::8:800:200C:417A]/foo
5864 *http://[::192.9.5.5]/ipng
5865 *http://[::FFFF:129.144.52.38]:80/index.html
5866 *http://[2010:836B:4179::836B:4179]
5867 !! html/php
5868 <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>
5869 </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:
5870 </p>
5871 <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>
5872 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5873 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5874 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5875 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5876 <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>
5877 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5878 </p>
5879 <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>
5880 <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>
5881 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5882 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5883 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5884 <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>
5885 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5886
5887 !! html/parsoid
5888 <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>
5889
5890 <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>
5891 <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>
5892 <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5893 <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5894 <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5895 <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5896 <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>
5897
5898 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5899 <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>
5900 <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>
5901 <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5902 <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>
5903 <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5904 <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>
5905 <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5906 !! end
5907
5908 !! test
5909 IPv6 urls, bracketed format (T23261)
5910 !! wikitext
5911 [http://[2404:130:0:1000::187:2]/index.php test]
5912
5913 Examples from RFC 2373, section 2.2:
5914
5915 *[http://[1080::8:800:200C:417A] unicast]
5916 *[http://[FF01::101] multicast]
5917 *[http://[::1]/ loopback]
5918 *[http://[::] unspecified]
5919 *[http://[::13.1.68.3] ipv4compat]
5920 *[http://[::FFFF:129.144.52.38] ipv4compat]
5921
5922 Examples from RFC 2732, section 2:
5923
5924 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5925 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5926 *[http://[3ffe:2a00:100:7031::1] 3]
5927 *[http://[1080::8:800:200C:417A]/foo 4]
5928 *[http://[::192.9.5.5]/ipng 5]
5929 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5930 *[http://[2010:836B:4179::836B:4179] 7]
5931 !! html/php
5932 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5933 </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:
5934 </p>
5935 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5936 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5937 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5938 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5939 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5940 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5941 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5942 </p>
5943 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5944 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5945 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5946 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5947 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5948 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5949 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5950
5951 !! html/parsoid
5952 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5953
5954 <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>
5955 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5956 <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5957 <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5958 <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5959 <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5960 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5961
5962 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5963 <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>
5964 <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5965 <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5966 <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5967 <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5968 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5969 <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5970 !! end
5971
5972 !! test
5973 Non-extlinks in brackets
5974 !! wikitext
5975 [foo]
5976 [foo bar]
5977 [foo ''bar'']
5978 [fool's] errand
5979 [fool's errand]
5980 [{{echo|foo}}]
5981 [{{echo|foo}} bar]
5982 [{{echo|foo}} ''bar'']
5983 [{{echo|foo}}l's] errand
5984 [{{echo|foo}}l's errand]
5985 [url={{echo|foo}}]
5986 [url=http://example.com]
5987 [http:// bare protocols don't count]
5988 !! html/php
5989 <p>[foo]
5990 [foo bar]
5991 [foo <i>bar</i>]
5992 [fool's] errand
5993 [fool's errand]
5994 [foo]
5995 [foo bar]
5996 [foo <i>bar</i>]
5997 [fool's] errand
5998 [fool's errand]
5999 [url=foo]
6000 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
6001 [http:// bare protocols don't count]
6002 </p>
6003 !! html/parsoid
6004 <p>[foo]
6005 [foo bar]
6006 [foo <i>bar</i>]
6007 [fool's] errand
6008 [fool's errand]
6009 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
6010 [<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]
6011 [<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>]
6012 [<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
6013 [<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]
6014 [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>]
6015 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
6016 [http:// bare protocols don't count]</p>
6017 !! end
6018
6019 !! test
6020 Percent encoding in external links
6021 !! wikitext
6022 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
6023 !! html/php
6024 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
6025 </p>
6026 !! html/parsoid
6027 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
6028 !! end
6029
6030 !! test
6031 Use url link syntax for links where the content is equal the link target
6032 !! wikitext
6033 http://example.com
6034 !! html/php
6035 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
6036 </p>
6037 !! html/parsoid
6038 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
6039 !! end
6040
6041 !! test
6042 Parenthesis in external links, especially URL links
6043 !! wikitext
6044 http://example.com)
6045
6046 http://example.com/test)
6047
6048 http://example.com/(test)
6049
6050 http://example.com/((test)
6051
6052 (http://example.com/(test))
6053
6054 (http://example.com/(test)))))
6055
6056 http://example.com/a)b
6057
6058 [http://example.com) foo]
6059 !! html/php
6060 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6061 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
6062 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
6063 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
6064 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
6065 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
6066 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
6067 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
6068 </p>
6069 !! html/parsoid
6070 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
6071 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
6072 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
6073 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
6074 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
6075 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
6076 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
6077 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
6078 !! end
6079
6080 !! test
6081 Parenthesis in external links, w/ transclusion or comment
6082 !! wikitext
6083 (http://example.com/{{echo|hi}})
6084
6085 (http://example.com<!-- hi -->)
6086 !! html/php
6087 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
6088 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6089 </p>
6090 !! html/parsoid
6091 <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>
6092
6093 <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>
6094 !! end
6095
6096 !! test
6097 Serialize <a> tags with invalid link targets as plain text
6098 !! options
6099 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
6100 !! html/parsoid
6101 <a rel="mw:WikiLink" href="[[foo]]">text</a>
6102 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
6103 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
6104 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
6105 !! wikitext
6106 text
6107 <nowiki>*</nowiki>text
6108 <nowiki>[[foo]]</nowiki>
6109 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
6110 !! end
6111
6112 !! test
6113 mw:ExtLink -vs- mw:WikiLink (T94723)
6114 !! options
6115 parsoid=html2wt
6116 !! html/parsoid
6117 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
6118 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
6119 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6120 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6121 <p>
6122 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6123 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6124 </p>
6125 !! wikitext
6126 [[Foo|Bar]]
6127 [[Foo|Bar]]
6128 [[:en:Foo|Bar]]
6129 [[:en:Foo|Bar]]
6130
6131 [[:en:European_Robin|European Robin]]
6132 [[:en:European_Robin|European Robin]]
6133 !! end
6134
6135 !! test
6136 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
6137 !! options
6138 parsoid=wt2wt
6139 !! wikitext
6140 [http://en.wikipedia.org/wiki/European_Robin European Robin]
6141 !! html/parsoid
6142 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
6143 !! end
6144
6145
6146 ###
6147 ### Quotes
6148 ###
6149
6150 !! test
6151 Quotes
6152 !! wikitext
6153 Normal text. '''Bold text.''' Normal text. ''Italic text.''
6154
6155 Normal text. '''''Bold italic text.''''' Normal text.
6156 !! html
6157 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
6158 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
6159 </p>
6160 !! end
6161
6162 !! test
6163 Quotes wrapping HTML table
6164 !! wikitext
6165 '''<table><tr><td>hi</td></tr></table>'''
6166 !! html/php+tidy
6167 <b><table><tbody><tr><td>hi</td></tr></tbody></table></b>
6168 !! html/parsoid
6169 <b><table data-parsoid='{"stx":"html"}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>hi</td></tr></tbody></table></b>
6170 !! end
6171
6172 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
6173 # parser strips. The wikitext contains just the first half of the bold
6174 # quote pair.
6175 !! test
6176 Unclosed and unmatched quotes
6177 !! wikitext
6178 '''''Bold italic text '''with bold deactivated''' in between.'''''
6179
6180 '''''Bold italic text ''with italic deactivated'' in between.'''''
6181
6182 '''Bold text..
6183
6184 ..spanning two paragraphs (should not work).'''
6185
6186 '''Bold tag left open
6187
6188 ''Italic tag left open
6189
6190 Normal text.
6191
6192 <!-- Unmatching number of opening, closing tags: -->
6193 '''This year''''s election ''should'' beat '''last year''''s.
6194
6195 ''Tom'''s car is bigger than ''Susan'''s.
6196
6197 Plain ''italic'''s plain
6198 !! html/php
6199 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6200 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6201 </p><p><b>Bold text..</b>
6202 </p><p>..spanning two paragraphs (should not work).
6203 </p><p><b>Bold tag left open</b>
6204 </p><p><i>Italic tag left open</i>
6205 </p><p>Normal text.
6206 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6207 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6208 </p><p>Plain <i>italic'</i>s plain
6209 </p>
6210 !! html/parsoid
6211 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6212 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6213 </p><p><b>Bold text..</b>
6214 </p><p>..spanning two paragraphs (should not work).<b></b>
6215 </p><p><b>Bold tag left open</b>
6216 </p><p><i>Italic tag left open</i>
6217 </p><p>Normal text.
6218 </p>
6219 <!-- Unmatching number of opening, closing tags: -->
6220 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6221 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6222 </p><p>Plain <i>italic'</i>s plain
6223 </p>
6224 !! end
6225
6226 ###
6227 ### Tables
6228 ###
6229 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
6230 ###
6231
6232 # This should not produce <table></table> as <table><tr><td></td></tr></table>
6233 # is the bare minimum required by the spec, see:
6234 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
6235 # Parsoid team replies: empty table tags are legal in HTML5
6236 !! test
6237 A table with no data.
6238 !! options
6239 parsoid=wt2html
6240 !! wikitext
6241 {||}
6242 !! html/php
6243
6244 !! html/parsoid
6245 <table></table>
6246
6247 !! end
6248
6249 !! test
6250 A table with stray table end tags on start tag line (wt2html)
6251 !! options
6252 parsoid=wt2html
6253 !! wikitext
6254 {|style="color: red;"|}
6255
6256 {|style="color: red;" |}
6257 |foo
6258 |}
6259
6260 {|style="color: red;"|} id="foo"
6261 |foo
6262 |}
6263
6264 {|style="color: red;" |} id="foo"
6265 |foo
6266 |}
6267 !! html
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
6288 !! end
6289
6290 !! test
6291 A table with no data (take 2)
6292 !! wikitext
6293 {|
6294 |}
6295 !! html/parsoid
6296 <table></table>
6297 !! end
6298
6299 # A table with nothing but a caption is invalid XHTML, we might want to render
6300 # this as <p>caption</p>
6301 # Parsoid team replies: table with only a caption is legal in HTML5
6302 !! test
6303 A table with nothing but a caption
6304 !! wikitext
6305 {|
6306 |+caption
6307 |}
6308 !! html/php
6309 <table>
6310 <caption>caption
6311 </caption><tr><td></td></tr></table>
6312
6313 !! html/parsoid
6314 <table><caption>caption</caption></table>
6315 !! end
6316
6317 !! test
6318 A table with caption with default-spaced attributes and a table row
6319 !! wikitext
6320 {|
6321 |+ style="color: red;" |caption1
6322 |-
6323 |foo
6324 |}
6325 !! html
6326 <table>
6327 <caption style="color: red;">caption1
6328 </caption>
6329 <tr>
6330 <td>foo
6331 </td></tr></table>
6332
6333 !! end
6334
6335 !! test
6336 A table with captions with non-default spaced attributes and a table row
6337 !! wikitext
6338 {|
6339 |+style="color: red;"|caption2
6340 |+ style="color: red;"|caption3
6341 |-
6342 |foo
6343 |}
6344 !! html
6345 <table>
6346 <caption style="color: red;">caption2
6347 </caption>
6348 <caption style="color: red;">caption3
6349 </caption>
6350 <tr>
6351 <td>foo
6352 </td></tr></table>
6353
6354 !! end
6355
6356 !! test
6357 Table td-cell syntax variations
6358 !! wikitext
6359 {|
6360 |foo bar foo|baz
6361 |foo bar foo||baz
6362 |style='color:red;'|baz
6363 |style='color:red;'||baz
6364 |}
6365 !! html
6366 <table>
6367 <tr>
6368 <td>baz
6369 </td>
6370 <td>foo bar foo</td>
6371 <td>baz
6372 </td>
6373 <td style="color:red;">baz
6374 </td>
6375 <td>style='color:red;'</td>
6376 <td>baz
6377 </td></tr></table>
6378
6379 !! end
6380
6381 !! test
6382 Simple table
6383 !! wikitext
6384 {|
6385 |1||2
6386 |-
6387 |3||4
6388 |}
6389 !! html
6390 <table>
6391 <tr>
6392 <td>1</td>
6393 <td>2
6394 </td></tr>
6395 <tr>
6396 <td>3</td>
6397 <td>4
6398 </td></tr></table>
6399
6400 !! end
6401
6402 !! test
6403 Simple table but with multiple dashes for row wikitext
6404 !! wikitext
6405 {|
6406 |foo
6407 |-----
6408 |bar
6409 |}
6410 !! html
6411 <table>
6412 <tr>
6413 <td>foo
6414 </td></tr>
6415 <tr>
6416 <td>bar
6417 </td></tr></table>
6418
6419 !! end
6420
6421 !! test
6422 Multiplication table
6423 !! wikitext
6424 {| border="1" cellpadding="2"
6425 |+Multiplication table
6426 |-
6427 !&times;!!1!!2!!3
6428 |-
6429 !1
6430 |1||2||3
6431 |-
6432 !2
6433 |2||4||6
6434 |-
6435 !3
6436 |3||6||9
6437 |-
6438 !4
6439 |4||8||12
6440 |-
6441 !5
6442 |5||10||15
6443 |}
6444 !! html
6445 <table border="1" cellpadding="2">
6446 <caption>Multiplication table
6447 </caption>
6448 <tr>
6449 <th>&#215;</th>
6450 <th>1</th>
6451 <th>2</th>
6452 <th>3
6453 </th></tr>
6454 <tr>
6455 <th>1
6456 </th>
6457 <td>1</td>
6458 <td>2</td>
6459 <td>3
6460 </td></tr>
6461 <tr>
6462 <th>2
6463 </th>
6464 <td>2</td>
6465 <td>4</td>
6466 <td>6
6467 </td></tr>
6468 <tr>
6469 <th>3
6470 </th>
6471 <td>3</td>
6472 <td>6</td>
6473 <td>9
6474 </td></tr>
6475 <tr>
6476 <th>4
6477 </th>
6478 <td>4</td>
6479 <td>8</td>
6480 <td>12
6481 </td></tr>
6482 <tr>
6483 <th>5
6484 </th>
6485 <td>5</td>
6486 <td>10</td>
6487 <td>15
6488 </td></tr></table>
6489
6490 !! end
6491
6492 !! test
6493 Accept "||" in table headings
6494 !! wikitext
6495 {|
6496 !h1||h2
6497 |}
6498 !! html
6499 <table>
6500 <tr>
6501 <th>h1</th>
6502 <th>h2
6503 </th></tr></table>
6504
6505 !! end
6506
6507 !! test
6508 Accept "!!" in table data
6509 !! wikitext
6510 {|
6511 |Foo!!||
6512 |}
6513 !! html
6514 <table>
6515 <tr>
6516 <td>Foo!!</td>
6517 <td>
6518 </td></tr></table>
6519
6520 !! html/parsoid
6521 <table>
6522 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6523 </tbody></table>
6524 !! end
6525
6526 !! test
6527 Accept "||" in indented table headings
6528 !! wikitext
6529 :{|
6530 !h1||h2
6531 |}
6532 !! html
6533 <dl><dd><table>
6534 <tr>
6535 <th>h1</th>
6536 <th>h2
6537 </th></tr></table></dd></dl>
6538
6539 !! end
6540
6541 !! test
6542 Accept "!!" in templates
6543 !! wikitext
6544 {|
6545 !a {{echo|b!!c}}
6546 |}
6547 !! html/php
6548 <table>
6549 <tr>
6550 <th>a b</th>
6551 <th>c
6552 </th></tr></table>
6553
6554 !! html/parsoid
6555 <table>
6556 <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>
6557 !! end
6558
6559 !! test
6560 Accept "!!" in table headings after newline
6561 !! wikitext
6562 {|
6563 !a
6564 b!!c
6565 |}
6566 !! html/php
6567 <table>
6568 <tr>
6569 <th>a
6570 <p>b!!c
6571 </p>
6572 </th></tr></table>
6573
6574 !! html/parsoid
6575 <table>
6576 <tbody><tr><th>a
6577 <p>b!!c</p></th></tr>
6578 </tbody></table>
6579 !! end
6580
6581 !! test
6582 Accept "!!" in table data of mixed wikitext / html syntax
6583 !! wikitext
6584 {|
6585 !a
6586 <tr><td>b!!c</td></tr>
6587 |}
6588 !! html/php+tidy
6589 <table>
6590 <tbody><tr>
6591 <th>a
6592 </th></tr><tr><td>b!!c</td></tr>
6593 </tbody></table>
6594 !! html/parsoid
6595 <table>
6596 <tbody><tr><th>a</th></tr>
6597 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6598 </tbody></table>
6599 !! end
6600
6601 !! test
6602 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6603 !! wikitext
6604 {|
6605 !|h1
6606 ||a
6607 |}
6608 !! html
6609 <table>
6610 <tr>
6611 <th>h1
6612 </th>
6613 <td>a
6614 </td></tr></table>
6615
6616 !! end
6617
6618 !!test
6619 Accept "| !" at start of line in tables (ignore !-attribute)
6620 !! wikitext
6621 {|
6622 |-
6623 |!style="color:red"|bar
6624 |}
6625 !! html
6626 <table>
6627
6628 <tr>
6629 <td>bar
6630 </td></tr></table>
6631
6632 !!end
6633
6634 !!test
6635 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 +/-
6636 !! wikitext
6637 {|
6638 |-
6639 |style='color:red;'|+1
6640 |style='color:blue;'|-1
6641 |-
6642 |1||2||3
6643 |1||+2||-3
6644 |-
6645 | +1
6646 | -1
6647 |}
6648 !! html
6649 <table>
6650
6651 <tr>
6652 <td style="color:red;">+1
6653 </td>
6654 <td style="color:blue;">-1
6655 </td></tr>
6656 <tr>
6657 <td>1</td>
6658 <td>2</td>
6659 <td>3
6660 </td>
6661 <td>1</td>
6662 <td>+2</td>
6663 <td>-3
6664 </td></tr>
6665 <tr>
6666 <td>+1
6667 </td>
6668 <td>-1
6669 </td></tr></table>
6670
6671 !!end
6672
6673 !! test
6674 Table rowspan
6675 !! wikitext
6676 {| border=1
6677 |Cell 1, row 1
6678 |rowspan=2|Cell 2, row 1 (and 2)
6679 |Cell 3, row 1
6680 |-
6681 |Cell 1, row 2
6682 |Cell 3, row 2
6683 |}
6684 !! html
6685 <table border="1">
6686 <tr>
6687 <td>Cell 1, row 1
6688 </td>
6689 <td rowspan="2">Cell 2, row 1 (and 2)
6690 </td>
6691 <td>Cell 3, row 1
6692 </td></tr>
6693 <tr>
6694 <td>Cell 1, row 2
6695 </td>
6696 <td>Cell 3, row 2
6697 </td></tr></table>
6698
6699 !! end
6700
6701 !! test
6702 Nested table
6703 !! wikitext
6704 {| border=1
6705 | &alpha;
6706 |
6707 {| bgcolor=#ABCDEF border=2
6708 |nested
6709 |-
6710 |table
6711 |}
6712 |the original table again
6713 |}
6714 !! html
6715 <table border="1">
6716 <tr>
6717 <td>&#945;
6718 </td>
6719 <td>
6720 <table bgcolor="#ABCDEF" border="2">
6721 <tr>
6722 <td>nested
6723 </td></tr>
6724 <tr>
6725 <td>table
6726 </td></tr></table>
6727 </td>
6728 <td>the original table again
6729 </td></tr></table>
6730
6731 !! end
6732
6733 !! test
6734 Invalid attributes in table cell (T3830)
6735 !! wikitext
6736 {|
6737 |Cell:|broken
6738 |}
6739 !! html
6740 <table>
6741 <tr>
6742 <td>broken
6743 </td></tr></table>
6744
6745 !! end
6746
6747 !! test
6748 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6749 !! wikitext
6750 {|
6751 |title="foo" |bar
6752 |title="foo<nowiki>|</nowiki>" |bar
6753 |title="foo<nowiki>|</nowiki>" bar
6754 |}
6755 !! html/php
6756 <table>
6757 <tr>
6758 <td title="foo">bar
6759 </td>
6760 <td title="foo&#124;">bar
6761 </td>
6762 <td>title="foo|" bar
6763 </td></tr></table>
6764
6765 !! html/parsoid
6766 <table>
6767 <tbody><tr><td title="foo">bar</td>
6768 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6769 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6770 </tbody></table>
6771 !! end
6772
6773 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6774 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6775 # *2wt modes will fail.
6776 !! test
6777 Table security: embedded pipes
6778 !! options
6779 parsoid=wt2html,html2html
6780 !! wikitext
6781 {|
6782 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6783 !! html/php
6784 <table>
6785 <tr>
6786 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6787 <td>]" onmouseover="alert(document.cookie)"&gt;test
6788 </td>
6789 </tr>
6790 </table>
6791
6792 !! html/parsoid
6793 <table><tbody>
6794 <tr>
6795 <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>
6796 !! end
6797
6798 !! test
6799 Element attributes with double ! should not be broken up by <th>
6800 !! wikitext
6801 {|
6802 !hi <div class="!!">ha</div> ho
6803 |}
6804 !! html/php
6805 <table>
6806 <tr>
6807 <th>hi <div class="!!">ha</div> ho
6808 </th></tr></table>
6809
6810 !! html/parsoid
6811 <table>
6812 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6813 </tbody></table>
6814 !! end
6815
6816 !! test
6817 ! and || in element attributes should not be parsed as <th>/<td>
6818 !! wikitext
6819 {|
6820 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6821 |}
6822 !! html/php
6823 <table>
6824 <tr>
6825 <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6826 </td></tr></table>
6827
6828 !! html/parsoid
6829 <table>
6830 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6831 </tbody></table>
6832 !! end
6833
6834 # FIXME: The output seems broken. Filed as T110268.
6835 !! test
6836 ! and || in td attributes should not be parsed as <th>/<td>
6837 !! options
6838 parsoid=wt2html
6839 !! wikitext
6840 {|
6841 |style="color: red !important;" data-contrived="put this here ||"|foo
6842 |}
6843 !! html/php
6844 <table>
6845 <tr>
6846 <td>style="color: red !important;" data-contrived="put this here</td>
6847 <td>foo
6848 </td></tr></table>
6849
6850 !! html/parsoid
6851 <table>
6852 <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>
6853 </tbody></table>
6854 !! end
6855
6856 !! test
6857 Break on | in element attribute in template
6858 !! options
6859 parsoid=wt2html,html2html
6860 !! wikitext
6861 {{echo|1=<div class="hi|ho">ha</div>}}
6862 !! html/php
6863 <p>ho"&gt;ha&lt;/div&gt;
6864 </p>
6865 !! html/parsoid
6866 <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>
6867 !! end
6868
6869 !! test
6870 Break on | in element attribute name in template
6871 !! wikitext
6872 {{echo|<div cla|ss="hiho">ha</div>}}
6873 !! html/parsoid
6874 <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>
6875 !! end
6876
6877 !! test
6878 Don't break on | in extension attribute in template
6879 !! wikitext
6880 {{echo|<ref name="hi|ho">ha</ref>}}
6881
6882 <references />
6883 !! html/parsoid
6884 <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="./Main_Page#cite_note-hi|ho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
6885
6886 <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="./Main_Page#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>
6887 !! end
6888
6889 ## We don't support roundtripping of these attributes in Parsoid.
6890 ## Selective serialization takes care of preventing dirty diffs.
6891 ## But, on edits, we dirty-diff the invalid attribute text.
6892 !! test
6893 Invalid text in table attributes should be discarded
6894 !! options
6895 parsoid=wt2html
6896 !! wikitext
6897 {| <span>boo</span> style='border:1px solid black'
6898 | <span>boo</span> style='color:blue' |1
6899 |<span>boo</span> style='color:blue'|2
6900 |}
6901 !! html/php
6902 <table style="border:1px solid black">
6903 <tr>
6904 <td style="color:blue">1
6905 </td>
6906 <td style="color:blue">2
6907 </td></tr></table>
6908
6909 !! html/parsoid
6910 <table style="border:1px solid black">
6911 <tr>
6912 <td style="color:blue">1</td>
6913 <td style="color:blue">2</td>
6914 </tr>
6915 </table>
6916 !! end
6917
6918 !! test
6919 Invalid text in table attributes should be preserved by selective serializer
6920 !! options
6921 parsoid={
6922 "modes": ["selser"],
6923 "changes": [
6924 ["td:first-child", "text", "abc"],
6925 ["td + td", "text", "xyz"]
6926 ]
6927 }
6928 !! wikitext
6929 {| <span>boo</span> style='border:1px solid black'
6930 | <span>boo</span> style='color:blue' | 1
6931 |<span>boo</span> style='color:blue'| 2
6932 |}
6933 !! wikitext/edited
6934 {| <span>boo</span> style='border:1px solid black'
6935 | <span>boo</span> style='color:blue' | abc
6936 |<span>boo</span> style='color:blue'| xyz
6937 |}
6938 !! end
6939
6940 !! test
6941 1. Template-generated table cell attributes and cell content
6942 !! wikitext
6943 {|
6944 |{{table_attribs}}
6945 | {{table_attribs}}
6946 || {{table_attribs_5}}
6947 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6948 |align=center {{table_attribs}}
6949 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6950 |}
6951 !! html
6952 <table>
6953 <tr>
6954 <td style="color:red;">Foo
6955 </td>
6956 <td style="color:red;">Foo
6957 </td>
6958 <td>style="color:red;"</td>
6959 <td>Bar
6960 </td>
6961 <td style="color:red;">Foo
6962 </td>
6963 <td align="center" style="color:red;">Foo
6964 </td>
6965 <td align="center" style="color:red;">Foo
6966 </td></tr></table>
6967
6968 !! end
6969
6970 !! test
6971 2. Template-generated table cell attributes and cell content
6972 !! wikitext
6973 {|
6974 |{{table_attribs_2}}
6975 |}
6976 !! html/php
6977 <table>
6978 <tr>
6979 <td style="color:red;">Foo
6980 </td>
6981 <td>Bar</td>
6982 <td>Baz
6983 </td></tr></table>
6984
6985 !! html/parsoid
6986 <table>
6987 <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>
6988 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6989 </tbody></table>
6990 !! end
6991
6992 !! test
6993 3. Template-generated table cell attributes and cell content
6994 !! wikitext
6995 {|
6996 !align=center {{table_header_cells}}
6997 |-
6998 |align=center {{table_cells}}
6999 |}
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
7013 !! html/parsoid
7014 <table>
7015 <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>
7016 <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>
7017 </tbody></table>
7018 !! end
7019
7020 !! test
7021 4. Template-generated table cell attributes and cell content inside a templated table
7022 !! wikitext
7023 {{tbl-start}}
7024 !align=center {{table_header_cells}}
7025 |-
7026 |align=center {{table_cells}}
7027 {{tbl-end}}
7028 !! html/php
7029 <table>
7030 <tr>
7031 <th align="center" style="color:red;">Foo</th>
7032 <th style="color:red;"><i>Bar</i></th>
7033 <th style="color:brown;"><i>Foo</i> and Baz
7034 </th></tr>
7035 <tr>
7036 <td align="center" style="color:red;">Foo</td>
7037 <td style="color:red;"><i>Bar</i></td>
7038 <td style="color:brown;"><i>Foo</i> and Baz
7039 </td></tr></table>
7040
7041 !! html/parsoid
7042 <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}}]}'>
7043 <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>
7044 <tr>
7045 <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>
7046 </tbody></table>
7047 !! end
7048
7049 ## Edge case fix to prevent future regressions
7050 !! test
7051 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
7052 !! wikitext
7053 {|
7054 |{{table_attribs_7}}
7055 |}
7056 <references />
7057 !! html/parsoid
7058 <table>
7059 <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="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></s></td></tr>
7060 </tbody></table>
7061 <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="./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" data-parsoid="{}">foo</span></li></ol>
7062 !! end
7063
7064 !! test
7065 Table with row followed by newlines and table heading
7066 !! options
7067 parsoid=wt2html,html2html
7068 !! wikitext
7069 {|
7070 |-
7071
7072 !foo
7073 |}
7074 !! html/*
7075 <table>
7076
7077
7078 <tr>
7079 <th>foo
7080 </th></tr></table>
7081
7082 !! end
7083
7084 !! test
7085 Table with empty line following the start tag
7086 !! options
7087 parsoid=wt2html,html2html
7088 !! wikitext
7089 {|
7090
7091 |-
7092 |foo
7093 |}
7094 !! html/*
7095 <table>
7096
7097
7098 <tr>
7099 <td>foo
7100 </td></tr></table>
7101
7102 !! end
7103
7104 !! test
7105 Table attributes with empty value
7106 !! options
7107 parsoid=wt2html,html2html
7108 !! wikitext
7109 {|
7110 | style=|hello
7111 |}
7112 !! html/php
7113 <table>
7114 <tr>
7115 <td style="">hello
7116 </td></tr></table>
7117
7118 !! html/parsoid
7119 <table>
7120 <tbody><tr><td style="">hello</td></tr>
7121 </tbody></table>
7122 !! end
7123
7124 !! test
7125 Wikitext table with a lot of comments
7126 !! wikitext
7127 {|
7128 <!-- c0 -->
7129 |foo
7130 <!-- c1 -->
7131 |-<!-- c2 -->
7132 <!-- c3 -->
7133 |<!-- c4 -->
7134 <!-- c5 -->
7135 |}
7136 !! html
7137 <table>
7138 <tr>
7139 <td>foo
7140 </td></tr>
7141 <tr>
7142 <td>
7143 </td></tr></table>
7144
7145 !! end
7146
7147 !! test
7148 Wikitext table comments represented in parsoid dom
7149 !! wikitext
7150 {|<!--c1--><!--c2-->
7151 |-<!--c3-->
7152 |x
7153 |}
7154 !! html/php+tidy
7155 <table>
7156
7157 <tbody><tr>
7158 <td>x
7159 </td></tr></tbody></table>
7160 !! html/parsoid
7161 <table><!--c1--><!--c2-->
7162 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
7163 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
7164 </tbody></table>
7165 !! end
7166
7167 !! test
7168 Wikitext table with double-line table cell
7169 !! wikitext
7170 {|
7171 |a
7172 b
7173 |}
7174 !! html
7175 <table>
7176 <tr>
7177 <td>a
7178 <p>b
7179 </p>
7180 </td></tr></table>
7181
7182 !! end
7183
7184 !! test
7185 Table cell with a single comment
7186 !! wikitext
7187 {|
7188 |<!-- c1 -->
7189 |a
7190 |}
7191 !! html
7192 <table>
7193 <tr>
7194 <td>
7195 </td>
7196 <td>a
7197 </td></tr></table>
7198
7199 !! end
7200
7201 !! test
7202 Table-cell after a comment-only-empty-line
7203 !! wikitext
7204 {|
7205 |a
7206 <!--c1-->
7207 <!--c2-->|b
7208 |}
7209 !! html
7210 <table>
7211 <tr>
7212 <td>a
7213 </td>
7214 <td>b
7215 </td></tr></table>
7216
7217 !! html/parsoid
7218 <table>
7219 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7220 <!--c1-->
7221 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
7222 </tbody></table>
7223
7224 !! end
7225
7226 !! test
7227 Build table with {{!}}
7228 !! wikitext
7229 {{{!}} class="wikitable"
7230 !header
7231 !second header
7232 {{!}}- style="color:red;"
7233 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
7234 {{!}}}
7235 !! html
7236 <table class="wikitable">
7237 <tr>
7238 <th>header
7239 </th>
7240 <th>second header
7241 </th></tr>
7242 <tr style="color:red;">
7243 <td>data</td>
7244 <td style="color:red;">second data
7245 </td></tr></table>
7246
7247 !! end
7248
7249 !! test
7250 Build table with pipe as data
7251 !! wikitext
7252 {| class="wikitable"
7253 !header
7254 !second header
7255 |- style="color:red;"
7256 |data|| style="color:red;" |second data
7257 |-
7258 | style="color:red;" |data with | || style="color:red;" | second data with |
7259 |-
7260 ||data with | |||second data with |
7261 |}
7262 !! html
7263 <table class="wikitable">
7264 <tr>
7265 <th>header
7266 </th>
7267 <th>second header
7268 </th></tr>
7269 <tr style="color:red;">
7270 <td>data</td>
7271 <td style="color:red;">second data
7272 </td></tr>
7273 <tr>
7274 <td style="color:red;">data with |</td>
7275 <td style="color:red;">second data with |
7276 </td></tr>
7277 <tr>
7278 <td>data with |</td>
7279 <td>second data with |
7280 </td></tr></table>
7281
7282 !! end
7283
7284 !! test
7285 Build table with wikilink
7286 !! wikitext
7287 {| class="wikitable"
7288 !header||second header
7289 |- style="color:red;"
7290 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
7291 |-
7292 |data||second data [[Main Page|link|text with pipe]]
7293 |}
7294 !! html
7295 <table class="wikitable">
7296 <tr>
7297 <th>header</th>
7298 <th>second header
7299 </th></tr>
7300 <tr style="color:red;">
7301 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
7302 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7303 </td></tr>
7304 <tr>
7305 <td>data</td>
7306 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7307 </td></tr></table>
7308
7309 !! end
7310
7311 # The expected HTML structure in this test is debatable. The PHP parser does
7312 # not parse this kind of table at all. The main focus for Parsoid is on
7313 # round-tripping, so this output is ok for now. TODO: revisit!
7314 !! test
7315 Wikitext table with html-syntax row
7316 !! wikitext
7317 {|
7318 |-
7319 <td>foo</td>
7320 |}
7321 !! html/parsoid
7322 <table>
7323 <tbody>
7324 <tr>
7325 <td>foo</td></tr></tbody></table>
7326 !! end
7327
7328 ## Remex doesn't account for fostered content.
7329 !! test
7330 Fostered content in tables: Plain text
7331 !! options
7332 parsoid=wt2html
7333 !! wikitext
7334 {|
7335 |-
7336 a
7337 |}
7338 !! html/php
7339 <table>
7340
7341 a
7342 </table>
7343
7344 !! html/php+tidy
7345
7346
7347 a
7348 <table></table>
7349 !! html/parsoid
7350 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
7351 a</p>
7352 <table>
7353 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr></tbody></table>
7354 !! end
7355
7356 !! test
7357 Fostered content in tables: Lists
7358 !! options
7359 parsoid=wt2html,html2html
7360 !! wikitext
7361 {|
7362 |-
7363 *a
7364 |}
7365 !! html/php
7366 <table>
7367
7368 <ul><li>a</li></ul>
7369 </table>
7370
7371 !! html/php+tidy
7372 <ul><li>a</li></ul><table>
7373
7374
7375 </table>
7376 !! html/parsoid
7377 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7378 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7379
7380 </tr></tbody></table>
7381 !! end
7382
7383 !! test
7384 Template generated table cell with attributes
7385 !! wikitext
7386 {|
7387 |-
7388 {{table_attribs_4}} ||a||b
7389 |}
7390 !! html/php+tidy
7391 <table>
7392
7393 <tbody><tr>
7394 <td style="background-color:#DC241f;" width="10px"></td>
7395 <td>a</td>
7396 <td>b
7397 </td></tr></tbody></table>
7398 !! html/parsoid
7399 <table>
7400 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7401 <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>
7402 !! end
7403
7404 !! test
7405 Parsoid: Round-trip tables directly followed by content (T53219)
7406 !! options
7407 parsoid=wt2html,wt2wt
7408 !! wikitext
7409 {|
7410 |foo
7411 |} bar
7412
7413 {|
7414 |baz
7415 |}<b>quux</b>
7416 !! html+tidy
7417 <table>
7418 <tbody><tr>
7419 <td>foo
7420 </td></tr></tbody></table><p> bar
7421 </p><table>
7422 <tbody><tr>
7423 <td>baz
7424 </td></tr></tbody></table><p><b>quux</b>
7425 </p>
7426 !! end
7427
7428 !! test
7429 Parsoid: Default to a newline after tables in new content (T53219)
7430 !! options
7431 parsoid=html2wt
7432 !! html/parsoid
7433 <table><tbody>
7434 <tr><td>foo</td></tr></tbody></table> bar
7435 <table><tbody>
7436 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7437 !! wikitext
7438 {|
7439 |foo
7440 |}
7441 <nowiki> </nowiki>bar
7442 {|
7443 |baz
7444 |}
7445 '''quux'''
7446 !! end
7447
7448 !! test
7449 Parsoid: Row-syntax table headings followed by comment & table cells
7450 !! options
7451 parsoid=wt2html,wt2wt
7452 !! wikitext
7453 {|
7454 !foo||bar
7455 <!-- foo --> ||baz||quux
7456 |}
7457 !! html/php
7458 <table>
7459 <tr>
7460 <th>foo</th>
7461 <th>bar
7462 </th>
7463 <td>baz</td>
7464 <td>quux
7465 </td></tr></table>
7466
7467 !! html/parsoid
7468 <table>
7469 <tbody><tr><th>foo</th><th>bar
7470 <!-- foo --></th><td> baz </td><td>quux</td></tr>
7471 </tbody></table>
7472 !! end
7473
7474 !!test
7475 Parsoid: Recover better from broken table attributes
7476 !!options
7477 parsoid=wt2html
7478 !!wikitext
7479 {| class="foo
7480 | class="bar" |
7481 foo
7482 |}
7483 !!html/php+tidy
7484 <table class="foo">
7485 <tbody><tr>
7486 <td class="bar">
7487 <p>foo
7488 </p>
7489 </td></tr></tbody></table>
7490 !!html/parsoid
7491 <table class="foo">
7492 <tr>
7493 <td class="bar">
7494 <p>foo</p></td></tr>
7495 </tbody></table>
7496 !!end
7497
7498 !! test
7499 Tables: Digest broken attributes on table and tr tag
7500 !! options
7501 parsoid=wt2html
7502 !! wikitext
7503 {| || |} ++
7504 |- || || ++ --
7505 |- > [
7506 |}
7507 !! html
7508 <table>
7509 <tbody>
7510 <tr class='mw-empty-elt'></tr>
7511 <tr class='mw-empty-elt'></tr>
7512 </tbody></table>
7513 !! end
7514
7515 !! test
7516 Table with missing opening <tr> tag
7517 !! options
7518 parsoid=wt2html,wt2wt
7519 !! wikitext
7520 <table>
7521 <td>foo</td>
7522 </tr>
7523 </table>
7524 !! html+tidy
7525 <table>
7526 <tbody><tr><td>foo</td>
7527 </tr>
7528 </tbody></table>
7529 !! end
7530
7531 # T137406: Whitespace in the HTML
7532 !! test
7533 1. Generate correct wikitext for tables with thead/tbody/tfoot
7534 !! options
7535 parsoid=html2wt
7536 !! html/parsoid
7537 <table>
7538 <caption>Test</caption>
7539 <thead>
7540 <tr>
7541 <th>Month</th>
7542 <th>Savings</th>
7543 </tr>
7544 </thead>
7545 <tbody>
7546 <tr>
7547 <td>January</td>
7548 <td>$100</td>
7549 </tr>
7550 <tr>
7551 <td>February</td>
7552 <td>$80</td>
7553 </tr>
7554 </tbody>
7555 <tfoot>
7556 <tr>
7557 <td>Sum</td>
7558 <td>$180</td>
7559 </tr>
7560 </tfoot>
7561 </table>
7562 !! wikitext
7563 {|
7564 |+Test
7565 !Month
7566 !Savings
7567 |-
7568 |January
7569 |$100
7570 |-
7571 |February
7572 |$80
7573 |-
7574 |Sum
7575 |$180
7576 |}
7577 !! html/php+tidy
7578 <table>
7579 <caption>Test
7580 </caption>
7581 <tbody><tr>
7582 <th>Month
7583 </th>
7584 <th>Savings
7585 </th></tr>
7586 <tr>
7587 <td>January
7588 </td>
7589 <td>$100
7590 </td></tr>
7591 <tr>
7592 <td>February
7593 </td>
7594 <td>$80
7595 </td></tr>
7596 <tr>
7597 <td>Sum
7598 </td>
7599 <td>$180
7600 </td></tr></tbody></table>
7601 !! end
7602
7603 # T137406: No whitespace in the HTML
7604 !! test
7605 2. Generate correct wikitext for tables with thead/tbody/tfoot
7606 !! options
7607 parsoid=html2wt
7608 !! html/parsoid
7609 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7610 !! wikitext
7611 {|
7612 !heading
7613 |-
7614 |foo
7615 |}
7616 !! end
7617
7618 !! test
7619 Wikitext tables can be nested inside HTML tables
7620 !! options
7621 parsoid=html2wt
7622 !! html
7623 <table data-parsoid='{"stx":"html"}'>
7624 <tr><td>
7625 <table>
7626 <tr><td>foo</td></tr>
7627 </table>
7628 </td></tr>
7629 </table>
7630 !! wikitext
7631 <table>
7632 <tr><td>
7633 {|
7634 |foo
7635 |}
7636 </td></tr>
7637 </table>
7638 !! end
7639
7640 ###
7641 ### Internal links
7642 ###
7643 !! test
7644 Plain link, capitalized
7645 !! wikitext
7646 [[Main Page]]
7647 !! html
7648 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7649 </p>
7650 !! end
7651
7652 !! test
7653 Plain link, uncapitalized
7654 !! wikitext
7655 [[main Page]]
7656 !! html
7657 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7658 </p>
7659 !! end
7660
7661 !! test
7662 Piped link
7663 !! wikitext
7664 [[Main Page|The Main Page]]
7665 !! html
7666 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7667 </p>
7668 !! end
7669
7670 !! test
7671 Piped link with comment in link text
7672 !! wikitext
7673 [[Main Page|The Main<!--front--> Page]]
7674 !! html
7675 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7676 </p>
7677 !! end
7678
7679 !! test
7680 Piped link with multiple pipe characters in link text
7681 !! wikitext
7682 [[Main Page||The|Main|Page|]]
7683 !! html/php
7684 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7685 </p>
7686 !! html/parsoid
7687 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7688 !! end
7689
7690 !! test
7691 Piped link with no link text
7692 !! wikitext
7693 [[Thomas Bek (bishop of St David's)|]]
7694 !! html/php
7695 <p>[[Thomas Bek (bishop of St David's)|]]
7696 </p>
7697 !! html/parsoid
7698 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7699 !! end
7700
7701 !! test
7702 Piped link with empty link text
7703 !! wikitext
7704 [[Main Page|<nowiki/>]] - empty nowiki
7705 [[Main Page| ]] - empty space
7706 [[Main Page|&nbsp;]] - empty non breaking space
7707 !! html/php
7708 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7709 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7710 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7711 </p>
7712 !! html/parsoid
7713 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7714 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7715 <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>
7716 !! end
7717
7718 !! test
7719 Broken link
7720 !! wikitext
7721 [[Zigzagzogzagzig]]
7722 !! html
7723 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7724 </p>
7725 !! end
7726
7727 !! test
7728 Broken link with fragment
7729 !! wikitext
7730 [[Zigzagzogzagzig#zug]]
7731 !! html
7732 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7733 </p>
7734 !! end
7735
7736 !! test
7737 Special page link with fragment
7738 !! wikitext
7739 [[Special:Version#anchor]]
7740 !! html
7741 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7742 </p>
7743 !! end
7744
7745 !! test
7746 Nonexistent special page link with fragment
7747 !! wikitext
7748 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7749 !! html
7750 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7751 </p>
7752 !! end
7753
7754 !! test
7755 Link with prefix
7756 !! wikitext
7757 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7758 !! html
7759 <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>
7760 </p>
7761 !! end
7762
7763 !! test
7764 Link with suffix
7765 !! wikitext
7766 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7767 !! html
7768 <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>!!!
7769 </p>
7770 !! end
7771
7772 !! article
7773 prefixed article
7774 !! text
7775 Some text
7776 !! endarticle
7777
7778 !! test
7779 T45661: Piped links with identical prefixes
7780 !! wikitext
7781 [[prefixed article|prefixed articles with spaces]]
7782
7783 [[prefixed article|prefixed articlesaoeu]]
7784
7785 [[Main Page|Main Page test]]
7786 !! html
7787 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7788 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7789 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7790 </p>
7791 !! end
7792
7793
7794 !! test
7795 Link with HTML entity in suffix / tail
7796 !! wikitext
7797 [[Main Page]]&quot;, [[Main Page]]&#97;
7798 !! html/php
7799 <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;
7800 </p>
7801 !! html/parsoid
7802 <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>
7803 !! end
7804
7805 !! test
7806 Link with 3 brackets
7807 !! wikitext
7808 [[[Main Page]]]
7809 Foo [[[Main Page]]]
7810 !! html
7811 <p>[[[Main Page]]]
7812 Foo [[[Main Page]]]
7813 </p>
7814 !! end
7815
7816 !! test
7817 Link with 4 brackets
7818 !! wikitext
7819 [[[[Main Page]]]]
7820 !! html
7821 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7822 </p>
7823 !! end
7824
7825 !! test
7826 Piped link with 3 brackets
7827 !! wikitext
7828 [[[main page|the main page]]]
7829 !! html
7830 <p>[[[main page|the main page]]]
7831 </p>
7832 !! end
7833
7834 !! test
7835 Piped link with extlink-like text
7836 !! wikitext
7837 [[Main Page|[bar]]]
7838 [[Main Page|This is a [bar]]]
7839 [[Main Page|[bar]]
7840 !! html/php
7841 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7842 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7843 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7844 </p>
7845 !! html/parsoid
7846 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7847 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7848 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7849 !! end
7850
7851 !! test
7852 Link with multiple pipes
7853 !! wikitext
7854 [[Main Page|The|Main|Page]]
7855 !! html
7856 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7857 </p>
7858 !! end
7859
7860 !! test
7861 Anchor containing a #. (T65430)
7862 !! config
7863 wgFragmentMode=[ 'html5', 'legacy' ]
7864 !! wikitext
7865 [[Main Page#And#Link]]
7866 !! html/php
7867 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7868 </p>
7869 !! html/parsoid
7870 <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>
7871 !! end
7872
7873 !! test
7874 Link to namespaces
7875 !! wikitext
7876 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7877 !! html
7878 <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>
7879 </p>
7880 !! end
7881
7882 !! test
7883 Link with space in namespace
7884 !! wikitext
7885 [[User talk:Foo bar]]
7886 !! html
7887 <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>
7888 </p>
7889 !! end
7890
7891 !! article
7892 MemoryAlpha:AlphaTest
7893 !! text
7894 This is an article in the MemoryAlpha namespace
7895 (which shadows the memoryalpha interwiki link).
7896 !! endarticle
7897
7898 !! test
7899 Namespace takes precedence over interwiki link (T53680)
7900 !! wikitext
7901 [[MemoryAlpha:AlphaTest]]
7902 !! html
7903 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7904 </p>
7905 !! end
7906
7907 # The previous test doesn't work correctly in html2*, due to not recognizing the
7908 # link as an internal one. This one checks for the correct behavior.
7909 !! test
7910 Link to namespace preferred over interwiki with correct rel attribute
7911 !! options
7912 parsoid=html2wt,html2html
7913 !! html/parsoid
7914 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7915 !! wikitext
7916 [[MemoryAlpha:AlphaTest]]
7917 !! end
7918
7919 !! test
7920 Piped link to namespace
7921 !! wikitext
7922 [[Meta:Disclaimers|The disclaimers]]
7923 !! html
7924 <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>
7925 </p>
7926 !! end
7927
7928 !! test
7929 Link containing }
7930 !! wikitext
7931 [[Usually caused by a typo (oops}]]
7932 !! html
7933 <p>[[Usually caused by a typo (oops}]]
7934 </p>
7935 !! end
7936
7937 !! article
7938 7% Solution
7939 !! text
7940 Just a test of an article title containing a percent.
7941 !! endarticle
7942
7943 !! test
7944 Link containing % (not as a hex sequence)
7945 !! wikitext
7946 [[7% Solution]]
7947 [[7% Solution|7%25 Solution]]
7948 !! html/php
7949 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7950 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7951 </p>
7952 !! html/parsoid
7953 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7954 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7955 !! end
7956
7957 # note that the parsoid HTML is identical to the previous test output,
7958 # so the previous test ensures that the html2wt mode will generate the
7959 # "not as a hex sequence" wikitext.
7960 !! test
7961 Link containing % as a single hex sequence interpreted to char
7962 !! options
7963 parsoid=wt2wt,wt2html,html2html
7964 !! wikitext
7965 [[7%25 Solution]]
7966 [[7%25 Solution|7%25 Solution]]
7967 !! html/php
7968 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7969 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7970 </p>
7971 !! html/parsoid
7972 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7973 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7974 !!end
7975
7976 !! test
7977 Link containing % as a double hex sequence interpreted to hex sequence
7978 !! wikitext
7979 [[7%2525 Solution]]
7980 !! html
7981 <p>[[7%2525 Solution]]
7982 </p>
7983 !!end
7984
7985 ## Example for such a section: == < ==
7986 !! test
7987 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7988 !! config
7989 wgFragmentMode=[ 'html5', 'legacy' ]
7990 !! wikitext
7991 [[%23%3c]][[%23%3e]]
7992 !! html/php
7993 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
7994 </p>
7995 !! html/parsoid
7996 <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>
7997 !! end
7998
7999 ## Example for such a section: == < ==
8000 !! test
8001 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
8002 !! config
8003 wgFragmentMode=[ 'legacy' ]
8004 !! wikitext
8005 [[%23%3c]][[%23%3e]]
8006 !! html/php
8007 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
8008 </p>
8009 !! end
8010
8011 !! test
8012 Link containing "<#" and ">#" as a hex sequences
8013 !! wikitext
8014 [[%3c%23]][[%3e%23]]
8015 !! html
8016 <p>[[%3c%23]][[%3e%23]]
8017 </p>
8018 !! end
8019
8020 !! test
8021 Link containing an equals sign
8022 !! wikitext
8023 [[Special:BookSources/isbn=4-00-026157-6]]
8024 !! html/php
8025 <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>
8026 </p>
8027 !! html/parsoid
8028 <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>
8029 !! end
8030
8031 !! article
8032 Foo & bar
8033 !! text
8034 Just a test of an article title containing an ampersand
8035 !! endarticle
8036
8037 !! test
8038 Link containing an ampersand
8039 !! wikitext
8040 [[Foo & bar]]
8041
8042 [[Foo &amp; bar]]
8043
8044 [[Foo &amp;amp; bar]]
8045 !! html/php+tidy
8046 <p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar">Foo &amp; bar</a>
8047 </p><p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar">Foo &amp; bar</a>
8048 </p><p>[[Foo &amp;amp; bar]]
8049 </p>
8050 !! html/parsoid
8051 <p><a rel="mw:WikiLink" href="./Foo_&amp;_bar" title="Foo &amp; bar">Foo &amp; bar</a></p>
8052 <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>
8053 <p>[[Foo <span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>amp; bar]]</p>
8054 !! end
8055
8056 !! article
8057 Foo~bar
8058 !! text
8059 Just a test of an article title containing a tilde.
8060 !! endarticle
8061
8062 # note that links containing signatures, like [[Foo~~~~]], are
8063 # massaged by the pre-save transform (PST) and so the tildes are never
8064 # seen by the parser.
8065 !! test
8066 Link containing a tilde
8067 !! wikitext
8068 [[Foo~bar]]
8069 !! html/php
8070 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
8071 </p>
8072 !! html/parsoid
8073 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
8074 !! end
8075
8076 !! test
8077 Link containing double-single-quotes '' (T6598)
8078 !! wikitext
8079 [[Lista d''e paise d''o munno]]
8080 !! html/php
8081 <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>
8082 </p>
8083 !! html/parsoid
8084 <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>
8085 !! end
8086
8087 !! test
8088 Link containing double quotes and spaces
8089 !! wikitext
8090 [[Cool "Gator"]]
8091 !! html/php
8092 <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>
8093 </p>
8094 !! html/parsoid
8095 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
8096 !! end
8097
8098 !! test
8099 File containing double quotes and spaces
8100 !! wikitext
8101 [[File:Cool "Gator".png]]
8102 !! html/parsoid
8103 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Cool_%22Gator%22.png" data-parsoid='{"a":{"href":"./File:Cool_%22Gator%22.png"},"sa":{"href":"File:Cool \"Gator\".png"}}'><img resource='./File:Cool_"Gator".png' src="./Special:FilePath/Cool_%22Gator%22.png" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Cool_\"Gator\".png","height":"220","width":"220","src":"./Special:FilePath/Cool_%22Gator%22.png"},"sa":{"resource":"File:Cool \"Gator\".png","src":"./Special:FilePath/Cool_\"Gator\".png"}}'/></a></figure-inline></p>
8104 !! end
8105
8106 !! test
8107 Redirect containing double quotes and spaces
8108 !! wikitext
8109 #REDIRECT [[Cool "Gator"]]
8110 !! html/parsoid
8111 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
8112 !! end
8113
8114 !! test
8115 Link containing double-single-quotes '' in text (T6598 sanity check)
8116 !! wikitext
8117 Some [[Link|pretty ''italics'' and stuff]]!
8118 !! html/php
8119 <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>!
8120 </p>
8121 !! html/parsoid
8122 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8123 !! end
8124
8125 !! test
8126 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8127 !! wikitext
8128 ''Some [[Link|pretty ''italics'' and stuff]]!''
8129 !! html
8130 <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>
8131 </p>
8132 !! end
8133
8134 !! test
8135 Link with double quotes in title part (literal) and alternate part (interpreted)
8136 !! wikitext
8137 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8138
8139 [[''Pentecoste'']]
8140
8141 [[''Pentecoste''|Pentecoste]]
8142
8143 [[''Pentecoste''|''Pentecoste'']]
8144 !! html/php
8145 <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>
8146 </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>
8147 </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>
8148 </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>
8149 </p>
8150 !! html/parsoid
8151 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></figure-inline></p>
8152 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8153 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8154 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8155 !! end
8156
8157 !! test
8158 Broken image links with HTML captions (T41700)
8159 !! wikitext
8160 [[File:Nonexistent|<script></script>]]
8161 [[File:Nonexistent|100x100px|<script></script>]]
8162 [[File:Nonexistent|&lt;]]
8163 [[File:Nonexistent|a<i>b</i>c]]
8164 !! html/php
8165 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8166 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8167 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8168 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8169 </p>
8170 !! html/parsoid
8171 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
8172 <figure-inline typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
8173 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
8174 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline></p>
8175 !! end
8176
8177 !! test
8178 Plain link to URL
8179 !! wikitext
8180 [[http://www.example.com]]
8181 !! html/php
8182 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8183 </p>
8184 !! html/parsoid
8185 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
8186 !! end
8187
8188 !! test
8189 Plain link to URL with link text
8190 !! wikitext
8191 [[http://www.example.com Link text]]
8192 !! html
8193 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8194 </p>
8195 !! end
8196
8197 !! test
8198 Plain link to protocol-relative URL
8199 !! wikitext
8200 [[//www.example.com]]
8201 !! html/php
8202 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8203 </p>
8204 !! html/parsoid
8205 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8206 !! end
8207
8208 !! test
8209 Plain link to protocol-relative URL with link text
8210 !! wikitext
8211 [[//www.example.com Link text]]
8212 !! html
8213 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8214 </p>
8215 !! end
8216
8217 !! test
8218 Plain link to page with question mark in title
8219 !! wikitext
8220 [[A?b]]
8221
8222 [[A?b|Baz]]
8223 !! html
8224 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8225 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8226 </p>
8227 !! end
8228
8229 # I'm fairly sure the expected result here is wrong.
8230 # We want these to be URL links, not pseudo-pages with URLs for titles....
8231 # However the current output is also pretty screwy.
8232 #
8233 # ----
8234 # I'm changing it to match the current output--it arguably makes more
8235 # sense in the light of the test above. Old expected result was:
8236 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8237 #</p>
8238 # But I think this test is bordering on "garbage in, garbage out" anyway.
8239 # -- wtm
8240 !! test
8241 Piped link to URL
8242 !! wikitext
8243 Piped link to URL: [[http://www.example.com|an example URL]]
8244 !! html/php
8245 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8246 </p>
8247 !! html/parsoid
8248 <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>
8249 !! end
8250
8251 !! test
8252 Plain link in template argument
8253 !! options
8254 parsoid=wt2html
8255 !! wikitext
8256 {{echo|[http://www.example.com |123]}}
8257
8258 {{echo|[[http://www.example.com |123]]}}
8259
8260 {{echo|[[http://www.example.com |123]}}
8261
8262 {{echo|[http://www.example.com |123]]}}
8263 !! html/php
8264 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8265 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8266 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8267 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8268 </p>
8269 !! html/parsoid
8270 <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>
8271
8272 <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>
8273
8274 <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>
8275
8276 <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>
8277 !! end
8278
8279 !! test
8280 T2002: [[page|http://url/]] should link to page, not http://url/
8281 !! wikitext
8282 [[Main Page|http://url/]]
8283 !! html/php
8284 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8285 </p>
8286 !! html/parsoid
8287 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8288 !! end
8289
8290 # Parsoid does not mark self-links, by design.
8291 !! test
8292 T2337: Escaped self-links should be bold
8293 !! options
8294 title=[[Bug462]]
8295 !! wikitext
8296 [[Bu&#103;462]] [[Bug462]]
8297 !! html/php+tidy
8298 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8299 </p>
8300 !! html/parsoid
8301 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8302 !! end
8303
8304 !! test
8305 Self-link to section should not be bold
8306 !! options
8307 title=[[Main Page]]
8308 !! wikitext
8309 [[Main Page#section]]
8310 !! html
8311 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8312 </p>
8313 !! end
8314
8315 !! article
8316 00
8317 !! text
8318 This is 00.
8319 !! endarticle
8320
8321 !!test
8322 Self-link to numeric title
8323 !!options
8324 title=[[0]]
8325 !! wikitext
8326 [[0]]
8327 !! html
8328 <p><a class="mw-selflink selflink">0</a>
8329 </p>
8330 !!end
8331
8332 !!test
8333 Link to numeric-equivalent title
8334 !!options
8335 title=[[0]]
8336 !! wikitext
8337 [[00]]
8338 !! html
8339 <p><a href="/wiki/00" title="00">00</a>
8340 </p>
8341 !!end
8342
8343 !! test
8344 <nowiki> inside a link
8345 !! wikitext
8346 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8347 !! html
8348 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8349 </p>
8350 !! end
8351
8352 !! test
8353 Non-breaking spaces in title
8354 !! wikitext
8355 [[&nbsp; Main &nbsp; Page &nbsp;]]
8356 !! html
8357 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8358 </p>
8359 !!end
8360
8361 # Add new article for the test below so that it doesn't red-link
8362 !! article
8363 Foo bar baz
8364 !! text
8365 boo
8366 !! endarticle
8367
8368 !! test
8369 Multiple spaces in titles should normalize to a single underscore
8370 !! options
8371 parsoid=wt2html,wt2wt
8372 !! wikitext
8373 [[Foo bar baz|x]]
8374 [[Foo bar baz|x]]
8375 [[Foo bar baz|x]]
8376 !! html/php
8377 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8378 <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 </p>
8381 !! html/parsoid
8382 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8383 <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 </p>
8386 !! end
8387
8388 !! test
8389 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8390 !! options
8391 language=ca
8392 !! wikitext
8393 '''[[Main Page]]'''
8394 !! html
8395 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8396 </p>
8397 !! end
8398
8399 !! test
8400 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8401 !! options
8402 language=ca
8403 !! wikitext
8404 ''[[Main Page]]''
8405 !! html
8406 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8407 </p>
8408 !! end
8409
8410 !! test
8411 Internal link with en linktrail: no apostrophes (T29473)
8412 !! options
8413 language=en
8414 !! wikitext
8415 [[Something]]'nice
8416 !! html
8417 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8418 </p>
8419 !! end
8420
8421 !! test
8422 Internal link with ca linktrail with apostrophes (T29473)
8423 !! options
8424 language=ca
8425 !! wikitext
8426 [[Something]]'nice
8427 !! html
8428 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8429 </p>
8430 !! end
8431
8432 !! test
8433 Internal link with kaa linktrail with apostrophes (T29473)
8434 !! options
8435 language=kaa
8436 !! wikitext
8437 [[Something]]'nice
8438 !! html
8439 <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>
8440 </p>
8441 !! end
8442
8443 !! test
8444 Link with multiple ":" in a subpage-supporting namespace (T65636)
8445 !! wikitext
8446 [[User:Foo/Test/63636:Bar|Test]]
8447 !! html/php
8448 <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>
8449 </p>
8450 !! html/parsoid
8451 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8452 !! end
8453
8454 ## Mainly a sanity check for Parsoid
8455 !! test
8456 Handle title parsing for subpages
8457 !! options
8458 title=[[/123123]]
8459 subpage
8460 !! wikitext
8461 123
8462 !! html/php
8463 <p>123
8464 </p>
8465 !! html/parsoid
8466 <p>123</p>
8467 !! end
8468
8469 !! article
8470 User:Test/123
8471 !! text
8472 test 123
8473 !! endarticle
8474
8475 !! test
8476 Link to a subpage from a namespace other than main
8477 !! options
8478 title=[[User:Test]]
8479 subpage
8480 !! wikitext
8481 [[/123]]
8482 !! html/php
8483 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8484 </p>
8485 !! html/parsoid
8486 <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>
8487 !! end
8488
8489 !! test
8490 Ensure that transclusion titles are not url-decoded
8491 !! options
8492 subpage title=[[Test]]
8493 parsoid=wt2html
8494 !! wikitext
8495 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8496 !! html/php
8497 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8498 </p>
8499 !! html/parsoid
8500 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8501 !! end
8502
8503 !! test
8504 Purely hash wikilink
8505 !! options
8506 title=[[User:Test/123]]
8507 subpage
8508 !! wikitext
8509 [[#a|b]]
8510 !! html/php
8511 <p><a href="#a">b</a>
8512 </p>
8513 !! html/parsoid
8514 <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>
8515 !! end
8516
8517 !! test
8518 Serialization of purely hash wikilink
8519 !! options
8520 title=[[User:Test/123]]
8521 subpage
8522 parsoid=html2wt
8523 !! html/parsoid
8524 <p><a href="#a">[[</a></p>
8525 !! wikitext
8526 [[#a|<nowiki>[[</nowiki>]]
8527 !! html/php
8528 <p><a href="#a">[[</a>
8529 </p>
8530 !! end
8531
8532 !! test
8533 1. Interaction of linktrail and template encapsulation
8534 !! wikitext
8535 {{echo|[[Foo]]}}l
8536 !! html/parsoid
8537 <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>
8538 !! end
8539
8540 !! test
8541 2. Interaction of linktrail and template encapsulation
8542 !! options
8543 parsoid
8544 !! wikitext
8545 {{echo|Some [[Fool]]}}s
8546 !! html
8547 <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>
8548 !! end
8549
8550 !! test
8551 3. Interaction of linktrail and template encapsulation
8552 !! options
8553 parsoid
8554 !! wikitext
8555 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8556 !! html
8557 <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>
8558 !! end
8559
8560 !! article
8561 Söfnuður
8562 !! text
8563 Test.
8564 !! endarticle
8565
8566 !! test
8567 Internal link with is link prefix
8568 !! options
8569 language=is
8570 !! wikitext
8571 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8572 !! html
8573 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8574 </p>
8575 !! end
8576
8577 !! article
8578 Mótmælendatrú
8579 !! text
8580 Test.
8581 !! endarticle
8582
8583 !! test
8584 Internal link with is link trail and link prefix
8585 !! options
8586 language=is
8587 !! wikitext
8588 [[mótmælendatrú|xxx]]ar
8589 [[mótmælendatrú]]ar
8590 mótmælenda[[söfnuður]]
8591 mótmælenda[[söfnuður|söfnuðir]]
8592 mótmælenda[[söfnuður|söfnuðir]]xxx
8593 !! html
8594 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8595 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8596 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8597 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8598 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8599 </p>
8600 !! end
8601
8602 !! test
8603 Parsoid link trail escaping
8604 !! options
8605 parsoid=html2wt,html2html
8606 !! html/parsoid
8607 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8608 !! wikitext
8609 [[apple]]<nowiki/>s
8610 !! end
8611
8612 !! test
8613 Parsoid link prefix escaping
8614 !! options
8615 language=is
8616 parsoid=html2wt,html2html
8617 !! html/parsoid
8618 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8619 !! wikitext
8620 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8621 !! end
8622
8623 !! test
8624 Parsoid link bracket escaping
8625 !! options
8626 parsoid=html2wt,html2html
8627 !! html/parsoid
8628 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8629 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8630 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8631 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8632 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8633 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8634 !! wikitext
8635 [[Test]]
8636
8637 [<nowiki/>[[Test]]]
8638
8639 [[[[Test]]]]
8640
8641 [[[<nowiki/>[[Test]]]]]
8642
8643 [[[[[[Test]]]]]]
8644
8645 [[[[[<nowiki/>[[Test]]]]]]]
8646 !! end
8647
8648 !! test
8649 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8650 !! wikitext
8651 [[Foo| bar]]
8652
8653 [[Foo| ''bar'']]
8654
8655 [http://wp.org foo]
8656
8657 [http://wp.org ''foo'']
8658 !! html
8659 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8660 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8661 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8662 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8663 </p>
8664 !! end
8665
8666 !! test
8667 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8668 !! wikitext
8669 [[Foo|{{echo|a}} b {{echo|c}}]]
8670 !! html/parsoid
8671 <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>
8672 !! end
8673
8674 !! test
8675 Link with angle bracket after anchor
8676 !! config
8677 wgFragmentMode=[ 'html5', 'legacy' ]
8678 !! wikitext
8679 [[Foo#<bar>]]
8680 !! html/php
8681 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8682 </p>
8683 !! html/parsoid
8684 <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>
8685 !! end
8686
8687 !! test
8688 Link with angle bracket after anchor (legacy)
8689 !! config
8690 wgFragmentMode=[ 'legacy' ]
8691 !! wikitext
8692 [[Foo#<bar>]]
8693 !! html/php
8694 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8695 </p>
8696 !! end
8697
8698 ###
8699 ### Interwiki links (see maintenance/interwiki.sql)
8700 ###
8701
8702 !! test
8703 Inline interwiki link
8704 !! options
8705 parsoid=wt2html,wt2wt,html2html
8706 !! wikitext
8707 [[MeatBall:SoftSecurity]]
8708 !! html/php
8709 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8710 </p>
8711 !! html/parsoid
8712 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8713 !! end
8714
8715 !! test
8716 Inline interwiki link with empty title (T4372)
8717 !! options
8718 parsoid=wt2html,wt2wt,html2html
8719 !! wikitext
8720 [[MeatBall:]]
8721 !! html/php
8722 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8723 </p>
8724 !! html/parsoid
8725 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8726 !! end
8727
8728 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8729 !! test
8730 Interwiki link encoding conversion (T3636)
8731 !! options
8732 parsoid=wt2html,wt2wt
8733 !! wikitext
8734 *[[Wikipedia:ro:Olteni&#0355;a]]
8735 *[[Wikipedia:ro:Olteni&#355;a]]
8736 !! html
8737 <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>
8738 <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>
8739
8740 !! html/php+tidy
8741 <ul>
8742 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8743 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8744 </ul>
8745 !! html/parsoid
8746 <ul>
8747 <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>
8748 <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>
8749 </ul>
8750 !! end
8751
8752 !! test
8753 Interwiki link with fragment (T4130)
8754 !! wikitext
8755 [[MeatBall:SoftSecurity#foo]]
8756 !! html
8757 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8758 </p>
8759 !! end
8760
8761 !! test
8762 Link scenarios with escaped fragments
8763 !! config
8764 wgFragmentMode=[ 'html5', 'legacy' ]
8765 !! wikitext
8766 [[#Is this great?]]
8767 [[Foo#Is this great?]]
8768 [[meatball:Foo#Is this great?]]
8769 !! html/php
8770 <p><a href="#Is_this_great?">#Is this great?</a>
8771 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8772 <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>
8773 </p>
8774 !! html/parsoid
8775 <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>
8776 <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>
8777 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great?" title="meatball:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great?"},"sa":{"href":"meatball:Foo#Is this great?"},"isIW":true}'>meatball:Foo#Is this great?</a></p>
8778 !! end
8779
8780 !! test
8781 Link scenarios with escaped fragments (legacy)
8782 !! config
8783 wgFragmentMode=[ 'legacy' ]
8784 !! wikitext
8785 [[#Is this great?]]
8786 [[Foo#Is this great?]]
8787 [[meatball:Foo#Is this great?]]
8788 !! html/php
8789 <p><a href="#Is_this_great.3F">#Is this great?</a>
8790 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8791 <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>
8792 </p>
8793 !! end
8794
8795 # Ideally the wikipedia: prefix here should be proto-relative too
8796 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8797 # define the 'en' prefix, and originally the test used 'wikipedia',
8798 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8799 # article.
8800 !! test
8801 Different interwiki prefixes mapping to the same URL
8802 !! wikitext
8803 [[:en:Foo]]
8804
8805 [[:en:Foo|Foo]]
8806
8807 [[wikipedia:Foo]]
8808
8809 [[:wikipedia:Foo|Foo]]
8810
8811 [[wikipedia:en:Foo]]
8812
8813 [[:wikipedia:en:Foo]]
8814
8815 [[ wikiPEdia :Foo]]
8816 !! html/parsoid
8817 <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>
8818
8819 <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>
8820
8821 <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>
8822
8823 <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>
8824
8825 <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>
8826
8827 <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>
8828
8829 <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>
8830 !! end
8831
8832 !! test
8833 Interwiki links that cannot be represented in wiki syntax
8834 !! wikitext
8835 [[meatball:ok]]
8836 [[meatball:ok#foo|ok with fragment]]
8837 [[meatball:ok_as_well?|ok ending with ? mark]]
8838 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8839 [http://de.wikipedia.org/wiki/#foo is just fragment]
8840
8841 !! html/php
8842 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8843 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8844 <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>
8845 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8846 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8847 </p>
8848 !! html/parsoid
8849 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8850 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8851 <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>
8852 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8853 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8854 !! end
8855
8856 !! test
8857 Interwiki links: trail
8858 !! wikitext
8859 [[wikipedia:Foo|Ba]]r
8860 !! html/php
8861 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8862 </p>
8863 !! html/parsoid
8864 <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>
8865 !! end
8866
8867 !! test
8868 Local interwiki link
8869 !! options
8870 parsoid=wt2html,wt2wt,html2html
8871 !! wikitext
8872 [[local:Template:Foo]]
8873 !! html/php
8874 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8875 </p>
8876 !! html/parsoid
8877 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8878 !! end
8879
8880 # Parsoid does not mark self-links, by design.
8881 !! test
8882 Local interwiki link: self-link to current page
8883 !! options
8884 title=[[Main Page]]
8885 parsoid=wt2html,wt2wt,html2html
8886 !! wikitext
8887 [[local:Main Page]]
8888 !! html/php
8889 <p><a class="mw-selflink selflink">local:Main Page</a>
8890 </p>
8891 !! html/parsoid
8892 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8893 !! end
8894
8895 !! test
8896 Local interwiki link: prefix only (T66167)
8897 !! options
8898 parsoid=wt2html,wt2wt,html2html
8899 !! wikitext
8900 [[local:]]
8901 !! html/php
8902 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8903 </p>
8904 !! html/parsoid
8905 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8906 !! end
8907
8908 !! test
8909 Local interwiki link: with additional interwiki prefix (T63357)
8910 !! options
8911 parsoid=wt2html,wt2wt,html2html
8912 !! wikitext
8913 [[local:meatball:Hello]]
8914 !! html/php
8915 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8916 </p>
8917 !! html/parsoid
8918 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8919 !! end
8920
8921 !! test
8922 Multiple local interwiki link prefixes
8923 !! wikitext
8924 [[local:local:local:local:mi:local:Foo]]
8925 !! options
8926 parsoid=wt2html,wt2wt,html2html
8927 !! html/php
8928 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8929 </p>
8930 !! html/parsoid
8931 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8932 !! end
8933
8934 !! test
8935 Interwiki link with percent encoded target
8936 !! wikitext
8937 [[:es:Nueva Guip%C3%BAzcoa|Nueva Guipúzcoa]]
8938 !! html/php
8939 <p><a href="http://es.wikipedia.org/wiki/Nueva_Guip%C3%BAzcoa" class="extiw" title="es:Nueva Guipúzcoa">Nueva Guipúzcoa</a>
8940 </p>
8941 !! html/parsoid
8942 <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>
8943 !! end
8944
8945 ###
8946 ### Interlanguage links
8947 ### Language links (so that searching for '### language' matches..)
8948 ###
8949
8950 !! test
8951 Interlanguage link
8952 !! wikitext
8953 Blah blah blah
8954 [[zh:Chinese]]
8955 !! html/php
8956 <p>Blah blah blah
8957 </p>
8958 !! html/parsoid
8959 <p>Blah blah blah</p>
8960 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8961 !! end
8962
8963 ## parsoid html2wt will lose the space variations
8964 !! test
8965 Interlanguage link with spacing
8966 !! options
8967 parsoid=wt2html,wt2wt,html2html
8968 !! wikitext
8969 Blah blah blah
8970 [[ zh : Chinese ]]
8971 !! html/php
8972 <p>Blah blah blah
8973 </p>
8974 !! html/parsoid
8975 <p>Blah blah blah</p>
8976 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8977 !! end
8978
8979 !! test
8980 Double interlanguage link
8981 !! wikitext
8982 Blah blah blah
8983 [[es:Spanish]]
8984 [[zh:Chinese]]
8985 !! html/php
8986 <p>Blah blah blah
8987 </p>
8988 !! html/parsoid
8989 <p>Blah blah blah</p>
8990 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8991 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8992 !! end
8993
8994 ## parsoid html2wt will lose the space variations
8995 !! test
8996 Interlanguage link variations
8997 !! options
8998 parsoid=wt2html,wt2wt,html2html
8999 !! wikitext
9000 Blah blah blah
9001 [[ es :Spanish]]
9002 [[ ZH :Chinese]]
9003 [[es:Foo_bar]]
9004 !! html/php
9005 <p>Blah blah blah
9006 </p>
9007 !! html/parsoid
9008 <p>Blah blah blah</p>
9009 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
9010 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
9011 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
9012 !! end
9013
9014 !! test
9015 Escaping of interlanguage links (T129218, T156308)
9016 !! wikitext
9017 Blah blah blah
9018 [[:es:Spanish]]
9019 [[ : zh : Chinese ]]
9020 !! html/php
9021 <p>Blah blah blah
9022 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9023 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
9024 </p>
9025 !! html/parsoid
9026 <p>Blah blah blah
9027 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9028 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
9029 !! end
9030
9031 !! test
9032 Multiple colons escaping interlanguage links
9033 !! options
9034 parsoid=wt2html
9035 !! wikitext
9036 [[:es:Spanish]]
9037 [[::es:Spanish]]
9038 [[:::es:Spanish]]
9039 !! html/php
9040 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9041 [[::es:Spanish]]
9042 [[:::es:Spanish]]
9043 </p>
9044 !! html/parsoid
9045 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9046 [[::es:Spanish]]
9047 [[:::es:Spanish]]</p>
9048 !! end
9049
9050 ## parsoid html2wt will normalize the space to _
9051 !! test
9052 Space and question mark encoding in interlanguage links (T95473)
9053 !! options
9054 parsoid=wt2html,wt2wt,html2html
9055 !! wikitext
9056 Blah blah blah
9057 [[es:Foo bar?]]
9058 !! html/php
9059 <p>Blah blah blah
9060 </p>
9061 !! html/parsoid
9062 <p>Blah blah blah</p>
9063 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
9064 !! end
9065
9066 !! test
9067 Interlanguage link, with prefix links
9068 !! options
9069 language=ln
9070 !! wikitext
9071 Blah blah blah
9072 [[zh:Chinese]]
9073 !! html/php
9074 <p>Blah blah blah
9075 </p>
9076 !! html/parsoid
9077 <p>Blah blah blah</p>
9078 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9079 !! end
9080
9081 !! test
9082 Double interlanguage link, with prefix links (T10897)
9083 !! options
9084 language=ln
9085 !! wikitext
9086 Blah blah blah
9087 [[es:Spanish]]
9088 [[zh:Chinese]]
9089 !! html/php
9090 <p>Blah blah blah
9091 </p>
9092 !! html/parsoid
9093 <p>Blah blah blah</p>
9094 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9095 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9096 !! end
9097
9098 !! test
9099 "Extra" interlanguage links (T34189 / gerrit 111390)
9100 !! wikitext
9101 Blah blah blah
9102 [[mul:Article]]
9103 !! html/php
9104 <p>Blah blah blah
9105 </p>
9106 !! html/parsoid
9107 <p>Blah blah blah</p>
9108 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
9109 !! end
9110
9111 ## PHP parser tests script needs an update
9112 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9113 !! test
9114 Language links render as inline links if $wgInterwikiMagic=false
9115 !! options
9116 wgInterwikiMagic=false
9117 parsoid=wt2html,wt2wt,html2html
9118 !! wikitext
9119 Blah blah blah
9120 [[zh:Chinese]]
9121 !! html/parsoid
9122 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9123 !! end
9124
9125 ## PHP parser tests script needs an update
9126 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9127 !! test
9128 Language links render as inline links in the Talk namespace
9129 !! options
9130 title=Talk:Foo
9131 parsoid=wt2html,wt2wt,html2html
9132 !! wikitext
9133 Blah blah blah
9134 [[zh:Chinese]]
9135 !! html/parsoid
9136 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9137 !! end
9138
9139 !! test
9140 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
9141 !! options
9142 language=ln
9143 !! wikitext
9144 [[WW&nbsp;II]]
9145 !! html
9146 <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>
9147 </p>
9148 !! end
9149
9150 !! test
9151 Parsoid T55221: Wikilinks should be properly entity-escaped
9152 !! options
9153 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
9154 !! html/parsoid
9155 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9156 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9157 !! wikitext
9158 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
9159
9160 He&amp;nbsp;llo He&amp;nbsp;llo
9161 !! html/php
9162 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
9163 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
9164 </p>
9165 !! end
9166
9167 # html2wt will fail because of title normalization without data-parsoid
9168 !! test
9169 Parsoid: handle constructor well
9170 !! options
9171 parsoid=wt2html,wt2wt
9172 !! wikitext
9173 [[constructor]]
9174
9175 [[constructor:foo]]
9176 !! html/php
9177 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9178 </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>
9179 </p>
9180 !! html/parsoid
9181 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9182
9183 <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>
9184 !! end
9185
9186 !! test
9187 Template parameter named "constructor"
9188 !! wikitext
9189 {{echo| constructor = |hi}}
9190 !! html/parsoid
9191 <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>
9192 !! end
9193
9194 !! article
9195 ko:
9196 !! text
9197 Test.
9198 !! endarticle
9199
9200 # Note that `ko` isn't a known interlanguage prefix
9201 !! test
9202 Parsoid: recognize interlanguage links without a target page
9203 !! options
9204 ill
9205 !! wikitext
9206 [[es:]]
9207
9208 [[ko:]]
9209 !! html/php
9210 es:
9211 !! html/parsoid
9212 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9213
9214 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9215 !! end
9216
9217 # Note that `ko` isn't a known interwiki prefix
9218 !! test
9219 Parsoid: recognize interwiki links without a target page
9220 !! options
9221 parsoid=wt2html,wt2wt,html2html
9222 !! wikitext
9223 [[:es:]]
9224
9225 [[:ko:]]
9226 !! html/php
9227 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9228 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9229 </p>
9230 !! html/parsoid
9231 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9232 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9233 !! end
9234
9235 !! test
9236 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9237 !! wikitext
9238 [[mi:Foo]]
9239 !! html/php
9240 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9241 </p>
9242 !! html/parsoid
9243 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9244 !! end
9245
9246 !! test
9247 Interlanguage link with preceding local interwiki link (T70085)
9248 !! options
9249 parsoid=wt2html,wt2wt,html2html
9250 !! wikitext
9251 Blah blah blah
9252 [[local:es:Spanish]]
9253 !! html/php
9254 <p>Blah blah blah
9255 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9256 </p>
9257 !! html/parsoid
9258 <p>Blah blah blah
9259 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9260 !! end
9261
9262 !! test
9263 Looks like an interlanguage link, but is actually a local interwiki
9264 !! options
9265 parsoid=wt2html,wt2wt,html2html
9266 !! wikitext
9267 Blah blah blah
9268 [[mi:Template:Foo]]
9269 !! html/php
9270 <p>Blah blah blah
9271 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9272 </p>
9273 !! html/parsoid
9274 <p>Blah blah blah
9275 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9276 !! end
9277
9278 ###
9279 ### Redirects, Parsoid-only
9280 ###
9281
9282 !! test
9283 1. Simple redirect to page
9284 !! wikitext
9285 #REDIRECT [[Main Page]]
9286 !! html/parsoid
9287 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9288 !! end
9289
9290 !! test
9291 2. Other redirect variants
9292 !! wikitext
9293 #REDIRECT [[Main_Page]]
9294 !! html/parsoid
9295 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9296 !! end
9297
9298 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9299 # This tests the Parsoid bail-out code.
9300 !! test
9301 3. Other redirect variants
9302 !! options
9303 parsoid=wt2html
9304 !! wikitext
9305 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9306 !! html/parsoid
9307 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9308 !! end
9309
9310 !! test
9311 4. Redirect to a templated destination
9312 !! wikitext
9313 #REDIRECT [[{{echo|Foo}}bar]]
9314 !! html/parsoid
9315 <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"}]]}'/>
9316 !! end
9317
9318 !! test
9319 Empty redirect
9320 !! options
9321 parsoid=wt2html,wt2wt
9322 !! wikitext
9323 #REDIRECT [[]]
9324 !! html/parsoid
9325 <ol>
9326 <li>REDIRECT [[]]</li></ol>
9327 !! end
9328
9329 !! test
9330 Optional colon in #REDIRECT
9331 !! options
9332 # the colon is archaic syntax. we support it for wt2html, but we
9333 # don't care that it roundtrips back to the modern syntax.
9334 parsoid=wt2html,html2html
9335 !! wikitext
9336 #REDIRECT:[[Main Page]]
9337 !! html/parsoid
9338 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9339 !! end
9340
9341 !! test
9342 Whitespace in #REDIRECT with optional colon
9343 !! options
9344 # the colon and gratuitous whitespace is archaic syntax. we support
9345 # it for wt2html, but we don't care that it roundtrips back to the
9346 # modern syntax (without extra whitespace)
9347 parsoid=wt2html,html2html
9348 !! wikitext
9349
9350 #REDIRECT
9351 :
9352 [[Main Page]]
9353 !! html/parsoid
9354 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9355 !! end
9356
9357 !! test
9358 Piped link in #REDIRECT
9359 !! options
9360 # content after piped link is ignored. we support this syntax,
9361 # but don't care that the piped link is lost when we roundtrip this.
9362 parsoid=wt2html
9363 !! wikitext
9364 #REDIRECT [[Main Page|bar]]
9365 !! html/parsoid
9366 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9367 !! end
9368
9369 !! test
9370 Redirect to category (T104502)
9371 !! options
9372 parsoid=wt2html,wt2wt
9373 !! wikitext
9374 #REDIRECT [[Category:Foo]]
9375 !! html/parsoid
9376 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9377 !! end
9378
9379 !! test
9380 Redirect to category with URL encoding (T104502)
9381 !! options
9382 parsoid=wt2html
9383 !! wikitext
9384 #REDIRECT [[Category%3AFoo]]
9385 !! html/parsoid
9386 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9387 !! end
9388
9389 !! test
9390 Redirect to category page
9391 !! wikitext
9392 #REDIRECT [[:Category:Foo]]
9393 !! html/parsoid
9394 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9395 !! end
9396
9397 !! test
9398 Redirect to image page (1)
9399 !! wikitext
9400 #REDIRECT [[File:Wiki.png]]
9401 !! html/parsoid
9402 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9403 !! end
9404
9405 !! test
9406 Redirect to image page (2)
9407 !! wikitext
9408 #REDIRECT [[Image:Wiki.png]]
9409 !! html/parsoid
9410 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9411 !! end
9412
9413 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9414 # Next test confirms this.
9415 !! test
9416 Redirect to language (1) (T104918)
9417 !! options
9418 parsoid=wt2html,wt2wt,html2html
9419 !! wikitext
9420 #REDIRECT [[en:File:Wiki.png]]
9421 !! html/parsoid
9422 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9423 !! end
9424
9425 !! test
9426 Redirect to language (2) (T104918)
9427 !! wikitext
9428 #REDIRECT [[:en:File:Wiki.png]]
9429 !! html/parsoid
9430 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9431 !! end
9432
9433 !! test
9434 Redirect to interwiki (T104918)
9435 !! wikitext
9436 #REDIRECT [[meatball:File:Wiki.png]]
9437 !! html/parsoid
9438 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9439 !! end
9440
9441 !! test
9442 Non-English #REDIRECT
9443 !! options
9444 language=is
9445 !! wikitext
9446 #TILVÍSUN [[Main Page]]
9447 !! html/parsoid
9448 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9449 !! end
9450
9451 !! test
9452 Redirect syntax under text isn't considered a redirect
9453 !! wikitext
9454 some text
9455
9456 #redirect [[Main Page]]
9457 !! html/parsoid
9458 <p>some text</p>
9459 <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>
9460 !! end
9461
9462 !! test
9463 New redirect
9464 !! options
9465 parsoid=html2wt
9466 !! html/parsoid
9467 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9468 !! wikitext
9469 #REDIRECT [[Foo]]
9470 Foo
9471 !! end
9472
9473 !! test
9474 Redirect followed by block on the same line
9475 !! options
9476 parsoid=wt2html
9477 !! wikitext
9478 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9479 !! html/parsoid
9480 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9481 !! end
9482
9483 !! test
9484 Redirect followed by a newline
9485 !! wikitext
9486 #REDIRECT [[Main Page]]
9487 A newline
9488 !! html/parsoid
9489 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9490 <p>A newline</p>
9491 !! end
9492
9493 !! test
9494 Redirect followed by multiple newlines
9495 !! wikitext
9496 #REDIRECT [[Main Page]]
9497
9498
9499 A newline
9500 !! html/parsoid
9501 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9502
9503 <p><br/>
9504 A newline</p>
9505 !! end
9506
9507 !! test
9508 Drop duplicate redirects
9509 !! options
9510 parsoid=html2wt
9511 !! html/parsoid
9512 <link rel="mw:PageProp/redirect" href="./Foo"/>
9513 <link rel="mw:PageProp/redirect" href="./Bar"/>
9514 <link rel="mw:PageProp/redirect" href="./Baz"/>
9515 !! wikitext
9516 #REDIRECT [[Foo]]
9517 !! end
9518
9519 ##
9520 ## XHTML tidiness
9521 ###
9522
9523 !! test
9524 <br> to <br />
9525 !! wikitext
9526 1<br>2<br />3
9527 !! html
9528 <p>1<br />2<br />3
9529 </p>
9530 !! end
9531
9532 !! test
9533 Broken br tag sanitization
9534 !! wikitext
9535 </br>
9536 !! html/php
9537 <p>&lt;/br&gt;
9538 </p>
9539 !! end
9540
9541 # TODO: Fix html2html mode (T53055)!
9542 !! test
9543 Parsoid: Broken br tag recognition
9544 !! options
9545 parsoid=wt2html
9546 !! wikitext
9547 </br>
9548
9549 <br/ >
9550 !! html+tidy
9551 <p><br />
9552 </p><p><br />
9553 </p>
9554 !! end
9555
9556 !! test
9557 Incorrecly removing closing slashes from correctly formed XHTML
9558 !! wikitext
9559 <br style="clear:both;" />
9560 !! html
9561 <p><br style="clear:both;" />
9562 </p>
9563 !! end
9564
9565 !! test
9566 Failing to transform badly formed HTML into correct XHTML
9567 !! wikitext
9568 <br style="clear: left;">
9569 <br style="clear: right;">
9570 <br style="clear: both;">
9571 !! html
9572 <p><br style="clear: left;" />
9573 <br style="clear: right;" />
9574 <br style="clear: both;" />
9575 </p>
9576 !!end
9577
9578 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9579 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9580 !! test
9581 Handling html with a div self-closing tag
9582 !! wikitext
9583 <div title />
9584 <div title/>
9585 <div title/ >
9586 <div title=bar />
9587 <div title=bar/>
9588 <div title=bar/ >
9589 !! html/php
9590 <p>&lt;div title /&gt;
9591 &lt;div title/&gt;
9592 </p>
9593 <div>
9594 <p>&lt;div title=bar /&gt;
9595 &lt;div title=bar/&gt;
9596 </p>
9597 <div title="bar/"></div>
9598 </div>
9599
9600 !! html/parsoid
9601 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9602 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9603 <div title="" data-parsoid='{"stx":"html","autoInsertedEnd":true}'>
9604 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9605 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9606 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div></div>
9607 !! end
9608
9609 !! test
9610 Elements with solidus in various attribute positions
9611 !! options
9612 parsoid=wt2html,html2html
9613 !! wikitext
9614 <div cla/ss="123">ha</div>
9615
9616 <div / class="123">ha</div>
9617
9618 <div class= / "123">ha</div>
9619 !! html/php+tidy
9620 <div>ha</div>
9621 <div class="123">ha</div>
9622 <div class="/">ha</div>
9623 !! html/parsoid
9624 <div data-parsoid='{"stx":"html","a":{"cla":null,"ss":null},"sa":{"cla":"","ss":"123"}}'>ha</div>
9625
9626 <div class="123" data-parsoid='{"stx":"html"}'>ha</div>
9627
9628 <div class="/" data-parsoid='{"stx":"html","a":{"\"123\"":null},"sa":{"\"123\"":""}}'>ha</div>
9629 !! end
9630
9631 !! test
9632 Handling html with a br self-closing tag
9633 !! wikitext
9634 <br title />
9635 <br title/>
9636 <br title/ >
9637 <br title=bar />
9638 <br title=bar/>
9639 <br title=bar/ >
9640 !! html/php
9641 <p><br title="" />
9642 <br title="" />
9643 <br />
9644 <br title="bar" />
9645 <br title="bar" />
9646 <br title="bar/" />
9647 </p>
9648 !! html/parsoid
9649 <p><br title="" />
9650 <br title="" />
9651 <br title="" />
9652 <br title="bar" />
9653 <br title="bar" />
9654 <br title="bar/" />
9655 </p>
9656 !! end
9657
9658 !! test
9659 Horizontal ruler (should it add that extra space?)
9660 !! wikitext
9661 <hr>
9662 <hr >
9663 foo <hr
9664 > bar
9665 !! html+tidy
9666 <hr />
9667 <hr /><p>
9668 foo </p><hr /><p> bar
9669 </p>
9670 !! end
9671
9672 !! test
9673 Horizontal ruler -- 4+ dashes render hr
9674 !! wikitext
9675 ----
9676 !! html
9677 <hr />
9678
9679 !! end
9680
9681 !! test
9682 Horizontal ruler -- eats additional dashes on the same line
9683 !! wikitext
9684 ---------
9685 !! html
9686 <hr />
9687
9688 !! end
9689
9690 !! test
9691 Horizontal ruler -- does not collapse dashes on consecutive lines
9692 !! wikitext
9693 ----
9694 ----
9695 !! html
9696 <hr />
9697 <hr />
9698
9699 !! end
9700
9701 !! test
9702 Horizontal ruler -- <4 dashes render as plain text
9703 !! wikitext
9704 ---
9705 !! html
9706 <p>---
9707 </p>
9708 !! end
9709
9710 !! test
9711 Horizontal ruler -- Supports content following dashes on same line
9712 !! wikitext
9713 ---- Foo
9714 !! html
9715 <hr /> Foo
9716
9717 !! html+tidy
9718 <hr /><p> Foo
9719 </p>
9720 !! end
9721
9722 ###
9723 ### Block-level elements
9724 ###
9725 !! test
9726 Common list
9727 !! wikitext
9728 *Common list
9729 *item 2
9730 *item 3
9731 !! html
9732 <ul><li>Common list</li>
9733 <li>item 2</li>
9734 <li>item 3</li></ul>
9735
9736 !! end
9737
9738 !! test
9739 Numbered list
9740 !! wikitext
9741 #Numbered list
9742 #item 2
9743 #item 3
9744 !! html
9745 <ol><li>Numbered list</li>
9746 <li>item 2</li>
9747 <li>item 3</li></ol>
9748
9749 !! end
9750
9751 # the switch from level 3 to ordered should not introduce a newline between
9752 !! test
9753 Mixed list
9754 !! wikitext
9755 *Mixed list
9756 *#with numbers
9757 **and bullets
9758 *#and numbers
9759 *bullets again
9760 **bullet level 2
9761 ***bullet level 3
9762 ***#Number on level 4
9763 **bullet level 2
9764 **#Number on level 3
9765 **#Number on level 3
9766 *#number level 2
9767 *Level 1
9768 ***Level 3
9769 #**Level 3, but ordered
9770 !! html
9771 <ul><li>Mixed list
9772 <ol><li>with numbers</li></ol>
9773 <ul><li>and bullets</li></ul>
9774 <ol><li>and numbers</li></ol></li>
9775 <li>bullets again
9776 <ul><li>bullet level 2
9777 <ul><li>bullet level 3
9778 <ol><li>Number on level 4</li></ol></li></ul></li>
9779 <li>bullet level 2
9780 <ol><li>Number on level 3</li>
9781 <li>Number on level 3</li></ol></li></ul>
9782 <ol><li>number level 2</li></ol></li>
9783 <li>Level 1
9784 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9785 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9786
9787 !! end
9788
9789 !! test
9790 1. Nested mixed wikitext and html list
9791 !! wikitext
9792 *hi
9793 *<ul><li>ho</li></ul>
9794 *hi
9795 **ho
9796 !! html/php
9797 <ul><li>hi</li>
9798 <li><ul><li>ho</li></ul></li>
9799 <li>hi
9800 <ul><li>ho</li></ul></li></ul>
9801
9802 !! html/parsoid
9803 <ul><li>hi</li>
9804 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9805 <li>hi
9806 <ul><li>ho</li></ul></li></ul>
9807 !! end
9808
9809 !! test
9810 2. Nested mixed wikitext and html list (incompatible)
9811 !! wikitext
9812 ;hi
9813 :{{echo|<li>ho</li>}}
9814 !! html/php
9815 <dl><dt>hi</dt>
9816 <dd><li>ho</li></dd></dl>
9817
9818 !! html/parsoid
9819 <dl><dt>hi</dt>
9820 <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>
9821 !! end
9822
9823 !! test
9824 Nested lists 1
9825 !! wikitext
9826 *foo
9827 **bar
9828 !! html
9829 <ul><li>foo
9830 <ul><li>bar</li></ul></li></ul>
9831
9832 !! end
9833
9834 !! test
9835 Nested lists 2
9836 !! wikitext
9837 **foo
9838 *bar
9839 !! html
9840 <ul><li><ul><li>foo</li></ul></li>
9841 <li>bar</li></ul>
9842
9843 !! end
9844
9845 !! test
9846 Nested lists 3 (first element empty)
9847 !! wikitext
9848 *
9849 **bar
9850 !! html
9851 <ul><li>
9852 <ul><li>bar</li></ul></li></ul>
9853
9854 !! end
9855
9856 !! test
9857 Nested lists 4 (first element empty)
9858 !! wikitext
9859 **
9860 *bar
9861 !! html
9862 <ul><li><ul><li></li></ul></li>
9863 <li>bar</li></ul>
9864
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
9876 !! end
9877
9878 !! test
9879 Nested lists 6 (both elements empty)
9880 !! wikitext
9881 *
9882 **
9883 !! html
9884 <ul><li>
9885 <ul><li></li></ul></li></ul>
9886
9887 !! end
9888
9889 !! test
9890 Nested lists 7 (skip initial nesting levels)
9891 !! wikitext
9892 ***foo
9893 !! html
9894 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9895
9896 !! end
9897
9898 !! test
9899 Nested lists 8 (multiple nesting transitions)
9900 !! wikitext
9901 *foo
9902 ***bar
9903 **baz
9904 *boo
9905 !! html
9906 <ul><li>foo
9907 <ul><li><ul><li>bar</li></ul></li>
9908 <li>baz</li></ul></li>
9909 <li>boo</li></ul>
9910
9911 !! end
9912
9913 !! test
9914 Nested lists 9 (extension interaction)
9915 !! options
9916 parsoid
9917 !! wikitext
9918 *<references />
9919 !! html/parsoid
9920 <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>
9921 !! end
9922
9923 !! test
9924 1. Lists with start-of-line-transparent tokens before bullets: Comments
9925 !! wikitext
9926 *foo
9927 *<!--cmt-->bar
9928 <!--cmt-->*baz
9929 !! html
9930 <ul><li>foo</li>
9931 <li>bar</li>
9932 <li>baz</li></ul>
9933
9934 !! end
9935
9936 !! test
9937 Nested lists 10 (list and span siblings: wt2wt regression)
9938 !! wikitext
9939 *a <span>x</span>
9940 **b <span>y</span>
9941 !! html/parsoid
9942 <ul><li>a <span>x</span>
9943 <ul><li>b <span>y</span></li></ul></li></ul>
9944 !! end
9945
9946 !! test
9947 2. Lists with start-of-line-transparent tokens before bullets: Template close
9948 !! wikitext
9949 *foo {{echo|bar
9950 }}*baz
9951 !! html
9952 <ul><li>foo bar</li>
9953 <li>baz</li></ul>
9954
9955 !! end
9956
9957 !! test
9958 List items are not parsed correctly following a <pre> block (T2785)
9959 !! wikitext
9960 *<pre>foo</pre>
9961 *<pre>bar</pre>
9962 *zar
9963 !! html/php
9964 <ul><li><pre>foo</pre></li>
9965 <li><pre>bar</pre></li>
9966 <li>zar</li></ul>
9967
9968 !! html/parsoid
9969 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9970 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9971 <li>zar</li></ul>
9972 !! end
9973
9974 # FIXME: Might benefit from a html/parsoid since this has a template
9975 !! test
9976 List items from template
9977 !! wikitext
9978
9979 {{inner list}}
9980 *item 2
9981
9982 *item 0
9983 {{inner list}}
9984 *item 2
9985
9986 *item 0
9987 *notSOL{{inner list}}
9988 *item 2
9989 !! html
9990 <ul><li>item 1</li>
9991 <li>item 2</li></ul>
9992 <ul><li>item 0</li>
9993 <li>item 1</li>
9994 <li>item 2</li></ul>
9995 <ul><li>item 0</li>
9996 <li>notSOL</li>
9997 <li>item 1</li>
9998 <li>item 2</li></ul>
9999
10000 !! end
10001
10002 !! test
10003 List interrupted by empty line or heading
10004 !! wikitext
10005 *foo
10006
10007 **bar
10008 ==A heading==
10009 *Another list item
10010 !! html
10011 <ul><li>foo</li></ul>
10012 <ul><li><ul><li>bar</li></ul></li></ul>
10013 <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>
10014 <ul><li>Another list item</li></ul>
10015
10016 !!end
10017
10018 !! test
10019 Multiple list tags generated by templates
10020 !! wikitext
10021 {{echo|<li>}}a
10022 {{echo|<li>}}b
10023 {{echo|<li>}}c
10024 !! html
10025 <li>a
10026 <li>b
10027 <li>c</li>
10028 </li>
10029 </li>
10030
10031
10032 !! html+tidy
10033 <li>a
10034 </li><li>b
10035 </li><li>c
10036 </li>
10037 !! html/parsoid
10038 <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>
10039 <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>
10040 <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>
10041 !! end
10042
10043 !! test
10044 Multiple newlines in between HTML list items don't induce paragraph wrapping
10045 !! wikitext
10046 <ul>
10047 <li>hi</li>
10048
10049
10050
10051
10052 <li>ho</li>
10053 </ul>
10054
10055 <dl>
10056 <dt>hi</dt>
10057 <dd>ho<div>123</div>
10058 </dd>
10059
10060
10061 </dl>
10062 !! html/php+tidy
10063 <ul>
10064 <li>hi</li>
10065
10066
10067
10068
10069 <li>ho</li>
10070 </ul>
10071 <dl>
10072 <dt>hi</dt>
10073 <dd>ho<div>123</div>
10074 </dd>
10075
10076
10077 </dl>
10078 !! end
10079
10080 !!test
10081 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
10082 !! wikitext
10083 *a
10084 <!--This line will NOT split the list-->
10085 *b
10086 <!--This line will NOT split the list either-->
10087 *c
10088 <!--foo--> <!----> <!--This line NOT split the list either-->
10089 *d
10090 !! html
10091 <ul><li>a</li>
10092 <li>b</li>
10093 <li>c</li>
10094 <li>d</li></ul>
10095
10096 !!end
10097
10098 !!test
10099 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
10100 !! wikitext
10101 *a
10102 <!--This line will NOT split the list-->
10103 *b
10104 <!--This line will NOT split the list either-->
10105 *c
10106 <!--foo--> <!----> <!--This line NOT split the list
10107 either-->
10108 *d
10109 !! html
10110 <ul><li>a</li>
10111 <li>b</li>
10112 <li>c</li>
10113 <li>d</li></ul>
10114
10115 !!end
10116
10117 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
10118 # That pass could possibly be removed.
10119 !!test
10120 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
10121 !!options
10122 parsoid=wt2html,wt2wt
10123 !! wikitext
10124 *foo
10125 *<li>li-hack
10126 *{{echo|<li>templated li-hack}}
10127 *<!--foo--><li> unsupported li-hack with preceding comments
10128
10129 <ul>
10130 <li><li>not a li-hack
10131 </li>
10132 </ul>
10133 !! html+tidy
10134 <ul><li>foo</li>
10135 <li class="mw-empty-elt"></li><li>li-hack</li>
10136 <li class="mw-empty-elt"></li><li>templated li-hack</li>
10137 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
10138 <ul>
10139 <li class="mw-empty-elt"></li><li>not a li-hack
10140 </li>
10141 </ul>
10142 !! html/parsoid
10143 <ul><li> foo</li>
10144 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
10145 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["*",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>templated li-hack"}},"i":0}}]}'>templated li-hack</li>
10146 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
10147
10148 <ul data-parsoid='{"stx":"html"}'>
10149 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
10150 </li>
10151 </ul>
10152
10153 !!end
10154
10155 !! test
10156 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
10157 !! options
10158 parsoid
10159 !! wikitext
10160 #foo
10161 ##bar
10162
10163 *foo
10164 **bar
10165
10166 :foo
10167 ::bar
10168 !! html
10169 <ol>
10170 <li>foo<ol>
10171 <li>bar</li>
10172 </ol></li>
10173 </ol><ul>
10174 <li>foo<ul>
10175 <li>bar</li>
10176 </ul></li>
10177 </ul><dl>
10178 <dd>foo<dl>
10179 <dd>bar</dd>
10180 </dl></dd>
10181 </dl>
10182 !! end
10183
10184 !! test
10185 Parsoid: Test of whitespace serialization with Templated bullets
10186 !! options
10187 parsoid=wt2html
10188 !! wikitext
10189 * {{bullet}}
10190 !! html/parsoid
10191 <ul>
10192 <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>
10193 </ul>
10194 !! end
10195
10196 # ------------------------------------------------------------------------
10197 # The next set of tests are about Parsoid's ability to handle badly nested
10198 # tags (parse, minimize scope of fixup, and roundtrip back)
10199 # ------------------------------------------------------------------------
10200
10201 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
10202 # Parsoid's list handling is more aware of block structure.
10203 !! test
10204 Unbalanced closing block tags break a list
10205 !! wikitext
10206 <div>
10207 *a</div><div>
10208 *b</div>
10209 !! html+tidy
10210 <div>
10211 <ul><li>a</li></ul></div><div>
10212 <li>b</li></div>
10213 !! html/parsoid
10214 <div><ul>
10215 <li>a</li>
10216 </ul></div>
10217 <div><ul>
10218 <li>b</li>
10219 </ul></div>
10220 !! end
10221
10222 !! test
10223 Unbalanced closing non-block tags don't break a list
10224 !! options
10225 parsoid=wt2html,html2html
10226 !! wikitext
10227 <span>
10228 *a</span><span>
10229 *b</span>
10230 !! html/php+tidy
10231 <p><span>
10232 </span></p>
10233 <ul><li>a<span></span></li>
10234 <li>b</li></ul>
10235 !! html/parsoid
10236 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></p>
10237 <ul><li>a<span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></li>
10238 <li>b</li></ul>
10239 !! end
10240
10241 # Parsoid does some post-dom-building cleanup
10242 # which is why its output differs from Remex.
10243 !! test
10244 Unclosed formatting tags that straddle lists are closed and reopened
10245 !! options
10246 parsoid=wt2html,wt2wt,html2html
10247 !! wikitext
10248 #<s> a
10249 #b </s>
10250 !! html/php+tidy
10251 <ol><li><s> a</s></li><s>
10252 </s><li><s>b </s></li></ol>
10253 !! html/parsoid
10254 <ol><li><s> a</s></li>
10255 <li><s>b </s></li></ol>
10256 !! end
10257
10258 # Output is ugly because of all the misnested tag fixups.
10259 !! test
10260 1. List embedded in a formatting tag
10261 !! wikitext
10262 <small>
10263 *foo
10264 </small>
10265 !! html/php+tidy
10266 <p><small>
10267 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10268 </p>
10269 !! html/parsoid
10270 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
10271 <ul><li data-parsoid='{}'>foo</li></ul></small>
10272 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p>
10273 !! end
10274
10275 # Output is ugly because of all the misnested tag fixups.
10276 !! test
10277 2. List embedded in a formatting tag in a misnested way
10278 !! wikitext
10279 <small>
10280 *a
10281 *b</small>
10282 !! html/php+tidy
10283 <p><small>
10284 </small></p><small></small><ul><small><li>a</li>
10285 </small><li><small>b</small></li></ul>
10286 !! html/parsoid
10287 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10288 <ul><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'><li>a</li></small>
10289 <li><small data-parsoid='{"stx":"html","autoInsertedStart":true}'>b</small></li></ul>
10290 !! end
10291
10292 # Output is ugly because of all the misnested tag fixups.
10293 !! test
10294 3. List embedded in a formatting tag in a misnested way
10295 !! wikitext
10296 <small>
10297
10298 ** 123</small>
10299 !! html/php+tidy
10300 <p><small>
10301 </small></p><small></small><ul><small></small><li><small></small><ul><small></small><li><small>123</small></li></ul></li></ul>
10302 !! html/parsoid
10303 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10304
10305 <ul><li><ul><li data-parsoid='{}'><small data-parsoid='{"stx":"html","autoInsertedStart":true}'> 123</small></li></ul></li></ul>
10306 !! end
10307
10308 ###
10309 ### Magic Words
10310 ###
10311
10312 # Note that the current date is hard-coded as
10313 # 1970-01-01T00:02:03Z (a Thursday)
10314 # when running parser tests. The timezone is also fixed to GMT, so
10315 # local date will be identical to current date.
10316
10317 !! test
10318 Magic Word: {{CURRENTDAY}}
10319 !! wikitext
10320 {{CURRENTDAY}}
10321 !! html
10322 <p>1
10323 </p>
10324 !! end
10325
10326 !! test
10327 Magic Word: {{CURRENTDAY2}}
10328 !! wikitext
10329 {{CURRENTDAY2}}
10330 !! html
10331 <p>01
10332 </p>
10333 !! end
10334
10335 !! test
10336 Magic Word: {{CURRENTDAYNAME}}
10337 !! wikitext
10338 {{CURRENTDAYNAME}}
10339 !! html
10340 <p>Thursday
10341 </p>
10342 !! end
10343
10344 !! test
10345 Magic Word: {{CURRENTDOW}}
10346 !! wikitext
10347 {{CURRENTDOW}}
10348 !! html
10349 <p>4
10350 </p>
10351 !! end
10352
10353 !! test
10354 Magic Word: {{CURRENTMONTH}}
10355 !! wikitext
10356 {{CURRENTMONTH}}
10357 !! html
10358 <p>01
10359 </p>
10360 !! end
10361
10362 !! test
10363 Magic Word: {{CURRENTMONTH1}}
10364 !! wikitext
10365 {{CURRENTMONTH1}}
10366 !! html
10367 <p>1
10368 </p>
10369 !! end
10370
10371 !! test
10372 Magic Word: {{CURRENTMONTHABBREV}}
10373 !! wikitext
10374 {{CURRENTMONTHABBREV}}
10375 !! html
10376 <p>Jan
10377 </p>
10378 !! end
10379
10380 !! test
10381 Magic Word: {{CURRENTMONTHNAME}}
10382 !! wikitext
10383 {{CURRENTMONTHNAME}}
10384 !! html
10385 <p>January
10386 </p>
10387 !! end
10388
10389 !! test
10390 Magic Word: {{CURRENTMONTHNAMEGEN}}
10391 !! wikitext
10392 {{CURRENTMONTHNAMEGEN}}
10393 !! html
10394 <p>January
10395 </p>
10396 !! end
10397
10398 !! test
10399 Magic Word: {{CURRENTTIME}}
10400 !! wikitext
10401 {{CURRENTTIME}}
10402 !! html
10403 <p>00:02
10404 </p>
10405 !! end
10406
10407 !! test
10408 Magic Word: {{CURRENTHOUR}}
10409 !! wikitext
10410 {{CURRENTHOUR}}
10411 !! html
10412 <p>00
10413 </p>
10414 !! end
10415
10416 !! test
10417 Magic Word: {{CURRENTWEEK}} (T6594)
10418 !! wikitext
10419 {{CURRENTWEEK}}
10420 !! html
10421 <p>1
10422 </p>
10423 !! end
10424
10425 !! test
10426 Magic Word: {{CURRENTYEAR}}
10427 !! wikitext
10428 {{CURRENTYEAR}}
10429 !! html
10430 <p>1970
10431 </p>
10432 !! end
10433
10434 !! test
10435 Magic Word: {{CURRENTTIMESTAMP}}
10436 !! wikitext
10437 {{CURRENTTIMESTAMP}}
10438 !! html
10439 <p>19700101000203
10440 </p>
10441 !! end
10442
10443 !! test
10444 Magic Words LOCAL (UTC)
10445 !! wikitext
10446 *{{LOCALMONTH}}
10447 *{{LOCALMONTH1}}
10448 *{{LOCALMONTHNAME}}
10449 *{{LOCALMONTHNAMEGEN}}
10450 *{{LOCALMONTHABBREV}}
10451 *{{LOCALDAY}}
10452 *{{LOCALDAY2}}
10453 *{{LOCALDAYNAME}}
10454 *{{LOCALYEAR}}
10455 *{{LOCALTIME}}
10456 *{{LOCALHOUR}}
10457 *{{LOCALWEEK}}
10458 *{{LOCALDOW}}
10459 *{{LOCALTIMESTAMP}}
10460 !! html
10461 <ul><li>01</li>
10462 <li>1</li>
10463 <li>January</li>
10464 <li>January</li>
10465 <li>Jan</li>
10466 <li>1</li>
10467 <li>01</li>
10468 <li>Thursday</li>
10469 <li>1970</li>
10470 <li>00:02</li>
10471 <li>00</li>
10472 <li>1</li>
10473 <li>4</li>
10474 <li>19700101000203</li></ul>
10475
10476 !! end
10477
10478 !! test
10479 Magic Word: {{FULLPAGENAME}}
10480 !! options
10481 title=[[User:Ævar Arnfjörð Bjarmason]]
10482 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10483 !! wikitext
10484 {{FULLPAGENAME}}
10485 !! html/*
10486 <p>User:Ævar Arnfjörð Bjarmason
10487 </p>
10488 !! end
10489
10490 !! test
10491 Magic Word: {{FULLPAGENAMEE}}
10492 !! options
10493 title=[[User:Ævar Arnfjörð Bjarmason]]
10494 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10495 !! wikitext
10496 {{FULLPAGENAMEE}}
10497 !! html/*
10498 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10499 </p>
10500 !! end
10501
10502 !! test
10503 Magic Word: {{TALKSPACE}}
10504 !! options
10505 title=[[User:Ævar Arnfjörð Bjarmason]]
10506 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10507 !! wikitext
10508 {{TALKSPACE}}
10509 !! html/*
10510 <p>User talk
10511 </p>
10512 !! end
10513
10514 !! test
10515 Magic Word: {{TALKSPACE}}, same namespace
10516 !! options
10517 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10518 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10519 !! wikitext
10520 {{TALKSPACE}}
10521 !! html/*
10522 <p>User talk
10523 </p>
10524 !! end
10525
10526 !! test
10527 Magic Word: {{TALKSPACE}}, main namespace
10528 !! options
10529 title=[[Parser Test]]
10530 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10531 !! wikitext
10532 {{TALKSPACE}}
10533 !! html/*
10534 <p>Talk
10535 </p>
10536 !! end
10537
10538 !! test
10539 Magic Word: {{TALKSPACEE}}
10540 !! options
10541 title=[[User:Ævar Arnfjörð Bjarmason]]
10542 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10543 !! wikitext
10544 {{TALKSPACEE}}
10545 !! html/*
10546 <p>User_talk
10547 </p>
10548 !! end
10549
10550 !! test
10551 Magic Word: {{SUBJECTSPACE}}
10552 !! options
10553 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10554 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10555 !! wikitext
10556 {{SUBJECTSPACE}}
10557 !! html/*
10558 <p>User
10559 </p>
10560 !! end
10561
10562 !! test
10563 Magic Word: {{SUBJECTSPACE}}, same namespace
10564 !! options
10565 title=[[User:Ævar Arnfjörð Bjarmason]]
10566 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10567 !! wikitext
10568 {{SUBJECTSPACE}}
10569 !! html/*
10570 <p>User
10571 </p>
10572 !! end
10573
10574 !! test
10575 Magic Word: {{SUBJECTSPACE}}, main namespace
10576 !! options
10577 title=[[Parser Test]]
10578 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10579 !! wikitext
10580 {{SUBJECTSPACE}}
10581 !! html/*
10582
10583 !! end
10584
10585 !! test
10586 Magic Word: {{SUBJECTSPACEE}}
10587 !! options
10588 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10589 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10590 !! wikitext
10591 {{SUBJECTSPACEE}}
10592 !! html/*
10593 <p>User
10594 </p>
10595 !! end
10596
10597 !! test
10598 Magic Word: {{NAMESPACE}}
10599 !! options
10600 title=[[User:Ævar Arnfjörð Bjarmason]]
10601 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10602 !! wikitext
10603 {{NAMESPACE}}
10604 !! html/*
10605 <p>User
10606 </p>
10607 !! end
10608
10609 !! test
10610 Magic Word: {{NAMESPACEE}}
10611 !! options
10612 title=[[User:Ævar Arnfjörð Bjarmason]]
10613 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10614 !! wikitext
10615 {{NAMESPACEE}}
10616 !! html/*
10617 <p>User
10618 </p>
10619 !! end
10620
10621 !! test
10622 Magic Word: {{NAMESPACENUMBER}}
10623 !! options
10624 title=[[User:Ævar Arnfjörð Bjarmason]]
10625 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10626 !! wikitext
10627 {{NAMESPACENUMBER}}
10628 !! html/*
10629 <p>2
10630 </p>
10631 !! end
10632
10633 !! test
10634 Magic Word: {{SUBPAGENAME}}
10635 !! options
10636 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10637 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10638 !! wikitext
10639 {{SUBPAGENAME}}
10640 !! html/*
10641 <p>sub ö
10642 </p>
10643 !! end
10644
10645 !! test
10646 Magic Word: {{SUBPAGENAMEE}}
10647 !! options
10648 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10649 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10650 !! wikitext
10651 {{SUBPAGENAMEE}}
10652 !! html/*
10653 <p>sub_%C3%B6
10654 </p>
10655 !! end
10656
10657 !! test
10658 Magic Word: {{ROOTPAGENAME}}
10659 !! options
10660 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10661 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10662 !! wikitext
10663 {{ROOTPAGENAME}}
10664 !! html/*
10665 <p>Ævar Arnfjörð Bjarmason
10666 </p>
10667 !! end
10668
10669 !! test
10670 Magic Word: {{ROOTPAGENAMEE}}
10671 !! options
10672 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10673 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10674 !! wikitext
10675 {{ROOTPAGENAMEE}}
10676 !! html/*
10677 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10678 </p>
10679 !! end
10680
10681 !! test
10682 Magic Word: {{BASEPAGENAME}}
10683 !! options
10684 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10685 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10686 !! wikitext
10687 {{BASEPAGENAME}}
10688 !! html/*
10689 <p>Ævar Arnfjörð Bjarmason
10690 </p>
10691 !! end
10692
10693 !! test
10694 Magic Word: {{BASEPAGENAMEE}}
10695 !! options
10696 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10697 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10698 !! wikitext
10699 {{BASEPAGENAMEE}}
10700 !! html/*
10701 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10702 </p>
10703 !! end
10704
10705 !! test
10706 Magic Word: {{TALKPAGENAME}}
10707 !! options
10708 title=[[User:Ævar Arnfjörð Bjarmason]]
10709 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10710 !! wikitext
10711 {{TALKPAGENAME}}
10712 !! html/*
10713 <p>User talk:Ævar Arnfjörð Bjarmason
10714 </p>
10715 !! end
10716
10717 !! test
10718 Magic Word: {{TALKPAGENAMEE}}
10719 !! options
10720 title=[[User:Ævar Arnfjörð Bjarmason]]
10721 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10722 !! wikitext
10723 {{TALKPAGENAMEE}}
10724 !! html/*
10725 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10726 </p>
10727 !! end
10728
10729 !! test
10730 Magic Word: {{SUBJECTPAGENAME}}
10731 !! options
10732 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10733 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10734 !! wikitext
10735 {{SUBJECTPAGENAME}}
10736 !! html/*
10737 <p>User:Ævar Arnfjörð Bjarmason
10738 </p>
10739 !! end
10740
10741 !! test
10742 Magic Word: {{SUBJECTPAGENAMEE}}
10743 !! options
10744 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10745 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10746 !! wikitext
10747 {{SUBJECTPAGENAMEE}}
10748 !! html/*
10749 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10750 </p>
10751 !! end
10752
10753 !! test
10754 Magic Word: {{NUMBEROFFILES}}
10755 !! options
10756 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10757 !! wikitext
10758 {{NUMBEROFFILES}}
10759 !! html/*
10760 <p>7
10761 </p>
10762 !! end
10763
10764 !! test
10765 Magic Word: {{PAGENAME}}
10766 !! options
10767 title=[[User:Ævar Arnfjörð Bjarmason]]
10768 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10769 !! wikitext
10770 {{PAGENAME}}
10771 !! html/*
10772 <p>Ævar Arnfjörð Bjarmason
10773 </p>
10774 !! end
10775
10776 !! test
10777 Magic Word: {{PAGENAME}} with metacharacters
10778 !! options
10779 title=[['foo & bar = baz']]
10780 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10781 !! wikitext
10782 ''{{PAGENAME}}''
10783 !! html+tidy
10784 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10785 </p>
10786 !! end
10787
10788 !! test
10789 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10790 !! options
10791 title=[[*RFC 1234 http://example.com/]]
10792 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10793 !! wikitext
10794 {{PAGENAME}}
10795 !! html+tidy
10796 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10797 </p>
10798 !! end
10799
10800 !! test
10801 Magic Word: {{PAGENAMEE}}
10802 !! options
10803 title=[[User:Ævar Arnfjörð Bjarmason]]
10804 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10805 !! wikitext
10806 {{PAGENAMEE}}
10807 !! html/*
10808 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10809 </p>
10810 !! end
10811
10812 !! test
10813 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10814 !! options
10815 title=[[*RFC 1234 http://example.com/]]
10816 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10817 !! wikitext
10818 {{PAGENAMEE}}
10819 !! html+tidy
10820 <p>&#42;RFC_1234_http&#58;//example.com/
10821 </p>
10822 !! end
10823
10824 !! test
10825 Magic Word: {{REVISIONID}}
10826 !! options
10827 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10828 showflags
10829 !! wikitext
10830 {{REVISIONID}}
10831 !! html/*
10832 <p>1337
10833 </p>
10834 flags=vary-revision-id
10835 !! end
10836
10837 !! test
10838 Magic Word: {{SCRIPTPATH}}
10839 !! options
10840 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10841 !! wikitext
10842 {{SCRIPTPATH}}
10843 !! html/*
10844
10845 !! end
10846
10847 !! test
10848 Magic Word: {{STYLEPATH}}
10849 !! options
10850 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10851 !! wikitext
10852 {{STYLEPATH}}
10853 !! html/*
10854 <p>/skins
10855 </p>
10856 !! end
10857
10858 !! test
10859 Magic Word: {{SERVER}}
10860 !! options
10861 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10862 !! wikitext
10863 {{SERVER}}
10864 !! html/*
10865 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10866 </p>
10867 !! end
10868
10869 !! test
10870 Magic Word: {{SERVERNAME}}
10871 !! options
10872 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10873 !! wikitext
10874 {{SERVERNAME}}
10875 !! html/*
10876 <p>example.org
10877 </p>
10878 !! end
10879
10880 !! test
10881 Magic Word: {{SITENAME}}
10882 !! options
10883 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10884 !! wikitext
10885 {{SITENAME}}
10886 !! html/*
10887 <p>MediaWiki
10888 </p>
10889 !! end
10890
10891 !! test
10892 Magic Word: {{PAGELANGUAGE}}
10893 !! options
10894 language=fr
10895 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10896 !! wikitext
10897 {{PAGELANGUAGE}}
10898 !! html/*
10899 <p>fr
10900 </p>
10901 !! end
10902
10903 !! test
10904 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10905 !! options
10906 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10907 !! wikitext
10908 {{PAGELANGUAGE}}
10909 !! html/*
10910 <p>en
10911 </p>
10912 !! end
10913
10914 !! test
10915 Case-sensitive magic words, when cased differently, should just be template transclusions
10916 !! wikitext
10917 {{CurrentMonth}}
10918 {{currentday}}
10919 {{cURreNTweEK}}
10920 {{currentHour}}
10921 !! html
10922 <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>
10923 <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>
10924 <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>
10925 <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>
10926 </p>
10927 !! end
10928
10929 !! test
10930 Case-insensitive magic words should still work with weird casing.
10931 !! wikitext
10932 {{sErVeRNaMe}}
10933 {{LCFirst:AOEU}}
10934 {{ucFIRST:aoeu}}
10935 {{SERver}}
10936 !! html
10937 <p>example.org
10938 aOEU
10939 Aoeu
10940 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10941 </p>
10942 !! end
10943
10944 # From plwiki:PLOS_ONE
10945 !! test
10946 Parsoid: Page property magic word with magic word contents
10947 !! wikitext
10948 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10949 !! html/parsoid
10950 <meta property="mw:PageProp/displaytitle" content="Main Page" 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;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10951 !! end
10952
10953 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10954 # But, this is a limitation of our representation and is documented in
10955 # TemplateHandler.js in processSpecialMagicWord
10956 !! test
10957 Parsoid: Template-generated DISPLAYTITLE
10958 !! wikitext
10959 {{{{echo|DISPLAYTITLE}}:Foo}}
10960 !! options
10961 showtitle
10962 !! config
10963 wgAllowDisplayTitle=true
10964 wgRestrictDisplayTitle=false
10965 !! html/php
10966 Foo
10967
10968 !! html/parsoid
10969 <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"}]]}'/>
10970 !! end
10971
10972 !! test
10973 Namespace 1 {{ns:1}}
10974 !! wikitext
10975 {{ns:1}}
10976 !! html
10977 <p>Talk
10978 </p>
10979 !! end
10980
10981 !! test
10982 Namespace 1 {{ns:01}}
10983 !! wikitext
10984 {{ns:01}}
10985 !! html
10986 <p>Talk
10987 </p>
10988 !! end
10989
10990 !! test
10991 Namespace 0 {{ns:0}} (T6783)
10992 !! wikitext
10993 {{ns:0}}
10994 !! html
10995
10996 !! end
10997
10998 !! test
10999 Namespace 0 {{ns:00}} (T6783)
11000 !! wikitext
11001 {{ns:00}}
11002 !! html
11003
11004 !! end
11005
11006 !! test
11007 Namespace -1 {{ns:-1}}
11008 !! wikitext
11009 {{ns:-1}}
11010 !! html
11011 <p>Special
11012 </p>
11013 !! end
11014
11015 !! test
11016 Namespace User {{ns:User}}
11017 !! wikitext
11018 {{ns:User}}
11019 !! html
11020 <p>User
11021 </p>
11022 !! end
11023
11024 !! test
11025 Namespace User talk {{ns:User_talk}}
11026 !! wikitext
11027 {{ns:User_talk}}
11028 !! html
11029 <p>User talk
11030 </p>
11031 !! end
11032
11033 !! test
11034 Namespace User talk {{ns:uSeR tAlK}}
11035 !! wikitext
11036 {{ns:uSeR tAlK}}
11037 !! html
11038 <p>User talk
11039 </p>
11040 !! end
11041
11042 !! test
11043 Namespace File {{ns:File}}
11044 !! wikitext
11045 {{ns:File}}
11046 !! html
11047 <p>File
11048 </p>
11049 !! end
11050
11051 !! test
11052 Namespace File {{ns:Image}}
11053 !! wikitext
11054 {{ns:Image}}
11055 !! html
11056 <p>File
11057 </p>
11058 !! end
11059
11060 !! test
11061 Namespace (lang=de) Benutzer {{ns:User}}
11062 !! options
11063 language=de
11064 !! wikitext
11065 {{ns:User}}
11066 !! html
11067 <p>Benutzer
11068 </p>
11069 !! end
11070
11071 !! test
11072 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
11073 !! options
11074 language=de
11075 !! wikitext
11076 {{ns:3}}
11077 !! html
11078 <p>Benutzer Diskussion
11079 </p>
11080 !! end
11081
11082 !! test
11083 Urlencode
11084 !! wikitext
11085 {{urlencode:hi world?!}}
11086 {{urlencode:hi world?!|WIKI}}
11087 {{urlencode:hi world?!|PATH}}
11088 {{urlencode:hi world?!|QUERY}}
11089 !! html/php
11090 <p>hi+world%3F%21
11091 hi_world%3F!
11092 hi%20world%3F%21
11093 hi+world%3F%21
11094 </p>
11095 !! end
11096
11097 !! test
11098 Magic Word: prioritize type info over data-parsoid
11099 !! options
11100 parsoid=html2wt
11101 !! html/parsoid
11102 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
11103 !! wikitext
11104 __FORCETOC__
11105 !! end
11106
11107 !! test
11108 Magic Word: serialize on separate line (parsoid)
11109 !! options
11110 parsoid=wt2wt,html2wt
11111 !! wikitext
11112 foo
11113 __NOTOC__
11114 bar
11115 !! html/parsoid
11116 foo<meta property="mw:PageProp/notoc"/>bar
11117 !! end
11118
11119 !! test
11120 Magic Word: rt non-english wikis
11121 !! options
11122 parsoid=wt2wt
11123 language=de
11124 !! wikitext
11125 __NOEDITSECTION__
11126 !! html/parsoid
11127 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
11128 !! end
11129
11130 !!test
11131 __proto__ is treated as normal wikitext (T105997)
11132 !!wikitext
11133 __proto__
11134 !!html
11135 <p>__proto__
11136 </p>
11137 !!end
11138
11139 ###
11140 ### Magic links
11141 ###
11142 !! test
11143 Magic links: internal link to RFC (T2479)
11144 !! wikitext
11145 [[RFC 123]]
11146 !! html/php
11147 <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>
11148 </p>
11149 !! html/parsoid
11150 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
11151 !! end
11152
11153 !! test
11154 Magic links: RFC (T2479)
11155 !! wikitext
11156 RFC 822
11157 !! html/php
11158 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11159 </p>
11160 !! html/parsoid
11161 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
11162 !! end
11163
11164 !! test
11165 Magic links: RFC (T67278)
11166 !! wikitext
11167 This is RFC 822 but thisRFC 822 is not RFC 822linked.
11168 !! html/php
11169 <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.
11170 </p>
11171 !! html/parsoid
11172 <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>
11173 !! end
11174
11175 !! test
11176 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
11177 !! wikitext
11178 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
11179 RFC
11180 822
11181 !! html/php
11182 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11183 RFC
11184 822
11185 </p>
11186 !! html/parsoid
11187 <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>
11188 RFC
11189 822</p>
11190 !! end
11191
11192 !! test
11193 Magic links: ISBN (T3937)
11194 !! wikitext
11195 ISBN 0-306-40615-2
11196 !! html/php
11197 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
11198 </p>
11199 !! html/parsoid
11200 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
11201 !! end
11202
11203 !! test
11204 Magic links: ISBN (T67278)
11205 !! wikitext
11206 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11207 !! html/php
11208 <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.
11209 </p>
11210 !! html/parsoid
11211 <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>
11212 !! end
11213
11214 !! test
11215 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
11216 !! wikitext
11217 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
11218 ISBN
11219 9780316098113
11220 ISBN 978
11221 0316098113
11222 !! html/php
11223 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11224 ISBN
11225 9780316098113
11226 ISBN 978
11227 0316098113
11228 </p>
11229 !! html/parsoid
11230 <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>
11231 ISBN
11232 9780316098113
11233 ISBN 978
11234 0316098113</p>
11235 !! end
11236
11237 !! test
11238 Magic links: PMID incorrectly converts space to underscore
11239 !! wikitext
11240 PMID 1234
11241 !! html/php
11242 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11243 </p>
11244 !! html/parsoid
11245 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
11246 !! end
11247
11248 !! test
11249 Magic links: PMID (T67278)
11250 !! wikitext
11251 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11252 !! html/php
11253 <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.
11254 </p>
11255 !! html/parsoid
11256 <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>
11257 !! end
11258
11259 !! test
11260 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11261 !! wikitext
11262 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11263 PMID
11264 1234
11265 !! html/php
11266 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11267 PMID
11268 1234
11269 </p>
11270 !! html/parsoid
11271 <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>
11272 PMID
11273 1234</p>
11274 !! end
11275
11276 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11277 # since these are ExtLinkText, not MagicLinkText
11278 !! test
11279 Magic links: use appropriate serialization for "almost" magic links.
11280 !! wikitext
11281 X[[Special:BookSources/0978739256|foo]]
11282
11283 X[https://tools.ietf.org/html/rfc1234 foo]
11284 !! html/php
11285 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11286 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11287 </p>
11288 !! html/parsoid
11289 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11290 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11291 !! end
11292
11293 !! test
11294 Magic links: All disabled (T47942)
11295 !! options
11296 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11297 !! wikitext
11298 ISBN 0-306-40615-2
11299 PMID 1234
11300 RFC 4321
11301 !! html/php
11302 <p>ISBN 0-306-40615-2
11303 PMID 1234
11304 RFC 4321
11305 </p>
11306 !! end
11307
11308 ###
11309 ### Templates
11310 ####
11311
11312 !! test
11313 Nonexistent template
11314 !! wikitext
11315 {{thistemplatedoesnotexist}}
11316 !! html
11317 <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>
11318 </p>
11319 !! end
11320
11321 !! test
11322 Template with invalid target containing tags
11323 !! wikitext
11324 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11325 !! html
11326 <p>{{a<b>b</b>|foo|a=b|a = b}}
11327 </p>
11328 !! end
11329
11330 !! test
11331 Template with invalid target containing unclosed tag
11332 !! wikitext
11333 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11334 !! html
11335 <p>{{a<b>|foo|a=b|a = b}}</b>
11336 </p>
11337 !! end
11338
11339 !! test
11340 Template with invalid target containing wikilink
11341 !! wikitext
11342 {{[[Main Page]]}}
11343 !! html/php
11344 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11345 </p>
11346 !! html/parsoid
11347 <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>
11348 !! end
11349
11350 !! test
11351 Template with just whitespace in it, T70421
11352 !! wikitext
11353 {{echo|{{ }}}}
11354 !! html/parsoid
11355 <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>
11356 !! end
11357
11358 !! article
11359 Template:test
11360 !! text
11361 This is a test template
11362 !! endarticle
11363
11364 !! test
11365 Simple template
11366 !! wikitext
11367 {{test}}
11368 !! html
11369 <p>This is a test template
11370 </p>
11371 !! end
11372
11373 !! test
11374 Template with explicit namespace
11375 !! wikitext
11376 {{Template:test}}
11377 !! html
11378 <p>This is a test template
11379 </p>
11380 !! end
11381
11382
11383 !! article
11384 Template:paramtest
11385 !! text
11386 This is a test template with parameter {{{param}}}
11387 !! endarticle
11388
11389 !! test
11390 Template parameter
11391 !! wikitext
11392 {{paramtest|param=foo}}
11393 !! html
11394 <p>This is a test template with parameter foo
11395 </p>
11396 !! end
11397
11398 !! article
11399 Template:paramtestnum
11400 !! text
11401 [[{{{1}}}|{{{2}}}]]
11402 !! endarticle
11403
11404 !! test
11405 Template unnamed parameter
11406 !! wikitext
11407 {{paramtestnum|Main Page|the main page}}
11408 !! html
11409 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11410 </p>
11411 !! end
11412
11413 !! article
11414 Template:templatesimple
11415 !! text
11416 (test)
11417 !! endarticle
11418
11419 !! article
11420 Template:templateredirect
11421 !! text
11422 #redirect [[Template:templatesimple]]
11423 !! endarticle
11424
11425 !! article
11426 Template:templateasargtestnum
11427 !! text
11428 {{{{{1}}}}}
11429 !! endarticle
11430
11431 !! article
11432 Template:templateasargtest
11433 !! text
11434 {{template{{{templ}}}}}
11435 !! endarticle
11436
11437 !! article
11438 Template:templateasargtest2
11439 !! text
11440 {{{{{templ}}}}}
11441 !! endarticle
11442
11443 !! test
11444 Template with template name as unnamed argument
11445 !! wikitext
11446 {{templateasargtestnum|templatesimple}}
11447 !! html
11448 <p>(test)
11449 </p>
11450 !! end
11451
11452 !! test
11453 Template with template name as argument
11454 !! wikitext
11455 {{templateasargtest|templ=simple}}
11456 !! html
11457 <p>(test)
11458 </p>
11459 !! end
11460
11461 !! test
11462 Template with template name as argument (2)
11463 !! wikitext
11464 {{templateasargtest2|templ=templatesimple}}
11465 !! html
11466 <p>(test)
11467 </p>
11468 !! end
11469
11470 !! article
11471 Template:templateasargtestdefault
11472 !! text
11473 {{{{{templ|templatesimple}}}}}
11474 !! endarticle
11475
11476 !! article
11477 Template:templa
11478 !! text
11479 '''templ'''
11480 !! endarticle
11481
11482 !! test
11483 Template with default value
11484 !! wikitext
11485 {{templateasargtestdefault}}
11486 !! html
11487 <p>(test)
11488 </p>
11489 !! end
11490
11491 !! test
11492 Template with default value (value set)
11493 !! wikitext
11494 {{templateasargtestdefault|templ=templa}}
11495 !! html
11496 <p><b>templ</b>
11497 </p>
11498 !! end
11499
11500 !! test
11501 Template redirect
11502 !! wikitext
11503 {{templateredirect}}
11504 !! html/php
11505 <p>(test)
11506 </p>
11507 !! html/parsoid
11508 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11509 !! end
11510
11511 !! test
11512 Template with argument in separate line
11513 !! wikitext
11514 {{ templateasargtest |
11515 templ = simple }}
11516 !! html
11517 <p>(test)
11518 </p>
11519 !! end
11520
11521 !! test
11522 Template with complex template as argument
11523 !! wikitext
11524 {{paramtest|
11525 param ={{ templateasargtest |
11526 templ = simple }}}}
11527 !! html
11528 <p>This is a test template with parameter (test)
11529 </p>
11530 !! end
11531
11532 !! test
11533 Templates with templated name
11534 !! wikitext
11535 {{{{echo|echo}}|foo}}
11536 {{{{echo|inner list}} }}
11537 !! html
11538 <p>foo
11539 </p>
11540 <ul><li>item 1</li></ul>
11541
11542 !! html/parsoid
11543 <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>
11544 <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>
11545 !! end
11546
11547 ## Regression test; the output here isn't really that interesting.
11548 !! test
11549 Templates with templated name and top level template args
11550 !! wikitext
11551 {{1{{2{{{3}}}|4=5}}}}
11552 !! html/parsoid
11553 <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>
11554 !! end
11555
11556 # Parsoid markup is deliberate "broken". This is an edge case.
11557 # See long comment in TemplateHandler.js:convertAttribsToString.
11558 !! test
11559 Templates with invalid templated targets
11560 !! wikitext
11561 {{echo
11562 {{echo|foo}}
11563 }}
11564 !! html/php
11565 <p>{{echo
11566 foo
11567 }}
11568 </p>
11569 !! html/parsoid
11570 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11571 foo }}</p>
11572 !! end
11573
11574 !! test
11575 Template with thumb image (with link in description)
11576 !! wikitext
11577 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11578 !! html/php
11579 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>
11580
11581 !! html+tidy
11582 <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>
11583 !! html/parsoid
11584 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
11585 !! end
11586
11587 !! article
11588 Template:complextemplate
11589 !! text
11590 {{{1}}} {{paramtest|
11591 param ={{{param}}}}}
11592 !! endarticle
11593
11594 !! test
11595 Template with complex arguments
11596 !! wikitext
11597 {{complextemplate|
11598 param ={{ templateasargtest |
11599 templ = simple }}|[[Template:complextemplate|link]]}}
11600 !! html
11601 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11602 </p>
11603 !! end
11604
11605 !! test
11606 T2553: link with two variables in a piped link
11607 !! wikitext
11608 {|
11609 |[[{{{1}}}|{{{2}}}]]
11610 |}
11611 !! html/php
11612 <table>
11613 <tr>
11614 <td>[[{{{1}}}|{{{2}}}]]
11615 </td></tr></table>
11616
11617 !! html/parsoid
11618 <table>
11619 <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>
11620 </tbody></table>
11621 !! end
11622
11623 # See: T2553
11624 !! test
11625 Abort table cell attribute parsing on wikilink
11626 !! wikitext
11627 {|
11628 |testing [[one|two]] |three||four
11629 |testing one two |three||four
11630 |testing="[[one|two]]" |three||four
11631 |}
11632 !! html/php
11633 <table>
11634 <tr>
11635 <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>
11636 <td>four
11637 </td>
11638 <td>three</td>
11639 <td>four
11640 </td>
11641 <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>
11642 <td>four
11643 </td></tr></table>
11644
11645 !! html/parsoid
11646 <table>
11647 <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>
11648 <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>
11649 <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>
11650 </tbody></table>
11651 !! end
11652
11653 !! test
11654 Don't abort table cell attribute parsing if wikilink is found in template arg
11655 !! wikitext
11656 {|
11657 |Test {{#tag:ref|One two "[[three]]" four}}
11658 |}
11659 !! html/parsoid
11660 <table>
11661 <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>
11662 </tbody></table>
11663 !! end
11664
11665 !! test
11666 Magic variable as template parameter
11667 !! wikitext
11668 {{paramtest|param={{SITENAME}}}}
11669 !! html
11670 <p>This is a test template with parameter MediaWiki
11671 </p>
11672 !! end
11673
11674 !! article
11675 Template:linktest
11676 !! text
11677 [[{{{param}}}|link]]
11678 !! endarticle
11679
11680 !! test
11681 Template parameter as link source
11682 !! wikitext
11683 {{linktest|param=Main Page}}
11684 !! html
11685 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11686 </p>
11687 !! end
11688
11689 !!article
11690 Template:paramtest2
11691 !! text
11692 including another template, {{paramtest|param={{{arg}}}}}
11693 !! endarticle
11694
11695 !! test
11696 Template passing argument to another template
11697 !! wikitext
11698 {{paramtest2|arg='hmm'}}
11699 !! html
11700 <p>including another template, This is a test template with parameter 'hmm'
11701 </p>
11702 !! end
11703
11704 !! article
11705 Template:Linktest2
11706 !! text
11707 Main Page
11708 !! endarticle
11709
11710 !! test
11711 Template as link source
11712 !! wikitext
11713 [[{{linktest2}}]]
11714
11715 [[{{linktest2}}|Main Page]]
11716
11717 [[{{linktest2}}]]Page
11718 !! html
11719 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11720 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11721 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11722 </p>
11723 !! end
11724
11725
11726 !! article
11727 Template:loop1
11728 !! text
11729 {{loop2}}
11730 !! endarticle
11731
11732 !! article
11733 Template:loop2
11734 !! text
11735 {{loop1}}
11736 !! endarticle
11737
11738 !! test
11739 Template infinite loop
11740 !! wikitext
11741 {{loop1}}
11742 !! html
11743 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11744 </p>
11745 !! end
11746
11747 !! test
11748 Template from main namespace
11749 !! wikitext
11750 {{:Main Page}}
11751 !! html
11752 <p>blah blah
11753 </p>
11754 !! end
11755
11756 !! test
11757 Template from non-includable namespace
11758 !! options
11759 wgNonincludableNamespaces=10
11760 !! wikitext
11761 {{echo|uh oh!}}
11762 !! html
11763 <p><a href="/wiki/Template:Echo" title="Template:Echo">Template:Echo</a>
11764 </p>
11765 !! end
11766
11767 !! article
11768 Template:table
11769 !! text
11770 {|
11771 | 1 || 2
11772 |-
11773 | 3 || 4
11774 |}
11775 !! endarticle
11776
11777 !! test
11778 T2529: Template with table, not included at beginning of line
11779 !! wikitext
11780 foo {{table}}
11781 !! html
11782 <p>foo
11783 </p>
11784 <table>
11785 <tr>
11786 <td>1</td>
11787 <td>2
11788 </td></tr>
11789 <tr>
11790 <td>3</td>
11791 <td>4
11792 </td></tr></table>
11793
11794 !! end
11795
11796 !! test
11797 T2523: Template shouldn't eat newline (or add an extra one before table)
11798 !! wikitext
11799 foo
11800 {{table}}
11801 !! html
11802 <p>foo
11803 </p>
11804 <table>
11805 <tr>
11806 <td>1</td>
11807 <td>2
11808 </td></tr>
11809 <tr>
11810 <td>3</td>
11811 <td>4
11812 </td></tr></table>
11813
11814 !! end
11815
11816 !! test
11817 T2041: Template parameters shown as broken links
11818 !! wikitext
11819 {{{parameter}}}
11820 !! html
11821 <p>{{{parameter}}}
11822 </p>
11823 !! end
11824
11825 !! test
11826 Template with targets containing wikilinks
11827 !! options
11828 parsoid=wt2html
11829 !! wikitext
11830 {{[[foo]]}}
11831
11832 {{[[{{echo|foo}}]]}}
11833
11834 {{{{echo|[[foo}}]]}}
11835 !! html/php
11836 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11837 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11838 </p><p>{{[[foo}}]]
11839 </p>
11840 !! html/parsoid
11841 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11842 <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>
11843 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11844 !! end
11845
11846 !! article
11847 Template:''
11848 !! text
11849 bar
11850 !! endarticle
11851
11852 !! test
11853 Templates: Double quotes as template target
11854 !! wikitext
11855 foo {{''}} baz
11856 !! html/php
11857 <p>foo bar baz
11858 </p>
11859 !! html/parsoid
11860 <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
11861 </p>
11862 !! end
11863
11864 ## This test is about making sure Parsoid's data-mw is well formed in the
11865 ## face of multiple templates with intersecting and overlapping ranges. The
11866 ## wikitext itself is wretched.
11867 !! test
11868 Templates with intersecting and overlapping ranges
11869 !! wikitext
11870 {|{{echo|
11871 <p>ha</p>}}
11872 {|{{echo|
11873 <p>ho</p>}}
11874 {{echo|{{!}}hi}}
11875 |}
11876 !! html/php+tidy
11877 <p>ha</p><table>
11878
11879 </table><p>ho</p><table>
11880
11881 <tbody><tr>
11882 <td>hi
11883 </td></tr></tbody></table>
11884 !! html/parsoid
11885 <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":""}]]}'>
11886
11887 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11888
11889 <tbody><tr><td>hi</td></tr>
11890 </tbody></table>
11891 !! end
11892
11893 !! article
11894 Template:MSGNW test
11895 !! text
11896 ''None'' of '''this''' should be
11897 * interpreted
11898 but rather passed unmodified
11899 {{test}}
11900 <gallery>
11901 File:Foobar.jpg
11902 </gallery>
11903 <!-- comment -->
11904 !! endarticle
11905
11906 # hmm, fix this or just deprecate msgnw and document its behavior?
11907 !! test
11908 msgnw keyword
11909 !! wikitext
11910 {{msgnw:MSGNW test}}
11911 !! html/php
11912 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11913 &#42; interpreted
11914 &#32;but rather passed unmodified
11915 &#123;&#123;test&#125;&#125;
11916 &#60;gallery&#62;
11917 File:Foobar.jpg
11918 &#60;/gallery&#62;
11919 &#60;!-- comment --&#62;
11920 </p>
11921 !! end
11922
11923 !! test
11924 int keyword
11925 !! wikitext
11926 {{int:youhavenewmessages|lots of money|not!}}
11927 !! html
11928 <p>You have lots of money (not!).
11929 </p>
11930 !! end
11931
11932 !! test
11933 int keyword - non-existing message
11934 !! wikitext
11935 {{int:var}}
11936 !! html
11937 <p>⧼var⧽
11938 </p>
11939 !! end
11940
11941 !! article
11942 Template:Includes
11943 !! text
11944 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11945 !! endarticle
11946
11947 !! test
11948 <includeonly> and <noinclude> being included
11949 !! wikitext
11950 {{Includes}}
11951 !! html
11952 <p>Foobar
11953 </p>
11954 !! end
11955
11956 !! article
11957 Template:Includes2
11958 !! text
11959 <onlyinclude>Foo</onlyinclude>bar
11960 !! endarticle
11961
11962 !! test
11963 <onlyinclude> being included
11964 !! wikitext
11965 {{Includes2}}
11966 !! html
11967 <p>Foo
11968 </p>
11969 !! end
11970
11971
11972 !! article
11973 Template:Includes3
11974 !! text
11975 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11976 !! endarticle
11977
11978 !! test
11979 <onlyinclude> and <includeonly> being included
11980 !! wikitext
11981 {{Includes3}}
11982 !! html
11983 <p>Foo
11984 </p>
11985 !! end
11986
11987 !! test
11988 <includeonly> and <noinclude> on a page
11989 !! wikitext
11990 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11991 !! html
11992 <p>Foozar
11993 </p>
11994 !! end
11995
11996 !! test
11997 Un-closed <noinclude>
11998 !! wikitext
11999 <noinclude>
12000 !! html
12001 !! end
12002
12003 !! test
12004 <onlyinclude> on a page
12005 !! wikitext
12006 <onlyinclude>Foo</onlyinclude>bar
12007 !! html
12008 <p>Foobar
12009 </p>
12010 !! end
12011
12012 !! test
12013 Un-closed <onlyinclude>
12014 !! wikitext
12015 <onlyinclude>
12016 !! html
12017 !! end
12018
12019 !!test
12020 Self-closed noinclude, includeonly, onlyinclude tags
12021 !! wikitext
12022 <noinclude />
12023 <includeonly />
12024 <onlyinclude />
12025 !! html
12026 <p><br />
12027 </p>
12028 !!end
12029
12030 !!test
12031 Unbalanced includeonly and noinclude tags
12032 !! wikitext
12033 {|
12034 |a</noinclude>
12035 |b</noinclude></noinclude>
12036 |c</noinclude></includeonly>
12037 |d</includeonly></includeonly>
12038 |}
12039 !! html
12040 <table>
12041 <tr>
12042 <td>a
12043 </td>
12044 <td>b
12045 </td>
12046 <td>c&lt;/includeonly&gt;
12047 </td>
12048 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
12049 </td></tr></table>
12050
12051 !!end
12052
12053 !! article
12054 Template:Includeonly section
12055 !! text
12056 <includeonly>
12057 ==Includeonly section==
12058 </includeonly>
12059 ==Section T-1==
12060 !!endarticle
12061
12062 !! test
12063 T8563: Edit link generation for section shown by <includeonly>
12064 !! wikitext
12065 {{includeonly section}}
12066 !! html
12067 <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>
12068 <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>
12069
12070 !! end
12071
12072 # Uses same input as the contents of [[Template:Includeonly section]]
12073 !! test
12074 T8563: Section extraction for section shown by <includeonly>
12075 !! options
12076 section=T-2
12077 !! wikitext
12078 <includeonly>
12079 ==Includeonly section==
12080 </includeonly>
12081 ==Section T-2==
12082 !! html
12083 ==Section T-2==
12084 !! end
12085
12086 !! test
12087 T8563: Edit link generation for section suppressed by <includeonly>
12088 !! wikitext
12089 <includeonly>
12090 ==Includeonly section==
12091 </includeonly>
12092 ==Section 1==
12093 !! html
12094 <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>
12095
12096 !! end
12097
12098 !! test
12099 T8563: Section extraction for section suppressed by <includeonly>
12100 !! options
12101 section=1
12102 !! wikitext
12103 <includeonly>
12104 ==Includeonly section==
12105 </includeonly>
12106 ==Section 1==
12107 !! html
12108 ==Section 1==
12109 !! end
12110
12111 !! test
12112 Un-closed <includeonly>
12113 !! wikitext
12114 <includeonly>
12115 !! html/php
12116 !! html/parsoid
12117 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}' data-mw='{"src":"&lt;includeonly>"}'/>
12118 !! end
12119
12120 ## We used to, but no longer wt2wt this test since the default serializer
12121 ## will normalize the include directives to serialize on their own line.
12122 ## Selser will take care of preserving formatting in scenarios where they
12123 ## intermingled with other wikitext.
12124 !! test
12125 Includes and comments at SOL
12126 !! options
12127 parsoid=wt2html,html2html
12128 !! wikitext
12129 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
12130
12131 <noinclude>
12132 some
12133 </noinclude>*stuff
12134 *here
12135
12136 <noinclude>
12137 some</noinclude>* stuff
12138 * here
12139
12140 <includeonly>can have stuff</includeonly>===here===
12141
12142 !! html/php
12143 <h2><span class="mw-headline" id="hu">hu</span></h2>
12144 <p>some
12145 </p>
12146 <ul><li>stuff</li>
12147 <li>here</li></ul>
12148 <p><br />
12149 some* stuff
12150 </p>
12151 <ul><li>here</li></ul>
12152 <h3><span class="mw-headline" id="here">here</span></h3>
12153
12154 !! html/parsoid
12155 <!-- 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>
12156
12157 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12158 <p>some</p>
12159 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
12160 <li>here</li></ul>
12161
12162 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12163 <p>some<meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>* stuff</p>
12164 <ul><li>here</li></ul>
12165
12166 <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>
12167
12168 !! end
12169
12170 # TODO: test with DOM fragment reuse!
12171 !! test
12172 Parsoid: DOM fragment reuse
12173 !! options
12174 parsoid=wt2wt,wt2html
12175 !! wikitext
12176 a{{echo|b<table></table>c}}d
12177
12178 a{{echo|b
12179 <table></table>
12180 c}}d
12181
12182 {{echo|a
12183
12184 <table></table>
12185
12186 b}}
12187 !! html
12188 <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>
12189
12190 <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">
12191 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
12192 </span><p about="#mwt2">cd</p>
12193
12194 <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">
12195
12196 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
12197
12198 </span><p about="#mwt3">b</p>
12199 !! end
12200
12201 !! test
12202 Parsoid: Merge double tds (T52603)
12203 !! options
12204 parsoid
12205 !! wikitext
12206 {|
12207 |{{echo|{{!}} foo}}
12208 |}
12209 !! html
12210 <table><tbody>
12211 <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>
12212 </tbody></table>
12213 !! end
12214
12215 !! test
12216 Parsoid: Merge double tds in nested transclusion content (T52603)
12217 !! options
12218 parsoid
12219 !! wikitext
12220 {{echo|<div>}}
12221 {|
12222 |{{echo|{{!}} foo}}
12223 |}
12224 {{echo|</div>}}
12225 !! html
12226 <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}}]}'>
12227 <table><tbody>
12228 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
12229 </tbody></table>
12230 </div>
12231 !! end
12232
12233 ###
12234 ### <includeonly> and <noinclude> in attributes
12235 ###
12236 !!test
12237 0. includeonly around the entire attribute
12238 !! wikitext
12239 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12240 !! html
12241 <p><span id="v2">bar</span>
12242 </p>
12243 !!end
12244
12245 !!test
12246 1. includeonly in html attr key
12247 !! wikitext
12248 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12249 !! html
12250 <p><span id="foo">bar</span>
12251 </p>
12252 !!end
12253
12254 !!test
12255 2. includeonly in html attr value
12256 !! wikitext
12257 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12258 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12259 !! html
12260 <p><span id="v1">bar</span>
12261 <span id="v1">bar</span>
12262 </p>
12263 !!end
12264
12265 !!test
12266 3. includeonly in part of an attr value
12267 !! wikitext
12268 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12269 !! html
12270 <p><span style="color:red;">bar</span>
12271 </p>
12272 !!end
12273
12274 !!test
12275 4. includeonly in table attributes
12276 !! wikitext
12277 {|
12278 |- <noinclude>
12279 |-
12280 |a
12281 </noinclude>
12282 |- <includeonly>
12283 |-
12284 |b
12285 </includeonly>
12286 |}
12287 !! html
12288 <table>
12289
12290
12291 <tr>
12292 <td>a
12293 </td></tr>
12294 </table>
12295
12296 !!end
12297
12298 ###
12299 ### Preprocessor precedence tests
12300 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12301 ###
12302 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12303 !! test
12304 Preprocessor precedence 1: link is rightmost opening
12305 !! options
12306 parsoid=wt2html
12307 !! wikitext
12308 {{[[Foo|bar}}]]
12309
12310 But close-brace is not a valid character in a link title:
12311 {{[[Foo}}|bar]]
12312
12313 However, we can still tell this was handled as a link in the preprocessor:
12314 {{echo|[[Foo}}|bar]]|bat}}
12315 !! html/php
12316 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12317 </p><p>But close-brace is not a valid character in a link title:
12318 {{[[Foo}}|bar]]
12319 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12320 [[Foo}}|bar]]
12321 </p>
12322 !! html/parsoid
12323 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12324 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12325 <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>
12326 !! end
12327
12328 !! test
12329 Preprocessor precedence 2: template is rightmost opening
12330 !! options
12331 language=zh
12332 !! wikitext
12333 -{{echo|foo}-}}-
12334 !! html/php
12335 <p>-foo}--
12336 </p>
12337 !! html/parsoid
12338 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12339 !! end
12340
12341 !! test
12342 Preprocessor precedence 3: language converter is rightmost opening
12343 !! options
12344 language=zh
12345 parsoid=wt2html
12346 !! wikitext
12347 {{echo|hi}}
12348
12349 {{-{R|echo|hi}}}-
12350
12351 [[-{R|raw]]}-
12352 !! html/php
12353 <p>hi
12354 </p><p>{{echo|hi}}
12355 </p><p>[[raw]]
12356 </p>
12357 !! html/parsoid
12358 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12359 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12360 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12361 !! end
12362
12363 !! test
12364 Preprocessor precedence 4: left-most angle bracket
12365 !! options
12366 language=zh
12367 !! wikitext
12368 <!--{raw}-->
12369 !! html/php
12370 !! html/parsoid
12371 <!--{raw}-->
12372 !! end
12373
12374 !! article
12375 Template:Precedence5
12376 !! text
12377 {{{{{1}}}}}
12378 !! endarticle
12379
12380 !! test
12381 Preprocessor precedence 5: tplarg takes precedence over template
12382 !! wikitext
12383 {{Precedence5|Bullet}}
12384 !! html/php
12385 <ul><li>Bar</li></ul>
12386
12387 !! html/parsoid
12388 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12389 !! end
12390
12391 !! test
12392 Preprocessor precedence 6: broken link is rightmost opening
12393 !! options
12394 parsoid=wt2html
12395 !! wikitext
12396 {{echo|[[Foo}}
12397
12398 {{echo|[[Foo|bar|bat=baz}}
12399 !! html/php
12400 <p>{{echo|[[Foo}}
12401 </p><p>{{echo|[[Foo|bar|bat=baz}}
12402 </p>
12403 !! html/parsoid
12404 <p>{{echo|[[Foo}}</p>
12405 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12406 !! end
12407
12408 # This next test exposes a difference between PHP and Parsoid:
12409 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12410 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12411 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12412 # outer `[[Foo` extends until the `y]]`
12413 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12414 # intermediate result (after template expansion), and link processing
12415 # happens on this intermediate result, which moves the wikilink
12416 # boundary leftward to `[[Foo|Bar]]`
12417 # 2b) Parsoid works in a single step, so it's going to keep the
12418 # wikilink as extending to the `y]]`
12419 # 3a) Then PHP does linktrail processing which slurps up the trailing
12420 # `xy` inside the link.
12421 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12422 # `z` inside the link.
12423 # This is "correct" behavior. Parsoid's basic worldview is that the
12424 # `]]` inside the template shouldn't be allowed to leak out to affect
12425 # the surrounding wikilink. PHP may match Parsoid (in the future)
12426 # if you use {{#balance}} (T114445).
12427
12428 !! test
12429 Preprocessor precedence 7: broken template is rightmost opening
12430 !! options
12431 parsoid=wt2html
12432 !! wikitext
12433 [[Foo|{{echo|Bar]]
12434
12435 [[Foo|{{echo|Bar]]-x}}-y]]-z
12436
12437 Careful: linktrails can move the end of the wikilink:
12438 [[Foo|{{echo|y']]a}}l]]l
12439 !! html/php
12440 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12441 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12442 </p><p>Careful: linktrails can move the end of the wikilink:
12443 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12444 </p>
12445 !! html/parsoid
12446 <p>[[Foo|{{echo|Bar]]</p>
12447 <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>
12448 <p>Careful: linktrails can move the end of the wikilink:
12449 <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>
12450 !! end
12451
12452 !! test
12453 Preprocessor precedence 8: broken language converter is rightmost opening
12454 !! options
12455 language=zh
12456 !! wikitext
12457 [[Foo-{R|raw]]
12458 !! html
12459 <p>[[Foo-{R|raw]]
12460 </p>
12461 !! end
12462
12463 !! article
12464 Template:Preprocessor_precedence_9
12465 !! text
12466 ;4: {{{{1}}}}
12467 ;5: {{{{{2}}}}}
12468 ;6: {{{{{{3}}}}}}
12469 ;7: {{{{{{{4}}}}}}}
12470 !! endarticle
12471
12472 !! test
12473 Preprocessor precedence 9: groups of braces
12474 !! wikitext
12475 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12476 !! html/php
12477 <dl><dt>4</dt>
12478 <dd>{Four}</dd>
12479 <dt>5</dt>
12480 <dd></dd></dl>
12481 <ul><li>Bar</li></ul>
12482 <dl><dt>6</dt>
12483 <dd>Four</dd>
12484 <dt>7</dt>
12485 <dd>{Bullet}</dd></dl>
12486
12487 !! html/parsoid
12488 <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}}]}'>
12489 <dt>4</dt>
12490 <dd>{Four}</dd>
12491 <dt>5</dt>
12492 <dd></dd>
12493 </dl><ul about="#mwt1">
12494 <li>Bar</li>
12495 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12496 <dt>6</dt>
12497 <dd>Four</dd>
12498 <dt>7</dt>
12499 <dd>{Bullet}</dd>
12500 </dl>
12501 !! end
12502
12503 !! article
12504 Template:Preprocessor_precedence_10
12505 !! text
12506 ;1: -{R|raw}-
12507 ;2: -{{Bullet}}-
12508 ;3: -{{{1}}}-
12509 ;4: -{{{{2}}}}-
12510 ;5: -{{{{{3}}}}}-
12511 ;6: -{{{{{{4}}}}}}-
12512 ;7: -{{{{{{{5}}}}}}}-
12513 !! endarticle
12514
12515 !! test
12516 Preprocessor precedence 10: groups of braces with leading dash
12517 !! options
12518 language=zh
12519 !! wikitext
12520 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12521 !! html/php
12522 <dl><dt>1</dt>
12523 <dd>raw</dd>
12524 <dt>2</dt>
12525 <dd>-</dd></dl>
12526 <ul><li>Bar-</li></ul>
12527 <dl><dt>3</dt>
12528 <dd>-Three-</dd>
12529 <dt>4</dt>
12530 <dd>raw2</dd>
12531 <dt>5</dt>
12532 <dd>-</dd></dl>
12533 <ul><li>Bar-</li></ul>
12534 <dl><dt>6</dt>
12535 <dd>-Three-</dd>
12536 <dt>7</dt>
12537 <dd>raw2</dd></dl>
12538
12539 !! html/parsoid
12540 <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}}]}'>
12541 <dt>1</dt>
12542 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12543 <dt>2</dt>
12544 <dd>-</dd>
12545 </dl><ul about="#mwt1">
12546 <li>Bar-</li>
12547 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12548 <dt>3</dt>
12549 <dd>-Three-</dd>
12550 <dt>4</dt>
12551 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12552 <dt>5</dt>
12553 <dd>-</dd>
12554 </dl><ul about="#mwt1">
12555 <li>Bar-</li>
12556 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12557 <dt>6</dt>
12558 <dd>-Three-</dd>
12559 <dt>7</dt>
12560 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12561 </dl>
12562 !! end
12563
12564 !! test
12565 Preprocessor precedence 11: found during visual diff testing
12566 !! wikitext
12567 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12568
12569 {{echo|-{{echo|-{{echo|x}}}}}}
12570
12571 {{echo|-{{echo|x}}}}
12572 !! html/php
12573 <p><span>-<span>-x</span></span>
12574 </p><p>--x
12575 </p><p>-x
12576 </p>
12577 !! html/parsoid
12578 <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>
12579
12580 <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>
12581
12582 <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>
12583 !! end
12584
12585 !! test
12586 Preprocessor precedence 12: broken language converter closed by brace.
12587 !! options
12588 parsoid=wt2html
12589 !! wikitext
12590 This form breaks the template, which is unfortunate:
12591 *{{echo|foo-{bar}bat}}
12592
12593 But if the broken language converter markup is inside an extension
12594 tag, nothing bad happens:
12595 *<nowiki>foo-{bar}bat</nowiki>
12596 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12597 *<pre>foo-{bar}bat</pre>
12598 *{{echo|<pre>foo-{bar}bat</pre>}}
12599
12600 <tag>foo-{bar}bat</tag>
12601 {{echo|<tag>foo-{bar}bat</tag>}}
12602
12603 !! html/php+tidy
12604 <p>This form breaks the template, which is unfortunate:
12605 </p>
12606 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12607 <p>But if the broken language converter markup is inside an extension
12608 tag, nothing bad happens:
12609 </p>
12610 <ul><li>foo-&#123;bar}bat</li>
12611 <li>foo-&#123;bar}bat</li>
12612 <li><pre>foo-{bar}bat</pre></li>
12613 <li><pre>foo-{bar}bat</pre></li></ul>
12614 <pre>'foo-{bar}bat'
12615 array (
12616 )
12617 </pre>
12618 <pre>'foo-{bar}bat'
12619 array (
12620 )
12621 </pre>
12622 !! html/parsoid
12623 <p>This form breaks the template, which is unfortunate:</p>
12624 <ul>
12625 <li>{{echo|foo-{bar}bat}}</li>
12626 </ul>
12627 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12628 <ul>
12629 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12630 <li><span typeof="mw:Transclusion mw:Nowiki" 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>
12631 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12632 <li><pre typeof="mw:Transclusion mw:Extension/pre" 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>
12633 </ul>
12634 <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>
12635 !! end
12636
12637 !! test
12638 Preprocessor precedence 13: broken language converter in external link
12639 !! options
12640 parsoid=wt2html
12641 !! wikitext
12642 *[http://example.com/-{foo Example in URL]
12643 *[http://example.com Example in -{link} description]
12644 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12645 !! html/php+tidy
12646 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12647 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12648 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12649 !! html/parsoid
12650 <ul>
12651 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12652 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12653 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12654 </ul>
12655 !! end
12656
12657 !! test
12658 Preprocessor precedence 14: broken language converter in comment
12659 !! wikitext
12660 *<!--{{foo}}-->...should be ok
12661 *<!---{{foo}}-->...extra dashes
12662 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12663 !! html/php+tidy
12664 <ul><li>...should be ok</li>
12665 <li>...extra dashes</li>
12666 <li>foobat...should be ok</li></ul>
12667 !! html/parsoid
12668 <ul>
12669 <li><!--{{foo}}-->...should be ok</li>
12670 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12671 <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>
12672 </ul>
12673 !! end
12674
12675 !! test
12676 Preprocessor precedence 15: broken brace markup in headings
12677 !! config
12678 wgFragmentMode=[ 'html5', 'legacy' ]
12679 !! options
12680 parsoid=wt2html
12681 !! wikitext
12682 __NOTOC__ __NOEDITSECTION__
12683 ===1 foo[bar 1===
12684 1
12685 ===2 foo[[bar 2===
12686 2
12687 ===3 foo{bar 3===
12688 3
12689 ===4 foo{{bar 4===
12690 4
12691 ===5 foo{{{bar 5===
12692 5
12693 ===6 foo-{bar 6===
12694 6
12695 !! html/php+tidy
12696 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12697 <p>1
12698 </p>
12699 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12700 <p>2
12701 </p>
12702 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12703 <p>3
12704 </p>
12705 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12706 <p>4
12707 </p>
12708 <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>
12709 <p>5
12710 </p>
12711 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12712 <p>6
12713 </p>
12714 !! html/parsoid
12715 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12716 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12717 <p>1</p>
12718 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12719 <p>2</p>
12720 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12721 <p>3</p>
12722 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12723 <p>4</p>
12724 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12725 <p>5</p>
12726 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12727 <p>6</p>
12728 !! end
12729
12730 !! test
12731 Preprocessor precedence 16: matching closing braces to opening braces
12732 !! options
12733 language=zh
12734 parsoid=wt2html
12735 !! wikitext
12736 -{{{echo|foo}}bar}-
12737 !! html/php
12738 <p>foobar
12739 </p>
12740 !! html/parsoid
12741 <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>
12742 !! end
12743
12744 !! test
12745 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12746 !! options
12747 parsoid=wt2html
12748 !! wikitext
12749 {{echo|hi {{}}}}
12750 !! html/php
12751 <p>hi {{}}
12752 </p>
12753 !! html/parsoid
12754 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12755 !! end
12756
12757 # Ensure we're using a language without variants for this test; even
12758 # if $wgUsePigLatinVariant is true. We've picked `de` arbitrarily.
12759 !! test
12760 Preprocessor precedence 18: another rightmost wins scenario
12761 !! options
12762 parsoid=wt2html
12763 language=de
12764 !! wikitext
12765 {{ -{{{{1|tplarg}}} }} }-
12766 !! html/php
12767 <p>{{ -{tplarg }} }-
12768 </p>
12769 !! html/parsoid
12770 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12771 !! end
12772
12773 !! test
12774 Preprocessor precedence 19: break syntax
12775 !! options
12776 parsoid=wt2html
12777 !! wikitext
12778 -{{
12779 !! html/php
12780 <p>-{{
12781 </p>
12782 !! html/parsoid
12783 <p>-{{</p>
12784 !! end
12785
12786 ###
12787 ### Token Stream Patcher tests
12788 ###
12789 ### These tests won't always pass wt2wt and other modes because
12790 ### on serialization, the table will be output on a new line.
12791 ### For now, we are blacklisting them, and using this to test selser.
12792 ###
12793
12794 !!test
12795 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12796 !!options
12797 parsoid=wt2html,wt2wt
12798 !!wikitext
12799 {{echo|}}{| width = '100%'
12800 |foo
12801 |}
12802 !!html/parsoid
12803 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12804 <tbody><tr><td>foo</td></tr>
12805 </tbody></table>
12806 !!end
12807
12808 ## We used to, but no longer wt2wt this test since the default serializer
12809 ## will normalize the include directives to serialize on their own line.
12810 ## Selser will take care of preserving formatting in scenarios where they
12811 ## intermingled with other wikitext.
12812 !!test
12813 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12814 !!options
12815 parsoid=wt2html
12816 !!wikitext
12817 <includeonly>a</includeonly>{| {{{b}}}
12818 |c
12819 |}
12820 !!html/parsoid
12821 <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":""}]]}'>
12822 <tbody><tr><td>c</td></tr>
12823 </tbody></table>
12824 !!end
12825
12826 !! test
12827 Table wikitext syntax outside wiki-tables
12828 !! wikitext
12829 a
12830 |+ not a caption
12831 ! not a table heading
12832 |- not a table row
12833 | not a table cell
12834 | class="foo bar" | baz
12835 b
12836 |}
12837 |-
12838 c
12839 !! html
12840 <p>a
12841 |+ not a caption
12842 ! not a table heading
12843 |- not a table row
12844 | not a table cell
12845 | class="foo bar" | baz
12846 b
12847 |}
12848 |-
12849 c
12850 </p>
12851 !! end
12852
12853 ###
12854 ### Testing parsing of templates where a template arg
12855 ### has the same name as the template itself.
12856 ###
12857
12858 !! article
12859 Template:quote
12860 !! text
12861 {{{quote|{{{1}}}}}}
12862 !! endarticle
12863
12864 !!test
12865 Templates: Template Name/Arg clash: 1. Use of positional param
12866 !! wikitext
12867 {{quote|foo}}
12868 !! html
12869 <p>foo
12870 </p>
12871 !!end
12872
12873 !!test
12874 Templates: Template Name/Arg clash: 2. Use of named param
12875 !! wikitext
12876 {{quote|quote=foo}}
12877 !! html
12878 <p>foo
12879 </p>
12880 !!end
12881
12882 !!test
12883 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12884 !! wikitext
12885 {{quote|quote}}
12886 !! html
12887 <p>quote
12888 </p>
12889 !!end
12890
12891 ###
12892 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12893 ###
12894
12895 !!test
12896 Templates: 1. Simple use
12897 !! wikitext
12898 {{echo|Foo}}
12899 !! html
12900 <p>Foo
12901 </p>
12902 !!end
12903
12904 !!test
12905 Templates: 2. Inside a block tag
12906 !! wikitext
12907 <div>{{echo|Foo}}</div>
12908 <blockquote>{{echo|Foo}}</blockquote>
12909 !! html
12910 <div>Foo</div>
12911 <blockquote>Foo</blockquote>
12912
12913 !! html+tidy
12914 <div>Foo</div>
12915 <blockquote><p>Foo</p></blockquote>
12916 !!end
12917
12918 !!test
12919 Templates: P-wrapping: 1a. Templates on consecutive lines
12920 !! wikitext
12921 {{echo|Foo}}
12922 {{echo|bar}}
12923 !! html
12924 <p>Foo
12925 bar
12926 </p>
12927 !!end
12928
12929 !!test
12930 Templates: P-wrapping: 1b. Templates on consecutive lines
12931 !! wikitext
12932 Foo
12933
12934 {{echo|bar}}
12935 {{echo|baz}}
12936 !! html
12937 <p>Foo
12938 </p><p>bar
12939 baz
12940 </p>
12941 !!end
12942
12943 !!test
12944 Templates: P-wrapping: 1c. Templates on consecutive lines
12945 !! wikitext
12946 {{echo|Foo}}
12947 {{echo|bar}} <div>baz</div>
12948 !! html
12949 <p>Foo
12950 </p>
12951 bar <div>baz</div>
12952
12953 !! html+tidy
12954 <p>Foo
12955 </p><p>
12956 bar </p><div>baz</div>
12957 !! end
12958
12959 !!test
12960 Templates: P-wrapping: 1d. Template preceded by comment-only line
12961 !!options
12962 parsoid
12963 !! wikitext
12964 <!-- foo -->
12965 {{echo|Bar}}
12966 !! html
12967 <!-- foo -->
12968
12969 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12970 !!end
12971
12972 !! test
12973 Templates: Scopes should not be expanded unnecessarily
12974 !! options
12975 parsoid=wt2html,wt2wt
12976 !! wikitext
12977 {{echo|<div>a</div>}}b{{echo|
12978 <div>c</div>}}
12979 !! html
12980 <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}}]}'>
12981 </span><div about="#mwt2">c</div>
12982 !! end
12983
12984 !!test
12985 Templates: Inline Text: 1. Multiple template uses
12986 !! wikitext
12987 {{echo|Foo}}bar{{echo|baz}}
12988 !! html
12989 <p>Foobarbaz
12990 </p>
12991 !!end
12992
12993 !!test
12994 Templates: Inline Text: 2. Back-to-back template uses
12995 !! wikitext
12996 {{echo|Foo}}{{echo|bar}}
12997 !! html
12998 <p>Foobar
12999 </p>
13000 !!end
13001
13002 !!test
13003 Templates: Block Tags: 1. Multiple template uses
13004 !! wikitext
13005 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
13006 !! html
13007 <div>Foo</div><div>bar</div><div>baz</div>
13008
13009 !!end
13010
13011 !!test
13012 Templates: Block Tags: 2. Back-to-back template uses
13013 !! wikitext
13014 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
13015 !! html
13016 <div>Foo</div><div>bar</div>
13017
13018 !!end
13019
13020 ## Parsoid drops empty elements in templates.
13021 !! test
13022 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
13023 !! wikitext
13024 {{echo|a
13025 b</p>}}
13026 !! html/php+tidy
13027 <p>a
13028 </p><p>
13029 b</p><p class="mw-empty-elt"></p>
13030 !! html/parsoid
13031 <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">
13032 </span><p about="#mwt1">b</p>
13033 !! end
13034
13035 !!test
13036 Templates: Links: 1. Simple example
13037 !! wikitext
13038 {{echo|[[Foo|bar]]}}
13039 !! html
13040 <p><a href="/wiki/Foo" title="Foo">bar</a>
13041 </p>
13042 !!end
13043
13044 !!test
13045 Templates: Links: 2. Generation of link href
13046 !! wikitext
13047 [[{{echo|Foo}}|bar]]
13048 !! html
13049 <p><a href="/wiki/Foo" title="Foo">bar</a>
13050 </p>
13051 !!end
13052
13053 !!test
13054 Templates: Links: 3. Generation of part of a link href
13055 !! wikitext
13056 [[Fo{{echo|o}}|bar]]
13057
13058 [[Foo{{echo|bar}}]]
13059
13060 [[Foo{{echo|bar}}baz]]
13061
13062 [[Foo{{echo|bar}}|bar]]
13063
13064 [[:Foo{{echo|bar}}]]
13065
13066 [[:Foo{{echo|bar}}|bar]]
13067 !! html
13068 <p><a href="/wiki/Foo" title="Foo">bar</a>
13069 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13070 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
13071 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">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=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13074 </p>
13075 !!end
13076
13077 !!test
13078 Templates: Links: 4. Multiple templates generating link href
13079 !! wikitext
13080 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
13081 !! html
13082 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13083 </p>
13084 !!end
13085
13086 !!test
13087 Templates: Links: 5. Generation of link text
13088 !! wikitext
13089 [[Foo|{{echo|bar}}]]
13090 !! html
13091 <p><a href="/wiki/Foo" title="Foo">bar</a>
13092 </p>
13093 !!end
13094
13095 !!test
13096 Templates: Links: 5. Nested templates (only outermost template should be marked)
13097 !! wikitext
13098 {{echo|[[{{echo|Foo}}|bar]]}}
13099 !! html
13100 <p><a href="/wiki/Foo" title="Foo">bar</a>
13101 </p>
13102 !!end
13103
13104 !!test
13105 Templates: HTML Tag: 1. Generation of HTML attr. key
13106 !! wikitext
13107 <div {{echo|style}}="color:red;">foo</div>
13108 !! html
13109 <div style="color:red;">foo</div>
13110
13111 !!end
13112
13113 !!test
13114 Templates: HTML Tag: 2. Generation of HTML attr. value
13115 !! wikitext
13116 <div style={{echo|'color:red;'}}>foo</div>
13117 !! html
13118 <div style="color:red;">foo</div>
13119
13120 !!end
13121
13122 !!test
13123 Templates: HTML Tag: 3. Generation of HTML attr key and value
13124 !! wikitext
13125 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
13126 !! html
13127 <div style="color:red;">foo</div>
13128
13129 !!end
13130
13131 !!test
13132 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
13133 !! wikitext
13134 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
13135 !! html
13136 <div title="This is a long title with just one piece templated">foo</div>
13137
13138 !!end
13139
13140 !!test
13141 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
13142 !! wikitext
13143 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
13144 !! html
13145 <div title="This is a long title with just one piece templated">foo</div>
13146
13147 !!end
13148
13149 !!test
13150 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
13151 !! wikitext
13152 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
13153 !! html
13154 <div title="This is a long title with just one piece templated">foo</div>
13155
13156 !!end
13157
13158 # SSS FIXME: While it is great we added support for all this,
13159 # do we want to make this part of the spec? Maybe we want to
13160 # deprecate this kind of usage in the future?
13161 !!test
13162 Templates: HTML Tag: 7. Generation of partial attribute key string
13163 !! wikitext
13164 <div st{{echo|yle}}="color:red;">foo</div>
13165 !! html
13166 <div style="color:red;">foo</div>
13167
13168 !!end
13169
13170 !! test
13171 Templates: HTML Tag: 8. Template-generated attribute (k=v)
13172 !! wikitext
13173 <div {{echo|1=id="v1"}}>bar</div>
13174 !! html
13175 <div id="v1">bar</div>
13176
13177 !!end
13178
13179 !! test
13180 Templates: HTML Tag: 9. Multiple template-generated attributes
13181 !! wikitext
13182 <div {{echo|1=id="v1" title="foo"}}>bar</div>
13183 !! html
13184 <div id="v1" title="foo">bar</div>
13185
13186 !!end
13187
13188 !! test
13189 Templates: Support for templates generating attributes and content
13190 !! wikitext
13191 {| {{mixed_attr_content_template}}
13192 |-
13193 |bar
13194 |}
13195 !! html/php
13196 <table style="color:red;" title="T48811">
13197
13198 <tr>
13199 <td>foo
13200 </td></tr>
13201 <tr>
13202 <td>bar
13203 </td></tr></table>
13204
13205 !! html/parsoid
13206 <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|}"]}'>
13207 <tbody><tr>
13208 <td>foo</td></tr>
13209 <tr>
13210 <td>bar</td></tr>
13211 </tbody></table>
13212 !!end
13213
13214 !! article
13215 Template:attribute_from_template
13216 !! text
13217 class="123"
13218 !! endarticle
13219
13220 !! test
13221 Table cell with attribute before expanded attribute
13222 !! wikitext
13223 {|
13224 | align="center" {{attribute_from_template}} |456
13225 |}
13226 !! html/parsoid
13227 <table>
13228 <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>
13229 </tbody></table>
13230 !! end
13231
13232 !! test
13233 1. Entities and nowikis inside templated attributes should be handled correctly
13234 !! wikitext
13235 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
13236 !! html/php
13237 <div style="background:#f9f9f9;">foo</div>
13238
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
13255 !! html/parsoid
13256 <table>
13257 <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>
13258 </tbody></table>
13259 !! end
13260
13261 !! test
13262 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13263 !! wikitext
13264 {{tbl-start}}
13265 |{{table_attribs_3}}
13266 {{tbl-end}}
13267 !! html/php
13268 <table>
13269 <tr>
13270 <td style="background:#f9f9f9;">Foo
13271 </td></tr></table>
13272
13273 !! html/parsoid
13274 <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}}]}'>
13275 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
13276 </tbody></table>
13277 !! end
13278
13279 # T107622
13280 !! test
13281 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13282 !! wikitext
13283 {|
13284 |{{table_attribs_6}} hi
13285 |}
13286 !! html/php
13287 <table>
13288 <tr>
13289 <td style="background: red;">hi
13290 </td></tr></table>
13291
13292 !! html/parsoid
13293 <table>
13294 <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>
13295 </tbody></table>
13296 !! end
13297
13298 !!test
13299 Templates: HTML Tables: 1. Generating start of a HTML table
13300 !! wikitext
13301 {{echo|<table><tr><td>foo</td>}}</tr></table>
13302 !! html
13303 <table><tr><td>foo</td></tr></table>
13304
13305 !!end
13306
13307 !!test
13308 Templates: HTML Tables: 2a. Generating middle of a HTML table
13309 !! wikitext
13310 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13311 !! html
13312 <table><tr><td>foo</td></tr></table>
13313
13314 !!end
13315
13316 !!test
13317 Templates: HTML Tables: 2b. Generating middle of a HTML table
13318 !! wikitext
13319 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13320 !! html
13321 <table><tr><td>foo</td></tr></table>
13322
13323 !!end
13324
13325 !!test
13326 Templates: HTML Tables: 3. Generating end of a HTML table
13327 !! wikitext
13328 <table><tr>{{echo|<td>foo</td></tr></table>}}
13329 !! html
13330 <table><tr><td>foo</td></tr></table>
13331
13332 !!end
13333
13334 !!test
13335 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13336 !! wikitext
13337 {{echo|<table>}}<tr><td>foo</td></tr></table>
13338 !! html
13339 <table><tr><td>foo</td></tr></table>
13340
13341 !!end
13342
13343 !!test
13344 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13345 !! wikitext
13346 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13347 !! html
13348 <table><tr><td>foo</td></tr></table>
13349
13350 !!end
13351
13352 !!test
13353 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13354 !! wikitext
13355 <table><tr>{{echo|<td>}}foo</td></tr></table>
13356 !! html
13357 <table><tr><td>foo</td></tr></table>
13358
13359 !!end
13360
13361 !!test
13362 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13363 !! wikitext
13364 <table><tr><td>foo{{echo|</td>}}</tr></table>
13365 !! html
13366 <table><tr><td>foo</td></tr></table>
13367
13368 !!end
13369
13370 !!test
13371 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13372 !! wikitext
13373 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13374 !! html
13375 <table><tr><td>foo</td></tr></table>
13376
13377 !!end
13378
13379 !!test
13380 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13381 !! wikitext
13382 <table><tr><td>foo</td></tr>{{echo|</table>}}
13383 !! html
13384 <table><tr><td>foo</td></tr></table>
13385
13386 !!end
13387
13388 !!test
13389 Templates: HTML Tables: 5. Proper fostering of categories from inside
13390 !!options
13391 parsoid=wt2html,wt2wt
13392 !! wikitext
13393 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13394 <!--Two categories (T52330)-->
13395 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13396 !! html
13397 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13398 <!--Two categories (T52330)-->
13399 <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>
13400 !!end
13401
13402 ## Remex doesn't account for fostered content.
13403 !! test
13404 Templates: Wiki Tables: 1a. Fostering of entire template content
13405 !! wikitext
13406 {|
13407 {{echo|a}}
13408 |}
13409 !! html/php
13410 <table>
13411 a
13412 <tr><td></td></tr></table>
13413
13414 !! html/php+tidy
13415
13416 a
13417 <table><tbody><tr><td></td></tr></tbody></table>
13418 !! html/parsoid
13419 <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">
13420
13421 </table>
13422 !! end
13423
13424 !!test
13425 Templates: Wiki Tables: 1b. Fostering of entire template content
13426 !! wikitext
13427 {|
13428 {{echo|<div>}}
13429 foo
13430 {{echo|</div>}}
13431 |}
13432 !! html
13433 <table>
13434 <div>
13435 <p>foo
13436 </p>
13437 </div>
13438 <tr><td></td></tr></table>
13439
13440 !! html/php+tidy
13441 <div>
13442 <p>foo
13443 </p>
13444 </div><table>
13445
13446 <tbody><tr><td></td></tr></tbody></table>
13447 !! html/parsoid
13448 <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|}"]}'>
13449 <p>foo</p>
13450 </div><table about="#mwt3">
13451
13452 </table>
13453 !! end
13454
13455 ## Remex doesn't account for fostered content.
13456 !! test
13457 Templates: Wiki Tables: 2. Fostering of partial template content
13458 !! wikitext
13459 {|
13460 {{echo|a
13461 <div>b</div>}}
13462 |}
13463 !! html/php
13464 <table>
13465 a
13466 <div>b</div>
13467 <tr><td></td></tr></table>
13468
13469 !! html/php+tidy
13470
13471 a
13472 <div>b</div><table>
13473 <tbody><tr><td></td></tr></tbody></table>
13474 !! html/parsoid
13475 <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">
13476
13477
13478 </table>
13479 !! end
13480
13481 !!test
13482 Templates: Wiki Tables: 3. td-content via multiple templates
13483 !! wikitext
13484 {|
13485 {{echo|{{pipe}}a}}{{echo|b}}
13486 |}
13487 !! html
13488 <table>
13489 <tr>
13490 <td>ab
13491 </td></tr></table>
13492
13493 !!end
13494
13495 !!test
13496 Templates: Wiki Tables: 4. Templated tags, no content
13497 !! wikitext
13498 {{tbl-start}}
13499 {{tbl-end}}
13500 !! html
13501 <table>
13502 <tr><td></td></tr></table>
13503
13504 !!end
13505
13506 !!test
13507 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13508 !! wikitext
13509 {{tbl-start}}
13510 |foo
13511 {{tbl-end}}
13512 !! html
13513 <table>
13514 <tr>
13515 <td>foo
13516 </td></tr></table>
13517
13518 !!end
13519
13520 !!test
13521 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13522 !! wikitext
13523 {{tbl-start}}
13524 {{!}}foo
13525 {{tbl-end}}
13526 !! html
13527 <table>
13528 <tr>
13529 <td>foo
13530 </td></tr></table>
13531
13532 !!end
13533
13534 ## This test case is very specific to Parsoid's internals
13535 ## and is hence only tested for Parsoid's code. Parsoid uses
13536 ## a <meta> marker tag for <ref> tags and they are expanded
13537 ## much later. We are verifying that this <meta> tag usage
13538 ## doesn't prevent foster parenting.
13539 !! test
13540 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13541 !! wikitext
13542 {{PartialTable}}<ref>foo</ref>
13543 |}
13544
13545 <references />
13546 !! html/parsoid
13547 <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="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p><table about="#mwt2">
13548 <tbody>
13549 </tbody></table>
13550
13551 <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="./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">foo</span></li></ol>
13552 !! end
13553
13554 !! test
13555 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13556 !! wikitext
13557 {{echo|
13558 {{{!}}
13559 {{!}}-}}
13560 <onlyinclude>
13561 |foo
13562 </onlyinclude>
13563 {{!}}}
13564 !! html/parsoid
13565 <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{{!}}}"]}'>
13566 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13567 <tbody><tr>
13568
13569 <td>foo
13570 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13571 </tbody></table>
13572 !! end
13573
13574 !!test
13575 Templates: Lists: Multi-line list-items via templates
13576 !! wikitext
13577 *{{echo|a {{nonexistent|
13578 unused}}}}
13579 *{{echo|b {{nonexistent|
13580 unused}}}}
13581 !! html
13582 <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>
13583 <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>
13584
13585 !!end
13586
13587 !!test
13588 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13589 !! wikitext
13590 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13591 !! html
13592 <p><i>ab</i>c<i>d</i>e
13593 </p>
13594 !!end
13595
13596 !!test
13597 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13598 (PHP parser generates misnested html)
13599 !! wikitext
13600 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13601 !! html/parsoid
13602 <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>
13603 !!end
13604
13605 !!test
13606 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13607 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13608 !! options
13609 parsoid=wt2html,wt2wt
13610 !! wikitext
13611 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13612 !! html
13613 <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>
13614 <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>
13615 <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>
13616 !!end
13617
13618 !!test
13619 Templates: Ugly nesting: 4. Divs opened/closed across templates
13620 !! wikitext
13621 a<div>b{{echo|c</div>d}}e
13622 !! html
13623 a<div>bc</div>de
13624
13625 !! html+tidy
13626 <p>a</p><div>bc</div><p>de
13627 </p>
13628 !! end
13629
13630 !! test
13631 Templates: Ugly templates: 3. newline-only template parameter
13632 !! wikitext
13633 foo {{echo|
13634 }}
13635 !! html
13636 <p>foo
13637 </p>
13638 !! end
13639
13640 # This looks like a bug: a single newline triggers p/br for some reason.
13641 !! test
13642 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13643 !! wikitext
13644 {{echo|
13645 }}
13646 !! html
13647 <p><br />
13648 </p>
13649 !! end
13650
13651 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13652 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13653 !! test
13654 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13655 !! wikitext
13656 {{echo|<table>}}
13657 {{echo|<div>foo}}
13658 {{echo|</table>}}
13659 !! html/parsoid
13660 <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">
13661 </span><table about="#mwt1">
13662 </table>
13663 !! end
13664
13665 # T66017 -- ugly wikitext with fostered content generates two template ranges
13666 # that are "identical" and generate nesting cycles in the algorithm
13667 !! test
13668 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13669 !! wikitext
13670 {{echo|<table><tr><td><table>}}
13671 {{echo|<div>}}
13672 {{echo|</div>}}
13673 !! html/parsoid
13674 <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"}'>
13675 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13676 </table></td></tr></tbody></table>
13677 !! end
13678
13679 !! test
13680 Templates: Parameters substituted at the top-level
13681 !! wikitext
13682 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13683
13684 {{{foo|bar|baz}}}
13685 !! html/php
13686 <p><i>who</i> me? <b>never!</b>
13687 </p><p>bar
13688 </p>
13689 !! html/parsoid
13690 <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>
13691
13692 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13693 !! end
13694
13695 !! test
13696 Templates: Param with empty arg in the final position
13697 !! wikitext
13698 {{{hi|}}}
13699 !! html/parsoid
13700 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13701 !! end
13702
13703 !!test
13704 Parser Functions: 1. Simple example
13705 !! wikitext
13706 {{uc:foo}}
13707 !! html
13708 <p>FOO
13709 </p>
13710 !!end
13711
13712 !!test
13713 Parser Functions: 2. Nested use (only outermost should be marked up)
13714 !! wikitext
13715 {{uc:{{lc:FOO}}}}
13716 !! html
13717 <p>FOO
13718 </p>
13719 !!end
13720
13721 ## Note that the templates inside the references are not wrapped
13722 !! test
13723 Template nested in extension tag in template
13724 !! options
13725 language=zh
13726 !! wikitext
13727 {{echo|hi<ref>[[ho|{{echo|hi}}]]</ref>}}
13728 {{echo|hi<ref>[http://test.com?q={{echo|ho}}]</ref>}}
13729 {{echo|hi<ref>-{ho|{{echo|hi}}}-</ref>}}
13730 <references />
13731 !! html/parsoid
13732 <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="./Wikipedia:首页#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
13733 <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="./Wikipedia:首页#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup>
13734 <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="./Wikipedia:首页#cite_note-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup></p>
13735 <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="./Wikipedia:首页#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="./Wikipedia:首页#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="./Wikipedia:首页#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>
13736 !! end
13737
13738 ###
13739 ### Pre-save transform tests
13740 ###
13741
13742 !! test
13743 pre-save transform: subst:
13744 !! options
13745 pst
13746 !! wikitext
13747 {{subst:test}}
13748 !! html/php
13749 This is a test template
13750 !! end
13751
13752 !! test
13753 pre-save transform: normal template
13754 !! options
13755 pst
13756 !! wikitext
13757 {{test}}
13758 !! html/php
13759 {{test}}
13760 !! end
13761
13762 !! test
13763 pre-save transform: nonexistent template
13764 !! options
13765 pst
13766 !! wikitext
13767 {{thistemplatedoesnotexist}}
13768 !! html/php
13769 {{thistemplatedoesnotexist}}
13770 !! end
13771
13772 !! test
13773 pre-save transform: subst magic variables
13774 !! options
13775 pst
13776 !! wikitext
13777 {{subst:SITENAME}}
13778 !! html/php
13779 MediaWiki
13780 !! end
13781
13782 # This is T2089, which I fixed. -- wtm
13783 !! test
13784 pre-save transform: subst: templates with parameters
13785 !! options
13786 pst
13787 !! wikitext
13788 {{subst:paramtest|param="something else"}}
13789 !! html/php
13790 This is a test template with parameter "something else"
13791 !! end
13792
13793 !! article
13794 Template:nowikitest
13795 !! text
13796 <nowiki>'''not wiki'''</nowiki>
13797 !! endarticle
13798
13799 !! test
13800 pre-save transform: nowiki in subst (T3188)
13801 !! options
13802 pst
13803 !! wikitext
13804 {{subst:nowikitest}}
13805 !! html/php
13806 <nowiki>'''not wiki'''</nowiki>
13807 !! end
13808
13809 !! article
13810 Template:commenttest
13811 !! text
13812 This template has <!-- a comment --> in it.
13813 !! endarticle
13814
13815 !! test
13816 pre-save transform: comment in subst (T3936)
13817 !! options
13818 pst
13819 !! wikitext
13820 {{subst:commenttest}}
13821 !! html/php
13822 This template has <!-- a comment --> in it.
13823 !! end
13824
13825 !! test
13826 pre-save transform: unclosed tag
13827 !! options
13828 pst
13829 !! wikitext
13830 <nowiki>'''not wiki'''
13831 !! html/php
13832 <nowiki>'''not wiki'''
13833 !! end
13834
13835 !! test
13836 pre-save transform: mixed tag case
13837 !! options
13838 pst
13839 !! wikitext
13840 <NOwiki>'''not wiki'''</noWIKI>
13841 !! html/php
13842 <NOwiki>'''not wiki'''</noWIKI>
13843 !! end
13844
13845 !! test
13846 pre-save transform: unclosed comment in <nowiki>
13847 !! options
13848 pst
13849 !! wikitext
13850 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13851 !! html/php
13852 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13853 !!end
13854
13855 # Leading @ in this template definition works around a limitation
13856 # in parsoid's parserTests which otherwise strips the <span> from the
13857 # result (confusing it for a template wrapper)
13858 !! article
13859 Template:dangerous
13860 !!text
13861 @<span onmouseover="alert('crap')">Oh no</span>
13862 !!endarticle
13863
13864 !!test
13865 (confirming safety of fix for subst T3936)
13866 !! wikitext
13867 {{Template:dangerous}}
13868 !! html
13869 <p>@<span>Oh no</span>
13870 </p>
13871 !! end
13872
13873 !! test
13874 pre-save transform: comment containing gallery (T7024)
13875 !! options
13876 pst
13877 !! wikitext
13878 <!-- <gallery>data</gallery> -->
13879 !! html/php
13880 <!-- <gallery>data</gallery> -->
13881 !!end
13882
13883 !! test
13884 pre-save transform: comment containing extension
13885 !! options
13886 pst
13887 !! wikitext
13888 <!-- <tag>data</tag> -->
13889 !! html/php
13890 <!-- <tag>data</tag> -->
13891 !!end
13892
13893 !! test
13894 pre-save transform: comment containing nowiki
13895 !! options
13896 pst
13897 !! wikitext
13898 <!-- <nowiki>data</nowiki> -->
13899 !! html/php
13900 <!-- <nowiki>data</nowiki> -->
13901 !!end
13902
13903 !! test
13904 pre-save transform: <noinclude> in subst (T5298)
13905 !! options
13906 pst
13907 !! wikitext
13908 {{subst:Includes}}
13909 !! html/php
13910 Foobar
13911 !! end
13912
13913 !! test
13914 pre-save transform: <onlyinclude> in subst (T5298)
13915 !! options
13916 pst
13917 !! wikitext
13918 {{subst:Includes2}}
13919 !! html/php
13920 Foo
13921 !! end
13922
13923 !! article
13924 Template:SubstTest
13925 !!text
13926 {{<includeonly>subst:</includeonly>Includes}}
13927 !! endarticle
13928
13929 !! article
13930 Template:SafeSubstTest
13931 !! text
13932 {{<includeonly>safesubst:</includeonly>Includes}}
13933 !! endarticle
13934
13935 !! test
13936 T24297: safesubst: works during PST
13937 !! options
13938 pst
13939 !! wikitext
13940 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13941 !! html/php
13942 FoobarFoobar
13943 !! end
13944
13945 !! test
13946 T24297: safesubst: works during normal parse
13947 !! wikitext
13948 {{SafeSubstTest}}
13949 !! html
13950 <p>Foobar
13951 </p>
13952 !! end
13953
13954 !! test
13955 subst: does not work during normal parse
13956 !! wikitext
13957 {{SubstTest}}
13958 !! html
13959 <p>{{subst:Includes}}
13960 </p>
13961 !! end
13962
13963 !! test
13964 pre-save transform: context links ("pipe trick")
13965 !! options
13966 pst
13967 !! wikitext
13968 [[Article (context)|]]
13969 [[Bar:Article|]]
13970 [[:Bar:Article|]]
13971 [[Bar:Article (context)|]]
13972 [[:Bar:Article (context)|]]
13973 [[|Article]]
13974 [[|Article (context)]]
13975 [[Bar:X (Y) Z|]]
13976 [[:Bar:X (Y) Z|]]
13977 !! html/php
13978 [[Article (context)|Article]]
13979 [[Bar:Article|Article]]
13980 [[:Bar:Article|Article]]
13981 [[Bar:Article (context)|Article]]
13982 [[:Bar:Article (context)|Article]]
13983 [[Article]]
13984 [[Article (context)]]
13985 [[Bar:X (Y) Z|X (Y) Z]]
13986 [[:Bar:X (Y) Z|X (Y) Z]]
13987 !! end
13988
13989 !! test
13990 pre-save transform: context links ("pipe trick") with interwiki prefix
13991 !! options
13992 pst
13993 !! wikitext
13994 [[interwiki:Article|]]
13995 [[:interwiki:Article|]]
13996 [[interwiki:Bar:Article|]]
13997 [[:interwiki:Bar:Article|]]
13998 !! html/php
13999 [[interwiki:Article|Article]]
14000 [[:interwiki:Article|Article]]
14001 [[interwiki:Bar:Article|Bar:Article]]
14002 [[:interwiki:Bar:Article|Bar:Article]]
14003 !! end
14004
14005 !! test
14006 pre-save transform: context links ("pipe trick") with parens in title
14007 !! options
14008 pst title=[[Somearticle (context)]]
14009 !! wikitext
14010 [[|Article]]
14011 !! html/php
14012 [[Article (context)|Article]]
14013 !! end
14014
14015 !! test
14016 pre-save transform: context links ("pipe trick") with comma in title
14017 !! options
14018 pst title=[[Someplace, Somewhere]]
14019 !! wikitext
14020 [[|Otherplace]]
14021 [[Otherplace, Elsewhere|]]
14022 [[Otherplace, Elsewhere, Anywhere|]]
14023 !! html/php
14024 [[Otherplace, Somewhere|Otherplace]]
14025 [[Otherplace, Elsewhere|Otherplace]]
14026 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
14027 !! end
14028
14029 !! test
14030 pre-save transform: context links ("pipe trick") with parens and comma
14031 !! options
14032 pst title=[[Someplace (IGNORED), Somewhere]]
14033 !! wikitext
14034 [[|Otherplace]]
14035 [[Otherplace (place), Elsewhere|]]
14036 !! html/php
14037 [[Otherplace, Somewhere|Otherplace]]
14038 [[Otherplace (place), Elsewhere|Otherplace]]
14039 !! end
14040
14041 !! test
14042 pre-save transform: context links ("pipe trick") with comma and parens
14043 !! options
14044 pst title=[[Who, me? (context)]]
14045 !! wikitext
14046 [[|Yes, you.]]
14047 [[Me, Myself, and I (1937 song)|]]
14048 !! html/php
14049 [[Yes, you. (context)|Yes, you.]]
14050 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
14051 !! end
14052
14053 !! test
14054 pre-save transform: context links ("pipe trick") with namespace
14055 !! options
14056 pst title=[[Ns:Somearticle]]
14057 !! wikitext
14058 [[|Article]]
14059 !! html/php
14060 [[Ns:Article|Article]]
14061 !! end
14062
14063 !! test
14064 pre-save transform: context links ("pipe trick") with namespace and parens
14065 !! options
14066 pst title=[[Ns:Somearticle (context)]]
14067 !! wikitext
14068 [[|Article]]
14069 !! html/php
14070 [[Ns:Article (context)|Article]]
14071 !! end
14072
14073 !! test
14074 pre-save transform: context links ("pipe trick") with namespace and comma
14075 !! options
14076 pst title=[[Ns:Somearticle, Context, Whatever]]
14077 !! wikitext
14078 [[|Article]]
14079 !! html/php
14080 [[Ns:Article, Context, Whatever|Article]]
14081 !! end
14082
14083 !! test
14084 pre-save transform: context links ("pipe trick") with namespace, comma and parens
14085 !! options
14086 pst title=[[Ns:Somearticle, Context (context)]]
14087 !! wikitext
14088 [[|Article]]
14089 !! html/php
14090 [[Ns:Article (context)|Article]]
14091 !! end
14092
14093 !! test
14094 pre-save transform: context links ("pipe trick") with namespace, parens and comma
14095 !! options
14096 pst title=[[Ns:Somearticle (IGNORED), Context]]
14097 !! wikitext
14098 [[|Article]]
14099 !! html/php
14100 [[Ns:Article, Context|Article]]
14101 !! end
14102
14103 !! test
14104 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
14105 !! options
14106 pst
14107 !! wikitext
14108 [[Article(context)|]]
14109 [[Bar:Article(context)|]]
14110 [[:Bar:Article(context)|]]
14111 [[|Article(context)]]
14112 [[Bar:X(Y)Z|]]
14113 [[:Bar:X(Y)Z|]]
14114 !! html/php
14115 [[Article(context)|Article]]
14116 [[Bar:Article(context)|Article]]
14117 [[:Bar:Article(context)|Article]]
14118 [[Article(context)]]
14119 [[Bar:X(Y)Z|X(Y)Z]]
14120 [[:Bar:X(Y)Z|X(Y)Z]]
14121 !! end
14122
14123 !! test
14124 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
14125 !! options
14126 pst
14127 !! wikitext
14128 [[Article (context)|]]
14129 [[Bar:Article (context)|]]
14130 [[:Bar:Article (context)|]]
14131 [[|Article (context)]]
14132 [[Bar:X (Y) Z|]]
14133 [[:Bar:X (Y) Z|]]
14134 !! html/php
14135 [[Article (context)|Article]]
14136 [[Bar:Article (context)|Article]]
14137 [[:Bar:Article (context)|Article]]
14138 [[Article (context)]]
14139 [[Bar:X (Y) Z|X (Y) Z]]
14140 [[:Bar:X (Y) Z|X (Y) Z]]
14141 !! end
14142
14143 !! test
14144 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
14145 !! options
14146 pst
14147 !! wikitext
14148 [[Article(context)|]]
14149 [[Bar:Article(context)|]]
14150 [[:Bar:Article(context)|]]
14151 [[|Article(context)]]
14152 [[Bar:X(Y)Z|]]
14153 [[:Bar:X(Y)Z|]]
14154 !! html/php
14155 [[Article(context)|Article]]
14156 [[Bar:Article(context)|Article]]
14157 [[:Bar:Article(context)|Article]]
14158 [[Article(context)]]
14159 [[Bar:X(Y)Z|X(Y)Z]]
14160 [[:Bar:X(Y)Z|X(Y)Z]]
14161 !! end
14162
14163 !! test
14164 pre-save transform: context links ("pipe trick") with commas (T23660)
14165 !! options
14166 pst
14167 !! wikitext
14168 [[Article (context), context|]]
14169 [[Article (context),context|]]
14170 [[Bar:Article (context), context|]]
14171 [[Bar:Article (context),context|]]
14172 [[:Bar:Article (context), context|]]
14173 [[:Bar:Article (context),context|]]
14174 !! html/php
14175 [[Article (context), context|Article]]
14176 [[Article (context),context|Article]]
14177 [[Bar:Article (context), context|Article]]
14178 [[Bar:Article (context),context|Article]]
14179 [[:Bar:Article (context), context|Article]]
14180 [[:Bar:Article (context),context|Article]]
14181 !! end
14182
14183 !! test
14184 Parsoid: backwards pipe trick
14185 !! wikitext
14186 [[|'''bar''']]
14187 !! html/php
14188 <p>[[|<b>bar</b>]]
14189 </p>
14190 !! html/parsoid
14191 <p>[[|<b>bar</b>]]</p>
14192 !! end
14193
14194 !! test
14195 pre-save transform: trim trailing empty lines
14196 !! options
14197 pst
14198 !! wikitext
14199 Empty lines are trimmed
14200
14201
14202
14203
14204 !! html/php
14205 Empty lines are trimmed
14206 !! end
14207
14208 !! test
14209 pre-save transform: Signature expansion
14210 !! options
14211 pst
14212 !! wikitext
14213 * ~~~
14214 * ~~~~
14215 * ~~~~~
14216 * <noinclude>~~~</noinclude>
14217 * <includeonly>~~~</includeonly>
14218 * <onlyinclude>~~~</onlyinclude>
14219 !! html/php
14220 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
14221 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14222 * 00:02, 1 January 1970 (UTC)
14223 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
14224 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
14225 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
14226 !! end
14227
14228
14229 !! test
14230 ParserOutput flags from signature expansion (T84843)
14231 !! options
14232 pst
14233 showflags
14234 !! wikitext
14235 ~~~~
14236 !! html/php
14237 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14238 flags=user-signature
14239 !! end
14240
14241
14242 !! test
14243 pre-save transform: Signature expansion in nowiki tags (T2093)
14244 !! options
14245 pst disabled
14246 !! wikitext
14247 Shall not expand:
14248
14249 <nowiki>~~~~</nowiki>
14250
14251 <includeonly><nowiki>~~~~</nowiki></includeonly>
14252
14253 <noinclude><nowiki>~~~~</nowiki></noinclude>
14254
14255 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14256
14257 {{subst:Foo}} shall be converted to FOO
14258
14259 As well as inside noinclude/onlyinclude
14260 <noinclude>{{subst:Foo}}</noinclude>
14261 <onlyinclude>{{subst:Foo}}</onlyinclude>
14262
14263 But not inside includeonly
14264 <includeonly>{{subst:Foo}}</includeonly>
14265 !! html/php
14266 Shall not expand:
14267
14268 <nowiki>~~~~</nowiki>
14269
14270 <includeonly><nowiki>~~~~</nowiki></includeonly>
14271
14272 <noinclude><nowiki>~~~~</nowiki></noinclude>
14273
14274 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14275
14276 FOO shall be converted to FOO
14277
14278 As well as inside noinclude/onlyinclude
14279 <noinclude>FOO</noinclude>
14280 <onlyinclude>FOO</onlyinclude>
14281
14282 But not inside includeonly
14283 <includeonly>{{subst:Foo}}</includeonly>
14284 !! end
14285
14286 !! test
14287 Parsoid: Recognize nowiki with trailing space in tags
14288 !! options
14289 parsoid=wt2html
14290 !! wikitext
14291 <nowiki ><div>[[foo]]</nowiki >
14292
14293 a<nowiki / >b
14294
14295 c<nowiki />d
14296
14297 e<nowiki/ >f
14298 !! html/php+tidy
14299 <p>&lt;div&gt;[[foo]]
14300 </p><p>a&lt;nowiki / &gt;b
14301 </p><p>cd
14302 </p><p>e&lt;nowiki/ &gt;f
14303 </p>
14304 !! html/parsoid
14305 <p><span typeof="mw:Nowiki">&lt;div>[[foo]]</span></p>
14306
14307 <p>a&lt;nowiki / >b</p>
14308
14309 <p>c<span typeof="mw:Nowiki"></span>d</p>
14310
14311 <p>e&lt;nowiki/ >f</p>
14312 !! end
14313
14314 !! test
14315 Parsoid: Recognize nowiki with odd capitalization
14316 !! options
14317 parsoid=wt2html
14318 !! wikitext
14319 <noWikI ><div>[[foo]]</Nowiki >
14320 !! html
14321 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14322 !! end
14323
14324
14325 !! test
14326 Parsoid: Escape nowiki with trailing space in tags
14327 !! options
14328 parsoid=html2wt
14329 !! html/parsoid
14330 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14331 <p>a&lt;nowiki /&gt;b</p>
14332 <p>c&lt;nowiki/ &gt;d</p>
14333 !! wikitext
14334 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14335
14336 a&lt;nowiki /&gt;b
14337
14338 c&lt;nowiki/ &gt;d
14339 !! end
14340
14341 !! test
14342 Parsoid: Escape weird noWikI capitalizations
14343 !! options
14344 parsoid=html2wt
14345 !! html/parsoid
14346 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14347 !! wikitext
14348 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14349 !! end
14350
14351 ###
14352 ### Message transform tests
14353 ###
14354 !! test
14355 message transform: magic variables
14356 !! options
14357 msg
14358 !! wikitext
14359 {{SITENAME}}
14360 !! html
14361 MediaWiki
14362 !! end
14363
14364 !! test
14365 message transform: should not transform wiki markup
14366 !! options
14367 msg
14368 !! wikitext
14369 ''test''
14370 !! html
14371 ''test''
14372 !! end
14373
14374 !! test
14375 message transform: <noinclude> in transcluded template (T6926)
14376 !! options
14377 msg
14378 !! wikitext
14379 {{Includes}}
14380 !! html
14381 Foobar
14382 !! end
14383
14384 !! test
14385 message transform: <onlyinclude> in transcluded template (T6926)
14386 !! options
14387 msg
14388 !! wikitext
14389 {{Includes2}}
14390 !! html
14391 Foo
14392 !! end
14393
14394 !! test
14395 {{#special:}} page name, known
14396 !! options
14397 msg
14398 !! wikitext
14399 {{#special:Recentchanges}}
14400 !! html
14401 Special:RecentChanges
14402 !! end
14403
14404 !! test
14405 {{#special:}} page name with subpage, known
14406 !! options
14407 msg
14408 !! wikitext
14409 {{#special:Recentchanges/param}}
14410 !! html
14411 Special:RecentChanges/param
14412 !! end
14413
14414 !! test
14415 {{#special:}} page name, unknown
14416 !! options
14417 msg
14418 !! wikitext
14419 {{#special:foobar nonexistent}}
14420 !! html
14421 Special:Foobar nonexistent
14422 !! end
14423
14424 !! test
14425 {{#speciale:}} page name, known
14426 !! options
14427 msg
14428 !! wikitext
14429 {{#speciale:Recentchanges}}
14430 !! html
14431 Special:RecentChanges
14432 !! end
14433
14434 !! test
14435 {{#speciale:}} page name with subpage, known
14436 !! options
14437 msg
14438 !! wikitext
14439 {{#speciale:Recentchanges/param}}
14440 !! html
14441 Special:RecentChanges/param
14442 !! end
14443
14444 !! test
14445 {{#speciale:}} page name, unknown
14446 !! options
14447 msg
14448 !! wikitext
14449 {{#speciale:foobar nonexistent}}
14450 !! html
14451 Special:Foobar_nonexistent
14452 !! end
14453
14454 ###
14455 ### Images
14456 ###
14457 ### For Parsoid-specific tests, see
14458 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14459
14460 !! test
14461 Simple image
14462 !! options
14463 parsoid=wt2html,wt2wt,html2html
14464 !! wikitext
14465 [[Image:foobar.jpg]]
14466 !! html/php
14467 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14468 </p>
14469 !! html/parsoid
14470 <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>
14471 !! end
14472
14473 !! test
14474 Serialize simple image with span wrapper
14475 !! options
14476 parsoid=html2wt
14477 !! html/parsoid
14478 <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>
14479 !! wikitext
14480 [[File:Foobar.jpg]]
14481 !! end
14482
14483 !! test
14484 Simple image (using File: namespace, now canonical)
14485 !! wikitext
14486 [[File:Foobar.jpg]]
14487 !! html/php
14488 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14489 </p>
14490 !! html/parsoid
14491 <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>
14492 !! end
14493
14494 !! test
14495 Right-aligned image
14496 !! wikitext
14497 [[File:Foobar.jpg|right]]
14498 !! html/php
14499 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14500
14501 !! html/parsoid
14502 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14503 !! end
14504
14505 !! test
14506 Image with caption
14507 !! wikitext
14508 [[File:Foobar.jpg|right|Caption text]]
14509 !! html/php
14510 <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" width="1941" height="220" /></a></div>
14511
14512 !! html/parsoid
14513 <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>
14514 !! end
14515
14516 !! test
14517 Image with caption, T55312 #1
14518 !! wikitext
14519 [[File:Foobar.jpg|right|Caption page stuff]]
14520 !! html/php
14521 <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" width="1941" height="220" /></a></div>
14522
14523 !! html/parsoid
14524 <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>
14525 !! end
14526
14527 !! test
14528 Image with caption, T55312 #2
14529 !! wikitext
14530 [[File:Foobar.jpg|right|Caption page=]]
14531 !! html/php
14532 <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" width="1941" height="220" /></a></div>
14533
14534 !! html/parsoid
14535 <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>
14536 !! end
14537
14538 !! test
14539 Image with caption, T55312 #3
14540 !! wikitext
14541 [[File:Foobar.jpg|right|Caption page=stuff]]
14542 !! html/php
14543 <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" width="1941" height="220" /></a></div>
14544
14545 !! html/parsoid
14546 <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>
14547 !! end
14548
14549 !! test
14550 Image caption with pipe entity
14551 !! wikitext
14552 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14553 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14554 !! html/php
14555 <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" 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>
14556 <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" 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>
14557
14558 !! html/parsoid
14559 <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>
14560 <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>
14561 !! end
14562
14563 !! test
14564 Allow empty links in image captions (T62753)
14565 !! options
14566 thumbsize=220
14567 !! wikitext
14568 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14569 [[]]
14570 [[Link2]]
14571 ]]
14572 !! html/php
14573 <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" 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>
14574
14575 !! html/parsoid
14576 <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>
14577 [[]]
14578 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14579 </figcaption></figure>
14580 !! end
14581
14582 !! test
14583 Titles in unlinked images (T23454)
14584 !! wikitext
14585 [[File:Foobar.jpg|link=|stuff]]
14586 !! html/php
14587 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14588 </p>
14589 !! html/parsoid
14590 <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>
14591 !! end
14592
14593 !! test
14594 Link with empty target
14595 !! wikitext
14596 [[]]
14597 !! html
14598 <p>[[]]
14599 </p>
14600 !! end
14601
14602 !! test
14603 Image with link trail
14604 !! wikitext
14605 Linktrails should not work for images: [[File:Foobar.jpg]]s
14606 !! html/php
14607 <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" width="1941" height="220" /></a>s
14608 </p>
14609 !! html/parsoid
14610 <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>
14611 !! end
14612
14613 !! test
14614 Image with empty attribute
14615 !! options
14616 parsoid=wt2html,wt2wt,html2html
14617 !! wikitext
14618 [[File:Foobar.jpg|right||Caption text]]
14619 !! html/php
14620 <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" width="1941" height="220" /></a></div>
14621
14622 !! html/parsoid
14623 <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>
14624 !! end
14625
14626 !! test
14627 1. Block image with individual attributes from templates
14628 !! wikitext
14629 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14630 !! html/php
14631 <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" 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>
14632
14633 !! html/parsoid
14634 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
14635 !! end
14636
14637 !! test
14638 2. Block Image with individual attributes from templates
14639 !! wikitext
14640 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14641 !! html/php
14642 <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" 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>
14643
14644 !! html/parsoid
14645 <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>
14646 !! end
14647
14648 !! test
14649 3. Inline image with individual attributes from templates
14650 !! wikitext
14651 [[File:Foobar.jpg|{{echo|50px}}]]
14652 !! html/php
14653 <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" 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>
14654 </p>
14655 !! html/parsoid
14656 <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>
14657 !! end
14658
14659 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14660 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14661 !! test
14662 Image with multiple attributes from the same template
14663 !! wikitext
14664 [[File:Foobar.jpg|{{image_attribs}}]]
14665 !! html/php
14666 <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" width="1941" height="220" /></a></div>
14667
14668 !! html/parsoid
14669 <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>
14670 !! end
14671
14672 !! test
14673 Image with link tails
14674 !! options
14675 thumbsize=220
14676 !! wikitext
14677 123[[File:Foobar.jpg]]456
14678 123[[File:Foobar.jpg|right]]456
14679 123[[File:Foobar.jpg|thumb]]456
14680 !! html/php
14681 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
14682 </p>
14683 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" width="1941" height="220" /></a></div>456
14684 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" 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
14685
14686 !! html/php+tidy
14687 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
14688 </p><p>
14689 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" width="1941" height="220" /></a></div><p>456
14690 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" 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
14691 </p>
14692 !! html/parsoid
14693 <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>
14694 <p>123</p><figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure><p>456
14695 123</p><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure><p>456</p>
14696 !! end
14697
14698 !! test
14699 Image with multiple captions -- only last one is accepted
14700 !! wikitext
14701 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14702 !! html/php
14703 <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" width="1941" height="220" /></a></div>
14704
14705 !! html/parsoid
14706 <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>
14707 !! end
14708
14709 !! test
14710 Image with multiple widths -- use last
14711 !! wikitext
14712 [[File:Foobar.jpg|200px|300px|caption]]
14713 !! html/php
14714 <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" 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>
14715 </p>
14716 !! html/parsoid
14717 <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>
14718 !! end
14719
14720 !! test
14721 Image with multiple alignments -- use first (T50664)
14722 !! options
14723 thumbsize=220
14724 !! wikitext
14725 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14726
14727 [[File:Foobar.jpg|middle|text-top|caption]]
14728 !! html/php
14729 <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" 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>
14730 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" style="vertical-align: middle" /></a>
14731 </p>
14732 !! html/parsoid
14733 <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>
14734 <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>
14735 !! end
14736
14737 !! test
14738 Image with width attribute at different positions
14739 !! wikitext
14740 [[File:Foobar.jpg|200px|right|Caption]]
14741 [[File:Foobar.jpg|right|200px|Caption]]
14742 [[File:Foobar.jpg|right|Caption|200px]]
14743 !! html/php
14744 <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" 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>
14745 <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" 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>
14746 <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" 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>
14747
14748 !! html/parsoid
14749 <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>
14750 <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>
14751 <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>
14752 !! end
14753
14754 # a sad bit of backward-compatibility
14755 !! test
14756 Image with size specified with pxpx (T15500, T53628)
14757 !! options
14758 parsoid=wt2html,wt2wt,html2html
14759 !! wikitext
14760 [[File:Foobar.jpg|20pxpx]]
14761 [[File:Foobar.jpg|200x20pxpx]]
14762 !! html/php
14763 <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" 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>
14764 <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" 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>
14765 </p>
14766 !! html/parsoid
14767 <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>
14768 !! end
14769
14770 !! test
14771 Image with link parameter, wiki target
14772 !! wikitext
14773 [[File:Foobar.jpg|link=Main Page]]
14774 !! html/php
14775 <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14776 </p>
14777 !! html/parsoid
14778 <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>
14779 !! end
14780
14781 # parsoid T51293 (part 1)
14782 !! test
14783 Image with link parameter, URL target
14784 !! wikitext
14785 [[File:Foobar.jpg|link=http://example.com/]]
14786 !! html/php
14787 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14788 </p>
14789 !! html/parsoid
14790 <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>
14791 !! end
14792
14793 # parsoid T51293 (part 2)
14794 !! test
14795 Image with link parameter, protocol-less URL target
14796 !! wikitext
14797 [[File:Foobar.jpg|link=//example.com/]]
14798 !! html/php
14799 <p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14800 </p>
14801 !! html/parsoid
14802 <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>
14803 !! end
14804
14805 !! test
14806 Escaping non-block captions (T107435)
14807 !! options
14808 parsoid={
14809 "modes": ["wt2wt"],
14810 "changes": [
14811 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14812 ]
14813 }
14814 !! wikitext
14815 [[Image:Foobar.jpg|caption]]
14816 !! wikitext/edited
14817 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14818 !! end
14819
14820 # wgExternalLinkTarget not supported by Parsoid
14821 !! test
14822 Image with link parameter, wgExternalLinkTarget
14823 !! wikitext
14824 [[Image:foobar.jpg|link=http://example.com/]]
14825 !! config
14826 wgExternalLinkTarget='foobar'
14827 !! html/php
14828 <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" width="1941" height="220" /></a>
14829 </p>
14830 !! end
14831
14832 !! test
14833 Image with link parameter, wgNoFollowLinks set to false
14834 !! wikitext
14835 [[Image:foobar.jpg|link=http://example.com/]]
14836 !! config
14837 wgNoFollowLinks=false
14838 !! html/php
14839 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14840 </p>
14841 !! end
14842
14843 !! test
14844 Image with link parameter, wgNoFollowDomainExceptions
14845 !! wikitext
14846 [[Image:foobar.jpg|link=http://example.com/]]
14847 !! config
14848 wgNoFollowDomainExceptions='example.com'
14849 !! html/php
14850 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14851 </p>
14852 !! end
14853
14854 # wgExternalLinkTarget not supported by Parsoid
14855 !! test
14856 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14857 !! wikitext
14858 [[Image:foobar.jpg|link=http://example.com/|Title]]
14859 !! config
14860 wgExternalLinkTarget='foobar'
14861 !! html/php
14862 <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" width="1941" height="220" /></a>
14863 </p>
14864 !! end
14865
14866 !! test
14867 Image with empty link parameter
14868 !! wikitext
14869 [[File:Foobar.jpg|link=]]
14870 !! html/php
14871 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14872 </p>
14873 !! html/parsoid
14874 <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>
14875 !! end
14876
14877 !! test
14878 Image with link parameter (wiki target) and unnamed parameter
14879 !! wikitext
14880 [[File:Foobar.jpg|link=Main_Page|Title]]
14881 !! html/php
14882 <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14883 </p>
14884 !! html/parsoid
14885 <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>
14886 !! end
14887
14888 !! test
14889 Image with link parameter (URL target) and unnamed parameter
14890 !! wikitext
14891 [[File:Foobar.jpg|link=http://example.com/|Title]]
14892 !! html/php
14893 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14894 </p>
14895 !! html/parsoid
14896 <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>
14897 !! end
14898
14899 !! test
14900 Thumbnail image with link parameter
14901 !! options
14902 thumbsize=220
14903 parsoid=wt2html,wt2wt,html2html
14904 !! wikitext
14905 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14906 !! html/php
14907 <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" 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>
14908
14909 !! html/parsoid
14910 <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>
14911 !! end
14912
14913 !! test
14914 Manually-specified thumbnail image
14915 !! options
14916 thumbsize=220
14917 !! wikitext
14918 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14919 !! html/php
14920 <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" 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>
14921
14922 !! html/parsoid
14923 <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>
14924 !! end
14925
14926 !! test
14927 Manually-specified thumbnail image with explicit link to wiki page
14928 !! options
14929 thumbsize=220
14930 parsoid=wt2html,wt2wt,html2html
14931 !! wikitext
14932 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14933 !! html/php
14934 <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" 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>
14935
14936 !! html/parsoid
14937 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14938 !! end
14939
14940 !! test
14941 Manually-specified thumbnail image with explicit link to url
14942 !! options
14943 thumbsize=220
14944 parsoid=wt2html,wt2wt,html2html
14945 !! wikitext
14946 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14947 !! html/php
14948 <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" 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>
14949
14950 !! html/parsoid
14951 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="http://example.com"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14952 !! end
14953
14954 !! test
14955 Manually-specified thumbnail image with explicit no link
14956 !! options
14957 thumbsize=220
14958 parsoid=wt2html,wt2wt,html2html
14959 !! wikitext
14960 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14961 !! html/php
14962 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" 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>
14963
14964 !! html/parsoid
14965 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
14966 !! end
14967
14968 !! test
14969 Manually-specified thumbnail image with explicit link and alt text
14970 !! options
14971 thumbsize=220
14972 parsoid=wt2html,wt2wt,html2html
14973 !! wikitext
14974 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14975 !! html/php
14976 <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" 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>
14977
14978 !! html/parsoid
14979 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./Main_Page"><img alt="alttext" resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14980 !! end
14981
14982 !! test
14983 Image with frame and link
14984 !! options
14985 parsoid=wt2html,wt2wt,html2html
14986 !! wikitext
14987 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14988 !! html/php
14989 <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" 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>
14990
14991 !! html/parsoid
14992 <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>
14993 !! end
14994
14995 !! test
14996 Image with frame and link and explicit alt
14997 !! options
14998 parsoid=wt2html,wt2wt,html2html
14999 !! wikitext
15000 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
15001 !! html/php
15002 <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" 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>
15003
15004 !! html/parsoid
15005 <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>
15006 !! end
15007
15008 !! test
15009 Image with wiki markup in implicit alt
15010 !! wikitext
15011 [[Image:Foobar.jpg|testing '''bold''' in alt]]
15012
15013 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
15014 !! html/php
15015 <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" width="1941" height="220" /></a>
15016 </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" width="1941" height="220" /></a>
15017 </p>
15018 !! html/parsoid
15019 <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>
15020
15021 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></figure-inline></p>
15022 !! end
15023
15024 !! test
15025 Alt image option should handle most kinds of wikitext without barfing
15026 !! wikitext
15027 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
15028 !! html/php
15029 <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" 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>
15030
15031 !! html/parsoid
15032 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&apos;&apos;bold template&apos;&apos;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&apos;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&apos;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;apos;&amp;apos;bold template&amp;apos;&amp;apos;\"}},\"i\":0}}]}&#39;>bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
15033 !! end
15034
15035 !! test
15036 Ampersand in alt attribute (T206940)
15037 !! wikitext
15038 [[File:Foobar.jpg|alt=&amp;amp;]]
15039
15040 <!-- consistency with gallery extension -->
15041 <gallery>
15042 File:Foobar.jpg|alt=&amp;amp;
15043 </gallery>
15044 !! html/php+tidy
15045 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="&amp;amp;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15046 </p>
15047 <ul class="gallery mw-gallery-traditional">
15048 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15049 <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" 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>
15050 <div class="gallerytext">
15051 </div>
15052 </div></li>
15053 </ul>
15054 !! html/parsoid
15055 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="&amp;amp;" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
15056
15057 <!-- consistency with gallery extension -->
15058 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15059 <li class="gallerybox">
15060 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="&amp;amp;" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div>
15061 <div class="gallerytext"></div>
15062 </li>
15063 </ul>
15064 !! end
15065
15066 !! test
15067 Italics markup in alt attribute (T206940)
15068 !! wikitext
15069 [[File:Foobar.jpg|alt=''x''|caption]]
15070
15071 <!-- consistency with gallery extension -->
15072 <gallery>
15073 File:Foobar.jpg|alt=''x''|caption
15074 </gallery>
15075 !! html/php+tidy
15076 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="x" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15077 </p>
15078 <ul class="gallery mw-gallery-traditional">
15079 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15080 <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" 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>
15081 <div class="gallerytext">
15082 <p>caption
15083 </p>
15084 </div>
15085 </div></li>
15086 </ul>
15087 !! html/parsoid
15088 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=&apos;&apos;x&apos;&apos;"},{"ck":"caption","ak":"caption"}]}' data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img alt="x" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"x","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=&apos;&apos;x&apos;&apos;","resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15089
15090 <!-- consistency with gallery extension -->
15091 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|alt=&apos;&apos;x&apos;&apos;|caption\n"}}'>
15092 <li class="gallerybox">
15093 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="x" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div>
15094 <div class="gallerytext">caption</div>
15095 </li>
15096 </ul>
15097 !! end
15098
15099 !! test
15100 Nowiki markup in alt attribute (T206940)
15101 !! wikitext
15102 [[File:Foobar.jpg|alt=<nowiki>''</nowiki>x<nowiki>''</nowiki>|caption]]
15103
15104 <!-- consistency with gallery extension -->
15105 <gallery>
15106 File:Foobar.jpg|alt=<nowiki>''</nowiki>x<nowiki>''</nowiki>|caption
15107 </gallery>
15108 !! html/php+tidy
15109 <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" width="1941" height="220" /></a>
15110 </p>
15111 <ul class="gallery mw-gallery-traditional">
15112 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15113 <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" 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>
15114 <div class="gallerytext">
15115 <p>caption
15116 </p>
15117 </div>
15118 </div></li>
15119 </ul>
15120 !! html/parsoid
15121 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=&lt;nowiki>&apos;&apos;&lt;/nowiki>x&lt;nowiki>&apos;&apos;&lt;/nowiki>"},{"ck":"caption","ak":"caption"}],"dsr":[0,71,null,null]}' data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img alt="''x''" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"&apos;&apos;x&apos;&apos;","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=&lt;nowiki>&apos;&apos;&lt;/nowiki>x&lt;nowiki>&apos;&apos;&lt;/nowiki>","resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15122
15123 <!-- consistency with gallery extension -->
15124 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|alt=&lt;nowiki>&apos;&apos;&lt;/nowiki>x&lt;nowiki>&apos;&apos;&lt;/nowiki>|caption\n"}}'>
15125 <li class="gallerybox">
15126 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="''x''" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div>
15127 <div class="gallerytext">caption</div>
15128 </li>
15129 </ul>
15130 !! end
15131
15132 !! test
15133 Nowiki markup in alt attribute (edited html, no data-parsoid) (T206940)
15134 !! wikitext
15135 [[File:Foobar.jpg|alt=<nowiki>''x''</nowiki>|caption]]
15136
15137 <!-- consistency with gallery extension -->
15138 <gallery>
15139 File:Foobar.jpg|alt=<nowiki>''x''</nowiki>|caption
15140 </gallery>
15141 !! html/php+tidy
15142 <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" width="1941" height="220" /></a>
15143 </p>
15144 <ul class="gallery mw-gallery-traditional">
15145 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15146 <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" 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>
15147 <div class="gallerytext">
15148 <p>caption
15149 </p>
15150 </div>
15151 </div></li>
15152 </ul>
15153 !! html/parsoid
15154 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img alt="''x''" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
15155
15156 <!-- consistency with gallery extension -->
15157 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15158 <li class="gallerybox">
15159 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="''x''" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div>
15160 <div class="gallerytext">caption</div>
15161 </li>
15162 </ul>
15163 !! end
15164
15165 !! test
15166 Ampersand in link attribute (T206940)
15167 !! wikitext
15168 [[File:Foobar.jpg|link=Foo &amp; bar]]
15169
15170 <!-- consistency with gallery extension -->
15171 <gallery>
15172 File:Foobar.jpg|link=Foo &amp; bar
15173 </gallery>
15174 !! html/php+tidy
15175 <p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15176 </p>
15177 <ul class="gallery mw-gallery-traditional">
15178 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15179 <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" 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>
15180 <div class="gallerytext">
15181 </div>
15182 </div></li>
15183 </ul>
15184 !! html/parsoid
15185 <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>
15186
15187 <!-- consistency with gallery extension -->
15188 <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"}}'>
15189 <li class="gallerybox">
15190 <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>
15191 <div class="gallerytext"></div>
15192 </li>
15193 </ul>
15194 !! end
15195
15196 !! test
15197 Ampersand in link attribute (edited html, no data-parsoid) (T206940)
15198 !! wikitext
15199 [[File:Foobar.jpg|link=Foo_&_bar]]
15200
15201 <!-- consistency with gallery extension -->
15202 <gallery>
15203 File:Foobar.jpg|link=Foo_&_bar
15204 </gallery>
15205 !! html/php+tidy
15206 <p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15207 </p>
15208 <ul class="gallery mw-gallery-traditional">
15209 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15210 <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" 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>
15211 <div class="gallerytext">
15212 </div>
15213 </div></li>
15214 </ul>
15215 !! html/parsoid
15216 <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>
15217
15218 <!-- consistency with gallery extension -->
15219 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15220 <li class="gallerybox">
15221 <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>
15222 <div class="gallerytext"></div>
15223 </li>
15224 </ul>
15225 !! end
15226
15227 !! test
15228 Italics markup in link attribute (T206940)
15229 !! wikitext
15230 [[Foo''s bar''s]]
15231
15232 <!-- Note that "italics" are stripped, even though this is a valid page title -->
15233 [[File:Foobar.jpg|link=Foo''s bar''s|caption1]]
15234
15235 [[File:Foobar.jpg|link=''Main Page''|caption2]]
15236
15237 <!-- consistency with gallery extension -->
15238 <gallery>
15239 File:Foobar.jpg|link=Foo''s bar''s|caption1
15240 File:Foobar.jpg|link=''Main Page''|caption2
15241 </gallery>
15242 !! html/php+tidy
15243 <p><a href="/wiki/Foo%27%27s_bar%27%27s" title="Foo&#39;&#39;s bar&#39;&#39;s">Foo''s bar''s</a>
15244 </p><p><a href="/wiki/Foos_bars" title="caption1"><img alt="caption1" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15245 </p><p><a href="/wiki/Main_Page" title="caption2"><img alt="caption2" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15246 </p>
15247 <ul class="gallery mw-gallery-traditional">
15248 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15249 <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" 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>
15250 <div class="gallerytext">
15251 <p>caption1
15252 </p>
15253 </div>
15254 </div></li>
15255 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15256 <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" 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>
15257 <div class="gallerytext">
15258 <p>caption2
15259 </p>
15260 </div>
15261 </div></li>
15262 </ul>
15263 !! html/parsoid
15264 <p><a rel="mw:WikiLink" href="./Foo''s_bar''s" title="Foo''s bar''s">Foo''s bar''s</a></p>
15265
15266 <!-- Note that "italics" are stripped, even though this is a valid page title -->
15267 <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>
15268
15269 <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>
15270
15271 <!-- consistency with gallery extension -->
15272 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|link=Foo&apos;&apos;s bar&apos;&apos;s|caption1\nFile:Foobar.jpg|link=&apos;&apos;Main Page&apos;&apos;|caption2\n"}}'>
15273 <li class="gallerybox">
15274 <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>
15275 <div class="gallerytext">caption1</div>
15276 </li>
15277 <li class="gallerybox">
15278 <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>
15279 <div class="gallerytext">caption2</div>
15280 </li>
15281 </ul>
15282 !! end
15283
15284 !! test
15285 Nowiki markup in link attribute (T206940)
15286 !! wikitext
15287 [[File:Foobar.jpg|link=Foo<nowiki>''</nowiki>s_bar<nowiki>''</nowiki>s|caption]]
15288
15289 <!-- consistency with gallery extension -->
15290 <gallery>
15291 File:Foobar.jpg|link=Foo<nowiki>''</nowiki>s_bar<nowiki>''</nowiki>s|caption
15292 </gallery>
15293 !! html/php+tidy
15294 <p><a href="/wiki/Foo%27%27s_bar%27%27s" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15295 </p>
15296 <ul class="gallery mw-gallery-traditional">
15297 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15298 <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" 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>
15299 <div class="gallerytext">
15300 <p>caption
15301 </p>
15302 </div>
15303 </div></li>
15304 </ul>
15305 !! html/parsoid
15306 <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>
15307
15308 <!-- consistency with gallery extension -->
15309 <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"}}'>
15310 <li class="gallerybox">
15311 <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>
15312 <div class="gallerytext">caption</div>
15313 </li>
15314 </ul>
15315 !! end
15316
15317 !! test
15318 Nowiki markup in link attribute (edited html, no data-parsoid) (T206940)
15319 !! wikitext
15320 [[File:Foobar.jpg|link=Foo<nowiki>''s_bar''</nowiki>s|caption]]
15321
15322 <!-- consistency with gallery extension -->
15323 <gallery>
15324 File:Foobar.jpg|link=Foo<nowiki>''s_bar''</nowiki>s|caption
15325 </gallery>
15326 !! html/php+tidy
15327 <p><a href="/wiki/Foo%27%27s_bar%27%27s" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15328 </p>
15329 <ul class="gallery mw-gallery-traditional">
15330 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15331 <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" 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>
15332 <div class="gallerytext">
15333 <p>caption
15334 </p>
15335 </div>
15336 </div></li>
15337 </ul>
15338 !! html/parsoid
15339 <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>
15340
15341 <!-- consistency with gallery extension -->
15342 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15343 <li class="gallerybox">
15344 <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>
15345 <div class="gallerytext">caption</div>
15346 </li>
15347 </ul>
15348 !! end
15349
15350 !! test
15351 Image with table with attributes in caption
15352 !! options
15353 parsoid=wt2html,html2html
15354 !! wikitext
15355 [[File:Foobar.jpg|thumb|
15356 {| class="123" |
15357 |- class="456" |
15358 | ha
15359 |}
15360 ]]
15361 !! html/parsoid
15362 <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>
15363 <table class="123">
15364 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
15365 <td> ha</td></tr>
15366 </tbody></table>
15367 </figcaption></figure>
15368 !! end
15369
15370 !! test
15371 Image with table with rows from templates in caption
15372 !! wikitext
15373 [[File:Foobar.jpg|thumb|
15374 {|
15375 {{echo|{{!}} hi}}
15376 |}
15377 ]]
15378 !! html/parsoid
15379 <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>
15380 <table>
15381 <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>
15382 </tbody></table>
15383 </figcaption></figure>
15384 !! end
15385
15386 !! test
15387 Image with nested tables in caption
15388 !! wikitext
15389 [[File:Foobar.jpg|thumb|Foo<br />
15390 {|
15391 |
15392 {|
15393 |z
15394 |}
15395 |}
15396 ]]
15397 !! html/parsoid
15398 <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}'/>
15399 <table>
15400 <tbody><tr><td>
15401 <table>
15402 <tbody><tr><td>z</td></tr>
15403 </tbody></table></td></tr>
15404 </tbody></table>
15405 </figcaption></figure>
15406 !! end
15407
15408 !! test
15409 Image with heading and horizontal rule in caption
15410 !! wikitext
15411 [[File:Foobar.jpg|thumb|
15412 ===Testing===
15413 123
15414 --------------
15415 ]]
15416 !! html/php
15417 <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" 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>
15418
15419 !! html/parsoid
15420 <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>
15421 <h3 id="Testing">Testing</h3>
15422 123
15423 <hr data-parsoid='{"extra_dashes":10}'/>
15424 </figcaption></figure>
15425 !! end
15426
15427 ###################
15428 # Conflicting image format options.
15429 # First option specified should 'win'.
15430 # All three cases in each test should be identical.
15431
15432 !! test
15433 Image with 'frameless' first.
15434 !! options
15435 parsoid=wt2html,wt2wt,html2html
15436 !! wikitext
15437 [[File:Foobar.jpg|frameless|caption]]
15438
15439 [[File:Foobar.jpg|frameless|frame|caption]]
15440
15441 [[File:Foobar.jpg|frameless|thumb|caption]]
15442 !! html/php
15443 <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" 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>
15444 </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" 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>
15445 </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" 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>
15446 </p>
15447 !! html/parsoid
15448 <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>
15449 <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>
15450 <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>
15451 !! end
15452
15453 !! test
15454 Image with 'frame' first.
15455 !! options
15456 parsoid=wt2html,wt2wt,html2html
15457 !! wikitext
15458 [[File:Foobar.jpg|frame|caption]]
15459 [[File:Foobar.jpg|frame|frameless|caption]]
15460 [[File:Foobar.jpg|frame|thumb|caption]]
15461 !! html/php
15462 <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" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
15463 <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" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
15464 <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" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
15465
15466 !! html/parsoid
15467 <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>
15468 <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>
15469 <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>
15470 !! end
15471
15472 !! test
15473 Image with 'thumb' first.
15474 !! options
15475 parsoid=wt2html,wt2wt,html2html
15476 !! wikitext
15477 [[File:Foobar.jpg|thumb|caption]]
15478 [[File:Foobar.jpg|thumb|frameless|caption]]
15479 [[File:Foobar.jpg|thumb|frame|caption]]
15480 !! html/php
15481 <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" 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>
15482 <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" 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>
15483 <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" 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>
15484
15485 !! html/parsoid
15486 <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>
15487 <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>
15488 <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>
15489 !! end
15490
15491 ###################
15492 # Image sizing.
15493 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
15494 # and https://phabricator.wikimedia.org/T64258
15495 # Foobar has actual size of 1941x220
15496 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
15497 # a scalable format.
15498 # 2. Framed images always ignore size options; always render at default size.
15499 # 3. "Unspecified format" and border are the only types which can be
15500 # enlarged.
15501
15502 !! test
15503 Image: unspecified format and border enlarge
15504 !! options
15505 parsoid=wt2html,wt2wt,html2html
15506 !! wikitext
15507 [[File:Foobar.jpg|2000px]]
15508
15509 [[File:Foobar.jpg|border|2000px]]
15510 !! html/php
15511 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" /></a>
15512 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" class="thumbborder" /></a>
15513 </p>
15514 !! html/parsoid
15515 <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>
15516 <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>
15517 !! end
15518
15519 !! test
15520 Image: "unspecified format" and border reduce
15521 !! options
15522 parsoid=wt2html,wt2wt,html2html
15523 !! wikitext
15524 [[File:Foobar.jpg|1000px]]
15525
15526 [[File:Foobar.jpg|border|1000px]]
15527 !! html/php
15528 <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" 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>
15529 </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" 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>
15530 </p>
15531 !! html/parsoid
15532 <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>
15533 <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>
15534 !! end
15535
15536 !! test
15537 Image: thumbs reduce
15538 !! options
15539 parsoid=wt2html,wt2wt,html2html
15540 !! wikitext
15541 [[File:Foobar.jpg|thumb|50px]]
15542 !! html/php
15543 <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" 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>
15544
15545 !! html/parsoid
15546 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure>
15547 !! end
15548
15549 !! test
15550 Image: bitmap thumbs can't be enlarged past original size, but vector can.
15551 !! options
15552 parsoid=wt2html,wt2wt,html2html
15553 !! wikitext
15554 [[File:Foobar.jpg|thumb|2000px]]
15555
15556 [[File:Foobar.svg|thumb|2000px]]
15557 !! html/php
15558 <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" 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>
15559 <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" 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>
15560
15561 !! html/parsoid
15562 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
15563 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure>
15564 !! end
15565
15566 !! test
15567 Image: frameless can reduce in size
15568 !! options
15569 parsoid=wt2html,wt2wt,html2html
15570 !! wikitext
15571 [[File:Foobar.jpg|frameless|50px]]
15572 !! html/php
15573 <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" 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>
15574 </p>
15575 !! html/parsoid
15576 <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>
15577 !! end
15578
15579 !! test
15580 Image: bitmap frameless can't be enlarged past original size, but vector can
15581 !! options
15582 parsoid=wt2html,wt2wt,html2html
15583 !! wikitext
15584 [[File:Foobar.jpg|frameless|2000px]]
15585
15586 [[File:Foobar.svg|frameless|2000px]]
15587 !! html/php
15588 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15589 </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" 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>
15590 </p>
15591 !! html/parsoid
15592 <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>
15593 <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>
15594 !! end
15595
15596 !! test
15597 Image: framed images are always unscaled.
15598 !! options
15599 parsoid=wt2html,wt2wt,html2html
15600 !! wikitext
15601 [[File:Foobar.jpg|frame]]
15602
15603 [[File:Foobar.jpg|frame|50px]]
15604
15605 [[File:Foobar.jpg|frame|50x50px]]
15606
15607 [[File:Foobar.jpg|frame|2000px]]
15608 !! html/php
15609 <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" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
15610 <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" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
15611 <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" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
15612 <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" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
15613
15614 !! html/parsoid
15615 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
15616 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
15617 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
15618 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
15619 !! end
15620
15621 ###################
15622
15623 !! test
15624 Link to image page- image page normally doesn't exists, hence edit link
15625 Add test with existing image page
15626 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
15627 !! wikitext
15628 [[:Image:test]]
15629 !! html
15630 <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>
15631 </p>
15632 !! end
15633
15634 !! test
15635 T20784 Link to non-existent image page with caption should use caption as link text
15636 !! wikitext
15637 [[:Image:test|caption]]
15638 !! html
15639 <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>
15640 </p>
15641 !! end
15642
15643 !! test
15644 Frameless image caption with a free URL
15645 !! wikitext
15646 [[File:Foobar.jpg|http://example.com]]
15647 !! html/php
15648 <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" width="1941" height="220" /></a>
15649 </p>
15650 !! html/parsoid
15651 <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>
15652 !! end
15653
15654 !! test
15655 Thumbnail image caption with a free URL
15656 !! options
15657 thumbsize=220
15658 !! wikitext
15659 [[File:Foobar.jpg|thumb|http://example.com]]
15660 !! html/php
15661 <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" 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>
15662
15663 !! html/parsoid
15664 <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>
15665 !! end
15666
15667 !! test
15668 Thumbnail image caption with a free URL and explicit alt
15669 !! options
15670 thumbsize=220
15671 parsoid=wt2html,wt2wt,html2html
15672 !! wikitext
15673 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15674 !! html/php
15675 <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" 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>
15676
15677 !! html/parsoid
15678 <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>
15679 !! end
15680
15681 !! test
15682 SVG thumbnails with no language set
15683 !! options
15684 !! wikitext
15685 [[File:Foobar.svg|thumb|caption]]
15686 !! html/php
15687 <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" 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>
15688
15689 !! html/parsoid
15690 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
15691 !! end
15692
15693 !! test
15694 SVG thumbnails with language de
15695 !! options
15696 parsoid=wt2html,wt2wt,html2html
15697 !! wikitext
15698 [[File:Foobar.svg|thumb|caption|lang=de]]
15699 !! html/php
15700 <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" 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>
15701
15702 !! html/parsoid
15703 <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>
15704 !! end
15705
15706 !! test
15707 SVG thumbnails with invalid language code
15708 !! options
15709 parsoid=wt2html,wt2wt,html2html
15710 !! wikitext
15711 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15712 !! html/php
15713 <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" 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>
15714
15715 !! html/parsoid
15716 <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>
15717 !! end
15718
15719 !! test
15720 SVG thumbnails in page language
15721 !! options
15722 language=ru
15723 wgMediaInTargetLanguage = true
15724 !! wikitext
15725 [[File:Foobar.svg]] [[File:Foobar.svg|lang=en]]
15726 !! html/php
15727 <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" 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" 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>
15728 </p>
15729 !! end
15730
15731 !! test
15732 SVG thumbnails in page language not present in the file
15733 !! options
15734 language=de
15735 wgMediaInTargetLanguage = true
15736 !! wikitext
15737 [[File:Foobar.svg]] [[File:Foobar.svg|lang=ru]]
15738 !! html/php
15739 <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" 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" 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>
15740 </p>
15741 !! end
15742
15743 !! test
15744 T3887: A ISBN with a thumbnail
15745 !! wikitext
15746 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15747 !! html/php
15748 <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" 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>
15749
15750 !! html/parsoid
15751 <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>
15752 !! end
15753
15754 !! test
15755 T3887: A RFC with a thumbnail
15756 !! wikitext
15757 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15758 !! html/php
15759 <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" 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>
15760
15761 !! html/parsoid
15762 <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>
15763 !! end
15764
15765 !! test
15766 T3887: A mailto link with a thumbnail
15767 !! wikitext
15768 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15769 !! html/php
15770 <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" 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>
15771
15772 !! html/parsoid
15773 <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>
15774 !! end
15775
15776 # Pending resolution to T2368
15777 !! test
15778 T2648: Frameless image caption with a link
15779 !! wikitext
15780 [[File:Foobar.jpg|text with a [[link]] in it]]
15781 !! html/php
15782 <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" width="1941" height="220" /></a>
15783 </p>
15784 !! html/parsoid
15785 <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>
15786 !! end
15787
15788 !! test
15789 T2648: Frameless image caption with a link (suffix)
15790 !! wikitext
15791 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15792 !! html/php
15793 <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" width="1941" height="220" /></a>
15794 </p>
15795 !! html/parsoid
15796 <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>
15797 !! end
15798
15799 !! test
15800 T2648: Frameless image caption with an interwiki link
15801 !! wikitext
15802 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15803 !! html/php
15804 <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" width="1941" height="220" /></a>
15805 </p>
15806 !! html/parsoid
15807 <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>
15808 !! end
15809
15810 !! test
15811 T2648: Frameless image caption with a piped interwiki link
15812 !! wikitext
15813 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15814 !! html/php
15815 <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" width="1941" height="220" /></a>
15816 </p>
15817 !! html/parsoid
15818 <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>
15819 !! end
15820
15821 !! test
15822 T107474: Frameless image caption with <nowiki>
15823 !! wikitext
15824 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15825 !! html/parsoid
15826 <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>
15827 !! end
15828
15829 !! test
15830 Escape HTML special chars in image alt text
15831 !! wikitext
15832 [[File:Foobar.jpg|& < > "]]
15833 !! html/php
15834 <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" width="1941" height="220" /></a>
15835 </p>
15836 !! html/parsoid
15837 <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>
15838 !! end
15839
15840 !! test
15841 Escape HTML special chars in image alt text with LanguageConverter
15842 !! options
15843 language=zh
15844 !! wikitext
15845 [[File:Foobar.jpg|& < > "]]
15846 !! html/php
15847 <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" width="1941" height="220" /></a>
15848 </p>
15849 !! html/parsoid
15850 <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>
15851 !! end
15852
15853 !! test
15854 Entities in file name and attributes
15855 !! wikitext
15856 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15857 !! html/php
15858 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15859 </p>
15860 !! html/parsoid
15861 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"manualthumb=7%25 solution.gif"},{"ck":"link","ak":"link=7%25 solution"},{"ck":"caption","ak":"[[7%25 solution]]"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&#39;>7% solution&lt;/a>"}'><a href="./7%25_solution" data-parsoid='{"a":{"href":"./7%25_solution"},"sa":{"href":"link=7%25 solution"}}'><img resource="./File:7%25_solution.gif" src="./Special:FilePath/7%25_solution.gif" height="220" width="220" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif","height":"220","width":"220"},"sa":{"resource":"File:7%25 solution.gif"}}'/></a></figure-inline></p>
15862 !! end
15863
15864 !! test
15865 T2499: Alt text should have &#1234;, not &amp;1234;
15866 !! wikitext
15867 [[File:Foobar.jpg|&#9792;]]
15868 !! html/php
15869 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" 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;#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>
15873 !! end
15874
15875 !! test
15876 Broken image caption with link
15877 !! options
15878 parsoid=wt2html,wt2wt,html2html
15879 !! wikitext
15880 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15881 !! html/php
15882 <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.
15883 </p>
15884 !! html/parsoid
15885 <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>
15886 !! end
15887
15888 !! test
15889 Image caption containing another image
15890 !! wikitext
15891 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15892 !! html/php
15893 <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" 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" width="135" height="135" /></a> inside it!</div></div></div>
15894
15895 !! html/parsoid
15896 <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>
15897 !! end
15898
15899 !! test
15900 Image: caption containing a newline
15901 !! wikitext
15902 [[File:Foobar.jpg|This
15903 *is some text]]
15904 !! html/php
15905 <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" width="1941" height="220" /></a>
15906 </p>
15907 !! html/parsoid
15908 <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>
15909 !!end
15910
15911 !!test
15912 Image: caption containing leading space
15913 (The leading space should not trigger nowiki escaping in wt2wt mode)
15914 !! wikitext
15915 [[File:Foobar.jpg|thumb| bar]]
15916 !! html/php
15917 <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" 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>
15918
15919 !! html/parsoid
15920 <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>
15921 !!end
15922
15923 # html/php output not have newlines after table, td, th, etc. because
15924 # Linker::makeThumbLink2() replaces the newlines with spaces since
15925 # the table is inside a caption.
15926 # FIXME: Verify if that circa 2004 fix is still required.
15927 !! test
15928 Image: caption containing a table
15929 !! options
15930 parsoid=wt2html,wt2wt,html2html
15931 !! wikitext
15932 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15933 {|
15934 !Foo!!Bar
15935 |-
15936 |Foo1||Bar1
15937 |}
15938 and some more text.]]
15939 !! html/php
15940 <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" 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>
15941
15942 !! html/parsoid
15943 <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
15944 <table>
15945 <tbody>
15946 <tr><th>Foo</th><th>Bar</th></tr>
15947 <tr>
15948 <td>Foo1</td>
15949 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15950 !! end
15951
15952 !! test
15953 T5090: External links other than http: in image captions
15954 !! wikitext
15955 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15956 !! html/php
15957 <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" 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>
15958
15959 !! html/parsoid
15960 <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>
15961 !! end
15962
15963 !! test
15964 Custom class
15965 !! options
15966 parsoid=wt2html,wt2wt,html2html
15967 !! wikitext
15968 [[Image:foobar.jpg|a|class=b]]
15969 !! html/php
15970 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
15971 </p>
15972 !! html/parsoid
15973 <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>
15974 !! end
15975
15976 !! test
15977 Localized image handling (1).
15978 !! options
15979 parsoid=wt2html,wt2wt,html2html
15980 language=es
15981 !! wikitext
15982 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15983 !! html/php
15984 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
15985
15986 !! html/parsoid
15987 <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>
15988 !! end
15989
15990 !! test
15991 Localized image handling (2).
15992 !! options
15993 thumbsize=220
15994 parsoid=wt2html,wt2wt,html2html
15995 language=es
15996 !! wikitext
15997 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15998 !! html/php
15999 <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" 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>
16000
16001 !! html/parsoid
16002 <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>
16003 !! end
16004
16005 !! test
16006 Localized image handling (3).
16007 !! options
16008 language=fa
16009 parsoid=html2wt
16010 !! html/parsoid
16011 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure>
16012 !! wikitext
16013 [[File:Foobar.jpg|بندانگشتی]]
16014 !! end
16015
16016 !! test
16017 "border", "frameless" and "class" attributes on an image.
16018 !! options
16019 thumbsize=220
16020 parsoid=wt2html,wt2wt,html2html
16021 !! wikitext
16022 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
16023 !! html/php
16024 <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" 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>
16025 </p>
16026 !! html/parsoid
16027 <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>
16028 !! end
16029
16030 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
16031 !! test
16032 Invalid image attributes (T64500)
16033 !! options
16034 thumbsize=220
16035 parsoid=wt2html,wt2wt,html2html
16036 !! wikitext
16037 [[File:Foobar.jpg|thumb|float|left|caption]]
16038
16039 [[File:Foobar.jpg|thumb|righ|caption]]
16040
16041 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
16042 !! html/php
16043 <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" 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>
16044 <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" 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>
16045 <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" 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>
16046
16047 !! html/parsoid
16048 <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>
16049 <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>
16050 <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>
16051 !! end
16052
16053 !! article
16054 File:Barfoo.jpg
16055 !! text
16056 #REDIRECT [[File:Barfoo.jpg]]
16057 !! endarticle
16058
16059 # FIXME: Parsoid should run this test -- but we'd need to teach the
16060 # mockAPI about the redirected Barfoo.jpg image.
16061 !! test
16062 Redirected image
16063 !! wikitext
16064 [[Image:Barfoo.jpg]]
16065 !! html/php
16066 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
16067 </p>
16068 !! end
16069
16070 !! test
16071 Missing image with uploads disabled
16072 !! options
16073 wgEnableUploads=0
16074 !! wikitext
16075 [[File:Foobaz.jpg]]
16076 !! html/php
16077 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
16078 </p>
16079 !! html/parsoid
16080 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></figure-inline></p>
16081 !! end
16082
16083 # Parsoid-specific testing for images
16084 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
16085 # Currently imperfect due to a flaw in the Parsoid testrunner
16086 # Work in progress
16087 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
16088 # image tests.
16089
16090 !! test
16091 Parsoid-specific image handling - simple image with size and middle alignment
16092 !! wikitext
16093 [[File:Foobar.jpg|middle|50px]]
16094 !! html/parsoid
16095 <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>
16096 !! end
16097
16098 !! test
16099 Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
16100 !! options
16101 parsoid=wt2wt,wt2html,html2html
16102 !! wikitext
16103 [[Image:Foobar.jpg|middle|50px]]
16104 !! html/parsoid
16105 <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>
16106 !! end
16107
16108 !! test
16109 Parsoid-specific image handling - simple image with size and middle alignment (existing content)
16110 !! wikitext
16111 [[File:Foobar.jpg|50px|middle]]
16112 !! html/parsoid
16113 <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>
16114 !! end
16115
16116 !! test
16117 Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
16118 !! options
16119 parsoid=wt2html,wt2wt,html2html
16120 !! wikitext
16121 [[Image:Foobar.jpg|50px|middle]]
16122 !! html/parsoid
16123 <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>
16124 !! end
16125
16126 !! test
16127 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
16128 !! wikitext
16129 [[File:Foobar.jpg|500x10px|baseline|caption]]
16130 !! html/parsoid
16131 <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>
16132 !! end
16133
16134 !! test
16135 Parsoid-specific image handling - simple image with border and size spec
16136 !! wikitext
16137 [[File:Foobar.jpg|50px|border|caption]]
16138 !! html/parsoid
16139 <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>
16140 !! end
16141
16142 !! test
16143 Parsoid-specific image handling - thumbnail with halign, valign, and caption
16144 !! options
16145 parsoid=wt2html,html2html
16146 !! wikitext
16147 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
16148 !! html/parsoid
16149 <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>
16150 !! end
16151
16152 !! test
16153 Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
16154 !! options
16155 parsoid=wt2html,html2html
16156 !! wikitext
16157 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
16158 !! html/parsoid
16159 <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>
16160 !! end
16161
16162 !! test
16163 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
16164 !! options
16165 parsoid=wt2html,html2html
16166 !! wikitext
16167 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
16168 !! html/parsoid
16169 <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>
16170 !! end
16171
16172 !! test
16173 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
16174 !! options
16175 parsoid=wt2html,html2html
16176 !! wikitext
16177 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
16178 !! html/parsoid
16179 <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>
16180 !! end
16181
16182 !! test
16183 Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
16184 !! options
16185 parsoid=wt2html,wt2wt,html2html
16186 !! wikitext
16187 [[File:Foobar.jpg|frame|500x50px|caption]]
16188 !! html/parsoid
16189 <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>
16190 !! end
16191
16192 !! test
16193 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
16194 !! options
16195 parsoid=wt2html,html2html
16196 !! wikitext
16197 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
16198 !! html/parsoid
16199 <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>
16200 !! end
16201
16202 !! test
16203 Parsoid-specific image handling - frameless image with specific size, border, and caption
16204 !! wikitext
16205 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
16206 !! html/parsoid
16207 <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>
16208 !! end
16209
16210 !! test
16211 Parsoid-specific image handling - simple image with a formatted caption
16212 !! wikitext
16213 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
16214 !! html/parsoid
16215 <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>
16216 !! end
16217
16218 !! test
16219 Parsoid-specific image handling - caption with a template in it
16220 !! wikitext
16221 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
16222 !! html/parsoid
16223 <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>
16224 !! end
16225
16226 !! test
16227 Parsoid-specific image handling - caption with unbalanced tags in it
16228 !! options
16229 parsoid=wt2html,wt2wt,html2html
16230 !! wikitext
16231 foo
16232 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
16233 bar
16234 !! html/parsoid
16235 <p>foo</p>
16236 <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>
16237 <p>bar</p>
16238 !! end
16239
16240 !! test
16241 Parsoid-specific image handling - empty caption (1)
16242 !! options
16243 parsoid=wt2html,wt2wt
16244 !! wikitext
16245 [[File:Foobar.jpg|thumb|]]
16246 !! html/parsoid
16247 <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>
16248 !! end
16249
16250 # empty captions don't get serialized unless we're in the "round trip" case
16251 !! test
16252 Parsoid-specific image handling - empty caption (2)
16253 !! options
16254 parsoid=html2wt
16255 !! html/parsoid
16256 <figure class="mw-default-size" typeof="mw:Image/Thumb">
16257 <a href="./File:Foobar.jpg">
16258 <img resource="./File:Foobar.jpg"
16259 src="//example.com/images/3/3a/Foobar.jpg"
16260 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
16261 height="25" width="220"/>
16262 </a>
16263 <figcaption></figcaption>
16264 </figure>
16265 !! wikitext
16266 [[File:Foobar.jpg|thumb]]
16267 !! end
16268
16269 !! test
16270 Parsoid-specific image handling - whitespace caption
16271 !! wikitext
16272 [[File:Foobar.jpg|thumb| ]]
16273 !! html/parsoid
16274 <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>
16275 !! end
16276
16277 !! test
16278 Parsoid-specific image handling - lang option
16279 !! wikitext
16280 foo
16281 [[File:Foobar.svg|lang=de|caption]]
16282 bar
16283 !! html/parsoid
16284 <p>foo
16285 <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>
16286 bar</p>
16287 !! end
16288
16289 ## Edge case bugs in Parsoid from T93580
16290 !! test
16291 T93580: 1. Templated <ref> inside block images
16292 !! wikitext
16293 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
16294
16295 <references />
16296 !! html/parsoid
16297 <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="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></figcaption></figure>
16298
16299 <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="./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" data-parsoid="{}">foo</span></li></ol>
16300 !! end
16301
16302 !! test
16303 T93580: 2. <ref> inside inline images
16304 !! wikitext
16305 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
16306
16307 <references />
16308 !! html/parsoid
16309 <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=\"./Main_Page#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>
16310
16311 <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="./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">foo</span></li></ol>
16312 !! end
16313
16314 !! test
16315 T93580: 3. Templated <ref> inside inline images
16316 !! wikitext
16317 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
16318
16319 <references />
16320 !! html/parsoid
16321 <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=\"./Main_Page#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>
16322
16323 <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="./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">foo</span></li></ol>
16324 !! end
16325
16326 ###
16327 ### Subpages
16328 ###
16329 !! article
16330 Subpage test/subpage
16331 !! text
16332 foo
16333 !! endarticle
16334
16335 !! test
16336 Subpage link
16337 !! options
16338 subpage title=[[Subpage test]]
16339 !! wikitext
16340 [[/subpage]]
16341 !! html
16342 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
16343 </p>
16344 !! end
16345
16346 !! test
16347 Subpage noslash link
16348 !! options
16349 subpage title=[[Subpage test]]
16350 !! wikitext
16351 [[/subpage/]]
16352 !! html
16353 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
16354 </p>
16355 !! end
16356
16357 !! article
16358 Subpage test/1/2/subpage
16359 !! text
16360 blah
16361 !! endarticle
16362
16363 !! test
16364 Relative subpage noslash link
16365 !! options
16366 parsoid=wt2wt,wt2html,html2html
16367 subpage title=[[Subpage test/1/2/3/4]]
16368 !! wikitext
16369 [[../../subpage/]]
16370
16371 [[../../subpage]]
16372 !! html/php
16373 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
16374 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
16375 </p>
16376 !! html/parsoid
16377 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
16378 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
16379 !! end
16380
16381 !! test
16382 Parsoid: dot-slash prefixed wikilinks
16383 !! wikitext
16384 [[./foo]]
16385
16386 [[././bar]]
16387
16388 [[././baz/]]
16389 !! html/php
16390 <p>[[./foo]]
16391 </p><p>[[././bar]]
16392 </p><p>[[././baz/]]
16393 </p>
16394 !! html/parsoid
16395 <p>[[./foo]]
16396 </p><p>[[././bar]]
16397 </p><p>[[././baz/]]
16398 </p>
16399 !! end
16400
16401 !! test
16402 Render invalid page names as plain text (T53090)
16403 !! wikitext
16404 [[./../foo|bar]]
16405 [[foo�|bar]]
16406 [[foo/.|bar]]
16407 [[foo/..|bar]]
16408 [[foo~~~bar]]
16409 [[foo>bar]]
16410 [[foo[bar]]
16411 [[.]]
16412 [[..]]
16413 [[foo././bar]]
16414 [[foo[http://example.com]xyz]]
16415
16416 [[{{echo|./../foo}}|bar]]
16417 [[{{echo|foo/.}}|bar]]
16418 [[{{echo|foo/..}}|bar]]
16419 [[{{echo|foo~~~~bar}}]]
16420 [[{{echo|foo>bar}}]]
16421 [[{{echo|foo././bar}}]]
16422 [[{{echo|foo{bar}}]]
16423 [[{{echo|foo}bar}}]]
16424 [[{{echo|foo[bar}}]]
16425 [[{{echo|foo]bar}}]]
16426 [[{{echo|foo<bar}}]]
16427 !!html/php
16428 <p>[[./../foo|bar]]
16429 [[foo�|bar]]
16430 [[foo/.|bar]]
16431 [[foo/..|bar]]
16432 [[foo~~~bar]]
16433 [[foo&gt;bar]]
16434 [[foo[bar]]
16435 [[.]]
16436 [[..]]
16437 [[foo././bar]]
16438 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
16439 </p><p>[[./../foo|bar]]
16440 [[foo/.|bar]]
16441 [[foo/..|bar]]
16442 [[foo~~~~bar]]
16443 [[foo&gt;bar]]
16444 [[foo././bar]]
16445 [[foo{bar]]
16446 [[foo}bar]]
16447 [[foo[bar]]
16448 [[foo]bar]]
16449 [[foo&lt;bar]]
16450 </p>
16451 !!html/parsoid
16452 <p>[[./../foo|bar]]
16453 [[foo�|bar]]
16454 [[foo/.|bar]]
16455 [[foo/..|bar]]
16456 [[foo~~~bar]]
16457 [[foo>bar]]
16458 [[foo[bar]]
16459 [[.]]
16460 [[..]]
16461 [[foo././bar]]
16462 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
16463
16464 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
16465 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
16466 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
16467 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
16468 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
16469 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
16470 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
16471 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
16472 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
16473 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
16474 [[<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>
16475 !!end
16476
16477 !! test
16478 Disabled subpages
16479 !! wikitext
16480 [[/subpage]]
16481 !! html
16482 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
16483 </p>
16484 !! end
16485
16486 !! test
16487 T2561: {{/Subpage}}
16488 !! options
16489 subpage title=[[Page]]
16490 !! wikitext
16491 {{/Subpage}}
16492 !! html
16493 <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>
16494 </p>
16495 !! end
16496
16497 ###
16498 ### Categories
16499 ###
16500 !! article
16501 Category:MediaWiki User's Guide
16502 !! text
16503 blah
16504 !! endarticle
16505
16506 !! test
16507 Link to category
16508 !! wikitext
16509 [[:Category:MediaWiki User's Guide]]
16510 !! html
16511 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
16512 </p>
16513 !! end
16514
16515 !! test
16516 Simple category
16517 !! options
16518 cat
16519 !! wikitext
16520 [[Category:MediaWiki User's Guide]]
16521 !! html/php
16522 cat=MediaWiki_User's_Guide sort=
16523 !! html/parsoid
16524 <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"}}'/>
16525 !! end
16526
16527 !! test
16528 PAGESINCATEGORY invalid title fatal (r33546 fix)
16529 !! wikitext
16530 {{PAGESINCATEGORY:<bogus>}}
16531 !! html
16532 <p>0
16533 </p>
16534 !! end
16535
16536 !! test
16537 Category with different sort key
16538 !! options
16539 cat
16540 !! wikitext
16541 [[Category:MediaWiki User's Guide|Foo]]
16542 !! html/php
16543 cat=MediaWiki_User's_Guide sort=Foo
16544 !! html/parsoid
16545 <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"}}'/>
16546 !! end
16547
16548 !! test
16549 Category with identical sort key
16550 !! options
16551 cat
16552 !! wikitext
16553 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16554 !! html/php
16555 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
16556 !! html/parsoid
16557 <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"}}'/>
16558 !! end
16559
16560 !! test
16561 Category with empty sort key
16562 !! options
16563 cat
16564 pst
16565 !! wikitext
16566 [[Category:MediaWiki User's Guide|]]
16567 !! html/php
16568 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16569 !! end
16570
16571 !! test
16572 Category with empty sort key and parentheses
16573 !! options
16574 cat
16575 pst
16576 !! wikitext
16577 [[Category:Foo (bar)|]]
16578 !! html/php
16579 [[Category:Foo (bar)|Foo]]
16580 !! end
16581
16582 !! test
16583 Category with link tail
16584 !! options
16585 cat
16586 pst
16587 !! wikitext
16588 123[[Category:Foo]]456
16589 !! html/php
16590 123[[Category:Foo]]456
16591 !! end
16592
16593 !! test
16594 Category with template
16595 !! options
16596 cat
16597 pst
16598 !! wikitext
16599 [[Category:{{echo|Foo}}]]
16600 !! html/php
16601 [[Category:{{echo|Foo}}]]
16602 !! end
16603
16604 !! test
16605 Category with template in sort key
16606 !! options
16607 cat
16608 pst
16609 !! wikitext
16610 [[Category:Foo|{{echo|Bar}}]]
16611 !! html/php
16612 [[Category:Foo|{{echo|Bar}}]]
16613 !! end
16614
16615 !! test
16616 Category with template in sort key and title
16617 !! options
16618 cat
16619 pst
16620 !! wikitext
16621 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16622 !! html/php
16623 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16624 !! end
16625
16626 ## We used to, but no longer wt2wt this test since the default serializer
16627 ## will normalize all categories to serialize on their own line.
16628 ## This wikitext usage is going to be fairly uncommon in production and
16629 ## selser will take care of preserving formatting in those scenarios.
16630 !! test
16631 Category / paragraph interactions
16632 !! options
16633 parsoid=wt2html
16634 !! wikitext
16635 Foo [[Category:Baz]] Bar
16636
16637 Foo [[Category:Baz]]
16638 Bar
16639
16640 Foo
16641 [[Category:Baz]]
16642 Bar
16643
16644 Foo
16645 [[Category:Baz]] Bar
16646
16647 Foo
16648 [[Category:Baz]]
16649 [[Category:Baz]]
16650 [[Category:Baz]]
16651 Bar
16652
16653 [[Category:Baz]]
16654 [[Category:Baz]]
16655 [[Category:Baz]]
16656
16657 [[Category:Baz]]
16658 {{echo|[[Category:Baz]]}}
16659 [[Category:Baz]]
16660 !! html/php
16661 <p>Foo Bar
16662 </p><p>Foo
16663 Bar
16664 </p><p>Foo
16665 Bar
16666 </p><p>Foo Bar
16667 </p><p>Foo
16668 Bar
16669 </p>
16670 !! html/parsoid
16671 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16672 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16673 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16674 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16675 <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>
16676 <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}}]}'/>
16677 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16678 !! end
16679
16680 ## We used to, but no longer wt2wt this test since the default serializer
16681 ## will normalize all categories to serialize on their own line.
16682 ## This wikitext usage is going to be fairly uncommon in production and
16683 ## selser will take care of preserving formatting in those scenarios.
16684 ##
16685 ## The whitespace on the empty line is part of the test. Please do not delete
16686 !! test
16687 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16688 !! options
16689 parsoid=wt2html
16690 !! wikitext
16691 This
16692
16693 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16694
16695 {{echo|[[Category:Foo]] and so should this!}}
16696 !! html/php
16697 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16698 </p>
16699 !! html/parsoid
16700 <p>This
16701
16702 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16703
16704 <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>
16705 !! end
16706
16707 ## Parsoid will not try to wt2wt this while preserving newlines because
16708 ## it suppresses excess newlines within list items -- and we don't want to
16709 ## introduce a special case just for categories, which is, in reality somewhat
16710 ## odd behavior -- categories are unlikely to be used in list items like this
16711 ## in top-level pages and are only likely to show up in template-generated
16712 ## list items where this RT-ing is a non-issue.
16713 ##
16714 ## The whitespace on the empty line is part of the test. Please do not delete
16715 !! test
16716 2. 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 the same list item
16723 * So should this
16724
16725 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16726 !! html
16727 <ul><li>This and this should be part of the same list item</li>
16728 <li>So should this and this should be part of the same list item</li></ul>
16729 !! html/parsoid
16730 <ul>
16731 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16732 <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>
16733 </ul>
16734 !! end
16735
16736 ## Newlines and categories that follow the last item of a list
16737 ## are treated differently because this (list followed by categories)
16738 ## is an extremely common pattern on wikis.
16739 !! test
16740 3. Categories and newlines: newline suppression for last list item should RT properly
16741 !! wikitext
16742 *a
16743 *b
16744
16745 [[Category:Foo]]
16746
16747 [[Category:Bar]]
16748 [[Category:Baz]]
16749
16750 :c
16751
16752 [[Category:C]]
16753
16754 ;d
16755
16756 [[Category:D]]
16757 !! html/parsoid
16758 <ul><li>a</li>
16759 <li>b</li></ul>
16760
16761 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16762
16763 <link rel="mw:PageProp/Category" href="./Category:Bar"/>
16764 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16765
16766 <dl><dd>c</dd></dl>
16767
16768 <link rel="mw:PageProp/Category" href="./Category:C"/>
16769
16770 <dl><dt>d</dt></dl>
16771
16772 <link rel="mw:PageProp/Category" href="./Category:D"/>
16773 !! end
16774
16775 !! test
16776 4. Categories and newlines: newline suppression for last list item should RT properly
16777 !! wikitext
16778 *a
16779 ****b
16780
16781 [[Category:Foo]]
16782 !! html/parsoid
16783 <ul><li>a
16784 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
16785
16786 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16787 !! end
16788
16789 ## only wt2html for this to make sure the algo only applies to the rightmost path
16790 !! test
16791 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16792 !! options
16793 parsoid=wt2html
16794 !! wikitext
16795 *a
16796 **b
16797 [[Category:Foo]]
16798 *c
16799 **d
16800 [[Category:Foo]]
16801 !! html/parsoid
16802 <ul><li>a
16803 <ul><li>b
16804 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16805 <li>c
16806 <ul><li>d</li></ul></li></ul>
16807 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16808 !! end
16809
16810 ## We used to, but no longer wt2wt this test since the default serializer
16811 ## will normalize all categories to serialize on their own line.
16812 ## This wikitext usage is going to be fairly uncommon in production and
16813 ## selser will take care of preserving formatting in those scenarios.
16814 !! test
16815 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16816 !! options
16817 parsoid=wt2html
16818 !! wikitext
16819 *a [[Category:Foo]]
16820 !! html/parsoid
16821 <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>
16822 !! end
16823
16824 # This test also demonstrates because of newline+category tunneling
16825 # through the list hander, template wrapping doesn't expand to the
16826 # containing list when the list item swallows the category.
16827 !! test
16828 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16829 !! wikitext
16830 *{{echo|a
16831 [[Category:Foo]]}}
16832 !! html/parsoid
16833 <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
16834 </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>
16835 !! end
16836
16837 !! test
16838 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16839 !! wikitext
16840 *a
16841
16842 {{echo|[[Category:Foo]]
16843 [[Category:Bar]]}}
16844 [[Category:Baz]]
16845 !! html/parsoid
16846 <ul><li>a</li></ul>
16847
16848 <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">
16849 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16850 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16851 !! end
16852
16853 !! test
16854 Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
16855 !! wikitext
16856 *a
16857
16858 [[Category:Bar]]<!--boo1--> <!--boo2-->
16859 [[Category:Baz]]<!--boo3--> <!--boo4-->
16860 !! html/parsoid
16861 <ul><li>a</li></ul>
16862
16863 <link rel="mw:PageProp/Category" href="./Category:Bar"/><!--boo1--> <!--boo2-->
16864 <link rel="mw:PageProp/Category" href="./Category:Baz"/><!--boo3--> <!--boo4-->
16865 !! end
16866
16867 !! test
16868 Categories and newlines: should behave properly with linkprefix (T87753)
16869 !! options
16870 language=ar
16871 !! wikitext
16872 foo bar
16873 foo bar
16874 [[تصنيف:Foo]]
16875 [[تصنيف:Bar]]
16876 !! html/php
16877 <p>foo bar
16878 foo bar
16879 </p>
16880 !! html/parsoid
16881 <p>foo bar
16882 foo bar</p>
16883 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16884 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16885 !! end
16886
16887 !! test
16888 No regressions on internal links following category (T174639)
16889 !! options
16890 parsoid=wt2html,html2html
16891 !! wikitext
16892 [[Category:Foo]]<div>a
16893
16894 [[Foo]]</div>
16895 !! html/php
16896 <div>a
16897 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16898
16899 !! html/parsoid
16900 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16901
16902 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16903 !! end
16904
16905 # Note that Parsoid differs slightly from PHP due to T175421
16906 !! test
16907 11. Special case where only newlines separate links (T175416)
16908 !! options
16909 parsoid=wt2html,html2html
16910 !! wikitext
16911 [[Category:Foo]]
16912
16913 [[Foo]][[es:Alimento]]
16914
16915 [[Foo]]
16916 !! html/php
16917 <p><br />
16918 <a href="/wiki/Foo" title="Foo">Foo</a>
16919 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16920 </p>
16921 !! html/parsoid
16922 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16923
16924 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16925
16926 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16927 !! end
16928
16929 !! test
16930 Category links with multiple namespaces
16931 !! wikitext
16932 [[Category:Project:Foo]]
16933 !! html/parsoid
16934 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16935 !! end
16936
16937 !! test
16938 Parsoid: Serialize link to category page with colon escape
16939 !! options
16940 parsoid
16941 !! wikitext
16942
16943 [[:Category:Foo]]
16944 [[:Category:Foo|Bar]]
16945 !! html
16946 <p>
16947 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16948 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16949 </p>
16950 !! end
16951
16952 # We used to, but no longer wt2wt this test since the default serializer
16953 # will normalize all categories to serialize on their own line.
16954 # This wikitext usage is going to be fairly uncommon in production and
16955 # selser will take care of preventing whitespace insertion if this
16956 # occurs in an article.
16957 #
16958 # html2html disabled for the same reason (whitespace insertion between
16959 # x and y).
16960 #
16961 # html2wt disabled because it localizes the "Category" namespace.
16962 !! test
16963 Link prefix/suffixes aren't applied to category links
16964 !! options
16965 parsoid=wt2html
16966 language=is
16967 !! wikitext
16968 x[[Category:Foo]]y
16969 !! html/php
16970 <p>xy
16971 </p>
16972 !! html/parsoid
16973 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16974 !! end
16975
16976 !! test
16977 Link prefix/suffixes aren't applied to language links
16978 !! options
16979 parsoid=wt2html
16980 language=is
16981 !! wikitext
16982 x[[es:Foo]]y
16983 !! html/php
16984 <p>xy
16985 </p>
16986 !! html/parsoid
16987 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16988 !! end
16989
16990 !! test
16991 Parsoid: Serialize link to file page with colon escape
16992 !! options
16993 parsoid
16994 !! wikitext
16995
16996 [[:File:Foo.png]]
16997 [[:File:Foo.png|Bar]]
16998 !! html
16999 <p>
17000 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
17001 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
17002 </p>
17003 !! end
17004
17005 !! test
17006 Parsoid: Serialize a genuine category link without colon escape
17007 !! options
17008 parsoid
17009 !! wikitext
17010 [[Category:Foo]]
17011 [[Category:Foo|Bar]]
17012 !! html
17013 <link rel="mw:PageProp/Category" href="./Category:Foo">
17014 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
17015 !! end
17016
17017 !! test
17018 Normalize hrefs properly before testing for invalid link targets (T72894)
17019 !! options
17020 parsoid=html2wt
17021 !! html/parsoid
17022 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
17023 !! wikitext
17024 [[Category:Toxine bactérienne]]
17025 !! end
17026
17027 !! test
17028 Parsoid: Defaultsort
17029 !! wikitext
17030 {{DEFAULTSORT:Foo}}
17031 !! html/parsoid
17032 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
17033 !! end
17034
17035 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
17036 # But, this is a limitation of our representation and is documented in
17037 # TemplateHandler.js in processSpecialMagicWord
17038 !! test
17039 Parsoid: Defaultsort (template-generated)
17040 !! wikitext
17041 {{{{echo|DEFAULTSORT}}:Foo}}
17042 !! html/parsoid
17043 <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"}]]}'/>
17044 !! end
17045
17046 ###
17047 ### Inter-language links
17048 ###
17049 !! test
17050 Interlanguage links
17051 !! options
17052 ill
17053 !! wikitext
17054 [[es:Alimento]]
17055 [[fr:Nourriture]]
17056 [[zh:食品]]
17057 !! html/php
17058 es:Alimento fr:Nourriture zh:食品
17059 !! html/parsoid
17060 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
17061 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
17062 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
17063 !! end
17064
17065 !! test
17066 Duplicate interlanguage links (T26502)
17067 !! options
17068 ill
17069 !! wikitext
17070 [[es:1]]
17071 [[es:2]]
17072 [[fr:1]]
17073 [[fr:2]]
17074 !! html/php
17075 es:1 fr:1
17076 !! html/parsoid
17077 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
17078 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
17079 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
17080 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
17081 !! end
17082
17083 ###
17084 ### Sections
17085 ###
17086 !! test
17087 Basic section headings
17088 !! wikitext
17089 ==Headline 1==
17090 Some text
17091
17092 ==Headline 2==
17093 More
17094 ===Smaller headline===
17095 Blah blah
17096 !! html
17097 <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>
17098 <p>Some text
17099 </p>
17100 <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>
17101 <p>More
17102 </p>
17103 <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>
17104 <p>Blah blah
17105 </p>
17106 !! end
17107
17108 !! test
17109 Section headings with TOC
17110 !! wikitext
17111 ==Headline 1==
17112 ===Subheadline 1===
17113 =====Skipping a level=====
17114 ======Skipping a level======
17115
17116 ==Headline 2==
17117 Some text
17118 ===Another headline===
17119 !! html
17120 <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>
17121 <ul>
17122 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
17123 <ul>
17124 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
17125 <ul>
17126 <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>
17127 <ul>
17128 <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>
17129 </ul>
17130 </li>
17131 </ul>
17132 </li>
17133 </ul>
17134 </li>
17135 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
17136 <ul>
17137 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
17138 </ul>
17139 </li>
17140 </ul>
17141 </div>
17142
17143 <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>
17144 <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>
17145 <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>
17146 <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>
17147 <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>
17148 <p>Some text
17149 </p>
17150 <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>
17151
17152 !! end
17153
17154 !! test
17155 TOC anchors don't collide
17156 !! wikitext
17157 __FORCETOC__
17158 ==Headline 2==
17159 ==Headline==
17160 ==Headline 2==
17161 ==Headline==
17162 !! html/php
17163 <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>
17164 <ul>
17165 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
17166 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
17167 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
17168 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
17169 </ul>
17170 </div>
17171
17172 <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>
17173 <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>
17174 <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>
17175 <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>
17176
17177 !! end
17178
17179 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
17180 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
17181 !! test
17182 Handling of sections up to level 6 and beyond
17183 !! options
17184 parsoid=wt2html
17185 !! wikitext
17186 =Level 1 Heading=
17187 ==Level 2 Heading==
17188 ===Level 3 Heading===
17189 ====Level 4 Heading====
17190 =====Level 5 Heading=====
17191 ======Level 6 Heading======
17192 =======Level 7 Heading=======
17193 ========Level 8 Heading========
17194 =========Level 9 Heading=========
17195 ==========Level 10 Heading==========
17196 !! html/php
17197 <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>
17198 <ul>
17199 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
17200 <ul>
17201 <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>
17202 <ul>
17203 <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>
17204 <ul>
17205 <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>
17206 <ul>
17207 <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>
17208 <ul>
17209 <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>
17210 <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>
17211 <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>
17212 <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>
17213 <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>
17214 </ul>
17215 </li>
17216 </ul>
17217 </li>
17218 </ul>
17219 </li>
17220 </ul>
17221 </li>
17222 </ul>
17223 </li>
17224 </ul>
17225 </div>
17226
17227 <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>
17228 <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>
17229 <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>
17230 <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>
17231 <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>
17232 <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>
17233 <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>
17234 <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>
17235 <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>
17236 <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>
17237
17238 !! html/parsoid
17239 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
17240 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
17241 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
17242 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
17243 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
17244 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
17245 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
17246 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
17247 <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>
17248 <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>
17249 !! end
17250
17251 !! test
17252 TOC regression (T11764)
17253 !! wikitext
17254 ==title 1==
17255 ===title 1.1===
17256 ====title 1.1.1====
17257 ===title 1.2===
17258 ==title 2==
17259 ===title 2.1===
17260 !! html
17261 <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>
17262 <ul>
17263 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17264 <ul>
17265 <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>
17266 <ul>
17267 <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>
17268 </ul>
17269 </li>
17270 <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>
17271 </ul>
17272 </li>
17273 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
17274 <ul>
17275 <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>
17276 </ul>
17277 </li>
17278 </ul>
17279 </div>
17280
17281 <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>
17282 <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>
17283 <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>
17284 <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>
17285 <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>
17286 <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>
17287
17288 !! end
17289
17290 !! test
17291 TOC for heading containing <span id="..."></span> (T96153)
17292 !! wikitext
17293 __FORCETOC__
17294 ==<span id="old-anchor"></span>New title==
17295 !! html/php
17296 <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>
17297 <ul>
17298 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
17299 </ul>
17300 </div>
17301
17302 <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>
17303
17304 !! end
17305
17306 !! test
17307 TOC with wgMaxTocLevel=3 (T8204)
17308 !! options
17309 wgMaxTocLevel=3
17310 !! wikitext
17311 ==title 1==
17312 ===title 1.1===
17313 ====title 1.1.1====
17314 ===title 1.2===
17315 ==title 2==
17316 ===title 2.1===
17317 !! html
17318 <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>
17319 <ul>
17320 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17321 <ul>
17322 <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>
17323 <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>
17324 </ul>
17325 </li>
17326 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
17327 <ul>
17328 <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>
17329 </ul>
17330 </li>
17331 </ul>
17332 </div>
17333
17334 <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>
17335 <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>
17336 <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>
17337 <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>
17338 <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>
17339 <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>
17340
17341 !! end
17342
17343 !! test
17344 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
17345 !! options
17346 wgMaxTocLevel=3
17347 !! wikitext
17348 ==Section 1==
17349 ===Section 1.1===
17350 ====Section 1.1.1====
17351 ====Section 1.1.1.1====
17352 ==Section 2==
17353 !! html
17354 <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>
17355 <ul>
17356 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
17357 <ul>
17358 <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>
17359 </ul>
17360 </li>
17361 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
17362 </ul>
17363 </div>
17364
17365 <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>
17366 <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>
17367 <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>
17368 <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>
17369 <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>
17370
17371 !! end
17372
17373
17374 !! test
17375 Resolving duplicate section names
17376 !! wikitext
17377 ==Foo bar==
17378 ==Foo bar==
17379 !! html
17380 <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>
17381 <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>
17382
17383 !! end
17384
17385 !! test
17386 Resolving duplicate section names with differing case (T12721)
17387 !! wikitext
17388 ==Foo bar==
17389 ==Foo Bar==
17390 !! html
17391 <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>
17392 <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>
17393
17394 !! end
17395
17396 !! article
17397 Template:sections
17398 !! text
17399 ===Section 1===
17400 ==Section 2==
17401 !! endarticle
17402
17403 !! test
17404 Template with sections, __NOTOC__
17405 !! wikitext
17406 __NOTOC__
17407 ==Section 0==
17408 {{sections}}
17409 ==Section 4==
17410 !! html
17411 <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>
17412 <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>
17413 <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>
17414 <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>
17415
17416 !! end
17417
17418 !! test
17419 __NOEDITSECTION__ keyword
17420 !! wikitext
17421 __NOEDITSECTION__
17422 ==Section 1==
17423 ==Section 2==
17424 !! html
17425 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
17426 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
17427
17428 !! end
17429
17430 !! test
17431 Link inside a section heading
17432 !! wikitext
17433 ==Section with a [[Main Page|link]] in it==
17434 !! html
17435 <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>
17436
17437 !! end
17438
17439 !! test
17440 TOC regression (T14077)
17441 !! wikitext
17442 __TOC__
17443 ==title 1==
17444 ===title 1.1===
17445 ==title 2==
17446 !! html
17447 <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>
17448 <ul>
17449 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17450 <ul>
17451 <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>
17452 </ul>
17453 </li>
17454 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
17455 </ul>
17456 </div>
17457
17458 <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>
17459 <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>
17460 <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>
17461
17462 !! end
17463
17464 !! test
17465 T3219 URL next to image (good)
17466 !! wikitext
17467 http://example.com [[File:Foobar.jpg]]
17468 !! html/php
17469 <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" width="1941" height="220" /></a>
17470 </p>
17471 !! html/parsoid
17472 <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>
17473 !!end
17474
17475 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
17476 !! test
17477 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
17478 !! options
17479 parsoid=wt2html,html2html
17480 !! wikitext
17481 ===
17482 The line above must have a trailing space!
17483 === <!--
17484 --> <!-- -->
17485 But just in case it doesn't...
17486 !! html/php
17487 <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>
17488 <p>The line above must have a trailing space!
17489 </p>
17490 <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>
17491 <p>But just in case it doesn't...
17492 </p>
17493 !! html/parsoid
17494 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
17495 <p>The line above must have a trailing space!</p>
17496 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
17497 --> <!-- -->
17498 <p>But just in case it doesn't...</p>
17499 !! end
17500
17501 !! test
17502 Header with special characters (T27462)
17503 !! wikitext
17504 The tooltips shall not show entities to the user (ie. be double escaped)
17505
17506 ==text > text==
17507 section 1
17508
17509 ==text < text==
17510 section 2
17511
17512 ==text & text==
17513 section 3
17514
17515 ==text ' text==
17516 section 4
17517
17518 ==text " text==
17519 section 5
17520 !! html/php
17521 <p>The tooltips shall not show entities to the user (ie. be double escaped)
17522 </p>
17523 <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>
17524 <ul>
17525 <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>
17526 <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>
17527 <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>
17528 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
17529 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
17530 </ul>
17531 </div>
17532
17533 <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>
17534 <p>section 1
17535 </p>
17536 <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>
17537 <p>section 2
17538 </p>
17539 <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>
17540 <p>section 3
17541 </p>
17542 <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>
17543 <p>section 4
17544 </p>
17545 <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>
17546 <p>section 5
17547 </p>
17548 !! html/parsoid
17549 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
17550
17551 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
17552 <p>section 1</p>
17553
17554 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
17555 <p>section 2</p>
17556
17557 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
17558 <p>section 3</p>
17559
17560 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
17561 <p>section 4</p>
17562
17563 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
17564 <p>section 5</p>
17565 !! end
17566
17567 !! test
17568 Header with space, plus and underscore as entity
17569 !! wikitext
17570 Id should not contain + for spaces
17571
17572 ==Space between Text==
17573 section 1
17574
17575 ==Space-Entity&#32;between&#32;Text==
17576 section 2
17577
17578 ==Plus+between+Text==
17579 section 3
17580
17581 ==Plus-Entity&#43;between&#43;Text==
17582 section 4
17583
17584 ==Underscore_between_Text==
17585 section 5
17586
17587 ==Underscore-Entity&#95;between&#95;Text==
17588 section 6
17589
17590 [[#Space between Text]]
17591 [[#Space-Entity&#32;between&#32;Text]]
17592 [[#Plus+between+Text]]
17593 [[#Plus-Entity&#43;between&#43;Text]]
17594 [[#Underscore_between_Text]]
17595 [[#Underscore-Entity&#95;between&#95;Text]]
17596 !! html/php
17597 <p>Id should not contain + for spaces
17598 </p>
17599 <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>
17600 <ul>
17601 <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>
17602 <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>
17603 <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>
17604 <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>
17605 <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>
17606 <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>
17607 </ul>
17608 </div>
17609
17610 <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>
17611 <p>section 1
17612 </p>
17613 <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>
17614 <p>section 2
17615 </p>
17616 <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>
17617 <p>section 3
17618 </p>
17619 <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>
17620 <p>section 4
17621 </p>
17622 <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>
17623 <p>section 5
17624 </p>
17625 <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>
17626 <p>section 6
17627 </p><p><a href="#Space_between_Text">#Space between Text</a>
17628 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
17629 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
17630 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
17631 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17632 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17633 </p>
17634 !! html/parsoid
17635 <p>Id should not contain + for spaces</p>
17636
17637 <h2 id="Space_between_Text">Space between Text</h2>
17638 <p>section 1</p>
17639
17640 <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>
17641 <p>section 2</p>
17642
17643 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
17644 <p>section 3</p>
17645
17646 <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>
17647 <p>section 4</p>
17648
17649 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
17650 <p>section 5</p>
17651
17652 <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>
17653 <p>section 6</p>
17654
17655 <p><a rel="mw:WikiLink" href="./Main_Page#Space_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Space_between_Text"},"sa":{"href":"#Space between Text"}}'>#Space between Text</a>
17656 <a rel="mw:WikiLink" href="./Main_Page#Space-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Space-Entity_between_Text"},"sa":{"href":"#Space-Entity&amp;#32;between&amp;#32;Text"}}'>#Space-Entity between Text</a>
17657 <a rel="mw:WikiLink" href="./Main_Page#Plus+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Plus+between+Text"},"sa":{"href":"#Plus+between+Text"}}'>#Plus+between+Text</a>
17658 <a rel="mw:WikiLink" href="./Main_Page#Plus-Entity+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Plus-Entity+between+Text"},"sa":{"href":"#Plus-Entity&amp;#43;between&amp;#43;Text"}}'>#Plus-Entity+between+Text</a>
17659 <a rel="mw:WikiLink" href="./Main_Page#Underscore_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Underscore_between_Text"},"sa":{"href":"#Underscore_between_Text"}}'>#Underscore_between_Text</a>
17660 <a rel="mw:WikiLink" href="./Main_Page#Underscore-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Underscore-Entity_between_Text"},"sa":{"href":"#Underscore-Entity&amp;#95;between&amp;#95;Text"}}'>#Underscore-Entity_between_Text</a></p>
17661 !! end
17662
17663 # Parsoid html2wt disabled because it adds padding spaces around =
17664 !! test
17665 Headers with excess '=' characters
17666 (Are similar tests necessary beyond the 1st level?)
17667 !! options
17668 parsoid=wt2html,wt2wt,html2html
17669 !! wikitext
17670 =foo==
17671 ==foo=
17672 =''italic'' heading==
17673 ==''italic'' heading=
17674 !! html/php
17675 <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>
17676 <ul>
17677 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17678 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17679 <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>
17680 <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>
17681 </ul>
17682 </div>
17683
17684 <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>
17685 <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>
17686 <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>
17687 <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>
17688
17689 !! html/parsoid
17690 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
17691 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
17692 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
17693 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
17694 !! end
17695
17696 !! test
17697 HTML headers vs TOC (T25393)
17698 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17699 !! wikitext
17700 <h1>Header 1</h1>
17701 ==Header 1.1==
17702 ==Header 1.2==
17703
17704 <h1>Header 2
17705 </h1>
17706 ==Header 2.1==
17707 ==Header 2.2==
17708 __NOEDITSECTION__
17709 !! html/php
17710 <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>
17711 <ul>
17712 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17713 <ul>
17714 <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>
17715 <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>
17716 </ul>
17717 </li>
17718 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
17719 <ul>
17720 <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>
17721 <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>
17722 </ul>
17723 </li>
17724 </ul>
17725 </div>
17726
17727 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17728 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17729 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17730 <h1><span class="mw-headline" id="Header_2">Header 2
17731 </span></h1>
17732 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17733 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17734
17735 !! html/parsoid
17736 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17737 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17738 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17739
17740 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17741 </h1>
17742 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17743 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17744 <meta property="mw:PageProp/noeditsection"/>
17745 !! end
17746
17747 !! test
17748 Single-line or multiline-comments can follow headings
17749 !! options
17750 parsoid=wt2html,wt2wt
17751 !! wikitext
17752 ==foo==<!---->
17753 ==bar==<!--c1-->
17754 ==baz==<!--
17755 c2
17756 c3-->
17757 !! html/php
17758 <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>
17759 <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>
17760 <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>
17761
17762 !! html/parsoid
17763 <h2 id="foo">foo</h2><!---->
17764 <h2 id="bar">bar</h2><!--c1-->
17765 <h2 id="baz">baz</h2><!--
17766 c2
17767 c3-->
17768 !! end
17769
17770 !! test
17771 T3219 URL next to image (broken)
17772 !! wikitext
17773 http://example.com[[File:Foobar.jpg]]
17774 !! html/php
17775 <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" width="1941" height="220" /></a>
17776 </p>
17777 !! html/parsoid
17778 <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>
17779 !!end
17780
17781 !! test
17782 T3186 news: in the middle of text
17783 !! wikitext
17784 http://en.wikinews.org/wiki/Wikinews:Workplace
17785 !! html
17786 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17787 </p>
17788 !!end
17789
17790
17791 !! test
17792 Namespaced link must have a title
17793 !! wikitext
17794 [[Project:]]
17795 !! html
17796 <p>[[Project:]]
17797 </p>
17798 !!end
17799
17800 !! test
17801 Namespaced link must have a title (bad fragment version)
17802 !! wikitext
17803 [[Project:#fragment]]
17804 !! html
17805 <p>[[Project:#fragment]]
17806 </p>
17807 !!end
17808
17809
17810 ###
17811 ### HTML tags and HTML attributes
17812 ###
17813
17814 !! test
17815 div with no attributes
17816 !! wikitext
17817 <div>HTML rocks</div>
17818 !! html
17819 <div>HTML rocks</div>
17820
17821 !! end
17822
17823 !! test
17824 div with double-quoted attribute
17825 !! wikitext
17826 <div id="rock">HTML rocks</div>
17827 !! html
17828 <div id="rock">HTML rocks</div>
17829
17830 !! end
17831
17832 !! test
17833 div with single-quoted attribute
17834 !! wikitext
17835 <div id='rock'>HTML rocks</div>
17836 !! html
17837 <div id="rock">HTML rocks</div>
17838
17839 !! end
17840
17841 !! test
17842 div with unquoted attribute
17843 !! wikitext
17844 <div id=rock>HTML rocks</div>
17845 !! html
17846 <div id="rock">HTML rocks</div>
17847
17848 !! end
17849
17850 !! test
17851 div with illegal double attributes
17852 !! wikitext
17853 <div id="a" id="b">HTML rocks</div>
17854 !! html
17855 <div id="b">HTML rocks</div>
17856
17857 !!end
17858
17859 !! test
17860 div with empty attribute value, space before equals
17861 !! options
17862 parsoid=wt2html,html2html
17863 !! wikitext
17864 <div class =>HTML rocks</div>
17865 !! html/php
17866 <div class="">HTML rocks</div>
17867
17868 !! html/parsoid
17869 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17870 !! end
17871
17872 !! test
17873 div with multiple empty attribute values
17874 !! config
17875 wgFragmentMode=[ 'html5', 'legacy' ]
17876 !! options
17877 parsoid=wt2html,html2html
17878 !! wikitext
17879 <div id= title=>HTML rocks</div>
17880 !! html/php
17881 <div id="title=">HTML rocks</div>
17882
17883 !! html/parsoid
17884 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17885 !! end
17886
17887 # FIXME Parsoid doesn't actually match PHP here.
17888 # Probably we should use the synthetic <foo /> or <indicator>
17889 # extensions for this test, which are enabled when running parser tests.
17890 !! test
17891 Extension tag in attribute value
17892 !! wikitext
17893 <span title="<translate>123</translate>">ok</span>
17894 !! html/php+disabled
17895 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17896 </p>
17897 !! html/parsoid
17898 <p><span title="123" about="#mwt4" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"123"},"sa":{"title":"&lt;translate>123&lt;/translate>"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;translate typeof=\"mw:Extension/translate\" about=\"#mwt3\" data-parsoid=&apos;{\"dsr\":[13,39,2,2]}&apos; data-mw=&apos;{\"name\":\"translate\",\"attrs\":{},\"body\":{\"extsrc\":\"123\"}}&apos;>123&lt;/translate>"}]]}'>ok</span></p>
17899 !! end
17900
17901 !! test
17902 table with multiple empty attribute values
17903 !! options
17904 parsoid=wt2html,html2html
17905 !! wikitext
17906 {| title= id=
17907 |hi
17908 |}
17909 !! html/php
17910 <table title="id=">
17911 <tr>
17912 <td>hi
17913 </td></tr></table>
17914
17915 !! html/parsoid
17916 <table title="id=">
17917 <tbody><tr><td>hi</td></tr>
17918 </tbody></table>
17919 !! end
17920
17921 !! test
17922 div with braces in attribute value
17923 !! wikitext
17924 <div title="{}">Foo</div>
17925 !! html/php
17926 <div title="&#123;&#125;">Foo</div>
17927
17928 !! html/parsoid
17929 <div title="{}">Foo</div>
17930 !! end
17931
17932 !! test
17933 div with empty attribute value, no space before equals
17934 !! options
17935 parsoid=wt2html,html2html
17936 !! wikitext
17937 <div class=>HTML rocks</div>
17938 !! html/php
17939 <div class="">HTML rocks</div>
17940
17941 !! html/parsoid
17942 <div class="">HTML rocks</div>
17943 !! end
17944
17945 !! test
17946 HTML multiple attributes correction
17947 !! wikitext
17948 <p class="error" class="awesome">Awesome!</p>
17949 !! html
17950 <p class="awesome">Awesome!</p>
17951
17952 !!end
17953
17954 !! test
17955 Table multiple attributes correction
17956 !! wikitext
17957 {|
17958 !+ class="error" class="awesome"|status
17959 |}
17960 !! html
17961 <table>
17962 <tr>
17963 <th class="awesome">status
17964 </th></tr></table>
17965
17966 !!end
17967
17968 !! test
17969 DIV IN UPPERCASE
17970 !! wikitext
17971 <DIV ID="x">HTML ROCKS</DIV>
17972 !! html
17973 <div id="x">HTML ROCKS</div>
17974
17975 !!end
17976
17977 !! test
17978 Non-ASCII pseudo-tags are rendered as text
17979 !! wikitext
17980 <khyô>
17981 !! html
17982 <p>&lt;khyô&gt;
17983 </p>
17984 !! end
17985
17986 !! test
17987 Pseudo-tag with URL 'name' renders as url link
17988 !! wikitext
17989 <http://example.com/>
17990 !! html
17991 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17992 </p>
17993 !! end
17994
17995 !! test
17996 text with amp in the middle of nowhere
17997 !! wikitext
17998 Remember AT&T?
17999 !! html
18000 <p>Remember AT&amp;T?
18001 </p>
18002 !! end
18003
18004 !! test
18005 text with character entity: eacute
18006 !! wikitext
18007 I always thought &eacute; was a cute letter.
18008 !! html+tidy
18009 <p>I always thought &#233; was a cute letter.
18010 </p>
18011 !! end
18012
18013 !! test
18014 text with entity-escaped character entity-like string: eacute
18015 !! wikitext
18016 I always thought &amp;eacute; was a cute letter.
18017 !! html
18018 <p>I always thought &amp;eacute; was a cute letter.
18019 </p>
18020 !! end
18021
18022 !! test
18023 text with undefined character entity: xacute
18024 !! wikitext
18025 I always thought &xacute; was a cute letter.
18026 !! html
18027 <p>I always thought &amp;xacute; was a cute letter.
18028 </p>
18029 !! end
18030
18031 !! test
18032 HTML5 tags
18033 !! wikitext
18034 <data value="5">five</data>
18035 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
18036 <mark>This highlighted text</mark>
18037 !! html
18038 <p><data value="5">five</data>
18039 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
18040 <mark>This highlighted text</mark>
18041 </p>
18042 !! end
18043
18044 !! test
18045 HTML tag with leading space is parsed as text
18046 !! wikitext
18047 < div>foo< /div>
18048 !! html
18049 <p>&lt; div&gt;foo&lt; /div&gt;
18050 </p>
18051 !! end
18052
18053 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
18054 ## the HTML5 parsing spec.
18055 !! test
18056 Element with broken attribute syntax
18057 !! options
18058 parsoid=wt2html
18059 !! wikitext
18060 <div style=" style="123">hi</div>
18061 <div =>ho</div>
18062 !! html/php
18063 <div style="123">hi</div>
18064 <div>ho</div>
18065
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
18208 !! html/php+tidy
18209 <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>
18210 !! html/parsoid
18211 <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>
18212 !! end
18213
18214 !! test
18215 Media link from missing resource (parsoid-only)
18216 !! options
18217 parsoid=html2wt
18218 !! html/parsoid
18219 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
18220 !! wikitext
18221 [[Media:Foobar.jpg|Bat!]]
18222 !! end
18223
18224 !! test
18225 Media link from missing resource, localized (parsoid-only)
18226 !! options
18227 parsoid=html2wt
18228 language=is
18229 !! html/parsoid
18230 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
18231 !! wikitext
18232 [[Miðill:Foobar.jpg|Bat!]]
18233 !! end
18234
18235 # This is a sanity test to ensure we don't crash or choke when given
18236 # old cached 1.7.0 HTML for media links; we don't require that the
18237 # result be "valid" because wt2wt was completely broken in 1.7.0
18238 !! test
18239 Media link from old 1.7.0 DOM spec (crash test, parsoid-only) T198511
18240 !! options
18241 parsoid=html2wt
18242 !! html/parsoid
18243 <p>This is what Parsoid would emit (and we still handle this HTML fine):</p>
18244 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18245 <p>But VisualEditor would mangle the rel attribute, and give us back this:</p>
18246 <p><a rel="mw:ExtLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18247 <p>But at least we don't crash when trying to handle the mangled HTML!</p>
18248 !! wikitext
18249 This is what Parsoid would emit (and we still handle this HTML fine):
18250
18251 [[Media:Foobar.jpg|A neat file to look at]]
18252
18253 But VisualEditor would mangle the rel attribute, and give us back this:
18254
18255 [//example.com/images/3/3a/Foobar.jpg A neat file to look at]
18256
18257 But at least we don't crash when trying to handle the mangled HTML!
18258 !! end
18259
18260 !! test
18261 Media link to nonexistent file (T3702)
18262 !! wikitext
18263 [[Media:No such.jpg]]
18264 [[Media:No_such file.jpg]]
18265 !! html/php
18266 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
18267 <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>
18268 </p>
18269 !! html/parsoid
18270 <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>
18271 <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>
18272 !! end
18273
18274 !! test
18275 Image link to nonexistent file (T3850 - good)
18276 !! wikitext
18277 [[File:No_such.jpg]]
18278 !! html/php
18279 <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>
18280 </p>
18281 !! html/parsoid
18282 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:No_such.jpg"><img resource="./File:No_such.jpg" src="./Special:FilePath/No_such.jpg" height="220" width="220"/></a></figure-inline></p>
18283 !! end
18284
18285 !! test
18286 :Image link to nonexistent file (T3850 - bad)
18287 !! wikitext
18288 [[:Image:No such.jpg]]
18289 !! html/php
18290 <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>
18291 </p>
18292 !! html/parsoid
18293 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
18294 !! end
18295
18296 !! test
18297 Character reference normalization in link text (T3938)
18298 !! wikitext
18299 [[Main Page|this&that]]
18300 !! html
18301 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
18302 </p>
18303 !!end
18304
18305 !! article
18306 אַ
18307 !! text
18308 Test for unicode normalization
18309
18310 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
18311 !! endarticle
18312
18313 !! test
18314 (T21451) Links should refer to the normalized form.
18315 !! wikitext
18316 [[&#xFB2E;]]
18317 [[&#x5d0;&#x5b7;]]
18318 [[&#x5d0;ַ]]
18319 [[א&#x5b7;]]
18320 [[אַ]]
18321 !! html
18322 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
18323 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
18324 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
18325 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
18326 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
18327 </p>
18328 !! end
18329
18330 !! test
18331 Empty attribute crash test (T4067)
18332 !! wikitext
18333 <font color="">foo</font>
18334 !! html
18335 <p><font color="">foo</font>
18336 </p>
18337 !! end
18338
18339 !! test
18340 Empty attribute crash test single-quotes (T4067)
18341 !! wikitext
18342 <font color=''>foo</font>
18343 !! html
18344 <p><font color="">foo</font>
18345 </p>
18346 !! end
18347
18348 !! test
18349 Attribute test: equals, then nothing
18350 !! options
18351 parsoid=wt2html,html2html
18352 !! wikitext
18353 <font color=>foo</font>
18354 !! html/php
18355 <p><font color="">foo</font>
18356 </p>
18357 !! html/parsoid
18358 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
18359 !! end
18360
18361 !! test
18362 Attribute test: unquoted value
18363 !! options
18364 parsoid=wt2html,html2html
18365 !! wikitext
18366 <font color=x>foo</font>
18367 !! html/php
18368 <p><font color="x">foo</font>
18369 </p>
18370 !! html/parsoid
18371 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
18372 !! end
18373
18374 !! test
18375 Attribute test: unquoted but illegal value (hash)
18376 !! wikitext
18377 <font color=#x>foo</font>
18378 !! html
18379 <p><font color="#x">foo</font>
18380 </p>
18381 !! end
18382
18383 # Parsoid does not serialize to empty attribute syntax,
18384 # so wt2wt and html2wt cases are skipped
18385 !! test
18386 Attribute test: no value (T54330)
18387 !! options
18388 parsoid=wt2html,html2html
18389 !! wikitext
18390 <font color>foo</font>
18391 !! html/php
18392 <p><font color="">foo</font>
18393 </p>
18394 !! html/parsoid
18395 <p><font color="">foo</font></p>
18396 !! end
18397
18398 !! test
18399 T4095: link with three closing brackets
18400 !! wikitext
18401 [[Main Page]]]
18402 !! html/php
18403 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
18404 </p>
18405 !! html/parsoid
18406 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
18407 !! end
18408
18409 !! test
18410 T4095: link with pipe and three closing brackets
18411 !! wikitext
18412 [[Main Page|link]]]
18413 !! html/php
18414 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
18415 </p>
18416 !! html/parsoid
18417 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
18418 !! end
18419
18420 !! test
18421 T4095: link with pipe and three closing brackets, version 2
18422 !! wikitext
18423 [[Main Page|[http://example.com/]]]
18424 !! html/php
18425 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
18426 </p>
18427 !! html/parsoid
18428 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
18429 !! end
18430
18431
18432 ###
18433 ### Safety
18434 ###
18435
18436 !! article
18437 Template:Dangerous attribute
18438 !! text
18439 " onmouseover="alert(document.cookie)
18440 !! endarticle
18441
18442 !! article
18443 Template:Dangerous style attribute
18444 !! text
18445 border-size: expression(alert(document.cookie))
18446 !! endarticle
18447
18448 !! article
18449 Template:Div style
18450 !! text
18451 <div style="float: right; {{{1}}}">Magic div</div>
18452 !! endarticle
18453
18454 !! test
18455 T4304: HTML attribute safety (safe template; regression T4309)
18456 !! wikitext
18457 <div title="{{test}}"></div>
18458 !! html/php
18459 <div title="This is a test template"></div>
18460
18461 !! html/parsoid
18462 <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>
18463 !! end
18464
18465 # Parsoid has enough context to handle this case
18466 !! test
18467 T4304: HTML attribute safety (dangerous template; 2309)
18468 !! wikitext
18469 <div title="{{dangerous attribute}}"></div>
18470 !! html/php
18471 <div title=""></div>
18472
18473 !! html/parsoid
18474 <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>
18475 !! end
18476
18477 !! test
18478 T4304: HTML attribute safety (dangerous style template; 2309)
18479 !! wikitext
18480 <div style="{{dangerous style attribute}}"></div>
18481 !! html/php
18482 <div style="/* insecure input */"></div>
18483
18484 !! html/parsoid
18485 <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>
18486 !! end
18487
18488 !! test
18489 T4304: HTML attribute safety (safe parameter; 2309)
18490 !! wikitext
18491 {{div style|width: 200px}}
18492 !! html/php
18493 <div style="float: right; width: 200px">Magic div</div>
18494
18495 !! html/parsoid
18496 <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>
18497 !! end
18498
18499 !! test
18500 T4304: HTML attribute safety (unsafe parameter; 2309)
18501 !! wikitext
18502 {{div style|width: expression(alert(document.cookie))}}
18503 !! html/php
18504 <div style="/* insecure input */">Magic div</div>
18505
18506 !! html/parsoid
18507 <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>
18508 !! end
18509
18510 ## Parsoid output here differs; needs investigation.
18511 !! test
18512 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
18513 !! wikitext
18514 {{div style|"><script>alert(document.cookie)</script>}}
18515 !! html
18516 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18517
18518 !! end
18519
18520 ## Parsoid output here differs; needs investigation.
18521 !! test
18522 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
18523 !! wikitext
18524 {{div style|" ><script>alert(document.cookie)</script>}}
18525 !! html
18526 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18527
18528 !! end
18529
18530 !! test
18531 T4304: HTML attribute safety (link)
18532 !! wikitext
18533 <div title="[[Main Page]]"></div>
18534 !! html/php
18535 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
18536
18537 !! html/parsoid
18538 <div title="[[Main Page]]"></div>
18539 !! end
18540
18541 !! test
18542 T4304: HTML attribute safety (italics)
18543 !! wikitext
18544 <div title="''foobar''"></div>
18545 !! html
18546 <div title="&#39;&#39;foobar&#39;&#39;"></div>
18547
18548 !! end
18549
18550 !! test
18551 T4304: HTML attribute safety (bold)
18552 !! wikitext
18553 <div title="'''foobar'''"></div>
18554 !! html
18555 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
18556
18557 !! end
18558
18559 !! test
18560 T4304: HTML attribute safety (ISBN)
18561 !! wikitext
18562 <div title="ISBN 1234567890"></div>
18563 !! html
18564 <div title="&#73;SBN 1234567890"></div>
18565
18566 !! end
18567
18568 !! test
18569 T4304: HTML attribute safety (RFC)
18570 !! wikitext
18571 <div title="RFC 1234"></div>
18572 !! html
18573 <div title="&#82;FC 1234"></div>
18574
18575 !! end
18576
18577 !! test
18578 T4304: HTML attribute safety (PMID)
18579 !! wikitext
18580 <div title="PMID 1234567890"></div>
18581 !! html
18582 <div title="&#80;MID 1234567890"></div>
18583
18584 !! end
18585
18586 !! test
18587 T4304: HTML attribute safety (web link)
18588 !! wikitext
18589 <div title="http://example.com/"></div>
18590 !! html
18591 <div title="http&#58;//example.com/"></div>
18592
18593 !! end
18594
18595 !! test
18596 T4304: HTML attribute safety (named web link)
18597 !! wikitext
18598 <div title="[http://example.com/ link]"></div>
18599 !! html/php
18600 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
18601
18602 !! html/parsoid
18603 <div title="[http://example.com/ link]"></div>
18604 !! end
18605
18606 !! test
18607 T5244: HTML attribute safety (extension; safe)
18608 !! wikitext
18609 <div style="<nowiki>background:blue</nowiki>"></div>
18610 !! html/php
18611 <div style="background:blue"></div>
18612
18613 !! html/parsoid
18614 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
18615 !! end
18616
18617 !! test
18618 T5244: HTML attribute safety (extension; unsafe)
18619 !! wikitext
18620 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
18621 !! html/php
18622 <div style="/* insecure input */"></div>
18623
18624 !! html/parsoid
18625 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"&lt;nowiki>border-left:expression(alert(document.cookie))&lt;/nowiki>"}}'></div>
18626 !! end
18627
18628 # More MSIE fun discovered by Tom Gilder
18629
18630 !! test
18631 MSIE CSS safety test: spurious slash
18632 !! wikitext
18633 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
18634 !! html/php
18635 <div style="/* insecure input */">evil</div>
18636
18637 !! html/parsoid
18638 <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>
18639 !! end
18640
18641 !! test
18642 MSIE CSS safety test: hex code
18643 !! wikitext
18644 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
18645 !! html/php
18646 <div style="/* insecure input */">evil</div>
18647
18648 !! html/parsoid
18649 <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>
18650 !! end
18651
18652 !! test
18653 MSIE CSS safety test: comment in url
18654 !! wikitext
18655 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
18656 !! html/php
18657 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
18658
18659 !! html/parsoid
18660 <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>
18661 !! end
18662
18663 !! test
18664 MSIE CSS safety test: comment in expression
18665 !! wikitext
18666 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
18667 !! html/php
18668 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
18669
18670 !! html/parsoid
18671 <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>
18672 !! end
18673
18674 !! test
18675 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
18676 !! wikitext
18677 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
18678 !! html/php
18679 <p style="/* invalid control char */">A</p>
18680
18681 !! html/parsoid
18682 <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>
18683 !! end
18684
18685 !! test
18686 MSIE 6 CSS safety test: Fullwidth (T57332)
18687 !! wikitext
18688 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
18689 <div style="top:EXPRESSION(alert())">B</div>
18690 !! html/php
18691 <p style="/* insecure input */">A</p>
18692 <div style="/* insecure input */">B</div>
18693
18694 !! html/parsoid
18695 <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>
18696 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
18697 !! end
18698
18699 !! test
18700 MSIE 6 CSS safety test: IPA extensions (T57332)
18701 !! wikitext
18702 <div style="background-image:uʀʟ(javascript:alert())">A</div>
18703 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
18704 !! html/php
18705 <div style="/* insecure input */">A</div>
18706 <p style="/* insecure input */">B</p>
18707
18708 !! html/parsoid
18709 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
18710 <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>
18711 !! end
18712
18713 !! test
18714 MSIE 6 CSS safety test: sup/sub script (T57332)
18715 !! wikitext
18716 <div style="background-image:url⁽javascript:alert())">A</div>
18717 <div style="background-image:url₍javascript:alert())">B</div>
18718 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
18719 !! html/php
18720 <div style="/* insecure input */">A</div>
18721 <div style="/* insecure input */">B</div>
18722 <p style="/* insecure input */">C</p>
18723
18724 !! html/parsoid
18725 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
18726 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
18727 <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>
18728 !! end
18729
18730 !! test
18731 Opera -o-link CSS
18732 !! options
18733 parsoid=wt2html,html2html
18734 !! wikitext
18735 <div
18736 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;"
18737 style="-o-link:attr(title);-o-link-source:current">X</div>
18738 !! html/php
18739 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
18740
18741 !! html/parsoid
18742 <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>
18743 !! end
18744
18745 !! test
18746 MSIE 6 CSS safety test: Repetition markers (T57332)
18747 !! wikitext
18748 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
18749 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
18750 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
18751 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
18752 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
18753 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
18754 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
18755 !! html/php
18756 <p style="/* insecure input */">A</p>
18757 <p style="/* insecure input */">B</p>
18758 <p style="/* insecure input */">C</p>
18759 <p style="/* insecure input */">D</p>
18760 <p style="/* insecure input */">E</p>
18761 <p style="/* insecure input */">F</p>
18762 <p style="/* insecure input */">G</p>
18763
18764 !! html/parsoid
18765 <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>
18766 <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>
18767 <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>
18768 <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>
18769 <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>
18770 <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>
18771 <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>
18772 !! end
18773
18774 !! test
18775 Table attribute legitimate extension
18776 !! wikitext
18777 {|
18778 !+ style="<nowiki>color:blue</nowiki>"|status
18779 |}
18780 !! html
18781 <table>
18782 <tr>
18783 <th style="color:blue">status
18784 </th></tr></table>
18785
18786 !!end
18787
18788 !! test
18789 Table attribute safety
18790 !! wikitext
18791 {|
18792 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18793 |}
18794 !! html
18795 <table>
18796 <tr>
18797 <th style="/* insecure input */">status
18798 </th></tr></table>
18799
18800 !! end
18801
18802 !! test
18803 CSS line continuation 1
18804 !! wikitext
18805 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18806 !! html
18807 <div style="/* insecure input */"></div>
18808
18809 !! end
18810
18811 !! test
18812 CSS line continuation 2
18813 !! wikitext
18814 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18815 !! html
18816 <div style="/* invalid control char */"></div>
18817
18818 !! end
18819
18820 !! article
18821 Template:Identity
18822 !! text
18823 {{{1}}}
18824 !! endarticle
18825
18826 !! test
18827 Expansion of multi-line templates in attribute values (T8255)
18828 !! wikitext
18829 <div style="background: {{identity|#00FF00}}">-</div>
18830 !! html
18831 <div style="background: #00FF00">-</div>
18832
18833 !! end
18834
18835 !! test
18836 Expansion of multi-line templates in attribute values (T8255 sanity check)
18837 !! wikitext
18838 <div style="background:
18839 #00FF00">-</div>
18840 !! html/php
18841 <div style="background: #00FF00">-</div>
18842
18843 !! html/parsoid
18844 <div style="background:
18845 #00FF00">-</div>
18846 !! end
18847
18848 !! test
18849 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18850 !! wikitext
18851 <div style="background: &#10;#00FF00">-</div>
18852 !! html
18853 <div style="background: &#10;#00FF00">-</div>
18854
18855 !! end
18856
18857 !! test
18858 Tags which are hidden from tidiers cannot pass through the Sanitizer
18859 !! wikitext
18860 <mw:toc><script>alert();</script></mw:toc>
18861 !! html+tidy
18862 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18863 </p>
18864 !! end
18865
18866 ###
18867 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18868 ###
18869
18870 !! test
18871 Parser hook: empty input
18872 !! wikitext
18873 <tag></tag>
18874 !! html/php
18875 <pre>
18876 ''
18877 array (
18878 )
18879 </pre>
18880
18881 !! html/parsoid
18882 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18883 !! end
18884
18885 ## Don't expect parsoid to rt this form.
18886 !! test
18887 Parser hook: empty input using terminated empty elements
18888 !! options
18889 parsoid=wt2html,html2html
18890 !! wikitext
18891 <tag/>
18892 !! html/php
18893 <pre>
18894 NULL
18895 array (
18896 )
18897 </pre>
18898
18899 !! html/parsoid
18900 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
18901 !! end
18902
18903 !! test
18904 Parser hook: empty input using terminated empty elements (space before)
18905 !! wikitext
18906 <tag />
18907 !! html/php
18908 <pre>
18909 NULL
18910 array (
18911 )
18912 </pre>
18913
18914 !! html/parsoid
18915 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
18916 !! end
18917
18918 !! test
18919 Parser hook: basic input
18920 !! wikitext
18921 <tag>input</tag>
18922 !! html/php
18923 <pre>
18924 'input'
18925 array (
18926 )
18927 </pre>
18928
18929 !! html/parsoid
18930 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18931 !! end
18932
18933 ## Don't expect parsoid to rt this form.
18934 !! test
18935 Parser hook: case insensitive
18936 !! options
18937 parsoid=wt2html,html2html
18938 !! wikitext
18939 <TAG>input</TAG>
18940 !! html/php
18941 <pre>
18942 'input'
18943 array (
18944 )
18945 </pre>
18946
18947 !! html/parsoid
18948 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18949 !! end
18950
18951 ## Don't expect parsoid to rt this form.
18952 !! test
18953 Parser hook: case insensitive, redux
18954 !! options
18955 parsoid=wt2html,html2html
18956 !! wikitext
18957 <TaG>input</TAg>
18958 !! html/php
18959 <pre>
18960 'input'
18961 array (
18962 )
18963 </pre>
18964
18965 !! html/parsoid
18966 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18967 !! end
18968
18969 !! test
18970 Parser hook: nested tags
18971 !! options
18972 parsoid=wt2html
18973 !! wikitext
18974 <tag><tag></tag></tag>
18975 !! html/php
18976 <pre>
18977 '<tag>'
18978 array (
18979 )
18980 </pre>&lt;/tag&gt;
18981
18982 !! html/php+tidy
18983 <pre>'<tag>'
18984 array (
18985 )
18986 </tag></pre><p>&lt;/tag&gt;
18987 </p>
18988 !! html/parsoid
18989 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}'></pre><p>&lt;/tag></p>
18990 !! end
18991
18992 !! test
18993 Parser hook: basic arguments
18994 !! wikitext
18995 <tag width="200" height="100" depth="50" square=""></tag>
18996 !! html/php
18997 <pre>
18998 ''
18999 array (
19000 'width' => '200',
19001 'height' => '100',
19002 'depth' => '50',
19003 'square' => '',
19004 )
19005 </pre>
19006
19007 !! html/parsoid
19008 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19009 !! end
19010
19011 ## Don't expect parsoid to rt this form.
19012 !! test
19013 Parser hook: basic arguments, variations
19014 !! options
19015 parsoid=wt2html,html2html
19016 !! wikitext
19017 <tag width=200 height = "100" depth = '50' square></tag>
19018 !! html/php
19019 <pre>
19020 ''
19021 array (
19022 'width' => '200',
19023 'height' => '100',
19024 'depth' => '50',
19025 'square' => '',
19026 )
19027 </pre>
19028
19029 !! html/parsoid
19030 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19031 !! end
19032
19033 !! test
19034 Parser hook: argument containing a forward slash (T7344)
19035 !! wikitext
19036 <tag filename="/tmp/bla"></tag>
19037 !! html/php
19038 <pre>
19039 ''
19040 array (
19041 'filename' => '/tmp/bla',
19042 )
19043 </pre>
19044
19045 !! html/parsoid
19046 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19047 !! end
19048
19049 ## Don't expect parsoid to rt this form.
19050 !! test
19051 Parser hook: empty input using terminated empty elements (T4374)
19052 !! options
19053 parsoid=wt2html,html2html
19054 !! wikitext
19055 <tag foo=bar/>text
19056 !! html/php
19057 <pre>
19058 NULL
19059 array (
19060 'foo' => 'bar',
19061 )
19062 </pre>text
19063
19064 !! html/parsoid
19065 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{"foo":"bar"}}'></pre><p>text</p>
19066 !! end
19067
19068 ## </tag> should be output literally since there is no matching tag that begins it
19069 ## Don't expect parsoid to rt this form.
19070 !! test
19071 Parser hook: basic arguments using terminated empty elements (T4374)
19072 !! options
19073 parsoid=wt2html
19074 !! wikitext
19075 <tag width=200 height = "100" depth = '50' square/>
19076 other stuff
19077 </tag>
19078 !! html/php
19079 <pre>
19080 NULL
19081 array (
19082 'width' => '200',
19083 'height' => '100',
19084 'depth' => '50',
19085 'square' => '',
19086 )
19087 </pre>
19088 <p>other stuff
19089 &lt;/tag&gt;
19090 </p>
19091 !! html/parsoid
19092 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""}}' about="#mwt2"></pre><p>other stuff
19093 &lt;/tag></p>
19094 !! end
19095
19096 ## Don't expect parsoid to rt this form.
19097 !! test
19098 Parser hook: Don't allow unclosed extension tags
19099 !! options
19100 parsoid=wt2html
19101 !! wikitext
19102 test <tag>123
19103
19104 this is a '''test'''
19105 !! html/php
19106 <p>test &lt;tag&gt;123
19107 </p><p>this is a <b>test</b>
19108 </p>
19109 !! html/parsoid
19110 <p>test &lt;tag>123</p>
19111
19112 <p>this is a <b>test</b></p>
19113 !! end
19114
19115 !! test
19116 Parser hook: horizontal rule inside extension tag that outputs <pre>
19117 !! wikitext
19118 <tag>
19119 Hello
19120 <hr/>
19121 Goodbye
19122 </tag>
19123 !! html/php
19124 <pre>
19125 '
19126 Hello
19127 <hr/>
19128 Goodbye
19129 '
19130 array (
19131 )
19132 </pre>
19133
19134 !! end
19135
19136 ###
19137 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
19138 ###
19139
19140 !! test
19141 Parser hook: static parser hook not inside a comment
19142 !! wikitext
19143 <statictag>hello, world</statictag>
19144
19145 <statictag action="flush" />
19146 !! html/php
19147 <p><br />
19148 hello, world
19149 </p>
19150 !! html/parsoid
19151 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
19152 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about="#mwt4">hello, world</p>
19153 !! end
19154
19155 !! test
19156 Parser hook: static parser hook inside a comment
19157 !! wikitext
19158 <!-- <statictag>hello, world</statictag> -->
19159 <statictag action="flush" />
19160 !! html/php
19161 <p><br />
19162 </p>
19163 !! html/parsoid
19164 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
19165 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about='#mwt2'></p>
19166 !! end
19167
19168 # Nested template calls; this case was broken by Parser.php rev 1.506,
19169 # since reverted.
19170
19171 !! article
19172 Template:One-parameter
19173 !! text
19174 (My parameter is: {{{1}}})
19175 !! endarticle
19176
19177 !! article
19178 Template:Map-one-parameter
19179 !! text
19180 {{{{{1}}}|{{{2}}}}}
19181 !! endarticle
19182
19183 !! test
19184 Nested template calls
19185 !! wikitext
19186 {{Map-one-parameter|One-parameter|param}}
19187 !! html
19188 <p>(My parameter is: param)
19189 </p>
19190 !! end
19191
19192
19193 ###
19194 ### Sanitizer
19195 ###
19196
19197 !! test
19198 Sanitizer: Closing of open tags
19199 !! wikitext
19200 <s></s><table></table>
19201 !! html/php+tidy
19202 <p><s></s></p><table></table>
19203 !! html/parsoid
19204 <p><s data-parsoid='{"stx":"html"}'></s></p><table data-parsoid='{"stx":"html"}'></table>
19205 !! end
19206
19207 !! test
19208 Sanitizer: Closing of open but not closed tags
19209 !! wikitext
19210 <s>foo
19211 !! html
19212 <p><s>foo</s>
19213 </p>
19214 !! end
19215
19216 !! test
19217 Sanitizer: Closing of closed but not open tags
19218 !! options
19219 parsoid=wt2html
19220 !! wikitext
19221 </s>
19222 !! html+tidy
19223 <p class="mw-empty-elt">
19224 </p>
19225 !! end
19226
19227 !! test
19228 Sanitizer: Closing of closed but not open table tags
19229 !! options
19230 parsoid=wt2html
19231 !! wikitext
19232 Table not started</td></tr></table>
19233 !! html+tidy
19234 <p>Table not started
19235 </p>
19236 !! end
19237
19238 !! test
19239 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
19240 !! config
19241 wgFragmentMode=[ 'html5', 'legacy' ]
19242 !! wikitext
19243 <span id="æ: v">byte</span>[[#æ: v|backlink]]
19244 !! html/php
19245 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
19246 </p>
19247 !! html/parsoid
19248 <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>
19249 !! end
19250
19251 !! test
19252 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
19253 !! config
19254 wgFragmentMode=[ 'legacy' ]
19255 !! wikitext
19256 <span id="æ: v">byte</span>[[#æ: v|backlink]]
19257 !! html/php
19258 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
19259 </p>
19260 !! end
19261
19262 # In HTML5, the restrictions are that id must contain at least one character,
19263 # and must not contain any space characters.
19264 !! test
19265 Sanitizer: Validating the contents of the id attribute (T6515)
19266 !! options
19267 disabled
19268 !! wikitext
19269 <br id="" /><br id="a space" />
19270 !! html
19271 Something ...
19272 !! end
19273
19274 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
19275 !! test
19276 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
19277 !! options
19278 disabled
19279 !! wikitext
19280 <br id="foo" /><br id="foo" />
19281 !! html
19282 Something need to be done. foo-2 ?
19283 !! end
19284
19285 !! test
19286 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
19287 !! wikitext
19288 <div itemscope>
19289 <meta itemprop="hello" content="world">
19290 <meta http-equiv="refresh" content="5">
19291 <meta itemprop="hello" http-equiv="refresh" content="5">
19292 <link itemprop="hello" href="{{SERVER}}">
19293 <link rel="stylesheet" href="{{SERVER}}">
19294 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
19295 </div>
19296 !! html
19297 <div itemscope="">
19298 <p> <meta itemprop="hello" content="world" />
19299 &lt;meta http-equiv="refresh" content="5"&gt;
19300 <meta itemprop="hello" content="5" />
19301 <link itemprop="hello" href="http&#58;//example.org" />
19302 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
19303 <link itemprop="hello" href="http&#58;//example.org" />
19304 </p>
19305 </div>
19306
19307 !! end
19308
19309 !! test
19310 Sanitizer: Strip comments from CSS attributes
19311 !! options
19312 parsoid=wt2html,wt2wt
19313 !! wikitext
19314 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
19315 !! html/php
19316 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
19317 </p>
19318 !! html/parsoid
19319 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
19320 !! end
19321
19322 !! test
19323 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
19324 !! wikitext
19325 [[meatball:Soft"Security]]
19326 !! html/php
19327 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
19328 </p>
19329 !! html/parsoid
19330 <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>
19331 !! end
19332
19333 !! test
19334 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
19335 !! wikitext
19336 [[meatball:Foo<Bar]]
19337 [[meatball:Foo>Bar]]
19338 [[meatball:Foo&lt;bar]]
19339 [[meatball:Foo&gt;bar]]
19340 !! html/php
19341 <p>[[meatball:Foo&lt;Bar]]
19342 [[meatball:Foo&gt;Bar]]
19343 [[meatball:Foo&lt;bar]]
19344 [[meatball:Foo&gt;bar]]
19345 </p>
19346 !! html/parsoid
19347 <p>[[meatball:Foo&lt;Bar]]
19348 [[meatball:Foo>Bar]]
19349 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
19350 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
19351 !! end
19352
19353 !! test
19354 Language converter: output gets cut off unexpectedly (T7757)
19355 !! options
19356 language=zh
19357 !! wikitext
19358 this bit is safe: }-
19359
19360 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
19361
19362 then we get cut off here: }-
19363
19364 all additional text is vanished
19365 !! html/php
19366 <p>this bit is safe: }-
19367 </p><p>but if we add a conversion instance: xxx
19368 </p><p>then we get cut off here: }-
19369 </p><p>all additional text is vanished
19370 </p>
19371 !! html/parsoid
19372 <p>this bit is safe: }-</p>
19373 <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>
19374 <p>then we get cut off here: }-</p>
19375 <p>all additional text is vanished</p>
19376 !! end
19377
19378 !! test
19379 Language converter glossary rules inside attributes (T119158)
19380 !! options
19381 language=sr variant=sr-el
19382 !! wikitext
19383 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
19384
19385 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
19386 !! html/php
19387 <p>
19388 </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" width="1941" height="220" /></a>
19389 </p>
19390 !! html/parsoid
19391 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
19392
19393 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./Датотека:Foobar.jpg"><img alt="foAjrjvi" resource="./Датотека:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"foAjrjvi","resource":"./Датотека:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=-{}-foAjrjvi-{}-","resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
19394 !! end
19395
19396 !! test
19397 Self closed html pairs (T7487)
19398 !! wikitext
19399 <center><font id="bug" />Centered text</center>
19400 <div><font id="bug2" />In div text</div>
19401 !! html+tidy
19402 <center><font id="bug"></font>Centered text</center>
19403 <div><font id="bug2"></font>In div text</div>
19404 !! end
19405
19406 !! test
19407 Punctuation: nbsp before exclamation
19408 !! wikitext
19409 C'est grave !
19410 !! html
19411 <p>C'est grave&#160;!
19412 </p>
19413 !! end
19414
19415 !! test
19416 Punctuation: CSS !important (T13874)
19417 !! wikitext
19418 <div style="width:50% !important">important</div>
19419 !! html
19420 <div style="width:50% !important">important</div>
19421
19422 !!end
19423
19424 !! test
19425 Punctuation: CSS ! important (T13874; with space after)
19426 !! wikitext
19427 <div style="width:50% ! important">important</div>
19428 !! html
19429 <div style="width:50%&#32;! important">important</div>
19430
19431 !!end
19432
19433 !! test
19434 HTML bullet list, closed tags (T7497)
19435 !! wikitext
19436 <ul>
19437 <li>One</li>
19438 <li>Two</li>
19439 </ul>
19440 !! html/php
19441 <ul>
19442 <li>One</li>
19443 <li>Two</li>
19444 </ul>
19445
19446 !! html/parsoid
19447 <ul data-parsoid='{"stx":"html"}'>
19448 <li data-parsoid='{"stx":"html"}'>One</li>
19449 <li data-parsoid='{"stx":"html"}'>Two</li>
19450 </ul>
19451
19452 !! end
19453
19454 !! test
19455 HTML bullet list, unclosed tags (T7497)
19456 !! wikitext
19457 <ul>
19458 <li>One
19459 <li>Two
19460 </ul>
19461 !! html/php+tidy
19462 <ul>
19463 <li>One
19464 </li><li>Two
19465 </li></ul>
19466 !! html/parsoid
19467 <ul data-parsoid='{"stx":"html"}'>
19468 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19469 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19470 </ul>
19471
19472 !! end
19473
19474 !! test
19475 HTML ordered list, closed tags (T7497)
19476 !! wikitext
19477 <ol>
19478 <li>One</li>
19479 <li>Two</li>
19480 </ol>
19481 !! html/php
19482 <ol>
19483 <li>One</li>
19484 <li>Two</li>
19485 </ol>
19486
19487 !! html/parsoid
19488 <ol data-parsoid='{"stx":"html"}'>
19489 <li data-parsoid='{"stx":"html"}'>One</li>
19490 <li data-parsoid='{"stx":"html"}'>Two</li>
19491 </ol>
19492
19493 !! end
19494
19495 !! test
19496 HTML ordered list, unclosed tags (T7497)
19497 !! options
19498 !! wikitext
19499 <ol>
19500 <li>One
19501 <li>Two
19502 </ol>
19503 !! html/php+tidy
19504 <ol>
19505 <li>One
19506 </li><li>Two
19507 </li></ol>
19508 !! html/parsoid
19509 <ol data-parsoid='{"stx":"html"}'>
19510 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19511 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19512 </ol>
19513
19514 !! end
19515
19516 !! test
19517 HTML nested bullet list, closed tags (T7497)
19518 !! wikitext
19519 <ul>
19520 <li>One</li>
19521 <li>Two:
19522 <ul>
19523 <li>Sub-one</li>
19524 <li>Sub-two</li>
19525 </ul>
19526 </li>
19527 </ul>
19528 !! html/php
19529 <ul>
19530 <li>One</li>
19531 <li>Two:
19532 <ul>
19533 <li>Sub-one</li>
19534 <li>Sub-two</li>
19535 </ul>
19536 </li>
19537 </ul>
19538
19539 !! html/parsoid
19540 <ul data-parsoid='{"stx":"html"}'>
19541 <li data-parsoid='{"stx":"html"}'>One</li>
19542 <li data-parsoid='{"stx":"html"}'>Two:
19543 <ul data-parsoid='{"stx":"html"}'>
19544 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
19545 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
19546 </ul>
19547 </li>
19548 </ul>
19549 !! end
19550
19551 !! test
19552 HTML nested bullet list, open tags (T7497)
19553 !! wikitext
19554 <ul>
19555 <li>One
19556 <li>Two:
19557 <ul>
19558 <li>Sub-one
19559 <li>Sub-two
19560 </ul>
19561 </ul>
19562 !! html+tidy
19563 <ul>
19564 <li>One
19565 </li><li>Two:
19566 <ul>
19567 <li>Sub-one
19568 </li><li>Sub-two
19569 </li></ul>
19570 </li></ul>
19571 !! end
19572
19573 !! test
19574 HTML nested ordered list, closed tags (T7497)
19575 !! wikitext
19576 <ol>
19577 <li>One</li>
19578 <li>Two:
19579 <ol>
19580 <li>Sub-one</li>
19581 <li>Sub-two</li>
19582 </ol>
19583 </li>
19584 </ol>
19585 !! html
19586 <ol>
19587 <li>One</li>
19588 <li>Two:
19589 <ol>
19590 <li>Sub-one</li>
19591 <li>Sub-two</li>
19592 </ol>
19593 </li>
19594 </ol>
19595
19596 !! end
19597
19598 !! test
19599 HTML nested ordered list, open tags (T7497)
19600 !! wikitext
19601 <ol>
19602 <li>One
19603 <li>Two:
19604 <ol>
19605 <li>Sub-one
19606 <li>Sub-two
19607 </ol>
19608 </ol>
19609 !! html/php
19610 <ol>
19611 <li>One
19612 <li>Two:
19613 <ol>
19614 <li>Sub-one
19615 <li>Sub-two
19616 </ol>
19617 </ol>
19618
19619 !! html/parsoid
19620 <ol>
19621 <li>One
19622 </li>
19623 <li>Two:
19624 <ol>
19625 <li>Sub-one
19626 </li>
19627 <li>Sub-two
19628 </li>
19629 </ol>
19630 </li>
19631 </ol>
19632
19633 !! end
19634
19635 !! test
19636 HTML ordered list item with parameters oddity
19637 !! wikitext
19638 <ol><li id="fragment">One</li>
19639 </ol>
19640 !! html
19641 <ol><li id="fragment">One</li>
19642 </ol>
19643
19644 !! end
19645
19646 # parsoid doesn't explicitly mark autonumbered links, see T55505
19647 !!test
19648 T7918: autonumbering
19649 !! wikitext
19650 [http://first/] [http://second] [ftp://ftp]
19651
19652 ftp://inlineftp
19653
19654 [mailto:enclosed@mail.tld With target]
19655
19656 [mailto:enclosed@mail.tld]
19657
19658 mailto:inline@mail.tld
19659 !! html/php
19660 <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>
19661 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
19662 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
19663 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
19664 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
19665 </p>
19666 !! html/parsoid
19667 <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>
19668 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
19669 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
19670 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
19671 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
19672 !! end
19673
19674
19675 #
19676 # Security and HTML correctness
19677 # From Nick Jenkins' fuzz testing
19678 #
19679
19680 !! test
19681 Fuzz testing: Parser13
19682 !! wikitext
19683 {|
19684 | http://a|
19685 !! html
19686 <table>
19687 <tr>
19688 <td>
19689 </td>
19690 </tr>
19691 </table>
19692
19693 !! end
19694
19695 # Note that Parsoid output differs from the PHP parser here: the PHP
19696 # parser breaks the URL for the magic word, while in Parsoid the URL
19697 # production takes precedence.
19698 !! test
19699 Fuzz testing: Parser14
19700 !! wikitext
19701 ==onmouseover===
19702 http://__TOC__
19703 !! html/php
19704 <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>
19705 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>
19706 <ul>
19707 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19708 </ul>
19709 </div>
19710
19711
19712 !! html/php+tidy
19713 <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>
19714 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>
19715 <ul>
19716 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19717 </ul>
19718 </div>
19719 !! html/parsoid
19720 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
19721 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
19722 !! end
19723
19724 !! test
19725 Fuzz testing: Parser14-table
19726 !! options
19727 parsoid=wt2html,html2html
19728 !! wikitext
19729 ==a==
19730 {| STYLE=__TOC__
19731 !! html
19732 <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>
19733 <table style="&#95;_TOC&#95;_">
19734 <tr><td></td></tr>
19735 </table>
19736
19737 !! html+tidy
19738 <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>
19739 <table style="__TOC__">
19740 <tr>
19741 <td></td>
19742 </tr>
19743 </table>
19744 !! html/parsoid
19745 <h2 id="a">a</h2>
19746 <table style="__TOC__"></table>
19747 !! end
19748
19749 # Known to produce bogus xml (extra </td>)
19750 # Don't add the html/php section since it generates broken HTML
19751 !! test
19752 Fuzz testing: Parser16
19753 !! wikitext
19754 {|
19755 !https://||||||
19756 !! html+tidy
19757 <table>
19758 <tbody><tr>
19759 <th>https://</th>
19760 <th></th>
19761 <th></th>
19762 <th>
19763
19764 </th></tr>
19765 </tbody></table>
19766 !! end
19767
19768 !! test
19769 Fuzz testing: Parser21
19770 !! wikitext
19771 {|
19772 !irc://{{ftp://a" onmouseover="alert('hello world');"
19773 |
19774 !! html
19775 <table>
19776 <tr>
19777 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
19778 </th>
19779 <td>
19780 </td>
19781 </tr>
19782 </table>
19783
19784 !! end
19785
19786 !! test
19787 Fuzz testing: Parser22
19788 !! wikitext
19789 http://===r:::https://b
19790
19791 {|
19792 !! html
19793 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
19794 </p>
19795 <table>
19796 <tr><td></td></tr>
19797 </table>
19798
19799 !! end
19800
19801 ## Remex doesn't account for fostered content.
19802 ## Known to produce bad XML for now
19803 !! test
19804 Fuzz testing: Parser24
19805 !! options
19806 parsoid=wt2html
19807 !! wikitext
19808 {|
19809 {{{|
19810 <u CLASS=
19811 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19812 <br style="onmouseover='alert(document.cookie);' " />
19813
19814 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19815 |
19816 !! html/php
19817 <table>
19818 {{{|
19819 <u class="&#124;">}}}} &gt;
19820 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19821
19822 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19823 <tr>
19824 <td></u>
19825 </td>
19826 </tr>
19827 </table>
19828
19829 !! html/php+tidy
19830
19831 {{{|
19832 <u class="&#124;">}}}} &gt;
19833 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19834
19835 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19836 </u><table><tbody><tr>
19837 <td>
19838 </td>
19839 </tr>
19840 </tbody></table><p><u class="&#124;">
19841 </u></p>
19842 !! html/parsoid
19843 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
19844 {{{|
19845 <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>"}'/>}}}} >
19846 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/>
19847
19848 MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p>
19849 <table data-parsoid='{"autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedStart":true}'><td></td></tr></tbody></table>
19850 !! end
19851
19852 # Note: the current result listed for this is not what the original one was,
19853 # but the original bug was JavaScript injection, which is fixed in any case.
19854 # It's not clear that the original result listed was any more correct than the
19855 # current one. Original result:
19856 # <p>{{{|
19857 # </p>
19858 # <li class="&#124;&#124;">
19859 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19860 !!test
19861 Fuzz testing: Parser25 (T8055)
19862 !! wikitext
19863 {{{
19864 |
19865 <LI CLASS=||
19866 >
19867 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19868 !! html/php
19869 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19870 </p>
19871 !! html/parsoid
19872 <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"]}'>
19873 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19874 !! end
19875
19876 !!test
19877 Fuzz testing: URL adjacent extension (with space, clean)
19878 !! wikitext
19879 http://example.com <nowiki>junk</nowiki>
19880 !! html/php
19881 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19882 </p>
19883 !! html/parsoid
19884 <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>
19885 !! end
19886
19887 !!test
19888 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19889 !! wikitext
19890 http://example.com<nowiki>junk</nowiki>
19891 !! html/php
19892 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19893 </p>
19894 !! html/parsoid
19895 <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>
19896 !! end
19897
19898 !! test
19899 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19900 !! wikitext
19901 http://example.com<pre>junk</pre>
19902 !! html/php
19903 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19904
19905 !! html/php+tidy
19906 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19907 !! html/parsoid
19908 <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>
19909 !! end
19910
19911 !! test
19912 Fuzz testing: image with bogus manual thumbnail
19913 !! wikitext
19914 [[Image:foobar.jpg|thumbnail= ]]
19915 !! html/php
19916 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19917
19918 !! html/parsoid
19919 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' data-mw='{"errors":[{"key":"apierror-invalidtitle","message":"Invalid thumbnail title.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"Image:foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/Foobar.jpg" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
19920 !! end
19921
19922 # Parsoid will emit the newline literally in wt2wt; see next test case.
19923 !! test
19924 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19925 !! options
19926 parsoid=wt2html
19927 !! wikitext
19928 <pre dir="&#10;"></pre>
19929 !! html/php
19930 <pre dir="&#10;"></pre>
19931
19932 !! html/parsoid
19933 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19934 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19935 !! end
19936
19937 !! test
19938 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19939 !! options
19940 parsoid=html2wt
19941 !! html/parsoid
19942 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19943 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19944 !! wikitext
19945 <pre dir="
19946 "></pre>
19947 !! html/php
19948 <pre dir=""></pre>
19949
19950 !! end
19951
19952 !! test
19953 Templates in extension attributes are not expanded
19954 !! wikitext
19955 <pre dir="{{echo|ltr}}"></pre>
19956 !! html/php
19957 <pre dir="{{echo|ltr}}"></pre>
19958
19959 !! html/parsoid
19960 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19961 !! end
19962
19963 !! test
19964 Parsing optional HTML elements (T8171)
19965 !! options
19966 !! wikitext
19967 <table>
19968 <tr>
19969 <td> Some tabular data</td>
19970 <td> More tabular data ...
19971 <td> And yet som tabular data</td>
19972 </tr>
19973 </table>
19974 !! html
19975 <table>
19976 <tr>
19977 <td> Some tabular data</td>
19978 <td> More tabular data ...
19979 </td><td> And yet som tabular data</td>
19980 </tr>
19981 </table>
19982
19983 !! end
19984
19985 !! test
19986 Correct handling of <td>, <tr> (T8171)
19987 !! options
19988 !! wikitext
19989 <table>
19990 <tr>
19991 <td> Some tabular data</td>
19992 <td> More tabular data ...</td>
19993 <td> And yet som tabular data</td>
19994 </tr>
19995 </table>
19996 !! html
19997 <table>
19998 <tr>
19999 <td> Some tabular data</td>
20000 <td> More tabular data ...</td>
20001 <td> And yet som tabular data</td>
20002 </tr>
20003 </table>
20004
20005 !! end
20006
20007
20008 !! test
20009 Parsing crashing regression (fr:JavaScript)
20010 !! wikitext
20011 </body></x>
20012 !! html
20013 <p>&lt;/body&gt;&lt;/x&gt;
20014 </p>
20015 !! end
20016
20017 !! test
20018 Inline wiki vs wiki block nesting
20019 !! wikitext
20020 '''Bold paragraph
20021
20022 New wiki paragraph
20023 !! html
20024 <p><b>Bold paragraph</b>
20025 </p><p>New wiki paragraph
20026 </p>
20027 !! end
20028
20029 # FIXME: The current php output is documented
20030 # and desired output is the parsoid target.
20031 !! test
20032 Inline HTML vs wiki block nesting
20033 !! wikitext
20034 <b>Bold paragraph
20035
20036 New wiki paragraph
20037 !! html/php
20038 <p><b>Bold paragraph
20039 </p><p>New wiki paragraph</b>
20040 </p>
20041 !! html/php+tidy
20042 <p><b>Bold paragraph
20043 </b></p><p><b>New wiki paragraph
20044 </b></p>
20045 !! html/parsoid
20046 <p><b>Bold paragraph</b>
20047 </p><p>New wiki paragraph
20048 </p>
20049 !! end
20050
20051 # Original result was this:
20052 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
20053 # </p>
20054 # While that might be marginally more intuitive, maybe, the six-apostrophe
20055 # construct is clearly pathological and the result stated here (which is what
20056 # the parser actually does) is about as reasonable as anything.
20057 !!test
20058 Mixing markup for italics and bold
20059 !! options
20060 !! wikitext
20061 '''bold''''''bold''bolditalics'''''
20062 !! html
20063 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
20064 </p>
20065 !! end
20066
20067
20068 !! article
20069 Xyzzyx
20070 !! text
20071 Article for special page transclusion test
20072 !! endarticle
20073
20074 !! test
20075 Special page transclusion
20076 !! options
20077 !! wikitext
20078 {{Special:Prefixindex/Xyzzyx}}
20079 !! html
20080 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20081 </ul>
20082
20083 !! end
20084
20085 !! test
20086 Special page transclusion twice (T7021)
20087 !! options
20088 !! wikitext
20089 {{Special:Prefixindex/Xyzzyx}}
20090 {{Special:Prefixindex/Xyzzyx}}
20091 !! html
20092 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20093 </ul>
20094 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20095 </ul>
20096
20097 !! end
20098
20099 !! test
20100 Transclusion of default MediaWiki message
20101 !! wikitext
20102 {{MediaWiki:Mainpage}}
20103 !! html
20104 <p>Main Page
20105 </p>
20106 !! end
20107
20108 !! test
20109 Transclusion of nonexistent MediaWiki message
20110 !! wikitext
20111 {{MediaWiki:Mainpagexxx}}
20112 !! html
20113 <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>
20114 </p>
20115 !! end
20116
20117 !! test
20118 Transclusion of MediaWiki message with underscore
20119 !! wikitext
20120 {{MediaWiki:history_short}}
20121 !! html
20122 <p>History
20123 </p>
20124 !! end
20125
20126 !! test
20127 Transclusion of MediaWiki message with space
20128 !! wikitext
20129 {{MediaWiki:history short}}
20130 !! html
20131 <p>History
20132 </p>
20133 !! end
20134
20135 !! test
20136 Invalid header with following text
20137 !! wikitext
20138 = x = y
20139 !! html
20140 <p>= x = y
20141 </p>
20142 !! end
20143
20144
20145 !! test
20146 Section extraction test (section 0)
20147 !! options
20148 section=0
20149 !! wikitext
20150 start
20151 ==a==
20152 ===aa===
20153 ====aaa====
20154 ==b==
20155 ===ba===
20156 ===bb===
20157 ====bba====
20158 ===bc===
20159 ==c==
20160 ===ca===
20161 !! html/php
20162 start
20163 !! end
20164
20165 !! test
20166 Section extraction test (section 1)
20167 !! options
20168 section=1
20169 !! wikitext
20170 start
20171 ==a==
20172 ===aa===
20173 ====aaa====
20174 ==b==
20175 ===ba===
20176 ===bb===
20177 ====bba====
20178 ===bc===
20179 ==c==
20180 ===ca===
20181 !! html/php
20182 ==a==
20183 ===aa===
20184 ====aaa====
20185 !! end
20186
20187 !! test
20188 Section extraction test (section 2)
20189 !! options
20190 section=2
20191 !! wikitext
20192 start
20193 ==a==
20194 ===aa===
20195 ====aaa====
20196 ==b==
20197 ===ba===
20198 ===bb===
20199 ====bba====
20200 ===bc===
20201 ==c==
20202 ===ca===
20203 !! html/php
20204 ===aa===
20205 ====aaa====
20206 !! end
20207
20208 !! test
20209 Section extraction test (section 3)
20210 !! options
20211 section=3
20212 !! wikitext
20213 start
20214 ==a==
20215 ===aa===
20216 ====aaa====
20217 ==b==
20218 ===ba===
20219 ===bb===
20220 ====bba====
20221 ===bc===
20222 ==c==
20223 ===ca===
20224 !! html/php
20225 ====aaa====
20226 !! end
20227
20228 !! test
20229 Section extraction test (section 4)
20230 !! options
20231 section=4
20232 !! wikitext
20233 start
20234 ==a==
20235 ===aa===
20236 ====aaa====
20237 ==b==
20238 ===ba===
20239 ===bb===
20240 ====bba====
20241 ===bc===
20242 ==c==
20243 ===ca===
20244 !! html/php
20245 ==b==
20246 ===ba===
20247 ===bb===
20248 ====bba====
20249 ===bc===
20250 !! end
20251
20252 !! test
20253 Section extraction test (section 5)
20254 !! options
20255 section=5
20256 !! wikitext
20257 start
20258 ==a==
20259 ===aa===
20260 ====aaa====
20261 ==b==
20262 ===ba===
20263 ===bb===
20264 ====bba====
20265 ===bc===
20266 ==c==
20267 ===ca===
20268 !! html/php
20269 ===ba===
20270 !! end
20271
20272 !! test
20273 Section extraction test (section 6)
20274 !! options
20275 section=6
20276 !! wikitext
20277 start
20278 ==a==
20279 ===aa===
20280 ====aaa====
20281 ==b==
20282 ===ba===
20283 ===bb===
20284 ====bba====
20285 ===bc===
20286 ==c==
20287 ===ca===
20288 !! html/php
20289 ===bb===
20290 ====bba====
20291 !! end
20292
20293 !! test
20294 Section extraction test (section 7)
20295 !! options
20296 section=7
20297 !! wikitext
20298 start
20299 ==a==
20300 ===aa===
20301 ====aaa====
20302 ==b==
20303 ===ba===
20304 ===bb===
20305 ====bba====
20306 ===bc===
20307 ==c==
20308 ===ca===
20309 !! html/php
20310 ====bba====
20311 !! end
20312
20313 !! test
20314 Section extraction test (section 8)
20315 !! options
20316 section=8
20317 !! wikitext
20318 start
20319 ==a==
20320 ===aa===
20321 ====aaa====
20322 ==b==
20323 ===ba===
20324 ===bb===
20325 ====bba====
20326 ===bc===
20327 ==c==
20328 ===ca===
20329 !! html/php
20330 ===bc===
20331 !! end
20332
20333 !! test
20334 Section extraction test (section 9)
20335 !! options
20336 section=9
20337 !! wikitext
20338 start
20339 ==a==
20340 ===aa===
20341 ====aaa====
20342 ==b==
20343 ===ba===
20344 ===bb===
20345 ====bba====
20346 ===bc===
20347 ==c==
20348 ===ca===
20349 !! html/php
20350 ==c==
20351 ===ca===
20352 !! end
20353
20354 !! test
20355 Section extraction test (section 10)
20356 !! options
20357 section=10
20358 !! wikitext
20359 start
20360 ==a==
20361 ===aa===
20362 ====aaa====
20363 ==b==
20364 ===ba===
20365 ===bb===
20366 ====bba====
20367 ===bc===
20368 ==c==
20369 ===ca===
20370 !! html/php
20371 ===ca===
20372 !! end
20373
20374 !! test
20375 Section extraction test (nonexistent section 11)
20376 !! options
20377 section=11
20378 !! wikitext
20379 start
20380 ==a==
20381 ===aa===
20382 ====aaa====
20383 ==b==
20384 ===ba===
20385 ===bb===
20386 ====bba====
20387 ===bc===
20388 ==c==
20389 ===ca===
20390 !! html/php
20391 !! end
20392
20393 !! test
20394 Section extraction test with bogus heading (section 1)
20395 !! options
20396 section=1
20397 !! wikitext
20398 ==a==
20399 ==bogus== not a legal section
20400 ==b==
20401 !! html/php
20402 ==a==
20403 ==bogus== not a legal section
20404 !! end
20405
20406 !! test
20407 Section extraction test with bogus heading (section 2)
20408 !! options
20409 section=2
20410 !! wikitext
20411 ==a==
20412 ==bogus== not a legal section
20413 ==b==
20414 !! html/php
20415 ==b==
20416 !! end
20417
20418 !! test
20419 Section extraction test with comment after heading (section 1)
20420 !! options
20421 section=1
20422 !! wikitext
20423 ==a==
20424 ==b== <!-- -->
20425 ==c==
20426 !! html/php
20427 ==a==
20428 !! end
20429
20430 !! test
20431 Section extraction test with comment after heading (section 2)
20432 !! options
20433 section=2
20434 !! wikitext
20435 ==a==
20436 ==b== <!-- -->
20437 ==c==
20438 !! html/php
20439 ==b== <!-- -->
20440 !! end
20441
20442 !! test
20443 Section extraction test with bogus <nowiki> heading (section 1)
20444 !! options
20445 section=1
20446 !! wikitext
20447 ==a==
20448 ==bogus== <nowiki>not a legal section</nowiki>
20449 ==b==
20450 !! html/php
20451 ==a==
20452 ==bogus== <nowiki>not a legal section</nowiki>
20453 !! end
20454
20455 !! test
20456 Section extraction test with bogus <nowiki> heading (section 2)
20457 !! options
20458 section=2
20459 !! wikitext
20460 ==a==
20461 ==bogus== <nowiki>not a legal section</nowiki>
20462 ==b==
20463 !! html/php
20464 ==b==
20465 !! end
20466
20467 # Formerly testing for T4587, now resolved by the use of unmarked sections
20468 # instead of respecting commented sections
20469 !! test
20470 Section extraction prefixed by comment (section 1)
20471 !! options
20472 section=1
20473 !! wikitext
20474 <!-- -->==sec1==
20475 ==sec2==
20476 !! html/php
20477 ==sec2==
20478 !!end
20479
20480 !! test
20481 Section extraction prefixed by comment (section 2)
20482 !! options
20483 section=2
20484 !! wikitext
20485 <!-- -->==sec1==
20486 ==sec2==
20487 !! html/php
20488
20489 !!end
20490
20491 # Formerly testing for T4607, now resolved by the use of unmarked sections
20492 # instead of respecting HTML-style headings
20493 !! test
20494 Section extraction, mixed wiki and html (section 1)
20495 !! options
20496 section=1
20497 !! wikitext
20498 <h2>unmarked</h2>
20499 unmarked
20500 ==1==
20501 one
20502 ==2==
20503 two
20504 !! html/php
20505 ==1==
20506 one
20507 !! end
20508
20509 !! test
20510 Section extraction, mixed wiki and html (section 2)
20511 !! options
20512 section=2
20513 !! wikitext
20514 <h2>unmarked</h2>
20515 unmarked
20516 ==1==
20517 one
20518 ==2==
20519 two
20520 !! html/php
20521 ==2==
20522 two
20523 !! end
20524
20525
20526 # Formerly testing for T5342
20527 !! test
20528 Section extraction, heading surrounded by <noinclude>
20529 !! options
20530 section=1
20531 !! wikitext
20532 <noinclude>==unmarked==</noinclude>
20533 ==marked==
20534 !! html/php
20535 ==marked==
20536 !!end
20537
20538 # Test behavior of T21910
20539 !! test
20540 Sectiion with all-equals
20541 !! options
20542 section=2
20543 !! wikitext
20544 ===
20545 The line above must have a trailing space
20546 === <!--
20547 --> <!-- -->
20548 But just in case it doesn't...
20549 !! html/php
20550 === <!--
20551 --> <!-- -->
20552 But just in case it doesn't...
20553 !! end
20554
20555 !! test
20556 Section replacement test (section 0)
20557 !! options
20558 replace=0,"xxx"
20559 !! wikitext
20560 start
20561 ==a==
20562 ===aa===
20563 ====aaa====
20564 ==b==
20565 ===ba===
20566 ===bb===
20567 ====bba====
20568 ===bc===
20569 ==c==
20570 ===ca===
20571 !! html/php
20572 xxx
20573
20574 ==a==
20575 ===aa===
20576 ====aaa====
20577 ==b==
20578 ===ba===
20579 ===bb===
20580 ====bba====
20581 ===bc===
20582 ==c==
20583 ===ca===
20584 !! end
20585
20586 !! test
20587 Section replacement test (section 1)
20588 !! options
20589 replace=1,"xxx"
20590 !! wikitext
20591 start
20592 ==a==
20593 ===aa===
20594 ====aaa====
20595 ==b==
20596 ===ba===
20597 ===bb===
20598 ====bba====
20599 ===bc===
20600 ==c==
20601 ===ca===
20602 !! html/php
20603 start
20604 xxx
20605
20606 ==b==
20607 ===ba===
20608 ===bb===
20609 ====bba====
20610 ===bc===
20611 ==c==
20612 ===ca===
20613 !! end
20614
20615 !! test
20616 Section replacement test (section 2)
20617 !! options
20618 replace=2,"xxx"
20619 !! wikitext
20620 start
20621 ==a==
20622 ===aa===
20623 ====aaa====
20624 ==b==
20625 ===ba===
20626 ===bb===
20627 ====bba====
20628 ===bc===
20629 ==c==
20630 ===ca===
20631 !! html/php
20632 start
20633 ==a==
20634 xxx
20635
20636 ==b==
20637 ===ba===
20638 ===bb===
20639 ====bba====
20640 ===bc===
20641 ==c==
20642 ===ca===
20643 !! end
20644
20645 !! test
20646 Section replacement test (section 3)
20647 !! options
20648 replace=3,"xxx"
20649 !! wikitext
20650 start
20651 ==a==
20652 ===aa===
20653 ====aaa====
20654 ==b==
20655 ===ba===
20656 ===bb===
20657 ====bba====
20658 ===bc===
20659 ==c==
20660 ===ca===
20661 !! html/php
20662 start
20663 ==a==
20664 ===aa===
20665 xxx
20666
20667 ==b==
20668 ===ba===
20669 ===bb===
20670 ====bba====
20671 ===bc===
20672 ==c==
20673 ===ca===
20674 !! end
20675
20676 !! test
20677 Section replacement test (section 4)
20678 !! options
20679 replace=4,"xxx"
20680 !! wikitext
20681 start
20682 ==a==
20683 ===aa===
20684 ====aaa====
20685 ==b==
20686 ===ba===
20687 ===bb===
20688 ====bba====
20689 ===bc===
20690 ==c==
20691 ===ca===
20692 !! html/php
20693 start
20694 ==a==
20695 ===aa===
20696 ====aaa====
20697 xxx
20698
20699 ==c==
20700 ===ca===
20701 !! end
20702
20703 !! test
20704 Section replacement test (section 5)
20705 !! options
20706 replace=5,"xxx"
20707 !! wikitext
20708 start
20709 ==a==
20710 ===aa===
20711 ====aaa====
20712 ==b==
20713 ===ba===
20714 ===bb===
20715 ====bba====
20716 ===bc===
20717 ==c==
20718 ===ca===
20719 !! html/php
20720 start
20721 ==a==
20722 ===aa===
20723 ====aaa====
20724 ==b==
20725 xxx
20726
20727 ===bb===
20728 ====bba====
20729 ===bc===
20730 ==c==
20731 ===ca===
20732 !! end
20733
20734 !! test
20735 Section replacement test (section 6)
20736 !! options
20737 replace=6,"xxx"
20738 !! wikitext
20739 start
20740 ==a==
20741 ===aa===
20742 ====aaa====
20743 ==b==
20744 ===ba===
20745 ===bb===
20746 ====bba====
20747 ===bc===
20748 ==c==
20749 ===ca===
20750 !! html/php
20751 start
20752 ==a==
20753 ===aa===
20754 ====aaa====
20755 ==b==
20756 ===ba===
20757 xxx
20758
20759 ===bc===
20760 ==c==
20761 ===ca===
20762 !! end
20763
20764 !! test
20765 Section replacement test (section 7)
20766 !! options
20767 replace=7,"xxx"
20768 !! wikitext
20769 start
20770 ==a==
20771 ===aa===
20772 ====aaa====
20773 ==b==
20774 ===ba===
20775 ===bb===
20776 ====bba====
20777 ===bc===
20778 ==c==
20779 ===ca===
20780 !! html/php
20781 start
20782 ==a==
20783 ===aa===
20784 ====aaa====
20785 ==b==
20786 ===ba===
20787 ===bb===
20788 xxx
20789
20790 ===bc===
20791 ==c==
20792 ===ca===
20793 !! end
20794
20795 !! test
20796 Section replacement test (section 8)
20797 !! options
20798 replace=8,"xxx"
20799 !! wikitext
20800 start
20801 ==a==
20802 ===aa===
20803 ====aaa====
20804 ==b==
20805 ===ba===
20806 ===bb===
20807 ====bba====
20808 ===bc===
20809 ==c==
20810 ===ca===
20811 !! html/php
20812 start
20813 ==a==
20814 ===aa===
20815 ====aaa====
20816 ==b==
20817 ===ba===
20818 ===bb===
20819 ====bba====
20820 xxx
20821
20822 ==c==
20823 ===ca===
20824 !!end
20825
20826 !! test
20827 Section replacement test (section 9)
20828 !! options
20829 replace=9,"xxx"
20830 !! wikitext
20831 start
20832 ==a==
20833 ===aa===
20834 ====aaa====
20835 ==b==
20836 ===ba===
20837 ===bb===
20838 ====bba====
20839 ===bc===
20840 ==c==
20841 ===ca===
20842 !! html/php
20843 start
20844 ==a==
20845 ===aa===
20846 ====aaa====
20847 ==b==
20848 ===ba===
20849 ===bb===
20850 ====bba====
20851 ===bc===
20852 xxx
20853 !! end
20854
20855 !! test
20856 Section replacement test (section 10)
20857 !! options
20858 replace=10,"xxx"
20859 !! wikitext
20860 start
20861 ==a==
20862 ===aa===
20863 ====aaa====
20864 ==b==
20865 ===ba===
20866 ===bb===
20867 ====bba====
20868 ===bc===
20869 ==c==
20870 ===ca===
20871 !! html/php
20872 start
20873 ==a==
20874 ===aa===
20875 ====aaa====
20876 ==b==
20877 ===ba===
20878 ===bb===
20879 ====bba====
20880 ===bc===
20881 ==c==
20882 xxx
20883 !! end
20884
20885 !! test
20886 Section replacement test with initial whitespace (T15728)
20887 !! options
20888 replace=2,"xxx"
20889 !! wikitext
20890 Preformatted initial line
20891 ==a==
20892 ===a===
20893 !! html/php
20894 Preformatted initial line
20895 ==a==
20896 xxx
20897 !! end
20898
20899
20900 !! test
20901 Section extraction, heading followed by pre with 20 spaces (T8398)
20902 !! options
20903 section=1
20904 !! wikitext
20905 ==a==
20906 a
20907 !! html/php
20908 ==a==
20909 a
20910 !! end
20911
20912 !! test
20913 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20914 !! options
20915 section=1
20916 !! wikitext
20917 ==a==
20918 a
20919 !! html/php
20920 ==a==
20921 a
20922 !! end
20923
20924
20925 !! test
20926 Section extraction, <pre> around bogus header (T12309)
20927 !! options
20928 section=2
20929 !! wikitext
20930 == Section One ==
20931 <pre>
20932 =======
20933 </pre>
20934
20935 == Section Two ==
20936 stuff
20937 !! html/php
20938 == Section Two ==
20939 stuff
20940 !! end
20941
20942 !! test
20943 Section replacement, <pre> around bogus header (T12309)
20944 !! options
20945 replace=2,"xxx"
20946 !! wikitext
20947 == Section One ==
20948 <pre>
20949 =======
20950 </pre>
20951
20952 == Section Two ==
20953 stuff
20954 !! html/php
20955 == Section One ==
20956 <pre>
20957 =======
20958 </pre>
20959
20960 xxx
20961 !! end
20962
20963 !! test
20964 Handling of &#x0A; in URLs
20965 !! wikitext
20966 *irc://&#x0A;a
20967 !! html/php
20968 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20969
20970 !! html/parsoid
20971 <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>
20972 !! end
20973
20974 !! test
20975 Handling of %0A in URLs
20976 !! wikitext
20977 *irc://%0Aa
20978 !! html/php
20979 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20980
20981 !! html/parsoid
20982 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20983 !! end
20984
20985 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20986 !! test
20987 5 quotes, code coverage +1 line
20988 !! options
20989 parsoid=wt2html
20990 !! wikitext
20991 '''''
20992 !! html/php
20993 !! html/parsoid
20994 <p><b><i></i></b></p>
20995 !! end
20996
20997 # same html as previous, but wikitext adjusted to match parsoid html2wt
20998 # note that wt2html and html2html will put the <i> before the <b>
20999 !! test
21000 5 quotes, code coverage +1 line w/ nowiki (1)
21001 !! options
21002 parsoid=wt2wt,html2wt
21003 !! wikitext
21004 '''''<nowiki/>'''''
21005 !! html/php
21006 <p><i></i>
21007 </p>
21008 !! html/parsoid
21009 <p><b><i></i></b></p>
21010 !! end
21011
21012 # same as previous, just swapping the <i> and <b>
21013 !! test
21014 5 quotes, code coverage +1 line w/ nowiki (2)
21015 !! wikitext
21016 '''''<nowiki/>'''''
21017 !! html/php
21018 <p><i></i>
21019 </p>
21020 !! html/parsoid
21021 <p><i><b></b></i></p>
21022 !! end
21023
21024 !! test
21025 Special:Search page linking.
21026 !! wikitext
21027 {{Special:search}}
21028 !! html
21029 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
21030 </p>
21031 !! end
21032
21033 !! test
21034 {{!}} is a magic word
21035 !! wikitext
21036 {{!}} is a magic word there and {{!}} is still a magic word here
21037 | is not a magic word here but {{!}} is still a magic word here
21038 !! html/php
21039 <p>| is a magic word there and | is still a magic word here
21040 | is not a magic word here but | is still a magic word here
21041 </p>
21042 !! html/parsoid
21043 <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
21044 | 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>
21045 !! end
21046
21047 !! test
21048 Say the magic word
21049 !! options
21050 title=[[Parser test]]
21051 !! wikitext
21052 *{{PAGENAME}}
21053 *{{PAGENAMEE}}
21054 *{{FULLPAGENAME}}
21055 *{{FULLPAGENAMEE}}
21056 *{{BASEPAGENAME}}
21057 *{{BASEPAGENAMEE}}
21058 *{{SUBPAGENAME}}
21059 *{{SUBPAGENAMEE}}
21060 *{{ROOTPAGENAME}}
21061 *{{ROOTPAGENAMEE}}
21062 *{{TALKPAGENAME}}
21063 *{{TALKPAGENAMEE}}
21064 *{{SUBJECTPAGENAME}}
21065 *{{SUBJECTPAGENAMEE}}
21066 *{{NAMESPACEE}}
21067 *{{NAMESPACE}}
21068 *{{NAMESPACENUMBER}}
21069 *{{TALKSPACE}}
21070 *{{TALKSPACEE}}
21071 *{{SUBJECTSPACE}}
21072 *{{SUBJECTSPACEE}}
21073 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
21074 !! html
21075 <ul><li>Parser test</li>
21076 <li>Parser_test</li>
21077 <li>Parser test</li>
21078 <li>Parser_test</li>
21079 <li>Parser test</li>
21080 <li>Parser_test</li>
21081 <li>Parser test</li>
21082 <li>Parser_test</li>
21083 <li>Parser test</li>
21084 <li>Parser_test</li>
21085 <li>Talk:Parser test</li>
21086 <li>Talk:Parser_test</li>
21087 <li>Parser test</li>
21088 <li>Parser_test</li>
21089 <li></li>
21090 <li></li>
21091 <li>0</li>
21092 <li>Talk</li>
21093 <li>Talk</li>
21094 <li></li>
21095 <li></li>
21096 <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>
21097
21098 !! end
21099 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
21100
21101 !! test
21102 Gallery with valid attributes
21103 !! wikitext
21104 <gallery type="123" summary="345">
21105 File:File:Foobar.jpg
21106 </gallery>
21107 !! html/php
21108 <ul class="gallery mw-gallery-traditional" type="123">
21109 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21110 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
21111 <div class="gallerytext">
21112 </div>
21113 </div></li>
21114 </ul>
21115
21116 !! html/parsoid
21117 <ul class="gallery mw-gallery-traditional" type="123" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"type":"123","summary":"345"},"body":{"extsrc":"\nFile:File:Foobar.jpg\n"}}'>
21118 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:File:Foobar.jpg"><img resource="./File:File:Foobar.jpg" src="./Special:FilePath/File:Foobar.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21119 </ul>
21120 !! end
21121
21122 ## Parsoid thinks the "centre" here is a property, not a caption.
21123 !! test
21124 Gallery
21125 !! options
21126 parsoid={
21127 "modes": ["wt2html"],
21128 "nativeGallery": true
21129 }
21130 !! wikitext
21131 <gallery>
21132 image1.png |
21133 image2.gif|||||
21134
21135 image3|
21136 image4 |300px| centre
21137 image5.svg| http://///////
21138 [[x|xx]]]]
21139 * image6
21140 </gallery>
21141 !! html/php
21142 <ul class="gallery mw-gallery-traditional">
21143 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21144 <div class="thumb" style="height: 150px;">Image1.png</div>
21145 <div class="gallerytext">
21146 </div>
21147 </div></li>
21148 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21149 <div class="thumb" style="height: 150px;">Image2.gif</div>
21150 <div class="gallerytext">
21151 </div>
21152 </div></li>
21153 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21154 <div class="thumb" style="height: 150px;">Image3</div>
21155 <div class="gallerytext">
21156 </div>
21157 </div></li>
21158 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21159 <div class="thumb" style="height: 150px;">Image4</div>
21160 <div class="gallerytext">
21161 <pre>centre
21162 </pre>
21163 </div>
21164 </div></li>
21165 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21166 <div class="thumb" style="height: 150px;">Image5.svg</div>
21167 <div class="gallerytext">
21168 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
21169 </p>
21170 </div>
21171 </div></li>
21172 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21173 <div class="thumb" style="height: 150px;">* image6</div>
21174 <div class="gallerytext">
21175 </div>
21176 </div></li>
21177 </ul>
21178
21179 !! html/parsoid
21180 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21181 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image1.png"><img resource="./File:Image1.png" src="./Special:FilePath/Image1.png" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21182 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image2.gif"><img resource="./File:Image2.gif" src="./Special:FilePath/Image2.gif" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21183 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image3"><img resource="./File:Image3" src="./Special:FilePath/Image3" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21184 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image4"><img resource="./File:Image4" src="./Special:FilePath/Image4" height="300" width="300"/></a></figure-inline></div><div class="gallerytext"></div></li>
21185 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image5.svg"><img resource="./File:Image5.svg" src="./Special:FilePath/Image5.svg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"> <a rel="mw:ExtLink" class="external free" href="http://///////">http://///////</a></div></li>
21186 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:*_image6"><img resource="./File:*_image6" src="./Special:FilePath/*_image6" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21187 </ul>
21188 !! end
21189
21190 !! test
21191 Gallery (with options, html)
21192 !! options
21193 parsoid={
21194 "modes": ["wt2html", "html2html"],
21195 "nativeGallery": true
21196 }
21197 !! wikitext
21198 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
21199 File:Nonexistent.jpg|caption
21200 File:Nonexistent.jpg
21201 image:foobar.jpg|some '''caption''' [[Main Page]]
21202 image:foobar.jpg
21203 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
21204 </gallery>
21205 !! html/php
21206 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
21207 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
21208 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21209 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21210 <div class="gallerytext">
21211 <p>caption
21212 </p>
21213 </div>
21214 </div></li>
21215 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21216 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21217 <div class="gallerytext">
21218 </div>
21219 </div></li>
21220 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21221 <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" 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>
21222 <div class="gallerytext">
21223 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21224 </p>
21225 </div>
21226 </div></li>
21227 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21228 <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" 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>
21229 <div class="gallerytext">
21230 </div>
21231 </div></li>
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="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" 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 <p>blabla.
21236 </p>
21237 </div>
21238 </div></li>
21239 </ul>
21240
21241 !! html/parsoid
21242 <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":{}}'>
21243 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
21244 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
21245 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
21246 <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>
21247 <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>
21248 <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>
21249 </ul>
21250 !! end
21251
21252 !! test
21253 Gallery (with options, extsrc)
21254 !! options
21255 parsoid={
21256 "nativeGallery": false
21257 }
21258 !! wikitext
21259 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
21260 File:Nonexistent.jpg|caption
21261 File:Nonexistent.jpg
21262 image:foobar.jpg|some '''caption''' [[Main Page]]
21263 image:foobar.jpg
21264 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
21265 </gallery>
21266 !! html/php
21267 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
21268 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
21269 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21270 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21271 <div class="gallerytext">
21272 <p>caption
21273 </p>
21274 </div>
21275 </div></li>
21276 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21277 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21278 <div class="gallerytext">
21279 </div>
21280 </div></li>
21281 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21282 <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" 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>
21283 <div class="gallerytext">
21284 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21285 </p>
21286 </div>
21287 </div></li>
21288 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21289 <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" 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>
21290 <div class="gallerytext">
21291 </div>
21292 </div></li>
21293 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21294 <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" 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>
21295 <div class="gallerytext">
21296 <p>blabla.
21297 </p>
21298 </div>
21299 </div></li>
21300 </ul>
21301
21302 !! html/parsoid
21303 <ul class="gallery mw-gallery-traditional" style="max-width: 226px; _width: 226px;" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"widths":"70px","heights":"40px","perrow":"2","caption":"Foo [[Main Page]]"},"body":{"extsrc":"\nFile:Nonexistent.jpg|caption\nFile:Nonexistent.jpg\nimage:foobar.jpg|some &#39;&#39;&#39;caption&#39;&#39;&#39; [[Main Page]]\nimage:foobar.jpg\nimage:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.\n"}}'>
21304 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
21305 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
21306 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
21307 <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>
21308 <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>
21309 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img 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>
21310 </ul>
21311 !! end
21312
21313 !! test
21314 Gallery (without px units)
21315 !! wikitext
21316 <gallery widths="70" heights="40">
21317 File:Foobar.jpg
21318 </gallery>
21319 !! html/php
21320 <ul class="gallery mw-gallery-traditional">
21321 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21322 <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" 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>
21323 <div class="gallerytext">
21324 </div>
21325 </div></li>
21326 </ul>
21327
21328 !! html/parsoid
21329 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70","heights":"40"},"body":{"extsrc":"\nFile:Foobar.jpg\n"}}'>
21330 <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>
21331 </ul>
21332 !! end
21333
21334 !! test
21335 Gallery (with invalid units)
21336 !! wikitext
21337 <gallery widths="70em" heights="40em">
21338 File:Foobar.jpg
21339 </gallery>
21340 !! html/php
21341 <ul class="gallery mw-gallery-traditional">
21342 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21343 <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" 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>
21344 <div class="gallerytext">
21345 </div>
21346 </div></li>
21347 </ul>
21348
21349 !! html/parsoid
21350 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70em","heights":"40em"},"body":{"extsrc":"\nFile:Foobar.jpg\n"}}'>
21351 <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>
21352 </ul>
21353 !! end
21354
21355 !! test
21356 Gallery with link that has fragment
21357 !! options
21358 parsoid={
21359 "modes": ["wt2html", "html2html"],
21360 "nativeGallery": true
21361 }
21362 !! wikitext
21363 <gallery>
21364 image:foobar.jpg|link=Main_Page
21365 image:foobar.jpg|link=Main_Page#section
21366 image:foobar.jpg|link=Main Page#section|caption
21367 </gallery>
21368 !! html/php
21369 <ul class="gallery mw-gallery-traditional">
21370 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21371 <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" 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>
21372 <div class="gallerytext">
21373 </div>
21374 </div></li>
21375 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21376 <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" 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>
21377 <div class="gallerytext">
21378 </div>
21379 </div></li>
21380 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21381 <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" 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>
21382 <div class="gallerytext">
21383 <p>caption
21384 </p>
21385 </div>
21386 </div></li>
21387 </ul>
21388
21389 !! html/parsoid
21390 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21391 <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>
21392 <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>
21393 <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>
21394 </ul>
21395 !! end
21396
21397 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
21398 !! test
21399 Gallery with template inside caption
21400 !! options
21401 parsoid={
21402 "nativeGallery": true
21403 }
21404 !! wikitext
21405 <gallery caption="{{echo|hi}}">
21406 File:Foobar.jpg|{{echo|ho}}
21407 </gallery>
21408 !! html/php
21409 <ul class="gallery mw-gallery-traditional">
21410 <li class='gallerycaption'>{{echo|hi}}</li>
21411 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21412 <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" 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>
21413 <div class="gallerytext">
21414 <p>ho
21415 </p>
21416 </div>
21417 </div></li>
21418 </ul>
21419
21420 !! html/parsoid
21421 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21422 <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>
21423 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><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>
21424 </ul>
21425 !! end
21426
21427 !! test
21428 Gallery with wikitext inside caption
21429 !! options
21430 parsoid={
21431 "nativeGallery": true
21432 }
21433 !! wikitext
21434 <gallery>
21435 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
21436 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
21437 </gallery>
21438 !! html/php
21439 <ul class="gallery mw-gallery-traditional">
21440 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21441 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21442 <div class="gallerytext">
21443 <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" 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>
21444 </p>
21445 </div>
21446 </div></li>
21447 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21448 <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" 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>
21449 <div class="gallerytext">
21450 <p>This is a test template
21451 </p>
21452 </div>
21453 </div></li>
21454 </ul>
21455
21456 !! html/parsoid
21457 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21458 <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>
21459 <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>
21460 </ul>
21461 !! end
21462
21463 !! test
21464 Gallery (with showfilename option)
21465 !! options
21466 parsoid={
21467 "nativeGallery": true
21468 }
21469 !! wikitext
21470 <gallery showfilename="">
21471 File:Nonexistent.jpg|caption
21472 File:Nonexistent.jpg
21473 File:Foobar.jpg|some '''caption''' [[Main Page]]
21474 File:Foobar.jpg
21475 </gallery>
21476 !! html/php
21477 <ul class="gallery mw-gallery-traditional">
21478 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21479 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21480 <div class="gallerytext">
21481 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21482 caption
21483 </p>
21484 </div>
21485 </div></li>
21486 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21487 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21488 <div class="gallerytext">
21489 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21490 </p>
21491 </div>
21492 </div></li>
21493 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21494 <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" 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>
21495 <div class="gallerytext">
21496 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21497 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21498 </p>
21499 </div>
21500 </div></li>
21501 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21502 <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" 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>
21503 <div class="gallerytext">
21504 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21505 </p>
21506 </div>
21507 </div></li>
21508 </ul>
21509
21510 !! html/parsoid
21511 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
21512 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a>caption</div></li>
21513 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a></div></li>
21514 <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>
21515 <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>
21516 </ul>
21517 !! end
21518
21519 ## Should Parsoid be preserving these variations? See T151367
21520 !! test
21521 Gallery (with namespace-less filenames)
21522 !! options
21523 parsoid={
21524 "modes": ["wt2html", "html2html"],
21525 "nativeGallery": true
21526 }
21527 !! wikitext
21528 <gallery>
21529 File:Nonexistent.jpg
21530 Nonexistent.jpg
21531 image:foobar.jpg
21532 foobar.jpg
21533 </gallery>
21534 !! html/php
21535 <ul class="gallery mw-gallery-traditional">
21536 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21537 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21538 <div class="gallerytext">
21539 </div>
21540 </div></li>
21541 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21542 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21543 <div class="gallerytext">
21544 </div>
21545 </div></li>
21546 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21547 <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" 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>
21548 <div class="gallerytext">
21549 </div>
21550 </div></li>
21551 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21552 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21553 <div class="gallerytext">
21554 </div>
21555 </div></li>
21556 </ul>
21557
21558 !! html/parsoid
21559 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21560 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21561 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21562 <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>
21563 <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>
21564 </ul>
21565 !! end
21566
21567 !! test
21568 Gallery override link with wikilink (T36852)
21569 !! options
21570 parsoid={
21571 "nativeGallery": true
21572 }
21573 !! wikitext
21574 <gallery>
21575 File:Foobar.jpg|alt=galleryalt|link=Wikilink
21576 </gallery>
21577 !! html/php
21578 <ul class="gallery mw-gallery-traditional">
21579 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21580 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Wikilink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21581 <div class="gallerytext">
21582 </div>
21583 </div></li>
21584 </ul>
21585
21586 !! html/parsoid
21587 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21588 <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>
21589 </ul>
21590 !! end
21591
21592 !! test
21593 Gallery override link with absolute external link (T36852)
21594 !! options
21595 parsoid={
21596 "nativeGallery": true
21597 }
21598 !! wikitext
21599 <gallery>
21600 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
21601 </gallery>
21602 !! html/php
21603 <ul class="gallery mw-gallery-traditional">
21604 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21605 <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" 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>
21606 <div class="gallerytext">
21607 </div>
21608 </div></li>
21609 </ul>
21610
21611 !! html/parsoid
21612 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21613 <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>
21614 </ul>
21615 !! end
21616
21617 !! test
21618 Gallery override link with absolute external link with LanguageConverter
21619 !! options
21620 language=zh
21621 !! wikitext
21622 <gallery>
21623 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21624 </gallery>
21625 !! html/php
21626 <ul class="gallery mw-gallery-traditional">
21627 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21628 <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" 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>
21629 <div class="gallerytext">
21630 <p>caption
21631 </p>
21632 </div>
21633 </div></li>
21634 </ul>
21635
21636 !! html/parsoid
21637 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org\n"}}'>
21638 <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>
21639 </ul>
21640 !! end
21641
21642 !! test
21643 Gallery override link with malicious javascript (T36852)
21644 !! options
21645 parsoid={
21646 "modes": ["wt2html", "html2html"],
21647 "nativeGallery": true
21648 }
21649 !! wikitext
21650 <gallery>
21651 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21652 </gallery>
21653 !! html/php
21654 <ul class="gallery mw-gallery-traditional">
21655 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21656 <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" 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>
21657 <div class="gallerytext">
21658 </div>
21659 </div></li>
21660 </ul>
21661
21662 !! html/parsoid
21663 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21664 <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>
21665 </ul>
21666 !! end
21667
21668 # Note that parsoid uses the invalid link as a caption, PHP does not.
21669 !! test
21670 Gallery with invalid title as link (T45964)
21671 !! options
21672 parsoid={
21673 "modes": ["wt2html", "html2html"],
21674 "nativeGallery": true
21675 }
21676 !! wikitext
21677 <gallery>
21678 File:Foobar.jpg|link=<
21679 </gallery>
21680 !! html/php
21681 <ul class="gallery mw-gallery-traditional">
21682 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21683 <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" 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>
21684 <div class="gallerytext">
21685 </div>
21686 </div></li>
21687 </ul>
21688
21689 !! html/parsoid
21690 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21691 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">link=&lt;</div></li>
21692 </ul>
21693 !! end
21694
21695 !! test
21696 Serialize gallery without attrs in data-mw
21697 !! options
21698 parsoid={
21699 "modes": ["html2wt"],
21700 "nativeGallery": true
21701 }
21702 !! html/parsoid
21703 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
21704 <li class="gallerycaption">123</li>
21705 <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>
21706 </ul>
21707 !! wikitext
21708 <gallery caption="123">
21709 File:Test.png
21710 </gallery>
21711 !! end
21712
21713 !! test
21714 Gallery with class and style attributes
21715 !! options
21716 parsoid={
21717 "nativeGallery": true
21718 }
21719 !! wikitext
21720 <gallery class="center" style="text-align: center;">
21721 File:Foobar.jpg
21722 </gallery>
21723 !! html/php
21724 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
21725 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21726 <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" 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>
21727 <div class="gallerytext">
21728 </div>
21729 </div></li>
21730 </ul>
21731
21732 !! html/parsoid
21733 <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":{}}'>
21734 <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>
21735 </ul>
21736 !! end
21737
21738 !! test
21739 Gallery in slideshow mode
21740 !! options
21741 parsoid={
21742 "nativeGallery": true
21743 }
21744 !! wikitext
21745 <gallery mode="slideshow" showthumbnails="">
21746 File:Foobar.jpg
21747 </gallery>
21748 !! html/php
21749 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
21750 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21751 <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" 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>
21752 <div class="gallerytext">
21753 </div>
21754 </div></li>
21755 </ul>
21756
21757 !! html/parsoid
21758 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
21759 <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>
21760 </ul>
21761 !! end
21762
21763 !! test
21764 Serialize gallery image captions on a line
21765 !! options
21766 parsoid={
21767 "modes": ["html2wt"],
21768 "nativeGallery": true
21769 }
21770 !! html/parsoid
21771 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21772 <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>
21773 <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>
21774 </ul>
21775 !! wikitext
21776 <gallery>
21777 File:Foobar.jpg| hi ho
21778 File:Foobar.jpg|hi<br />ho
21779 </gallery>
21780 !! end
21781
21782 !! test
21783 HTML Hex character encoding (spells the word "JavaScript")
21784 !! options
21785 parsoid=wt2html,wt2wt,html2html
21786 !! wikitext
21787 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
21788 !! html/php
21789 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
21790 </p>
21791 !! html/parsoid
21792 <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>
21793 !! end
21794
21795 !! test
21796 HTML Hex character encoding bogus encoding (T28437 regression check)
21797 !! wikitext
21798 &#xsee;&#XSEE;
21799 !! html
21800 <p>&amp;#xsee;&amp;#XSEE;
21801 </p>
21802 !! end
21803
21804 !! test
21805 HTML Hex character encoding mixed case
21806 !! options
21807 parsoid=wt2html,wt2wt,html2html
21808 !! wikitext
21809 &#xEE;&#Xee;
21810 !! html/php
21811 <p>&#xee;&#xee;
21812 </p>
21813 !! html/parsoid
21814 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
21815 !! end
21816
21817 # See: https://www.w3.org/TR/html5/syntax.html#character-references
21818 # Note that U+000C (form feed) is not a valid XML character, so
21819 # it is banned even though allowed in HTML5.
21820 !! test
21821 Illegal character references (T106578)
21822 !! wikitext
21823 ; Null: &#00;
21824 ; FF: &#xC;
21825 ; CR: &#xD;
21826 ; Control (low): &#8;
21827 ; Control (high): &#x7F; &#x9F;
21828 ; Surrogate: &#xD83D;&#xDCA9;
21829 ; This is an okay astral character: &#x1F4A9;
21830 !! html+tidy
21831 <dl><dt>Null</dt>
21832 <dd>&amp;#00;</dd>
21833 <dt>FF</dt>
21834 <dd>&amp;#xC;</dd>
21835 <dt>CR</dt>
21836 <dd>&amp;#xD;</dd>
21837 <dt>Control (low)</dt>
21838 <dd>&amp;#8;</dd>
21839 <dt>Control (high)</dt>
21840 <dd>&amp;#x7F; &amp;#x9F;</dd>
21841 <dt>Surrogate</dt>
21842 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
21843 <dt>This is an okay astral character</dt>
21844 <dd>&#x1f4a9;</dd></dl>
21845 !! end
21846
21847 !! test
21848 __FORCETOC__ override
21849 !! wikitext
21850 __NEWSECTIONLINK__
21851 __FORCETOC__
21852 !! html/php
21853 <p><br />
21854 </p>
21855 !! end
21856
21857 !! test
21858 ISBN code coverage
21859 !! wikitext
21860 ISBN 978-0-1234-56&#x20;789
21861 !! html/php
21862 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21863 </p>
21864 !! html/parsoid
21865 <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>
21866 !! end
21867
21868 !! test
21869 ISBN followed by 5 spaces
21870 !! wikitext
21871 ISBN
21872 !! html
21873 <p>ISBN
21874 </p>
21875 !! end
21876
21877 !! test
21878 Double ISBN
21879 !! wikitext
21880 ISBN ISBN 1234567890
21881 !! html/php
21882 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21883 </p>
21884 !! html/parsoid
21885 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21886 !! end
21887
21888 # Uppercase X and lowercase x as well
21889 !! test
21890 ISBN with an X
21891 !! wikitext
21892 ISBN 3-462-04561-X
21893 ISBN 3-462-04561-x
21894 ISBN 080442957X
21895 ISBN 080442957x
21896 ISBN 978080442957X
21897 ISBN 978080442957x
21898 !! html/php
21899 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21900 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21901 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21902 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21903 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21904 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21905 </p>
21906 !! html/parsoid
21907 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21908 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21909 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21910 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21911 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21912 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21913 !! end
21914
21915 !! test
21916 ISBN with empty prefix (parsoid test)
21917 !! wikitext
21918 ISBN 1234567890
21919 !! html/php
21920 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21921 </p>
21922 !! html/parsoid
21923 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21924 !! end
21925
21926 !! test
21927 T24905: <abbr> followed by ISBN followed by </a>
21928 !! wikitext
21929 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21930 !! html/php
21931 <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>
21932 </p>
21933 !! html/parsoid
21934 <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>
21935 !! end
21936
21937 !! test
21938 Double RFC
21939 !! wikitext
21940 RFC RFC 1234
21941 !! html/php
21942 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21943 </p>
21944 !! html/parsoid
21945 <p>RFC <a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
21946 !! end
21947
21948 !! test
21949 Double RFC with a wiki link
21950 !! wikitext
21951 RFC [[RFC 1234]]
21952 !! html/php
21953 <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>
21954 </p>
21955 !! html/parsoid
21956 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234" title="RFC 1234">RFC 1234</a></p>
21957 !! end
21958
21959 !! test
21960 RFC code coverage
21961 !! wikitext
21962 RFC 983&#x20;987
21963 !! html/php
21964 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21965 </p>
21966 !! html/parsoid
21967 <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>
21968 !! end
21969
21970 !! test
21971 Centre-aligned image
21972 !! wikitext
21973 [[Image:foobar.jpg|centre]]
21974 !! html/php
21975 <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" width="1941" height="220" /></a></div></div>
21976
21977 !! html/parsoid
21978 <figure class="mw-default-size mw-halign-center" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"center","ak":"centre"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
21979 !! end
21980
21981 !! test
21982 None-aligned image
21983 !! wikitext
21984 [[Image:foobar.jpg|none]]
21985 !! html/php
21986 <div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
21987
21988 !! html/parsoid
21989 <figure class="mw-default-size mw-halign-none" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
21990 !! end
21991
21992 !! test
21993 Width + Height sized image (using px) (height is ignored)
21994 !! wikitext
21995 [[Image:foobar.jpg|640x480px]]
21996 !! html/php
21997 <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" 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>
21998 </p>
21999 !! html/parsoid
22000 <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>
22001 !! end
22002
22003 !! test
22004 Width-sized image (using px, no following whitespace)
22005 !! wikitext
22006 [[Image:foobar.jpg|640px]]
22007 !! html/php
22008 <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" 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>
22009 </p>
22010 !! html/parsoid
22011 <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>
22012 !! end
22013
22014 !! test
22015 Width-sized image (using px, with following whitespace - test regression from r39467)
22016 !! wikitext
22017 [[Image:foobar.jpg|640px ]]
22018 !! html/php
22019 <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" 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>
22020 </p>
22021 !! html/parsoid
22022 <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>
22023 !!end
22024
22025 !! test
22026 Width-sized image (using px, with preceding whitespace - test regression from r39467)
22027 !! wikitext
22028 [[Image:foobar.jpg| 640px]]
22029 !! html/php
22030 <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" 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>
22031 </p>
22032 !! html/parsoid
22033 <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>
22034 !! end
22035
22036 !! test
22037 Image with page parameter
22038 !! options
22039 djvu
22040 !! wikitext
22041 [[File:LoremIpsum.djvu|page=2]]
22042 !! html/php
22043 <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" 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>
22044 </p>
22045 !! html/parsoid
22046 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"page","ak":"page=2"}]}' data-mw='{"page":"2"}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{"href":"File:LoremIpsum.djvu"}}'><img resource="./File:LoremIpsum.djvu" src="//example.com/images/5/5f/LoremIpsum.djvu" data-file-width="2480" data-file-height="3508" data-file-type="bitmap" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></figure-inline></p>
22047 !! end
22048
22049 !! test
22050 Another italics / bold test
22051 !! wikitext
22052 ''' ''x'
22053 !! html
22054 <pre>'<i> </i>x'
22055 </pre>
22056 !!end
22057
22058 # FIXME: The php output seems broken. It's interleaving some open/close tags.
22059 !! test
22060 dt/dd/dl test
22061 !! wikitext
22062 :;;;::
22063 !! html/php
22064 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
22065
22066 !! html/parsoid
22067 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
22068
22069 !!end
22070
22071 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
22072 !! test
22073 Images with the "|" character in the comment
22074 !! wikitext
22075 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
22076 !! html/php
22077 <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" 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>
22078
22079 !! html/parsoid
22080 <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>
22081 !! end
22082
22083 !! test
22084 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
22085 !! wikitext
22086 <html><script>alert(1);</script></html>
22087 !! html
22088 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
22089 </p>
22090 !! end
22091
22092 !! test
22093 HTML with raw HTML ($wgRawHtml==true)
22094 !! options
22095 wgRawHtml=1
22096 !! wikitext
22097 <html><script>alert(1);</script></html>
22098 !! html/php
22099 <p><script>alert(1);</script>
22100 </p>
22101 !! end
22102
22103 !! test
22104 Parents of subpages, one level up
22105 !! options
22106 subpage title=[[Subpage test/L1/L2/L3]]
22107 !! wikitext
22108 [[../|L2]]
22109 !! html
22110 <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>
22111 </p>
22112 !! end
22113
22114
22115 !! test
22116 Parents of subpages, one level up, not named
22117 !! options
22118 subpage title=[[Subpage test/L1/L2/L3]]
22119 !! wikitext
22120 [[../]]
22121 !! html
22122 <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>
22123 </p>
22124 !! end
22125
22126
22127
22128 !! test
22129 Parents of subpages, two levels up
22130 !! options
22131 subpage title=[[Subpage test/L1/L2/L3]]
22132 !! wikitext
22133 [[../../|L1]]2
22134
22135 [[../../|L1]]l
22136 !! html
22137 <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
22138 </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>
22139 </p>
22140 !! end
22141
22142 !! test
22143 Parents of subpages, two levels up, without trailing slash or name.
22144 !! options
22145 subpage title=[[Subpage test/L1/L2/L3]]
22146 !! wikitext
22147 [[../..]]
22148 !! html
22149 <p>[[../..]]
22150 </p>
22151 !! end
22152
22153 !! test
22154 Parents of subpages, two levels up, with lots of extra trailing slashes.
22155 !! options
22156 subpage title=[[Subpage test/L1/L2/L3]]
22157 !! wikitext
22158 [[../../////]]
22159 !! html
22160 <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>
22161 </p>
22162 !! end
22163
22164 !! article
22165 Subpage test/L1/L2/L3Sibling
22166 !! text
22167 Sibling article
22168 !! endarticle
22169
22170 !! test
22171 Transclusion of a sibling page (one level up)
22172 !! options
22173 subpage title=[[Subpage test/L1/L2/L3]]
22174 !! wikitext
22175 {{../L3Sibling}}
22176 !! html
22177 <p>Sibling article
22178 </p>
22179 !! end
22180
22181 !! test
22182 Transclusion of a child page
22183 !! options
22184 subpage title=[[Subpage test/L1/L2]]
22185 !! wikitext
22186 {{/L3Sibling}}
22187 !! html
22188 <p>Sibling article
22189 </p>
22190 !! end
22191
22192 # This is wt2html only in Parsoid because we add <nowiki>
22193 # because of {{..}} and we don't expect to fix that to
22194 # eliminate the nowikis selective for {{..}} markup.
22195 !! test
22196 Non-transclusion because of too many up levels
22197 !! options
22198 subpage title=[[Subpage test/L1/L2/L3]]
22199 parsoid=wt2html
22200 !! wikitext
22201 {{../../../../More than parent}}
22202 !! html/php
22203 <p>{{../../../../More than parent}}
22204 </p>
22205 !! html/parsoid
22206 <p>{{../../../../More than parent}}</p>
22207 !! end
22208
22209 !! test
22210 Definition list code coverage
22211 !! wikitext
22212 ;title :def
22213 ;title :def
22214 ;title:def
22215 !! html/php
22216 <dl><dt>title</dt>
22217 <dd>def</dd>
22218 <dt>title</dt>
22219 <dd>def</dd>
22220 <dt>title</dt>
22221 <dd>def</dd></dl>
22222
22223 !! html/parsoid
22224 <dl><dt>title </dt><dd>def</dd>
22225 <dt>title </dt><dd>def</dd>
22226 <dt>title</dt><dd>def</dd></dl>
22227 !! end
22228
22229 !! test
22230 Don't fall for the self-closing div
22231 !! wikitext
22232 <div>hello world</div/>
22233 !! html
22234 <div>hello world</div>
22235
22236 !! end
22237
22238 !! test
22239 MSGNW magic word
22240 !! wikitext
22241 {{MSGNW:msg}}
22242 !! html/php
22243 <p>&#91;&#91;:Template:Msg&#93;&#93;
22244 </p>
22245 !! end
22246
22247 !! test
22248 RAW magic word
22249 !! wikitext
22250 {{RAW:QUERTY}}
22251 !! html
22252 <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>
22253 </p>
22254 !! end
22255
22256 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
22257 !! test
22258 Always escape literal '>' in output, not just after '<'
22259 !! wikitext
22260 ><>
22261 !! html
22262 <p>&gt;&lt;&gt;
22263 </p>
22264 !! end
22265
22266 !! test
22267 Template caching
22268 !! wikitext
22269 {{Test}}
22270 {{Test}}
22271 !! html
22272 <p>This is a test template
22273 This is a test template
22274 </p>
22275 !! end
22276
22277
22278 !! article
22279 MediaWiki:Fake
22280 !! text
22281 ==header==
22282 !! endarticle
22283
22284 !! test
22285 Inclusion of !userCanEdit() content
22286 !! wikitext
22287 {{MediaWiki:Fake}}
22288 !! html
22289 <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>
22290
22291 !! end
22292
22293
22294 !! test
22295 Out-of-order TOC heading levels
22296 !! wikitext
22297 ==2==
22298 ======6======
22299 ===3===
22300 =1=
22301 =====5=====
22302 ==2==
22303 !! html
22304 <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>
22305 <ul>
22306 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
22307 <ul>
22308 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
22309 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
22310 </ul>
22311 </li>
22312 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
22313 <ul>
22314 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
22315 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
22316 </ul>
22317 </li>
22318 </ul>
22319 </div>
22320
22321 <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>
22322 <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>
22323 <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>
22324 <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>
22325 <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>
22326 <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>
22327
22328 !! end
22329
22330
22331 !! test
22332 ISBN with a dummy number
22333 !! wikitext
22334 ISBN ---
22335 !! html
22336 <p>ISBN ---
22337 </p>
22338 !! end
22339
22340
22341 !! test
22342 ISBN with space-delimited number
22343 !! wikitext
22344 ISBN 92 9017 032 8
22345 !! html/php
22346 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
22347 </p>
22348 !! html/parsoid
22349 <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>
22350 !! end
22351
22352
22353 !! test
22354 ISBN with multiple spaces, no number
22355 !! wikitext
22356 ISBN foo
22357 !! html
22358 <p>ISBN foo
22359 </p>
22360 !! end
22361
22362
22363 !! test
22364 ISBN length
22365 !! wikitext
22366 ISBN 123456789
22367
22368 ISBN 1234567890
22369
22370 ISBN 12345678901
22371 !! html/php
22372 <p>ISBN 123456789
22373 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22374 </p><p>ISBN 12345678901
22375 </p>
22376 !! html/parsoid
22377 <p>ISBN 123456789</p>
22378
22379 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
22380
22381 <p>ISBN 12345678901</p>
22382 !! end
22383
22384
22385 !! test
22386 ISBN with trailing year (T9110)
22387 !! wikitext
22388 ISBN 1-234-56789-0 - 2006
22389
22390 ISBN 1 234 56789 0 - 2006
22391 !! html/php
22392 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
22393 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
22394 </p>
22395 !! html/parsoid
22396 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
22397
22398 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
22399 !! end
22400
22401
22402 !! test
22403 anchorencode
22404 !! config
22405 wgFragmentMode=[ 'html5', 'legacy' ]
22406 !! wikitext
22407 {{anchorencode:foo bar©#%n}}
22408 !! html/php
22409 <p>foo_bar©#%n
22410 </p>
22411 !! html/parsoid
22412 <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>
22413 !! end
22414
22415 !! test
22416 anchorencode (legacy)
22417 !! config
22418 wgFragmentMode=[ 'legacy' ]
22419 !! wikitext
22420 {{anchorencode:foo bar©#%n}}
22421 !! html/php
22422 <p>foo_bar.C2.A9.23.25n
22423 </p>
22424 !! end
22425
22426 !! test
22427 anchorencode trims spaces
22428 !! config
22429 wgFragmentMode=[ 'html5', 'legacy' ]
22430 !! wikitext
22431 {{anchorencode: __pretty__please__}}
22432 !! html/php
22433 <p>pretty_please
22434 </p>
22435 !! html/parsoid
22436 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
22437 !! end
22438
22439 !! test
22440 anchorencode deals with links
22441 !! config
22442 wgFragmentMode=[ 'html5', 'legacy' ]
22443 !! wikitext
22444 {{anchorencode: [[hello|world]] [[hi]]}}
22445 !! html/php
22446 <p>world_hi
22447 </p>
22448 !! html/parsoid
22449 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
22450 !! end
22451
22452 !! test
22453 anchorencode deals with templates
22454 !! config
22455 wgFragmentMode=[ 'html5', 'legacy' ]
22456 !! wikitext
22457 {{anchorencode: {{Foo}} x}}
22458 !! html/php
22459 <p>FOO_x
22460 </p>
22461 !! html/parsoid
22462 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
22463 !! end
22464
22465 !! test
22466 anchorencode encodes like the TOC generator: (T20431)
22467 !! config
22468 wgFragmentMode=[ 'html5', 'legacy' ]
22469 !! wikitext
22470 ===_ +:.3A%3A _ &&amp;]] x===
22471 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
22472 __NOEDITSECTION__
22473 !! html/php
22474 <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>
22475 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
22476 </p>
22477 !! html/parsoid
22478 <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>
22479 <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>
22480 <meta property="mw:PageProp/noeditsection"/>
22481 !! end
22482
22483 !! test
22484 anchorencode encodes like the TOC generator: (T20431) (legacy)
22485 !! config
22486 wgFragmentMode=[ 'legacy' ]
22487 !! wikitext
22488 ===_ +:.3A%3A&&amp;]]===
22489 {{anchorencode: _ +:.3A%3A&&amp;]] }}
22490 __NOEDITSECTION__
22491 !! html/php
22492 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
22493 <p>.2B:.3A.253A.26.26.5D.5D
22494 </p>
22495 !! end
22496
22497 !! test
22498 T8200: blockquotes and paragraph formatting
22499 !! wikitext
22500 <blockquote>
22501 foo
22502 </blockquote>
22503
22504 bar
22505
22506 baz
22507 !! html
22508 <blockquote>
22509 <p>foo
22510 </p>
22511 </blockquote>
22512 <p>bar
22513 </p>
22514 <pre>baz
22515 </pre>
22516 !! end
22517
22518 !! test
22519 T10293: Use of center tag ruins paragraph formatting
22520 !! wikitext
22521 <center>
22522 foo
22523 </center>
22524
22525 bar
22526
22527 baz
22528 !! html
22529 <center>
22530 <p>foo
22531 </p>
22532 </center>
22533 <p>bar
22534 </p>
22535 <pre>baz
22536 </pre>
22537 !! end
22538
22539 !!test
22540 Parsing of overlapping (improperly nested) inline html tags
22541 !! wikitext
22542 <span><s>x</span></s>
22543 !! html/php
22544 <p><span><s>x&lt;/span&gt;</s></span>
22545 </p>
22546 !! html/parsoid
22547 <p><span><s>x</s></span>
22548 </p>
22549 !!end
22550
22551 ###
22552 ### Language variants related tests
22553 ###
22554
22555 # Parsoid does not mark self-links.
22556 # Parsoid does not convert links; PHP will do any necessary redirects.
22557
22558 !! test
22559 Self-link in language variants
22560 !! options
22561 title=[[Dunav]] language=sr
22562 !! wikitext
22563 Both [[Dunav]] and [[Дунав]] are names for this river.
22564 !! html/php
22565 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
22566 </p>
22567 !! html/parsoid
22568 <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>
22569 !! end
22570
22571 !! article
22572 Дуна
22573 !! text
22574 content
22575 !! endarticle
22576
22577 !! test
22578 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
22579 !! options
22580 title=[[Duna]] language=sr
22581 !! wikitext
22582 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
22583 !! html/php
22584 <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.
22585 </p>
22586 !! html/parsoid
22587 <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>
22588 !! end
22589
22590 !! test
22591 Link to a section of a variant of this title shouldn't be parsed as self-link
22592 !! options
22593 title=[[Duna]] language=sr
22594 !! wikitext
22595 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
22596 !! html/php
22597 <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.
22598 </p>
22599 !! html/parsoid
22600 <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>
22601 !! end
22602
22603 !! test
22604 Link to pages in language variants
22605 !! options
22606 language=sr
22607 !! wikitext
22608 Main Page can be written as [[Маин Паге]]
22609 !! html/php
22610 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
22611 </p>
22612 !! html/parsoid
22613 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
22614 !! end
22615
22616
22617 !! test
22618 Multiple links to pages in language variants
22619 !! options
22620 language=sr
22621 !! wikitext
22622 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
22623 !! html/php
22624 <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>.
22625 </p>
22626 !! html/parsoid
22627 <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>
22628 !! end
22629
22630
22631 !! test
22632 Simple template in language variants
22633 !! options
22634 language=sr
22635 !! wikitext
22636 {{тест}}
22637 !! html/php
22638 <p>This is a test template
22639 </p>
22640 !! end
22641
22642
22643 !! test
22644 Template with explicit namespace in language variants
22645 !! options
22646 language=sr
22647 !! wikitext
22648 {{Template:тест}}
22649 !! html/php
22650 <p>This is a test template
22651 </p>
22652 !! end
22653
22654
22655 !! test
22656 Basic test for template parameter in language variants
22657 !! options
22658 language=sr
22659 !! wikitext
22660 {{парамтест|param=foo}}
22661 !! html/php
22662 <p>This is a test template with parameter foo
22663 </p>
22664 !! end
22665
22666 !! test
22667 Simple category in language variants
22668 !! options
22669 language=sr cat
22670 !! wikitext
22671 [[Category:МедиаWики Усер'с Гуиде]]
22672 !! html/php
22673 cat=МедиаWики_Усер'с_Гуиде sort=
22674 !! html/parsoid
22675 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
22676 !! end
22677
22678 !! article
22679 Category:分类
22680 !! text
22681 blah
22682 !! endarticle
22683
22684 !! article
22685 Category:分類
22686 !! text
22687 blah
22688 !! endarticle
22689
22690 ## We used to, but no longer wt2wt this test since the default serializer
22691 ## will normalize all categories to serialize on their own line.
22692 ## This wikitext usage is going to be fairly uncommon in production and
22693 ## selser will take care of preserving formatting in those scenarios.
22694 !! test
22695 Don't convert blue categorylinks to another variant (T35210)
22696 !! options
22697 cat
22698 language=zh
22699 parsoid=wt2html
22700 !! wikitext
22701 [[A]][[Category:分类]]
22702 !! html/php
22703 cat=分类 sort=
22704 !! html/parsoid
22705 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
22706 <link rel="mw:PageProp/Category" href="./Category:分类"/>
22707 !! end
22708
22709 !! test
22710 Stripping -{}- tags (language variants)
22711 !! options
22712 language=sr
22713 !! wikitext
22714 Latin proverb: -{Ne nuntium necare}-
22715 !! html/php
22716 <p>Latin proverb: Ne nuntium necare
22717 </p>
22718 !! html/parsoid
22719 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22720 !! end
22721
22722
22723 !! test
22724 Prevent conversion with -{}- tags (language variants)
22725 !! options
22726 language=sr variant=sr-ec
22727 !! wikitext
22728 Latinski: -{Ne nuntium necare}-
22729 !! html/php
22730 <p>Латински: Ne nuntium necare
22731 </p>
22732 !! html/parsoid
22733 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22734 !! end
22735
22736
22737 !! test
22738 Prevent conversion of text with -{}- tags (language variants)
22739 !! options
22740 language=sr variant=sr-ec
22741 !! wikitext
22742 Latinski: -{Ne nuntium necare}-
22743 !! html/php
22744 <p>Латински: Ne nuntium necare
22745 </p>
22746 !! html/parsoid
22747 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22748 !! end
22749
22750
22751 !! test
22752 Prevent conversion of links with -{}- tags (language variants)
22753 !! options
22754 language=sr variant=sr-ec
22755 !! wikitext
22756 -{[[Main Page]]}-
22757 !! html/php
22758 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22759 </p>
22760 !! html/parsoid
22761 <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>
22762 !! end
22763
22764
22765 !! test
22766 -{}- tags within headlines (within html for parserConvert())
22767 !! config
22768 wgFragmentMode=[ 'html5', 'legacy' ]
22769 !! options
22770 language=sr variant=sr-ec
22771 !! wikitext
22772 ==-{Naslov}-==
22773
22774 Note that even an unprotected headline ID is not affected by language
22775 conversion:
22776
22777 ==Latinski==
22778 !! html/php
22779 <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>
22780 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
22781 цонверсион:
22782 </p>
22783 <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>
22784
22785 !! html/parsoid
22786 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
22787
22788 <p>Note that even an unprotected headline ID is not affected by language
22789 conversion:</p>
22790
22791 <h2 id="Latinski">Latinski</h2>
22792 !! end
22793
22794 !! test
22795 Explicit definition of language variant alternatives
22796 !! options
22797 language=zh variant=zh-tw
22798 !! wikitext
22799 -{zh:China;zh-tw:Taiwan}-, not China
22800 !! html/php
22801 <p>Taiwan, not China
22802 </p>
22803 !! html/parsoid
22804 <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>
22805 !! end
22806
22807 !! test
22808 Filter syntax for language variants
22809 !! options
22810 language=zh variant=zh-tw
22811 !! wikitext
22812 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
22813 !! html/php
22814 <p>fooblog, WEBJOURNAL, WEBLOGquux
22815 </p>
22816 !! html/parsoid
22817 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
22818 !! end
22819
22820 # Note that Parsoid post-processing for language variants needs to
22821 # update the `title` attribute here, based on the mw:ExpandedAttrs property
22822 !! test
22823 Conversion around HTML tags
22824 !! options
22825 language=sr variant=sr-ec
22826 !! wikitext
22827 -{H|span=>sr-ec:script;title=>sr-ec:src}-
22828 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
22829 !! html/php
22830 <p>
22831 <span title="ЛаCтин">ски</span>
22832 </p>
22833 !! html/parsoid
22834 <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"}]}'/>
22835 <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>
22836 !! end
22837
22838 !! test
22839 Explicit session-wise two-way language variant mapping (A flag and - flag)
22840 !! options
22841 language=zh variant=zh-tw
22842 !! wikitext
22843 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
22844
22845 Taiwan is not China.
22846
22847 But -{A|zh:China; zh-tw:Taiwan}- is China,
22848
22849 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
22850
22851 and -{China}- is China.
22852 !! html/php
22853 <p>This is Taiwan, but we'll forget that now.
22854 </p><p>Taiwan is not China.
22855 </p><p>But Taiwan is Taiwan,
22856 </p><p>(This should be stripped!)
22857 </p><p>and China is China.
22858 </p>
22859 !! html/parsoid
22860 <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>
22861 <p>Taiwan is not China.</p>
22862 <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>
22863 <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>
22864 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22865 !! end
22866
22867 !! test
22868 Explicit session-wise one-way language variant mapping (A flag and - flag)
22869 !! options
22870 language=zh variant=zh-tw
22871 !! wikitext
22872 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
22873
22874 COUNTRY is China or Taiwan.
22875
22876 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
22877
22878 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22879
22880 and -{COUNTRY}- is COUNTRY.
22881 !! html/php
22882 <p>This is Taiwan, but we'll forget that now.
22883 </p><p>COUNTRY is China or Taiwan.
22884 </p><p>But Taiwan is Taiwan,
22885 </p><p>(This should be stripped!)
22886 </p><p>and COUNTRY is COUNTRY.
22887 </p>
22888 !! html/parsoid
22889 <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>
22890 <p>COUNTRY is China or Taiwan.</p>
22891 <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>
22892 <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>
22893 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22894 !! end
22895
22896 !! test
22897 Explicit session-wise two-way language variant mapping (H flag for hide)
22898 !! options
22899 language=zh variant=zh-tw
22900 !! wikitext
22901 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22902
22903 Taiwan is China.
22904 !! html/php
22905 <p>(This should be stripped!)
22906 </p><p>Taiwan is Taiwan.
22907 </p>
22908 !! html/parsoid
22909 <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>
22910 <p>Taiwan is China.</p>
22911 !! end
22912
22913 !! test
22914 Explicit session-wise one-way language variant mapping (H flag for hide)
22915 !! options
22916 language=zh variant=zh-tw
22917 !! wikitext
22918 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22919
22920 COUNTRY is Taiwan or China.
22921 !! html/php
22922 <p>(This should be stripped!)
22923 </p><p>Taiwan is Taiwan or China.
22924 </p>
22925 !! html/parsoid
22926 <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>
22927 <p>COUNTRY is Taiwan or China.</p>
22928 !! end
22929
22930 ## Note that parsoid test runner does not support 'showtitle' option.
22931 !! test
22932 Adding explicit conversion rule for title (T flag)
22933 !! options
22934 language=zh variant=zh-tw showtitle
22935 !! wikitext
22936 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22937
22938 Taiwan is China.
22939 !! html/php
22940 Taiwan
22941 <p>Should be stripped!
22942 </p><p>Taiwan is China.
22943 </p>
22944 !! html/parsoid
22945 <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>
22946 <p>Taiwan is China.</p>
22947 !! end
22948
22949 !! test
22950 Code coverage: T combined with H flag
22951 !! options
22952 language=zh variant=zh-tw showtitle
22953 !! wikitext
22954 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22955
22956 Taiwan is China.
22957 !! html/php
22958 Taiwan
22959 <p>Should be stripped!
22960 </p><p>Taiwan is Taiwan.
22961 </p>
22962 !! html/parsoid
22963 <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>
22964 <p>Taiwan is China.</p>
22965 !! end
22966
22967 !! test
22968 Code coverage: T with no variants
22969 !! options
22970 language=zh variant=zh-tw showtitle
22971 !! wikitext
22972 -{H|zh:China; zh-tw:Taiwan}-
22973 Taiwan is China.-{T|Taiwan is China}-
22974 !! html/php
22975 Taiwan is China
22976 <p>
22977 Taiwan is Taiwan.
22978 </p>
22979 !! html/parsoid
22980 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22981 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22982 !! end
22983
22984 !! test
22985 Code coverage: rules with no variants
22986 !! options
22987 language=zh variant=zh-tw
22988 !! wikitext
22989 -{H|zh:China; zh-tw:Taiwan}-
22990 Taiwan is China.
22991 -{H|China}-
22992 Taiwan is China.
22993 !! html/php
22994 <p>
22995 Taiwan is Taiwan.
22996
22997 Taiwan is China.
22998 </p>
22999 !! html/parsoid
23000 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
23001 Taiwan is China.
23002 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
23003 Taiwan is China.</p>
23004 !! end
23005
23006
23007 !! test
23008 Code coverage: D flag for conversion rule
23009 !! options
23010 language=zh variant=zh-tw
23011 !! wikitext
23012 -{D|zh-cn:XA; zh-tw:YA}-
23013 -{A;D|zh-cn:XB; zh-tw:YB}-
23014 -{D;H|zh-cn:XC; zh-tw:YC}-
23015
23016 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
23017
23018 -{D|0=>zh-tw:1}-
23019 -{A;D|2=>zh-tw:3}-
23020 -{D;H|4=>zh-tw:5}-
23021
23022 XA XB XC YA YB YC FOO BAR BAT 012345
23023 !! html/php
23024 <p>大陆:XA;台灣:YA;
23025
23026 大陆:XC;台灣:YC;
23027 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
23028 </p><p>0⇒台灣:1;
23029
23030 4⇒台灣:5;
23031 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
23032 </p>
23033 !! html/parsoid
23034 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
23035 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
23036 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
23037 <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>
23038 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
23039 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
23040 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
23041 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
23042 !! end
23043
23044 !! test
23045 Code coverage: N flag for conversion rule
23046 !! options
23047 language=zh variant=zh-cn
23048 !! wikitext
23049 -{N|zh-cn}-
23050
23051 -{N|zh-tw}-
23052
23053 -{N|sr-ec}-
23054 !! html/php
23055 <p>大陆
23056 </p><p>台灣
23057 </p><p>српски (ћирилица)‎
23058 </p>
23059 !! html/parsoid
23060 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
23061 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
23062 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
23063 !! end
23064
23065 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
23066 !! test
23067 Code coverage: N flag for conversion rule (wt2html only)
23068 !! options
23069 language=zh variant=zh-cn
23070 parsoid=wt2html,html2html
23071 !! wikitext
23072 -{D;N|en}-
23073 !! html/php
23074 <p>English
23075 </p>
23076 !! html/parsoid
23077 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
23078 !! end
23079
23080 !! test
23081 Testing that changing the language variant here in the tests actually works
23082 !! options
23083 language=zh variant=zh showtitle
23084 !! wikitext
23085 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
23086 !! html/php
23087 China
23088 <p>Should be stripped!
23089 </p>
23090 !! html/parsoid
23091 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
23092 !! end
23093
23094 !! test
23095 Recursive conversion of alt and title attrs shouldn't clear converter state
23096 !! options
23097 language=zh variant=zh-cn
23098 showtitle
23099 !! wikitext
23100 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
23101 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
23102 !! html/php
23103 China
23104 <p>
23105 Should be stripped<span title="Exclamation">!</span>
23106 </p>
23107 !! html/parsoid
23108 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
23109 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>
23110 !! end
23111
23112 !! test
23113 T26072: more test on conversion rule for title
23114 !! options
23115 language=zh variant=zh-tw showtitle
23116 !! wikitext
23117 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
23118
23119 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
23120 !! html/php
23121 Taiwan
23122 <p>This should be stripped!
23123 </p><p>This won't take interferes with the title rule.
23124 </p>
23125 !! html/parsoid
23126 <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>
23127 <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>
23128 !! end
23129
23130 !! test
23131 Partly disable title conversion if variant == main language code
23132 !! options
23133 language=zh variant=zh title=[[ZH]] showtitle
23134 !! wikitext
23135 -{T|zh-cn:CN;zh-tw:TW}-
23136 !! html/php
23137 ZH
23138 <p>
23139 </p>
23140 !! html/parsoid
23141 <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>
23142 !! end
23143
23144 !! test
23145 Partly disable title conversion if variant == main language code, more
23146 !! options
23147 language=zh variant=zh title=[[ZH]] showtitle
23148 !! wikitext
23149 -{T|TW}-
23150 !! html/php
23151 ZH
23152 <p>
23153 </p>
23154 !! html/parsoid
23155 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
23156 !! end
23157
23158 !! test
23159 Raw output of variant escape tags (R flag)
23160 !! options
23161 language=zh variant=zh-tw
23162 !! wikitext
23163 Raw: -{R|zh:China;zh-tw:Taiwan}-
23164 !! html/php
23165 <p>Raw: zh:China;zh-tw:Taiwan
23166 </p>
23167 !! html/parsoid
23168 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
23169 !! end
23170
23171 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
23172 !! test
23173 Raw output of variant escape tags (R flag) (wt2html only)
23174 !! options
23175 language=zh variant=zh-tw
23176 parsoid=wt2html,html2html
23177 !! wikitext
23178 -{Variant}- -{D|syntax}- -{D;R|options}-
23179 !! html/php
23180 <p>Variant syntax options
23181 </p>
23182 !! html/parsoid
23183 <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>
23184 !! end
23185
23186 !! test
23187 Nested markup inside raw output of variant escape tags (R flag)
23188 !! options
23189 language=zh variant=zh-tw
23190 !! wikitext
23191 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
23192 !! html/php
23193 <p>Nested raw: nested Taiwan nested
23194 </p>
23195 !! html/parsoid
23196 <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>
23197 !! end
23198
23199 !! test
23200 Nested markup and spaces inside raw output of variant escape tags (R flag)
23201 !! options
23202 language=zh variant=zh-tw
23203 !! wikitext
23204 X-{ outer -{ inner }- outer }-X
23205 !! html/php
23206 <p>X outer inner outer X
23207 </p>
23208 !! html/parsoid
23209 <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>
23210 !! end
23211
23212 !! test
23213 Templates inside raw output of variant escape tags (R flag)
23214 !! options
23215 language=zh variant=zh-tw
23216 !! wikitext
23217 Nested raw: -{R|nested {{echo|hi}} templates}-
23218 !! html/php
23219 <p>Nested raw: nested hi templates
23220 </p>
23221 !! html/parsoid
23222 <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>
23223 !! end
23224
23225 !! test
23226 Strings evaluating false shouldn't be ignored by Language converter (T51072)
23227 !! options
23228 language=zh variant=zh-cn
23229 !! wikitext
23230 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
23231 !! html/php
23232 <p>0
23233 </p>
23234 !! html/parsoid
23235 <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>
23236 !! end
23237
23238 !! test
23239 Conversion rules from [numeric-only string] to [something else] (T48634)
23240 !! options
23241 language=zh variant=zh-cn
23242 !! wikitext
23243 -{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
23244 !! html/php
23245 <p>D12345EE12345
23246 </p>
23247 !! html/parsoid
23248 <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>
23249 !! end
23250
23251 !! test
23252 Two-way converter rule entries with an empty value should be ignored (T53551)
23253 !! options
23254 language=zh variant=zh-cn
23255 !! wikitext
23256 -{H|zh-cn:foo;zh-tw:;}-foobar
23257 !! html/php
23258 <p>foobar
23259 </p>
23260 !! html/parsoid
23261 <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>
23262 !! end
23263
23264 !! test
23265 One-way converter rule entries with an empty "from" string should be ignored (T53551)
23266 !! options
23267 language=zh variant=zh-cn
23268 !! wikitext
23269 -{H|=>zh-cn:foo;}-foobar
23270 !! html/php
23271 <p>foobar
23272 </p>
23273 !! html/parsoid
23274 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
23275 !! end
23276
23277 !! test
23278 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
23279 !! options
23280 language=zh variant=zh-cn
23281 !! wikitext
23282 -{H|}-foobar
23283 !! html/php
23284 <p>foobar
23285 </p>
23286 !! html/parsoid
23287 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
23288 !! end
23289
23290 !! test
23291 Nested using of manual convert syntax
23292 !! options
23293 language=zh variant=zh-hk
23294 !! wikitext
23295 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
23296 !! html/php
23297 <p>Nested: Hello Hong Kong!
23298 </p>
23299 !! html/parsoid
23300 <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>
23301 !! end
23302
23303 !! test
23304 HTML markups with conversion syntax in attribs, nested in other conversion blocks
23305 !! options
23306 language=zh variant=zh-cn
23307 !! wikitext
23308 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
23309 !! html/php
23310 <p><span title="X">A</span>
23311 </p>
23312 !! html/parsoid
23313 <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>
23314 !! end
23315
23316 !! test
23317 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
23318 !! options
23319 language=zh variant=zh-cn
23320 !! wikitext
23321 -{<span title="-{X}-">A</span>}-
23322 !! html/php+disabled
23323 <p><span title="X">A</span>
23324 </p>
23325 !! html/parsoid
23326 <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>
23327 !! end
23328
23329 # Parsoid and PHP disagree on how to parse this example: Parsoid
23330 # insists that the content of a language converter element be a valid
23331 # DOM fragment or attribute string
23332 !! test
23333 Language converter markup with block content
23334 !! options
23335 language=zh variant=zh-cn
23336 !! wikitext
23337 <span>a-{b<div>c}-d
23338
23339 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
23340
23341 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
23342 !! html/php+tidy
23343 <span>ab<div>cd
23344 <span>ab<div>cd
23345 <span>ad
23346 </span></div></span></div></span>
23347 !! html/parsoid
23348 <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
23349
23350 <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
23351
23352 <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>
23353 !! end
23354
23355 !! test
23356 LanguageConverter selser (1)
23357 !! options
23358 language=zh variant=zh-cn
23359 parsoid={
23360 "modes": ["wt2wt", "selser"],
23361 "changes": [
23362 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23363 ]
23364 }
23365 !! wikitext
23366 -{raw}-
23367 !! wikitext/edited
23368 -{edited}-
23369 !! end
23370
23371 !! test
23372 LanguageConverter selser (2)
23373 !! options
23374 language=zh variant=zh-cn
23375 parsoid={
23376 "modes": ["wt2wt", "selser"],
23377 "changes": [
23378 ["span[class='x']", "contents", "text", "-{foo}-"],
23379 ["a", "contents", "text", "-{"],
23380 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
23381 ]
23382 }
23383 !! wikitext
23384 <span class="x">TEXT1</span>
23385 [http://example.com TEXT2]
23386 [[Foo|TEXT3]]
23387 {{echo|TEXT4}}
23388 !! wikitext/edited
23389 <span class="x"><nowiki>-{foo}-</nowiki></span>
23390 [http://example.com -{]
23391 [[Foo|<nowiki>-{</nowiki>]]
23392 {{1x|<nowiki>-{</nowiki>}}
23393 !! end
23394
23395 # Tests LanguageVariantText in ConstrainedText
23396 !! test
23397 LanguageConverter selser (3)
23398 !! options
23399 language=zh variant=zh-cn
23400 parsoid={
23401 "modes": ["wt2wt", "selser"],
23402 "changes": [
23403 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
23404 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23405 ]
23406 }
23407 !! wikitext
23408 {|
23409 |-
23410 |<span>Foo</span>
23411 |}
23412 !! wikitext/edited
23413 {|
23414 |-
23415 |<nowiki/>-{edited}-
23416 |}
23417 !! end
23418
23419 # Tests LanguageVariantText._fromSelSer
23420 !! test
23421 LanguageConverter selser (4)
23422 !! options
23423 language=zh variant=zh-cn
23424 parsoid={
23425 "modes": ["wt2wt", "selser"],
23426 "changes": [
23427 ["td > span.x", "remove"]
23428 ]
23429 }
23430 !! wikitext
23431 {|
23432 |-
23433 |<span class="x">Foo</span>-{Bar}-
23434 ||<span class="x">Foo</span>-{Bar}-
23435 |}
23436 !! wikitext/edited
23437 {|
23438 |-
23439 |<nowiki/>-{Bar}-
23440 ||-{Bar}-
23441 |}
23442 !! end
23443
23444 # Since Parsoid is starting to emit canonical wikitext for links,
23445 # [http://example.com http://example.com] will not RT back to that
23446 # form anymore.
23447 # Parsoid does not language-convert links (it is done in a
23448 # post-processing step)
23449 !! test
23450 Proper conversion of text in external links
23451 !! options
23452 language=sr variant=sr-ec
23453 parsoid=wt2html
23454 !! wikitext
23455 http://www.google.com
23456 gopher://www.google.com
23457 [http://www.google.com http://www.google.com]
23458 [gopher://www.google.com gopher://www.google.com]
23459 [https://www.google.com irc://www.google.com]
23460 [ftp://www.google.com www.google.com/ftp://dir]
23461 [//www.google.com www.google.com]
23462 !! html/php
23463 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
23464 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23465 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
23466 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23467 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
23468 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
23469 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
23470 </p>
23471 !! html/parsoid
23472 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
23473 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23474 <a rel="mw:ExtLink" class="external text" href="http://www.google.com">http://www.google.com</a>
23475 <a rel="mw:ExtLink" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23476 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
23477 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
23478 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
23479 !! end
23480
23481 !! test
23482 Do not convert roman numbers to language variants
23483 !! options
23484 language=sr variant=sr-ec
23485 !! wikitext
23486 Fridrih IV je car.
23487 !! html/php
23488 <p>Фридрих IV је цар.
23489 </p>
23490 !! html/parsoid
23491 <p>Fridrih IV je car.</p>
23492 !! end
23493
23494 !! test
23495 Unclosed language converter markup "-{"
23496 !! options
23497 language=sr
23498 !! wikitext
23499 -{T|hello
23500 !! html
23501 <p>-{T|hello
23502 </p>
23503 !! end
23504
23505 !! test
23506 Don't convert raw rule "-{R|=&gt;}-" to "=>"
23507 !! options
23508 language=sr
23509 !! wikitext
23510 -{R|=&gt;}-
23511 !! html/php
23512 <p>=&gt;
23513 </p>
23514 !! html/parsoid
23515 <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>
23516 !!end
23517
23518 !! test
23519 Don't break link parsing if language converter markup is in the caption.
23520 !! options
23521 language=sr variant=sr-ec
23522 !! wikitext
23523 [[Main Page|-{R|main page}-]]
23524 !! html/php
23525 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
23526 </p>
23527 !! html/parsoid
23528 <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>
23529 !! end
23530
23531 !! test
23532 T146304: Don't break template parsing if language converter markup is in the parameter.
23533 !! options
23534 language=sr variant=sr-ec
23535 !! wikitext
23536 {{echo|-{R|foo}-}}
23537 !! html/php
23538 <p>foo
23539 </p>
23540 !! html/parsoid
23541 <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>
23542 !! end
23543
23544 !! test
23545 T146305: Don't break image parsing if language converter markup is in the caption.
23546 !! options
23547 language=sr
23548 !! wikitext
23549 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
23550 !! html/php
23551 <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" 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>
23552
23553 !! html/parsoid
23554 <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>
23555 !! end
23556
23557 !! test
23558 T146305: Don't break image parsing if nested language converter markup is in the caption.
23559 !! options
23560 language=zh variant=zh-cn
23561 !! wikitext
23562 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
23563 !! html/php
23564 <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" 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>
23565
23566 !! html/parsoid
23567 <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>
23568 !! end
23569
23570 # XXX html2wt disabled because rich markup in alt is not preserved.
23571 !! test
23572 Don't break gallery if language converter markup is inside.
23573 !! options
23574 language=zh
23575 !! wikitext
23576 <gallery>
23577 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
23578 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
23579 </gallery>
23580 !! html/php
23581 <ul class="gallery mw-gallery-traditional">
23582 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23583 <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" 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>
23584 <div class="gallerytext">
23585 <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" 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>
23586 </p>
23587 </div>
23588 </div></li>
23589 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23590 <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" 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>
23591 <div class="gallerytext">
23592 <p>This is a test template
23593 </p>
23594 </div>
23595 </div></li>
23596 </ul>
23597
23598 !! html/parsoid
23599 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-\nFile:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt\n"}}'>
23600 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><figure-inline typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"disabled\":{\"t\":\"bar\"}}&#39; data-parsoid=&#39;{\"fl\":[\"R\"],\"dsr\":[68,77,null,2]}&#39;>&lt;/span>"}'><a href="./File:Foobar.jpg"><img alt="" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="2" width="20"/></a></figure-inline></div></li>
23601 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><span about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"unamedParam"},"alt":{"wt":"-{R|param}-"}},"i":0}}]}'>This is a test template</span></div></li>
23602 </ul>
23603 !! end
23604
23605 !! test
23606 T153135: Don't break list handling if language converter markup is in the item.
23607 !! options
23608 language=zh variant=zh-cn
23609 !! wikitext
23610 ;-{zh-cn:AAA;zh-tw:BBB}-
23611 ;-{R|foo:bar}-
23612 !! html/php
23613 <dl><dt>AAA</dt>
23614 <dt>foo:bar</dt></dl>
23615
23616 !! html/parsoid
23617 <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>
23618 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
23619 </dl>
23620 !! end
23621
23622 // Note that parsoid does not protect colons unless language converter
23623 // markup is properly nested, because it is a backtracking parser.
23624 !! test
23625 T153135: Unclosed markup in definition list (code coverage)
23626 !! options
23627 language=zh variant=zh-cn
23628 !! wikitext
23629 ;<b>foo:bar
23630 ;-{zh-cn:AAA
23631 !! html/php+tidy
23632 <dl><dt><b>foo:bar</b></dt><b>
23633 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
23634 </b></p>
23635 !! html/parsoid
23636 <dl><dt data-parsoid='{}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
23637 <dt data-parsoid='{}'>-{zh-cn</dt><dd data-parsoid='{"stx":"row"}'>AAA</dd></b></dl>
23638 !! end
23639
23640 !! test
23641 T153135: Nested language converter markup in definition list (code coverage)
23642 !! options
23643 language=zh variant=zh-cn
23644 !! wikitext
23645 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
23646 !! html/php
23647 <dl><dt>AAA foo:bar bat:baz</dt>
23648 <dd>def</dd></dl>
23649
23650 !! html/parsoid
23651 <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>
23652 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
23653 </dl>
23654 !! end
23655
23656 # html2wt mode disabled due to <nowiki> insertion.
23657 !! test
23658 T153140: Don't break table handling if language converter markup is in the cell.
23659 !! options
23660 language=sr variant=sr-ec
23661 parsoid=wt2html,wt2wt,html2html
23662 !! wikitext
23663 {|
23664 |-
23665 | -{R|B}-
23666 |}
23667 !! html/php
23668 <table>
23669
23670 <tr>
23671 <td>B
23672 </td></tr></table>
23673
23674 !! html/parsoid
23675 <table>
23676 <tbody>
23677 <tr>
23678 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
23679 </tr>
23680 </tbody>
23681 </table>
23682 !! end
23683
23684 !! test
23685 Language converter tricky html2wt cases (1)
23686 !! options
23687 language=sr
23688 parsoid=html2wt,wt2wt
23689 !! html/parsoid
23690 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
23691 !! wikitext
23692 -{<nowiki>}-</nowiki>}-
23693 !! html/php
23694 <p>&#125;-
23695 </p>
23696 !! end
23697
23698 !! test
23699 Language converter tricky html2wt cases (2)
23700 !! options
23701 language=sr
23702 parsoid=html2wt,wt2wt
23703 !! html/parsoid
23704 <p>-{foo}-</p>
23705 !! wikitext
23706 <nowiki>-{foo}-</nowiki>
23707 !! html/php
23708 <p>-&#123;foo&#125;-
23709 </p>
23710 !! end
23711
23712 !! test
23713 Language converter tricky html2wt cases (3)
23714 !! options
23715 language=sr
23716 parsoid=html2wt,wt2wt
23717 !! html/parsoid
23718 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
23719 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
23720 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
23721 !! wikitext
23722 -{R||}-
23723
23724 -{R|R|raw}-
23725
23726 -{<nowiki>-{foo}-</nowiki>}-
23727 !! html/php
23728 <p>|
23729 </p><p>R|raw
23730 </p><p>-&#123;foo&#125;-
23731 </p>
23732 !! end
23733
23734 !! test
23735 Language converter tricky html2wt cases (4)
23736 !! options
23737 language=sr
23738 parsoid=html2wt,wt2wt
23739 !! html/parsoid
23740 <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>
23741 !! wikitext
23742 -{R|{{echo|hey}}}-
23743 !! html/php
23744 <p>hey
23745 </p>
23746 !! end
23747
23748 # Note that the <nowiki> escaping added by parsoid for source text,
23749 # destination text, and language names only works on the PHP side
23750 # for *destination text*. (HTML entity escaping wouldn't work
23751 # any better.) This is probably a bug, at least for source texts.
23752 # (For language names PHP uses a precise regexp based on the languages
23753 # it currently knows have variants, which is fragile since this set
23754 # can grow/shrink over time.)
23755 !! test
23756 Language converter tricky html2wt cases (5)
23757 !! options
23758 language=zh variant=zh-cn
23759 !! html/parsoid
23760 <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>
23761 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
23762 <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>
23763 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
23764 <p>a:b=>c xyz</p>
23765 !! wikitext
23766 -{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
23767
23768 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
23769
23770 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
23771
23772 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
23773
23774 a:b=>c xyz
23775 !! html/php+disabled
23776 <p>foobat;xyz=&gt;zh-cn:abc
23777 </p><p>A
23778 </p><p>0;zh-tw:bar
23779 </p><p>abc
23780 </p><p>a:b=&gt;c 0;zh-tw:bar
23781 </p>
23782 !! end
23783
23784 !! test
23785 T179579: Nowiki and lc interaction
23786 !! options
23787 parsoid=wt2html
23788 language=sr
23789 !! wikitext
23790 -{</nowiki>123}-
23791
23792 -{123<nowiki>|</nowiki>456}-
23793 !! html/parsoid
23794 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
23795
23796 <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>
23797 !! end
23798
23799 !! test
23800 T2529: Uncovered bullet
23801 !! wikitext
23802 *Foo {{bullet}}
23803 !! html
23804 <ul><li>Foo</li>
23805 <li>Bar</li></ul>
23806
23807 !! end
23808
23809 !! test
23810 T2529: Uncovered bullet in a deeply nested list
23811 !! wikitext
23812 *******Foo {{bullet}}
23813 !! html
23814 <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>
23815 <li>Bar</li></ul>
23816
23817 !! end
23818
23819 !! test
23820 T2529: Uncovered table already at line-start
23821 !! wikitext
23822 x
23823
23824 {{table}}
23825 y
23826 !! html
23827 <p>x
23828 </p>
23829 <table>
23830 <tr>
23831 <td>1</td>
23832 <td>2
23833 </td></tr>
23834 <tr>
23835 <td>3</td>
23836 <td>4
23837 </td></tr></table>
23838 <p>y
23839 </p>
23840 !! end
23841
23842 !! test
23843 T2529: Uncovered bullet in parser function result
23844 !! wikitext
23845 *Foo {{lc:{{bullet}} }}
23846 !! html
23847 <ul><li>Foo</li>
23848 <li>bar</li></ul>
23849
23850 !! end
23851
23852 !! test
23853 T7678: Double-parsed template argument
23854 !! wikitext
23855 {{lc:{{{1}}}|hello}}
23856 !! html
23857 <p>{{{1}}}
23858 </p>
23859 !! end
23860
23861 !! test
23862 T7678: Double-parsed template invocation
23863 !! wikitext
23864 {{lc:{{paramtest {{!}} param = hello }} }}
23865 !! html
23866 <p>{{paramtest | param = hello }}
23867 </p>
23868 !! end
23869
23870 !! test
23871 Case insensitivity of parser functions for non-ASCII characters (T10143)
23872 !! options
23873 language=cs
23874 title=[[Main Page]]
23875 !! wikitext
23876 {{PRVNÍVELKÉ:ěščř}}
23877 {{prvnívelké:ěščř}}
23878 {{PRVNÍMALÉ:ěščř}}
23879 {{prvnímalé:ěščř}}
23880 {{MALÁ:ěščř}}
23881 {{malá:ěščř}}
23882 {{VELKÁ:ěščř}}
23883 {{velká:ěščř}}
23884 !! html
23885 <p>Ěščř
23886 Ěščř
23887 ěščř
23888 ěščř
23889 ěščř
23890 ěščř
23891 ĚŠČŘ
23892 ĚŠČŘ
23893 </p>
23894 !! end
23895
23896 !! test
23897 Morwen/13: Unclosed link followed by heading
23898 !! wikitext
23899 [[link
23900 ==heading==
23901 !! html
23902 <p>[[link
23903 </p>
23904 <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>
23905
23906 !! end
23907
23908 !! test
23909 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23910 !! wikitext
23911 {{foo|
23912 =heading=
23913 !! html
23914 <p>{{foo|
23915 </p>
23916 <h1><span class="mw-headline" id="heading">heading</span></h1>
23917
23918 !! end
23919
23920 !! test
23921 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23922 !! wikitext
23923 {{foo|
23924 ==heading==
23925 !! html
23926 <p>{{foo|
23927 </p>
23928 <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>
23929
23930 !! end
23931
23932 !! test
23933 Tildes in comments
23934 !! options
23935 pst
23936 !! wikitext
23937 <!-- ~~~~ -->
23938 !! html/php
23939 <!-- ~~~~ -->
23940 !! end
23941
23942 !! test
23943 Paragraphs inside divs (no extra line breaks)
23944 !! wikitext
23945 <div>Line one
23946
23947 Line two</div>
23948 !! html
23949 <div>Line one
23950 Line two</div>
23951
23952 !! end
23953
23954 !! test
23955 Paragraphs inside divs (extra line break on open)
23956 !! wikitext
23957 <div>
23958 Line one
23959
23960 Line two</div>
23961 !! html
23962 <div>
23963 <p>Line one
23964 </p>
23965 Line two</div>
23966
23967 !! end
23968
23969 !! test
23970 Paragraphs inside divs (extra line break on close)
23971 !! wikitext
23972 <div>Line one
23973
23974 Line two
23975 </div>
23976 !! html
23977 <div>Line one
23978 <p>Line two
23979 </p>
23980 </div>
23981
23982 !! end
23983
23984 !! test
23985 Paragraphs inside divs (extra line break on open and close)
23986 !! wikitext
23987 <div>
23988 Line one
23989
23990 Line two
23991 </div>
23992 !! html
23993 <div>
23994 <p>Line one
23995 </p><p>Line two
23996 </p>
23997 </div>
23998
23999 !! end
24000
24001 # doBlockLevels screws up this output and Remex cleans up as much as it can.
24002 !! test
24003 Nesting tags, paragraphs on lines which begin with <div>
24004 !! wikitext
24005 <div></div><strong>A
24006 B</strong>
24007 !! html/php+tidy
24008 <div></div><p><strong>A
24009 </strong></p><strong></strong><p><strong>B</strong>
24010 </p>
24011 !! html/parsoid
24012 <div data-parsoid='{"stx":"html"}'></div><p><strong data-parsoid='{"stx":"html","autoInsertedEnd":true}'>A</strong></p>
24013 <p><strong data-parsoid='{"stx":"html","autoInsertedStart":true}'>B</strong></p>
24014 !! end
24015
24016 # T8200: <blockquote> should behave like <div> with respect to line breaks
24017 !! test
24018 T8200: paragraphs inside blockquotes (no extra line breaks)
24019 !! wikitext
24020 <blockquote>Line one
24021
24022 Line two</blockquote>
24023 !! html
24024 <blockquote>Line one
24025 Line two</blockquote>
24026
24027 !! html+tidy
24028 <blockquote><p>Line one
24029 Line two</p></blockquote>
24030 !! end
24031
24032 !! test
24033 T8200: paragraphs inside blockquotes (extra line break on open)
24034 !! wikitext
24035 <blockquote>
24036 Line one
24037
24038 Line two</blockquote>
24039 !! html
24040 <blockquote>
24041 <p>Line one
24042 </p>
24043 Line two</blockquote>
24044
24045 !! html+tidy
24046 <blockquote>
24047 <p>Line one
24048 </p><p>
24049 Line two</p></blockquote>
24050 !! end
24051
24052 !! test
24053 T8200: paragraphs inside blockquotes (extra line break on close)
24054 !! wikitext
24055 <blockquote>Line one
24056
24057 Line two
24058 </blockquote>
24059 !! html
24060 <blockquote>Line one
24061 <p>Line two
24062 </p>
24063 </blockquote>
24064
24065 !! html+tidy
24066 <blockquote><p>Line one
24067 </p><p>Line two
24068 </p>
24069 </blockquote>
24070 !! end
24071
24072 !! test
24073 T8200: paragraphs inside blockquotes (extra line break on open and close)
24074 !! wikitext
24075 <blockquote>
24076 Line one
24077
24078 Line two
24079 </blockquote>
24080 !! html
24081 <blockquote>
24082 <p>Line one
24083 </p><p>Line two
24084 </p>
24085 </blockquote>
24086
24087 !! end
24088
24089 ## This is a corner case interaction between the paragraph wrapping in the
24090 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
24091 ## some tags which close paragraphs (and thus prevent wrapping on their line),
24092 ## of which "div" is one, but do p-wrapping inside them. These are referred
24093 ## to as "never suppressing". Remex, for its part, doesn't traverse into
24094 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
24095 !! test
24096 Paragraphs inside blockquotes/divs (no extra line breaks)
24097 !! wikitext
24098 <blockquote><div>Line one
24099
24100 Line two</div></blockquote>
24101 !! html
24102 <blockquote><div>Line one
24103 Line two</div></blockquote>
24104
24105 !! end
24106
24107 !! test
24108 Paragraphs inside blockquotes/divs (extra line break on open)
24109 !! wikitext
24110 <blockquote><div>
24111 Line one
24112
24113 Line two</div></blockquote>
24114 !! html
24115 <blockquote><div>
24116 <p>Line one
24117 </p>
24118 Line two</div></blockquote>
24119
24120 !! end
24121
24122 !! test
24123 Paragraphs inside blockquotes/divs (extra line break on close)
24124 !! wikitext
24125 <blockquote><div>Line one
24126
24127 Line two
24128 </div></blockquote>
24129 !! html
24130 <blockquote><div>Line one
24131 <p>Line two
24132 </p>
24133 </div></blockquote>
24134
24135 !! end
24136
24137 !! test
24138 Paragraphs inside blockquotes/divs (extra line break on open and close)
24139 !! wikitext
24140 <blockquote><div>
24141 Line one
24142
24143 Line two
24144 </div></blockquote>
24145 !! html
24146 <blockquote><div>
24147 <p>Line one
24148 </p><p>Line two
24149 </p>
24150 </div></blockquote>
24151
24152 !! end
24153
24154 !! test
24155 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
24156 !! options
24157 wgLinkHolderBatchSize=0
24158 !! wikitext
24159 [[meatball:1]]
24160 [[meatball:2]]
24161 [[meatball:3]]
24162 !! html
24163 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
24164 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
24165 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
24166 </p>
24167 !! end
24168
24169 !! test
24170 Free external link invading image caption
24171 !! wikitext
24172 [[Image:Foobar.jpg|thumb|http://x|hello]]
24173 !! html/php
24174 <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" 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>
24175
24176 !! html/parsoid
24177 <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>
24178 !! end
24179
24180 !! test
24181 T17196: localised external link numbers
24182 !! options
24183 language=fa
24184 !! wikitext
24185 [http://en.wikipedia.org/]
24186 !! html/php
24187 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
24188 </p>
24189 !! html/parsoid
24190 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
24191 !! end
24192
24193 !! test
24194 Multibyte character in padleft
24195 !! wikitext
24196 {{padleft:-Hello|7|Æ}}
24197 !! html/php
24198 <p>Æ-Hello
24199 </p>
24200 !! html/parsoid
24201 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
24202 !! end
24203
24204 !! test
24205 Multibyte character in padright
24206 !! wikitext
24207 {{padright:Hello-|7|Æ}}
24208 !! html/php
24209 <p>Hello-Æ
24210 </p>
24211 !! html/parsoid
24212 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
24213 !! end
24214
24215 !!test
24216 formatdate parser function
24217 !! wikitext
24218 {{#formatdate:2009-03-24}}
24219 !! html
24220 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
24221 </p>
24222 !! end
24223
24224 !!test
24225 formatdate parser function, with default format
24226 !! wikitext
24227 {{#formatdate:2009-03-24|mdy}}
24228 !! html
24229 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
24230 </p>
24231 !! end
24232
24233 !! test
24234 Spacing of numbers in formatted dates
24235 !! wikitext
24236 {{#formatdate:January 15}}
24237 !! html
24238 <p><span class="mw-formatted-date" title="01-15">January 15</span>
24239 </p>
24240 !! end
24241
24242 !! test
24243 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
24244 !! options
24245 language=nl title=[[MediaWiki:Common.css]]
24246 !! wikitext
24247 {{#formatdate:2009-03-24|dmy}}
24248 !! html
24249 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
24250 </p>
24251 !! end
24252
24253 #
24254 #
24255 #
24256
24257 #
24258 # Edit comments
24259 #
24260
24261 !! test
24262 Edit comment with link
24263 !! options
24264 comment
24265 !! wikitext
24266 I like the [[Main Page]] a lot
24267 !! html/php
24268 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
24269 !!end
24270
24271 !! test
24272 Edit comment with link and link text
24273 !! options
24274 comment
24275 !! wikitext
24276 I like the [[Main Page|best pages]] a lot
24277 !! html/php
24278 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
24279 !!end
24280
24281 !! test
24282 Edit comment with link and link text with suffix
24283 !! options
24284 comment
24285 !! wikitext
24286 I like the [[Main Page|best page]]s a lot
24287 !! html/php
24288 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
24289 !!end
24290
24291 !! test
24292 Edit comment with section link (non-local, eg in history list)
24293 !! options
24294 comment title=[[Main Page]]
24295 !! wikitext
24296 /* External links */ removed bogus entries
24297 !! html/php
24298 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
24299 !!end
24300
24301 !! test
24302 Edit comment with section link and text before it (non-local, eg in history list)
24303 !! options
24304 comment title=[[Main Page]]
24305 !! wikitext
24306 pre-comment text /* External links */ removed bogus entries
24307 !! html/php
24308 pre-comment text <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
24309 !!end
24310
24311 !! test
24312 Edit comment with section link (local, eg in diff view)
24313 !! options
24314 comment local title=[[Main Page]]
24315 !! wikitext
24316 /* External links */ removed bogus entries
24317 !! html/php
24318 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
24319 !!end
24320
24321 !! test
24322 Edit comment with subpage link (T16080)
24323 !! options
24324 comment
24325 subpage
24326 title=[[Subpage test]]
24327 !! wikitext
24328 Poked at a [[/subpage]] here...
24329 !! html/php
24330 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
24331 !!end
24332
24333 !! test
24334 Edit comment with subpage link and link text (T16080)
24335 !! options
24336 comment
24337 subpage
24338 title=[[Subpage test]]
24339 !! wikitext
24340 Poked at a [[/subpage|neat little page]] here...
24341 !! html/php
24342 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
24343 !!end
24344
24345 !! test
24346 Edit comment with bogus subpage link in non-subpage NS (T16080)
24347 !! options
24348 comment
24349 title=[[Subpage test]]
24350 !! wikitext
24351 Poked at a [[/subpage]] here...
24352 !! html/php
24353 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...
24354 !!end
24355
24356 !! test
24357 Edit comment with bare anchor link (local, as on diff)
24358 !! options
24359 comment
24360 local
24361 title=[[Main Page]]
24362 !! wikitext
24363 [[#section]]
24364 !! html/php
24365 <a href="#section">#section</a>
24366 !! end
24367
24368 !! test
24369 Edit comment with bare anchor link (non-local, as on history)
24370 !! options
24371 comment
24372 title=[[Main Page]]
24373 !! wikitext
24374 [[#section]]
24375 !! html/php
24376 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
24377 !! end
24378
24379 !! test
24380 Anchor starting with underscore
24381 !! options
24382 title=[[Foo]]
24383 !! wikitext
24384 [[#_ref|One]]
24385 !! html/php
24386 <p><a href="#_ref">One</a>
24387 </p>
24388 !! html/parsoid
24389 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
24390 !! end
24391
24392 !! test
24393 Id starting with underscore
24394 !! wikitext
24395 <div id="_ref"></div>
24396 !! html/*
24397 <div id="_ref"></div>
24398
24399 !! end
24400
24401 !! test
24402 Edit comment with link with more than one pipe (T99346)
24403 !! options
24404 comment
24405 !! wikitext
24406 [[Main Page|Many|pipes]]
24407 !! html/php
24408 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
24409 !! end
24410
24411 !! test
24412 Complex edit comment with link with more than one pipe (T99346)
24413 !! options
24414 comment
24415 !! wikitext
24416 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
24417 !! html/php
24418 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;
24419 !! end
24420
24421 !! test
24422 Space normalisation on autocomment (T24784)
24423 !! options
24424 comment
24425 title=[[Main Page]]
24426 !! wikitext
24427 /* __hello__world__ */
24428 !! html/php
24429 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
24430 !! end
24431
24432 !! test
24433 percent-encoding and + signs in comments (T28410)
24434 !! options
24435 comment
24436 !! wikitext
24437 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
24438 !! html/php
24439 <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>
24440 !! end
24441
24442 # Parsoid doesn't support this yet: see T75581
24443 # but it *should* omit the 'src' attribute if the image is bad.
24444 # PHP side of tests was disabled in
24445 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
24446 # because of issues in the PHP parserTests infrastructure
24447 # (but the output below is indeed what the PHP side emits)
24448 !! test
24449 Bad images - basic functionality
24450 !! wikitext
24451 [[File:Bad.jpg]]
24452 !! html/php+disabled
24453 !! html/parsoid
24454 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="./File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span></p>
24455 !! end
24456
24457 !! test
24458 Bad images - T18039: text after bad image disappears
24459 !! wikitext
24460 Foo bar
24461 [[File:Bad.jpg]]
24462 Bar foo
24463 !! html/php+disabled
24464 <p>Foo bar
24465 </p><p>Bar foo
24466 </p>
24467 !! html/parsoid
24468 <p>Foo bar
24469 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="./File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span>
24470 Bar foo</p>
24471 !! end
24472
24473 !! test
24474 Verify that displaytitle works (T24501) no displaytitle
24475 !! options
24476 showtitle
24477 !! config
24478 wgAllowDisplayTitle=true
24479 wgRestrictDisplayTitle=false
24480 !! wikitext
24481 this is not the the title
24482 !! html/php
24483 Parser test
24484 <p>this is not the the title
24485 </p>
24486 !! end
24487
24488 !! test
24489 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
24490 !! options
24491 showtitle
24492 title=[[Screen]]
24493 !! config
24494 wgAllowDisplayTitle=true
24495 wgRestrictDisplayTitle=false
24496 !! wikitext
24497 this is not the the title
24498 {{DISPLAYTITLE:whatever}}
24499 !! html/php
24500 whatever
24501 <p>this is not the the title
24502 </p>
24503 !! end
24504
24505 !! test
24506 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
24507 !! options
24508 showtitle
24509 title=[[Screen]]
24510 !! config
24511 wgAllowDisplayTitle=true
24512 wgRestrictDisplayTitle=true
24513 !! wikitext
24514 this is not the the title
24515 {{DISPLAYTITLE:whatever}}
24516 !! html/php
24517 Screen
24518 <p>this is not the the title
24519 </p>
24520 !! end
24521
24522 !! test
24523 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
24524 !! options
24525 showtitle
24526 title=[[Screen]]
24527 !! config
24528 wgAllowDisplayTitle=true
24529 wgRestrictDisplayTitle=true
24530 !! wikitext
24531 this is not the the title
24532 {{DISPLAYTITLE:screen}}
24533 !! html/php
24534 screen
24535 <p>this is not the the title
24536 </p>
24537 !! end
24538
24539 !! test
24540 Verify that displaytitle works (T24501) AllowDisplayTitle=false
24541 !! options
24542 showtitle
24543 title=[[Screen]]
24544 !! config
24545 wgAllowDisplayTitle=false
24546 !! wikitext
24547 this is not the the title
24548 {{DISPLAYTITLE:screen}}
24549 !! html/php
24550 Screen
24551 <p>this is not the the title
24552 <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>
24553 </p>
24554 !! end
24555
24556 !! test
24557 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
24558 !! options
24559 showtitle
24560 title=[[Screen]]
24561 !! config
24562 wgAllowDisplayTitle=false
24563 !! wikitext
24564 this is not the the title
24565 !! html/php
24566 Screen
24567 <p>this is not the the title
24568 </p>
24569 !! end
24570
24571 !! test
24572 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
24573 !! options
24574 showtitle
24575 title=[[Screen]]
24576 !! config
24577 wgAllowDisplayTitle=true
24578 wgRestrictDisplayTitle=true
24579 !! wikitext
24580 this is not the the title
24581 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
24582 !! html/php
24583 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
24584 <p>this is not the the title
24585 </p>
24586 !! end
24587
24588 !! test
24589 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
24590 !! options
24591 showtitle
24592 title=[[Screen]]
24593 !! config
24594 wgAllowDisplayTitle=true
24595 wgRestrictDisplayTitle=true
24596 !! wikitext
24597 this is not the the title
24598 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
24599 !! html/php
24600 <span style="color: red;">s</span>creen
24601 <p>this is not the the title
24602 </p>
24603 !! end
24604
24605 !! test
24606 Page status indicators: Empty name is invalid
24607 !! options
24608 showindicators
24609 !! wikitext
24610 <indicator name=" "></indicator>
24611 <indicator></indicator>
24612 !! html/php
24613 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24614 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24615 </p>
24616 !! end
24617
24618 !! test
24619 Page status indicators: Weird syntaxes that are okay
24620 !! options
24621 showindicators
24622 !! wikitext
24623 <indicator name="empty" />
24624 <indicator name="name"></indicator>
24625 !! html/php
24626 empty=
24627 name=
24628 <p><br />
24629 </p>
24630 !! end
24631
24632 !! test
24633 Page status indicators: Torture test
24634 !! options
24635 showindicators
24636 !! wikitext
24637 <indicator name="01">hello world</indicator>
24638 <indicator name="02">[[Main Page]]</indicator>
24639 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
24640 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
24641 <indicator name="05">*foo
24642 *bar</indicator>
24643 <indicator name="06"><nowiki>foo</nowiki></indicator>
24644 <indicator name="07"> Preformatted</indicator>
24645 <indicator name="08"><div>Broken tag</indicator>
24646 <indicator name="09">{| class=wikitable
24647 |cell
24648 |}</indicator>
24649 <indicator name="10">Two
24650
24651 paragraphs</indicator>
24652 !! html/php
24653 01=hello world
24654 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
24655 03=<img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg" 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" />
24656 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" 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>
24657 05=<ul><li>foo</li>
24658 <li>bar</li></ul>
24659
24660 06=foo
24661 07=<pre>Preformatted
24662 </pre>
24663 08=<div>Broken tag</div>
24664
24665 09=<table class="wikitable">
24666 <tr>
24667 <td>cell
24668 </td></tr></table>
24669
24670 10=<p>Two
24671 </p><p>paragraphs
24672 </p>
24673 <p><br />
24674 </p><p><br />
24675 </p><p><br />
24676 </p><p><br />
24677 </p><p><br />
24678 </p>
24679 !! end
24680
24681 !! test
24682 preload: check <noinclude> and <includeonly>
24683 !! options
24684 preload
24685 !! wikitext
24686 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
24687 !! html/php
24688 Hello kind world.
24689 !! end
24690
24691 !! test
24692 preload: check <onlyinclude>
24693 !! options
24694 preload
24695 !! wikitext
24696 Goodbye <onlyinclude>Hello world</onlyinclude>
24697 !! html/php
24698 Hello world
24699 !! end
24700
24701 !! test
24702 preload: can pass tags through if we want to
24703 !! options
24704 preload
24705 !! wikitext
24706 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
24707 !! html/php
24708 <includeonly>Hello world</includeonly>
24709 !! end
24710
24711 !! test
24712 preload: check that it doesn't try to do tricks
24713 !! options
24714 preload
24715 !! wikitext
24716 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24717 !! html/php
24718 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24719 !! end
24720
24721 !! test
24722 Play a bit with r67090 and T5158
24723 !! wikitext
24724 <div style="width:50% !important">&nbsp;</div>
24725 <div style="width:50%&nbsp;!important">&nbsp;</div>
24726 <div style="width:50%&#160;!important">&nbsp;</div>
24727 <div style="border : solid;">&nbsp;</div>
24728 !! html/php
24729 <div style="width:50% !important">&#160;</div>
24730 <div style="width:50% !important">&#160;</div>
24731 <div style="width:50% !important">&#160;</div>
24732 <div style="border&#32;: solid;">&#160;</div>
24733
24734 !! html/parsoid
24735 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24736 <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>
24737 <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>
24738 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24739
24740 !! end
24741
24742 !! test
24743 French spaces in wikitext
24744 !! wikitext
24745 foo ! bar ? bat 50 % is less than 75 %.
24746
24747 Hello : this ; is « something ‹ else › again »
24748 !! html
24749 <p>foo&#160;! bar&#160;? bat 50&#160;% is less than 75&#160;%.
24750 </p><p>Hello&#160;: this&#160;; is «&#160;something ‹&#160;else&#160;› again&#160;»
24751 </p>
24752 !! end
24753
24754 # It would be reasonable for Parsoid and PHP to differ here.
24755 # The PHP behavior is arguably a bug.
24756 !! test
24757 Corner case: french spaces in definition list
24758 !! wikitext
24759 ;foo : bar
24760 !! html+tidy
24761 <dl><dt>foo&#160;</dt>
24762 <dd>bar</dd></dl>
24763 !! end
24764
24765 !! test
24766 T5158: Test for French spaces in attributes
24767 !! wikitext
24768 <br style=" clear : both ; " />
24769 !! html/php
24770 <p><br style="clear&#32;: both&#32;;" />
24771 </p>
24772 !! end
24773
24774 !! test
24775 HTML5 data attributes
24776 !! wikitext
24777 <span data-foo="bar">Baz</span>
24778 <p data-abc-def_hij="">Quuz</p>
24779 !! html/php
24780 <p><span data-foo="bar">Baz</span>
24781 </p>
24782 <p data-abc-def_hij="">Quuz</p>
24783
24784 !! html/parsoid
24785 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
24786 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
24787 !! end
24788
24789 !! test
24790 Strip reserved data attributes
24791 !! wikitext
24792 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
24793 !! html/php
24794 <div data-ok="fred">d</div>
24795
24796 !! html/parsoid
24797 <div data-x-data-mw="foo" data-x-data-parsoid="bar" data-x-data-mw-someext="baz" data-ok="fred" data-parsoid='{"stx":"html","a":{"data-ooui":null,"data-bad:ns":null},"sa":{"data-ooui":"xyzzy","data-bad:ns":"ns"}}'>d</div>
24798 !! end
24799
24800 !! test
24801 percent-encoding and + signs in internal links (T28410)
24802 !! wikitext
24803 [[User:+%]] [[Page+title%]]
24804 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
24805 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
24806 [[%33%45]] [[%33%45+]]
24807 !! html/php
24808 <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>
24809 <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>
24810 <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>
24811 <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>
24812 </p>
24813 !! html/parsoid
24814 <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>
24815 <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>
24816 <a rel="mw:WikiLink" href="./%25" title="%" data-parsoid='{"stx":"simple","a":{"href":"./%25"},"sa":{"href":"%"}}'>%</a> <a rel="mw:WikiLink" href="./+" title="+" data-parsoid='{"stx":"simple","a":{"href":"./+"},"sa":{"href":"+"}}'>+</a> <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bar\"},\"sa\":{\"href\":\"bar\"},\"dsr\":[94,101,2,2]}&#39;>bar&lt;/a>"}'><a href="./File:%25+abc9" data-parsoid='{"a":{"href":"./File:%25+abc9"},"sa":{}}'><img resource="./File:%25+abc9" src="./Special:FilePath/%25+abc9" height="220" width="220" data-parsoid='{"a":{"resource":"./File:%25+abc9","height":"220","width":"220"},"sa":{"resource":"File:%+abc%39"}}'/></a></figure-inline>
24817 <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>
24818 !! end
24819
24820 !! test
24821 Special characters in embedded file links (T29679)
24822 !! wikitext
24823 [[File:Contains & ampersand.jpg]]
24824 [[File:Does not exist.jpg|Title with & ampersand]]
24825 !! html/php
24826 <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>
24827 <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>
24828 </p>
24829 !! html/parsoid
24830 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Contains_&amp;_ampersand.jpg"><img resource="./File:Contains_&amp;_ampersand.jpg" src="./Special:FilePath/Contains_&amp;_ampersand.jpg" height="220" width="220"/></a></figure-inline>
24831 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"Title with &amp;amp; ampersand"}'><a href="./File:Does_not_exist.jpg"><img resource="./File:Does_not_exist.jpg" src="./Special:FilePath/Does_not_exist.jpg" height="220" width="220"/></a></figure-inline></p>
24832 !! end
24833
24834 !! test
24835 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
24836 !! wikitext
24837 Text&apos;s been normalized?
24838 !! html
24839 <p>Text&#39;s been normalized?
24840 </p>
24841 !! end
24842
24843 !! test
24844 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
24845 !! wikitext
24846 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
24847 !! html
24848 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
24849 </p>
24850 !! end
24851
24852 !! test
24853 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
24854 !! wikitext
24855 [http://www.example.org/ ideograms]
24856 !! html
24857 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
24858 </p>
24859 !! end
24860
24861 !! test
24862 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
24863 !! wikitext
24864 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
24865 !! html
24866 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
24867 </p>
24868 !! end
24869
24870 !! article
24871 Mediawiki:loop1
24872 !! text
24873 {{Identical|A}}
24874 !! endarticle
24875
24876 !! article
24877 Mediawiki:loop2
24878 !! text
24879 {{Identical|B}}
24880 !! endarticle
24881
24882 !! article
24883 Template:Identical
24884 !! text
24885 {{int:loop1}}
24886 {{int:loop2}}
24887 !! endarticle
24888
24889 !! test
24890 T33098 Template which includes system messages which includes the template
24891 !! wikitext
24892 {{Identical}}
24893 !! html
24894 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24895 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24896 </p>
24897 !! end
24898
24899 !! test
24900 T33490 Turkish: ucfirst 'blah'
24901 !! options
24902 language=tr
24903 !! wikitext
24904 {{ucfirst:blah}}
24905 !! html
24906 <p>Blah
24907 </p>
24908 !! end
24909
24910 !! test
24911 T33490 Turkish: ucfirst 'ix'
24912 !! options
24913 language=tr
24914 !! wikitext
24915 {{ucfirst:ix}}
24916 !! html
24917 <p>İx
24918 </p>
24919 !! end
24920
24921 !! test
24922 T33490 Turkish: lcfirst 'BLAH'
24923 !! options
24924 language=tr
24925 !! wikitext
24926 {{lcfirst:BLAH}}
24927 !! html
24928 <p>bLAH
24929 </p>
24930 !! end
24931
24932 !! test
24933 T33490 Turkish: ucfırst (with a dotless i)
24934 !! options
24935 language=tr
24936 !! wikitext
24937 {{ucfırst:blah}}
24938 !! html
24939 <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>
24940 </p>
24941 !! end
24942
24943 !! test
24944 T33490 ucfırst (with a dotless i) with English language
24945 !! options
24946 language=en
24947 !! wikitext
24948 {{ucfırst:blah}}
24949 !! html
24950 <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>
24951 </p>
24952 !! end
24953
24954 # Note that Parsoid doesn't emit an explicit TOC.
24955 # Note also that the html2wt direction tends to emit an extra newline
24956 # between the __TOC__ magicword and the first heading unless *both*
24957 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24958 # it's "{}").
24959
24960 !! test
24961 T28375: TOC with italics
24962 !! options
24963 title=[[Main Page]]
24964 !! wikitext
24965 __TOC__
24966 ==''Lost'' episodes==
24967 !! html/php
24968 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
24969 <ul>
24970 <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
24971 </ul>
24972 </div>
24973
24974 <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>
24975
24976 !! html/parsoid
24977 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24978 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24979 !! end
24980
24981 !! test
24982 T28375: TOC with bold
24983 !! options
24984 title=[[Main Page]]
24985 !! wikitext
24986 __TOC__
24987 =='''should be bold''' then normal text==
24988 !! html/php
24989 <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>
24990 <ul>
24991 <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>
24992 </ul>
24993 </div>
24994
24995 <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>
24996
24997 !! html/parsoid
24998 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24999 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
25000 !! end
25001
25002 !! test
25003 T35845: Headings become cursive in TOC when they contain an image
25004 !! options
25005 title=[[Main Page]]
25006 !! wikitext
25007 __TOC__
25008 ==Image [[Image:foobar.jpg]]==
25009 !! html/php
25010 <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>
25011 <ul>
25012 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
25013 </ul>
25014 </div>
25015
25016 <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" 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>
25017
25018 !! html/parsoid
25019 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25020 <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>
25021 !! end
25022
25023 !! test
25024 T35845 (2): Headings become bold in TOC when they contain a blockquote
25025 !! options
25026 title=[[Main Page]]
25027 !! wikitext
25028 __TOC__
25029 ==<blockquote>Quote</blockquote>==
25030 !! html/php
25031 <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>
25032 <ul>
25033 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
25034 </ul>
25035 </div>
25036
25037 <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>
25038
25039 !! html/php+tidy
25040 <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>
25041 <ul>
25042 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
25043 </ul>
25044 </div>
25045
25046 <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>
25047 !! html/parsoid
25048 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25049 <h2 id="Quote" data-parsoid='{}'><blockquote><p>Quote</p></blockquote></h2>
25050 !! end
25051
25052 !! test
25053 Unclosed tags in TOC
25054 !! config
25055 wgFragmentMode=[ 'html5', 'legacy' ]
25056 !! options
25057 title=[[Main Page]]
25058 !! wikitext
25059 __TOC__
25060 ==Proof: 2 < 3==
25061 <small>Hanc marginis exiguitas non caperet.</small>
25062 QED
25063 !! html/php
25064 <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>
25065 <ul>
25066 <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>
25067 </ul>
25068 </div>
25069
25070 <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>
25071 <p><small>Hanc marginis exiguitas non caperet.</small>
25072 QED
25073 </p>
25074 !! html/parsoid
25075 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25076 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
25077 <p><small>Hanc marginis exiguitas non caperet.</small>
25078 QED</p>
25079 !! end
25080
25081 !! test
25082 Multiple tags in TOC
25083 !! wikitext
25084 __TOC__
25085 ==<i>Foo</i> <b>Bar</b>==
25086
25087 ==<i>Foo</i> <blockquote>Bar</blockquote>==
25088 !! html/php
25089 <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>
25090 <ul>
25091 <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>
25092 <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>
25093 </ul>
25094 </div>
25095
25096 <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>
25097 <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>
25098
25099 !! html/php+tidy
25100 <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>
25101 <ul>
25102 <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>
25103 <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>
25104 </ul>
25105 </div>
25106
25107 <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>
25108 <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>
25109 !! html/parsoid
25110 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25111 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
25112
25113 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote><p>Bar</p></blockquote></h2>
25114 !! end
25115
25116 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
25117 # html5 tag parsing.
25118 !! test
25119 Tags with parameters in TOC
25120 !! options
25121 parsoid=wt2html
25122 !! wikitext
25123 __TOC__
25124 ==<sup class="in-h2">Hello</sup>==
25125
25126 ==<sup class="a > b">Evilbye</sup>==
25127 !! html/php
25128 <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>
25129 <ul>
25130 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
25131 <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>
25132 </ul>
25133 </div>
25134
25135 <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>
25136 <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>
25137
25138 !! html/parsoid
25139 <meta property="mw:PageProp/toc" />
25140 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
25141
25142 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
25143 !! end
25144
25145 !! test
25146 span tags with directionality in TOC
25147 !! wikitext
25148 __TOC__
25149 ==<span dir="ltr">C++</span>==
25150
25151 ==<span dir="rtl">זבנג!</span>==
25152
25153 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
25154
25155 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
25156
25157 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
25158 !! html/php
25159 <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>
25160 <ul>
25161 <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>
25162 <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>
25163 <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>
25164 <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>
25165 <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>
25166 </ul>
25167 </div>
25168
25169 <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>
25170 <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>
25171 <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>
25172 <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>
25173 <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>
25174
25175 !! html/parsoid
25176 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25177 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
25178 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
25179 <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>
25180 <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>
25181 <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>
25182 !! end
25183
25184 !! test
25185 T74884: bdi element in ToC
25186 !! wikitext
25187 __TOC__
25188 ==<bdi>test</bdi>==
25189 !! html/php
25190 <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>
25191 <ul>
25192 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
25193 </ul>
25194 </div>
25195
25196 <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>
25197
25198 !! html/parsoid
25199 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25200 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
25201 !! end
25202
25203 !! test
25204 T35715: s/strike element in ToC
25205 !! wikitext
25206 __TOC__
25207 ==<s>test</s> test <strike>test</strike>==
25208 !! html/php
25209 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
25210 <ul>
25211 <li class="toclevel-1 tocsection-1"><a href="#test_test_test"><span class="tocnumber">1</span> <span class="toctext"><s>test</s> test <strike>test</strike></span></a></li>
25212 </ul>
25213 </div>
25214
25215 <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>
25216
25217 !! html/parsoid
25218 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25219 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
25220 !! end
25221
25222 !! test
25223 T198618: style element in ToC
25224 !! options
25225 styletag=1
25226 !! wikitext
25227 __TOC__
25228 ==<style>.foo {}</style>Style<style>.bar {}</style>==
25229 !! html/php
25230 <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>
25231 <ul>
25232 <li class="toclevel-1 tocsection-1"><a href="#Style"><span class="tocnumber">1</span> <span class="toctext">Style</span></a></li>
25233 </ul>
25234 </div>
25235
25236 <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>
25237
25238 !! html/parsoid
25239 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25240 <h2 id="Style" data-parsoid='{}'><style>.foo {}</style>Style<style>.bar {}</style></h2>
25241 !! end
25242
25243 !! test
25244 Empty <p> tag in TOC, removed by Sanitizer (T92892)
25245 !! wikitext
25246 __TOC__
25247 ==x==
25248 !! html/php
25249 <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>
25250 <ul>
25251 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
25252 </ul>
25253 </div>
25254
25255 <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>
25256
25257 !! html/parsoid
25258 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25259 <h2 id="x" data-parsoid='{}'>x</h2>
25260 !! end
25261
25262 !! article
25263 MediaWiki:T34057
25264 !! text
25265 == {{int:headline_sample}} ==
25266 !! endarticle
25267
25268 !! test
25269 T34057: Title needed when expanding <h> nodes.
25270 !! options
25271 title=[[Main Page]]
25272 !! wikitext
25273 {{int:T34057}}
25274 !! html
25275 <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>
25276
25277 !! end
25278
25279 !! test
25280 Strip marker in urlencode
25281 !! wikitext
25282 {{urlencode:x<nowiki/>y}}
25283 {{urlencode:x<nowiki/>y|wiki}}
25284 {{urlencode:x<nowiki/>y|path}}
25285 {{urlencode:x<pre id="one">two</pre>y}}
25286 !! html/php
25287 <p>xy
25288 xy
25289 xy
25290 xy
25291 </p>
25292 !! end
25293
25294 !! test
25295 Strip marker in lc
25296 !! wikitext
25297 {{lc:x<nowiki/>y}}
25298 !! html
25299 <p>xy
25300 </p>
25301 !! end
25302
25303 !! test
25304 Strip marker in uc
25305 !! wikitext
25306 {{uc:x<nowiki/>y}}
25307 !! html
25308 <p>XY
25309 </p>
25310 !! end
25311
25312 !! test
25313 Strip marker in formatNum
25314 !! wikitext
25315 {{formatnum:1<nowiki/>2}}
25316 {{formatnum:1<nowiki/>2|R}}
25317 !! html
25318 <p>12
25319 12
25320 </p>
25321 !! end
25322
25323 !! test
25324 Check noCommafy in formatNum
25325 !! options
25326 language=be-tarask
25327 !! wikitext
25328 {{formatnum:123456.78}}
25329 {{formatnum:123456.78|NOSEP}}
25330 !! html
25331 <p>123 456,78
25332 123456.78
25333 </p>
25334 !! end
25335
25336 !! test
25337 Wrong option for formatNum (T58199)
25338 !! wikitext
25339 {{formatnum:1,234.56|Random}}
25340 {{formatnum:1,234.56|EVERYTHING}}
25341 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
25342 !! html
25343 <p>1,234.56
25344 1,234.56
25345 1,234.56
25346 </p>
25347 !! end
25348
25349 !! test
25350 Strip marker in grammar
25351 !! options
25352 language=fi
25353 !! wikitext
25354 {{grammar:elative|foo<nowiki/>bar}}
25355 !! html
25356 <p>foobarista
25357 </p>
25358 !! end
25359
25360 !! test
25361 Strip marker in padleft
25362 !! wikitext
25363 {{padleft:|2|x<nowiki/>y}}
25364 !! html
25365 <p>xy
25366 </p>
25367 !! end
25368
25369 !! test
25370 Strip marker in padright
25371 !! wikitext
25372 {{padright:|2|x<nowiki/>y}}
25373 !! html
25374 <p>xy
25375 </p>
25376 !! end
25377
25378 !! test
25379 Strip marker in anchorencode
25380 !! wikitext
25381 {{anchorencode:x<nowiki/>y}}
25382 !! html/php
25383 <p>xy
25384 </p>
25385 !! html/parsoid
25386 <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>
25387 !! end
25388
25389 !! test
25390 nowiki inside link inside heading (T20295)
25391 !! wikitext
25392 ==[[foo|x<nowiki>y</nowiki>z]]==
25393 !! html
25394 <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>
25395
25396 !! end
25397
25398 !! test
25399 new support for bdi element (T33817)
25400 !! wikitext
25401 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25402 !! html
25403 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25404
25405 !!end
25406
25407 !! test
25408 Ignore pipe between table row attributes
25409 !! wikitext
25410 {|
25411 |quux
25412 |- id=foo | style='color: red'
25413 |bar
25414 |}
25415 !! html
25416 <table>
25417 <tr>
25418 <td>quux
25419 </td></tr>
25420 <tr id="foo" style="color: red">
25421 <td>bar
25422 </td></tr></table>
25423
25424 !! end
25425
25426 !!test
25427 Language parser function
25428 !! wikitext
25429 {{#language:ar}}
25430 !! html
25431 <p>العربية
25432 </p>
25433 !! end
25434
25435 !!test
25436 Padleft and padright (default 0-padding)
25437 !! wikitext
25438 {{padleft:xyz|5}}
25439 {{padright:xyz|5}}
25440 !! html/php
25441 <p>00xyz
25442 xyz00
25443 </p>
25444 !! html/parsoid
25445 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
25446 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
25447 !! end
25448
25449 !!test
25450 Padleft and padright (partial fill)
25451 !! wikitext
25452 {{padleft:xyz|6|ab}}
25453 {{padright:xyz|6|ab}}
25454 !! html/php
25455 <p>abaxyz
25456 xyzaba
25457 </p>
25458 !! html/parsoid
25459 <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>
25460 <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>
25461 !! end
25462
25463 !!test
25464 Padleft and padright as substr
25465 !! wikitext
25466 {{padleft:|3|abcde}}
25467 {{padright:|3|abcde}}
25468 !! html/php
25469 <p>abc
25470 abc
25471 </p>
25472 !! html/parsoid
25473 <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>
25474 <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>
25475 !! end
25476
25477 !! test
25478 Padleft and padright with non-numerical length (T180403)
25479 !! wikitext
25480 {{padleft:abcdef|junk}}
25481 {{padright:abcdef|junk}}
25482 !! html/php
25483 <p>abcdef
25484 abcdef
25485 </p>
25486 !! end
25487
25488 !!test
25489 Special parser function
25490 !! wikitext
25491 {{#special:RandomPage}}
25492 {{#special:BaDtItLe}}
25493 {{#special:Foobar}}
25494 !! html
25495 <p>Special:Random
25496 Special:Badtitle
25497 Special:Foobar
25498 </p>
25499 !! end
25500
25501 !!test
25502 T36939 - Case insensitive link parsing ([HttP://])
25503 !! wikitext
25504 [HttP://MediaWiki.Org/]
25505 !! html/php
25506 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
25507 </p>
25508 !! html/parsoid
25509 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
25510 !! end
25511
25512 !!test
25513 T36939 - Case insensitive link parsing ([HttP:// title])
25514 !! wikitext
25515 [HttP://MediaWiki.Org/ MediaWiki]
25516 !! html
25517 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
25518 </p>
25519 !! end
25520
25521 !!test
25522 T36939 - Case insensitive link parsing (HttP://)
25523 !! wikitext
25524 HttP://MediaWiki.Org/
25525 !! html/php
25526 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
25527 </p>
25528 !! html/parsoid
25529 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
25530 !! end
25531
25532 !!test
25533 Disable TOC
25534 !! options
25535 notoc
25536 !! wikitext
25537 Lead
25538 ==Section 1==
25539 ==Section 2==
25540 ==Section 3==
25541 ==Section 4==
25542 ==Section 5==
25543 !! html
25544 <p>Lead
25545 </p>
25546
25547 <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>
25548 <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>
25549 <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>
25550 <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>
25551 <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>
25552
25553 !! end
25554
25555
25556 ###
25557 ### Parsoid-specific tests
25558 ### Parsoid-PHP parser incompatibilities
25559 ###
25560 !!test
25561 1. SOL-sensitive wikitext tokens as template-args
25562 !!options
25563 parsoid=wt2html,wt2wt
25564 !! wikitext
25565 {{echo|*a}}
25566 {{echo|#a}}
25567 {{echo|:a}}
25568 !! html
25569 <span about="#mwt1" typeof="mw:Transclusion">
25570 </span><ul about="#mwt1"><li>a</li>
25571 </ul>
25572 <span about="#mwt2" typeof="mw:Transclusion">
25573 </span><ol about="#mwt2"><li>a</li>
25574 </ol>
25575 <span about="#mwt3" typeof="mw:Transclusion">
25576 </span><dl about="#mwt3"><dd>a</dd>
25577 </dl>
25578 !!end
25579
25580 #### -----------------------------------------------------------------
25581 #### Parsoid-specific functionality tests
25582 #### -----------------------------------------------------------------
25583
25584 # T65642/T68749: Formatting elt fixup around images.
25585 # We know wt2wt will fail, but we expect selser to pass.
25586 # Due to the nature of our testing, wt2wt and selser tests will enter the
25587 # blacklist and we'll catch selser regressions based on changes to the
25588 # blacklist entries for selser tests.
25589 !! test
25590 1. Treebuilder fixup of formatting elt
25591 !! options
25592 parsoid=wt2html,wt2wt
25593 !! wikitext
25594 {|
25595 |
25596 <small>
25597 [[Image:Foobar.jpg|right|Test]]
25598 </small>
25599 |}
25600 !! html/php+tidy
25601 <table>
25602 <tbody><tr>
25603 <td>
25604 <p><small>
25605 </small></p><small>
25606 <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" width="1941" height="220" /></a></div>
25607 </small><p><small></small>
25608 </p>
25609 </td></tr></tbody></table>
25610 !! html/parsoid
25611 <table>
25612 <tbody><tr><td>
25613 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
25614 <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>
25615 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p></td></tr>
25616 </tbody></table>
25617 !! end
25618
25619 !! test
25620 2. Treebuilder fixup of formatting elt
25621 !! options
25622 parsoid=wt2html,wt2wt
25623 !! wikitext
25624 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
25625
25626 <small>[[Image:Foobar.jpg|right|300px]]</small>
25627 !! html/php+tidy
25628 <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" 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>
25629 </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" 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>
25630 !! html/parsoid
25631 <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>
25632
25633 <small><figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure></small>
25634 !! end
25635
25636 !! test
25637 3. Treebuilder fixup of formatting elt
25638 !! options
25639 parsoid=wt2html,wt2wt
25640 !! wikitext
25641 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
25642 !! html/php+tidy
25643 <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" 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>
25644 </p>
25645 !! html/parsoid
25646 <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>
25647 !! end
25648
25649 !! test
25650 4. Treebuilder fixup of formatting elt: formatting tags around captionless images
25651 !! options
25652 parsoid=wt2html,wt2wt
25653 !! wikitext
25654 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
25655 !! html/php+tidy
25656 <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" 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>
25657 !! html/parsoid
25658 <b><small><figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure></small></b>
25659 !! end
25660
25661 #### ----------------------------------------------------------------
25662 #### Parsoid-only testing of Parsoid's impl of LST
25663 #### Not implemented yet, see
25664 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
25665 #### ----------------------------------------------------------------
25666
25667 ## We still need to support serializing the older format while content is stored.
25668 !! test
25669 LST Sections: Backwards compatibility
25670 !! options
25671 parsoid={
25672 "suppressErrors": true,
25673 "modes": ["html2wt"]
25674 }
25675 !! wikitext
25676 <section begin="2011-05-16" />
25677 <section end="2014-04-10 (MW 1.23wmf22)" />
25678 !! html/parsoid
25679 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
25680 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
25681 !! end
25682
25683 !! test
25684 LST Sections: Newfangled approach
25685 !! wikitext
25686 <section begin="2011-05-16" />
25687 <section end="2014-04-10 (MW 1.23wmf22)" />
25688 !! html/parsoid
25689 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"}}'>
25690 </span>
25691 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"}}'>
25692 </span></p>
25693 !! end
25694
25695 #--------- Test stripping of empty nodes in template content ----------
25696
25697 !! test
25698 Empty LI and TR nodes should be stripped from template content
25699 !! wikitext
25700 {{EmptyLITest}}
25701 {{EmptyTRTest}}
25702 !! html/parsoid
25703 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
25704 <li>a</li>
25705 <li>b</li>
25706 </ul>
25707 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
25708 <tbody>
25709 <tr>
25710 <td>foo</td>
25711 </tr>
25712 <tr>
25713 <td>bar</td>
25714 </tr>
25715 </tbody>
25716 </table>
25717 !! end
25718
25719 !! test
25720 Empty LI and TR nodes should not be stripped from top-level content
25721 !! wikitext
25722 *a
25723 *
25724 *b
25725
25726 {|
25727 |-
25728 |-
25729 |foo
25730 |}
25731 !! html/parsoid
25732 <ul>
25733 <li>a</li>
25734 <li class='mw-empty-elt'></li>
25735 <li>b</li>
25736 </ul>
25737 <table>
25738 <tbody>
25739 <tr class='mw-empty-elt'></tr>
25740 <tr>
25741 <td>foo</td>
25742 </tr>
25743 </tbody>
25744 </table>
25745 !! end
25746
25747 !! test
25748 Empty TR nodes should not be stripped if they have any attributes set
25749 !! wikitext
25750 {{EmptyTRWithHTMLAttrTest}}
25751 !! html/parsoid
25752 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
25753 <tr align='center'></tr>
25754 <tr><td>foo</td></tr>
25755 <tr align='center'></tr>
25756 <tr><td>bar</td></tr>
25757 </table>
25758 !! end
25759
25760 #### ----------------------------------------------------------------
25761 #### The following section of tests are primarily to test
25762 #### wikitext escaping capabilities of Parsoid. Given that
25763 #### escaping can be done any number of ways, the wikitext (input)
25764 #### is always adjusted to reflect how Parsoid adds nowiki
25765 #### escape tags.
25766 ####
25767 #### We are marking several tests as parsoid-only since the
25768 #### HTML in the result section is different from what the
25769 #### PHP parser generates for it.
25770 #### ----------------------------------------------------------------
25771
25772
25773 #### --------------- Headings ---------------
25774 #### 0. Unnested
25775 #### 1. Nested inside html <h1>=foo=</h1>
25776 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
25777 #### 3. Nested inside html with wikitext split by html tags
25778 #### 4. No escape needed
25779 #### 5. Empty headings <h1></h1>
25780 #### 6. Heading chars in SOL context
25781 #### ----------------------------------------
25782 !! test
25783 Headings: 0. Unnested
25784 !! options
25785 parsoid=html2wt
25786 !! html/parsoid
25787 <p>=foo=</p>
25788
25789 <p> =foo=
25790 <!--cmt-->
25791 =foo=</p>
25792
25793 <p>=foo<i>a</i>=</p>
25794 !! wikitext
25795 <nowiki>=foo=</nowiki>
25796
25797 <nowiki> </nowiki>=foo=
25798 <!--cmt-->
25799 <nowiki>=foo=</nowiki>
25800
25801 =foo''a''<nowiki>=</nowiki>
25802 !!end
25803
25804 # New headings and existing headings are handled differently
25805 !! test
25806 Headings: 1. Nested inside html
25807 !! options
25808 parsoid=html2wt
25809 !! html/parsoid
25810 <h1>=foo=</h1>
25811 <h2>=foo=</h2>
25812 <h3>=foo=</h3>
25813
25814 <h1 data-parsoid=''>=foo=</h1>
25815 <h2 data-parsoid=''>=foo=</h2>
25816 <h3 data-parsoid=''>=foo=</h3>
25817 <h4 data-parsoid=''>=foo=</h4>
25818 <h5 data-parsoid=''>=foo=</h5>
25819 <h6 data-parsoid=''>=foo=</h6>
25820 !! wikitext
25821 = =foo= =
25822
25823 == =foo= ==
25824
25825 === =foo= ===
25826
25827 =<nowiki>=foo=</nowiki>=
25828 ==<nowiki>=foo=</nowiki>==
25829 ===<nowiki>=foo=</nowiki>===
25830 ====<nowiki>=foo=</nowiki>====
25831 =====<nowiki>=foo=</nowiki>=====
25832 ======<nowiki>=foo=</nowiki>======
25833
25834 !!end
25835
25836 !! test
25837 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
25838 !! options
25839 parsoid=html2wt
25840 !! html/parsoid
25841 <h1>foo</h1>*bar
25842 <h1>foo</h1>=bar
25843 <h1>foo</h1>=bar=
25844 !! wikitext
25845 = foo =
25846 <nowiki>*</nowiki>bar
25847
25848 = foo =
25849 =bar
25850
25851 = foo =
25852 <nowiki>=bar=</nowiki>
25853 !!end
25854
25855 !! test
25856 Headings: 3. Nested inside html with wikitext split by html tags
25857 !! options
25858 parsoid=html2wt
25859 !! html/parsoid
25860 <h1>=<b>bold</b>foo=</h1>
25861 !! wikitext
25862 = ='''bold'''foo= =
25863 !!end
25864
25865 !! test
25866 Headings: 4a. No escaping needed (testing just h1 and h2)
25867 !! options
25868 parsoid=html2wt
25869 !! html/parsoid
25870 <h1>=foo</h1>
25871 <h1>foo=</h1>
25872 <h1> =foo= </h1>
25873 <h1>=foo= bar</h1>
25874 <h2>=foo</h2>
25875 <h2>foo=</h2>
25876 <h1>=</h1>
25877 <h1><i>=</i>foo=</h1>
25878 !! wikitext
25879 = =foo =
25880
25881 = foo= =
25882
25883 = =foo= =
25884
25885 = =foo= bar =
25886
25887 == =foo ==
25888
25889 == foo= ==
25890
25891 = = =
25892
25893 = ''=''foo= =
25894 !!end
25895
25896 !! test
25897 Headings: 4b. No escaping needed (inside p-tags)
25898 !! options
25899 parsoid=html2wt
25900 !! html/parsoid
25901 <p>=foo= x
25902 =foo= <s></s>
25903 </p>
25904 !! wikitext
25905 =foo= x
25906 =foo= <s></s>
25907 !! html/php
25908 <p>=foo= x
25909 =foo= <s></s>
25910 </p>
25911 !!end
25912
25913 !! test
25914 Headings: 4c. Short headings (1)
25915 !! options
25916 parsoid=html2wt
25917 !! html/parsoid
25918 <p>===
25919 </p>
25920 !! wikitext
25921 <nowiki>===</nowiki>
25922 !! html/php
25923 <p>===
25924 </p>
25925 !! end
25926
25927 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
25928 !! test
25929 Headings: 4d. Short headings (2)
25930 !! options
25931 parsoid=wt2html,html2html
25932 !! wikitext
25933 =
25934 ==
25935 ===
25936 ====
25937 =====
25938 !! html/php
25939 <p>=
25940 ==
25941 </p>
25942 <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>
25943 <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>
25944 <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>
25945
25946 !! html/parsoid
25947 <p>=
25948 ==</p>
25949 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
25950 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
25951 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
25952 !! end
25953
25954 !! test
25955 Headings: 5. Empty headings
25956 !! options
25957 parsoid=html2wt
25958 !! html/parsoid
25959 <h1 data-parsoid='{}'></h1>
25960
25961 <h2 data-parsoid='{}'></h2>
25962
25963 <h3 data-parsoid='{}'></h3>
25964
25965 <h4 data-parsoid='{}'></h4>
25966
25967 <h5 data-parsoid='{}'></h5>
25968
25969 <h6 data-parsoid='{}'></h6>
25970 !! wikitext
25971 =<nowiki/>=
25972
25973 ==<nowiki/>==
25974
25975 ===<nowiki/>===
25976
25977 ====<nowiki/>====
25978
25979 =====<nowiki/>=====
25980
25981 ======<nowiki/>======
25982 !!end
25983
25984 !! test
25985 Headings: 6a. Heading chars in SOL context (with trailing spaces)
25986 !! options
25987 parsoid=html2wt
25988 !! html/parsoid
25989 <p>=a=</p>
25990
25991 <p>=a=</p>
25992
25993 <p>=a=</p>
25994 !! wikitext
25995 <nowiki>=a=</nowiki>
25996
25997 <nowiki>=a=</nowiki>
25998
25999 <nowiki>=a=</nowiki>
26000 !!end
26001
26002 !! test
26003 Headings: 6b. Heading chars in SOL context (with trailing newlines)
26004 !! options
26005 parsoid=html2wt
26006 !! html/parsoid
26007 <p>=a=
26008 b</p>
26009
26010 <p>=a=
26011 b</p>
26012
26013 <p>=a=
26014 b</p>
26015 !! wikitext
26016 <nowiki>=a=</nowiki>
26017 b
26018
26019 <nowiki>=a=</nowiki>
26020 b
26021
26022 <nowiki>=a=</nowiki>
26023 b
26024 !!end
26025
26026 !! test
26027 Headings: 6c. Heading chars in SOL context (leading newline break)
26028 !! options
26029 parsoid=html2wt
26030 !! html/parsoid
26031 <p>a
26032 =b=</p>
26033 !! wikitext
26034 a
26035 <nowiki>=b=</nowiki>
26036 !!end
26037
26038 !! test
26039 Headings: 6d. Heading chars in SOL context (with interspersed comments)
26040 !! options
26041 parsoid=html2wt
26042 !! html/parsoid
26043 <!--c0--><p>=a=</p>
26044
26045 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
26046 !! wikitext
26047 <!--c0--><nowiki>=a=</nowiki>
26048
26049 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
26050 !!end
26051
26052 !! test
26053 Headings: 6d. Heading chars in SOL context (No escaping needed)
26054 !! options
26055 parsoid=html2wt
26056 !! html/parsoid
26057 =a=<div>b</div>
26058 !! wikitext
26059 =a=<div>b</div>
26060 !!end
26061
26062 !! test
26063 Headings: 7. Insert a newline between new content and headings
26064 !! options
26065 parsoid=html2wt
26066 !! html/parsoid
26067 <h2>NEW</h2>
26068 <p>new</p>
26069 <h2 data-parsoid='{}'>A</h2>
26070 <p data-parsoid='{}'>a</p>
26071 !! wikitext
26072 == NEW ==
26073 new
26074
26075 ==A==
26076 a
26077
26078 !! end
26079
26080 !! test
26081 Headings: Used as horizontal rule
26082 !! config
26083 wgFragmentMode=[ 'html5', 'legacy' ]
26084 !! options
26085 parsoid=wt2html
26086 !! wikitext
26087 ===============
26088 !! html/php
26089 <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>
26090
26091 !! html/parsoid
26092 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
26093 !! end
26094
26095 #### --------------- Lists ---------------
26096 #### 0. Outside nests (*foo, etc.)
26097 #### 1. Nested inside html <ul><li>*foo</li></ul>
26098 #### 2. Inside definition lists
26099 #### 3. Only bullets at start should be escaped
26100 #### 4. No escapes needed
26101 #### 5. No unnecessary escapes
26102 #### 6. Escape bullets in SOL position
26103 #### 7. Escape bullets in a multi-line context
26104 #### ----------------------------------------
26105
26106 !! test
26107 Lists: 0. Outside nests
26108 !! options
26109 parsoid=html2wt
26110 !! html/parsoid
26111 <p>*foo</p>
26112
26113 <p>#foo</p>
26114
26115 <p>;Foo:bar</p>
26116 !! wikitext
26117 <nowiki>*</nowiki>foo
26118
26119 <nowiki>#</nowiki>foo
26120
26121 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
26122 !!end
26123
26124 ## Making these next 3 tests Parsoid-only since they are html2wt tests
26125 ## to test wikitext escaping, and insignificant whitespace diffs
26126 ## cause PHP parser tests to barf
26127 !! test
26128 Lists: 1. Nested inside html (No unnecessary escapes)
26129 !! options
26130 parsoid=html2wt
26131 !! html/parsoid
26132 <ul>
26133 <li>*foo</li>
26134 <li>#foo</li>
26135 <li>:foo</li>
26136 <li>;foo</li>
26137 <li data-parsoid='{}'>*foo</li>
26138 <li data-parsoid='{}'>#foo</li>
26139 <li data-parsoid='{}'>:foo</li>
26140 <li data-parsoid='{}'>;foo</li>
26141 </ul>
26142
26143 <ol>
26144 <li>*foo</li>
26145 <li>#foo</li>
26146 <li>:foo</li>
26147 <li>;foo</li>
26148 <li data-parsoid='{}'>*foo</li>
26149 <li data-parsoid='{}'>#foo</li>
26150 <li data-parsoid='{}'>:foo</li>
26151 <li data-parsoid='{}'>;foo</li>
26152 </ol>
26153 !! wikitext
26154 * *foo
26155 * #foo
26156 * :foo
26157 * ;foo
26158 *<nowiki>*foo</nowiki>
26159 *<nowiki>#foo</nowiki>
26160 *<nowiki>:foo</nowiki>
26161 *<nowiki>;foo</nowiki>
26162
26163 # *foo
26164 # #foo
26165 # :foo
26166 # ;foo
26167 #<nowiki>*foo</nowiki>
26168 #<nowiki>#foo</nowiki>
26169 #<nowiki>:foo</nowiki>
26170 #<nowiki>;foo</nowiki>
26171 !!end
26172
26173 !! test
26174 Lists: 2. Inside definition lists
26175 !! options
26176 parsoid=html2wt
26177 !! html/parsoid
26178 <dl><dt>;foo</dt></dl>
26179 <dl><dt>:foo</dt></dl>
26180 <dl><dt>:foo</dt>
26181 <dd>bar</dd></dl>
26182 <dl><dd>:foo</dd></dl>
26183 !! wikitext
26184 ; ;foo
26185
26186 ; <nowiki>:foo</nowiki>
26187
26188 ; <nowiki>:foo</nowiki>
26189 : bar
26190
26191 : :foo
26192 !!end
26193
26194 !! test
26195 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
26196 !! options
26197 parsoid=html2wt
26198 !! html/parsoid
26199 <ul>
26200 <li>*foo*bar</li>
26201 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
26202 </ul>
26203 !! wikitext
26204 * *foo*bar
26205 *<nowiki>*foo</nowiki>''it''*bar
26206 !!end
26207
26208 !! test
26209 Lists: 4. No escapes needed
26210 !! options
26211 parsoid=html2wt
26212 !! html/parsoid
26213 <ul>
26214 <li>foo*bar
26215 </li>
26216 </ul>
26217 <ul>
26218 <li><i>foo</i>*bar
26219 </li>
26220 </ul>
26221 <ul>
26222 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
26223 </li>
26224 </ul>
26225 <ul>
26226 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
26227 </li>
26228 </ul>
26229 !! wikitext
26230 *foo*bar
26231
26232 *''foo''*bar
26233
26234 *[[Foo]]: bar
26235
26236 *[[Foo]]*bar
26237 !!end
26238
26239 !! test
26240 Lists: 5. No unnecessary escapes
26241 !! options
26242 parsoid=html2wt
26243 !! html/parsoid
26244 <ul><li> bar <span>[[foo]]</span></li></ul>
26245 <ul><li> =bar <span>[[foo]]</span></li></ul>
26246 <ul><li> [[bar <span>[[foo]]</span></li></ul>
26247 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
26248 <ul><li> =bar <span>foo]]</span>=</li></ul>
26249 <ul><li> <s></s>: a</li></ul>
26250 <ul><li> <i>* foo</i></li></ul>
26251
26252 !! wikitext
26253 * bar <span><nowiki>[[foo]]</nowiki></span>
26254
26255 * =bar <span><nowiki>[[foo]]</nowiki></span>
26256
26257 * [[bar <span><nowiki>[[foo]]</nowiki></span>
26258
26259 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
26260
26261 * =bar <span>foo]]</span>=
26262
26263 * <s></s>: a
26264
26265 * ''* foo''
26266 !!end
26267
26268 !! test
26269 Lists: 6. Escape bullets in SOL position
26270 !! options
26271 parsoid=html2wt
26272 !! html/parsoid
26273 <p><!--cmt-->*foo</p>
26274 !! wikitext
26275 <!--cmt--><nowiki>*</nowiki>foo
26276 !!end
26277
26278 !! test
26279 Lists: 7. Escape bullets in a multi-line context
26280 !! options
26281 parsoid=html2wt
26282 !! html/parsoid
26283 <p>a
26284 *b
26285 </p>
26286 !! wikitext
26287 a
26288 <nowiki>*</nowiki>b
26289 !!end
26290
26291 !! test
26292 Lists: 8. Escape colons only if not present in tags
26293 !! options
26294 parsoid=html2wt
26295 !! html/parsoid
26296 <dl><dt>a:b<i>c:d</i></dt></dl>
26297 !! wikitext
26298 ; <nowiki>a:b</nowiki>''c:d''
26299 !! end
26300
26301 #### --------------- HRs ---------------
26302 #### 1. Single line
26303 #### -----------------------------------
26304
26305 !! test
26306 HRs: 1. Single line
26307 !! options
26308 parsoid=html2wt
26309 !! html/parsoid
26310 <hr />----
26311 <hr />=foo=
26312 <hr />*foo
26313 !! wikitext
26314 ----<nowiki>----</nowiki>
26315 ----=foo=
26316 ----*foo
26317 !! end
26318
26319 #### --------------- Tables ---------------
26320 #### 1a. Simple example
26321 #### 1b. No escaping needed (!foo)
26322 #### 1c. No escaping needed (|foo)
26323 #### 1d. No escaping needed (|}foo)
26324 ####
26325 #### 2a. Nested in td (<td>foo|bar</td>)
26326 #### 2b. Nested in td (<td>foo||bar</td>)
26327 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
26328 ####
26329 #### 3a. Nested in th (<th>foo!bar</th>)
26330 #### 3b. Nested in th (<th>foo!!bar</th>)
26331 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
26332 ####
26333 #### 4a. Escape -
26334 #### 4b. Escape +
26335 #### 4c. No escaping needed
26336 #### --------------------------------------
26337
26338 !! test
26339 Tables: 1a. Simple example
26340 !! options
26341 parsoid=html2wt
26342 !! html/parsoid
26343 <p>{|
26344 |}
26345 </p>
26346 !! wikitext
26347 <nowiki>{|</nowiki>
26348 |}
26349 !! end
26350
26351 !! test
26352 Tables: 1b. No escaping needed
26353 !! options
26354 parsoid=html2wt
26355 !! html/parsoid
26356 <p>!foo
26357 </p>
26358 !! wikitext
26359 !foo
26360 !! end
26361
26362 !! test
26363 Tables: 1c. No escaping needed
26364 !! options
26365 parsoid=html2wt
26366 !! html/parsoid
26367 <p>|foo
26368 </p>
26369 !! wikitext
26370 |foo
26371 !! end
26372
26373 !! test
26374 Tables: 1d. No escaping needed
26375 !! options
26376 parsoid=html2wt
26377 !! html/parsoid
26378 <p>|}foo
26379 </p>
26380 !! wikitext
26381 |}foo
26382 !! end
26383
26384 !! test
26385 Tables: 2a. Nested in td
26386 !! options
26387 parsoid=html2wt
26388 !! html/parsoid
26389 <table><tbody><tr>
26390 <td>foo|bar</td></tr>
26391 <tr><td>x<div>a|b</div></td>
26392 </tbody></table>
26393 !! wikitext
26394 {|
26395 |<nowiki>foo|bar</nowiki>
26396 |-
26397 |x<div><nowiki>a|b</nowiki></div>
26398 |}
26399 !! html/php+tidy
26400 <table>
26401 <tbody><tr>
26402 <td>foo|bar
26403 </td></tr>
26404 <tr>
26405 <td>x<div>a|b</div>
26406 </td></tr></tbody></table>
26407 !! end
26408
26409 !! test
26410 Tables: 2b. Nested in td
26411 !! options
26412 parsoid=html2wt
26413 !! html/parsoid
26414 <table><tbody><tr>
26415 <td>foo||bar</td>
26416 <td>a<i>b||c</i></td>
26417 <td>a<i><div>b||c</div></i></td>
26418 </tr></tbody></table>
26419 !! wikitext
26420 {|
26421 |<nowiki>foo||bar</nowiki>
26422 |a''<nowiki>b||c</nowiki>''
26423 |a''<div><nowiki>b||c</nowiki></div>''
26424 |}
26425 !! html/php
26426 <table>
26427 <tr>
26428 <td>foo||bar
26429 </td>
26430 <td>a<i>b||c</i>
26431 </td>
26432 <td>a<i><div>b||c</div></i>
26433 </td></tr></table>
26434
26435 !! end
26436
26437 !! test
26438 Tables: 2c. Nested in td -- no escaping needed
26439 !! options
26440 parsoid=html2wt
26441 !! html/*
26442 <table>
26443 <tr>
26444 <td>foo!!bar
26445 </td></tr></table>
26446
26447 !! wikitext
26448 {|
26449 |foo!!bar
26450 |}
26451 !! end
26452
26453 !! test
26454 Tables: 3a. Nested in th
26455 !! options
26456 parsoid=html2wt
26457 !! html/*
26458 <table>
26459 <tr>
26460 <th>foo!bar
26461 </th></tr></table>
26462
26463 !! wikitext
26464 {|
26465 !foo!bar
26466 |}
26467 !! end
26468
26469 !! test
26470 Tables: 3b. Nested in th
26471 !! options
26472 parsoid=html2wt
26473 !! html/parsoid
26474 <table><tbody>
26475 <tr><th>foo!!bar</th>
26476 <th><i>foo|bar</i></th>
26477 <th><i>foo!!bar</i></th>
26478 <th><i><span>foo!!bar</span></i></th>
26479 </tr></tbody></table>
26480 !! wikitext
26481 {|
26482 !<nowiki>foo!!bar</nowiki>
26483 !''<nowiki>foo|bar</nowiki>''
26484 !''<nowiki>foo!!bar</nowiki>''
26485 !''<span><nowiki>foo!!bar</nowiki></span>''
26486 |}
26487 !! html/php
26488 <table>
26489 <tr>
26490 <th>foo!!bar
26491 </th>
26492 <th><i>foo|bar</i>
26493 </th>
26494 <th><i>foo!!bar</i>
26495 </th>
26496 <th><i><span>foo!!bar</span></i>
26497 </th></tr></table>
26498
26499 !! end
26500
26501 !! test
26502 Tables: 3c. Nested in th
26503 !! options
26504 parsoid=html2wt
26505 !! html/parsoid
26506 <table><tbody>
26507 <tr><th>foo||bar</th>
26508 <th><span typeof="mw:Nowiki">foo||bar</span></th>
26509 </tr></tbody></table>
26510 !! wikitext
26511 {|
26512 !<nowiki>foo||bar</nowiki>
26513 !<nowiki>foo||bar</nowiki>
26514 |}
26515 !! html/php
26516 <table>
26517 <tr>
26518 <th>foo||bar
26519 </th>
26520 <th>foo||bar
26521 </th></tr></table>
26522
26523 !! end
26524
26525 !! test
26526 Tables: 4a. Escape -
26527 !! options
26528 parsoid=html2wt
26529 !! html/*
26530 <table>
26531 <tr>
26532 <th>-bar
26533 </th></tr>
26534 <tr>
26535 <td>-bar
26536 </td></tr></table>
26537
26538 !! wikitext
26539 {|
26540 !-bar
26541 |-
26542 |<nowiki>-bar</nowiki>
26543 |}
26544 !! end
26545
26546 !! test
26547 Tables: 4b. Escape +
26548 !! options
26549 parsoid=html2wt
26550 !! html/*
26551 <table>
26552 <tr>
26553 <th>+bar
26554 </th></tr>
26555 <tr>
26556 <td>+bar
26557 </td></tr></table>
26558
26559 !! wikitext
26560 {|
26561 !+bar
26562 |-
26563 |<nowiki>+bar</nowiki>
26564 |}
26565 !! end
26566
26567 !! test
26568 Tables: 4c. No escaping needed
26569 !! options
26570 parsoid=html2wt
26571 !! html/parsoid
26572 <table><tbody>
26573 <tr><td>foo-bar</td><td>foo+bar</td></tr>
26574 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
26575 <tr><td>foo
26576 <p>bar|baz
26577 +bar
26578 -bar</p></td></tr>
26579 <tr><td>x
26580 <div>a|b</div></td>
26581 </tbody></table>
26582 !! wikitext
26583 {|
26584 |foo-bar
26585 |foo+bar
26586 |-
26587 |''foo''-bar
26588 |''foo''+bar
26589 |-
26590 |foo
26591 bar|baz
26592 +bar
26593 -bar
26594 |-
26595 |x
26596 <div>a|b</div>
26597 |}
26598 !! html/php
26599 <table>
26600 <tr>
26601 <td>foo-bar
26602 </td>
26603 <td>foo+bar
26604 </td></tr>
26605 <tr>
26606 <td><i>foo</i>-bar
26607 </td>
26608 <td><i>foo</i>+bar
26609 </td></tr>
26610 <tr>
26611 <td>foo
26612 <p>bar|baz
26613 +bar
26614 -bar
26615 </p>
26616 </td></tr>
26617 <tr>
26618 <td>x
26619 <div>a|b</div>
26620 </td></tr></table>
26621
26622 !! end
26623
26624 !! test
26625 Tables: 4d. No escaping needed
26626 !! options
26627 parsoid=html2wt
26628 !! html/parsoid
26629 <table>
26630 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
26631 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
26632 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
26633 </tbody></table>
26634 !! wikitext
26635 {|
26636 |[[Foo]]-bar
26637 ||+1
26638 ||-2
26639 |}
26640 !! html/php
26641 <table>
26642 <tr>
26643 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
26644 </td>
26645 <td>+1
26646 </td>
26647 <td>-2
26648 </td></tr></table>
26649
26650 !! end
26651
26652 !! test
26653 Tables: 5. Empty table cells should get whitespace to avoid need for nowikis
26654 !! options
26655 parsoid=html2wt
26656 !! html/parsoid
26657 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26658
26659 <table><tr><td></td><td align="center"></td><td></td></tr></table>
26660
26661 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26662
26663 <table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table>
26664 !! wikitext
26665 {|
26666 | || align="center" | ||
26667 |}
26668
26669 {|
26670 |
26671 | align="center" |
26672 |
26673 |}
26674
26675 {|
26676 | {{!}}{{!}} align="center" | ||
26677 |}
26678
26679 {|
26680 ! !! align="center" | !!
26681 |}
26682 !! html/php+tidy
26683 <table>
26684 <tbody><tr>
26685 <td></td>
26686 <td align="center"></td>
26687 <td>
26688 </td></tr></tbody></table>
26689 <table>
26690 <tbody><tr>
26691 <td>
26692 </td>
26693 <td align="center">
26694 </td>
26695 <td>
26696 </td></tr></tbody></table>
26697 <table>
26698 <tbody><tr>
26699 <td></td>
26700 <td align="center"></td>
26701 <td>
26702 </td></tr></tbody></table>
26703 <table>
26704 <tbody><tr>
26705 <th></th>
26706 <th align="center"></th>
26707 <th>
26708 </th></tr></tbody></table>
26709 !! end
26710
26711 !! test
26712 T97430: Don't emit empty nowiki pairs around marker meta tags
26713 !! options
26714 parsoid=html2wt
26715 !! html/parsoid
26716 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26717 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
26718 !! wikitext
26719 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26720 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
26721 !! end
26722
26723 !! test
26724 Unclosed xmlish element in table line shouldn't eat end delimiters
26725 !! options
26726 parsoid=html2wt
26727 !! html/parsoid
26728 <table>
26729 <tbody><tr><td> &lt;foo</td>
26730 <td> bar></td></tr>
26731 </tbody></table>
26732 !! wikitext
26733 {|
26734 | <foo
26735 | bar>
26736 |}
26737 !! html/php
26738 <table>
26739 <tr>
26740 <td>&lt;foo
26741 </td>
26742 <td>bar&gt;
26743 </td></tr></table>
26744
26745 !! end
26746
26747 #### --------------- Links ----------------
26748 #### 1. Quote marks in link text
26749 #### 2. Wikilinks: Escapes needed
26750 #### 3. Wikilinks: No escapes needed
26751 #### 4. Extlinks: Escapes needed
26752 #### 5. Extlinks: No escapes needed
26753 #### --------------------------------------
26754 !! test
26755 Links 1. WikiLinks: No escapes needed
26756 !! options
26757 parsoid=html2wt
26758 !! html/parsoid
26759 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
26760 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
26761 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
26762 !! wikitext
26763 [[Foo|Foo''boo'']]
26764 [[Foo|[Foobar]]]
26765 [[Foo|x [Foobar] x]]
26766 !! html/php
26767 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
26768 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
26769 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
26770 </p>
26771 !! end
26772
26773 !! test
26774 Links 2. WikiLinks: Escapes needed
26775 !! options
26776 parsoid=html2wt
26777 !! html/parsoid
26778 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
26779 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
26780 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
26781 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
26782 <a href="Foo" rel="mw:WikiLink">|Bar</a>
26783 <a href="Foo" rel="mw:WikiLink">]]bar</a>
26784 <a href="Foo" rel="mw:WikiLink">[[bar</a>
26785 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
26786 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
26787 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
26788 !! wikitext
26789 [[Foo|<nowiki>Foobar]</nowiki>]]
26790 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
26791 [[Foo|<nowiki>[[Bar]]</nowiki>]]
26792 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
26793 [[Foo|<nowiki>|Bar</nowiki>]]
26794 [[Foo|<nowiki>]]bar</nowiki>]]
26795 [[Foo|<nowiki>[[bar</nowiki>]]
26796 [[Foo|<nowiki>x [[ y</nowiki>]]
26797 [[Foo|<nowiki>x ]] y</nowiki>]]
26798 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
26799 !! html/php
26800 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
26801 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
26802 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
26803 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
26804 <a href="/wiki/Foo" title="Foo">|Bar</a>
26805 <a href="/wiki/Foo" title="Foo">]]bar</a>
26806 <a href="/wiki/Foo" title="Foo">[[bar</a>
26807 <a href="/wiki/Foo" title="Foo">x [[ y</a>
26808 <a href="/wiki/Foo" title="Foo">x ]] y</a>
26809 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
26810 </p>
26811 !! end
26812
26813 !! test
26814 Links 3. WikiLinks: No escapes needed
26815 !! options
26816 parsoid=html2wt
26817 !! html/parsoid
26818 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
26819 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
26820 !! wikitext
26821 [[Foo|[Foobar]]
26822 [[Foo|foo|bar]]
26823 !! html/php
26824 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
26825 <a href="/wiki/Foo" title="Foo">foo|bar</a>
26826 </p>
26827 !! end
26828
26829 !! test
26830 Links 4. ExtLinks: Escapes needed
26831 !! options
26832 parsoid=html2wt
26833 !! html/parsoid
26834 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
26835 <a rel="mw:ExtLink" href="http://google.com">google]</a>
26836 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
26837 <p>[http://google.com]</p>
26838 <p>[http://google.com google]</p>
26839 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
26840 <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>
26841 !! wikitext
26842 [http://google.com <nowiki>[google]</nowiki>]
26843 [http://google.com <nowiki>google]</nowiki>]
26844 [http://google.com <nowiki>goog] le</nowiki>]
26845
26846 <nowiki>[http://google.com]</nowiki>
26847
26848 <nowiki>[http://google.com google]</nowiki>
26849
26850 [http://google.com<nowiki>]</nowiki>
26851
26852 [{{echo|http://google.com}}<nowiki>]</nowiki>
26853 !! html/php
26854 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
26855 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
26856 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
26857 </p><p>[http://google.com]
26858 </p><p>[http://google.com google]
26859 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26860 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26861 </p>
26862 !! end
26863
26864 !! test
26865 Links 5. ExtLinks: No escapes needed
26866 !! options
26867 parsoid=html2wt
26868 !! html/parsoid
26869 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
26870 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
26871 !! wikitext
26872 [http://google.com [google]
26873
26874 [[http://google.com]]
26875 !! html/php
26876 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
26877 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
26878 </p>
26879 !! end
26880
26881 !! test
26882 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
26883 !! options
26884 parsoid=html2wt
26885 !! html/parsoid
26886 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
26887 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
26888 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
26889 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
26890 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
26891 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
26892 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26893 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
26894 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26895 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
26896 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
26897 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
26898 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
26899 </p>
26900 !! wikitext
26901 x<nowiki/>http://example.com<nowiki/>y
26902 http://example.com<nowiki/>?x
26903 http://example.com<nowiki/>&x
26904 http://example.com<nowiki/>'x
26905 http://example.com<nowiki/>,x
26906 http://example.com<nowiki/>.x
26907 http://example.com<nowiki/>;x
26908 http://example.com<nowiki/>:x
26909 http://example.com<nowiki/>;x
26910 http://example.com<nowiki/>!x
26911 http://example.com<nowiki/>=x
26912 http://example.com<nowiki/>(x)
26913 http://example.com(x<nowiki/>)
26914 !! end
26915
26916 !! test
26917 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26918 !! options
26919 parsoid=html2wt
26920 !! html/parsoid
26921 <p>x
26922 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
26923 y
26924 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
26925 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
26926 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
26927 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
26928 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
26929 </p>
26930 !! wikitext
26931 x
26932 http://example.com
26933 y
26934 "http://example.com"
26935 (http://example.com)
26936 (http://example.com) foo
26937 http://example.com,
26938 http://example.com, foo
26939 !! html/php
26940 <p>x
26941 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
26942 y
26943 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
26944 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
26945 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
26946 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
26947 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
26948 </p>
26949 !! end
26950
26951 !! test
26952 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26953 !! options
26954 parsoid=html2wt
26955 !! html/parsoid
26956 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
26957 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
26958 !! wikitext
26959 http://example.com.,;:!?\
26960 -http://example.com:
26961 !! html/php
26962 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
26963 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
26964 </p>
26965 !! end
26966
26967 !! test
26968 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
26969 !! options
26970 parsoid=html2wt
26971 !! html/parsoid
26972 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
26973 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
26974 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
26975 !! wikitext
26976 RFC 123<nowiki/>4
26977 RFC 123<nowiki/>y
26978 X<nowiki/>RFC 123<nowiki/>y
26979 !! end
26980
26981 !! test
26982 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
26983 !! options
26984 parsoid=html2wt
26985 !! html/parsoid
26986 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
26987 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
26988 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
26989 </p>
26990 !! wikitext
26991 RFC 123?foo
26992 RFC 123&foo
26993 -RFC 123-
26994 !! html/php
26995 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
26996 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
26997 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
26998 </p>
26999 !! end
27000
27001 !! test
27002 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
27003 !! options
27004 parsoid=html2wt
27005 !! html/parsoid
27006 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
27007 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
27008 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
27009 !! wikitext
27010 PMID 123<nowiki/>4
27011 PMID 123<nowiki/>y
27012 X<nowiki/>PMID 123<nowiki/>y
27013 !! end
27014
27015 !! test
27016 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
27017 !! options
27018 parsoid=html2wt
27019 !! html/parsoid
27020 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
27021 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
27022 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
27023 </p>
27024 !! wikitext
27025 PMID 123?foo
27026 PMID 123&foo
27027 -PMID 123-
27028 !! html/php
27029 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
27030 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
27031 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
27032 </p>
27033 !! end
27034
27035 !! test
27036 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
27037 !! options
27038 parsoid=html2wt
27039 !! html/parsoid
27040 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
27041 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
27042 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
27043 </p>
27044 !! wikitext
27045 ISBN 1234567890<nowiki/>1
27046 ISBN 1234567890<nowiki/>x
27047 a<nowiki/>ISBN 1234567890<nowiki/>b
27048 !! end
27049
27050 !! test
27051 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
27052 !! options
27053 parsoid=html2wt
27054 !! html/parsoid
27055 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
27056 !! wikitext
27057 -ISBN 1234567890's
27058 !! html/php
27059 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
27060 </p>
27061 !! end
27062
27063 !! test
27064 Links 14. Protect link-like plain text. (Parsoid bug T78425)
27065 !! options
27066 parsoid=html2wt
27067 !! html/*
27068 <p>this is not a link: http://example.com
27069 </p>
27070 !! wikitext
27071 this is not a link: <nowiki>http://example.com</nowiki>
27072 !! end
27073
27074 !! test
27075 Links 15. Link trails can't become link prefixes.
27076 !! options
27077 language=is
27078 parsoid=html2wt
27079 !! html/parsoid
27080 <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>
27081 !! wikitext
27082 [[Söfnuður]]-[[00]]
27083 !! html/php
27084 <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>
27085 </p>
27086 !! end
27087
27088 #### --------------- Quotes ---------------
27089 #### 1. Quotes inside <b> and <i>
27090 #### 2. Link fragments separated by <i> and <b> tags
27091 #### 3. Link fragments inside <i> and <b>
27092 #### 4. No escaping needed
27093 #### --------------------------------------
27094 !! test
27095 1a. Quotes inside <b> and <i>
27096 !! options
27097 parsoid=html2wt
27098 !! html/*
27099 <p><i>'foo'</i>
27100 <i>''foo''</i>
27101 <i>'''foo'''</i>
27102 <i>foo</i>'s
27103 <b>'foo'</b>
27104 <b>''foo''</b>
27105 <b>'''foo'''</b>
27106 <b>foo'<i>bar'</i>baz</b>
27107 <b>foo</b>'s
27108 '<i>foo</i>
27109 <i>foo</i>'
27110 <i>foo'</i>'
27111 '<i>foo</i>'
27112 '<b>foo</b>
27113 <b>foo</b>'
27114 '<b>foo</b>'
27115 <i>fools'<span> errand</span></i>
27116 <i><span>fool</span>'s errand</i>
27117 '<i>foo</i> bar '<i>baz</i>
27118 a|!*#-:;+-~[]{}b'<i>x</i>
27119 </p>
27120 !! wikitext
27121 ''<nowiki/>'foo'''
27122 ''<nowiki>''foo''</nowiki>''
27123 ''<nowiki>'''foo'''</nowiki>''
27124 ''foo''<nowiki/>'s
27125 '''<nowiki/>'foo''''
27126 '''<nowiki>''foo''</nowiki>'''
27127 '''<nowiki>'''foo'''</nowiki>'''
27128 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
27129 '''foo'''<nowiki/>'s
27130 '''foo''
27131 ''foo''<nowiki/>'
27132 ''foo'''<nowiki/>'
27133 '''foo''<nowiki/>'
27134 ''''foo'''
27135 '''foo'''<nowiki/>'
27136 ''''foo'''<nowiki/>'
27137 ''fools'<span> errand</span>''
27138 ''<span>fool</span>'s errand''
27139 '<nowiki/>''foo'' bar '''baz''
27140 a|!*#-:;+-~[]{}b'''x''
27141 !! end
27142
27143 !! test
27144 1b. Quotes inside <b> and <i> with other tags on same line
27145 !! options
27146 parsoid=html2wt
27147 !! html/parsoid
27148 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
27149 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
27150 <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>
27151 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
27152 '<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>
27153 '<i>foo</i> <div title="name">test</div>
27154 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
27155 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
27156 <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>
27157 </ol>
27158 !! wikitext
27159 '''a'' foo ''[[bar]]''
27160 ''a''' foo ''[[bar]]''
27161 ''a''' foo '''{{echo|[[bar]]}}'''
27162 [[foo]] x'''[[bar]]''
27163 '''foo'' <ref>test</ref>
27164 '''foo'' <div title="name">test</div>
27165 '''foo'' and <br> bar
27166 <references />
27167 !! end
27168
27169 !! test
27170 2. Link fragments separated by <i> and <b> tags
27171 !! options
27172 parsoid=html2wt
27173 !! html/parsoid
27174 <p>[[<i>foo</i>hello]]</p>
27175 <p>[[<b>foo</b>hello]]</p>
27176 !! wikitext
27177 [[''foo''<nowiki>hello]]</nowiki>
27178
27179 [['''foo'''<nowiki>hello]]</nowiki>
27180 !! end
27181
27182 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
27183 # this is one of the shortcomings of this format
27184 !! test
27185 3. Link fragments inside <i> and <b>
27186 !! options
27187 parsoid=html2wt
27188 !! html/parsoid
27189 <p><i>[[foo</i>]]</p>
27190 <p><b>[[foo</b>]]</p>
27191 !! wikitext
27192 ''[[foo''<nowiki>]]</nowiki>
27193
27194 '''[[foo'''<nowiki>]]</nowiki>
27195 !! end
27196
27197 !! test
27198 4. No escaping needed
27199 !! options
27200 parsoid=html2wt
27201 !! html/parsoid
27202 <p>'<span><i>bar</i></span>'
27203 '<span><b>bar</b></span>'
27204 'a:b'foo
27205 </p>
27206 !! wikitext
27207 '<span>''bar''</span>'
27208 '<span>'''bar'''</span>'
27209 'a:b'foo
27210 !! end
27211
27212 #### ----------- Paragraphs ---------------
27213 #### 1. No unnecessary escapes
27214 #### --------------------------------------
27215
27216 !! test
27217 1. No unnecessary escapes
27218 !! options
27219 parsoid=html2wt
27220 !! html/parsoid
27221 <p>bar <span>[[foo]]</span>
27222 </p><p>=bar <span>[[foo]]</span>
27223 </p><p>[[bar <span>[[foo]]</span>
27224 </p><p>]]bar <span>[[foo]]</span>
27225 </p><p>=bar <span>foo]]</span>=
27226 </p>
27227 !! wikitext
27228 bar <span><nowiki>[[foo]]</nowiki></span>
27229
27230 =bar <span><nowiki>[[foo]]</nowiki></span>
27231
27232 [[bar <span><nowiki>[[foo]]</nowiki></span>
27233
27234 ]]bar <span><nowiki>[[foo]]</nowiki></span>
27235
27236 =bar <span>foo]]</span><nowiki>=</nowiki>
27237 !!end
27238
27239 #### ----------------------- PRE --------------------------
27240 !! test
27241 1. Leading whitespace in SOL context should be escaped
27242 !! options
27243 parsoid=html2wt
27244 !! html/parsoid
27245 <p> a</p>
27246
27247 <p> a</p>
27248
27249 <p> a(tab)</p>
27250
27251 <p> a
27252 <!--cmt-->
27253 a</p>
27254
27255 <p>a
27256 b</p>
27257
27258 <p>a
27259 b</p>
27260
27261 <p>a
27262 b</p>
27263 !! wikitext
27264 <nowiki> </nowiki>a
27265
27266 <nowiki> </nowiki> a
27267
27268 a(tab)
27269
27270 <nowiki> </nowiki> a
27271 <!--cmt-->
27272 <nowiki> </nowiki>a
27273
27274 a
27275 <nowiki> </nowiki>b
27276
27277 a
27278 b
27279
27280 a
27281 b
27282 !! html/php
27283 <p> a
27284 </p><p> a
27285 </p><p> a(tab)
27286 </p><p> a
27287 a
27288 </p><p>a
27289 b
27290 </p><p>a
27291 b
27292 </p><p>a
27293 b
27294 </p>
27295 !! end
27296
27297 !! test
27298 2. Leading whitespace in non-indent-pre contexts should not be escaped
27299 !! options
27300 parsoid=html2wt
27301 !! html/parsoid
27302 <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>
27303 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
27304 <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>
27305 b</span></li>
27306 </ol>
27307 !! wikitext
27308 foo <ref>''a''
27309 b</ref>
27310 <references />
27311 !! end
27312
27313 !! test
27314 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
27315 !! options
27316 parsoid=html2wt
27317 !! html/parsoid
27318 <blockquote>
27319 <p>
27320 a
27321 <span>b</span>
27322 c</p>
27323 </blockquote>
27324 !! wikitext
27325 <blockquote>
27326 a
27327 <span>b</span>
27328 c
27329 </blockquote>
27330 !! end
27331
27332 !! test
27333 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
27334 !! options
27335 parsoid=html2wt
27336 !! html/parsoid
27337 <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>
27338 !! wikitext
27339 [[File:Foobar.jpg|thumb|caption]]
27340 !! end
27341
27342 !! test
27343 5. Nowiki escaping should account for indent-pres
27344 !! options
27345 parsoid=html2wt
27346 !! html/parsoid
27347 <pre>==foo==</pre>
27348 !! wikitext
27349 ==foo==
27350 !! end
27351
27352 !! test
27353 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
27354 !! options
27355 parsoid=html2wt
27356 !! html/parsoid
27357 <pre>
27358 * foo
27359 * bar
27360 </pre>
27361 !! wikitext
27362 * foo
27363 * bar
27364 !! end
27365
27366 !! test
27367 Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup
27368 !! options
27369 parsoid = {
27370 "modes": ["html2wt"],
27371 "scrubWikitext": true
27372 }
27373 !! html/parsoid
27374 <p> foo</p>
27375 <p> %foo</p>
27376 <p> *foo</p>
27377 <p> #foo</p>
27378 <p> =foo=</p>
27379 <p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p>
27380 <p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p>
27381 <p> <!--boo-->*foo</p>
27382 <p><!--boo--> *foo</p>
27383 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p>
27384 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p>
27385 !! wikitext
27386 foo
27387
27388 %foo
27389
27390 <nowiki/>*foo
27391
27392 <nowiki/>#foo
27393
27394 <nowiki/>=foo=
27395
27396 [[Category:Foo]]
27397 <nowiki/>*foo
27398
27399 [[Category:Foo]]
27400 <nowiki>*</nowiki>foo
27401
27402 <nowiki/><!--boo-->*foo
27403
27404 <!--boo--><nowiki/>*foo
27405
27406 <!--a--><!--b--><!--c--><!--d--><!--e-->foo
27407
27408 <!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo
27409 !! end
27410
27411 #### --------------- Behavior Switches --------------------
27412
27413 !! test
27414 1. Valid behavior switches should be escaped
27415 !! options
27416 parsoid=html2wt
27417 !! html/parsoid
27418 __TOC__
27419 <i>__TOC__</i>
27420 !! wikitext
27421 <nowiki>__TOC__</nowiki>
27422 ''<nowiki>__TOC__</nowiki>''
27423 !! end
27424
27425 !! test
27426 2. Invalid behavior switches should not be escaped
27427 !! options
27428 parsoid=html2wt
27429 !! html/parsoid
27430 __TOO__
27431 __|__
27432 !! wikitext
27433 __TOO__
27434 __|__
27435 !! end
27436
27437 # We use indent-pre as an indirect way to test for sol-transparent behavior.
27438 !! test
27439 Behavior switches should be SOL-transparent
27440 !! options
27441 parsoid=html2wt
27442 !! html/parsoid
27443 <meta property="mw:PageProp/toc" />
27444
27445 <!-- this one's bogus -->
27446 <pre>__TOO__</pre>
27447
27448 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
27449
27450 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
27451 !! wikitext
27452 __TOC__
27453
27454 <!-- this one's bogus -->
27455 __TOO__
27456
27457 __TOC__ foo
27458
27459 __TOC__
27460 bar
27461 !! end
27462
27463 #### --------------- HTML tags ---------------
27464 #### 1. a tags
27465 #### 2. other tags
27466 #### 3. multi-line html tag
27467 #### 4. extension tags
27468 #### -----------------------------------------
27469 !! test
27470 1. a tags
27471 !! options
27472 parsoid=html2wt
27473 !! html/parsoid
27474 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
27475 !! wikitext
27476 <a href="http://google.com">google</a>
27477 !! end
27478
27479 !! test
27480 2. other tags
27481 !! options
27482 parsoid=html2wt
27483 !! html/parsoid
27484 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
27485 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
27486 <li> &lt;td&gt;</li></ul>
27487
27488 !! wikitext
27489 * <nowiki><div>foo</div></nowiki>
27490 * <nowiki><div style="color:red">foo</div></nowiki>
27491 * <nowiki><td></nowiki>
27492 !! end
27493
27494 !! test
27495 3. multi-line html tag
27496 !! options
27497 parsoid=html2wt
27498 !! html/parsoid
27499 <p>&lt;div
27500 &gt;foo&lt;/div
27501 &gt;
27502 </p>
27503 !! wikitext
27504 <nowiki><div
27505 >foo</div
27506 ></nowiki>
27507 !! end
27508
27509 !! test
27510 4. extension tags
27511 !! options
27512 parsoid=html2wt
27513 !! html/parsoid
27514 <p>&lt;ref&gt;foo&lt;/ref&gt;
27515 </p><p>&lt;ref&gt;bar
27516 </p><p>baz&lt;/ref&gt;
27517 </p>
27518 !! wikitext
27519 <nowiki><ref>foo</ref></nowiki>
27520
27521 <nowiki><ref>bar</nowiki>
27522
27523 baz<nowiki></ref></nowiki>
27524 !! end
27525
27526 !! test
27527 Parsoid: newline inducing block nodes don't suppress <nowiki>
27528 !! options
27529 parsoid=html2wt
27530 !! html/parsoid
27531 a<h1>foo</h1>
27532 !! wikitext
27533 <nowiki> </nowiki>a
27534
27535 = foo =
27536 !! end
27537
27538 #### --------------- Others ---------------
27539 !! test
27540 Escaping nowikis
27541 !! options
27542 parsoid=html2wt
27543 !! html/parsoid
27544 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
27545 </p>
27546 !! wikitext
27547 &lt;nowiki&gt;foo&lt;/nowiki&gt;
27548 !! end
27549
27550 ## The quote-char in the input is necessary for triggering the bug
27551 !! test
27552 (T54035) Nowiki-escaping should not get tripped by " :" in text
27553 !! options
27554 parsoid=html2wt
27555 !! html/parsoid
27556 <p>foo's bar :</p>
27557 !! wikitext
27558 foo's bar :
27559 !! end
27560
27561 #----------- End of wikitext escaping tests --------------
27562
27563 !! test
27564
27565 Tag-like HTML structures are passed through as text
27566 !! wikitext
27567 <x y>
27568
27569 <x.y>
27570
27571 <x-y>
27572
27573 1>2
27574
27575 x<y
27576
27577 a>b
27578
27579 1<d e>f
27580 !! html
27581 <p>&lt;x y&gt;
27582 </p><p>&lt;x.y&gt;
27583 </p><p>&lt;x-y&gt;
27584 </p><p>1&gt;2
27585 </p><p>x&lt;y
27586 </p><p>a&gt;b
27587 </p><p>1&lt;d e&gt;f
27588 </p>
27589 !! end
27590
27591 !! test
27592 HTML tag with necessary entities in attributes
27593 !! wikitext
27594 <span title="&amp;amp;">foo</span>
27595 !! html
27596 <p><span title="&amp;amp;">foo</span>
27597 </p>
27598 !! end
27599
27600 !! test
27601 HTML tag with 'unnecessary' entity encoding in attributes
27602 !! wikitext
27603 <span title="&amp;">foo</span>
27604 !! html
27605 <p><span title="&amp;">foo</span>
27606 </p>
27607 !! end
27608
27609 !! test
27610 HTML tag with broken attribute value quoting
27611 !! options
27612 parsoid=wt2html,html2html
27613 !! wikitext
27614 <span title="Hello world>Foo</span>
27615 !! html/php
27616 <p><span title="Hello world">Foo</span>
27617 </p>
27618 !! html/parsoid
27619 <p><span title="Hello world">Foo</span></p>
27620 !! end
27621
27622 !! test
27623 Self-closed tag with broken attribute value quoting
27624 !! options
27625 parsoid=wt2html,html2html
27626 !! wikitext
27627 <div title="Hello world />Foo
27628 !! html/php+tidy
27629 <div title="Hello world"></div><p>Foo
27630 </p>
27631 !! html/parsoid
27632 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
27633 !! end
27634
27635 !! test
27636 Table with broken attribute value quoting
27637 !! options
27638 parsoid=wt2html,html2html
27639 !! wikitext
27640 {|
27641 | title="Hello world|Foo
27642 |}
27643 !! html/php
27644 <table>
27645 <tr>
27646 <td title="Hello world">Foo
27647 </td></tr></table>
27648
27649 !! html/parsoid
27650 <table>
27651 <tr>
27652 <td title="Hello world">Foo
27653 </td></tr></table>
27654
27655 !! end
27656
27657 !! test
27658 Table with broken attribute value quoting on consecutive lines
27659 !! options
27660 parsoid=wt2html,html2html
27661 !! wikitext
27662 {|
27663 | title="Hello world|Foo
27664 | style="color:red|Bar
27665 |}
27666 !! html/php
27667 <table>
27668 <tr>
27669 <td title="Hello world">Foo
27670 </td>
27671 <td style="color:red">Bar
27672 </td></tr></table>
27673
27674 !! html/parsoid
27675 <table><tbody>
27676 <tr>
27677 <td title="Hello world">Foo
27678 </td><td style="color: red">Bar
27679 </td></tr></tbody></table>
27680
27681 !! end
27682
27683 !!test
27684 Accept empty td cell attribute
27685 !! wikitext
27686 {|
27687 | align="center" |foo|| |
27688 |}
27689 !! html
27690 <table>
27691 <tr>
27692 <td align="center">foo</td>
27693 <td>
27694 </td></tr></table>
27695
27696 !!end
27697
27698 !!test
27699 Non-empty attributes in th-cells
27700 !! wikitext
27701 {|
27702 !Foo!! style="color: red" |Bar
27703 |}
27704 !! html
27705 <table>
27706 <tr>
27707 <th>Foo</th>
27708 <th style="color: red">Bar
27709 </th></tr></table>
27710
27711 !!end
27712
27713 !!test
27714 Accept empty attributes in th-cells
27715 !! wikitext
27716 {|
27717 !|foo!!|bar
27718 |}
27719 !! html
27720 <table>
27721 <tr>
27722 <th>foo</th>
27723 <th>bar
27724 </th></tr></table>
27725
27726 !!end
27727
27728 !!test
27729 Empty table rows go away
27730 !! wikitext
27731 {|
27732 |Hello
27733 |there
27734 |- class="foo"
27735 |-
27736 |}
27737 !! html
27738 <table>
27739 <tr>
27740 <td>Hello
27741 </td>
27742 <td>there
27743 </td></tr>
27744
27745 </table>
27746
27747 !! end
27748
27749 ###
27750 ### Parsoid-centric tests for testing RTing of inter-element separators
27751 ### Edge cases not tested by existing parser tests and specific to
27752 ### Parsoid-specific serialization strategies.
27753 ###
27754
27755 !!test
27756 RT-ed inter-element separators should be valid separators
27757 !! wikitext
27758 {|
27759 |- [[foo]]
27760 |}
27761 !! html/php
27762 <table>
27763
27764 </table>
27765
27766 !! html/parsoid
27767 <table>
27768 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
27769 </tbody></table>
27770 !!end
27771
27772 # Parsoid-only test of a DOM pass
27773 !!test
27774 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
27775 !! wikitext
27776 {|
27777 |<small>foo
27778 bar
27779 |}
27780
27781 {|
27782 |<small>foo<small>
27783 |}
27784 !! html/parsoid
27785 <table>
27786 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
27787 <p>bar</p></small></td></tr>
27788 </tbody></table>
27789
27790 <table>
27791 <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>
27792 </tbody></table>
27793 !!end
27794
27795 # Note that the "style" attribute is really a template parameter here.
27796 # The = would have to be {{=}} if you wanted the literal.
27797 !!test
27798 Empty TD followed by TD with tpl-generated attribute
27799 !! wikitext
27800 {|
27801 |-
27802 |
27803 |{{echo|style='color:red'}}|foo
27804 |}
27805 !! html
27806 <table>
27807
27808 <tr>
27809 <td>
27810 </td>
27811 <td>foo
27812 </td></tr></table>
27813
27814 !!end
27815
27816 !!test
27817 Indented table with an empty td
27818 !! wikitext
27819 {|
27820 |-
27821 |
27822 |foo
27823 |}
27824 !! html
27825 <table>
27826
27827 <tr>
27828 <td>
27829 </td>
27830 <td>foo
27831 </td></tr></table>
27832
27833 !!end
27834
27835 !! test
27836 Indented table with blank lines in between (T85627)
27837 !! wikitext
27838 {|
27839 |foo
27840
27841
27842 |}
27843 !! html/php
27844 <table>
27845 <tr>
27846 <td>foo
27847 <p><br />
27848 </p>
27849 </td></tr></table>
27850
27851 !! html/parsoid
27852 <table>
27853 <tbody><tr><td>foo
27854 <p>
27855 <br /></p></td></tr>
27856 </tbody></table>
27857 !! end
27858
27859 !!test
27860 Indented block & table
27861 !! wikitext
27862 <div>foo</div>
27863 {|
27864 |foo
27865 |}
27866 !! html/php
27867 <div>foo</div>
27868 <table>
27869 <tr>
27870 <td>foo
27871 </td></tr></table>
27872
27873 !! html/parsoid
27874 <div data-parsoid='{"stx":"html"}'>foo</div>
27875 <table><tbody>
27876 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
27877 </tbody></table>
27878 !!end
27879
27880 !! test
27881 Indent and comment before table row
27882 !! wikitext
27883 {|
27884 <!--hi-->|-
27885 |there
27886 |}
27887 !! html/php
27888 <table>
27889
27890 <tr>
27891 <td>there
27892 </td></tr></table>
27893
27894 !! html/parsoid
27895 <table>
27896 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
27897 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
27898 </tbody></table>
27899 !! end
27900
27901 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
27902 !!test
27903 Empty TR followed by a template-generated TR
27904 !!options
27905 parsoid
27906 !! wikitext
27907 {|
27908 |-
27909 {{echo|<tr><td>foo</td></tr>}}
27910 |}
27911 !! html
27912 <table>
27913 <tbody>
27914 <tr class='mw-empty-elt'></tr>
27915 <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}}]}'>
27916 <td>foo</td></tr>
27917 </tbody></table>
27918 !!end
27919
27920 ## PHP and parsoid output differ for this, and since this is primarily
27921 ## for testing Parsoid's serializer, marking this Parsoid only
27922 !!test
27923 Empty TR followed by mixed-ws-comment line should RT correctly
27924 !!options
27925 parsoid
27926 !! wikitext
27927 {|
27928 |-
27929 <!--c-->
27930 |-
27931 <!--c--> <!--d-->
27932 |}
27933 !! html
27934 <table>
27935 <tbody>
27936 <tr class='mw-empty-elt'></tr>
27937 <!--c-->
27938 <tr>
27939 <!--c--> </tr><!--d-->
27940 </tbody></table>
27941
27942 !!end
27943
27944 !!test
27945 Multi-line image caption generated by templates with/without trailing newlines
27946 !! wikitext
27947 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
27948 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
27949 !! html/parsoid
27950 <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>
27951 <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>
27952 !!end
27953
27954 !! test
27955 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
27956 !! options
27957 parsoid=html2wt
27958 !! html/parsoid
27959 <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>
27960
27961 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
27962 !! wikitext
27963 <includeonly>foo</includeonly>
27964 new para
27965
27966 [[Category:Foo]]
27967
27968 = new heading =
27969 !! end
27970
27971 ## PHP emits broken html for this, and since this is primarily
27972 ## a Parsoid serializer test, marking this Parsoid only
27973 !!test
27974 Improperly nested inline or quotes tags with whitespace in between
27975 !! wikitext
27976 <span> <s>x</span> </s>
27977 ''' ''x''' ''
27978 !! html/parsoid
27979 <p><span> <s>x</s></span><s> </s>
27980 <b> <i>x</i></b><i> </i>
27981 </p>
27982 !!end
27983
27984 !!test
27985 Encapsulate protected attributes from wt
27986 !! wikitext
27987 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
27988
27989 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
27990 |ok
27991 |}
27992 !! html/parsoid
27993 <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>
27994
27995 <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">
27996 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'>ok</td></tr>
27997 </tbody></table>
27998 !!end
27999
28000 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
28001 ## Having nested or stray pre tags results in the attempt to add duplicates,
28002 ## causing an assertion fail. This test tries to prevent that situation.
28003 !! test
28004 Ensure ParagraphWrapper can deal with stray closing pre tags
28005 !! options
28006 parsoid=wt2html
28007 !! wikitext
28008 plain text</pre>
28009 !! html/parsoid
28010 <p>plain text</p>
28011 !! end
28012
28013 ## Remex doesn't account for fostered content.
28014 !! test
28015 1. Ensure fostered text content is wrapped in element nodes
28016 !! options
28017 parsoid=wt2html
28018 !! wikitext
28019 <table>hi</table><table>ho</table>
28020 !! html/php+tidy
28021 hi<table></table>ho<table></table>
28022 !! html/parsoid
28023 <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>
28024 !! end
28025
28026 ## Remex doesn't account for fostered content.
28027 !! test
28028 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
28029 !! options
28030 parsoid=wt2html,wt2wt
28031 !! wikitext
28032 <table>
28033 <tr> || ||
28034 <td> a
28035 </table>
28036 !! html/php+tidy
28037 || ||
28038 <table>
28039 <tbody><tr><td> a
28040 </td></tr></tbody></table>
28041 !! html/parsoid
28042 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||</p>
28043 <table data-parsoid='{"stx":"html"}'>
28044 <tbody><tr data-parsoid='{"stx":"html","autoInsertedEnd":true}'><td data-parsoid='{"stx":"html","autoInsertedEnd":true}'> a
28045 </td></tr></tbody></table>
28046 !! end
28047
28048 ## Remex doesn't account for fostered content.
28049 !! test
28050 Encapsulation properly handles null DSR information from foster box
28051 !! options
28052 parsoid=wt2html,wt2wt
28053 !! wikitext
28054 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
28055 !! html/parsoid
28056 <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>
28057 !! end
28058
28059 ## Remex doesn't account for fostered content.
28060 !! test
28061 1. Encapsulate foster-parented transclusion content
28062 !! options
28063 parsoid=wt2wt,wt2html
28064 !! wikitext
28065 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
28066 !! html/php+tidy
28067 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
28068 !! html/parsoid
28069 <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>
28070 !! end
28071
28072 !! test
28073 2. Encapsulate foster-parented transclusion content
28074 !! options
28075 parsoid=wt2wt,wt2html
28076 !! wikitext
28077 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
28078 !! html/parsoid
28079 <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>
28080 <table>
28081 <tbody>
28082 <tr>
28083 <td>bar</td>
28084 </tr>
28085 </tbody>
28086 </table>
28087 !! end
28088
28089 !! test
28090 3. Encapsulate foster-parented transclusion content
28091 !! options
28092 parsoid=wt2wt,wt2html
28093 !! wikitext
28094 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
28095 !! html/parsoid
28096 <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;]}">
28097 <p>foo</p>
28098 </div>
28099 <table>
28100 <tbody>
28101 <tr>
28102 <td>bar</td>
28103 </tr>
28104 </tbody>
28105 </table>
28106 !! end
28107
28108 !! test
28109 4. Encapsulate foster-parented transclusion content
28110 !! options
28111 parsoid=wt2wt,wt2html
28112 !! wikitext
28113 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
28114 !! html/parsoid
28115 <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;]}">
28116 <p>foo</p>
28117 </div>
28118 <table>
28119 <tbody>
28120 <tr>
28121 <td>bar</td>
28122 </tr>
28123 </tbody>
28124 </table>
28125 !! end
28126
28127 ## Remex doesn't account for fostered content.
28128 !! test
28129 5. Encapsulate foster-parented transclusion content
28130 !!options
28131 parsoid=wt2wt,wt2html
28132 !! wikitext
28133 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
28134 !! html/php+tidy
28135 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
28136 !! html/parsoid
28137 <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>
28138 !! end
28139
28140 ## Remex doesn't account for fostered content.
28141 !! test
28142 6. Encapsulate foster-parented transclusion content
28143 !! options
28144 parsoid=wt2wt,wt2html
28145 !! wikitext
28146 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
28147 !! html/php+tidy
28148 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
28149 !! html/parsoid
28150 <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>
28151 !! end
28152
28153 !! test
28154 7. Encapsulate foster-parented transclusion content
28155 !!options
28156 parsoid=wt2wt,wt2html
28157 !! wikitext
28158 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
28159 !! html/parsoid
28160 <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>
28161 <table>
28162 <tbody>
28163 <tr>
28164 <td>bar</td>
28165 </tr>
28166 </tbody>
28167 </table>
28168 !! end
28169
28170 ## Remex doesn't account for fostered content.
28171 # Note that the wt is broken on purpose: the = should be {{=}} if you
28172 # don't want it to be a template parameter key.
28173 !! test
28174 8. Encapsulate foster-parented transclusion content
28175 !! options
28176 parsoid=wt2wt,wt2html
28177 !! wikitext
28178 {{echo|a
28179 }}{|{{echo|style='color:red'}}
28180 |-
28181 |b
28182 |}
28183 !! html/php+tidy
28184 <p>a
28185 </p>
28186 <table>
28187
28188 <tbody><tr>
28189 <td>b
28190 </td></tr></tbody></table>
28191 !! html/parsoid
28192 <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">
28193 </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">
28194 <tbody><tr>
28195 <td>b
28196 </td></tr></tbody></table>
28197 !! end
28198
28199 ## Remex doesn't account for fostered content.
28200 !! test
28201 9. Encapsulate foster-parented transclusion content
28202 !!options
28203 parsoid=wt2wt,wt2html
28204 !! wikitext
28205 <table>{{echo|hi</table>hello}}
28206 !! html/php+tidy
28207 hi<table></table><p>hello
28208 </p>
28209 !! html/parsoid
28210 <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>
28211 !! end
28212
28213 !! test
28214 Table in fosterable position
28215 !!options
28216 parsoid=wt2html
28217 !! wikitext
28218 {{OpenTable}}
28219 <div>
28220 {|
28221 |}
28222 </div>
28223 |}
28224 !! html/parsoid
28225 <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">
28226 </span>
28227 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
28228
28229 <table>
28230 </table>
28231 !! end
28232
28233 # Parsoid only for T66747
28234 !! test
28235 Properly encapsulate empty-content transclusions in fosterable positions
28236 !! wikitext
28237 <table>
28238 {{#if:|
28239 <td>foo</td>
28240 }}
28241 </table>
28242 !! html/parsoid
28243 <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"}]]}'>
28244
28245 </table>
28246 !! end
28247
28248 ## No longer captures its original intention
28249 !! test
28250 Always encapsulate foster box when template range is expanded to table
28251 !! options
28252 disabled
28253 parsoid=wt2wt
28254 !! wikitext
28255 {|
28256 hello
28257 {{OpenTable}}
28258 |}
28259 !! html/parsoid
28260
28261 !! end
28262
28263 !! test
28264 T115289: Unclosed table
28265 !! wikitext
28266 {{echo|<table>}}<!--c-->[[Category:Two]]
28267 !! html/parsoid
28268 <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>
28269 !! end
28270
28271 !! test
28272 T115289: Don't migrate newlines out of tables with fostered content
28273 !! wikitext
28274 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
28275 !! html/parsoid
28276 <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>
28277 !! end
28278
28279 !! test
28280 T73074: More fostering fun
28281 !! wikitext
28282 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
28283 !! html/parsoid
28284 <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>
28285 !! end
28286
28287 !!test
28288 Support <object> element with .data attribute
28289 !!options
28290 parsoid=html2wt
28291 !! html/parsoid
28292 <object data="test.swf"></object>
28293 !! wikitext
28294 <object data="test.swf"></object>
28295 !!end
28296
28297 !! test
28298 Don't block XML namespace declaration
28299 !! wikitext
28300 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
28301 !! html/php
28302 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
28303 </p>
28304 !! html/parsoid
28305 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
28306 !! end
28307
28308 # -----------------------------------------------------------------
28309 # The following section of tests are primarily to spec requirements
28310 # around Parsoid's serialization (old, new, edited content)
28311 #
28312 # All these tests are marked Parsoid html2wt and html2html only
28313 # ----------------------------------------------------------------
28314
28315 !! test
28316 Ignore rel attribute in a-tags during serialization to url-links
28317 !! options
28318 parsoid=html2wt
28319 !! html/parsoid
28320 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
28321 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
28322 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
28323 !! wikitext
28324 http://en.wikipedia.org/wiki/Foobar
28325 http://en.wikipedia.org/wiki/Foobar
28326 http://en.wikipedia.org/wiki/Foobar
28327 !! end
28328
28329 # 'mi' is a localinterwiki prefix as well as a language
28330 !! test
28331 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
28332 !! options
28333 parsoid=html2wt
28334 !! html/parsoid
28335 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
28336 !! wikitext
28337 [[Foo]]
28338 !! end
28339
28340 !! test
28341 Parsoid should accept interwiki shortcuts
28342 !! options
28343 parsoid=html2wt
28344 !! html/parsoid
28345 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
28346 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
28347 <a href='./fr:Foo'>Foo</a></p>
28348 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
28349 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
28350 <a href='fr%3AFoo'>Foo</a></p>
28351 <p><a href='FR%3AFoo'>Foo</a>
28352 <a href='./FR:Foo'>Foo</a></p>
28353 !! wikitext
28354 [[:fr:Foo|Foo]]
28355 [[:fr:Foo|Foo]]
28356 [[:fr:Foo|Foo]]
28357
28358 [[:fr:Foo|Foo]]
28359 [[:fr:Foo|Foo]]
28360 [[:fr:Foo|Foo]]
28361
28362 [[:fr:Foo|Foo]]
28363 [[:fr:Foo|Foo]]
28364 !! end
28365
28366 !! test
28367 Parsoid should not accept invalid interwiki shortcuts
28368 !! options
28369 parsoid=html2wt
28370 !! html/parsoid
28371 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
28372 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
28373 <a href='news:Foo'>Foo</a></p>
28374 !! wikitext
28375 [news:Foo Foo]
28376 [news:Foo Foo]
28377 [news:Foo Foo]
28378 !! end
28379
28380 # See T93839
28381 !! test
28382 New wikilinks should be serialized properly
28383 !! options
28384 parsoid=html2wt
28385 !! html/parsoid
28386 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
28387 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
28388 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
28389 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
28390 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
28391 !! wikitext
28392 [[Foo]]
28393 [[Foo]]
28394 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
28395 http://en.wikipedia.org/wiki/Foo
28396 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
28397 !! end
28398
28399 !! test
28400 New wiki links (href variations)
28401 !! options
28402 parsoid=html2wt
28403 !! html/parsoid
28404 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28405 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
28406 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
28407 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
28408 !! wikitext
28409 [[Foo_bar]]
28410 [[Foo_bar]]
28411 [[Foo_bar]]
28412 [[Toxine bactérienne]]
28413 !! end
28414
28415 !! test
28416 New wiki links (content string variations)
28417 !! options
28418 parsoid=html2wt
28419 !! html/parsoid
28420 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28421 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
28422 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
28423 !! wikitext
28424 [[Foo_bar]]
28425 [[Foo bar]]
28426 [[Foo_bar|./Foo_bar]]
28427 !! end
28428
28429 !! test
28430 New category links (href variations)
28431 !! options
28432 parsoid=html2wt
28433 !! html/parsoid
28434 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
28435 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
28436 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
28437 !! wikitext
28438 [[Category:Toxine bactérienne]]
28439 [[Category:Toxine bactérienne]]
28440 [[Category:Toxine bactérienne]]
28441 !! end
28442
28443 !! test
28444 New sol transparent links don't need indent-pre nowiki protection
28445 !! options
28446 parsoid=html2wt
28447 language=de
28448 !! html/parsoid
28449 <link rel="mw:PageProp/redirect" href="./Main_Page">
28450 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
28451 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
28452 !! wikitext
28453 #WEITERLEITUNG [[Main Page]]
28454 <!-- this is good --> [[Category:Good]]
28455 <!-- this is great --> [[Kategorie:Great]]
28456 !! end
28457
28458 !! test
28459 New interlanguage links (href variations)
28460 !! options
28461 parsoid=html2wt
28462 !! html/parsoid
28463 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
28464 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
28465 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
28466 !! wikitext
28467 [[es:Toxine bactérienne]]
28468 [[es:Toxine_bactérienne]]
28469 [[es:Toxine_bactérienne]]
28470 !! end
28471
28472 !! test
28473 Image: Modifying size of an image (1)
28474 !! options
28475 parsoid={
28476 "modes": ["wt2wt"],
28477 "changes": [
28478 ["img[height]", "attr", "height", "22"],
28479 ["img[width]", "attr", "width", "200"]
28480 ]
28481 }
28482 !! wikitext
28483 [[Image:Foobar.jpg|230x230px]]
28484 !! wikitext/edited
28485 [[Image:Foobar.jpg|200x200px]]
28486 !!end
28487
28488 !! test
28489 Image: Modifying size of an image (2)
28490 !! options
28491 parsoid={
28492 "modes": ["wt2wt"],
28493 "changes": [
28494 ["img[height]", "attr", "height", "100"],
28495 ["img[width]", "attr", "width", "500"]
28496 ]
28497 }
28498 !! wikitext
28499 [[Image:Foobar.jpg|230x230px]]
28500 !! wikitext/edited
28501 [[Image:Foobar.jpg|500x500px]]
28502 !!end
28503
28504 # Change in size is ignored so long as class='mw-default-size'
28505 !! test
28506 Image: Modifying size of an image (3)
28507 !! options
28508 parsoid={
28509 "modes": ["wt2wt"],
28510 "changes": [
28511 ["figure[class]", "removeClass", "mw-default-size"],
28512 ["figure img", "attr", "height", "19"],
28513 ["figure img", "attr", "width", "170"]
28514 ]
28515 }
28516 !! wikitext
28517 [[Image:Foobar.jpg|thumb]]
28518 !! wikitext/edited
28519 [[Image:Foobar.jpg|thumb|170x170px]]
28520 !!end
28521
28522 !! test
28523 Image: Modifying alignment of an image (T50665)
28524 !! options
28525 parsoid={
28526 "modes": ["wt2wt"],
28527 "changes": [
28528 ["figure[class]", "removeClass", "mw-halign-right"],
28529 ["figure[class]", "addClass", "mw-halign-left"]
28530 ]
28531 }
28532 !! wikitext
28533 [[Image:Foobar.jpg|thumb|caption|right]]
28534 !! wikitext/edited
28535 [[Image:Foobar.jpg|thumb|caption|left]]
28536 !! end
28537
28538 !! test
28539 Image: Modifying mw-default-size of an frameless image (T64805)
28540 !! options
28541 parsoid={
28542 "modes": ["wt2wt"],
28543 "changes": [
28544 ["figure.mw-default-size", "removeClass", "mw-default-size"]
28545 ]
28546 }
28547 !! wikitext
28548 [[Image:Foobar.jpg|frameless|right]]
28549 !! wikitext/edited
28550 [[Image:Foobar.jpg|frameless|right|220x220px]]
28551 !! end
28552
28553 !! test
28554 Image: Modifying valign of an image (T51221)
28555 !! options
28556 parsoid={
28557 "modes": ["wt2wt"],
28558 "changes": [
28559 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
28560 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
28561 ]
28562 }
28563 !! wikitext
28564 [[File:Foobar.jpg|20px|middle]]
28565 !! wikitext/edited
28566 [[File:Foobar.jpg|20px|text-top]]
28567 !! end
28568
28569 !! test
28570 Image: Modifying alt attribute of an image (T58400)
28571 !! options
28572 parsoid={
28573 "modes": ["wt2wt"],
28574 "changes": [
28575 ["img[alt]", "attr", "alt", "some alternate edited text"]
28576 ]
28577 }
28578 !! wikitext
28579 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
28580 !! wikitext/edited
28581 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
28582 !!end
28583
28584 !! test
28585 Image: Modifying caption of an image
28586 !! options
28587 parsoid={
28588 "modes": ["wt2wt"],
28589 "changes": [
28590 ["figcaption", "text", "new caption"]
28591 ]
28592 }
28593 !! wikitext
28594 [[Image:Foobar.jpg|thumb|original caption]]
28595 !! wikitext/edited
28596 [[Image:Foobar.jpg|thumb|new caption]]
28597 !!end
28598
28599 !! test
28600 Image: empty alt attribute (T50924)
28601 !! options
28602 parsoid
28603 !! wikitext
28604 [[File:Foobar.jpg|thumb|alt=|bar]]
28605 !! html
28606 <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>
28607 !! end
28608
28609 !! test
28610 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
28611 !! options
28612 parsoid=html2wt
28613 language=ar
28614 disabled
28615 !! html/parsoid
28616 <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>
28617 !! wikitext
28618 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
28619 !! end
28620
28621 !! test
28622 Image: Block level image should have \n before and after
28623 !! wikitext
28624 123
28625 [[File:Foobar.jpg|right|thumb|150x150px]]
28626 456
28627 !! html/parsoid
28628 <p>123</p>
28629 <figure class="mw-halign-right" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150"/></a></figure>
28630 <p>456</p>
28631 !! end
28632
28633 !! test
28634 Image: New block level image should have \n before and after (existing content)
28635 !! wikitext
28636 123
28637 [[File:Foobar.jpg|right|thumb|150x150px]]
28638 456
28639 !! html/parsoid
28640 <p>123</p>
28641 <figure class="mw-halign-right" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"right","ak":"right"},{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"150x150px"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"17","width":"150"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure>
28642 <p>456</p>
28643 !! end
28644
28645 !! test
28646 Image: upright option (parsoid)
28647 !! wikitext
28648 [[File:Foobar.jpg|thumb|upright|caption]]
28649 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
28650 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
28651 !! html/parsoid
28652 <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>
28653 <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>
28654 <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>
28655 !! end
28656
28657 !! test
28658 Image: upright option is ignored on inline and frame images (parsoid)
28659 !! wikitext
28660 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
28661 !! html/parsoid
28662 <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>
28663 !! end
28664
28665 !! test
28666 Image: in template parameter with empty parameter
28667 !! wikitext
28668 {{echo|[[File:Foobar.jpg|link=]]}}
28669 !! html/parsoid
28670 <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>
28671 !! end
28672
28673 !! test
28674 Image: from basic HTML (1)
28675 !! options
28676 parsoid=html2wt
28677 !! html/parsoid
28678 <span typeof="mw:Image">
28679 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28680 </span>
28681 !! wikitext
28682 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28683 !! end
28684
28685 !! test
28686 Image: from basic HTML (2)
28687 !! options
28688 parsoid=html2wt
28689 !! html/parsoid
28690 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28691 !! wikitext
28692 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28693 !! end
28694
28695 !! test
28696 Image: from basic HTML (3)
28697 !! options
28698 parsoid=html2wt
28699 !! html/parsoid
28700 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
28701 !! wikitext
28702 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
28703 !! end
28704
28705 !! test
28706 Image: from basic HTML (4)
28707 !! options
28708 parsoid=html2wt
28709 !! html/parsoid
28710 <img src="./File:Foobar.jpg">
28711 !! wikitext
28712 [[File:Foobar.jpg|link=]]
28713 !! end
28714
28715 !! test
28716 Image: Invalid title as link
28717 !! wikitext
28718 [[File:Foobar.jpg|link=<]]
28719 !! html/php
28720 <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" width="1941" height="220" /></a>
28721 </p>
28722 !! html/parsoid
28723 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=&lt;"}]}' data-mw='{"caption":"link=&amp;lt;"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
28724 !! end
28725
28726 !! test
28727 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
28728 !! options
28729 parsoid=html2wt
28730 !! html/parsoid
28731 <ul>
28732 <li><p>foo</p></li>
28733 </ul>
28734 !! wikitext
28735 * foo
28736 !! end
28737
28738 !! test
28739 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
28740 !! options
28741 parsoid=html2wt
28742 !! html/parsoid
28743 <ul> <li>foo</li></ul>
28744 !! wikitext
28745 * foo
28746 !! end
28747
28748 !! test
28749 Don't strip leading whitespace when handling indent-pre suppressing tags
28750 !! options
28751 parsoid=html2wt
28752 !! html/parsoid
28753 <table>
28754 <tr><td> indented row</td></tr>
28755 </table>
28756 <blockquote><p>
28757 <b>This is very bold of you!</b>
28758 </p>
28759 <table><tr><td>
28760 indented cell (no pre-wrapping!)
28761 </td></tr></table>
28762 </blockquote>
28763 <p>foo</p>
28764 <div>bar</div>
28765 !! wikitext
28766 {|
28767 | indented row
28768 |}
28769 <blockquote>
28770 '''This is very bold of you!'''
28771
28772 {|
28773 |
28774 indented cell (no pre-wrapping!)
28775 |}
28776 </blockquote>
28777 foo
28778 <div>bar</div>
28779 !! end
28780
28781 !! test
28782 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
28783 !! options
28784 parsoid=html2wt
28785 !! html/parsoid
28786 <p>foo</p>
28787 <span>bar</span>
28788
28789 <span>foo2
28790 </span>bar2
28791
28792 <div>foo</div>
28793 <span>bar</span>
28794
28795 <div>
28796 <span>foo</span>
28797 </div>
28798 !! wikitext
28799 foo
28800
28801 <span>bar</span>
28802
28803 <span>foo2
28804 <nowiki> </nowiki></span>bar2
28805
28806 <div>foo</div>
28807 <nowiki> </nowiki><span>bar</span>
28808
28809 <div>
28810 <nowiki> </nowiki><span>foo</span>
28811 </div>
28812 !! end
28813
28814 !! test
28815 Lists: Dont insert newlines in a serialized list item.
28816 !! options
28817 parsoid=html2wt
28818 !! html/parsoid
28819 <ul><li>a<br>b</li><li>c</li></ul>
28820 !! wikitext
28821 * a<br />b
28822 * c
28823 !! end
28824
28825 !! test
28826 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
28827 !! options
28828 parsoid={
28829 "modes": ["html2wt"],
28830 "scrubWikitext": false
28831 }
28832 !! html/parsoid
28833 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28834 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28835
28836 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28837 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28838
28839 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
28840
28841 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28842 !! wikitext
28843 == hello there [[Category:A1]] ==
28844
28845 == [[Category:A2]] hi pal ==
28846
28847 == <!--foo--> [[Category:A3]] how goes it ==
28848
28849 == it goes well [[Category:A4]] <!--bar--> ==
28850
28851 ==howdy [[Category:A5]]==
28852
28853 == __TOC__ ok ==
28854 !! end
28855
28856 !! test
28857 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
28858 !! options
28859 parsoid={
28860 "modes": ["html2wt"],
28861 "scrubWikitext": true
28862 }
28863 !! html/parsoid
28864 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28865 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28866
28867 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28868 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28869
28870 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28871 !! wikitext
28872 == hello there ==
28873 [[Category:A1]]
28874 [[Category:A2]]
28875
28876 == hi pal ==
28877
28878 <!--foo-->[[Category:A3]]
28879
28880 == how goes it ==
28881
28882 == it goes well ==
28883 [[Category:A4]] <!--bar-->
28884
28885 __TOC__
28886
28887 == ok ==
28888 !! end
28889
28890 !! test
28891 Headings: Don't hoist metas that come from templates
28892 !! options
28893 parsoid={
28894 "modes": ["html2wt"],
28895 "scrubWikitext": true
28896 }
28897 !! html/parsoid
28898 <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>
28899 !! wikitext
28900 == {{echo|foo [[Category:Foo]]}} ==
28901 !! end
28902
28903 !! test
28904 Headings: Category in ref isn't hoisted
28905 !! options
28906 parsoid={
28907 "modes": ["html2wt"],
28908 "scrubWikitext": true
28909 }
28910 !! html/parsoid
28911 <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>
28912
28913 <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>
28914 !! wikitext
28915 == foo <ref>bar
28916 [[Category:Baz]] </ref> ==
28917
28918 <references />
28919 !! end
28920
28921 !! test
28922 Parsoid: Serialize positional parameters with = in them as named parameter
28923 !! options
28924 parsoid=html2wt
28925 !! html/parsoid
28926 <p about="#mwt1" typeof="mw:Transclusion"
28927 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
28928
28929 <p about="#mwt1" typeof="mw:Transclusion"
28930 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
28931
28932 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28933 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28934 <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>
28935 !! wikitext
28936 {{echo|1=f=oo}}
28937
28938 {{echo|1=f=oo|2=bar}}
28939
28940 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28941 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28942 {{echo|<nowiki>f=oo</nowiki>|bar}}
28943 !! end
28944
28945 !! test
28946 Parsoid: Serialize positional parameters with = in extlink as named parameter
28947 !! options
28948 parsoid=html2wt
28949 !! html/parsoid
28950 <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>
28951 !! wikitext
28952 {{echo|1=http://stuff?is=ok}}
28953 !! end
28954
28955 !! test
28956 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
28957 !! options
28958 parsoid=html2wt
28959 !! html/parsoid
28960 <div>a<p>b</p></div>
28961 <div>a
28962 <p>b</p></div>
28963 <div>
28964 a
28965 <p>b</p></div>
28966 !! wikitext
28967 <div>a
28968 b
28969 </div>
28970 <div>a
28971 b
28972 </div>
28973 <div>
28974 a
28975
28976 b
28977 </div>
28978 !! end
28979
28980 !! test
28981 Substrings resembling wikitext in hrefs should not get nowiki escapes
28982 !! options
28983 parsoid=html2wt
28984 !! html/parsoid
28985 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
28986 !! wikitext
28987 [[Foo''bar''baz]]
28988 !! end
28989
28990 !! test
28991 Enforce single-line context in the serializer
28992 !! options
28993 parsoid=html2wt
28994 !! html/parsoid
28995 <h2>testing
28996 123</h2>
28997
28998 <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">
28999 </span><span about="#mwt1">you</span> </h2>
29000
29001 <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>
29002
29003 <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
29004 there</span></li></ol>
29005
29006 <ul><li>asd
29007 sdf</li></ul>
29008
29009 <ul><li>foo
29010 bar
29011 baz</li>
29012 <li>foo <b>bar</b>
29013 baz</li></ul>
29014
29015 <dl><dt>hi
29016 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
29017 ho</dd></dl>
29018
29019 <dl><dd> <table>
29020 <tbody><tr><td> ha
29021 ha
29022 ha</td></tr>
29023 </tbody></table></dd></dl>
29024 !! wikitext
29025 == testing 123 ==
29026
29027 == hi {{bogus|there
29028 you}} ==
29029
29030 == foo <ref>hello
29031 there</ref> ==
29032
29033 <references />
29034
29035 * asd sdf
29036
29037 * foo bar baz
29038 * foo '''bar''' baz
29039
29040 ; hi ho : hi ho
29041
29042 : {|
29043 | ha
29044 ha
29045 ha
29046 |}
29047 !! end
29048
29049 !! test
29050 Serialize new placeholder space without spans
29051 !! options
29052 parsoid=html2wt
29053 !! html/parsoid
29054 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
29055
29056 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
29057
29058 <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>
29059 !! wikitext
29060 foo : bar
29061
29062 foo : bar
29063
29064 <ref>foo : bar</ref>ok
29065 !! end
29066
29067
29068 #-----------------------
29069 # Tag minimization tests
29070 #-----------------------
29071
29072 !! test
29073 1. I/B quote minimization: wikitext-only tags should be combined
29074 !! options
29075 parsoid=html2wt
29076 !! html/parsoid
29077 <p><i>A</i><i>B</i></p>
29078 <p><b>A</b><b>B</b></p>
29079 <p><i>A</i><b><i>B</i></b></p>
29080 <p><b>A</b><i><b>B</b></i></p>
29081 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
29082 <p><i><b>A</b></i><i><b>B</b></i></p>
29083 <p><i><b>A</b></i><b><i>B</i></b></p>
29084 <p><b><i>A</i></b><i><b>B</b></i></p>
29085 !! wikitext
29086 ''AB''
29087
29088 '''AB'''
29089
29090 ''A'''B'''''
29091
29092 '''A''B'''''
29093
29094 '''A''BC''D'''
29095
29096 '''''AB'''''
29097
29098 '''''AB'''''
29099
29100 '''''AB'''''
29101 !! end
29102
29103 !! test
29104 2. I/B quote minimization: wikitext and html tags should not be combined
29105 !! options
29106 parsoid=html2wt
29107 !! html/parsoid
29108 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
29109 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
29110 !! wikitext
29111 ''A''<i>B</i>
29112
29113 ''A''<nowiki/>'''<i>B</i>'''
29114 !! end
29115
29116 !! test
29117 3. I/B quote minimization: templated content stops minimization
29118 !! options
29119 parsoid=html2wt
29120 !! html/parsoid
29121 <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>
29122 <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>
29123 !! wikitext
29124 ''A''{{echo|''B''}}
29125
29126 ''A''{{echo|'''''B'''''}}
29127 !! end
29128
29129 !! test
29130 4. I/B quote minimization: new content should be mimimized with adjacent old content
29131 !! options
29132 parsoid=html2wt
29133 !! html/parsoid
29134 <p><i>A</i><i>B</i></p>
29135 <p><b>A</b><b>B</b></p>
29136 <p><i>A</i><b><i>B</i></b></p>
29137 !! wikitext
29138 ''AB''
29139
29140 '''AB'''
29141
29142 ''A'''B'''''
29143 !! end
29144
29145 !! test
29146 5a. Merge adjacent quote nodes if they've been edited
29147 !! options
29148 parsoid={
29149 "modes": ["wt2wt", "selser"],
29150 "changes": [
29151 ["p", "contents", "remove", ":contains('b')"]
29152 ]
29153 }
29154 !! wikitext
29155 ''a''b''c''
29156 !! wikitext/edited
29157 ''ac''
29158 !! end
29159
29160 !! test
29161 5b. Merge adjacent quote nodes if they've been edited
29162 !! options
29163 parsoid={
29164 "modes": ["wt2wt", "selser"],
29165 "changes": [
29166 ["#x", "remove"]
29167 ]
29168 }
29169 !! wikitext
29170 ''a''<span id="x">b</span>''c''
29171 !! wikitext/edited
29172 ''ac''
29173 !! end
29174
29175 !! test
29176 1. Merge adjacent link nodes as long as at least one element is new
29177 !! options
29178 parsoid={
29179 "modes": ["html2wt"],
29180 "scrubWikitext": true
29181 }
29182 !! html/parsoid
29183 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29184 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29185 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
29186 !! wikitext
29187 [[Football]]
29188 [[Football]]
29189 [[Football|Foot]][[Football|ball]]
29190 !! end
29191
29192 !! test
29193 2. Merge adjacent link nodes and enable additional normalizations
29194 !! options
29195 parsoid={
29196 "modes": ["html2wt"],
29197 "scrubWikitext": true
29198 }
29199 !! html/parsoid
29200 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
29201 !! wikitext
29202 ''[[Football]]''
29203 !! end
29204
29205 !! test
29206 3. Don't merge adjacent link nodes if scrubWikitext is false
29207 !! options
29208 parsoid={
29209 "modes": ["html2wt"],
29210 "scrubWikitext": false
29211 }
29212 !! html/parsoid
29213 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29214 !! wikitext
29215 [[Football|Foot]][[Football|ball]]
29216 !! end
29217
29218 !! test
29219 1. Move format tags outside of WikiLink
29220 !! options
29221 parsoid={
29222 "modes": ["html2wt"],
29223 "scrubWikitext": true
29224 }
29225 !! html/parsoid
29226 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
29227 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
29228 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
29229 !! wikitext
29230 ''[[Football]]''
29231 '''''[[Football]]'''''
29232 <u>'''''[[Football]]'''''</u>
29233 !! end
29234
29235 !! test
29236 2. Move format tags outside of WikiLink with mergable A tags
29237 !! options
29238 parsoid={
29239 "modes": ["html2wt"],
29240 "scrubWikitext": true
29241 }
29242 !! html/parsoid
29243 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
29244 !! wikitext
29245 '''''[[Football]]'''''
29246 !! end
29247
29248 !! test
29249 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
29250 !! options
29251 parsoid={
29252 "modes": ["html2wt"],
29253 "scrubWikitext": true
29254 }
29255 !! html/parsoid
29256 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
29257 !! wikitext
29258 <font color="red"><u>'''[[Foo]]'''</u></font>
29259 !! end
29260
29261 !! test
29262 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
29263 !! options
29264 parsoid={
29265 "modes": ["html2wt"],
29266 "scrubWikitext": true
29267 }
29268 !! html/parsoid
29269 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
29270 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
29271 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
29272 !! wikitext
29273 [[Foo|<font color="red">Foo</font>]]
29274 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
29275 [[Foo|<span class="Bar">Foo</span>]]
29276 !! end
29277
29278 !! test
29279 5. T194083 Regression test: Manual edit test that also enables scrubWikitext to move format tags outside wikilinks
29280 !! options
29281 parsoid={
29282 "modes": ["selser"],
29283 "scrubWikitext": true,
29284 "changes": [
29285 ["a", "html", "<i>Foo</i>"]
29286 ]
29287 }
29288 !! wikitext
29289 [[Foo]]
29290 !! wikitext/edited
29291 ''[[Foo]]''
29292 !! end
29293
29294 !! test
29295 6. Regression test: Manual edit test to ensure diff markers are not lost
29296 !! options
29297 parsoid={
29298 "modes": ["selser"],
29299 "scrubWikitext": true,
29300 "changes": [
29301 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
29302 ]
29303 }
29304 !! wikitext
29305 ''Foo''
29306 !! wikitext/edited
29307 ''[[Foo]]''
29308 !! end
29309
29310 !! test
29311 7. T194083 Regression test: Manual edit test to ensure nested diff markers aren't inserted
29312 !! options
29313 parsoid={
29314 "modes": ["selser"],
29315 "scrubWikitext": true,
29316 "changes": [
29317 ["div", "after", "\n<p><a href='./Foo' rel='mw:WikiLink'>Foo </a>, placeholder</p>"]
29318 ]
29319 }
29320 !! wikitext
29321 <div>placeholder</div>
29322 !! wikitext/edited
29323 <div>placeholder</div>
29324 [[Foo]] , placeholder
29325 !! end
29326
29327 #------------------------------
29328 # End of tag minimization tests
29329 #------------------------------
29330
29331 !!test
29332 T56262: New entities
29333 !! options
29334 parsoid=html2wt
29335 !! html/parsoid
29336 <span typeof="mw:Entity">&nbsp;</span>
29337 !! wikitext
29338 &nbsp;
29339 !! end
29340
29341 ## Note that there is no wikitext output for 'unknownproperty' ##
29342 ## Unknown magic words are silently dropped ##
29343
29344 !! test
29345 Magic words
29346 !! options
29347 parsoid=html2wt
29348 !! html/parsoid
29349 <meta property='mw:PageProp/toc' />
29350 <meta property='mw:PageProp/notoc' />
29351 <meta property='mw:PageProp/forcetoc' />
29352 <meta property='mw:PageProp/index' />
29353 <meta property='mw:PageProp/noindex' />
29354 <meta property='mw:PageProp/nogallery' />
29355 <meta property='mw:PageProp/noeditsection' />
29356 <meta property='mw:PageProp/notitleconvert' />
29357 <meta property='mw:PageProp/nocontentconvert' />
29358 <meta property='mw:PageProp/unknownproperty' />
29359 !! wikitext
29360 __TOC__
29361 __NOTOC__
29362 __FORCETOC__
29363 __INDEX__
29364 __NOINDEX__
29365 __NOGALLERY__
29366 __NOEDITSECTION__
29367 __NOTITLECONVERT__
29368 __NOCONTENTCONVERT__
29369 !! end
29370
29371 !! test
29372 Consecutive <pre>s should not get merged
29373 !! options
29374 parsoid=html2wt,html2html
29375 !! html/parsoid
29376 <pre>a</pre><pre>b</pre>
29377
29378 <pre>c
29379 </pre><pre>
29380 d</pre>
29381
29382 <pre>e
29383
29384 </pre><pre>
29385
29386 f</pre>
29387 !! wikitext
29388 a
29389
29390 b
29391
29392 c
29393
29394 d
29395
29396 e
29397
29398
29399
29400 f
29401 !! end
29402
29403 !! test
29404 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
29405 !! options
29406 parsoid=html2wt
29407 !! html/parsoid
29408 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
29409 !! wikitext
29410 [[Special:BookSources/1234567890|ISBN 1234567895]]
29411 !! end
29412
29413 !! test
29414 Edited RFC links not serializable as RFC links should serialize as extlinks
29415 !! options
29416 parsoid=html2wt
29417 !! html/parsoid
29418 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
29419 !! wikitext
29420 [https://tools.ietf.org/html/rfc123 New RFC]
29421 !! end
29422
29423 !! test
29424 Edited PMID links not serializable as PMID links should serialize as extlinks
29425 !! options
29426 parsoid=html2wt
29427 !! html/parsoid
29428 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
29429 !! wikitext
29430 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
29431 !! end
29432
29433 !! test
29434 WTS of autolinks with trailing/surrounding context
29435 !! options
29436 parsoid=html2wt
29437 !! html/parsoid
29438 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
29439 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
29440 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
29441 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
29442 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
29443 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
29444 !! wikitext
29445 http://cscott.net'''foo'''
29446
29447 http://cscott.net<b>foo</b>
29448
29449 '''http://cscott.net'''
29450
29451 '''http://cscott.net '''
29452
29453 '''http://cscott.net<nowiki/>x'''
29454
29455 http://cscott.net<nowiki/>x
29456 !! end
29457
29458 !! test
29459 WTS of autolinks with nowikis (round-trip)
29460 !! wikitext
29461 x<nowiki/>http://cscott.net<nowiki/>x
29462 !! html/parsoid
29463 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
29464 !! end
29465
29466 # this is the "easy" test because it leaves in place all the
29467 # data-parsoid information indicating this is an autolink
29468 !! test
29469 WTS of autolinks with escapes (editing)
29470 !! options
29471 parsoid={
29472 "modes": ["wt2wt"],
29473 "changes": [
29474 [ "span", "remove" ]
29475 ]
29476 }
29477 !! wikitext
29478 x<nowiki/>http://cscott.net<nowiki/>x
29479 !! wikitext/edited
29480 x<nowiki/>http://cscott.net<nowiki/>x
29481 !! end
29482
29483 !! test
29484 WTS of edited autolink-like text (T103364)
29485 !! options
29486 parsoid={
29487 "modes": ["wt2wt"],
29488 "changes": [
29489 [ "span[typeof]", "removeAttr", "typeof" ]
29490 ]
29491 }
29492 !! wikitext
29493 Not a link: <nowiki>http://example.com</nowiki>.
29494 !! wikitext/edited
29495 Not a link: <span><nowiki>http://example.com</nowiki></span>.
29496 !! end
29497
29498 !! test
29499 WTS of newly-authored autolink-like text (T103364)
29500 !! options
29501 parsoid=html2wt
29502 !! html/parsoid
29503 <p>http://example.com is not a link.</p>
29504 !! wikitext
29505 <nowiki>http://example.com</nowiki> is not a link.
29506 !! end
29507
29508 !! test
29509 WTS of autolink-like text after an autolink (T108563)
29510 !! options
29511 parsoid=html2wt
29512 !! html/parsoid
29513 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
29514 !! wikitext
29515 http://example.com <nowiki>http://example.com</nowiki> is not a link.
29516 !! end
29517
29518 !! test
29519 Magic links inside links (not autolinked)
29520 !! wikitext
29521 [[Foo|http://example.com]]
29522 [[Foo|RFC 1234]]
29523 [[Foo|PMID 1234]]
29524 [[Foo|ISBN 123456789x]]
29525
29526 [http://foo.com http://example.com]
29527 [http://foo.com RFC 1234]
29528 [http://foo.com PMID 1234]
29529 [http://foo.com ISBN 123456789x]
29530 !! html+tidy
29531 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
29532 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
29533 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
29534 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
29535 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
29536 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
29537 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
29538 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
29539 </p>
29540 !! html/parsoid
29541 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
29542 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
29543 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
29544 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
29545
29546 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
29547 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
29548 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
29549 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
29550 !! end
29551
29552 !! test
29553 Magic links inside image captions (autolinked)
29554 !! wikitext
29555 [[File:Foobar.jpg|thumb|http://example.com]]
29556 [[File:Foobar.jpg|thumb|RFC 1234]]
29557 [[File:Foobar.jpg|thumb|PMID 1234]]
29558 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
29559 !! html+tidy
29560 <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" 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>
29561 <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" 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>
29562 <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" 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>
29563 <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" 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>
29564 !! html/parsoid
29565 <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>
29566 <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>
29567 <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>
29568 <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>
29569 !! end
29570
29571 !! test
29572 WTS of magic word text (T109371)
29573 !! options
29574 parsoid=html2wt
29575 !! html/parsoid
29576 <p>RFC 1234</p>
29577 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
29578 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
29579 !! wikitext
29580 <nowiki>RFC 1234</nowiki>
29581
29582 [http://foo.com RFC 1234]
29583
29584 [[Foo|RFC 1234]]
29585 !! end
29586
29587 !! test
29588 Edited Redirect link should emit a non-piped wikitext link
29589 !! options
29590 parsoid=html2wt
29591 !! html/parsoid
29592 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
29593 !! wikitext
29594 #REDIRECT [[Bar]]
29595 !! end
29596
29597 !! test
29598 T75121: Infer extension name from typeOf if data-mw is not present
29599 !! options
29600 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29601 !! html/parsoid
29602 <div typeOf="mw:Extension/foo"></div>
29603 !! wikitext
29604 <foo />
29605 !! end
29606
29607 # Note that the <p> wrapping isn't present in PHP parser output
29608 # The important thing for this test is that P-wrapping doesn't
29609 # interfere with the <nowiki> protection for leading - in <td>
29610 # (which isn't necessary for <th>).
29611 !! test
29612 T88318: p-wrapped dash in table.
29613 !! options
29614 parsoid=html2wt,wt2wt
29615 !! html/parsoid
29616 <table><tbody>
29617 <tr><th><p>-</p></th><th><p>- </p></th></tr>
29618 <tr><td><p>-</p></td><td><p>- </p></td></tr>
29619 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
29620 </tbody></table>
29621 !! wikitext
29622 {|
29623 !-
29624 !-
29625 |-
29626 |<nowiki>-</nowiki>
29627 |<nowiki>- </nowiki>
29628 |-
29629 |<small>-</small>
29630 |<br />
29631 -
29632 |<br />-
29633 |}
29634 !! html/php+tidy
29635 <table>
29636 <tbody><tr>
29637 <th>-
29638 </th>
29639 <th>-
29640 </th></tr>
29641 <tr>
29642 <td>-
29643 </td>
29644 <td>-
29645 </td></tr>
29646 <tr>
29647 <td><small>-</small>
29648 </td>
29649 <td><br />
29650 <p>-
29651 </p>
29652 </td>
29653 <td><br />-
29654 </td></tr></tbody></table>
29655 !! end
29656
29657 !! test
29658 T149209: WTS: Handle newlines in table cells properly
29659 !! options
29660 parsoid=html2wt
29661 !! html/parsoid
29662 <table>
29663 <tbody>
29664 <tr><td>a
29665 b
29666 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
29667 <tr><td><p>x</p>
29668 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
29669 </tbody></table>
29670 <table>
29671 <tbody>
29672 <tr><th>a
29673 b
29674 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
29675 <tr><th><p>x</h>
29676 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
29677 </tbody></table>
29678 !! wikitext
29679 {|
29680 |a
29681 b
29682 |c
29683 |-
29684 |x
29685 {{!}}y
29686 |}
29687 {|
29688 !a
29689 b
29690 !c
29691 |-
29692 !x
29693 !y
29694 |}
29695 !! end
29696
29697 !! test
29698 T149209: Selser: Handle newlines in table cells properly
29699 !! options
29700 parsoid={
29701 "modes": ["selser"],
29702 "changes": [
29703 [ "#h1", "html", "a\nb\n" ],
29704 [ "#h2", "html", "a\nb\n" ],
29705 [ "#c1", "html", "a\nb\n" ],
29706 [ "#c2", "html", "<p>a</p>" ],
29707 [ "#c3", "html", "<p>a</p>" ],
29708 [ "#c4", "html", "edit-me<p>a</p>" ]
29709 ]
29710 }
29711 !! wikitext
29712 {|
29713 ! id="h1" |edit-me!!1
29714 |-
29715 ! id="h2" |edit-me||2
29716 |-
29717 | id="c1" |edit-me||3
29718 |-
29719 | id="c2" |edit-me||4
29720 |-
29721 | id="c3" |edit-me||p||q||r
29722 |-
29723 | id="c4" |edit-me||p||q||r
29724 |}
29725 !! wikitext/edited
29726 {|
29727 ! id="h1" |a
29728 b
29729 !1
29730 |-
29731 ! id="h2" |a
29732 b
29733 !2
29734 |-
29735 | id="c1" |a
29736 b
29737 |3
29738 |-
29739 | id="c2" |a
29740 |4
29741 |-
29742 | id="c3" |a
29743 |p||q||r
29744 |-
29745 | id="c4" |edit-me
29746 a
29747 |p||q||r
29748 |}
29749 !! end
29750
29751 !! test
29752 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
29753 !! options
29754 parsoid=html2wt
29755 !! html/parsoid
29756 <table id='mwAb'>
29757 <td id='mwAc'>foo</td>
29758 <td id='serialize-this'>bar</td>
29759 </table>
29760 !! wikitext
29761 {|
29762 |foo
29763 | id="serialize-this" |bar
29764 |}
29765 !! end
29766
29767 !! test
29768 Parsoid-like element ids should not be serialized to wikitext unless shadowed
29769 !! options
29770 parsoid=html2wt
29771 !! html/parsoid
29772 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
29773 !! wikitext
29774 <div id="hello">ok</div>
29775 !! end
29776
29777 !! test
29778 Testing serialization after deletion in references
29779 !! options
29780 parsoid={
29781 "modes": ["wt2wt"],
29782 "changes": [
29783 ["#x", "remove"]
29784 ]
29785 }
29786 !! wikitext
29787 hi <ref><div id="x">ho</div></ref>
29788
29789 <references />
29790 !! wikitext/edited
29791 hi <ref></ref>
29792
29793 <references />
29794 !! end
29795
29796 !!test
29797 Testing serialization after deletion of table cells
29798 !!options
29799 parsoid={
29800 "modes": ["wt2wt", "selser"],
29801 "changes": [
29802 ["#x", "remove"]
29803 ]
29804 }
29805 !!wikitext
29806 {|
29807 !h1 !!h2 !!h3
29808 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
29809 |}
29810 !! wikitext/edited
29811 {|
29812 !h1!!h2!!h3
29813 |c2|||c3
29814 |}
29815 !!end
29816
29817 !! test
29818 Testing selser after addition of new row before first row (T125419)
29819 !! options
29820 parsoid={
29821 "modes": ["wt2wt", "selser"],
29822 "changes": [
29823 [ "tr", "before", "<tr><td>X</td></tr>" ]
29824 ]
29825 }
29826 !! wikitext
29827 {|
29828 |a
29829 |}
29830 !! wikitext/edited
29831 {|
29832 |X
29833 |-
29834 |a
29835 |}
29836 !! end
29837
29838 !! test
29839 Serialize new table rows in a HTML table using HTML tags
29840 !! options
29841 parsoid={
29842 "modes": ["wt2wt", "selser"],
29843 "changes": [
29844 [ "tr", "before", "<tr><td>X</td></tr>" ]
29845 ]
29846 }
29847 !! wikitext
29848 <table><tr><td>a</td></tr></table>
29849 !! wikitext/edited
29850 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
29851 !! end
29852
29853 !! test
29854 Serialize new table cells in a HTML row using HTML tags
29855 !! options
29856 parsoid={
29857 "modes": ["wt2wt", "selser"],
29858 "changes": [
29859 [ "td", "before", "<td>X</td>" ]
29860 ]
29861 }
29862 !! wikitext
29863 <table><tr><td>a</td></tr></table>
29864 !! wikitext/edited
29865 <table><tr><td>X</td><td>a</td></tr></table>
29866 !! end
29867
29868 !! test
29869 Serialize wikitext list items as HTML list items when embedded in a HTML list
29870 !! options
29871 parsoid=html2wt
29872 !! html
29873 <ul data-parsoid='{"stx": "html"}'>
29874 <li data-parsoid='{}'>a</li>
29875 <li>b</li>
29876 </ul>
29877 !! wikitext
29878 <ul>
29879 <li>a</li>
29880 <li>b</li>
29881 </ul>
29882 !! end
29883
29884 # SSS FIXME: Is this actually a good thing given the
29885 # odd nested list output that is generated by MW?
29886 # <ul><li>foo<ul>..</ul></li></ul> instead of
29887 # <ul><li>foo</li><ul>..</ul></ul>
29888 !! test
29889 Wikitext lists can be nested inside HTML lists
29890 !! options
29891 parsoid=html2wt
29892 !! html
29893 <ul data-parsoid='{"stx": "html"}'>
29894 <li data-parsoid='{"stx": "html"}'>a
29895 <ul><li>b</li></ul>
29896 </li>
29897 </ul>
29898
29899 <ul data-parsoid='{"stx": "html"}'>
29900 <li>x
29901 <ul><li>y</li></ul>
29902 </li>
29903 </ul>
29904 !! wikitext
29905 <ul>
29906 <li>a
29907 * b
29908 </li>
29909 </ul>
29910
29911 <ul>
29912 <li>x
29913 * y
29914 </li>
29915 </ul>
29916 !! end
29917
29918 !! test
29919 WTS change modes
29920 !! options
29921 parsoid={
29922 "modes": ["wt2wt"],
29923 "changes": [
29924 [ "#xyz", "before", "<b>before</b> stuff " ],
29925 [ "#xyz", "after", " stuff <i>after</i>" ],
29926 [ "#xyz", "html", "x <b>y</b> z" ]
29927 ]
29928 }
29929 !! wikitext
29930 <span id="xyz">hello</span>
29931 !! wikitext/edited
29932 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
29933 !! end
29934
29935 !! test
29936 Never serialize a-tag as html, regardless of what data-parsoid has to say
29937 !! options
29938 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29939 !! html/parsoid
29940 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
29941 !! wikitext
29942 [[Foo]]
29943 !! end
29944
29945 ## SSS FIXME: This is broken output nevertheless.
29946 ## What might be a reasonable non-broken output for this?
29947 ## This is an edge case unlikely to be seen in production
29948 ## that I am not wasting more time on this right now.
29949 !! test
29950 Never serialize a-tag as html, no matter what attributes it has
29951 !! options
29952 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29953 !! html/parsoid
29954 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
29955 !! wikitext
29956 [http://boo.org http://boohoo.org]
29957 !! end
29958
29959 # Misnested is an indication that selser can reuse the source but these have
29960 # shown to sneak through on occasion. See T101768.
29961 # The original wikitext here is: [http://test.com [[one]] two three]
29962 !! test
29963 Strip span tags added to mark misnested links
29964 !! options
29965 parsoid=html2wt
29966 !! html/parsoid
29967 <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>
29968 !! wikitext
29969 [http://test.com][[one]] two three
29970 !! end
29971
29972 !! test
29973 Catch regression when unpacking misnested links
29974 !! options
29975 parsoid=wt2html
29976 !! wikitext
29977 {{echo|hi}}[http://example.com [[ho]]]
29978 !! html/parsoid
29979 <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>
29980 !! end
29981
29982 !! test
29983 Catch regression when unpacking with trailing content
29984 !! wikitext
29985 {{echo|Foo <references/> bar}}
29986 !! html/parsoid
29987 <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>
29988 !! end
29989
29990 !! test
29991 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
29992 !! options
29993 parsoid=html2wt
29994 !! html/parsoid
29995 <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|}"]}'>
29996 <tbody><tr><td>d
29997 </td></tr>
29998 </tbody></table>
29999 !! wikitext
30000 {{echo|a}}
30001 {|{{echo|c
30002 {{!}}d
30003 }}
30004 |}
30005 !! end
30006
30007 ## This test verifies the presence and computation of this attribute indirectly
30008 ## by making an edit and ensuring that the serialization is correct (which it would be
30009 ## only if firstWikitextNode is properly set).
30010 !! test
30011 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
30012 !! options
30013 parsoid= {
30014 "modes": ["wt2wt"],
30015 "changes": [
30016 [ "div#x", "remove" ],
30017 [ "div", "before", "<div>new</div>" ]
30018 ]
30019 }
30020 !! wikitext
30021 <div id="x">foo</div>
30022 {|
30023 {{echo|<div>boo</div>
30024 {{!}}b}}
30025 |c
30026 |}
30027 !! wikitext/edited
30028
30029 <div>new</div>
30030 {|
30031 {{echo|<div>boo</div>
30032 {{!}}b}}
30033 |c
30034 |}
30035 !! end
30036
30037 # --------------------------------------------
30038 # Tests spec'ing wikitext serialization norms |
30039 # --------------------------------------------
30040
30041 !! test
30042 Serialize multi-line indent-pre starting with wikitext syntax
30043 !! options
30044 parsoid=html2wt
30045 !! html/parsoid
30046 <pre>* 1
30047 ** 2
30048 * 3</pre>
30049 !! wikitext
30050 * 1
30051 ** 2
30052 * 3
30053 !! end
30054
30055 !! test
30056 1. Categories should always be serialized on their own line
30057 !! options
30058 parsoid=html2wt
30059 !! html/parsoid
30060 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
30061 !! wikitext
30062 foo
30063 [[Category:Foo]]
30064 bar
30065 !! end
30066
30067 !! test
30068 2. Categories that are part of templates should not introduce a line break
30069 !! wikitext
30070 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
30071 !! html/parsoid
30072 <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>
30073 !! end
30074
30075 # Careful while editing these next 2 tests. There are \u200f characters
30076 # before and after the <link> tags in the HTML and following some
30077 # of the categories in wikitext
30078 # Do not remove these characters in edits.
30079 #
30080 # As part of the serialization, these bidi characters will get stripped.
30081 !! test
30082 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
30083 !! options
30084 parsoid={
30085 "modes": ["html2wt"],
30086 "scrubWikitext": true
30087 }
30088 !! html/parsoid
30089 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
30090 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
30091 !! wikitext
30092 [[קטגוריה:טקסים]]
30093 [[קטגוריה: שיטות משפט]]
30094 !! end
30095
30096 !! test
30097 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
30098 !! options
30099 parsoid={
30100 "modes": ["html2wt"],
30101 "scrubWikitext": true
30102 }
30103 !! html/parsoid
30104 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
30105 !! wikitext
30106 [[קטגוריה:טקסים]]
30107 ‏y
30108 !! end
30109
30110 !! test
30111 Lists: Add space after bullets
30112 !! options
30113 parsoid=html2wt
30114 !! html/parsoid
30115 <ul>
30116 <li>foo</li>
30117 <li> bar</li>
30118 <li><span> baz</span></li>
30119 </ul>
30120 !! wikitext
30121 * foo
30122 * bar
30123 * <span> baz</span>
30124 !! end
30125
30126 !! test
30127 1. Headings: Add space before/after == (T53744)
30128 !! options
30129 parsoid=html2wt
30130 !! html/parsoid
30131 <h2>foo</h2>
30132 <h2> bar</h2>
30133 <h2>baz </h2>
30134 <h2><span> baz</span></h2>
30135 !! wikitext
30136 == foo ==
30137
30138 == bar ==
30139
30140 == baz ==
30141
30142 == <span> baz</span> ==
30143 !! end
30144
30145 !! test
30146 2. Headings: Add space before/after == even after hoisted content
30147 !! options
30148 parsoid={
30149 "modes": ["html2wt"],
30150 "scrubWikitext": true
30151 }
30152 !! html/parsoid
30153 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
30154 !! wikitext
30155 [[Category:A2]]
30156
30157 == ok ==
30158 !! end
30159
30160 !! test
30161 1. Headings: suppress newly created empty headings
30162 !! options
30163 parsoid={
30164 "modes": ["html2wt"],
30165 "scrubWikitext": true
30166 }
30167 !! html/parsoid
30168 <h2></h2>
30169 !! wikitext
30170 !! end
30171
30172 !! test
30173 2. Headings: don't suppress empty headings if scrubWikitext is false
30174 !! options
30175 parsoid=html2wt
30176 !! html/parsoid
30177 <h2></h2>
30178 !! wikitext
30179 ==<nowiki/>==
30180 !! end
30181
30182 !! test
30183 3. Headings: suppress empty headings on edits
30184 !! options
30185 parsoid={
30186 "modes": ["selser"],
30187 "scrubWikitext": true,
30188 "changes": [
30189 [ "#x", "remove"]
30190 ]
30191 }
30192 !! wikitext
30193 ==<span id="x">foo</span>==
30194 !! wikitext/edited
30195 !! end
30196
30197 !! test
30198 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
30199 !! options
30200 parsoid={
30201 "modes": ["html2wt"],
30202 "scrubWikitext": true
30203 }
30204 !! html/parsoid
30205 <h2>foo<br/>bar</h2>
30206 <h2>foo <span><br/>bar</span> baz</h2>
30207 !! wikitext
30208 == foo bar ==
30209
30210 == foo <span> bar</span> baz ==
30211 !! end
30212
30213 !! test
30214 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
30215 !! options
30216 parsoid={
30217 "modes": ["html2wt"],
30218 "scrubWikitext": false
30219 }
30220 !! html/parsoid
30221 <h2>foo<br/>bar</h2>
30222 !! wikitext
30223 == foo<br />bar ==
30224 !! end
30225
30226 !! test
30227 1. WT Quote Tags: suppress newly created empty style tags
30228 !! options
30229 parsoid={
30230 "modes": ["html2wt"],
30231 "scrubWikitext": true
30232 }
30233 !! html/parsoid
30234 <i></i><b></b>
30235 !! wikitext
30236 !! end
30237
30238 !! test
30239 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
30240 !! options
30241 parsoid=html2wt
30242 !! html/parsoid
30243 <i></i><b></b>
30244 !! wikitext
30245 ''<nowiki/>'''''<nowiki/>'''
30246 !! end
30247
30248 !! test
30249 3. WT Quote Tags: suppress empty style tags on edits
30250 !! options
30251 parsoid={
30252 "modes": ["selser"],
30253 "scrubWikitext": true,
30254 "changes": [
30255 [ "#x", "remove"]
30256 ]
30257 }
30258 !! wikitext
30259 '''<span id="x">foo</span>'''
30260 !! wikitext/edited
30261 !! end
30262
30263 !! test
30264 1. Anchors: suppress newly created empty anchors
30265 !! options
30266 parsoid={
30267 "modes": ["html2wt"],
30268 "scrubWikitext": true
30269 }
30270 !! html/parsoid
30271 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
30272 !! wikitext
30273 !! end
30274
30275 !! test
30276 2. Anchors: don't suppress empty anchors if scrubWikitext is false
30277 !! options
30278 parsoid={
30279 "modes": ["html2wt"],
30280 "scrubWikitext": false
30281 }
30282 !! html/parsoid
30283 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
30284 !! wikitext
30285 [[Test|<nowiki/>]]
30286 !! end
30287
30288 !! test
30289 3. Anchors: suppress empty anchors on edits
30290 !! options
30291 parsoid={
30292 "modes": ["selser"],
30293 "scrubWikitext": true,
30294 "changes": [
30295 [ "#x", "remove"]
30296 ]
30297 }
30298 !! wikitext
30299 [[Test|<span id="x">foo</span>]]
30300 !! wikitext/edited
30301 !! end
30302
30303 !! test
30304 3a. Anchors: do not suppress numbered extlinks
30305 !! options
30306 parsoid={
30307 "modes": ["wt2wt"],
30308 "scrubWikitext": true
30309 }
30310 !! wikitext
30311 [http://foo.com]
30312 !! html/parsoid
30313 <a rel="mw:ExtLink" href="http://foo.com"></a>
30314 !! end
30315
30316 !! test
30317 3b. Anchors: do not suppress numbered extlinks
30318 !! options
30319 parsoid={
30320 "modes": ["wt2wt"],
30321 "scrubWikitext": true,
30322 "changes": [
30323 [ "#x", "remove"]
30324 ]
30325 }
30326 !! wikitext
30327 [http://foo.com <span id="x">foo</span>]
30328 !! wikitext/edited
30329 [http://foo.com]
30330 !! end
30331
30332 !!test
30333 Normalizations should be restricted to edited content
30334 !!options
30335 parsoid={
30336 "modes": ["selser"],
30337 "scrubWikitext": true,
30338 "changes": [
30339 [ "h1", "before", "<i></i>"]
30340 ]
30341 }
30342 !!wikitext
30343 a
30344 = =
30345 b
30346 !!wikitext/edited
30347 a
30348 = =
30349 b
30350 !!end
30351
30352 !! test
30353 1. Multiple normalizations (html2wt)
30354 !! options
30355 parsoid={
30356 "modes": ["html2wt"],
30357 "scrubWikitext": true
30358 }
30359 !! html
30360 <h2><i></i></h2>
30361 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
30362 </a><b><i></i></b>x</p>
30363 !! wikitext
30364
30365 [[foo]]
30366 x
30367
30368 !! end
30369
30370 !! test
30371 2. Multiple normalizations (selser)
30372 !! options
30373 parsoid={
30374 "modes": ["selser"],
30375 "scrubWikitext": true,
30376 "changes": [
30377 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
30378 ]
30379 }
30380 !! wikitext
30381 <span id="x">foo</span>
30382 !! wikitext/edited
30383 <span id="x">foo</span>
30384
30385 x
30386 !! end
30387
30388 !! test
30389 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
30390 !! options
30391 parsoid={
30392 "modes": ["html2wt"],
30393 "scrubWikitext": true
30394 }
30395 !! html/parsoid
30396 <p> hi</p>
30397 <p> hello</p>
30398 !! wikitext
30399 hi
30400
30401 hello
30402 !! end
30403
30404 !! test
30405 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
30406 !! options
30407 parsoid=html2wt
30408 !! html/parsoid
30409 <p> hi</p>
30410 <p> hello</p>
30411 !! wikitext
30412 <nowiki> </nowiki>hi
30413
30414 <nowiki> </nowiki> hello
30415 !! end
30416
30417 !! test
30418 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
30419 !! options
30420 parsoid={
30421 "modes": ["html2wt"],
30422 "scrubWikitext": true
30423 }
30424 !! html/parsoid
30425 <p>Foo
30426 bar
30427 baz</p>
30428
30429 <table><tr><td>Foo
30430 bar
30431 baz bang</td></tr></table>
30432
30433 <p><!--boo--> foo
30434 bar</p>
30435
30436 <p> foo
30437 bar<span>boo</span></p>
30438 !! wikitext
30439 Foo
30440 bar
30441 baz
30442
30443 {|
30444 |Foo
30445 bar
30446 baz bang
30447 |}
30448
30449 <!--boo-->foo
30450 bar
30451
30452 foo
30453 bar<span>boo</span>
30454 !! end
30455
30456 !! test
30457 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
30458 !! options
30459 parsoid={
30460 "modes": ["selser"],
30461 "scrubWikitext": true,
30462 "changes": [
30463 [ "p", "html", " a\n b" ]
30464 ]
30465 }
30466 !! wikitext
30467 xyz
30468 !! wikitext/edited
30469 a
30470 b
30471 !! end
30472
30473 !! test
30474 1. New links that end in spaces
30475 !! options
30476 parsoid={
30477 "modes": ["html2wt"],
30478 "scrubWikitext": false
30479 }
30480 !! html/parsoid
30481 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30482 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30483 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30484 !! wikitext
30485 [[Berlin ]]<nowiki/>is the capital of Germany.
30486
30487 [[Foo ]]'''bar'''
30488
30489 [[Boston ]] is a city.
30490 !! end
30491
30492 !! test
30493 2. New links that end in spaces
30494 !! options
30495 parsoid={
30496 "modes": ["html2wt"],
30497 "scrubWikitext": true
30498 }
30499 !! html/parsoid
30500 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30501 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30502 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30503 !! wikitext
30504 [[Berlin]] is the capital of Germany.
30505
30506 [[Foo]] '''bar'''
30507
30508 [[Boston]] is a city.
30509 !! end
30510
30511 !! test
30512 1. Table cells with escapable prefixes
30513 !! options
30514 parsoid={
30515 "modes": ["html2wt"],
30516 "scrubWikitext": false
30517 }
30518 !! html
30519 <table>
30520 <tr><td>a</td></tr>
30521 <tr><td>-</td></tr>
30522 <tr><td>+</td></tr>
30523 </table>
30524 !! wikitext
30525 {|
30526 |a
30527 |-
30528 |<nowiki>-</nowiki>
30529 |-
30530 |<nowiki>+</nowiki>
30531 |}
30532 !! end
30533
30534 !! test
30535 2. Table cells with escapable prefixes
30536 !! options
30537 parsoid={
30538 "modes": ["html2wt"],
30539 "scrubWikitext": true
30540 }
30541 !! html
30542 <table>
30543 <tr><td>a</td></tr>
30544 <tr><td>-</td></tr>
30545 <tr><td>+</td></tr>
30546 </table>
30547 !! wikitext
30548 {|
30549 |a
30550 |-
30551 | -
30552 |-
30553 | +
30554 |}
30555 !! end
30556
30557 !! test
30558 3a. Table cells with escapable prefixes after edits
30559 !! options
30560 parsoid={
30561 "modes": ["selser"],
30562 "scrubWikitext": true,
30563 "changes": [
30564 [ "table tbody tr:first-child td:first-child", "remove"]
30565 ]
30566 }
30567 !! wikitext
30568 {|
30569 |a||-
30570 |}
30571 !! wikitext/edited
30572 {|
30573 | -
30574 |}
30575 !! end
30576
30577 !! test
30578 3b. Table cells with escapable prefixes after edits
30579 !! options
30580 parsoid={
30581 "modes": ["selser"],
30582 "scrubWikitext": true,
30583 "changes": [
30584 [ "table tbody tr:first-child td:first-child", "html", "-" ],
30585 [ "#x", "remove" ]
30586 ]
30587 }
30588 !! wikitext
30589 {|
30590 |pqr
30591 |<span id="x">foo</span>+
30592 |}
30593 !! wikitext/edited
30594 {|
30595 | -
30596 | +
30597 |}
30598 !! end
30599
30600 # FIXME: This test will fail because
30601 # normalization doesn't realize that the id attribute
30602 # will eliminate the escapable scenario
30603 !! test
30604 4a. Table cells without escapable prefixes after edits
30605 !! options
30606 parsoid={
30607 "modes": ["selser"],
30608 "scrubWikitext": true,
30609 "changes": [
30610 [ "#x", "html", "-" ]
30611 ]
30612 }
30613 !! wikitext
30614 {|
30615 | id="x" |abcd
30616 |}
30617 !! wikitext/edited
30618 {|
30619 | id="x" |-
30620 |}
30621 !! end
30622
30623 ## This tests normalizer's ability to discriminate between
30624 ## cells having identical content.
30625 !! test
30626 4b. Table cells without escapable prefixes after edits
30627 !! options
30628 parsoid={
30629 "modes": ["selser"],
30630 "scrubWikitext": true,
30631 "changes": [
30632 [ "td", "html", "-" ]
30633 ]
30634 }
30635 !! wikitext
30636 {|
30637 |a||b
30638 |}
30639 !! wikitext/edited
30640 {|
30641 | -||-
30642 |}
30643 !! end
30644
30645 ## This tests normalizer's ability to not be tripped by
30646 ## comments (and whitespace)
30647 !! test
30648 4c. Table cells without escapable prefixes after edits
30649 !! options
30650 parsoid={
30651 "modes": ["selser"],
30652 "scrubWikitext": true,
30653 "changes": [
30654 [ "table tbody tr td:first-child", "remove" ]
30655 ]
30656 }
30657 !! wikitext
30658 {|
30659 |-
30660 <!--foo--> |a||-
30661 |}
30662 !! wikitext/edited
30663 {|
30664 |-
30665 <!--foo--> | -
30666 |}
30667 !! end
30668
30669 ## This tests normalizer's ability to handle HTML cells
30670 !! test
30671 4d. Table cells without escapable prefixes after edits
30672 !! options
30673 parsoid={
30674 "modes": ["selser"],
30675 "scrubWikitext": true,
30676 "changes": [
30677 [ "td", "html", "-" ]
30678 ]
30679 }
30680 !! wikitext
30681 <table>
30682 <tr><td>a</td></tr>
30683 </table>
30684 !! wikitext/edited
30685 <table>
30686 <tr><td>-</td></tr>
30687 </table>
30688 !! end
30689
30690 ## T111151 Remove font elements without attributes
30691 !! test
30692 5a. font tags without attributes should be dropped in scrubWikitext mode
30693 !! options
30694 parsoid={
30695 "modes": ["html2wt"],
30696 "scrubWikitext": true
30697 }
30698 !! html
30699 <font>foo</font>
30700 <font><font>bar</font></font>
30701 <font class="x">boo</font>
30702 !! wikitext
30703 foo
30704 bar
30705 <font class="x">boo</font>
30706 !! end
30707
30708 !! test
30709 5b. font tags should not be dropped without scrubWikitext being enabled
30710 !! options
30711 parsoid={
30712 "modes": ["html2wt"],
30713 "scrubWikitext": false
30714 }
30715 !! html
30716 <font>foo</font>
30717 !! wikitext
30718 <font>foo</font>
30719 !! end
30720
30721 !! test
30722 Escape nowiki DOM elements
30723 !! options
30724 parsoid=html2wt
30725 !! html/parsoid
30726 <nowiki><i>foo</i></nowiki>
30727 !! wikitext
30728 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
30729 !! end
30730
30731 # This is meant to be an interim fix while we go about figuring out
30732 # how to not introduce these trailing <nowiki/>s in the first place.
30733 !! test
30734 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
30735 !! options
30736 parsoid=html2wt
30737 !! html/parsoid
30738 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
30739 y</p>
30740 <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>
30741 <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>
30742 !! wikitext
30743 x
30744 y
30745
30746 {{echo|
30747 1 = <nowiki/>}}
30748
30749 {{echo|
30750 1 = <nowiki/>
30751 }}
30752 !! end
30753
30754 !! test
30755 New list is serialized on newlines
30756 !! options
30757 parsoid=html2wt
30758 !! html/parsoid
30759 <p>The quick brown fox jumps over the lazy dog.</p><ul>
30760 <li>Yesterday</li>
30761 <li>Today</li>
30762 <li>Tomorrow</li>
30763 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
30764 !! wikitext
30765 The quick brown fox jumps over the lazy dog.
30766
30767 * Yesterday
30768 * Today
30769 * Tomorrow
30770
30771 The quick onyx goblin jumps over the lazy dwarf.
30772 !! end
30773
30774 !! test
30775 New lists in formatting elements serialized w/o newlines
30776 !! options
30777 parsoid=html2wt
30778 !! html/parsoid
30779 <small>
30780
30781 <ul>
30782 <li>123</li>
30783 </ul>
30784
30785 </small>
30786
30787 <small><ul><li>hi</li></ul></small>
30788 !! wikitext
30789 <small>
30790 * 123
30791 </small>
30792
30793 <small>
30794 * hi
30795 </small>
30796 !! end
30797
30798 !! test
30799 New list in table doesn't need newlines
30800 !! options
30801 parsoid=html2wt
30802 !! html/parsoid
30803 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
30804 !! wikitext
30805 {|
30806 |
30807 * test
30808 * 123
30809 |}
30810 !! end
30811
30812 # ---------------------------------------------------
30813 # End of tests spec'ing wikitext serialization norms |
30814 # ---------------------------------------------------
30815
30816 # T104032
30817 !! test
30818 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
30819 !! options
30820 parsoid=html2wt
30821 !! html/parsoid
30822 a<p>b</p>
30823 <b>c</b><p>d</p>
30824 <table><tr>
30825 <td>a<p>b</p></td>
30826 <td><b>c</b><p>d</p></td>
30827 </tr></table>
30828 !! wikitext
30829 a
30830
30831 b
30832
30833 '''c'''
30834
30835 d
30836 {|
30837 |a
30838 b
30839 |'''c'''
30840 d
30841 |}
30842 !! end
30843
30844 !! test
30845 Anchor without href scenarios
30846 !! options
30847 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30848 !! html/parsoid
30849 <a class="bc"></a>
30850 <a class="no">dice</a>
30851 <a name="foo"></a>
30852 !! wikitext
30853
30854 dice
30855 <span name="foo"></span>
30856 !! end
30857
30858 !! test
30859 New transclusion added after a list should be serialized after the list
30860 !! options
30861 parsoid=html2wt
30862 !! html/parsoid
30863 <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>
30864 !! wikitext
30865 * a
30866 {{echo|foo}}
30867 !! end
30868
30869 # -----------------------------------------------------------------
30870 # End of section for Parsoid-only html2wt tests for serialization
30871 # of new content
30872 # -----------------------------------------------------------------
30873
30874 # -----------------------------------------------------------------
30875 # The following section of tests are primarily to spec behavior of
30876 # the selective serializer. All these tests have manual selser
30877 # changes. The automated selser changes for all tests handle the
30878 # wide variation of changes, but these tests here capture specs
30879 # deterministically.
30880 # ----------------------------------------------------------------
30881
30882 ## T90517
30883 !! test
30884 Selser: New comments should not be lost
30885 !! options
30886 parsoid={
30887 "modes": ["selser"],
30888 "changes": [
30889 [ "#a", "after", "<!--c1-->" ],
30890 [ "#b", "before", "<!--c2-->" ]
30891 ]
30892 }
30893 !! wikitext
30894 <span id="a">a</span>
30895
30896 <span id="b">b</span>
30897 !! wikitext/edited
30898 <span id="a">a</span><!--c1-->
30899
30900 <!--c2--><span id="b">b</span>
30901 !! end
30902
30903 ## T89383
30904 !! test
30905 Selser: Check for validity of DSR before using it
30906 !! options
30907 parsoid={
30908 "modes": ["selser"],
30909 "changes": [
30910 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
30911 ]
30912 }
30913 !! wikitext
30914 <span id="a">a</span>
30915 !! wikitext/edited
30916 {{DISPLAYTITLE:foo}}
30917 <span id="a">a</span>
30918 !! end
30919
30920 !! test
30921 1. DOMDiff: Changes to <ref> content should be looked up using id
30922 !! options
30923 parsoid={
30924 "modes": ["selser"],
30925 "changes": [
30926 ["#X", "after", "bar"],
30927 ["#Y", "after", "baz"]
30928 ]
30929 }
30930 !! wikitext
30931 X <ref><span id="X">foo</span></ref>
30932 Y <ref name="a" />
30933 <references>
30934 <ref name="a"><span id="Y">foo</span></ref>
30935 </references>
30936 !! wikitext/edited
30937 X <ref><span id="X">foo</span>bar</ref>
30938 Y <ref name="a" />
30939 <references>
30940 <ref name="a"><span id="Y">foo</span>baz</ref>
30941 </references>
30942 !! end
30943
30944 !! test
30945 2. DOMDiff: Changes to <ref> content should be looked up using id
30946 !! options
30947 parsoid={
30948 "modes": ["selser"],
30949 "changes": [
30950 ["#Z", "after", "bar"]
30951 ]
30952 }
30953 !! wikitext
30954 A <ref>foo bar for a</ref>
30955 B <ref group="X" name="b" />
30956
30957 <references />
30958
30959 <references group="X">
30960 <ref name="b"><span id="Z">foo</span></ref>
30961 </references>
30962 !! wikitext/edited
30963 A <ref>foo bar for a</ref>
30964 B <ref group="X" name="b" />
30965
30966 <references />
30967
30968 <references group="X">
30969 <ref name="b"><span id="Z">foo</span>bar</ref>
30970 </references>
30971 !! end
30972
30973 !! test
30974 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
30975 !! options
30976 parsoid={
30977 "modes": ["selser"],
30978 "changes": [
30979 [ "div:first-child", "text", "bar" ]
30980 ]
30981 }
30982 !! wikitext
30983 <div style="{{1x|color:red;}}%">foo</div>
30984 !! wikitext/edited
30985 <div style="{{1x|color:red;}}%">bar</div>
30986 !! end
30987
30988 !! test
30989 Empty LI (T49673)
30990 !! wikitext
30991 *a
30992 *
30993 *
30994 *b
30995 !! html+tidy
30996 <ul><li>a</li>
30997 <li class="mw-empty-elt"></li>
30998 <li class="mw-empty-elt"></li>
30999 <li>b</li></ul>
31000 !! end
31001
31002 !! test
31003 Thumbnail output
31004 !! wikitext
31005 [[File:Thumb.png|thumb]]
31006 !! html/php+tidy
31007 <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" 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>
31008 !! html/parsoid
31009 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Thumb.png"><img resource="./File:Thumb.png" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a></figure>
31010 !! end
31011
31012 !! test
31013 unclosed internal link XSS (T137264)
31014 !! wikitext
31015 [[#%3Cscript%3Ealert(1)%3C/script%3E|
31016 !! html/php
31017 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
31018 </p>
31019 !! html/parsoid
31020 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
31021 !! end
31022
31023 !! test
31024 Validating that <style> isn't eaten by tidy (T167349)
31025 !! options
31026 styletag=1
31027 !! wikitext
31028 <div class="foo">
31029 <style>.foo::before { content: "<foo>"; }</style>
31030 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
31031 </div>
31032 !! html/php+tidy
31033 <div class="foo">
31034 <style>.foo::before { content: "<foo>"; }</style>
31035 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
31036 </div>
31037 !! end
31038
31039 !! test
31040 Validating that <style> isn't wrapped in a paragraph (T186965)
31041 !! options
31042 styletag=1
31043 !! wikitext
31044 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31045
31046 <style>.foo::before { content: "<foo>"; }</style>
31047
31048 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
31049
31050 But if it's on a line with other content, let it be wrapped.
31051
31052 <style>.foo::before { content: "<foo>"; }</style> bar
31053
31054 foo <style>.foo::before { content: "<foo>"; }</style>
31055
31056 foo <style>.foo::before { content: "<foo>"; }</style> bar
31057
31058 And the same if we have non-paragraph-breaking whitespace
31059
31060 foo
31061 <style>.foo::before { content: "<foo>"; }</style>
31062 bar
31063 !! html/php
31064 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31065 </p>
31066 <style>.foo::before { content: "<foo>"; }</style>
31067 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
31068 <p>But if it's on a line with other content, let it be wrapped.
31069 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
31070 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
31071 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
31072 </p><p>And the same if we have non-paragraph-breaking whitespace
31073 </p><p>foo
31074 <style>.foo::before { content: "<foo>"; }</style>
31075 bar
31076 </p>
31077 !! end
31078
31079 !! test
31080 Validating that <link> isn't wrapped in a paragraph (T186965)
31081 !! options
31082 styletag=1
31083 !! wikitext
31084 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31085
31086 <link rel="foo" href="bar"/>
31087
31088 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
31089
31090 But if it's on a line with other content, let it be wrapped.
31091
31092 <link rel="foo" href="bar"/> bar
31093
31094 foo <link rel="foo" href="bar"/>
31095
31096 foo <link rel="foo" href="bar"/> bar
31097
31098 And the same if we have non-paragraph-breaking whitespace
31099
31100 foo
31101 <link rel="foo" href="bar"/>
31102 bar
31103 !! html/php
31104 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31105 </p>
31106 <link rel="foo" href="bar"/>
31107 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
31108 <p>But if it's on a line with other content, let it be wrapped.
31109 </p><p><link rel="foo" href="bar"/> bar
31110 </p><p>foo <link rel="foo" href="bar"/>
31111 </p><p>foo <link rel="foo" href="bar"/> bar
31112 </p><p>And the same if we have non-paragraph-breaking whitespace
31113 </p><p>foo
31114 <link rel="foo" href="bar"/>
31115 bar
31116 </p>
31117 !! end
31118
31119 !! test
31120 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
31121 !! config
31122 wgFragmentMode=[ 'html5', 'legacy' ]
31123 !! wikitext
31124 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
31125 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
31126 !! html/php
31127 <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>
31128 <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>
31129 </p>
31130 !! html/parsoid
31131 <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>
31132 <p><a rel="mw:WikiLink" href="./Main_Page#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#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>
31133 !! end
31134
31135 !! test
31136 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
31137 !! config
31138 wgFragmentMode=[ 'legacy' ]
31139 !! wikitext
31140 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
31141 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
31142 !! html/php
31143 <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>
31144 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
31145 </p>
31146 !! end
31147
31148 !! test
31149 Decoding of HTML entities in embedded HTML tags
31150 !! wikitext
31151 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
31152 !! html/php
31153 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
31154
31155 !! html/parsoid
31156 <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>
31157 !! end
31158
31159 !! test
31160 Decoding of HTML entities in indicator names for IDs (T104196)
31161 !! options
31162 parsoid=wt2html,html2html
31163 showindicators
31164 !! wikitext
31165 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
31166 !! html/php
31167 1&2&3&amp;4&amp;amp;5=Indicator
31168
31169 !! html/parsoid
31170 <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>
31171 !! end
31172
31173 # this version of the test strips out the ambiguity so Parsoid rts cleanly
31174 !! test
31175 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
31176 !! options
31177 showindicators
31178 !! wikitext
31179 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
31180 !! html/php
31181 1&2&3&amp;4&amp;amp;5=Indicator
31182
31183 !! html/parsoid
31184 <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>
31185 !! end
31186
31187 # This fragment mode is what Parsoid supports.
31188 !! test
31189 HTML5 ids: fallback to legacy
31190 !! config
31191 wgFragmentMode=[ 'html5', 'legacy' ]
31192 !! wikitext
31193 ==Foo bar==
31194
31195 ==foo Bar==
31196
31197 ==Тест==
31198
31199 ==Тест==
31200
31201 ==тест==
31202
31203 ==Hey < # " > % : '==
31204 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31205
31206 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31207
31208 <!-- These two links should produce identical HTML -->
31209 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31210
31211 !! html/php
31212 <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>
31213 <ul>
31214 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31215 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31216 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
31217 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
31218 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
31219 <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>
31220 </ul>
31221 </div>
31222
31223 <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>
31224 <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>
31225 <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>
31226 <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>
31227 <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>
31228 <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>
31229 <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>
31230 </p><p>💩 <span id="💩"></span>
31231 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
31232 </p>
31233 !! html/parsoid
31234 <h2 id="Foo_bar">Foo bar</h2>
31235
31236 <h2 id="foo_Bar_2">foo Bar</h2>
31237
31238 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
31239
31240 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
31241
31242 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
31243
31244 <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>
31245 <p><a rel="mw:WikiLink" href="./Main_Page#Foo_bar">#Foo bar</a> <a rel="mw:WikiLink" href="./Main_Page#foo_Bar">#foo Bar</a> <a rel="mw:WikiLink" href="./Main_Page#Тест">#Тест</a> <a rel="mw:WikiLink" href="./Main_Page#тест">#тест</a> <a rel="mw:WikiLink" href="./Main_Page#Hey_&lt;_#_&quot;_>_%_:_'" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Hey_&lt;_#_\"_>_%_:_&#39;"},"sa":{"href":"#Hey &lt; # \" > % : &#39;"}}'>#Hey &lt; # " > % : '</a></p>
31246
31247 <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>
31248
31249 <!-- These two links should produce identical HTML -->
31250 <p><a rel="mw:WikiLink" href="./Main_Page#啤酒">#啤酒</a> <a rel="mw:WikiLink" href="./Main_Page#啤酒" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#啤酒"},"sa":{"href":"#%E5%95%A4%E9%85%92"}}'>#啤酒</a></p>
31251 !! end
31252
31253 # Parsoid doesn't support this mode
31254 !! test
31255 HTML5 ids: legacy with a fallback to modern
31256 !! config
31257 wgFragmentMode=[ 'legacy', 'html5' ]
31258 !! wikitext
31259 ==Foo bar==
31260
31261 ==foo Bar==
31262
31263 ==Тест==
31264
31265 ==Тест==
31266
31267 ==тест==
31268
31269 ==Hey < # " > % : '==
31270 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31271
31272 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31273
31274 <!-- These two links should produce identical HTML -->
31275 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31276
31277 !! html/php
31278 <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>
31279 <ul>
31280 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31281 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31282 <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>
31283 <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>
31284 <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>
31285 <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>
31286 </ul>
31287 </div>
31288
31289 <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>
31290 <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>
31291 <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>
31292 <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>
31293 <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>
31294 <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>
31295 <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>
31296 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
31297 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
31298 </p>
31299 !! end
31300
31301 # Parsoid doesn't support this mode.
31302 !! test
31303 HTML5 ids: no legacy
31304 !! config
31305 wgFragmentMode=[ 'html5' ]
31306 !! wikitext
31307 ==Foo bar==
31308
31309 ==foo Bar==
31310
31311 ==Тест==
31312
31313 ==Тест==
31314
31315 ==тест==
31316
31317 ==Hey < # " > % : '==
31318 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31319
31320 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31321
31322 <!-- These two links should produce identical HTML -->
31323 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31324
31325 !! html/php
31326 <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>
31327 <ul>
31328 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31329 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31330 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
31331 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
31332 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
31333 <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>
31334 </ul>
31335 </div>
31336
31337 <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>
31338 <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>
31339 <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>
31340 <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>
31341 <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>
31342 <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>
31343 <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>
31344 </p><p>💩 <span id="💩"></span>
31345 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
31346 </p>
31347 !! end
31348
31349 !! test
31350 T90902: Normalize weird characters in section IDs
31351 !! config
31352 wgFragmentMode=[ 'html5', 'legacy' ]
31353 !! wikitext
31354 ==Foo&nbsp;bar==
31355 [[#Foo&nbsp;bar]]
31356
31357 !! html/php
31358 <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>
31359 <p><a href="#Foo_bar">#Foo&#160;bar</a>
31360 </p>
31361 !! html/parsoid
31362 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
31363 <p><a rel="mw:WikiLink" href="./Main_Page#Foo_bar" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Foo_bar"},"sa":{"href":"#Foo&amp;nbsp;bar"}}'>#Foo bar</a></p>
31364 !! end
31365
31366 !! test
31367 T51672: Test for brackets in attributes of elements in external link texts
31368 !! wikitext
31369 [http://example.com/ link <span title="title with [brackets]">span</span>]
31370 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
31371
31372 !! html/php
31373 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31374 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31375 </p>
31376 !! html/parsoid
31377 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
31378 <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>
31379 !! end
31380
31381 !! test
31382 T72875: Test for brackets in attributes of elements in internal link texts
31383 !! wikitext
31384 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
31385 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
31386
31387 !! html/php
31388 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31389 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31390 </p>
31391 !! html/parsoid
31392 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
31393 <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>
31394 !! end
31395
31396 !! test
31397 T199926: html arrow wt: Parsoid sometimes trips up on verticalbar chars in hrefs
31398 !! options
31399 parsoid={
31400 "modes": ["html2wt"]
31401 }
31402 !! html/parsoid
31403 <a href="https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total">9</a>
31404 <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>
31405 !! wikitext
31406 [https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total 9]
31407 [[stats:v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total|10]]
31408 !! end
31409
31410 !! test
31411 T179544: {{anchorencode:}} output should be always usable in links
31412 !! config
31413 wgFragmentMode=[ 'html5' ]
31414 !! wikitext
31415 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
31416 !! html/php
31417 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
31418 </p>
31419 !! html/parsoid
31420 <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="./Main_Page#[foo]" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#[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>
31421 !! end
31422
31423 ## ------------------------------
31424 ## Parsoid section-wrapping tests
31425 ## ------------------------------
31426 !! test
31427 Section wrapping for well-nested sections (no leading content)
31428 !! options
31429 parsoid={
31430 "wrapSections": true
31431 }
31432 !! wikitext
31433 =1=
31434 a
31435
31436 =2=
31437 b
31438
31439 ==2.1==
31440 c
31441
31442 ==2.2==
31443 d
31444
31445 ===2.2.1===
31446 e
31447
31448 =3=
31449 f
31450 !! html/parsoid
31451 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31452 <p>a</p>
31453
31454 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31455 <p>b</p>
31456
31457 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
31458 <p>c</p>
31459
31460 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
31461 <p>d</p>
31462
31463 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
31464 <p>e</p>
31465
31466 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
31467 <p>f</p>
31468
31469 </section>
31470 !! end
31471
31472 !! test
31473 Section wrapping for well-nested sections (with leading content)
31474 !! options
31475 parsoid={
31476 "wrapSections": true
31477 }
31478 !! wikitext
31479 Para 1.
31480
31481 Para 2 with a <div>nested in it</div>
31482
31483 Para 3.
31484
31485 =1=
31486 a
31487
31488 =2=
31489 b
31490
31491 ==2.1==
31492 c
31493 !! html/parsoid
31494 <section data-mw-section-id="0"><p>Para 1.</p>
31495
31496 <p>Para 2 with a </p><div>nested in it</div>
31497
31498 <p>Para 3.</p>
31499
31500 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
31501 <p>a</p>
31502
31503 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31504 <p>b</p>
31505
31506 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
31507 <p>c</p>
31508
31509 </section></section>
31510 !! end
31511
31512 !! test
31513 Section wrapping with template-generated sections (good nesting 1)
31514 !! options
31515 parsoid={
31516 "wrapSections": true
31517 }
31518 !! wikitext
31519 =1=
31520 a
31521
31522 {{echo|1=
31523 ==1.1==
31524 b
31525 }}
31526
31527 ==1.2==
31528 c
31529
31530 =2=
31531 d
31532 !! html/parsoid
31533 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31534 <p>a</p>
31535
31536 <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">
31537 </span><p about="#mwt1">b</p>
31538 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
31539 <p>c</p>
31540
31541 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
31542 <p>d</p></section>
31543 !! end
31544
31545 # In this example, the template scope is mildly expanded to incorporate the
31546 # trailing newline after the transclusion since that is part of section 1.1.1
31547 !! test
31548 Section wrapping with template-generated sections (good nesting 2)
31549 !! options
31550 parsoid={
31551 "wrapSections": true,
31552 "modes": ["wt2html", "wt2wt"]
31553 }
31554 !! wikitext
31555 =1=
31556 a
31557
31558 {{echo|1=
31559 ==1.1==
31560 b
31561 ===1.1.1===
31562 d
31563 }}
31564 =2=
31565 e
31566 !! html/parsoid
31567 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31568 <p>a</p>
31569
31570 <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">
31571 </span><p about="#mwt1">b</p><span about="#mwt1">
31572 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
31573 </span><p about="#mwt1">d</p><span about="#mwt1">
31574 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
31575 <p>e</p></section>
31576 !! end
31577
31578 # In this example, the template scope is mildly expanded to incorporate the
31579 # trailing newline after the transclusion since that is part of section 1.2.1
31580 !! test
31581 Section wrapping with template-generated sections (good nesting 3)
31582 !! options
31583 parsoid={
31584 "wrapSections": true,
31585 "modes": ["wt2html", "wt2wt"]
31586 }
31587 !! wikitext
31588 =1=
31589 a
31590
31591 {{echo|1=
31592 x
31593 ==1.1==
31594 b
31595 ==1.2==
31596 c
31597 ===1.2.1===
31598 d
31599 }}
31600 =2=
31601 e
31602 !! html/parsoid
31603 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
31604 <p>a</p>
31605
31606 <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">
31607 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
31608 </span><p about="#mwt1">b</p><span about="#mwt1">
31609 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
31610 </span><p about="#mwt1">c</p><span about="#mwt1">
31611 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
31612 </span><p about="#mwt1">d</p><span about="#mwt1">
31613 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
31614 <p>e</p></section>
31615 !! end
31616
31617 # Because of section-wrapping and template-wrapping interactions,
31618 # the scope of the template is expanded so that the template markup
31619 # is valid in the presence of <section> tags.
31620 # This exercises the s1 is null scenario in the wrapSections code
31621 !! test
31622 Section wrapping with template-generated sections (bad nesting 1)
31623 !! options
31624 parsoid={
31625 "wrapSections": true
31626 }
31627 !! wikitext
31628 <div>
31629 a
31630
31631 {{echo|
31632 =1=
31633 b
31634 }}
31635
31636 c
31637 </div>
31638 !! html/parsoid
31639 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
31640 <p>a</p>
31641
31642 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n=1=\nb\n"}},"i":0}},"\n\nc\n"]}'>
31643 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
31644 </span><p about="#mwt1">b
31645 </p><span about="#mwt1">
31646
31647 </span><p about="#mwt1">c</p><span about="#mwt1">
31648 </span></section></div></section>
31649 !! end
31650
31651 # Because of section-wrapping and template-wrapping interactions,
31652 # the scope of the template is expanded so that the template markup
31653 # is valid in the presence of <section> tags.
31654 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
31655 !! test
31656 Section wrapping with template-generated sections (bad nesting 2)
31657 !! options
31658 parsoid={
31659 "wrapSections": true
31660 }
31661 !! wikitext
31662 =1=
31663 a
31664
31665 {{echo|1=
31666 =2=
31667 b
31668 ==2.1==
31669 c
31670 }}
31671
31672 d
31673
31674 =3=
31675 e
31676 !! html/parsoid
31677 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31678 <p>a</p>
31679
31680 </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">
31681 </span><p about="#mwt1">b</p><span about="#mwt1">
31682 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
31683 </span><p about="#mwt1">c</p><span about="#mwt1">
31684
31685 </span><p about="#mwt1">d</p><span about="#mwt1">
31686
31687 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
31688 <p>e</p></section>
31689 !! end
31690
31691 # Because of section-wrapping and template-wrapping interactions,
31692 # additional template wrappers are added to <section> tags
31693 # so that template wrapping semantics are valid whether section
31694 # tags are retained or stripped. But, the template scope can expand
31695 # greatly when accounting for section tags.
31696 # This exercises the s1 and s2 are in different subtrees scenario
31697 !! test
31698 Section wrapping with template-generated sections (bad nesting 3)
31699 !! options
31700 parsoid={
31701 "wrapSections": true,
31702 "modes": ["wt2html", "wt2wt"]
31703 }
31704 !! wikitext
31705 =1=
31706 a
31707
31708 {{echo|1=
31709 ==1.2==
31710 b
31711 =2=
31712 c
31713 }}
31714
31715 d
31716
31717 =3=
31718 e
31719 !! html/parsoid
31720 <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>
31721 <p>a</p>
31722
31723 <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">
31724 </span><p about="#mwt1">b</p><span about="#mwt1">
31725 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
31726 </span><p about="#mwt1">c</p>
31727
31728 <p>d</p>
31729 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
31730 <p>e</p></section>
31731 !! end
31732
31733 !! test
31734 Section wrapping with uneditable lead section + div wrapping multiple sections
31735 !! options
31736 parsoid={
31737 "wrapSections": true
31738 }
31739 !! wikitext
31740 foo
31741
31742 <div style="border:1px solid red;">
31743 =1=
31744 a
31745
31746 ==1.1==
31747 b
31748
31749 =2=
31750 c
31751 </div>
31752
31753 =3=
31754 d
31755
31756 ==3.1==
31757 e
31758 !! html/parsoid
31759 <section data-mw-section-id="-1"><p>foo</p>
31760
31761 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31762 <section data-mw-section-id="1"><h1 id="1">1</h1>
31763 <p>a</p>
31764
31765 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31766 <p>b</p>
31767
31768 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31769 <p>c</p>
31770 </section></div>
31771
31772 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31773 <p>d</p>
31774
31775 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31776 <p>e</p>
31777 </section></section>
31778 !! end
31779
31780 !! test
31781 Section wrapping with editable lead section + div overlapping multiple sections
31782 !! options
31783 parsoid={
31784 "wrapSections": true
31785 }
31786 !! wikitext
31787 foo
31788
31789 =1=
31790 a
31791 <div style="border:1px solid red;">
31792 b
31793
31794 ==1.1==
31795 c
31796
31797 =2=
31798 d
31799 </div>
31800 e
31801
31802 =3=
31803 f
31804
31805 ==3.1==
31806 g
31807 !! html/parsoid
31808 <section data-mw-section-id="0"><p>foo</p>
31809
31810 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
31811 <p>a</p>
31812 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31813 <p>b</p>
31814
31815 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31816 <p>c</p>
31817
31818 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31819 <p>d</p>
31820 </section></div>
31821 <p>e</p>
31822
31823 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31824 <p>f</p>
31825
31826 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31827 <p>g</p>
31828 </section></section>
31829 !! end
31830
31831 !! test
31832 HTML header tags should not be wrapped in section tags
31833 !! options
31834 parsoid={
31835 "wrapSections": true
31836 }
31837 !! wikitext
31838 foo
31839
31840 <h1>a</h1>
31841
31842 =b=
31843
31844 <h1>c</h1>
31845
31846 =d=
31847 !! html/parsoid
31848 <section data-mw-section-id="0"><p>foo</p>
31849
31850 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
31851
31852 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
31853
31854 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
31855
31856 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
31857 !! end
31858
31859 !! test
31860 Lead section containing only whitespace and comments.
31861 !! options
31862 parsoid={
31863 "wrapSections": true
31864 }
31865 !! wikitext
31866
31867 <!-- this is a comment, presumably significant to editors -->
31868 =1=
31869 a
31870
31871 =2=
31872 b
31873 !! html/parsoid
31874 <section data-mw-section-id="0" data-parsoid="{}">
31875 <!-- this is a comment, presumably significant to editors -->
31876 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
31877 <p>a</p>
31878
31879 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31880 <p>b</p></section>
31881 !! end
31882
31883 !! test
31884 Pseudo-sections emitted by templates should have id -2
31885 !! options
31886 parsoid={
31887 "wrapSections": true
31888 }
31889 !! wikitext
31890 foo
31891 {{echo|<div>
31892 ==a==
31893 ==b==
31894 </div>
31895 }}
31896 !! html/parsoid
31897 <section data-mw-section-id="-1"><p>foo</p>
31898 </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}}]}'>
31899 <section data-mw-section-id="-1"><h2 id="a">a</h2>
31900 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
31901 </section></div><span about="#mwt1">
31902 </span></section>
31903 !! end
31904
31905 ##########################################################################
31906 Tests demonstrating white-space insensitivity in input wikitext
31907 for wikitext headings, wikitext list items, and wikitext table captions,
31908 headings, and cells. HTML versions of the same should preserve whitespace.
31909 ##########################################################################
31910 !! test
31911 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
31912 !! options
31913 parsoid={
31914 "modes": ["wt2html"],
31915 "preserveIEW": true
31916 }
31917 !! wikitext
31918 __NOTOC__
31919 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
31920 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
31921 == <!--Headings with fallback ids--> Личная жизнь ==
31922 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
31923 ; <!--term to define--> term : <!--term's definition--> definition
31924 {|
31925 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
31926 |-
31927 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
31928 |-
31929 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31930 |-
31931 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
31932 |-
31933 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
31934 |}
31935 : {|
31936 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31937 |} foo <!--c1-->
31938 !! html/php+tidy
31939 <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>
31940 <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>
31941 <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>
31942 <ul><li>List item</li></ul>
31943 <dl><dt>term&#160;</dt>
31944 <dd>definition</dd></dl>
31945 <table>
31946 <caption>Table Caption
31947 </caption>
31948 <tbody><tr>
31949 <th>Table Heading 1</th>
31950 <th>Table Heading 2
31951 </th></tr>
31952 <tr>
31953 <td>Table Cell 1</td>
31954 <td>Table Cell 2
31955 </td></tr>
31956 <tr>
31957 <td>class="foo"</td>
31958 <td>Table Cell 3
31959 </td></tr>
31960 <tr>
31961 <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
31962 </td></tr></tbody></table>
31963 <dl><dd><table>
31964 <tbody><tr>
31965 <td>Table Cell 1</td>
31966 <td>Table Cell 2
31967 </td></tr></tbody></table> foo</dd></dl>
31968 !! html/parsoid
31969 <meta property="mw:PageProp/notoc">
31970 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
31971 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
31972 <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>
31973 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
31974 <dl><dt><!--term to define-->term&nbsp;</dt><dd><!--term's definition-->definition</dd></dl>
31975 <table>
31976 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
31977 <tbody><tr>
31978 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th>Table Heading 2<!--c5--></th></tr>
31979 <tr>
31980 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31981 <tr>
31982 <td>class="foo"</td><td><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
31983 <tr>
31984 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One">two</a> <!--c2--> | <!--c3--> some content</td></tr>
31985 </tbody></table>
31986 <dl><dd><table>
31987 <tbody><tr><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31988 </tbody></table> foo<!--c1--></dd></dl>
31989 !! end
31990
31991 # Looks like <caption> is not accepted in HTML
31992 !! test
31993 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
31994 !! options
31995 parsoid={
31996 "modes": ["wt2html"],
31997 "preserveIEW": true
31998 }
31999 !! wikitext
32000 __NOTOC__
32001 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
32002 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
32003 <table>
32004 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
32005 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
32006 </table>
32007 !! html/php+tidy
32008 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
32009 <ul><li> List item </li></ul>
32010 <table>
32011 <tbody><tr><th> Table Heading </th><th></th></tr>
32012 <tr><td> Table Cell </td><th></th></tr>
32013 </tbody></table>
32014 !! html/parsoid
32015 <meta property="mw:PageProp/notoc"/>
32016 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
32017 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
32018 <table>
32019 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
32020 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
32021 </tbody></table>
32022 !! end
32023
32024 !! test
32025 Do not trim whitespace in links and quotes
32026 !! options
32027 parsoid={
32028 "modes": ["wt2html"],
32029 "preserveIEW": true
32030 }
32031 !! wikitext
32032 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
32033 [[Foo| some text ]]
32034 !! html/php+tidy
32035 <p>foo <i> italic </i> and <b> bold </b>
32036 <a href="/wiki/Foo" title="Foo"> some text </a>
32037 </p>
32038 !! html/parsoid
32039 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
32040 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
32041 !! end
32042
32043 !! test
32044 Remove p tags surrounding a single element in a figcaption
32045 !! options
32046 parsoid=html2wt
32047 !! wikitext
32048 [[File:Foobar.jpg|right|200x200px|Caption]]
32049 !! html/parsoid
32050 <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>
32051 !! end
32052
32053 !! test
32054 Selser preserves lack of newline before list and allows newline after the list
32055 !! options
32056 parsoid={
32057 "modes": ["selser"],
32058 "scrubWikitext": true,
32059 "changes": [
32060 [ "ul", "after", "<p>footer</p>" ]
32061 ]
32062 }
32063 !! wikitext
32064 header
32065 *foo
32066 *bar
32067 !! wikitext/edited
32068 header
32069 *foo
32070 *bar
32071
32072 footer
32073 !! end
32074
32075
32076 !! test
32077 Selser does not introduce newlines between unedited paragraph preceding the list
32078 !! options
32079 parsoid={
32080 "modes": ["selser"],
32081 "changes": [
32082 [ "table tbody tr td p:last-child", "empty" ]
32083 ]
32084 }
32085 !! wikitext
32086 {|
32087 |
32088 header
32089 *foo
32090 *bar
32091 footer
32092 |}
32093 !! wikitext/edited
32094 {|
32095 |
32096 header
32097 *foo
32098 *bar
32099
32100 |}
32101 !! end
32102
32103 !! test
32104 Selser does not introduce newlines between unedited paragraph following the list
32105 !! options
32106 parsoid={
32107 "modes": ["selser"],
32108 "changes": [
32109 [ "table tbody tr td p:first-child", "empty" ]
32110 ]
32111 }
32112 !! wikitext
32113 {|
32114 |
32115 header
32116 *foo
32117 *bar
32118 footer
32119 |}
32120 !! wikitext/edited
32121 {|
32122 |
32123
32124 *foo
32125 *bar
32126 footer
32127 |}
32128 !! end
32129
32130 !! test
32131 Remove a list item but do not insert newline above list
32132 !! options
32133 parsoid={
32134 "modes": ["selser"],
32135 "changes": [
32136 [ "ul li:last-child", "remove" ]
32137 ]
32138 }
32139 !! wikitext
32140 header
32141 *foo
32142 *bar
32143 footer
32144 !! wikitext/edited
32145 header
32146 *foo
32147 footer
32148 !! end