Quoted attributes don't need to be followed by a space
[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 Newline before table-close generates empty table row: T208619
2919 !! wikitext
2920 {|
2921
2922 |}
2923 !! html/php+tidy
2924 <table>
2925
2926 <tbody><tr><td></td></tr></tbody></table>
2927 !! html/parsoid
2928 <table data-parsoid='{}'>
2929
2930 </table>
2931 !! end
2932
2933 # PHP has one more row in the output than Parsoid does: T208619
2934 !! test
2935 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2936 !! options
2937 parsoid=wt2html
2938 !! wikitext
2939 {|
2940 <td>
2941 <td>
2942 </td>
2943
2944
2945
2946 |}
2947 !! html/php+tidy
2948 <table>
2949 <tbody><tr><td>
2950 </td><td>
2951 </td>
2952
2953
2954
2955 </tr><tr><td></td></tr></tbody></table>
2956 !! html/parsoid
2957 <table>
2958
2959 <tbody>
2960 <tr>
2961 <td></td>
2962
2963 <td>
2964 </td></tr>
2965
2966
2967
2968 </tbody></table>
2969 !! end
2970
2971
2972 #--------------------------------------------------------------------
2973 # Transclusion parameter whitespace stripping tests
2974 # Behavior is different for positional and named parameters
2975 #--------------------------------------------------------------------
2976 !! test
2977 Templates: Strip leading and trailing whitespace from named-param values
2978 !! wikitext
2979 {{echo|1= a }}
2980
2981 {{echo|1= {{echo|b}} }}
2982
2983 {{echo| 1 =
2984 c }}
2985
2986 {{echo| 1 =
2987 * d
2988 }}
2989 !! html
2990 <p>a
2991 </p><p>b
2992 </p><p>c
2993 </p>
2994 <ul><li>d</li></ul>
2995
2996 !! end
2997
2998 !! test
2999 Templates: Don't strip whitespace from positional-param values
3000 !! wikitext
3001 {{echo|a }}
3002
3003 {{echo|{{echo|b}} }}
3004
3005 {{echo| c
3006 }}
3007
3008 {{echo| {{echo|d}}
3009 }}
3010
3011 {{echo|
3012 e}}
3013
3014 {{echo|
3015 *f}}
3016
3017 {{echo|
3018 }}g
3019 !! html
3020 <p>a
3021 </p><p>b
3022 </p>
3023 <pre>c
3024 </pre>
3025 <p><br />
3026 </p>
3027 <pre>d
3028 </pre>
3029 <p><br />
3030 </p>
3031 <pre>e
3032 </pre>
3033 <p><br />
3034 </p>
3035 <ul><li>f</li></ul>
3036 <p><br />
3037 </p>
3038 <pre>g
3039 </pre>
3040 !! end
3041
3042 !! test
3043 Templates: Don't recognize targets split by newlines
3044 !! options
3045 parsoid=wt2html
3046 !! wikitext
3047 {{ech
3048 o|foo}}
3049 !! html/php
3050 <p>{{ech
3051 o|foo}}
3052 </p>
3053 !! html/parsoid
3054 <p>{{ech
3055 o|foo}}</p>
3056 !! end
3057
3058 !! test
3059 Templates: Recognize targets when newlines and comments don't split the target
3060 !! options
3061 parsoid=wt2html
3062 !! wikitext
3063 {{
3064 <!--X--> ech<!--X-->o<!--X-->
3065 <!--X--> <!--X-->
3066
3067 |foo}}
3068 !! html/php
3069 <p>foo
3070 </p>
3071 !! html/parsoid
3072 <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>
3073 !! end
3074
3075 !! test
3076 Templates: Handle empty comment-and-ws-only lines correctly
3077 !! wikitext
3078 {{echo|foo
3079 <!--should be ignored-->
3080 <!--should be ignored as well-->
3081 bar}}
3082 !! html/php
3083 <p>foo
3084 bar
3085 </p>
3086 !! html/parsoid
3087 <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>
3088 !! end
3089
3090 !! test
3091 Templates: Handle comments in the target
3092 !! wikitext
3093 {{echo
3094 <!-- should be ignored -->
3095 |foo}}
3096
3097 {{echo
3098 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
3099 |foo}}
3100
3101 {{echo<!-- should be ignored -->
3102 |foo}}
3103
3104 {{echo<!-- should be ignored -->|foo}}
3105
3106 {{<!-- should be ignored -->echo|foo}}
3107 !! html/php
3108 <p>foo
3109 </p><p>foo
3110 </p><p>foo
3111 </p><p>foo
3112 </p><p>foo
3113 </p>
3114 !! html/parsoid
3115 <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>
3116
3117 <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>
3118
3119 <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>
3120
3121 <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>
3122
3123 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3124 !! end
3125
3126 !! test
3127 Templates: Handle comments in parameter names (T69657)
3128 !! wikitext
3129 {{echo|1
3130 <!-- should be ignored -->
3131 =foo}}
3132
3133 {{echo|
3134 <!-- should be ignored -->
3135 1 = foo}}
3136
3137 {{echo|1<!-- should be ignored -->=foo}}
3138
3139 {{echo|<!-- should be ignored -->1=foo}}
3140 !! html/php
3141 <p>foo
3142 </p><p>foo
3143 </p><p>foo
3144 </p><p>foo
3145 </p>
3146 !! html/parsoid
3147 <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>
3148
3149 <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>
3150
3151 <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>
3152
3153 <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>
3154 !! end
3155
3156 !! test
3157 Templates: Other wikitext in parameter names (T69657)
3158 !! wikitext
3159 {{echo|''1''=foo}}
3160 !! html/php
3161 <p>{{{1}}}
3162 </p>
3163 !! html/parsoid
3164 <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>
3165 !! end
3166
3167 !! test
3168 Templates: With colons
3169 !! wikitext
3170 {{With: Colon}}
3171 !! html/php
3172 <p>Template with colon
3173 </p>
3174 !! html/parsoid
3175 <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>
3176 !! end
3177
3178 #--------------------------------------------------------------------
3179 # Transclusion parameter escaping tests
3180 #--------------------------------------------------------------------
3181
3182 !! test
3183 Templates: Parsoid parameter escaping test 1
3184 !! wikitext
3185 {{echo|[foo]|{{echo|[bar]}}}}
3186 !! html/php+tidy
3187 <p>[foo]
3188 </p>
3189 !! html/parsoid
3190 <p about="#mwt1" typeof="mw:Transclusion"
3191 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
3192 !! end
3193
3194 !! test
3195 Parsoid: Pipes in external links in template parameter
3196 !! wikitext
3197 {{echo|[{{echo|http://example.com}} link]}}
3198 !! html/php+tidy
3199 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
3200 </p>
3201 !! html/parsoid
3202 <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>
3203 !! end
3204
3205 !! test
3206 Parsoid: pipe in transclusion parameter
3207 !! wikitext
3208 {{echo|http://foo.com/a&#124;b}}
3209 !! html/php+tidy
3210 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
3211 </p>
3212 !! html/parsoid
3213 <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>
3214 !! end
3215
3216 !! test
3217 Parsoid: Pipe in external link target and content in template parameter
3218 !! options
3219 parsoid=html2wt,wt2wt
3220 !! wikitext
3221 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
3222 !! html/php+tidy
3223 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
3224 </p>
3225 !! html/parsoid
3226 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
3227 typeof="mw:Transclusion"
3228 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
3229 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
3230 !! end
3231
3232 !! test
3233 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
3234 !! wikitext
3235 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
3236 !! html/php+tidy
3237 <p><a rel="nofollow" class="external text" href="http://example.org/index.php?title=Parser_test&amp;action=edit">bar</a>
3238 </p>
3239 !! html/parsoid
3240 <p><a rel="mw:ExtLink" class="external text" href="http://example.org/index.php?title=Parser_test&amp;action=edit" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>bar</a></p>
3241 !! end
3242
3243 !! test
3244 Templates: Don't escape already nowiki-escaped text in template parameters
3245 !! options
3246 parsoid=html2wt,wt2wt
3247 !! wikitext
3248 {{echo|foo<nowiki>|</nowiki>bar}}
3249 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3250 {{echo|<nowiki></nowiki>}}
3251 !! html/php+tidy
3252 <p>foo|bar
3253 &lt;div&gt;
3254
3255 </p>
3256 !! html/parsoid
3257 <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>
3258 <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>
3259 <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>
3260 </p>
3261 !! end
3262
3263 ## T54824
3264 !! test
3265 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3266 !! options
3267 parsoid=html2wt,wt2wt
3268 !! wikitext
3269 {{echo|{{echo|1=bar}}}}
3270 !! html/php+tidy
3271 <p>bar
3272 </p>
3273 !! html/parsoid
3274 <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>
3275 !! end
3276
3277 ## T58733
3278 !! test
3279 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3280 !! wikitext
3281 {{echo|a : b}}
3282 !! html/php+tidy
3283 <p>a&#160;: b
3284 </p>
3285 !! html/parsoid
3286 <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>
3287 !! end
3288
3289 ## T73412
3290 !! test
3291 Templates: Preserve blank parameter names
3292 !! wikitext
3293 {{echo|=foo}}
3294 !! html/php+tidy
3295 <p>{{{1}}}
3296 </p>
3297 !! html/parsoid
3298 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3299 !! end
3300
3301 !! test
3302 Templates: Preserve blank parameter names in other positions
3303 !! wikitext
3304 {{blank_param|bar|=foo}}
3305 !! html/php+tidy
3306 <p>bar
3307 foo
3308 </p>
3309 !! html/parsoid
3310 <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
3311 foo</p>
3312 !! end
3313
3314 ###
3315 ### Parsoid-centric tests for testing RT edge cases for pre
3316 ###
3317
3318 !!test
3319 1a. Indent-Pre and Comments
3320 !! wikitext
3321 a
3322 <!--a-->
3323 c
3324 !! html
3325 <pre>a
3326 </pre>
3327 <p>c
3328 </p>
3329 !!end
3330
3331 !!test
3332 1b. Indent-Pre and Comments
3333 !! wikitext
3334 a
3335 <!--a-->
3336 c
3337 !! html
3338 <pre>a
3339 </pre>
3340 <p>c
3341 </p>
3342 !!end
3343
3344 !!test
3345 1c. Indent-Pre and Comments
3346 !! wikitext
3347 <!--a--> a
3348
3349 <!--a--> a
3350 !! html
3351 <pre> a
3352 </pre>
3353 <pre> a
3354 </pre>
3355 !!end
3356
3357 !!test
3358 1d. Indent-Pre and Comments
3359 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3360 !! wikitext
3361 <!--a--> a
3362
3363 <!--b-->b
3364 !! html
3365 <pre>a
3366 </pre>
3367 <pre>b
3368 </pre>
3369 !!end
3370
3371 !!test
3372 2a. Indent-Pre and tables
3373 !! wikitext
3374 {|
3375 |-
3376 !h1!!h2
3377 |foo||bar
3378 |}
3379 !! html
3380 <table>
3381
3382 <tr>
3383 <th>h1</th>
3384 <th>h2
3385 </th>
3386 <td>foo</td>
3387 <td>bar
3388 </td></tr></table>
3389
3390 !!end
3391
3392 !!test
3393 2b. Indent-Pre and tables
3394 !! wikitext
3395 {|
3396 |-
3397 |foo
3398 |}
3399 !! html
3400 <table>
3401
3402 <tr>
3403 <td>foo
3404 </td></tr></table>
3405
3406 !!end
3407
3408 !!test
3409 2c. Indent-Pre and tables (T44252)
3410 !! wikitext
3411 {|
3412 |+foo
3413 ! |bar
3414 |}
3415 !! html
3416 <table>
3417 <caption>foo
3418 </caption>
3419 <tr>
3420 <th>bar
3421 </th></tr></table>
3422
3423 !!end
3424
3425 !!test
3426 2d. Indent-Pre and tables
3427 !! wikitext
3428 a
3429 {|
3430 |b
3431 |}
3432 !! html/php
3433 <pre>a
3434 </pre>
3435 <table>
3436 <tr>
3437 <td>b
3438 </td></tr></table>
3439
3440 !! html/parsoid
3441 <pre>a</pre>
3442 <table>
3443 <tbody><tr><td> b</td></tr>
3444 </tbody></table>
3445 !!end
3446
3447 !!test
3448 2e. Indent-Pre and table-line syntax
3449 !! wikitext
3450 a
3451 | b
3452 | c
3453 !! html/php
3454 <pre>a
3455 | b
3456 | c
3457 </pre>
3458 !!end
3459
3460 !!test
3461 2f. Indent-pre started by table-line syntax
3462 !! wikitext
3463 a
3464 | b
3465 | c
3466 !! html/php
3467 <p>a
3468 </p>
3469 <pre>| b
3470 | c
3471 </pre>
3472 !! html/parsoid
3473 <p>a</p>
3474 <pre>
3475 | b
3476 | c</pre>
3477 !!end
3478
3479 !! test
3480 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3481 !! wikitext
3482 <table>
3483 <tr>
3484 <td>
3485 Text that should be rendered preformatted
3486 </td>
3487 </tr>
3488 </table>
3489 !! html
3490 <table>
3491 <tr>
3492 <td>
3493 <pre>Text that should be rendered preformatted
3494 </pre>
3495 </td>
3496 </tr>
3497 </table>
3498
3499 !! end
3500
3501 !! test
3502 2h. Indent pre in tables
3503 !! options
3504 parsoid=wt2html,html2html
3505 !! wikitext
3506 {|
3507 !
3508 foo
3509 !
3510 bar
3511 |-
3512 |
3513 baz
3514 {{!}}
3515 bam
3516 |}
3517 !! html/php
3518 <table>
3519 <tr>
3520 <th>
3521 <pre>foo
3522 </pre>
3523 </th>
3524 <th>
3525 <pre>bar
3526 </pre>
3527 </th></tr>
3528 <tr>
3529 <td>
3530 <pre>baz
3531 </pre>
3532 </td>
3533 <td>
3534 <pre>bam
3535 </pre>
3536 </td></tr></table>
3537
3538 !! html/parsoid
3539 <table>
3540 <tbody><tr><th>
3541 <pre>foo</pre>
3542 </th><th>
3543 <pre>bar</pre>
3544 </th></tr><tr>
3545 <td>
3546 <pre>baz</pre>
3547 </td><td data-parsoid='{"startTagSrc":"{{!}}"}'>
3548 <pre>bam</pre>
3549 </td></tr></tbody></table>
3550 !! end
3551
3552 !! test
3553 3a. Indent-Pre and block tags (single-line html)
3554 !! wikitext
3555 a <p> foo </p>
3556 b <div> foo </div>
3557 c <blockquote> foo </blockquote>
3558 <span> foo </span>
3559 !! html
3560 a <p> foo </p>
3561 b <div> foo </div>
3562 c <blockquote> foo </blockquote>
3563 <pre><span> foo </span>
3564 </pre>
3565 !! html/php+tidy
3566 <p> a </p><p> foo </p><p>
3567 b </p><div> foo </div><p>
3568 c </p><blockquote><p> foo </p></blockquote>
3569 <pre><span> foo </span>
3570 </pre>
3571 !! html/parsoid
3572 <p> a </p><p data-parsoid='{"stx":"html"}'> foo </p><p>
3573 b </p><div data-parsoid='{"stx":"html"}'> foo </div><p>
3574 c </p><blockquote data-parsoid='{"stx":"html"}'><p> foo </p></blockquote>
3575 <pre><span data-parsoid='{"stx":"html"}'> foo </span></pre>
3576 !! end
3577
3578 !! test
3579 3b. Indent-Pre and block tags (multi-line html)
3580 !! wikitext
3581 a <span>foo</span>
3582 <!-- comment --> b <div> foo </div>
3583 !! html/php
3584 <pre>a <span>foo</span>
3585 </pre>
3586 b <div> foo </div>
3587
3588 !! html/parsoid
3589 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3590 <!-- comment --> <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3591 !! html/php+tidy
3592 <pre>a <span>foo</span>
3593 </pre><p>
3594 b </p><div> foo </div>
3595 !! end
3596
3597 !!test
3598 3c. Indent-Pre and block tags (pre-content on separate line)
3599 !! wikitext
3600 <p>
3601 foo
3602 </p>
3603
3604 <div>
3605 foo
3606 </div>
3607
3608 <center>
3609 foo
3610 </center>
3611
3612 <blockquote>
3613 foo
3614 </blockquote>
3615
3616 <blockquote>
3617 <pre>
3618 foo
3619 </pre>
3620 </blockquote>
3621
3622 <table><tr><td>
3623 foo
3624 </td></tr></table>
3625
3626 <ul><li>
3627 foo
3628 </li></ul>
3629
3630 !! html
3631 <p>
3632 foo
3633 </p>
3634 <div>
3635 <pre>foo
3636 </pre>
3637 </div>
3638 <center>
3639 <pre>foo
3640 </pre>
3641 </center>
3642 <blockquote>
3643 <p> foo
3644 </p>
3645 </blockquote>
3646 <blockquote>
3647 <pre>
3648 foo
3649 </pre>
3650 </blockquote>
3651 <table><tr><td>
3652 <pre>foo
3653 </pre>
3654 </td></tr></table>
3655 <ul><li>
3656 foo
3657 </li></ul>
3658
3659 !!end
3660
3661 !! test
3662 4. Indent-Pre and extension tags
3663 !! options
3664 parsoid=wt2html,html2html
3665 !! wikitext
3666 a <tag />
3667 !! html/php+tidy
3668 <p> a </p><pre>NULL
3669 array (
3670 )
3671 </pre>
3672 !! html/parsoid
3673 <p> a </p><pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{}}'></pre>
3674 !! end
3675
3676 !! test
3677 5. Indent-Pre and html pre
3678 !! wikitext
3679 <pre class="123">hi</pre>
3680 !! html/php
3681 <pre class="123">hi</pre>
3682
3683 !! html/parsoid
3684 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3685 !! end
3686
3687 !!test
3688 Render paragraphs when indent-pre is suppressed in blocklevels
3689 !! wikitext
3690 <blockquote>
3691 foo
3692
3693 bar
3694 </blockquote>
3695 !! html
3696 <blockquote>
3697 <p> foo
3698 </p><p> bar
3699 </p>
3700 </blockquote>
3701
3702 !!end
3703
3704 !!test
3705 4. Multiple spaces at start-of-line
3706 !! wikitext
3707 <p> foo </p>
3708 foo
3709 {|
3710 |foo
3711 |}
3712 !! html
3713 <p> foo </p>
3714 <pre> foo
3715 </pre>
3716 <table>
3717 <tr>
3718 <td>foo
3719 </td></tr></table>
3720
3721 !!end
3722
3723 ## NOTE: the leading white-space chars on empty line are significant
3724 !! test
3725 5a. White-space in indent-pre
3726 !! wikitext
3727 a<br />
3728
3729 b
3730 !! html
3731 <pre>a<br />
3732
3733 b
3734 </pre>
3735 !! end
3736
3737 ## NOTE: the leading white-space chars on empty line are significant
3738 !! test
3739 5b. White-space in indent-pre
3740 !! wikitext
3741 a
3742
3743 b
3744
3745
3746 c
3747 !! html
3748 <pre>a
3749
3750 b
3751
3752
3753 c
3754 </pre>
3755 !! end
3756
3757 !! test
3758 5c. White-space in indent-pre
3759 !! wikitext
3760 ''a''
3761 ''b''
3762 ''c''
3763 !! html
3764 <pre><i>a</i>
3765 <i>b</i>
3766 <i>c</i>
3767 </pre>
3768 !! end
3769
3770 !! test
3771 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3772 !! wikitext
3773 a
3774
3775 <!-- continue -->
3776 b
3777
3778 c
3779
3780 d
3781 !! html
3782 <pre>a
3783
3784 b
3785 </pre>
3786 <pre>c
3787
3788 </pre>
3789 <p>d
3790 </p>
3791 !! end
3792
3793 !! test
3794 7a. Indent-pre and category links
3795 !! options
3796 parsoid=wt2html,wt2wt
3797 !! wikitext
3798 [[Category:foo]] <!-- No pre-wrapping -->
3799 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3800 !! html/php+tidy
3801 !! html/parsoid
3802 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3803 <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 -->
3804 !! end
3805
3806 ## We used to, but no longer wt2wt this test since the default serializer
3807 ## will normalize all categories to serialize on their own line.
3808 ## This wikitext usage is going to be fairly uncommon in production and
3809 ## selser will take care of preserving formatting in those scenarios.
3810 !! test
3811 7b. Indent-pre and category links
3812 !! options
3813 parsoid=wt2html
3814 !! wikitext
3815 [[Category:foo]] a
3816 [[Category:foo]] {{echo|b}}
3817 !! html/parsoid
3818 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3819 <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>
3820 !! end
3821
3822 !! test
3823 Indent-Pre: Newlines in comments shouldn't affect sol state
3824 !! wikitext
3825 a <!--
3826 foo
3827 --> b
3828 !! html/php+tidy
3829 <p>a b
3830 </p>
3831 !! html/parsoid
3832 <p>a <!--
3833 foo
3834 --> b</p>
3835 !! end
3836
3837 ###
3838 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3839 ###
3840
3841 !!test
3842 HTML-pre: 1. embedded newlines
3843 !! wikitext
3844 <pre>foo</pre>
3845
3846 <pre>
3847 foo
3848 </pre>
3849
3850 <pre>
3851
3852 foo
3853 </pre>
3854
3855 <pre>
3856
3857
3858 foo
3859 </pre>
3860 !! html/php+tidy
3861 <pre>foo</pre>
3862 <pre>foo
3863 </pre>
3864 <pre>
3865
3866 foo
3867 </pre>
3868 <pre>
3869
3870
3871 foo
3872 </pre>
3873 !! html/parsoid
3874 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3875
3876 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3877 </pre>
3878
3879 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3880
3881 foo
3882 </pre>
3883
3884 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3885
3886
3887 foo
3888 </pre>
3889 !!end
3890
3891 !! test
3892 HTML-pre: big spaces
3893 !! wikitext
3894 <pre>
3895
3896
3897
3898
3899 haha
3900
3901
3902
3903
3904 haha
3905
3906
3907
3908
3909 </pre>
3910 !! html/php+tidy
3911 <pre>
3912
3913
3914
3915
3916 haha
3917
3918
3919
3920
3921 haha
3922
3923
3924
3925
3926 </pre>
3927 !! html/parsoid
3928 <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"}}'>
3929
3930
3931
3932
3933 haha
3934
3935
3936
3937
3938 haha
3939
3940
3941
3942
3943 </pre>
3944 !! end
3945
3946 !!test
3947 HTML-pre: 2: indented text
3948 !! wikitext
3949 <pre>
3950 foo
3951 </pre>
3952 !! html
3953 <pre>
3954 foo
3955 </pre>
3956
3957 !!end
3958
3959 !!test
3960 HTML-pre: 3: other wikitext
3961 !! wikitext
3962 <pre>
3963 * foo
3964 # bar
3965 = no-h =
3966 '' no-italic ''
3967 [[ NoLink ]]
3968 </pre>
3969 !! html/php
3970 <pre>
3971 * foo
3972 # bar
3973 = no-h =
3974 '' no-italic ''
3975 [[ NoLink ]]
3976 </pre>
3977
3978 !! html/parsoid
3979 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n* foo\n# bar\n= no-h =\n&#39;&#39; no-italic &#39;&#39;\n[[ NoLink ]]\n"}}'>* foo
3980 # bar
3981 = no-h =
3982 '' no-italic ''
3983 [[ NoLink ]]
3984 </pre>
3985 !!end
3986
3987 ###
3988 ### Definition lists
3989 ###
3990 !! test
3991 Simple definition
3992 !! wikitext
3993 ;name :Definition
3994 !! html
3995 <dl><dt>name</dt>
3996 <dd>Definition</dd></dl>
3997
3998 !! end
3999
4000 !! test
4001 Definition list for indentation only
4002 !! wikitext
4003 :Indented text
4004 !! html
4005 <dl><dd>Indented text</dd></dl>
4006
4007 !! end
4008
4009 !! test
4010 Definition list with no space
4011 !! wikitext
4012 ;name:Definition
4013 !! html
4014 <dl><dt>name</dt>
4015 <dd>Definition</dd></dl>
4016
4017 !!end
4018
4019 !! test
4020 Definition list with URL link
4021 !! wikitext
4022 ;http://example.com/ :definition
4023 !! html
4024 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a></dt>
4025 <dd>definition</dd></dl>
4026
4027 !! end
4028
4029 !! test
4030 Definition list with bracketed URL link
4031 !! wikitext
4032 ;[http://www.example.com/ Example]:Something about it
4033 !! html
4034 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
4035 <dd>Something about it</dd></dl>
4036
4037 !! end
4038
4039 !! test
4040 Definition list with wikilink containing colon
4041 !! wikitext
4042 ;[[Help:FAQ]]:The least-read page on Wikipedia
4043 !! html
4044 <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>
4045 <dd>The least-read page on Wikipedia</dd></dl>
4046
4047 !! end
4048
4049 # At Brion's and JeLuF's insistence... :)
4050 !! test
4051 Definition list with news link containing colon
4052 !! wikitext
4053 ;news:alt.wikipedia.rox :This isn't even a real newsgroup!
4054 !! html/php
4055 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
4056 <dd>This isn't even a real newsgroup!</dd></dl>
4057
4058 !! html/parsoid
4059 <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>
4060 !! end
4061
4062 !! test
4063 Malformed definition list with colon
4064 !! wikitext
4065 ;news:alt.wikipedia.rox -- don't crash or enter an infinite loop
4066 !! html
4067 <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>
4068
4069 !! end
4070
4071 !! test
4072 Definition lists: colon in external link text
4073 !! wikitext
4074 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
4075 !! html
4076 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia :The Next Generation</a></dt>
4077 <dd>OK, I made that up</dd></dl>
4078
4079 !! end
4080
4081 !! test
4082 Definition lists: colon in HTML attribute
4083 !! wikitext
4084 ;<b style="display: inline">bold</b>
4085 !! html
4086 <dl><dt><b style="display: inline">bold</b></dt></dl>
4087
4088 !! end
4089
4090 !! test
4091 Definition lists: self-closed tag
4092 !! wikitext
4093 ;one<br/>two :two-line fun
4094 !! html
4095 <dl><dt>one<br />two</dt>
4096 <dd>two-line fun</dd></dl>
4097
4098 !! end
4099
4100 !! test
4101 Definition lists: ignore colons inside tags
4102 !! wikitext
4103 ;one <b>two : tag <i>fun:</i>:</b>:def
4104 !! html
4105 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
4106 <dd>def</dd></dl>
4107
4108 !! end
4109
4110 !! test
4111 Definition lists: excess closed tags
4112 !! wikitext
4113 ;one</b>two :bad tag fun
4114 !! html/php+tidy
4115 <dl><dt>onetwo</dt>
4116 <dd>bad tag fun</dd></dl>
4117 !! html/parsoid
4118 <dl>
4119 <dt>onetwo</dt>
4120 <dd>bad tag fun</dd>
4121 </dl>
4122 !! end
4123
4124 !! test
4125 T13748: Literal closing tags
4126 !! wikitext
4127 <dl>
4128 <dt>test 1</dt>
4129 <dd>test test test test test</dd>
4130 <dt>test 2</dt>
4131 <dd>test test test test test</dd>
4132 </dl>
4133 !! html
4134 <dl>
4135 <dt>test 1</dt>
4136 <dd>test test test test test</dd>
4137 <dt>test 2</dt>
4138 <dd>test test test test test</dd>
4139 </dl>
4140
4141 !! end
4142
4143 !! test
4144 Definition and unordered list using wiki syntax nested in unordered list using html tags.
4145 !! wikitext
4146 <ul><li>
4147 ;term :description
4148 *unordered
4149 </li></ul>
4150 !! html
4151 <ul><li>
4152 <dl><dt>term</dt>
4153 <dd>description</dd></dl>
4154 <ul><li>unordered</li></ul>
4155 </li></ul>
4156
4157 !! end
4158
4159 !! test
4160 Definition list with empty definition and following paragraph
4161 !! wikitext
4162 ;term:
4163
4164 Paragraph text
4165 !! html
4166 <dl><dt>term</dt>
4167 <dd></dd></dl>
4168 <p>Paragraph text
4169 </p>
4170 !! end
4171
4172 !! test
4173 Nested definition lists using html syntax
4174 !! wikitext
4175 <dl><dt>x</dt>
4176 <dd>a</dd>
4177 <dd>b</dd></dl>
4178 !! html
4179 <dl><dt>x</dt>
4180 <dd>a</dd>
4181 <dd>b</dd></dl>
4182
4183 !! end
4184
4185 !! test
4186 Definition Lists: No nesting: Multiple dd's
4187 !! wikitext
4188 ;x
4189 :a
4190 :b
4191 !! html
4192 <dl><dt>x</dt>
4193 <dd>a</dd>
4194 <dd>b</dd></dl>
4195
4196 !! end
4197
4198 !! test
4199 Definition Lists: Indentation: Regular
4200 !! wikitext
4201 :i1
4202 ::i2
4203 :::i3
4204 !! html
4205 <dl><dd>i1
4206 <dl><dd>i2
4207 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4208
4209 !! end
4210
4211 !! test
4212 Definition Lists: Indentation: Missing 1st level
4213 !! wikitext
4214 ::i2
4215 :::i3
4216 !! html
4217 <dl><dd><dl><dd>i2
4218 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4219
4220 !! end
4221
4222 !! test
4223 Definition Lists: Indentation: Multi-level indent
4224 !! wikitext
4225 :::i3
4226 !! html
4227 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
4228
4229 !! end
4230
4231 !! test
4232 Definition Lists: Hacky use to indent tables
4233 !! wikitext
4234 ::{|
4235 |foo
4236 |bar
4237 |}
4238 this text
4239 should be left alone
4240 !! html
4241 <dl><dd><dl><dd><table>
4242 <tr>
4243 <td>foo
4244 </td>
4245 <td>bar
4246 </td></tr></table></dd></dl></dd></dl>
4247 <p>this text
4248 should be left alone
4249 </p>
4250 !! end
4251
4252 !! test
4253 Definition Lists: Hacky use to indent tables (with content following table)
4254 !! wikitext
4255 :{|
4256 |foo
4257 |bar
4258 |} <!--c1--> this text should be part of the dl
4259 !! html/php+tidy
4260 <dl><dd><table>
4261 <tbody><tr>
4262 <td>foo
4263 </td>
4264 <td>bar
4265 </td></tr></tbody></table> this text should be part of the dl</dd></dl>
4266 !! html/parsoid
4267 <dl><dd><table>
4268 <tbody><tr>
4269 <td>foo
4270 </td>
4271 <td>bar
4272 </td></tr></tbody></table> <!--c1--> this text should be part of the dl</dd></dl>
4273 !! end
4274
4275 !! test
4276 Definition Lists: Hacky use to indent tables, with comments (T65979)
4277 !! wikitext
4278 <!-- foo -->
4279 ::{|
4280 |foo
4281 |bar
4282 |}<!-- bar -->
4283 this text
4284 should be left alone
4285 !! html/parsoid
4286 <!-- foo -->
4287 <dl><dd><dl><dd><table><tr>
4288 <td>foo</td>
4289 <td>bar</td>
4290 </tr></table><!-- bar --></dd></dl></dd></dl>
4291 <p>this text
4292 should be left alone</p>
4293 !! end
4294
4295 !! test
4296 Definition Lists: Hacky use to indent tables, with comment before table
4297 !!options
4298 parsoid=wt2html
4299 !! wikitext
4300 ::<!-- foo -->{|
4301 |foo
4302 |}
4303 !! html/parsoid
4304 <dl><dd><dl><dd><!-- foo --><table><tr>
4305 <td>foo</td>
4306 </tr></table></dd></dl></dd></dl>
4307 !! end
4308
4309 # The trailing whitespace in this test is to catch a regression in
4310 # Parsoid after T54473.
4311 !! test
4312 Definition Lists: Hacky use to indent tables (WS-insensitive)
4313 !! wikitext
4314 :{|
4315 |a
4316 |}
4317 !! html/php
4318 <dl><dd><table>
4319 <tr>
4320 <td>a
4321 </td></tr></table></dd></dl>
4322
4323 !! html/parsoid
4324 <dl><dd><table>
4325 <tbody><tr><td>a</td></tr>
4326 </tbody></table></dd></dl>
4327 !! end
4328
4329 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4330 ## as an empty dt item. It also ignores all but the last ";" when followed
4331 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4332 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4333 ## ";"s.
4334 ##
4335 ## Ex: ";;t2 ::d2" is transformed into:
4336 ##
4337 ## <dl>
4338 ## <dt>t2 </dt>
4339 ## <dd>
4340 ## <dl>
4341 ## <dt></dt>
4342 ## <dd>d2</dd>
4343 ## </dl>
4344 ## </dd>
4345 ## </dl>
4346 ##
4347 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4348 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4349 ##
4350 ## <dl>
4351 ## <dt>
4352 ## <dl>
4353 ## <dt>t2 </dt>
4354 ## <dd>:d2</dd>
4355 ## </dl>
4356 ## </dt>
4357 ## </dl>
4358 ##
4359 ## All Parsoid only definition list tests have this difference.
4360 ##
4361 ## See also: https://phabricator.wikimedia.org/T8569
4362 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4363
4364 !! test
4365 Table / list interaction: indented table with lists in table contents
4366 !! wikitext
4367 :{|
4368 |-
4369 |a
4370
4371 *b
4372 |-
4373 |c
4374
4375 *d
4376 |}
4377 !! html
4378 <dl><dd><table>
4379
4380 <tr>
4381 <td>a
4382 <ul><li>b</li></ul>
4383 </td></tr>
4384 <tr>
4385 <td>c
4386 <ul><li>d</li></ul>
4387 </td></tr></table></dd></dl>
4388
4389 !! end
4390
4391 !!test
4392 Table / list interaction: lists nested in tables nested in indented lists
4393 !! wikitext
4394 :{|
4395 |
4396 :a
4397 :b
4398 |
4399 *c
4400 *d
4401 |}
4402
4403 *e
4404 *f
4405 !! html
4406 <dl><dd><table>
4407 <tr>
4408 <td>
4409 <dl><dd>a</dd>
4410 <dd>b</dd></dl>
4411 </td>
4412 <td>
4413 <ul><li>c</li>
4414 <li>d</li></ul>
4415 </td></tr></table></dd></dl>
4416 <ul><li>e</li>
4417 <li>f</li></ul>
4418
4419 !!end
4420
4421 !! test
4422 Definition Lists: Nesting: Multi-level (Parsoid only)
4423 !! wikitext
4424 ;t1 :d1
4425 ;;t2 ::d2
4426 ;;;t3 :::d3
4427 !! html/parsoid
4428 <dl>
4429 <dt>t1 </dt>
4430 <dd>d1</dd>
4431 <dt>
4432 <dl>
4433 <dt>t2 </dt>
4434 <dd>:d2</dd>
4435 <dt>
4436 <dl>
4437 <dt>t3 </dt>
4438 <dd>::d3</dd>
4439 </dl>
4440 </dt>
4441 </dl>
4442 </dt>
4443 </dl>
4444
4445
4446 !! end
4447
4448
4449 !! test
4450 Definition Lists: Nesting: Test 2
4451 !! wikitext
4452 ;t1
4453 ::d2
4454 !! html+tidy
4455 <dl><dt>t1</dt>
4456 <dd>
4457 <dl><dd>d2</dd></dl></dd></dl>
4458 !! end
4459
4460
4461 !! test
4462 Definition Lists: Nesting: Test 3
4463 !! wikitext
4464 :;t1
4465 ::::d2
4466 !! html+tidy
4467 <dl><dd><dl><dt>t1</dt>
4468 <dd>
4469 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4470 !! end
4471
4472
4473 !! test
4474 Definition Lists: Nesting: Test 4
4475 !! wikitext
4476 ::;t3
4477 :::d3
4478 !! html
4479 <dl><dd><dl><dd><dl><dt>t3</dt>
4480 <dd>d3</dd></dl></dd></dl></dd></dl>
4481
4482 !! end
4483
4484
4485 ## The Parsoid team believes the following three test exposes a
4486 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4487 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4488 ## It also exposes a "misfeature" in tidy, which doesn't like
4489 ## <dl> tags with a single <dt> child; it converts the <dt> into
4490 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4491 !! test
4492 Definition Lists: Mixed Lists: Test 1
4493 !! wikitext
4494 :;*foo
4495 ::*bar
4496 :;baz
4497 !! html/php
4498 <dl><dd><dl><dt><ul><li>foo</li>
4499 <li>bar</li></ul></dt></dl>
4500 <dl><dt>baz</dt></dl></dd></dl>
4501
4502 !! html/php+tidy
4503 <dl><dd><dl><dt><ul><li>foo</li>
4504 <li>bar</li></ul></dt></dl>
4505 <dl><dt>baz</dt></dl></dd></dl>
4506 !! html/parsoid
4507 <dl>
4508 <dd><dl>
4509 <dt><ul>
4510 <li>foo
4511 </li>
4512 </ul></dt>
4513 <dd><ul>
4514 <li>bar
4515 </li>
4516 </ul></dd>
4517 <dt>baz</dt>
4518 </dl></dd>
4519 </dl>
4520 !! end
4521
4522 !! test
4523 Definition Lists: Mixed Lists: Test 2
4524 !! wikitext
4525 *:d1
4526 *:d2
4527 !! html
4528 <ul><li><dl><dd>d1</dd>
4529 <dd>d2</dd></dl></li></ul>
4530
4531 !! end
4532
4533
4534 !! test
4535 Definition Lists: Mixed Lists: Test 3
4536 !! wikitext
4537 *:::d1
4538 *:::d2
4539 !! html
4540 <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
4541 <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
4542
4543 !! end
4544
4545
4546 !! test
4547 Definition Lists: Mixed Lists: Test 4
4548 !! wikitext
4549 *;d1 :d2
4550 *;d3 :d4
4551 !! html
4552 <ul><li><dl><dt>d1</dt>
4553 <dd>d2</dd>
4554 <dt>d3</dt>
4555 <dd>d4</dd></dl></li></ul>
4556
4557 !! end
4558
4559
4560 !! test
4561 Definition Lists: Mixed Lists: Test 5
4562 !! wikitext
4563 *:d1
4564 *::d2
4565 !! html
4566 <ul><li><dl><dd>d1
4567 <dl><dd>d2</dd></dl></dd></dl></li></ul>
4568
4569 !! end
4570
4571
4572 !! test
4573 Definition Lists: Mixed Lists: Test 6
4574 !! wikitext
4575 #*:d1
4576 #*:::d3
4577 !! html
4578 <ol><li><ul><li><dl><dd>d1
4579 <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4580
4581 !! end
4582
4583
4584 !! test
4585 Definition Lists: Mixed Lists: Test 7
4586 !! wikitext
4587 :*d1
4588 :*d2
4589 !! html
4590 <dl><dd><ul><li>d1</li>
4591 <li>d2</li></ul></dd></dl>
4592
4593 !! end
4594
4595
4596 !! test
4597 Definition Lists: Mixed Lists: Test 8
4598 !! wikitext
4599 :*d1
4600 ::*d2
4601 !! html
4602 <dl><dd><ul><li>d1</li></ul>
4603 <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
4604
4605 !! end
4606
4607
4608 !! test
4609 Definition Lists: Mixed Lists: Test 9
4610 !! wikitext
4611 *;foo :bar
4612 !! html
4613 <ul><li><dl><dt>foo</dt>
4614 <dd>bar</dd></dl></li></ul>
4615
4616 !! end
4617
4618
4619 !! test
4620 Definition Lists: Mixed Lists: Test 10
4621 !! wikitext
4622 *#;foo :bar
4623 !! html
4624 <ul><li><ol><li><dl><dt>foo</dt>
4625 <dd>bar</dd></dl></li></ol></li></ul>
4626
4627 !! end
4628
4629 # The Parsoid team disagrees with the PHP parser's seemingly-random
4630 # rules regarding dd/dt on the next few tests. Parsoid is more
4631 # consistent, and recognizes the shared nesting and keeps the
4632 # still-open tags around until the nesting is complete.
4633
4634 # This is a regression test for T175099
4635 !! test
4636 Definition Lists: Mixed Lists: Test 11
4637 !! wikitext
4638 ;a
4639 :*b
4640 !! html/php
4641 <dl><dt>a</dt>
4642 <dd>
4643 <ul><li>b</li></ul></dd></dl>
4644
4645 !! html/parsoid
4646 <dl><dt>a
4647 <dd><ul><li>b</li></ul></dd></dl>
4648 !! end
4649
4650 # FIXME: Maybe get rid of this test?
4651 !! test
4652 Definition Lists: Mixed Lists: Test 12
4653 !! wikitext
4654 *#*#;*;;foo :bar
4655 *#*#;boo :baz
4656 !! html/php
4657 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4658 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4659 <dl><dt>boo</dt>
4660 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4661
4662 !! html/php+tidy
4663 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4664 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4665 <dl><dt>boo</dt>
4666 <dd>baz</dd></dl></li></ol></li></ul>
4667 !! html/parsoid
4668 <ul>
4669 <li>
4670 <ol>
4671 <li>
4672 <ul>
4673 <li>
4674 <ol>
4675 <li>
4676 <dl>
4677 <dt>
4678 <ul>
4679 <li>
4680 <dl>
4681 <dt>
4682 <dl>
4683 <dt>foo</dt>
4684 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4685 </dl></dt>
4686 </dl></li>
4687 </ul></dt>
4688 <dt>boo</dt>
4689 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4690 </dl></li>
4691 </ol></li>
4692 </ul></li>
4693 </ol></li>
4694 </ul>
4695 !! end
4696
4697 !! test
4698 Definition Lists: Mixed Lists: Test 13
4699 !! wikitext
4700 *#*#;*;;foo : bar
4701 *#*#;boo : baz
4702 !! html+tidy
4703 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4704 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4705 <dl><dt>boo&#160;</dt>
4706 <dd>baz</dd></dl></li></ol></li></ul>
4707 !! end
4708
4709 # FIXME: Maybe get rid of this test?
4710 # From whitelist:
4711 # * The test is wrong, there are two colons where there should be :;
4712 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4713 !! test
4714 Definition Lists: Weird Ones: Test 1
4715 !! wikitext
4716 *#;*::;;foo :bar (who uses this?)
4717 !! html/php+tidy
4718 <ul><li><ol><li><dl><dt>foo</dt>
4719 <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>
4720 !! html/parsoid
4721 <ul>
4722 <li>
4723 <ol>
4724 <li>
4725 <dl>
4726 <dt>
4727 <ul>
4728 <li>
4729 <dl>
4730 <dd>
4731 <dl>
4732 <dd>
4733 <dl>
4734 <dt>
4735 <dl>
4736 <dt>foo</dt>
4737 <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
4738 </dl></dt>
4739 </dl></dd>
4740 </dl></dd>
4741 </dl></li>
4742 </ul></dt>
4743 </dl></li>
4744 </ol></li>
4745 </ul>
4746 !! end
4747
4748 !! test
4749 Definition Lists: colons occurring in tags
4750 !! wikitext
4751 ;a:b
4752 ;'''a:b'''
4753 ;<i>a:b</i>
4754 ;<span>a:b</span>
4755 ;<div>a:b</div>
4756 ;<div>a
4757 :b</div>
4758 ;{{echo|a:b}}
4759 ;{{echo|''a:b''}}
4760 ;;;''a:b''
4761 !! html+tidy
4762 <dl><dt>a</dt>
4763 <dd>b</dd>
4764 <dt><b>a:b</b></dt>
4765 <dt><i>a:b</i></dt>
4766 <dt><span>a:b</span></dt>
4767 <dt><div>a:b</div></dt>
4768 <dt><div>a</div></dt>
4769 <dd>b</dd>
4770 <dt>a</dt>
4771 <dd>b</dd>
4772 <dt><i>a:b</i></dt></dl>
4773 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4774 !! html/parsoid
4775 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4776 <dt><b>a:b</b></dt>
4777 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4778 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4779 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4780 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4781 <dd>b</dd>
4782 <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>
4783 <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>
4784 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4785 !! end
4786
4787 # Parsoid's output differs here again because it shares
4788 # nesting between the two lists unlike the PHP parser.
4789 # Unsure which is more desirable.
4790 !! test
4791 Definition Lists: colons and tables 1
4792 !! wikitext
4793 :{|
4794 |x
4795 |}
4796 :{|
4797 |y
4798 |}
4799 !! html/php
4800 <dl><dd><table>
4801 <tr>
4802 <td>x
4803 </td></tr></table></dd></dl>
4804 <dl><dd><table>
4805 <tr>
4806 <td>y
4807 </td></tr></table></dd></dl>
4808
4809 !! html/parsoid
4810 <dl><dd><table>
4811 <tr>
4812 <td>x
4813 </td></tr></table></dd>
4814 <dd><table>
4815 <tr>
4816 <td>y
4817 </td></tr></table></dd></dl>
4818 !! end
4819
4820 # FIXME: Does this need a html/php section?
4821 !! test
4822 Definition Lists: template interaction
4823 !! wikitext
4824 ::{{definition_list}}
4825
4826 :one
4827 ::{{definition_list}}
4828 :::two
4829 :::three
4830 ::four
4831 !! html/parsoid
4832 <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">
4833 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4834
4835 <dl><dd data-parsoid='{}'>one
4836 <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">
4837 </span><dd about="#mwt2">two
4838 <dl><dd>two</dd>
4839 <dd>three</dd></dl></dd>
4840 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4841 !! end
4842
4843
4844 ###
4845 ### External links
4846 ###
4847 !! test
4848 External links: non-bracketed
4849 !! wikitext
4850 Non-bracketed: http://example.com
4851 !! html
4852 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4853 </p>
4854 !! end
4855
4856 # parsoid doesn't explicitly mark autonumbered links, see T55505
4857 !! test
4858 External links: numbered
4859 !! wikitext
4860 Numbered: [http://example.com]
4861 Numbered: [http://example.net]
4862 Numbered: [http://example.com]
4863 !! html/php
4864 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4865 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4866 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4867 </p>
4868 !! html/parsoid
4869 <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
4870 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4871 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
4872 !!end
4873
4874 !! test
4875 External links: specified text
4876 !! wikitext
4877 Specified text: [http://example.com link]
4878 !! html
4879 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4880 </p>
4881 !!end
4882
4883 !! test
4884 External links: trail
4885 !! wikitext
4886 Linktrails should not work for external links: [http://example.com link]s
4887 !! html
4888 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4889 </p>
4890 !! end
4891
4892 !! test
4893 External links: dollar sign in URL
4894 !! wikitext
4895 http://example.com/1$2345
4896 !! html
4897 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4898 </p>
4899 !! end
4900
4901 # parsoid doesn't explicitly mark autonumbered links, see T55505
4902 !! test
4903 External links: dollar sign in URL (autonumber)
4904 !! wikitext
4905 [http://example.com/1$2345]
4906 !! html/php
4907 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4908 </p>
4909 !! html/parsoid
4910 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
4911 !!end
4912
4913 !! test
4914 External links: open square bracket forbidden in URL (T6377)
4915 !! options
4916 parsoid=wt2html,wt2wt,html2html
4917 !! wikitext
4918 http://example.com/1[2345
4919 !! html/php
4920 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4921 </p>
4922 !! html/parsoid
4923 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
4924 !! end
4925
4926 !! test
4927 External links: open square bracket forbidden in URL (named) (T6377)
4928 !! options
4929 parsoid=wt2html,html2html
4930 !! wikitext
4931 [http://example.com/1[2345]
4932 !! html/php
4933 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4934 </p>
4935 !! html/parsoid
4936 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
4937 !!end
4938
4939 # parsoid adds a space before the link name
4940 !! test
4941 External links: open square bracket forbidden in URL (named) (T6377)
4942 Parsoid variant.
4943 !! wikitext
4944 [http://example.com/1 [2345]
4945 !! html
4946 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4947 </p>
4948 !!end
4949
4950 !! test
4951 External links: nowiki in URL link text (T8230)
4952 !! wikitext
4953 [http://example.com/ <nowiki>''example site''</nowiki>]
4954 !! html
4955 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4956 </p>
4957 !! end
4958
4959 !! test
4960 External links: newline forbidden in text (T8230 regression check)
4961 !! wikitext
4962 [http://example.com/ first
4963 second]
4964 !! html
4965 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4966 second]
4967 </p>
4968 !!end
4969
4970 !! test
4971 External links: Pipe char between url and text
4972 !! wikitext
4973 [http://example.com | link]
4974 !! html
4975 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4976 </p>
4977 !!end
4978
4979 !! test
4980 External links: protocol-relative URL in brackets
4981 !! wikitext
4982 [//example.com/ Test]
4983 !! html
4984 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4985 </p>
4986 !! end
4987
4988 # parsoid doesn't explicitly mark autonumbered links, see T55505
4989 !! test
4990 External links: protocol-relative URL in brackets without text
4991 !! wikitext
4992 [//example.com]
4993 !! html/php
4994 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4995 </p>
4996 !! html/parsoid
4997 <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
4998 !! end
4999
5000 !! test
5001 External links: protocol-relative URL in free text is left alone
5002 !! wikitext
5003 //example.com/Foo
5004 !! html
5005 <p>//example.com/Foo
5006 </p>
5007 !!end
5008
5009 !! test
5010 External links: protocol-relative URL in the middle of a word is left alone (T32269)
5011 !! wikitext
5012 foo//example.com/Foo
5013 !! html
5014 <p>foo//example.com/Foo
5015 </p>
5016 !! end
5017
5018 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
5019 !! test
5020 External links: with no contents
5021 !! options
5022 parsoid=wt2html,wt2wt
5023 !! wikitext
5024 [http://en.wikipedia.org/wiki/Foo]
5025
5026 [[wikipedia:Foo|Bar]]
5027
5028 [[wikipedia:Foo|<span>Bar</span>]]
5029 !! html/php
5030 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
5031 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
5032 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
5033 </p>
5034 !! html/parsoid
5035 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
5036 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
5037 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
5038 !! end
5039
5040 !! test
5041 External links: Free with trailing punctuation
5042 !! wikitext
5043 http://example.com,
5044 http://example.com;
5045 http://example.com\
5046 http://example.com.
5047 http://example.com:
5048 http://example.com!
5049 http://example.com?
5050 http://example.com)
5051 http://example.com/url_with_(brackets)
5052 (http://example.com/url_without_brackets)
5053 http://example.com/url_with_entity&amp;
5054 http://example.com/url_with_entity&#x26;
5055 http://example.com/url_with_entity&#038;
5056 http://example.com/url_with_entity&nbsp;
5057 http://example.com/url_with_entity&#xA0;
5058 http://example.com/url_with_entity&#160;
5059 http://example.com/url_with_entity&lt;
5060 http://example.com/url_with_entity&#x3C;
5061 http://example.com/url_with_entity&#60;
5062 !! html/php
5063 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
5064 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
5065 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
5066 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
5067 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
5068 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
5069 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
5070 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5071 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5072 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5073 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5074 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5075 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5076 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5077 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
5078 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5079 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
5080 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
5081 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
5082 </p>
5083 !! html/parsoid
5084 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
5085 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
5086 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
5087 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
5088 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
5089 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
5090 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
5091 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
5092 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5093 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5094 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5095 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5096 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5097 <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>
5098 <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>
5099 <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>
5100 <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>
5101 <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>
5102 <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>
5103 !! end
5104
5105 !! test
5106 External links: tricky Parsoid html2html case
5107 !! options
5108 parsoid=wt2html,wt2wt,html2html
5109 !! wikitext
5110 http://example.com/url_with_entity&amp;amp;
5111 !! html/php
5112 <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>;
5113 </p>
5114 !! html/parsoid
5115 <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>
5116 !! end
5117
5118 !! test
5119 External links: Free with trailing quotes (T113666)
5120 !! wikitext
5121 '''News:''' Stuff here
5122
5123 news:'a'b''c''d e
5124 !! html/php
5125 <p><b>News:</b> Stuff here
5126 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
5127 </p>
5128 !! html/parsoid
5129 <p><b>News:</b> Stuff here</p>
5130 <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
5131 !! end
5132
5133 !! test
5134 External links: with entity
5135 !! wikitext
5136 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
5137 !! html/php
5138 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
5139 </p>
5140 !! html/parsoid
5141 <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>
5142 !! end
5143
5144 !! test
5145 External links: Lone protocols are never linked (T105697)
5146 !! wikitext
5147 http://
5148 http://;
5149 (http://)
5150 bitcoin:
5151 bitcoin:;
5152 (bitcoin:)
5153 !! html
5154 <p>http://
5155 http://;
5156 (http://)
5157 bitcoin:
5158 bitcoin:;
5159 (bitcoin:)
5160 </p>
5161 !! end
5162
5163 !! test
5164 External links: No preceding word characters allowed (T67278)
5165 !! wikitext
5166 NOPEhttp://example.com
5167 N0http://example.com
5168 ok:http://example.com
5169 ok-http://example.com
5170 !! html
5171 <p>NOPEhttp://example.com
5172 N0http://example.com
5173 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5174 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5175 </p>
5176 !! end
5177
5178 !! test
5179 External links: nofollow domain exception
5180 !! wikitext
5181 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
5182 !! html
5183 <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>.
5184 </p>
5185 !!end
5186
5187 !! test
5188 External image
5189 !! wikitext
5190 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5191 !! html
5192 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5193 </p>
5194 !! end
5195
5196 !! test
5197 External image from https
5198 !! wikitext
5199 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5200 !! html
5201 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5202 </p>
5203 !! end
5204
5205 !! test
5206 External image (when not allowed)
5207 !! options
5208 wgAllowExternalImages=0
5209 !! wikitext
5210 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5211 !! html
5212 <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>
5213 </p>
5214 !! end
5215
5216 !! test
5217 Link to non-http image, no img tag
5218 !! wikitext
5219 Link to non-http image, no img tag: ftp://example.com/test.jpg
5220 !! html
5221 <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>
5222 </p>
5223 !! end
5224
5225 !! test
5226 External links: terminating separator
5227 !! wikitext
5228 Terminating separator: http://example.com/thing,
5229 !! html
5230 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
5231 </p>
5232 !! end
5233
5234 !! test
5235 External links: intervening separator
5236 !! wikitext
5237 Intervening separator: http://example.com/1,2,3
5238 !! html
5239 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
5240 </p>
5241 !! end
5242
5243 !! test
5244 External links: old bug with URL in query
5245 !! wikitext
5246 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
5247 !! html
5248 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
5249 </p>
5250 !! end
5251
5252 !! test
5253 External links: old URL-in-URL bug, mixed protocols
5254 !! wikitext
5255 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
5256 !! html
5257 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
5258 </p>
5259 !!end
5260
5261 # Since Parsoid is starting to emit canonical wikitext for links,
5262 # [http://example.com http://example.com] will not RT back to that
5263 # form anymore.
5264 !! test
5265 External links: URL in text
5266 !! options
5267 parsoid=wt2html
5268 !! wikitext
5269 URL in text: [http://example.com http://example.com]
5270 !! html/php
5271 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
5272 </p>
5273 !! html/parsoid
5274 <p>URL in text: <a rel="mw:ExtLink" class="external text" href="http://example.com">http://example.com</a></p>
5275 !! end
5276
5277 !! test
5278 External links: Clickable images
5279 !! wikitext
5280 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5281 !! html/php
5282 <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>
5283 </p>
5284 !! html/parsoid
5285 <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>
5286 !! end
5287
5288 !! test
5289 External links: raw ampersand
5290 !! wikitext
5291 Old &amp; use: http://x&y
5292 !! html
5293 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5294 </p>
5295 !! end
5296
5297 !! test
5298 External links: encoded ampersand
5299 !! wikitext
5300 Old &amp; use: http://x&amp;y
5301 !! html/php
5302 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5303 </p>
5304 !! html/parsoid
5305 <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>
5306 !! end
5307
5308 !! test
5309 External links: encoded equals (T8102)
5310 !! wikitext
5311 http://example.com/?foo&#61;bar
5312 !! html/php
5313 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5314 </p>
5315 !! html/parsoid
5316 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5317 !! end
5318
5319 ##
5320 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5321 ## does it number them. As discussed in T55505, we can identify
5322 ## autonumbered links via CSS.
5323 ##
5324
5325 !! test
5326 External links: [raw ampersand]
5327 !! wikitext
5328 Old &amp; use: [http://x&y]
5329 !! html/php
5330 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5331 </p>
5332 !! html/parsoid
5333 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5334 !! end
5335
5336 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5337 # mode will return the [raw ampersand] wikitext
5338 !! test
5339 External links: [encoded ampersand]
5340 !! options
5341 parsoid=wt2html,wt2wt,html2html
5342 !! wikitext
5343 Old &amp; use: [http://x&amp;y]
5344 !! html/php
5345 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5346 </p>
5347 !! html/parsoid
5348 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5349 !! end
5350
5351 !! test
5352 External links: [raw equals]
5353 !! wikitext
5354 [http://example.com/?foo=bar]
5355 !! html/php
5356 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5357 </p>
5358 !! html/parsoid
5359 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5360 !! end
5361
5362 # note that parsoid html is identical to [raw equals] case; so html2wt
5363 # mode will return the [raw equals] wikitext
5364 !! test
5365 External links: [encoded equals] (T8102)
5366 !! options
5367 parsoid=wt2html,wt2wt,html2html
5368 !! wikitext
5369 [http://example.com/?foo&#61;bar]
5370 !! html/php
5371 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5372 </p>
5373 !! html/parsoid
5374 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5375 !! end
5376
5377 # xxx parsoid strips the IDN character, so the round-trip tests will
5378 # obviously fail and are disabled. --cscott
5379 !! test
5380 External links: [IDN ignored character reference in hostname; strip it right off]
5381 !! options
5382 parsoid=wt2html,wt2wt,html2html
5383 !! wikitext
5384 [http://e&zwnj;xample.com/]
5385 !! html/php
5386 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5387 </p>
5388 !! html/parsoid
5389 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
5390 !! end
5391
5392 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5393 # Where an external link could easily circumvent the sanitization of the text of
5394 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5395 # test demands a higher standard. That's a bit strange.
5396 #
5397 # Example:
5398 #
5399 # http://e‌xample.com -> [http://example.com|http://example.com]
5400 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5401 #
5402 # The first example is sanitized, but the second is not. Any security benefits
5403 # from this production are trivial to circumvent. Either remove this test and
5404 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5405 # the test accordingly.
5406 #
5407 # All our love,
5408 # The Parsoid team.
5409 # xxx parsoid strips the IDN character, so the round-trip tests will
5410 # obviously fail and are disabled. --cscott
5411 !! test
5412 External links: IDN ignored character reference in hostname; strip it right off
5413 !! options
5414 parsoid=wt2html,html2html
5415 !! wikitext
5416 http://e&zwnj;xample.com/
5417 !! html/php
5418 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5419 </p>
5420 !! html/parsoid
5421 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
5422 !! end
5423
5424 !! test
5425 External links: www.jpeg.org (T2554)
5426 !! wikitext
5427 http://www.jpeg.org
5428 !! html
5429 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5430 </p>
5431 !! end
5432
5433 # parsoid doesn't explicitly mark autonumbered links, see T55505
5434 !! test
5435 External links: URL within URL (T2002)
5436 !! wikitext
5437 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5438 !! html/php
5439 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5440 </p>
5441 !! html/parsoid
5442 <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>
5443 !! end
5444
5445 !! test
5446 T2361: URL inside bracketed URL
5447 !! wikitext
5448 [http://www.example.com/foo http://www.example.com/bar]
5449 !! html
5450 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5451 </p>
5452 !! end
5453
5454 !! test
5455 T2361: URL within URL, not bracketed
5456 !! wikitext
5457 http://www.example.com/foo?=http://www.example.com/bar
5458 !! html
5459 <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>
5460 </p>
5461 !! end
5462
5463 !! test
5464 T2289: ">"-token in URL-tail
5465 !! wikitext
5466 http://www.example.com/<hello>
5467 !! html
5468 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5469 </p>
5470 !!end
5471
5472 !! test
5473 T2289: literal ">"-token in URL-tail
5474 !! wikitext
5475 http://www.example.com/<b>html</b>
5476 !! html/php
5477 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5478 </p>
5479 !! html/parsoid
5480 <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>
5481 !! end
5482
5483 !! test
5484 T2289: ">"-token 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/">&lt;hello&gt; stuff</a>
5489 </p>
5490 !!end
5491
5492 !! test
5493 T2289: literal ">"-token in bracketed URL
5494 !! wikitext
5495 [http://www.example.com/<b>html</b> stuff]
5496 !! html
5497 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5498 </p>
5499 !!end
5500
5501 !! test
5502 T2289: literal double quote at end of URL
5503 !! wikitext
5504 http://www.example.com/"hello"
5505 !! html
5506 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5507 </p>
5508 !!end
5509
5510 !! test
5511 T2289: literal double quote in bracketed URL
5512 !! wikitext
5513 [http://www.example.com/"hello" stuff]
5514 !! html
5515 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5516 </p>
5517 !!end
5518
5519 !! test
5520 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5521 !! wikitext
5522 [http://www.example.com test]
5523 !! html
5524 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5525 </p>
5526 !! end
5527
5528 !! test
5529 External links: link text with spaces
5530 !! wikitext
5531 [http://www.example.com a b c]
5532 [http://www.example.com ''a'' ''b'']
5533 !! html
5534 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5535 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5536 </p>
5537 !! end
5538
5539 # Note edge case difference between PHP and Parsoid here.
5540 !! test
5541 External links: wiki links within external link (T5695)
5542 !! options
5543 parsoid=wt2html,html2html
5544 !! wikitext
5545 [http://example.com [[wikilink]] embedded in ext link]
5546
5547 [http://example.com test [[wikilink]] embedded in ext link]
5548 !! html/php
5549 <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>
5550 </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>
5551 </p>
5552 !! html/parsoid
5553 <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>
5554 <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>
5555 !! end
5556
5557 !! test
5558 T2787: Links with one slash after the url protocol are invalid
5559 !! wikitext
5560 http:/example.com
5561
5562 [http:/example.com title]
5563 !! html
5564 <p>http:/example.com
5565 </p><p>[http:/example.com title]
5566 </p>
5567 !! end
5568
5569 !! test
5570 Bracketed external links with template-generated invalid target
5571 !! wikitext
5572 [{{echo|http:/example.com}} title]
5573 !! html
5574 <p>[http:/example.com title]
5575 </p>
5576 !! end
5577
5578 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5579 !! test
5580 Broken wikilinks (but not external links) prevent templates from closing
5581 !! options
5582 parsoid=wt2html
5583 !! wikitext
5584 [http://example.com x
5585
5586 {{echo|[http://example.com x}}
5587
5588 [[Foo
5589
5590 {{echo|[[Foo}}
5591 !! html/php
5592 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5593 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5594 </p><p>[[Foo
5595 </p><p>{{echo|[[Foo}}
5596 </p>
5597 !! html/parsoid
5598 <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5599 <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>
5600 <p>[[Foo</p>
5601 <p>{{echo|[[Foo}}</p>
5602 !! end
5603
5604 !! test
5605 Wikilinks with embedded newlines are not broken
5606 !! wikitext
5607 {{echo|[[ Foo
5608 B
5609 C]]}}
5610 !! html/php
5611 <p>[[ Foo
5612 B
5613 C]]
5614 </p>
5615 !! html/parsoid
5616 <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>
5617 !! end
5618
5619 !! test
5620 Broken templates
5621 !! options
5622 parsoid=wt2html
5623 !! wikitext
5624 {{echo|[[Foo|}}]]
5625
5626 [[Foo|{{echo|]]}}
5627 !! html/php
5628 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5629 </p><p>[[Foo|]]
5630 </p>
5631 !! html/parsoid
5632 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5633 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5634 !! end
5635
5636 !! test
5637 T4702: Mismatched <i>, <b> and <a> tags are invalid
5638 !! wikitext
5639 ''[http://example.com text'']
5640 [http://example.com '''text]'''
5641 ''Something [http://example.com in italic'']
5642 ''Something [http://example.com mixed''''', even bold]'''
5643 '''''Now [http://example.com both''''']
5644 !! html
5645 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5646 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5647 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5648 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5649 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5650 </p>
5651 !! end
5652
5653
5654 !! test
5655 T6781: %26 in URL
5656 !! wikitext
5657 http://www.example.com/?title=AT%26T
5658 !! html/php
5659 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5660 </p>
5661 !! html/parsoid
5662 <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>
5663 !! end
5664
5665 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5666 # % is actually legal in HTML5. Any change in output would need testing though.
5667 !! test
5668 T6781, T7267: %25 in URL
5669 !! wikitext
5670 http://www.example.com/?title=100%25_Bran
5671 !! html/php
5672 <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>
5673 </p>
5674 !! html/parsoid
5675 <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>
5676 !! end
5677
5678 !! test
5679 T6781, T7267: %28, %29 in URL
5680 !! wikitext
5681 http://www.example.com/?title=Ben-Hur_%281959_film%29
5682 !! html/php
5683 <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>
5684 </p>
5685 !! html/parsoid
5686 <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>
5687 !! end
5688
5689
5690 !! test
5691 T6781: %26 in autonumber URL
5692 !! wikitext
5693 [http://www.example.com/?title=AT%26T]
5694 !! html/php
5695 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5696 </p>
5697 !! html/parsoid
5698 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5699 !! end
5700
5701 !! test
5702 T6781, T7267: %26 in autonumber URL
5703 !! wikitext
5704 [http://www.example.com/?title=100%25_Bran]
5705 !! html/php
5706 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5707 </p>
5708 !! html/parsoid
5709 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5710 !! end
5711
5712 !! test
5713 T6781, T7267: %28, %29 in autonumber URL
5714 !! wikitext
5715 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5716 !! html/php
5717 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5718 </p>
5719 !! html/parsoid
5720 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5721 !! end
5722
5723
5724 !! test
5725 T6781: %26 in bracketed URL
5726 !! wikitext
5727 [http://www.example.com/?title=AT%26T link]
5728 !! html/php
5729 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5730 </p>
5731 !! html/parsoid
5732 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5733 !! end
5734
5735 !! test
5736 T6781, T7267: %25 in bracketed URL
5737 !! wikitext
5738 [http://www.example.com/?title=100%25_Bran link]
5739 !! html
5740 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5741 </p>
5742 !! end
5743
5744 !! test
5745 T6781, T7267: %28, %29 in bracketed URL
5746 !! wikitext
5747 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5748 !! html/php
5749 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5750 </p>
5751 !! html/parsoid
5752 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5753 !! end
5754
5755 !! test
5756 External link containing a period in the anchor. (T65947)
5757 !! wikitext
5758 [//foo.org/bar#baz. bang]
5759
5760 [//foo.org/bar. bang]
5761 !! html/php
5762 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5763 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5764 </p>
5765 !! html/parsoid
5766 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5767 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5768 !! end
5769
5770 !! test
5771 External link containing a single quote. (T65947)
5772 !! wikitext
5773 [//foo.org/bar'baz]
5774
5775 [//foo.org/bar'baz bang]
5776 !! html/php
5777 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5778 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5779 </p>
5780 !! html/parsoid
5781 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5782 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5783 !! end
5784
5785 !! test
5786 External link containing double-single-quotes in text '' (T6598 sanity check)
5787 !! wikitext
5788 Some [http://example.com/ pretty ''italics'' and stuff]!
5789 !! html
5790 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5791 </p>
5792 !! end
5793
5794 !! test
5795 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5796 !! wikitext
5797 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5798 !! html
5799 <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>
5800 </p>
5801 !! end
5802
5803 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5804 !! test
5805 External link containing double-single-quotes with no space separating the url from text in italics
5806 !! wikitext
5807 [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]].]
5808 !! html/php+tidy
5809 <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>.
5810 </p>
5811 !! html/parsoid
5812 <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>
5813 !! end
5814
5815 !! test
5816 External link with comments in link text
5817 !! wikitext
5818 [http://www.google.com Google <!-- comment -->]
5819 !! html/php
5820 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5821 </p>
5822 !! html/parsoid
5823 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5824 !! end
5825
5826 !! test
5827 External link to bare IPv4 address
5828 !! wikitext
5829 [http://192.168.0.1 Link]
5830 !! html/php
5831 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5832 </p>
5833 !! html/parsoid
5834 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5835 !! end
5836
5837 !! test
5838 URL-encoding in URL functions (single parameter)
5839 !! wikitext
5840 {{localurl:Some page|amp=&}}
5841 !! html
5842 <p>/index.php?title=Some_page&amp;amp=&amp;
5843 </p>
5844 !! end
5845
5846 !! test
5847 URL-encoding in URL functions (multiple parameters)
5848 !! wikitext
5849 {{localurl:Some page|q=?&amp=&}}
5850 !! html
5851 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5852 </p>
5853 !! end
5854
5855 !! test
5856 Brackets in urls
5857 !! wikitext
5858 http://example.com/index.php?foozoid%5B%5D=bar
5859
5860 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5861 !! html/php
5862 <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>
5863 </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>
5864 </p>
5865 !! html/parsoid
5866 <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>
5867
5868 <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>
5869 !! end
5870
5871 !! test
5872 IPv6 urls, autolink format (T23261)
5873 !! wikitext
5874 http://[2404:130:0:1000::187:2]/index.php
5875
5876 Examples from RFC 2373, section 2.2:
5877
5878 *http://[1080::8:800:200C:417A]/unicast
5879 *http://[FF01::101]/multicast
5880 *http://[::1]/loopback
5881 *http://[::]/unspecified
5882 *http://[::13.1.68.3]/ipv4compat
5883 *http://[::FFFF:129.144.52.38]/ipv4compat
5884
5885 Examples from RFC 2732, section 2:
5886
5887 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5888 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5889 *http://[3ffe:2a00:100:7031::1]
5890 *http://[1080::8:800:200C:417A]/foo
5891 *http://[::192.9.5.5]/ipng
5892 *http://[::FFFF:129.144.52.38]:80/index.html
5893 *http://[2010:836B:4179::836B:4179]
5894 !! html/php
5895 <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>
5896 </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:
5897 </p>
5898 <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>
5899 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5900 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5901 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5902 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5903 <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>
5904 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5905 </p>
5906 <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>
5907 <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>
5908 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5909 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5910 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5911 <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>
5912 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5913
5914 !! html/parsoid
5915 <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>
5916
5917 <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>
5918 <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>
5919 <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5920 <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5921 <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5922 <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5923 <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>
5924
5925 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5926 <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>
5927 <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>
5928 <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5929 <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>
5930 <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5931 <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>
5932 <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5933 !! end
5934
5935 !! test
5936 IPv6 urls, bracketed format (T23261)
5937 !! wikitext
5938 [http://[2404:130:0:1000::187:2]/index.php test]
5939
5940 Examples from RFC 2373, section 2.2:
5941
5942 *[http://[1080::8:800:200C:417A] unicast]
5943 *[http://[FF01::101] multicast]
5944 *[http://[::1]/ loopback]
5945 *[http://[::] unspecified]
5946 *[http://[::13.1.68.3] ipv4compat]
5947 *[http://[::FFFF:129.144.52.38] ipv4compat]
5948
5949 Examples from RFC 2732, section 2:
5950
5951 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5952 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5953 *[http://[3ffe:2a00:100:7031::1] 3]
5954 *[http://[1080::8:800:200C:417A]/foo 4]
5955 *[http://[::192.9.5.5]/ipng 5]
5956 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5957 *[http://[2010:836B:4179::836B:4179] 7]
5958 !! html/php
5959 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5960 </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:
5961 </p>
5962 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5963 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5964 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5965 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5966 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5967 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5968 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5969 </p>
5970 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5971 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5972 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5973 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5974 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5975 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5976 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5977
5978 !! html/parsoid
5979 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5980
5981 <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>
5982 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5983 <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5984 <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5985 <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5986 <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5987 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5988
5989 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5990 <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>
5991 <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5992 <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5993 <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5994 <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5995 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5996 <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5997 !! end
5998
5999 !! test
6000 Non-extlinks in brackets
6001 !! wikitext
6002 [foo]
6003 [foo bar]
6004 [foo ''bar'']
6005 [fool's] errand
6006 [fool's errand]
6007 [{{echo|foo}}]
6008 [{{echo|foo}} bar]
6009 [{{echo|foo}} ''bar'']
6010 [{{echo|foo}}l's] errand
6011 [{{echo|foo}}l's errand]
6012 [url={{echo|foo}}]
6013 [url=http://example.com]
6014 [http:// bare protocols don't count]
6015 !! html/php
6016 <p>[foo]
6017 [foo bar]
6018 [foo <i>bar</i>]
6019 [fool's] errand
6020 [fool's errand]
6021 [foo]
6022 [foo bar]
6023 [foo <i>bar</i>]
6024 [fool's] errand
6025 [fool's errand]
6026 [url=foo]
6027 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
6028 [http:// bare protocols don't count]
6029 </p>
6030 !! html/parsoid
6031 <p>[foo]
6032 [foo bar]
6033 [foo <i>bar</i>]
6034 [fool's] errand
6035 [fool's errand]
6036 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
6037 [<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]
6038 [<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>]
6039 [<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
6040 [<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]
6041 [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>]
6042 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
6043 [http:// bare protocols don't count]</p>
6044 !! end
6045
6046 !! test
6047 Percent encoding in external links
6048 !! wikitext
6049 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
6050 !! html/php
6051 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
6052 </p>
6053 !! html/parsoid
6054 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
6055 !! end
6056
6057 !! test
6058 Use url link syntax for links where the content is equal the link target
6059 !! wikitext
6060 http://example.com
6061 !! html/php
6062 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
6063 </p>
6064 !! html/parsoid
6065 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
6066 !! end
6067
6068 !! test
6069 Parenthesis in external links, especially URL links
6070 !! wikitext
6071 http://example.com)
6072
6073 http://example.com/test)
6074
6075 http://example.com/(test)
6076
6077 http://example.com/((test)
6078
6079 (http://example.com/(test))
6080
6081 (http://example.com/(test)))))
6082
6083 http://example.com/a)b
6084
6085 [http://example.com) foo]
6086 !! html/php
6087 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6088 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
6089 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
6090 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
6091 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
6092 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
6093 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
6094 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
6095 </p>
6096 !! html/parsoid
6097 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
6098 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
6099 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
6100 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
6101 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
6102 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
6103 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
6104 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
6105 !! end
6106
6107 !! test
6108 Parenthesis in external links, w/ transclusion or comment
6109 !! wikitext
6110 (http://example.com/{{echo|hi}})
6111
6112 (http://example.com<!-- hi -->)
6113 !! html/php
6114 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
6115 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6116 </p>
6117 !! html/parsoid
6118 <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>
6119
6120 <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>
6121 !! end
6122
6123 !! test
6124 Serialize <a> tags with invalid link targets as plain text
6125 !! options
6126 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
6127 !! html/parsoid
6128 <a rel="mw:WikiLink" href="[[foo]]">text</a>
6129 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
6130 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
6131 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
6132 !! wikitext
6133 text
6134 <nowiki>*</nowiki>text
6135 <nowiki>[[foo]]</nowiki>
6136 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
6137 !! end
6138
6139 !! test
6140 mw:ExtLink -vs- mw:WikiLink (T94723)
6141 !! options
6142 parsoid=html2wt
6143 !! html/parsoid
6144 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
6145 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
6146 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6147 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6148 <p>
6149 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6150 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6151 </p>
6152 !! wikitext
6153 [[Foo|Bar]]
6154 [[Foo|Bar]]
6155 [[:en:Foo|Bar]]
6156 [[:en:Foo|Bar]]
6157
6158 [[:en:European_Robin|European Robin]]
6159 [[:en:European_Robin|European Robin]]
6160 !! end
6161
6162 !! test
6163 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
6164 !! options
6165 parsoid=wt2wt
6166 !! wikitext
6167 [http://en.wikipedia.org/wiki/European_Robin European Robin]
6168 !! html/parsoid
6169 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
6170 !! end
6171
6172
6173 ###
6174 ### Quotes
6175 ###
6176
6177 !! test
6178 Quotes
6179 !! wikitext
6180 Normal text. '''Bold text.''' Normal text. ''Italic text.''
6181
6182 Normal text. '''''Bold italic text.''''' Normal text.
6183 !! html
6184 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
6185 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
6186 </p>
6187 !! end
6188
6189 !! test
6190 Quotes wrapping HTML table
6191 !! wikitext
6192 '''<table><tr><td>hi</td></tr></table>'''
6193 !! html/php+tidy
6194 <b><table><tbody><tr><td>hi</td></tr></tbody></table></b>
6195 !! html/parsoid
6196 <b><table data-parsoid='{"stx":"html"}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>hi</td></tr></tbody></table></b>
6197 !! end
6198
6199 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
6200 # parser strips. The wikitext contains just the first half of the bold
6201 # quote pair.
6202 !! test
6203 Unclosed and unmatched quotes
6204 !! wikitext
6205 '''''Bold italic text '''with bold deactivated''' in between.'''''
6206
6207 '''''Bold italic text ''with italic deactivated'' in between.'''''
6208
6209 '''Bold text..
6210
6211 ..spanning two paragraphs (should not work).'''
6212
6213 '''Bold tag left open
6214
6215 ''Italic tag left open
6216
6217 Normal text.
6218
6219 <!-- Unmatching number of opening, closing tags: -->
6220 '''This year''''s election ''should'' beat '''last year''''s.
6221
6222 ''Tom'''s car is bigger than ''Susan'''s.
6223
6224 Plain ''italic'''s plain
6225 !! html/php
6226 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6227 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6228 </p><p><b>Bold text..</b>
6229 </p><p>..spanning two paragraphs (should not work).
6230 </p><p><b>Bold tag left open</b>
6231 </p><p><i>Italic tag left open</i>
6232 </p><p>Normal text.
6233 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6234 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6235 </p><p>Plain <i>italic'</i>s plain
6236 </p>
6237 !! html/parsoid
6238 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6239 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6240 </p><p><b>Bold text..</b>
6241 </p><p>..spanning two paragraphs (should not work).<b></b>
6242 </p><p><b>Bold tag left open</b>
6243 </p><p><i>Italic tag left open</i>
6244 </p><p>Normal text.
6245 </p>
6246 <!-- Unmatching number of opening, closing tags: -->
6247 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6248 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6249 </p><p>Plain <i>italic'</i>s plain
6250 </p>
6251 !! end
6252
6253 ###
6254 ### Tables
6255 ###
6256 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
6257 ###
6258
6259 # This should not produce <table></table> as <table><tr><td></td></tr></table>
6260 # is the bare minimum required by the spec, see:
6261 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
6262 # Parsoid team replies: empty table tags are legal in HTML5
6263 !! test
6264 A table with no data.
6265 !! options
6266 parsoid=wt2html
6267 !! wikitext
6268 {||}
6269 !! html/php
6270
6271 !! html/parsoid
6272 <table></table>
6273
6274 !! end
6275
6276 !! test
6277 A table with stray table end tags on start tag line (wt2html)
6278 !! options
6279 parsoid=wt2html
6280 !! wikitext
6281 {|style="color: red;"|}
6282
6283 {|style="color: red;" |}
6284 |foo
6285 |}
6286
6287 {|style="color: red;"|} id="foo"
6288 |foo
6289 |}
6290
6291 {|style="color: red;" |} id="foo"
6292 |foo
6293 |}
6294 !! html/php+tidy
6295 <table style="color: red;">
6296
6297 </table><table style="color: red;">
6298 <tbody><tr>
6299 <td>foo
6300 </td></tr></tbody></table>
6301 <table style="color: red;" id="foo">
6302 <tbody><tr>
6303 <td>foo
6304 </td></tr></tbody></table>
6305 <table style="color: red;" id="foo">
6306 <tbody><tr>
6307 <td>foo
6308 </td></tr></tbody></table>
6309 !! html/parsoid
6310 <table style="color: red;"></table>
6311
6312 <table style="color: red;">
6313 <tbody><tr>
6314 <td>foo</td>
6315 </tr></tbody>
6316 </table>
6317
6318 <table style="color: red;" id="foo">
6319 <tbody><tr>
6320 <td>foo</td>
6321 </tr></tbody>
6322 </table>
6323
6324 <table style="color: red;" id="foo">
6325 <tbody><tr>
6326 <td>foo</td>
6327 </tr></tbody>
6328 </table>
6329
6330 !! end
6331
6332 !! test
6333 A table with no data (take 2)
6334 !! wikitext
6335 {|
6336 |}
6337 !! html/parsoid
6338 <table></table>
6339 !! end
6340
6341 # A table with nothing but a caption is invalid XHTML, we might want to render
6342 # this as <p>caption</p>
6343 # Parsoid team replies: table with only a caption is legal in HTML5
6344 !! test
6345 A table with nothing but a caption
6346 !! wikitext
6347 {|
6348 |+caption
6349 |}
6350 !! html/php
6351 <table>
6352 <caption>caption
6353 </caption><tr><td></td></tr></table>
6354
6355 !! html/parsoid
6356 <table><caption>caption</caption></table>
6357 !! end
6358
6359 !! test
6360 A table with caption with default-spaced attributes and a table row
6361 !! wikitext
6362 {|
6363 |+ style="color: red;" |caption1
6364 |-
6365 |foo
6366 |}
6367 !! html
6368 <table>
6369 <caption style="color: red;">caption1
6370 </caption>
6371 <tr>
6372 <td>foo
6373 </td></tr></table>
6374
6375 !! end
6376
6377 !! test
6378 A table with captions with non-default spaced attributes and a table row
6379 !! wikitext
6380 {|
6381 |+style="color: red;"|caption2
6382 |+ style="color: red;"|caption3
6383 |-
6384 |foo
6385 |}
6386 !! html
6387 <table>
6388 <caption style="color: red;">caption2
6389 </caption>
6390 <caption style="color: red;">caption3
6391 </caption>
6392 <tr>
6393 <td>foo
6394 </td></tr></table>
6395
6396 !! end
6397
6398 !! test
6399 Table td-cell syntax variations
6400 !! wikitext
6401 {|
6402 |foo bar foo|baz
6403 |foo bar foo||baz
6404 |style='color:red;'|baz
6405 |style='color:red;'||baz
6406 |}
6407 !! html
6408 <table>
6409 <tr>
6410 <td>baz
6411 </td>
6412 <td>foo bar foo</td>
6413 <td>baz
6414 </td>
6415 <td style="color:red;">baz
6416 </td>
6417 <td>style='color:red;'</td>
6418 <td>baz
6419 </td></tr></table>
6420
6421 !! end
6422
6423 !! test
6424 Simple table
6425 !! wikitext
6426 {|
6427 |1||2
6428 |-
6429 |3||4
6430 |}
6431 !! html
6432 <table>
6433 <tr>
6434 <td>1</td>
6435 <td>2
6436 </td></tr>
6437 <tr>
6438 <td>3</td>
6439 <td>4
6440 </td></tr></table>
6441
6442 !! end
6443
6444 !! test
6445 Simple table but with multiple dashes for row wikitext
6446 !! wikitext
6447 {|
6448 |foo
6449 |-----
6450 |bar
6451 |}
6452 !! html
6453 <table>
6454 <tr>
6455 <td>foo
6456 </td></tr>
6457 <tr>
6458 <td>bar
6459 </td></tr></table>
6460
6461 !! end
6462
6463 !! test
6464 Multiplication table
6465 !! wikitext
6466 {| border="1" cellpadding="2"
6467 |+Multiplication table
6468 |-
6469 !&times;!!1!!2!!3
6470 |-
6471 !1
6472 |1||2||3
6473 |-
6474 !2
6475 |2||4||6
6476 |-
6477 !3
6478 |3||6||9
6479 |-
6480 !4
6481 |4||8||12
6482 |-
6483 !5
6484 |5||10||15
6485 |}
6486 !! html
6487 <table border="1" cellpadding="2">
6488 <caption>Multiplication table
6489 </caption>
6490 <tr>
6491 <th>&#215;</th>
6492 <th>1</th>
6493 <th>2</th>
6494 <th>3
6495 </th></tr>
6496 <tr>
6497 <th>1
6498 </th>
6499 <td>1</td>
6500 <td>2</td>
6501 <td>3
6502 </td></tr>
6503 <tr>
6504 <th>2
6505 </th>
6506 <td>2</td>
6507 <td>4</td>
6508 <td>6
6509 </td></tr>
6510 <tr>
6511 <th>3
6512 </th>
6513 <td>3</td>
6514 <td>6</td>
6515 <td>9
6516 </td></tr>
6517 <tr>
6518 <th>4
6519 </th>
6520 <td>4</td>
6521 <td>8</td>
6522 <td>12
6523 </td></tr>
6524 <tr>
6525 <th>5
6526 </th>
6527 <td>5</td>
6528 <td>10</td>
6529 <td>15
6530 </td></tr></table>
6531
6532 !! end
6533
6534 !! test
6535 Accept "||" in table headings
6536 !! wikitext
6537 {|
6538 !h1||h2
6539 |}
6540 !! html
6541 <table>
6542 <tr>
6543 <th>h1</th>
6544 <th>h2
6545 </th></tr></table>
6546
6547 !! end
6548
6549 !! test
6550 Accept "!!" in table data
6551 !! wikitext
6552 {|
6553 |Foo!!||
6554 |}
6555 !! html
6556 <table>
6557 <tr>
6558 <td>Foo!!</td>
6559 <td>
6560 </td></tr></table>
6561
6562 !! html/parsoid
6563 <table>
6564 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6565 </tbody></table>
6566 !! end
6567
6568 !! test
6569 Accept "||" in indented table headings
6570 !! wikitext
6571 :{|
6572 !h1||h2
6573 |}
6574 !! html
6575 <dl><dd><table>
6576 <tr>
6577 <th>h1</th>
6578 <th>h2
6579 </th></tr></table></dd></dl>
6580
6581 !! end
6582
6583 !! test
6584 Accept "!!" in templates
6585 !! wikitext
6586 {|
6587 !a {{echo|b!!c}}
6588 |}
6589 !! html/php
6590 <table>
6591 <tr>
6592 <th>a b</th>
6593 <th>c
6594 </th></tr></table>
6595
6596 !! html/parsoid
6597 <table>
6598 <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>
6599 !! end
6600
6601 !! test
6602 Accept "!!" in table headings after newline
6603 !! wikitext
6604 {|
6605 !a
6606 b!!c
6607 |}
6608 !! html/php
6609 <table>
6610 <tr>
6611 <th>a
6612 <p>b!!c
6613 </p>
6614 </th></tr></table>
6615
6616 !! html/parsoid
6617 <table>
6618 <tbody><tr><th>a
6619 <p>b!!c</p></th></tr>
6620 </tbody></table>
6621 !! end
6622
6623 !! test
6624 Accept "!!" in table data of mixed wikitext / html syntax
6625 !! wikitext
6626 {|
6627 !a
6628 <tr><td>b!!c</td></tr>
6629 |}
6630 !! html/php+tidy
6631 <table>
6632 <tbody><tr>
6633 <th>a
6634 </th></tr><tr><td>b!!c</td></tr>
6635 </tbody></table>
6636 !! html/parsoid
6637 <table>
6638 <tbody><tr><th>a</th></tr>
6639 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6640 </tbody></table>
6641 !! end
6642
6643 !! test
6644 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6645 !! wikitext
6646 {|
6647 !|h1
6648 ||a
6649 |}
6650 !! html
6651 <table>
6652 <tr>
6653 <th>h1
6654 </th>
6655 <td>a
6656 </td></tr></table>
6657
6658 !! end
6659
6660 !!test
6661 Accept "| !" at start of line in tables (ignore !-attribute)
6662 !! wikitext
6663 {|
6664 |-
6665 |!style="color:red"|bar
6666 |}
6667 !! html
6668 <table>
6669
6670 <tr>
6671 <td>bar
6672 </td></tr></table>
6673
6674 !!end
6675
6676 !!test
6677 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 +/-
6678 !! wikitext
6679 {|
6680 |-
6681 |style='color:red;'|+1
6682 |style='color:blue;'|-1
6683 |-
6684 |1||2||3
6685 |1||+2||-3
6686 |-
6687 | +1
6688 | -1
6689 |}
6690 !! html
6691 <table>
6692
6693 <tr>
6694 <td style="color:red;">+1
6695 </td>
6696 <td style="color:blue;">-1
6697 </td></tr>
6698 <tr>
6699 <td>1</td>
6700 <td>2</td>
6701 <td>3
6702 </td>
6703 <td>1</td>
6704 <td>+2</td>
6705 <td>-3
6706 </td></tr>
6707 <tr>
6708 <td>+1
6709 </td>
6710 <td>-1
6711 </td></tr></table>
6712
6713 !!end
6714
6715 !! test
6716 Table rowspan
6717 !! wikitext
6718 {| border=1
6719 |Cell 1, row 1
6720 |rowspan=2|Cell 2, row 1 (and 2)
6721 |Cell 3, row 1
6722 |-
6723 |Cell 1, row 2
6724 |Cell 3, row 2
6725 |}
6726 !! html
6727 <table border="1">
6728 <tr>
6729 <td>Cell 1, row 1
6730 </td>
6731 <td rowspan="2">Cell 2, row 1 (and 2)
6732 </td>
6733 <td>Cell 3, row 1
6734 </td></tr>
6735 <tr>
6736 <td>Cell 1, row 2
6737 </td>
6738 <td>Cell 3, row 2
6739 </td></tr></table>
6740
6741 !! end
6742
6743 !! test
6744 Nested table
6745 !! wikitext
6746 {| border=1
6747 | &alpha;
6748 |
6749 {| bgcolor=#ABCDEF border=2
6750 |nested
6751 |-
6752 |table
6753 |}
6754 |the original table again
6755 |}
6756 !! html
6757 <table border="1">
6758 <tr>
6759 <td>&#945;
6760 </td>
6761 <td>
6762 <table bgcolor="#ABCDEF" border="2">
6763 <tr>
6764 <td>nested
6765 </td></tr>
6766 <tr>
6767 <td>table
6768 </td></tr></table>
6769 </td>
6770 <td>the original table again
6771 </td></tr></table>
6772
6773 !! end
6774
6775 !! test
6776 Invalid attributes in table cell (T3830)
6777 !! wikitext
6778 {|
6779 |Cell:|broken
6780 |}
6781 !! html
6782 <table>
6783 <tr>
6784 <td>broken
6785 </td></tr></table>
6786
6787 !! end
6788
6789 !! test
6790 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6791 !! wikitext
6792 {|
6793 |title="foo" |bar
6794 |title="foo<nowiki>|</nowiki>" |bar
6795 |title="foo<nowiki>|</nowiki>" bar
6796 |}
6797 !! html/php
6798 <table>
6799 <tr>
6800 <td title="foo">bar
6801 </td>
6802 <td title="foo&#124;">bar
6803 </td>
6804 <td>title="foo|" bar
6805 </td></tr></table>
6806
6807 !! html/parsoid
6808 <table>
6809 <tbody><tr><td title="foo">bar</td>
6810 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6811 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6812 </tbody></table>
6813 !! end
6814
6815 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6816 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6817 # *2wt modes will fail.
6818 !! test
6819 Table security: embedded pipes
6820 !! options
6821 parsoid=wt2html,html2html
6822 !! wikitext
6823 {|
6824 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6825 !! html/php
6826 <table>
6827 <tr>
6828 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6829 <td>]" onmouseover="alert(document.cookie)"&gt;test
6830 </td>
6831 </tr>
6832 </table>
6833
6834 !! html/parsoid
6835 <table><tbody>
6836 <tr>
6837 <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>
6838 !! end
6839
6840 !! test
6841 Element attributes with double ! should not be broken up by <th>
6842 !! wikitext
6843 {|
6844 !hi <div class="!!">ha</div> ho
6845 |}
6846 !! html/php
6847 <table>
6848 <tr>
6849 <th>hi <div class="!!">ha</div> ho
6850 </th></tr></table>
6851
6852 !! html/parsoid
6853 <table>
6854 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6855 </tbody></table>
6856 !! end
6857
6858 !! test
6859 ! and || in element attributes should not be parsed as <th>/<td>
6860 !! wikitext
6861 {|
6862 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6863 |}
6864 !! html/php
6865 <table>
6866 <tr>
6867 <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6868 </td></tr></table>
6869
6870 !! html/parsoid
6871 <table>
6872 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6873 </tbody></table>
6874 !! end
6875
6876 # FIXME: The output seems broken. Filed as T110268.
6877 !! test
6878 ! and || in td attributes should not be parsed as <th>/<td>
6879 !! options
6880 parsoid=wt2html
6881 !! wikitext
6882 {|
6883 |style="color: red !important;" data-contrived="put this here ||"|foo
6884 |}
6885 !! html/php
6886 <table>
6887 <tr>
6888 <td>style="color: red !important;" data-contrived="put this here</td>
6889 <td>foo
6890 </td></tr></table>
6891
6892 !! html/parsoid
6893 <table>
6894 <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>
6895 </tbody></table>
6896 !! end
6897
6898 !! test
6899 Break on | in element attribute in template
6900 !! options
6901 parsoid=wt2html,html2html
6902 !! wikitext
6903 {{echo|1=<div class="hi|ho">ha</div>}}
6904 !! html/php
6905 <p>ho"&gt;ha&lt;/div&gt;
6906 </p>
6907 !! html/parsoid
6908 <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>
6909 !! end
6910
6911 !! test
6912 Break on | in element attribute name in template
6913 !! wikitext
6914 {{echo|<div cla|ss="hiho">ha</div>}}
6915 !! html/parsoid
6916 <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>
6917 !! end
6918
6919 !! test
6920 Don't break on | in extension attribute in template
6921 !! wikitext
6922 {{echo|<ref name="hi|ho">ha</ref>}}
6923
6924 <references />
6925 !! html/parsoid
6926 <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>
6927
6928 <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>
6929 !! end
6930
6931 ## We don't support roundtripping of these attributes in Parsoid.
6932 ## Selective serialization takes care of preventing dirty diffs.
6933 ## But, on edits, we dirty-diff the invalid attribute text.
6934 !! test
6935 Invalid text in table attributes should be discarded
6936 !! options
6937 parsoid=wt2html
6938 !! wikitext
6939 {| <span>boo</span> style='border:1px solid black'
6940 | <span>boo</span> style='color:blue' |1
6941 |<span>boo</span> style='color:blue'|2
6942 |}
6943 !! html/php
6944 <table style="border:1px solid black">
6945 <tr>
6946 <td style="color:blue">1
6947 </td>
6948 <td style="color:blue">2
6949 </td></tr></table>
6950
6951 !! html/parsoid
6952 <table style="border:1px solid black">
6953 <tr>
6954 <td style="color:blue">1</td>
6955 <td style="color:blue">2</td>
6956 </tr>
6957 </table>
6958 !! end
6959
6960 !! test
6961 Invalid text in table attributes should be preserved by selective serializer
6962 !! options
6963 parsoid={
6964 "modes": ["selser"],
6965 "changes": [
6966 ["td:first-child", "text", "abc"],
6967 ["td + td", "text", "xyz"]
6968 ]
6969 }
6970 !! wikitext
6971 {| <span>boo</span> style='border:1px solid black'
6972 | <span>boo</span> style='color:blue' | 1
6973 |<span>boo</span> style='color:blue'| 2
6974 |}
6975 !! wikitext/edited
6976 {| <span>boo</span> style='border:1px solid black'
6977 | <span>boo</span> style='color:blue' | abc
6978 |<span>boo</span> style='color:blue'| xyz
6979 |}
6980 !! end
6981
6982 !! test
6983 1. Template-generated table cell attributes and cell content
6984 !! wikitext
6985 {|
6986 |{{table_attribs}}
6987 | {{table_attribs}}
6988 || {{table_attribs_5}}
6989 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6990 |align=center {{table_attribs}}
6991 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6992 |}
6993 !! html
6994 <table>
6995 <tr>
6996 <td style="color:red;">Foo
6997 </td>
6998 <td style="color:red;">Foo
6999 </td>
7000 <td>style="color:red;"</td>
7001 <td>Bar
7002 </td>
7003 <td style="color:red;">Foo
7004 </td>
7005 <td align="center" style="color:red;">Foo
7006 </td>
7007 <td align="center" style="color:red;">Foo
7008 </td></tr></table>
7009
7010 !! end
7011
7012 !! test
7013 2. Template-generated table cell attributes and cell content
7014 !! wikitext
7015 {|
7016 |{{table_attribs_2}}
7017 |}
7018 !! html/php
7019 <table>
7020 <tr>
7021 <td style="color:red;">Foo
7022 </td>
7023 <td>Bar</td>
7024 <td>Baz
7025 </td></tr></table>
7026
7027 !! html/parsoid
7028 <table>
7029 <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>
7030 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
7031 </tbody></table>
7032 !! end
7033
7034 !! test
7035 3. Template-generated table cell attributes and cell content
7036 !! wikitext
7037 {|
7038 !align=center {{table_header_cells}}
7039 |-
7040 |align=center {{table_cells}}
7041 |}
7042 !! html/php
7043 <table>
7044 <tr>
7045 <th align="center" style="color:red;">Foo</th>
7046 <th style="color:red;"><i>Bar</i></th>
7047 <th style="color:brown;"><i>Foo</i> and Baz
7048 </th></tr>
7049 <tr>
7050 <td align="center" style="color:red;">Foo</td>
7051 <td style="color:red;"><i>Bar</i></td>
7052 <td style="color:brown;"><i>Foo</i> and Baz
7053 </td></tr></table>
7054
7055 !! html/parsoid
7056 <table>
7057 <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>
7058 <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>
7059 </tbody></table>
7060 !! end
7061
7062 !! test
7063 4. Template-generated table cell attributes and cell content inside a templated table
7064 !! wikitext
7065 {{tbl-start}}
7066 !align=center {{table_header_cells}}
7067 |-
7068 |align=center {{table_cells}}
7069 {{tbl-end}}
7070 !! html/php
7071 <table>
7072 <tr>
7073 <th align="center" style="color:red;">Foo</th>
7074 <th style="color:red;"><i>Bar</i></th>
7075 <th style="color:brown;"><i>Foo</i> and Baz
7076 </th></tr>
7077 <tr>
7078 <td align="center" style="color:red;">Foo</td>
7079 <td style="color:red;"><i>Bar</i></td>
7080 <td style="color:brown;"><i>Foo</i> and Baz
7081 </td></tr></table>
7082
7083 !! html/parsoid
7084 <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}}]}'>
7085 <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>
7086 <tr>
7087 <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>
7088 </tbody></table>
7089 !! end
7090
7091 ## Edge case fix to prevent future regressions
7092 !! test
7093 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
7094 !! wikitext
7095 {|
7096 |{{table_attribs_7}}
7097 |}
7098 <references />
7099 !! html/parsoid
7100 <table>
7101 <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>
7102 </tbody></table>
7103 <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>
7104 !! end
7105
7106 !! test
7107 Table with row followed by newlines and table heading
7108 !! options
7109 parsoid=wt2html,html2html
7110 !! wikitext
7111 {|
7112 |-
7113
7114 !foo
7115 |}
7116 !! html/*
7117 <table>
7118
7119
7120 <tr>
7121 <th>foo
7122 </th></tr></table>
7123
7124 !! end
7125
7126 !! test
7127 Table with empty line following the start tag
7128 !! options
7129 parsoid=wt2html,html2html
7130 !! wikitext
7131 {|
7132
7133 |-
7134 |foo
7135 |}
7136 !! html/*
7137 <table>
7138
7139
7140 <tr>
7141 <td>foo
7142 </td></tr></table>
7143
7144 !! end
7145
7146 !! test
7147 Table attributes with empty value
7148 !! options
7149 parsoid=wt2html,html2html
7150 !! wikitext
7151 {|
7152 | style=|hello
7153 |}
7154 !! html/php
7155 <table>
7156 <tr>
7157 <td style="">hello
7158 </td></tr></table>
7159
7160 !! html/parsoid
7161 <table>
7162 <tbody><tr><td style="">hello</td></tr>
7163 </tbody></table>
7164 !! end
7165
7166 !! test
7167 Wikitext table with a lot of comments
7168 !! wikitext
7169 {|
7170 <!-- c0 -->
7171 |foo
7172 <!-- c1 -->
7173 |-<!-- c2 -->
7174 <!-- c3 -->
7175 |<!-- c4 -->
7176 <!-- c5 -->
7177 |}
7178 !! html
7179 <table>
7180 <tr>
7181 <td>foo
7182 </td></tr>
7183 <tr>
7184 <td>
7185 </td></tr></table>
7186
7187 !! end
7188
7189 !! test
7190 Wikitext table comments represented in parsoid dom
7191 !! wikitext
7192 {|<!--c1--><!--c2-->
7193 |-<!--c3-->
7194 |x
7195 |}
7196 !! html/php+tidy
7197 <table>
7198
7199 <tbody><tr>
7200 <td>x
7201 </td></tr></tbody></table>
7202 !! html/parsoid
7203 <table><!--c1--><!--c2-->
7204 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
7205 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
7206 </tbody></table>
7207 !! end
7208
7209 !! test
7210 Wikitext table with double-line table cell
7211 !! wikitext
7212 {|
7213 |a
7214 b
7215 |}
7216 !! html
7217 <table>
7218 <tr>
7219 <td>a
7220 <p>b
7221 </p>
7222 </td></tr></table>
7223
7224 !! end
7225
7226 !! test
7227 Table cell with a single comment
7228 !! wikitext
7229 {|
7230 |<!-- c1 -->
7231 |a
7232 |}
7233 !! html
7234 <table>
7235 <tr>
7236 <td>
7237 </td>
7238 <td>a
7239 </td></tr></table>
7240
7241 !! end
7242
7243 !! test
7244 Table-cell after a comment-only-empty-line
7245 !! wikitext
7246 {|
7247 |a
7248 <!--c1-->
7249 <!--c2-->|b
7250 |}
7251 !! html
7252 <table>
7253 <tr>
7254 <td>a
7255 </td>
7256 <td>b
7257 </td></tr></table>
7258
7259 !! html/parsoid
7260 <table>
7261 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7262 <!--c1-->
7263 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
7264 </tbody></table>
7265
7266 !! end
7267
7268 !! test
7269 Build table with {{!}}
7270 !! wikitext
7271 {{{!}} class="wikitable"
7272 !header
7273 !second header
7274 {{!}}- style="color:red;"
7275 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
7276 {{!}}}
7277 !! html
7278 <table class="wikitable">
7279 <tr>
7280 <th>header
7281 </th>
7282 <th>second header
7283 </th></tr>
7284 <tr style="color:red;">
7285 <td>data</td>
7286 <td style="color:red;">second data
7287 </td></tr></table>
7288
7289 !! end
7290
7291 !! test
7292 Build table with pipe as data
7293 !! wikitext
7294 {| class="wikitable"
7295 !header
7296 !second header
7297 |- style="color:red;"
7298 |data|| style="color:red;" |second data
7299 |-
7300 | style="color:red;" |data with | || style="color:red;" | second data with |
7301 |-
7302 ||data with | |||second data with |
7303 |}
7304 !! html
7305 <table class="wikitable">
7306 <tr>
7307 <th>header
7308 </th>
7309 <th>second header
7310 </th></tr>
7311 <tr style="color:red;">
7312 <td>data</td>
7313 <td style="color:red;">second data
7314 </td></tr>
7315 <tr>
7316 <td style="color:red;">data with |</td>
7317 <td style="color:red;">second data with |
7318 </td></tr>
7319 <tr>
7320 <td>data with |</td>
7321 <td>second data with |
7322 </td></tr></table>
7323
7324 !! end
7325
7326 !! test
7327 Build table with wikilink
7328 !! wikitext
7329 {| class="wikitable"
7330 !header||second header
7331 |- style="color:red;"
7332 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
7333 |-
7334 |data||second data [[Main Page|link|text with pipe]]
7335 |}
7336 !! html
7337 <table class="wikitable">
7338 <tr>
7339 <th>header</th>
7340 <th>second header
7341 </th></tr>
7342 <tr style="color:red;">
7343 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
7344 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7345 </td></tr>
7346 <tr>
7347 <td>data</td>
7348 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7349 </td></tr></table>
7350
7351 !! end
7352
7353 # The expected HTML structure in this test is debatable. The PHP parser does
7354 # not parse this kind of table at all. The main focus for Parsoid is on
7355 # round-tripping, so this output is ok for now. TODO: revisit!
7356 !! test
7357 Wikitext table with html-syntax row
7358 !! wikitext
7359 {|
7360 |-
7361 <td>foo</td>
7362 |}
7363 !! html/parsoid
7364 <table>
7365 <tbody>
7366 <tr>
7367 <td>foo</td></tr></tbody></table>
7368 !! end
7369
7370 ## Remex doesn't account for fostered content.
7371 !! test
7372 Fostered content in tables: Plain text
7373 !! options
7374 parsoid=wt2html
7375 !! wikitext
7376 {|
7377 |-
7378 a
7379 |}
7380 !! html/php
7381 <table>
7382
7383 a
7384 </table>
7385
7386 !! html/php+tidy
7387
7388
7389 a
7390 <table></table>
7391 !! html/parsoid
7392 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
7393 a</p>
7394 <table>
7395 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr></tbody></table>
7396 !! end
7397
7398 !! test
7399 Fostered content in tables: Lists
7400 !! options
7401 parsoid=wt2html,html2html
7402 !! wikitext
7403 {|
7404 |-
7405 *a
7406 |}
7407 !! html/php
7408 <table>
7409
7410 <ul><li>a</li></ul>
7411 </table>
7412
7413 !! html/php+tidy
7414 <ul><li>a</li></ul><table>
7415
7416
7417 </table>
7418 !! html/parsoid
7419 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7420 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7421
7422 </tr></tbody></table>
7423 !! end
7424
7425 !! test
7426 Template generated table cell with attributes
7427 !! wikitext
7428 {|
7429 |-
7430 {{table_attribs_4}} ||a||b
7431 |}
7432 !! html/php+tidy
7433 <table>
7434
7435 <tbody><tr>
7436 <td style="background-color:#DC241f;" width="10px"></td>
7437 <td>a</td>
7438 <td>b
7439 </td></tr></tbody></table>
7440 !! html/parsoid
7441 <table>
7442 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7443 <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>
7444 !! end
7445
7446 !! test
7447 Parsoid: Round-trip tables directly followed by content (T53219)
7448 !! options
7449 parsoid=wt2html,wt2wt
7450 !! wikitext
7451 {|
7452 |foo
7453 |} bar
7454
7455 {|
7456 |baz
7457 |}<b>quux</b>
7458 !! html+tidy
7459 <table>
7460 <tbody><tr>
7461 <td>foo
7462 </td></tr></tbody></table><p> bar
7463 </p><table>
7464 <tbody><tr>
7465 <td>baz
7466 </td></tr></tbody></table><p><b>quux</b>
7467 </p>
7468 !! end
7469
7470 !! test
7471 Parsoid: Default to a newline after tables in new content (T53219)
7472 !! options
7473 parsoid=html2wt
7474 !! html/parsoid
7475 <table><tbody>
7476 <tr><td>foo</td></tr></tbody></table> bar
7477 <table><tbody>
7478 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7479 !! wikitext
7480 {|
7481 |foo
7482 |}
7483 <nowiki> </nowiki>bar
7484 {|
7485 |baz
7486 |}
7487 '''quux'''
7488 !! end
7489
7490 !! test
7491 Parsoid: Row-syntax table headings followed by comment & table cells
7492 !! options
7493 parsoid=wt2html,wt2wt
7494 !! wikitext
7495 {|
7496 !foo||bar
7497 <!-- foo --> ||baz||quux
7498 |}
7499 !! html/php
7500 <table>
7501 <tr>
7502 <th>foo</th>
7503 <th>bar
7504 </th>
7505 <td>baz</td>
7506 <td>quux
7507 </td></tr></table>
7508
7509 !! html/parsoid
7510 <table>
7511 <tbody><tr><th>foo</th><th>bar
7512 <!-- foo --></th><td> baz </td><td>quux</td></tr>
7513 </tbody></table>
7514 !! end
7515
7516 !!test
7517 Parsoid: Recover better from broken table attributes
7518 !!options
7519 parsoid=wt2html
7520 !!wikitext
7521 {| class="foo
7522 | class="bar" |
7523 foo
7524 |}
7525 !!html/php+tidy
7526 <table class="foo">
7527 <tbody><tr>
7528 <td class="bar">
7529 <p>foo
7530 </p>
7531 </td></tr></tbody></table>
7532 !!html/parsoid
7533 <table class="foo">
7534 <tr>
7535 <td class="bar">
7536 <p>foo</p></td></tr>
7537 </tbody></table>
7538 !!end
7539
7540 # Note: PHP parser omits empty rows
7541 !! test
7542 Tables: Digest broken attributes on table and tr tag
7543 !! options
7544 parsoid=wt2html
7545 !! wikitext
7546 {| || |} ++
7547 |- || || ++ --
7548 |- > [
7549 |}
7550 !! html/php+tidy
7551 <table>
7552
7553
7554 </table>
7555 !! html/parsoid
7556 <table>
7557 <tbody>
7558 <tr class='mw-empty-elt'></tr>
7559 <tr class='mw-empty-elt'></tr>
7560 </tbody></table>
7561 !! end
7562
7563 !! test
7564 Table with missing opening <tr> tag
7565 !! options
7566 parsoid=wt2html,wt2wt
7567 !! wikitext
7568 <table>
7569 <td>foo</td>
7570 </tr>
7571 </table>
7572 !! html+tidy
7573 <table>
7574 <tbody><tr><td>foo</td>
7575 </tr>
7576 </tbody></table>
7577 !! end
7578
7579 # T137406: Whitespace in the HTML
7580 !! test
7581 1. Generate correct wikitext for tables with thead/tbody/tfoot
7582 !! options
7583 parsoid=html2wt
7584 !! html/parsoid
7585 <table>
7586 <caption>Test</caption>
7587 <thead>
7588 <tr>
7589 <th>Month</th>
7590 <th>Savings</th>
7591 </tr>
7592 </thead>
7593 <tbody>
7594 <tr>
7595 <td>January</td>
7596 <td>$100</td>
7597 </tr>
7598 <tr>
7599 <td>February</td>
7600 <td>$80</td>
7601 </tr>
7602 </tbody>
7603 <tfoot>
7604 <tr>
7605 <td>Sum</td>
7606 <td>$180</td>
7607 </tr>
7608 </tfoot>
7609 </table>
7610 !! wikitext
7611 {|
7612 |+Test
7613 !Month
7614 !Savings
7615 |-
7616 |January
7617 |$100
7618 |-
7619 |February
7620 |$80
7621 |-
7622 |Sum
7623 |$180
7624 |}
7625 !! html/php+tidy
7626 <table>
7627 <caption>Test
7628 </caption>
7629 <tbody><tr>
7630 <th>Month
7631 </th>
7632 <th>Savings
7633 </th></tr>
7634 <tr>
7635 <td>January
7636 </td>
7637 <td>$100
7638 </td></tr>
7639 <tr>
7640 <td>February
7641 </td>
7642 <td>$80
7643 </td></tr>
7644 <tr>
7645 <td>Sum
7646 </td>
7647 <td>$180
7648 </td></tr></tbody></table>
7649 !! end
7650
7651 # T137406: No whitespace in the HTML
7652 !! test
7653 2. Generate correct wikitext for tables with thead/tbody/tfoot
7654 !! options
7655 parsoid=html2wt
7656 !! html/parsoid
7657 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7658 !! wikitext
7659 {|
7660 !heading
7661 |-
7662 |foo
7663 |}
7664 !! end
7665
7666 !! test
7667 Wikitext tables can be nested inside HTML tables
7668 !! options
7669 parsoid=html2wt
7670 !! html/parsoid
7671 <table data-parsoid='{"stx":"html"}'>
7672 <tr><td>
7673 <table>
7674 <tr><td>foo</td></tr>
7675 </table>
7676 </td></tr>
7677 </table>
7678 !! wikitext
7679 <table>
7680 <tr><td>
7681 {|
7682 |foo
7683 |}
7684 </td></tr>
7685 </table>
7686 !! html/php+tidy
7687 <table>
7688 <tbody><tr><td>
7689 <table>
7690 <tbody><tr>
7691 <td>foo
7692 </td></tr></tbody></table>
7693 </td></tr>
7694 </tbody></table>
7695 !! end
7696
7697 ###
7698 ### Internal links
7699 ###
7700 !! test
7701 Plain link, capitalized
7702 !! wikitext
7703 [[Main Page]]
7704 !! html
7705 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7706 </p>
7707 !! end
7708
7709 !! test
7710 Plain link, uncapitalized
7711 !! wikitext
7712 [[main Page]]
7713 !! html
7714 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7715 </p>
7716 !! end
7717
7718 !! test
7719 Piped link
7720 !! wikitext
7721 [[Main Page|The Main Page]]
7722 !! html
7723 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7724 </p>
7725 !! end
7726
7727 !! test
7728 Piped link with comment in link text
7729 !! wikitext
7730 [[Main Page|The Main<!--front--> Page]]
7731 !! html
7732 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7733 </p>
7734 !! end
7735
7736 !! test
7737 Piped link with multiple pipe characters in link text
7738 !! wikitext
7739 [[Main Page||The|Main|Page|]]
7740 !! html/php
7741 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7742 </p>
7743 !! html/parsoid
7744 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7745 !! end
7746
7747 !! test
7748 Piped link with no link text
7749 !! wikitext
7750 [[Thomas Bek (bishop of St David's)|]]
7751 !! html/php
7752 <p>[[Thomas Bek (bishop of St David's)|]]
7753 </p>
7754 !! html/parsoid
7755 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7756 !! end
7757
7758 !! test
7759 Piped link with empty link text
7760 !! wikitext
7761 [[Main Page|<nowiki/>]] - empty nowiki
7762 [[Main Page| ]] - empty space
7763 [[Main Page|&nbsp;]] - empty non breaking space
7764 !! html/php
7765 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7766 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7767 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7768 </p>
7769 !! html/parsoid
7770 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7771 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7772 <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>
7773 !! end
7774
7775 !! test
7776 Broken link
7777 !! wikitext
7778 [[Zigzagzogzagzig]]
7779 !! html
7780 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7781 </p>
7782 !! end
7783
7784 !! test
7785 Broken link with fragment
7786 !! wikitext
7787 [[Zigzagzogzagzig#zug]]
7788 !! html
7789 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7790 </p>
7791 !! end
7792
7793 !! test
7794 Special page link with fragment
7795 !! wikitext
7796 [[Special:Version#anchor]]
7797 !! html
7798 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7799 </p>
7800 !! end
7801
7802 !! test
7803 Nonexistent special page link with fragment
7804 !! wikitext
7805 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7806 !! html
7807 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7808 </p>
7809 !! end
7810
7811 !! test
7812 Link with prefix
7813 !! wikitext
7814 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7815 !! html
7816 <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>
7817 </p>
7818 !! end
7819
7820 !! test
7821 Link with suffix
7822 !! wikitext
7823 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7824 !! html
7825 <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>!!!
7826 </p>
7827 !! end
7828
7829 !! article
7830 prefixed article
7831 !! text
7832 Some text
7833 !! endarticle
7834
7835 !! test
7836 T45661: Piped links with identical prefixes
7837 !! wikitext
7838 [[prefixed article|prefixed articles with spaces]]
7839
7840 [[prefixed article|prefixed articlesaoeu]]
7841
7842 [[Main Page|Main Page test]]
7843 !! html
7844 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7845 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7846 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7847 </p>
7848 !! end
7849
7850
7851 !! test
7852 Link with HTML entity in suffix / tail
7853 !! wikitext
7854 [[Main Page]]&quot;, [[Main Page]]&#97;
7855 !! html/php
7856 <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;
7857 </p>
7858 !! html/parsoid
7859 <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>
7860 !! end
7861
7862 !! test
7863 Link with 3 brackets
7864 !! wikitext
7865 [[[Main Page]]]
7866 Foo [[[Main Page]]]
7867 !! html
7868 <p>[[[Main Page]]]
7869 Foo [[[Main Page]]]
7870 </p>
7871 !! end
7872
7873 !! test
7874 Link with 4 brackets
7875 !! wikitext
7876 [[[[Main Page]]]]
7877 !! html
7878 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7879 </p>
7880 !! end
7881
7882 !! test
7883 Piped link with 3 brackets
7884 !! wikitext
7885 [[[main page|the main page]]]
7886 !! html
7887 <p>[[[main page|the main page]]]
7888 </p>
7889 !! end
7890
7891 !! test
7892 Piped link with extlink-like text
7893 !! wikitext
7894 [[Main Page|[bar]]]
7895 [[Main Page|This is a [bar]]]
7896 [[Main Page|[bar]]
7897 !! html/php
7898 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7899 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7900 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7901 </p>
7902 !! html/parsoid
7903 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7904 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7905 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7906 !! end
7907
7908 !! test
7909 Link with multiple pipes
7910 !! wikitext
7911 [[Main Page|The|Main|Page]]
7912 !! html
7913 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7914 </p>
7915 !! end
7916
7917 !! test
7918 Anchor containing a #. (T65430)
7919 !! config
7920 wgFragmentMode=[ 'html5', 'legacy' ]
7921 !! wikitext
7922 [[Main Page#And#Link]]
7923 !! html/php
7924 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7925 </p>
7926 !! html/parsoid
7927 <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>
7928 !! end
7929
7930 !! test
7931 Link to namespaces
7932 !! wikitext
7933 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7934 !! html
7935 <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>
7936 </p>
7937 !! end
7938
7939 !! test
7940 Link with space in namespace
7941 !! wikitext
7942 [[User talk:Foo bar]]
7943 !! html
7944 <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>
7945 </p>
7946 !! end
7947
7948 !! article
7949 MemoryAlpha:AlphaTest
7950 !! text
7951 This is an article in the MemoryAlpha namespace
7952 (which shadows the memoryalpha interwiki link).
7953 !! endarticle
7954
7955 !! test
7956 Namespace takes precedence over interwiki link (T53680)
7957 !! wikitext
7958 [[MemoryAlpha:AlphaTest]]
7959 !! html
7960 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7961 </p>
7962 !! end
7963
7964 # The previous test doesn't work correctly in html2*, due to not recognizing the
7965 # link as an internal one. This one checks for the correct behavior.
7966 !! test
7967 Link to namespace preferred over interwiki with correct rel attribute
7968 !! options
7969 parsoid=html2wt,html2html
7970 !! html/parsoid
7971 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7972 !! wikitext
7973 [[MemoryAlpha:AlphaTest]]
7974 !! end
7975
7976 !! test
7977 Piped link to namespace
7978 !! wikitext
7979 [[Meta:Disclaimers|The disclaimers]]
7980 !! html
7981 <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>
7982 </p>
7983 !! end
7984
7985 !! test
7986 Link containing }
7987 !! wikitext
7988 [[Usually caused by a typo (oops}]]
7989 !! html
7990 <p>[[Usually caused by a typo (oops}]]
7991 </p>
7992 !! end
7993
7994 !! article
7995 7% Solution
7996 !! text
7997 Just a test of an article title containing a percent.
7998 !! endarticle
7999
8000 !! test
8001 Link containing % (not as a hex sequence)
8002 !! wikitext
8003 [[7% Solution]]
8004 [[7% Solution|7%25 Solution]]
8005 !! html/php
8006 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
8007 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
8008 </p>
8009 !! html/parsoid
8010 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
8011 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
8012 !! end
8013
8014 # note that the parsoid HTML is identical to the previous test output,
8015 # so the previous test ensures that the html2wt mode will generate the
8016 # "not as a hex sequence" wikitext.
8017 !! test
8018 Link containing % as a single hex sequence interpreted to char
8019 !! options
8020 parsoid=wt2wt,wt2html,html2html
8021 !! wikitext
8022 [[7%25 Solution]]
8023 [[7%25 Solution|7%25 Solution]]
8024 !! html/php
8025 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
8026 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
8027 </p>
8028 !! html/parsoid
8029 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
8030 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
8031 !!end
8032
8033 !! test
8034 Link containing % as a double hex sequence interpreted to hex sequence
8035 !! wikitext
8036 [[7%2525 Solution]]
8037 !! html
8038 <p>[[7%2525 Solution]]
8039 </p>
8040 !!end
8041
8042 ## Example for such a section: == < ==
8043 !! test
8044 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
8045 !! config
8046 wgFragmentMode=[ 'html5', 'legacy' ]
8047 !! wikitext
8048 [[%23%3c]][[%23%3e]]
8049 !! html/php
8050 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
8051 </p>
8052 !! html/parsoid
8053 <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>
8054 !! end
8055
8056 ## Example for such a section: == < ==
8057 !! test
8058 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
8059 !! config
8060 wgFragmentMode=[ 'legacy' ]
8061 !! wikitext
8062 [[%23%3c]][[%23%3e]]
8063 !! html/php
8064 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
8065 </p>
8066 !! end
8067
8068 !! test
8069 Link containing "<#" and ">#" as a hex sequences
8070 !! wikitext
8071 [[%3c%23]][[%3e%23]]
8072 !! html
8073 <p>[[%3c%23]][[%3e%23]]
8074 </p>
8075 !! end
8076
8077 !! test
8078 Link containing an equals sign
8079 !! wikitext
8080 [[Special:BookSources/isbn=4-00-026157-6]]
8081 !! html/php
8082 <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>
8083 </p>
8084 !! html/parsoid
8085 <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>
8086 !! end
8087
8088 !! article
8089 Foo & bar
8090 !! text
8091 Just a test of an article title containing an ampersand
8092 !! endarticle
8093
8094 !! test
8095 Link containing an ampersand
8096 !! wikitext
8097 [[Foo & bar]]
8098
8099 [[Foo &amp; bar]]
8100
8101 [[Foo &amp;amp; bar]]
8102 !! html/php+tidy
8103 <p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar">Foo &amp; bar</a>
8104 </p><p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar">Foo &amp; bar</a>
8105 </p><p>[[Foo &amp;amp; bar]]
8106 </p>
8107 !! html/parsoid
8108 <p><a rel="mw:WikiLink" href="./Foo_&amp;_bar" title="Foo &amp; bar">Foo &amp; bar</a></p>
8109 <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>
8110 <p>[[Foo <span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>amp; bar]]</p>
8111 !! end
8112
8113 !! article
8114 Foo~bar
8115 !! text
8116 Just a test of an article title containing a tilde.
8117 !! endarticle
8118
8119 # note that links containing signatures, like [[Foo~~~~]], are
8120 # massaged by the pre-save transform (PST) and so the tildes are never
8121 # seen by the parser.
8122 !! test
8123 Link containing a tilde
8124 !! wikitext
8125 [[Foo~bar]]
8126 !! html/php
8127 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
8128 </p>
8129 !! html/parsoid
8130 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
8131 !! end
8132
8133 !! test
8134 Link containing double-single-quotes '' (T6598)
8135 !! wikitext
8136 [[Lista d''e paise d''o munno]]
8137 !! html/php
8138 <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>
8139 </p>
8140 !! html/parsoid
8141 <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>
8142 !! end
8143
8144 !! test
8145 Link containing double quotes and spaces
8146 !! wikitext
8147 [[Cool "Gator"]]
8148 !! html/php
8149 <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>
8150 </p>
8151 !! html/parsoid
8152 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
8153 !! end
8154
8155 !! test
8156 File containing double quotes and spaces
8157 !! wikitext
8158 [[File:Cool "Gator".png]]
8159 !! html/parsoid
8160 <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>
8161 !! end
8162
8163 !! test
8164 Redirect containing double quotes and spaces
8165 !! wikitext
8166 #REDIRECT [[Cool "Gator"]]
8167 !! html/parsoid
8168 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
8169 !! end
8170
8171 !! test
8172 Link containing double-single-quotes '' in text (T6598 sanity check)
8173 !! wikitext
8174 Some [[Link|pretty ''italics'' and stuff]]!
8175 !! html/php
8176 <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>!
8177 </p>
8178 !! html/parsoid
8179 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8180 !! end
8181
8182 !! test
8183 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8184 !! wikitext
8185 ''Some [[Link|pretty ''italics'' and stuff]]!''
8186 !! html
8187 <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>
8188 </p>
8189 !! end
8190
8191 !! test
8192 Link with double quotes in title part (literal) and alternate part (interpreted)
8193 !! wikitext
8194 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8195
8196 [[''Pentecoste'']]
8197
8198 [[''Pentecoste''|Pentecoste]]
8199
8200 [[''Pentecoste''|''Pentecoste'']]
8201 !! html/php
8202 <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>
8203 </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>
8204 </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>
8205 </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>
8206 </p>
8207 !! html/parsoid
8208 <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>
8209 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8210 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8211 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8212 !! end
8213
8214 !! test
8215 Broken image links with HTML captions (T41700)
8216 !! wikitext
8217 [[File:Nonexistent|<script></script>]]
8218 [[File:Nonexistent|100x100px|<script></script>]]
8219 [[File:Nonexistent|&lt;]]
8220 [[File:Nonexistent|a<i>b</i>c]]
8221 !! html/php
8222 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8223 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8224 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8225 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8226 </p>
8227 !! html/parsoid
8228 <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>
8229 <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>
8230 <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>
8231 <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>
8232 !! end
8233
8234 !! test
8235 Plain link to URL
8236 !! wikitext
8237 [[http://www.example.com]]
8238 !! html/php
8239 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8240 </p>
8241 !! html/parsoid
8242 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
8243 !! end
8244
8245 !! test
8246 Plain link to URL with link text
8247 !! wikitext
8248 [[http://www.example.com Link text]]
8249 !! html
8250 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8251 </p>
8252 !! end
8253
8254 !! test
8255 Plain link to protocol-relative URL
8256 !! wikitext
8257 [[//www.example.com]]
8258 !! html/php
8259 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8260 </p>
8261 !! html/parsoid
8262 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8263 !! end
8264
8265 !! test
8266 Plain link to protocol-relative URL with link text
8267 !! wikitext
8268 [[//www.example.com Link text]]
8269 !! html
8270 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8271 </p>
8272 !! end
8273
8274 !! test
8275 Plain link to page with question mark in title
8276 !! wikitext
8277 [[A?b]]
8278
8279 [[A?b|Baz]]
8280 !! html
8281 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8282 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8283 </p>
8284 !! end
8285
8286 # I'm fairly sure the expected result here is wrong.
8287 # We want these to be URL links, not pseudo-pages with URLs for titles....
8288 # However the current output is also pretty screwy.
8289 #
8290 # ----
8291 # I'm changing it to match the current output--it arguably makes more
8292 # sense in the light of the test above. Old expected result was:
8293 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8294 #</p>
8295 # But I think this test is bordering on "garbage in, garbage out" anyway.
8296 # -- wtm
8297 !! test
8298 Piped link to URL
8299 !! wikitext
8300 Piped link to URL: [[http://www.example.com|an example URL]]
8301 !! html/php
8302 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8303 </p>
8304 !! html/parsoid
8305 <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>
8306 !! end
8307
8308 !! test
8309 Plain link in template argument
8310 !! options
8311 parsoid=wt2html
8312 !! wikitext
8313 {{echo|[http://www.example.com |123]}}
8314
8315 {{echo|[[http://www.example.com |123]]}}
8316
8317 {{echo|[[http://www.example.com |123]}}
8318
8319 {{echo|[http://www.example.com |123]]}}
8320 !! html/php
8321 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8322 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8323 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8324 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8325 </p>
8326 !! html/parsoid
8327 <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>
8328
8329 <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>
8330
8331 <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>
8332
8333 <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>
8334 !! end
8335
8336 !! test
8337 T2002: [[page|http://url/]] should link to page, not http://url/
8338 !! wikitext
8339 [[Main Page|http://url/]]
8340 !! html/php
8341 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8342 </p>
8343 !! html/parsoid
8344 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8345 !! end
8346
8347 # Parsoid does not mark self-links, by design.
8348 !! test
8349 T2337: Escaped self-links should be bold
8350 !! options
8351 title=[[Bug462]]
8352 !! wikitext
8353 [[Bu&#103;462]] [[Bug462]]
8354 !! html/php+tidy
8355 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8356 </p>
8357 !! html/parsoid
8358 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8359 !! end
8360
8361 !! test
8362 Self-link to section should not be bold
8363 !! options
8364 title=[[Main Page]]
8365 !! wikitext
8366 [[Main Page#section]]
8367 !! html
8368 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8369 </p>
8370 !! end
8371
8372 !! article
8373 00
8374 !! text
8375 This is 00.
8376 !! endarticle
8377
8378 !!test
8379 Self-link to numeric title
8380 !!options
8381 title=[[0]]
8382 !! wikitext
8383 [[0]]
8384 !! html
8385 <p><a class="mw-selflink selflink">0</a>
8386 </p>
8387 !!end
8388
8389 !!test
8390 Link to numeric-equivalent title
8391 !!options
8392 title=[[0]]
8393 !! wikitext
8394 [[00]]
8395 !! html
8396 <p><a href="/wiki/00" title="00">00</a>
8397 </p>
8398 !!end
8399
8400 !! test
8401 <nowiki> inside a link
8402 !! wikitext
8403 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8404 !! html
8405 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8406 </p>
8407 !! end
8408
8409 !! test
8410 Non-breaking spaces in title
8411 !! wikitext
8412 [[&nbsp; Main &nbsp; Page &nbsp;]]
8413 !! html
8414 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8415 </p>
8416 !!end
8417
8418 # Add new article for the test below so that it doesn't red-link
8419 !! article
8420 Foo bar baz
8421 !! text
8422 boo
8423 !! endarticle
8424
8425 !! test
8426 Multiple spaces in titles should normalize to a single underscore
8427 !! options
8428 parsoid=wt2html,wt2wt
8429 !! wikitext
8430 [[Foo bar baz|x]]
8431 [[Foo bar baz|x]]
8432 [[Foo bar baz|x]]
8433 !! html/php
8434 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8435 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8436 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8437 </p>
8438 !! html/parsoid
8439 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8440 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8441 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8442 </p>
8443 !! end
8444
8445 !! test
8446 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8447 !! options
8448 language=ca
8449 !! wikitext
8450 '''[[Main Page]]'''
8451 !! html
8452 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8453 </p>
8454 !! end
8455
8456 !! test
8457 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8458 !! options
8459 language=ca
8460 !! wikitext
8461 ''[[Main Page]]''
8462 !! html
8463 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8464 </p>
8465 !! end
8466
8467 !! test
8468 Internal link with en linktrail: no apostrophes (T29473)
8469 !! options
8470 language=en
8471 !! wikitext
8472 [[Something]]'nice
8473 !! html
8474 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8475 </p>
8476 !! end
8477
8478 !! test
8479 Internal link with ca linktrail with apostrophes (T29473)
8480 !! options
8481 language=ca
8482 !! wikitext
8483 [[Something]]'nice
8484 !! html
8485 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8486 </p>
8487 !! end
8488
8489 !! test
8490 Internal link with kaa linktrail with apostrophes (T29473)
8491 !! options
8492 language=kaa
8493 !! wikitext
8494 [[Something]]'nice
8495 !! html
8496 <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>
8497 </p>
8498 !! end
8499
8500 !! test
8501 Link with multiple ":" in a subpage-supporting namespace (T65636)
8502 !! wikitext
8503 [[User:Foo/Test/63636:Bar|Test]]
8504 !! html/php
8505 <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>
8506 </p>
8507 !! html/parsoid
8508 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8509 !! end
8510
8511 ## Mainly a sanity check for Parsoid
8512 !! test
8513 Handle title parsing for subpages
8514 !! options
8515 title=[[/123123]]
8516 subpage
8517 !! wikitext
8518 123
8519 !! html/php
8520 <p>123
8521 </p>
8522 !! html/parsoid
8523 <p>123</p>
8524 !! end
8525
8526 !! article
8527 User:Test/123
8528 !! text
8529 test 123
8530 !! endarticle
8531
8532 !! test
8533 Link to a subpage from a namespace other than main
8534 !! options
8535 title=[[User:Test]]
8536 subpage
8537 !! wikitext
8538 [[/123]]
8539 !! html/php
8540 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8541 </p>
8542 !! html/parsoid
8543 <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>
8544 !! end
8545
8546 !! test
8547 Ensure that transclusion titles are not url-decoded
8548 !! options
8549 subpage title=[[Test]]
8550 parsoid=wt2html
8551 !! wikitext
8552 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8553 !! html/php
8554 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8555 </p>
8556 !! html/parsoid
8557 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8558 !! end
8559
8560 !! test
8561 Purely hash wikilink
8562 !! options
8563 title=[[User:Test/123]]
8564 subpage
8565 !! wikitext
8566 [[#a|b]]
8567 !! html/php
8568 <p><a href="#a">b</a>
8569 </p>
8570 !! html/parsoid
8571 <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>
8572 !! end
8573
8574 !! test
8575 Serialization of purely hash wikilink
8576 !! options
8577 title=[[User:Test/123]]
8578 subpage
8579 parsoid=html2wt
8580 !! html/parsoid
8581 <p><a href="#a">[[</a></p>
8582 !! wikitext
8583 [[#a|<nowiki>[[</nowiki>]]
8584 !! html/php
8585 <p><a href="#a">[[</a>
8586 </p>
8587 !! end
8588
8589 !! test
8590 1. Interaction of linktrail and template encapsulation
8591 !! wikitext
8592 {{echo|[[Foo]]}}l
8593 !! html/php+tidy
8594 <p><a href="/wiki/Foo" title="Foo">Fool</a>
8595 </p>
8596 !! html/parsoid
8597 <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>
8598 !! end
8599
8600 !! test
8601 2. Interaction of linktrail and template encapsulation
8602 !! wikitext
8603 {{echo|Some [[Fool]]}}s
8604 !! html/php+tidy
8605 <p>Some <a href="/index.php?title=Fool&amp;action=edit&amp;redlink=1" class="new" title="Fool (page does not exist)">Fools</a>
8606 </p>
8607 !! html/parsoid
8608 <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>
8609 !! end
8610
8611 !! test
8612 3. Interaction of linktrail and template encapsulation
8613 !! wikitext
8614 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8615 !! html/php+tidy
8616 <p>Some <a href="/index.php?title=Fool&amp;action=edit&amp;redlink=1" class="new" title="Fool (page does not exist)">Fools</a> are <b>bold and foolish</b>
8617 </p>
8618 !! html/parsoid
8619 <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>
8620 !! end
8621
8622 !! article
8623 Söfnuður
8624 !! text
8625 Test.
8626 !! endarticle
8627
8628 !! test
8629 Internal link with is link prefix
8630 !! options
8631 language=is
8632 !! wikitext
8633 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8634 !! html
8635 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8636 </p>
8637 !! end
8638
8639 !! article
8640 Mótmælendatrú
8641 !! text
8642 Test.
8643 !! endarticle
8644
8645 !! test
8646 Internal link with is link trail and link prefix
8647 !! options
8648 language=is
8649 !! wikitext
8650 [[mótmælendatrú|xxx]]ar
8651 [[mótmælendatrú]]ar
8652 mótmælenda[[söfnuður]]
8653 mótmælenda[[söfnuður|söfnuðir]]
8654 mótmælenda[[söfnuður|söfnuðir]]xxx
8655 !! html
8656 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8657 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8658 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8659 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8660 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8661 </p>
8662 !! end
8663
8664 !! test
8665 Parsoid link trail escaping
8666 !! options
8667 parsoid=html2wt,html2html
8668 !! html/parsoid
8669 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8670 !! wikitext
8671 [[apple]]<nowiki/>s
8672 !! end
8673
8674 !! test
8675 Parsoid link prefix escaping
8676 !! options
8677 language=is
8678 parsoid=html2wt,html2html
8679 !! html/parsoid
8680 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8681 !! wikitext
8682 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8683 !! end
8684
8685 !! test
8686 Parsoid link bracket escaping
8687 !! options
8688 parsoid=html2wt,html2html
8689 !! html/parsoid
8690 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8691 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8692 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8693 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8694 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8695 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8696 !! wikitext
8697 [[Test]]
8698
8699 [<nowiki/>[[Test]]]
8700
8701 [[[[Test]]]]
8702
8703 [[[<nowiki/>[[Test]]]]]
8704
8705 [[[[[[Test]]]]]]
8706
8707 [[[[[<nowiki/>[[Test]]]]]]]
8708 !! end
8709
8710 !! test
8711 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8712 !! wikitext
8713 [[Foo| bar]]
8714
8715 [[Foo| ''bar'']]
8716
8717 [http://wp.org foo]
8718
8719 [http://wp.org ''foo'']
8720 !! html
8721 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8722 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8723 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8724 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8725 </p>
8726 !! end
8727
8728 !! test
8729 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8730 !! wikitext
8731 [[Foo|{{echo|a}} b {{echo|c}}]]
8732 !! html/parsoid
8733 <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>
8734 !! end
8735
8736 !! test
8737 Link with angle bracket after anchor
8738 !! config
8739 wgFragmentMode=[ 'html5', 'legacy' ]
8740 !! wikitext
8741 [[Foo#<bar>]]
8742 !! html/php
8743 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8744 </p>
8745 !! html/parsoid
8746 <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>
8747 !! end
8748
8749 !! test
8750 Link with angle bracket after anchor (legacy)
8751 !! config
8752 wgFragmentMode=[ 'legacy' ]
8753 !! wikitext
8754 [[Foo#<bar>]]
8755 !! html/php
8756 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8757 </p>
8758 !! end
8759
8760 ###
8761 ### Interwiki links (see maintenance/interwiki.sql)
8762 ###
8763
8764 !! test
8765 Inline interwiki link
8766 !! options
8767 parsoid=wt2html,wt2wt,html2html
8768 !! wikitext
8769 [[MeatBall:SoftSecurity]]
8770 !! html/php
8771 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8772 </p>
8773 !! html/parsoid
8774 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8775 !! end
8776
8777 !! test
8778 Inline interwiki link with empty title (T4372)
8779 !! options
8780 parsoid=wt2html,wt2wt,html2html
8781 !! wikitext
8782 [[MeatBall:]]
8783 !! html/php
8784 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8785 </p>
8786 !! html/parsoid
8787 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8788 !! end
8789
8790 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8791 !! test
8792 Interwiki link encoding conversion (T3636)
8793 !! options
8794 parsoid=wt2html,wt2wt
8795 !! wikitext
8796 *[[Wikipedia:ro:Olteni&#0355;a]]
8797 *[[Wikipedia:ro:Olteni&#355;a]]
8798 !! html/php
8799 <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>
8800 <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>
8801
8802 !! html/php+tidy
8803 <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>
8804 <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>
8805 !! html/parsoid
8806 <ul>
8807 <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>
8808 <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>
8809 </ul>
8810 !! end
8811
8812 !! test
8813 Interwiki link with fragment (T4130)
8814 !! wikitext
8815 [[MeatBall:SoftSecurity#foo]]
8816 !! html
8817 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8818 </p>
8819 !! end
8820
8821 !! test
8822 Link scenarios with escaped fragments
8823 !! config
8824 wgFragmentMode=[ 'html5', 'legacy' ]
8825 !! wikitext
8826 [[#Is this great?]]
8827 [[Foo#Is this great?]]
8828 [[meatball:Foo#Is this great?]]
8829 !! html/php
8830 <p><a href="#Is_this_great?">#Is this great?</a>
8831 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8832 <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>
8833 </p>
8834 !! html/parsoid
8835 <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>
8836 <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>
8837 <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>
8838 !! end
8839
8840 !! test
8841 Link scenarios with escaped fragments (legacy)
8842 !! config
8843 wgFragmentMode=[ 'legacy' ]
8844 !! wikitext
8845 [[#Is this great?]]
8846 [[Foo#Is this great?]]
8847 [[meatball:Foo#Is this great?]]
8848 !! html/php
8849 <p><a href="#Is_this_great.3F">#Is this great?</a>
8850 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8851 <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>
8852 </p>
8853 !! end
8854
8855 # Ideally the wikipedia: prefix here should be proto-relative too
8856 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8857 # define the 'en' prefix, and originally the test used 'wikipedia',
8858 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8859 # article.
8860 !! test
8861 Different interwiki prefixes mapping to the same URL
8862 !! wikitext
8863 [[:en:Foo]]
8864
8865 [[:en:Foo|Foo]]
8866
8867 [[wikipedia:Foo]]
8868
8869 [[:wikipedia:Foo|Foo]]
8870
8871 [[wikipedia:en:Foo]]
8872
8873 [[:wikipedia:en:Foo]]
8874
8875 [[ wikiPEdia :Foo]]
8876 !! html/parsoid
8877 <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>
8878
8879 <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>
8880
8881 <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>
8882
8883 <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>
8884
8885 <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>
8886
8887 <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>
8888
8889 <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>
8890 !! end
8891
8892 !! test
8893 Interwiki links that cannot be represented in wiki syntax
8894 !! wikitext
8895 [[meatball:ok]]
8896 [[meatball:ok#foo|ok with fragment]]
8897 [[meatball:ok_as_well?|ok ending with ? mark]]
8898 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8899 [http://de.wikipedia.org/wiki/#foo is just fragment]
8900
8901 !! html/php
8902 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8903 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8904 <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>
8905 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8906 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8907 </p>
8908 !! html/parsoid
8909 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8910 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8911 <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>
8912 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8913 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8914 !! end
8915
8916 !! test
8917 Interwiki links: trail
8918 !! wikitext
8919 [[wikipedia:Foo|Ba]]r
8920 !! html/php
8921 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8922 </p>
8923 !! html/parsoid
8924 <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>
8925 !! end
8926
8927 !! test
8928 Local interwiki link
8929 !! options
8930 parsoid=wt2html,wt2wt,html2html
8931 !! wikitext
8932 [[local:Template:Foo]]
8933 !! html/php
8934 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8935 </p>
8936 !! html/parsoid
8937 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8938 !! end
8939
8940 # Parsoid does not mark self-links, by design.
8941 !! test
8942 Local interwiki link: self-link to current page
8943 !! options
8944 title=[[Main Page]]
8945 parsoid=wt2html,wt2wt,html2html
8946 !! wikitext
8947 [[local:Main Page]]
8948 !! html/php
8949 <p><a class="mw-selflink selflink">local:Main Page</a>
8950 </p>
8951 !! html/parsoid
8952 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8953 !! end
8954
8955 !! test
8956 Local interwiki link: prefix only (T66167)
8957 !! options
8958 parsoid=wt2html,wt2wt,html2html
8959 !! wikitext
8960 [[local:]]
8961 !! html/php
8962 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8963 </p>
8964 !! html/parsoid
8965 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8966 !! end
8967
8968 !! test
8969 Local interwiki link: with additional interwiki prefix (T63357)
8970 !! options
8971 parsoid=wt2html,wt2wt,html2html
8972 !! wikitext
8973 [[local:meatball:Hello]]
8974 !! html/php
8975 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8976 </p>
8977 !! html/parsoid
8978 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8979 !! end
8980
8981 !! test
8982 Multiple local interwiki link prefixes
8983 !! wikitext
8984 [[local:local:local:local:mi:local:Foo]]
8985 !! options
8986 parsoid=wt2html,wt2wt,html2html
8987 !! html/php
8988 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8989 </p>
8990 !! html/parsoid
8991 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8992 !! end
8993
8994 !! test
8995 Interwiki link with percent encoded target
8996 !! wikitext
8997 [[:es:Nueva Guip%C3%BAzcoa|Nueva Guipúzcoa]]
8998 !! html/php
8999 <p><a href="http://es.wikipedia.org/wiki/Nueva_Guip%C3%BAzcoa" class="extiw" title="es:Nueva Guipúzcoa">Nueva Guipúzcoa</a>
9000 </p>
9001 !! html/parsoid
9002 <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>
9003 !! end
9004
9005 ###
9006 ### Interlanguage links
9007 ### Language links (so that searching for '### language' matches..)
9008 ###
9009
9010 !! test
9011 Interlanguage link
9012 !! wikitext
9013 Blah blah blah
9014 [[zh:Chinese]]
9015 !! html/php
9016 <p>Blah blah blah
9017 </p>
9018 !! html/parsoid
9019 <p>Blah blah blah</p>
9020 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9021 !! end
9022
9023 ## parsoid html2wt will lose the space variations
9024 !! test
9025 Interlanguage link with spacing
9026 !! options
9027 parsoid=wt2html,wt2wt,html2html
9028 !! wikitext
9029 Blah blah blah
9030 [[ zh : Chinese ]]
9031 !! html/php
9032 <p>Blah blah blah
9033 </p>
9034 !! html/parsoid
9035 <p>Blah blah blah</p>
9036 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9037 !! end
9038
9039 !! test
9040 Double interlanguage link
9041 !! wikitext
9042 Blah blah blah
9043 [[es:Spanish]]
9044 [[zh:Chinese]]
9045 !! html/php
9046 <p>Blah blah blah
9047 </p>
9048 !! html/parsoid
9049 <p>Blah blah blah</p>
9050 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9051 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9052 !! end
9053
9054 ## parsoid html2wt will lose the space variations
9055 !! test
9056 Interlanguage link variations
9057 !! options
9058 parsoid=wt2html,wt2wt,html2html
9059 !! wikitext
9060 Blah blah blah
9061 [[ es :Spanish]]
9062 [[ ZH :Chinese]]
9063 [[es:Foo_bar]]
9064 !! html/php
9065 <p>Blah blah blah
9066 </p>
9067 !! html/parsoid
9068 <p>Blah blah blah</p>
9069 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
9070 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
9071 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
9072 !! end
9073
9074 !! test
9075 Escaping of interlanguage links (T129218, T156308)
9076 !! wikitext
9077 Blah blah blah
9078 [[:es:Spanish]]
9079 [[ : zh : Chinese ]]
9080 !! html/php
9081 <p>Blah blah blah
9082 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9083 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
9084 </p>
9085 !! html/parsoid
9086 <p>Blah blah blah
9087 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9088 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
9089 !! end
9090
9091 !! test
9092 Multiple colons escaping interlanguage links
9093 !! options
9094 parsoid=wt2html
9095 !! wikitext
9096 [[:es:Spanish]]
9097 [[::es:Spanish]]
9098 [[:::es:Spanish]]
9099 !! html/php
9100 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9101 [[::es:Spanish]]
9102 [[:::es:Spanish]]
9103 </p>
9104 !! html/parsoid
9105 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9106 [[::es:Spanish]]
9107 [[:::es:Spanish]]</p>
9108 !! end
9109
9110 ## parsoid html2wt will normalize the space to _
9111 !! test
9112 Space and question mark encoding in interlanguage links (T95473)
9113 !! options
9114 parsoid=wt2html,wt2wt,html2html
9115 !! wikitext
9116 Blah blah blah
9117 [[es:Foo bar?]]
9118 !! html/php
9119 <p>Blah blah blah
9120 </p>
9121 !! html/parsoid
9122 <p>Blah blah blah</p>
9123 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
9124 !! end
9125
9126 !! test
9127 Interlanguage link, with prefix links
9128 !! options
9129 language=ln
9130 !! wikitext
9131 Blah blah blah
9132 [[zh:Chinese]]
9133 !! html/php
9134 <p>Blah blah blah
9135 </p>
9136 !! html/parsoid
9137 <p>Blah blah blah</p>
9138 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9139 !! end
9140
9141 !! test
9142 Double interlanguage link, with prefix links (T10897)
9143 !! options
9144 language=ln
9145 !! wikitext
9146 Blah blah blah
9147 [[es:Spanish]]
9148 [[zh:Chinese]]
9149 !! html/php
9150 <p>Blah blah blah
9151 </p>
9152 !! html/parsoid
9153 <p>Blah blah blah</p>
9154 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9155 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9156 !! end
9157
9158 !! test
9159 "Extra" interlanguage links (T34189 / gerrit 111390)
9160 !! wikitext
9161 Blah blah blah
9162 [[mul:Article]]
9163 !! html/php
9164 <p>Blah blah blah
9165 </p>
9166 !! html/parsoid
9167 <p>Blah blah blah</p>
9168 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
9169 !! end
9170
9171 ## PHP parser tests script needs an update
9172 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9173 !! test
9174 Language links render as inline links if $wgInterwikiMagic=false
9175 !! options
9176 wgInterwikiMagic=false
9177 parsoid=wt2html,wt2wt,html2html
9178 !! wikitext
9179 Blah blah blah
9180 [[zh:Chinese]]
9181 !! html/parsoid
9182 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9183 !! end
9184
9185 ## PHP parser tests script needs an update
9186 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9187 !! test
9188 Language links render as inline links in the Talk namespace
9189 !! options
9190 title=Talk:Foo
9191 parsoid=wt2html,wt2wt,html2html
9192 !! wikitext
9193 Blah blah blah
9194 [[zh:Chinese]]
9195 !! html/parsoid
9196 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9197 !! end
9198
9199 !! test
9200 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
9201 !! options
9202 language=ln
9203 !! wikitext
9204 [[WW&nbsp;II]]
9205 !! html
9206 <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>
9207 </p>
9208 !! end
9209
9210 !! test
9211 Parsoid T55221: Wikilinks should be properly entity-escaped
9212 !! options
9213 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
9214 !! html/parsoid
9215 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9216 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9217 !! wikitext
9218 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
9219
9220 He&amp;nbsp;llo He&amp;nbsp;llo
9221 !! html/php
9222 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
9223 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
9224 </p>
9225 !! end
9226
9227 # html2wt will fail because of title normalization without data-parsoid
9228 !! test
9229 Parsoid: handle constructor well
9230 !! options
9231 parsoid=wt2html,wt2wt
9232 !! wikitext
9233 [[constructor]]
9234
9235 [[constructor:foo]]
9236 !! html/php
9237 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9238 </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>
9239 </p>
9240 !! html/parsoid
9241 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9242
9243 <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>
9244 !! end
9245
9246 !! test
9247 Template parameter named "constructor"
9248 !! wikitext
9249 {{echo| constructor = |hi}}
9250 !! html/parsoid
9251 <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>
9252 !! end
9253
9254 !! article
9255 ko:
9256 !! text
9257 Test.
9258 !! endarticle
9259
9260 # Note that `ko` isn't a known interlanguage prefix
9261 !! test
9262 Parsoid: recognize interlanguage links without a target page
9263 !! options
9264 ill
9265 !! wikitext
9266 [[es:]]
9267
9268 [[ko:]]
9269 !! html/php
9270 es:
9271 !! html/parsoid
9272 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9273
9274 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9275 !! end
9276
9277 # Note that `ko` isn't a known interwiki prefix
9278 !! test
9279 Parsoid: recognize interwiki links without a target page
9280 !! options
9281 parsoid=wt2html,wt2wt,html2html
9282 !! wikitext
9283 [[:es:]]
9284
9285 [[:ko:]]
9286 !! html/php
9287 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9288 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9289 </p>
9290 !! html/parsoid
9291 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9292 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9293 !! end
9294
9295 !! test
9296 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9297 !! wikitext
9298 [[mi:Foo]]
9299 !! html/php
9300 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9301 </p>
9302 !! html/parsoid
9303 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9304 !! end
9305
9306 !! test
9307 Interlanguage link with preceding local interwiki link (T70085)
9308 !! options
9309 parsoid=wt2html,wt2wt,html2html
9310 !! wikitext
9311 Blah blah blah
9312 [[local:es:Spanish]]
9313 !! html/php
9314 <p>Blah blah blah
9315 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9316 </p>
9317 !! html/parsoid
9318 <p>Blah blah blah
9319 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9320 !! end
9321
9322 !! test
9323 Looks like an interlanguage link, but is actually a local interwiki
9324 !! options
9325 parsoid=wt2html,wt2wt,html2html
9326 !! wikitext
9327 Blah blah blah
9328 [[mi:Template:Foo]]
9329 !! html/php
9330 <p>Blah blah blah
9331 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9332 </p>
9333 !! html/parsoid
9334 <p>Blah blah blah
9335 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9336 !! end
9337
9338 ###
9339 ### Redirects, Parsoid-only
9340 ###
9341
9342 !! test
9343 1. Simple redirect to page
9344 !! wikitext
9345 #REDIRECT [[Main Page]]
9346 !! html/parsoid
9347 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9348 !! end
9349
9350 !! test
9351 2. Other redirect variants
9352 !! wikitext
9353 #REDIRECT [[Main_Page]]
9354 !! html/parsoid
9355 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9356 !! end
9357
9358 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9359 # This tests the Parsoid bail-out code.
9360 !! test
9361 3. Other redirect variants
9362 !! options
9363 parsoid=wt2html
9364 !! wikitext
9365 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9366 !! html/parsoid
9367 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9368 !! end
9369
9370 !! test
9371 4. Redirect to a templated destination
9372 !! wikitext
9373 #REDIRECT [[{{echo|Foo}}bar]]
9374 !! html/parsoid
9375 <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"}]]}'/>
9376 !! end
9377
9378 !! test
9379 Empty redirect
9380 !! options
9381 parsoid=wt2html,wt2wt
9382 !! wikitext
9383 #REDIRECT [[]]
9384 !! html/parsoid
9385 <ol>
9386 <li>REDIRECT [[]]</li></ol>
9387 !! end
9388
9389 !! test
9390 Optional colon in #REDIRECT
9391 !! options
9392 # the colon is archaic syntax. we support it for wt2html, but we
9393 # don't care that it roundtrips back to the modern syntax.
9394 parsoid=wt2html,html2html
9395 !! wikitext
9396 #REDIRECT:[[Main Page]]
9397 !! html/parsoid
9398 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9399 !! end
9400
9401 !! test
9402 Whitespace in #REDIRECT with optional colon
9403 !! options
9404 # the colon and gratuitous whitespace is archaic syntax. we support
9405 # it for wt2html, but we don't care that it roundtrips back to the
9406 # modern syntax (without extra whitespace)
9407 parsoid=wt2html,html2html
9408 !! wikitext
9409
9410 #REDIRECT
9411 :
9412 [[Main Page]]
9413 !! html/parsoid
9414 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9415 !! end
9416
9417 !! test
9418 Piped link in #REDIRECT
9419 !! options
9420 # content after piped link is ignored. we support this syntax,
9421 # but don't care that the piped link is lost when we roundtrip this.
9422 parsoid=wt2html
9423 !! wikitext
9424 #REDIRECT [[Main Page|bar]]
9425 !! html/parsoid
9426 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9427 !! end
9428
9429 !! test
9430 Redirect to category (T104502)
9431 !! options
9432 parsoid=wt2html,wt2wt
9433 !! wikitext
9434 #REDIRECT [[Category:Foo]]
9435 !! html/parsoid
9436 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9437 !! end
9438
9439 !! test
9440 Redirect to category with URL encoding (T104502)
9441 !! options
9442 parsoid=wt2html
9443 !! wikitext
9444 #REDIRECT [[Category%3AFoo]]
9445 !! html/parsoid
9446 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9447 !! end
9448
9449 !! test
9450 Redirect to category page
9451 !! wikitext
9452 #REDIRECT [[:Category:Foo]]
9453 !! html/parsoid
9454 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9455 !! end
9456
9457 !! test
9458 Redirect to image page (1)
9459 !! wikitext
9460 #REDIRECT [[File:Wiki.png]]
9461 !! html/parsoid
9462 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9463 !! end
9464
9465 !! test
9466 Redirect to image page (2)
9467 !! wikitext
9468 #REDIRECT [[Image:Wiki.png]]
9469 !! html/parsoid
9470 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9471 !! end
9472
9473 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9474 # Next test confirms this.
9475 !! test
9476 Redirect to language (1) (T104918)
9477 !! options
9478 parsoid=wt2html,wt2wt,html2html
9479 !! wikitext
9480 #REDIRECT [[en:File:Wiki.png]]
9481 !! html/parsoid
9482 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9483 !! end
9484
9485 !! test
9486 Redirect to language (2) (T104918)
9487 !! wikitext
9488 #REDIRECT [[:en:File:Wiki.png]]
9489 !! html/parsoid
9490 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9491 !! end
9492
9493 !! test
9494 Redirect to interwiki (T104918)
9495 !! wikitext
9496 #REDIRECT [[meatball:File:Wiki.png]]
9497 !! html/parsoid
9498 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9499 !! end
9500
9501 !! test
9502 Non-English #REDIRECT
9503 !! options
9504 language=is
9505 !! wikitext
9506 #TILVÍSUN [[Main Page]]
9507 !! html/parsoid
9508 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9509 !! end
9510
9511 !! test
9512 Redirect syntax under text isn't considered a redirect
9513 !! wikitext
9514 some text
9515
9516 #redirect [[Main Page]]
9517 !! html/parsoid
9518 <p>some text</p>
9519 <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>
9520 !! end
9521
9522 !! test
9523 New redirect
9524 !! options
9525 parsoid=html2wt
9526 !! html/parsoid
9527 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9528 !! wikitext
9529 #REDIRECT [[Foo]]
9530 Foo
9531 !! end
9532
9533 !! test
9534 Redirect followed by block on the same line
9535 !! options
9536 parsoid=wt2html
9537 !! wikitext
9538 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9539 !! html/parsoid
9540 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9541 !! end
9542
9543 !! test
9544 Redirect followed by a newline
9545 !! wikitext
9546 #REDIRECT [[Main Page]]
9547 A newline
9548 !! html/parsoid
9549 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9550 <p>A newline</p>
9551 !! end
9552
9553 !! test
9554 Redirect followed by multiple newlines
9555 !! wikitext
9556 #REDIRECT [[Main Page]]
9557
9558
9559 A newline
9560 !! html/parsoid
9561 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9562
9563 <p><br/>
9564 A newline</p>
9565 !! end
9566
9567 !! test
9568 Drop duplicate redirects
9569 !! options
9570 parsoid=html2wt
9571 !! html/parsoid
9572 <link rel="mw:PageProp/redirect" href="./Foo"/>
9573 <link rel="mw:PageProp/redirect" href="./Bar"/>
9574 <link rel="mw:PageProp/redirect" href="./Baz"/>
9575 !! wikitext
9576 #REDIRECT [[Foo]]
9577 !! end
9578
9579 ##
9580 ## XHTML tidiness
9581 ###
9582
9583 !! test
9584 <br> to <br />
9585 !! wikitext
9586 1<br>2<br />3
9587 !! html
9588 <p>1<br />2<br />3
9589 </p>
9590 !! end
9591
9592 !! test
9593 Broken br tag sanitization
9594 !! wikitext
9595 </br>
9596 !! html/php
9597 <p>&lt;/br&gt;
9598 </p>
9599 !! end
9600
9601 # TODO: Fix html2html mode (T53055)!
9602 !! test
9603 Parsoid: Broken br tag recognition
9604 !! options
9605 parsoid=wt2html
9606 !! wikitext
9607 </br>
9608
9609 <br/ >
9610 !! html+tidy
9611 <p><br />
9612 </p><p><br />
9613 </p>
9614 !! end
9615
9616 !! test
9617 Incorrecly removing closing slashes from correctly formed XHTML
9618 !! wikitext
9619 <br style="clear:both;" />
9620 !! html
9621 <p><br style="clear:both;" />
9622 </p>
9623 !! end
9624
9625 !! test
9626 Failing to transform badly formed HTML into correct XHTML
9627 !! wikitext
9628 <br style="clear: left;">
9629 <br style="clear: right;">
9630 <br style="clear: both;">
9631 !! html
9632 <p><br style="clear: left;" />
9633 <br style="clear: right;" />
9634 <br style="clear: both;" />
9635 </p>
9636 !!end
9637
9638 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9639 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9640 !! test
9641 Handling html with a div self-closing tag
9642 !! wikitext
9643 <div title />
9644 <div title/>
9645 <div title/ >
9646 <div title=bar />
9647 <div title=bar/>
9648 <div title=bar/ >
9649 !! html/php+tidy
9650 <div title=""></div>
9651 <div title=""></div>
9652 <div title="">
9653 <div title="bar"></div>
9654 <div title="bar"></div>
9655 <div title="bar/">
9656 </div></div>
9657 !! html/parsoid
9658 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9659 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9660 <div title="" data-parsoid='{"stx":"html","autoInsertedEnd":true}'>
9661 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9662 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9663 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div></div>
9664 !! end
9665
9666 !! test
9667 Elements with solidus in various attribute positions
9668 !! options
9669 parsoid=wt2html,html2html
9670 !! wikitext
9671 <div cla/ss="123">ha</div>
9672
9673 <div / class="123">ha</div>
9674
9675 <div class= / "123">ha</div>
9676 !! html/php+tidy
9677 <div>ha</div>
9678 <div class="123">ha</div>
9679 <div class="/">ha</div>
9680 !! html/parsoid
9681 <div data-parsoid='{"stx":"html","a":{"cla":null,"ss":null},"sa":{"cla":"","ss":"123"}}'>ha</div>
9682
9683 <div class="123" data-parsoid='{"stx":"html"}'>ha</div>
9684
9685 <div class="/" data-parsoid='{"stx":"html","a":{"\"123\"":null},"sa":{"\"123\"":""}}'>ha</div>
9686 !! end
9687
9688 !! test
9689 Handling html with a br self-closing tag
9690 !! wikitext
9691 <br title />
9692 <br title/>
9693 <br title/ >
9694 <br title=bar />
9695 <br title=bar/>
9696 <br title=bar/ >
9697 !! html/php+tidy
9698 <p><br title="" />
9699 <br title="" />
9700 <br title="" />
9701 <br title="bar" />
9702 <br title="bar" />
9703 <br title="bar/" />
9704 </p>
9705 !! html/parsoid
9706 <p><br title="" />
9707 <br title="" />
9708 <br title="" />
9709 <br title="bar" />
9710 <br title="bar" />
9711 <br title="bar/" />
9712 </p>
9713 !! end
9714
9715 !! test
9716 Quoted attributes without spaces
9717 !! options
9718 parsoid=wt2html
9719 !! wikitext
9720 <div class="foo"style="color:red">red</div>
9721 !! html/php+tidy
9722 <div class="foo" style="color:red">red</div>
9723 !! html/parsoid
9724 <div class="foo" style="color:red">red</div>
9725 !! end
9726
9727 !! test
9728 Horizontal ruler (should it add that extra space?)
9729 !! wikitext
9730 <hr>
9731 <hr >
9732 foo <hr
9733 > bar
9734 !! html+tidy
9735 <hr />
9736 <hr /><p>
9737 foo </p><hr /><p> bar
9738 </p>
9739 !! end
9740
9741 !! test
9742 Horizontal ruler -- 4+ dashes render hr
9743 !! wikitext
9744 ----
9745 !! html
9746 <hr />
9747
9748 !! end
9749
9750 !! test
9751 Horizontal ruler -- eats additional dashes on the same line
9752 !! wikitext
9753 ---------
9754 !! html
9755 <hr />
9756
9757 !! end
9758
9759 !! test
9760 Horizontal ruler -- does not collapse dashes on consecutive lines
9761 !! wikitext
9762 ----
9763 ----
9764 !! html
9765 <hr />
9766 <hr />
9767
9768 !! end
9769
9770 !! test
9771 Horizontal ruler -- <4 dashes render as plain text
9772 !! wikitext
9773 ---
9774 !! html
9775 <p>---
9776 </p>
9777 !! end
9778
9779 !! test
9780 Horizontal ruler -- Supports content following dashes on same line
9781 !! wikitext
9782 ---- Foo
9783 !! html
9784 <hr /> Foo
9785
9786 !! html+tidy
9787 <hr /><p> Foo
9788 </p>
9789 !! end
9790
9791 ###
9792 ### Block-level elements
9793 ###
9794 !! test
9795 Common list
9796 !! wikitext
9797 *Common list
9798 *item 2
9799 *item 3
9800 !! html
9801 <ul><li>Common list</li>
9802 <li>item 2</li>
9803 <li>item 3</li></ul>
9804
9805 !! end
9806
9807 !! test
9808 Numbered list
9809 !! wikitext
9810 #Numbered list
9811 #item 2
9812 #item 3
9813 !! html
9814 <ol><li>Numbered list</li>
9815 <li>item 2</li>
9816 <li>item 3</li></ol>
9817
9818 !! end
9819
9820 # the switch from level 3 to ordered should not introduce a newline between
9821 !! test
9822 Mixed list
9823 !! wikitext
9824 *Mixed list
9825 *#with numbers
9826 **and bullets
9827 *#and numbers
9828 *bullets again
9829 **bullet level 2
9830 ***bullet level 3
9831 ***#Number on level 4
9832 **bullet level 2
9833 **#Number on level 3
9834 **#Number on level 3
9835 *#number level 2
9836 *Level 1
9837 ***Level 3
9838 #**Level 3, but ordered
9839 !! html
9840 <ul><li>Mixed list
9841 <ol><li>with numbers</li></ol>
9842 <ul><li>and bullets</li></ul>
9843 <ol><li>and numbers</li></ol></li>
9844 <li>bullets again
9845 <ul><li>bullet level 2
9846 <ul><li>bullet level 3
9847 <ol><li>Number on level 4</li></ol></li></ul></li>
9848 <li>bullet level 2
9849 <ol><li>Number on level 3</li>
9850 <li>Number on level 3</li></ol></li></ul>
9851 <ol><li>number level 2</li></ol></li>
9852 <li>Level 1
9853 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9854 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9855
9856 !! end
9857
9858 !! test
9859 1. Nested mixed wikitext and html list
9860 !! wikitext
9861 *hi
9862 *<ul><li>ho</li></ul>
9863 *hi
9864 **ho
9865 !! html/php
9866 <ul><li>hi</li>
9867 <li><ul><li>ho</li></ul></li>
9868 <li>hi
9869 <ul><li>ho</li></ul></li></ul>
9870
9871 !! html/parsoid
9872 <ul><li>hi</li>
9873 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9874 <li>hi
9875 <ul><li>ho</li></ul></li></ul>
9876 !! end
9877
9878 !! test
9879 2. Nested mixed wikitext and html list (incompatible)
9880 !! wikitext
9881 ;hi
9882 :{{echo|<li>ho</li>}}
9883 !! html/php
9884 <dl><dt>hi</dt>
9885 <dd><li>ho</li></dd></dl>
9886
9887 !! html/parsoid
9888 <dl><dt>hi</dt>
9889 <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>
9890 !! end
9891
9892 !! test
9893 Nested lists 1
9894 !! wikitext
9895 *foo
9896 **bar
9897 !! html
9898 <ul><li>foo
9899 <ul><li>bar</li></ul></li></ul>
9900
9901 !! end
9902
9903 !! test
9904 Nested lists 2
9905 !! wikitext
9906 **foo
9907 *bar
9908 !! html
9909 <ul><li><ul><li>foo</li></ul></li>
9910 <li>bar</li></ul>
9911
9912 !! end
9913
9914 !! test
9915 Nested lists 3 (first element empty)
9916 !! wikitext
9917 *
9918 **bar
9919 !! html
9920 <ul><li>
9921 <ul><li>bar</li></ul></li></ul>
9922
9923 !! end
9924
9925 !! test
9926 Nested lists 4 (first element empty)
9927 !! wikitext
9928 **
9929 *bar
9930 !! html
9931 <ul><li><ul><li></li></ul></li>
9932 <li>bar</li></ul>
9933
9934 !! end
9935
9936 !! test
9937 Nested lists 5 (both elements empty)
9938 !! wikitext
9939 **
9940 *
9941 !! html
9942 <ul><li><ul><li></li></ul></li>
9943 <li></li></ul>
9944
9945 !! end
9946
9947 !! test
9948 Nested lists 6 (both elements empty)
9949 !! wikitext
9950 *
9951 **
9952 !! html
9953 <ul><li>
9954 <ul><li></li></ul></li></ul>
9955
9956 !! end
9957
9958 !! test
9959 Nested lists 7 (skip initial nesting levels)
9960 !! wikitext
9961 ***foo
9962 !! html
9963 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9964
9965 !! end
9966
9967 !! test
9968 Nested lists 8 (multiple nesting transitions)
9969 !! wikitext
9970 *foo
9971 ***bar
9972 **baz
9973 *boo
9974 !! html
9975 <ul><li>foo
9976 <ul><li><ul><li>bar</li></ul></li>
9977 <li>baz</li></ul></li>
9978 <li>boo</li></ul>
9979
9980 !! end
9981
9982 # XXX this test should be moved to citeParserTests, since it depends
9983 # on the Cite extension, which is "built in" to Parsoid.
9984 !! test
9985 Nested lists 9 (extension interaction)
9986 !! wikitext
9987 *<references />
9988 !! html/php+tidy-DISABLED
9989 <ul><li class="mw-empty-elt"></li></ul>
9990 !! html/parsoid
9991 <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>
9992 !! end
9993
9994 !! test
9995 1. Lists with start-of-line-transparent tokens before bullets: Comments
9996 !! wikitext
9997 *foo
9998 *<!--cmt-->bar
9999 <!--cmt-->*baz
10000 !! html
10001 <ul><li>foo</li>
10002 <li>bar</li>
10003 <li>baz</li></ul>
10004
10005 !! end
10006
10007 !! test
10008 Nested lists 10 (list and span siblings: wt2wt regression)
10009 !! wikitext
10010 *a <span>x</span>
10011 **b <span>y</span>
10012 !! html/parsoid
10013 <ul><li>a <span>x</span>
10014 <ul><li>b <span>y</span></li></ul></li></ul>
10015 !! end
10016
10017 !! test
10018 2. Lists with start-of-line-transparent tokens before bullets: Template close
10019 !! wikitext
10020 *foo {{echo|bar
10021 }}*baz
10022 !! html
10023 <ul><li>foo bar</li>
10024 <li>baz</li></ul>
10025
10026 !! end
10027
10028 !! test
10029 List items are not parsed correctly following a <pre> block (T2785)
10030 !! wikitext
10031 *<pre>foo</pre>
10032 *<pre>bar</pre>
10033 *zar
10034 !! html/php
10035 <ul><li><pre>foo</pre></li>
10036 <li><pre>bar</pre></li>
10037 <li>zar</li></ul>
10038
10039 !! html/parsoid
10040 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
10041 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
10042 <li>zar</li></ul>
10043 !! end
10044
10045 # FIXME: Might benefit from a html/parsoid since this has a template
10046 !! test
10047 List items from template
10048 !! wikitext
10049
10050 {{inner list}}
10051 *item 2
10052
10053 *item 0
10054 {{inner list}}
10055 *item 2
10056
10057 *item 0
10058 *notSOL{{inner list}}
10059 *item 2
10060 !! html
10061 <ul><li>item 1</li>
10062 <li>item 2</li></ul>
10063 <ul><li>item 0</li>
10064 <li>item 1</li>
10065 <li>item 2</li></ul>
10066 <ul><li>item 0</li>
10067 <li>notSOL</li>
10068 <li>item 1</li>
10069 <li>item 2</li></ul>
10070
10071 !! end
10072
10073 !! test
10074 List interrupted by empty line or heading
10075 !! wikitext
10076 *foo
10077
10078 **bar
10079 ==A heading==
10080 *Another list item
10081 !! html
10082 <ul><li>foo</li></ul>
10083 <ul><li><ul><li>bar</li></ul></li></ul>
10084 <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>
10085 <ul><li>Another list item</li></ul>
10086
10087 !!end
10088
10089 !! test
10090 Multiple list tags generated by templates
10091 !! wikitext
10092 {{echo|<li>}}a
10093 {{echo|<li>}}b
10094 {{echo|<li>}}c
10095 !! html
10096 <li>a
10097 <li>b
10098 <li>c</li>
10099 </li>
10100 </li>
10101
10102
10103 !! html+tidy
10104 <li>a
10105 </li><li>b
10106 </li><li>c
10107 </li>
10108 !! html/parsoid
10109 <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>
10110 <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>
10111 <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>
10112 !! end
10113
10114 !! test
10115 Multiple newlines in between HTML list items don't induce paragraph wrapping
10116 !! wikitext
10117 <ul>
10118 <li>hi</li>
10119
10120
10121
10122
10123 <li>ho</li>
10124 </ul>
10125
10126 <dl>
10127 <dt>hi</dt>
10128 <dd>ho<div>123</div>
10129 </dd>
10130
10131
10132 </dl>
10133 !! html/php+tidy
10134 <ul>
10135 <li>hi</li>
10136
10137
10138
10139
10140 <li>ho</li>
10141 </ul>
10142 <dl>
10143 <dt>hi</dt>
10144 <dd>ho<div>123</div>
10145 </dd>
10146
10147
10148 </dl>
10149 !! end
10150
10151 !!test
10152 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
10153 !! wikitext
10154 *a
10155 <!--This line will NOT split the list-->
10156 *b
10157 <!--This line will NOT split the list either-->
10158 *c
10159 <!--foo--> <!----> <!--This line NOT split the list either-->
10160 *d
10161 !! html
10162 <ul><li>a</li>
10163 <li>b</li>
10164 <li>c</li>
10165 <li>d</li></ul>
10166
10167 !!end
10168
10169 !!test
10170 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
10171 !! wikitext
10172 *a
10173 <!--This line will NOT split the list-->
10174 *b
10175 <!--This line will NOT split the list either-->
10176 *c
10177 <!--foo--> <!----> <!--This line NOT split the list
10178 either-->
10179 *d
10180 !! html
10181 <ul><li>a</li>
10182 <li>b</li>
10183 <li>c</li>
10184 <li>d</li></ul>
10185
10186 !!end
10187
10188 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
10189 # That pass could possibly be removed.
10190 !!test
10191 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
10192 !!options
10193 parsoid=wt2html,wt2wt
10194 !! wikitext
10195 *foo
10196 *<li>li-hack
10197 *{{echo|<li>templated li-hack}}
10198 *<!--foo--><li> unsupported li-hack with preceding comments
10199
10200 <ul>
10201 <li><li>not a li-hack
10202 </li>
10203 </ul>
10204 !! html+tidy
10205 <ul><li>foo</li>
10206 <li class="mw-empty-elt"></li><li>li-hack</li>
10207 <li class="mw-empty-elt"></li><li>templated li-hack</li>
10208 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
10209 <ul>
10210 <li class="mw-empty-elt"></li><li>not a li-hack
10211 </li>
10212 </ul>
10213 !! html/parsoid
10214 <ul><li> foo</li>
10215 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
10216 <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>
10217 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
10218
10219 <ul data-parsoid='{"stx":"html"}'>
10220 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
10221 </li>
10222 </ul>
10223
10224 !!end
10225
10226 !! test
10227 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
10228 !! wikitext
10229 #foo
10230 ##bar
10231
10232 *foo
10233 **bar
10234
10235 :foo
10236 ::bar
10237 !! html/php+tidy
10238 <ol><li>foo
10239 <ol><li>bar</li></ol></li></ol>
10240 <ul><li>foo
10241 <ul><li>bar</li></ul></li></ul>
10242 <dl><dd>foo
10243 <dl><dd>bar</dd></dl></dd></dl>
10244 !! html/parsoid
10245 <ol>
10246 <li>foo<ol>
10247 <li>bar</li>
10248 </ol></li>
10249 </ol><ul>
10250 <li>foo<ul>
10251 <li>bar</li>
10252 </ul></li>
10253 </ul><dl>
10254 <dd>foo<dl>
10255 <dd>bar</dd>
10256 </dl></dd>
10257 </dl>
10258 !! end
10259
10260 !! test
10261 Parsoid: Test of whitespace serialization with Templated bullets
10262 !! options
10263 parsoid=wt2html
10264 !! wikitext
10265 * {{bullet}}
10266 !! html/parsoid
10267 <ul>
10268 <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>
10269 </ul>
10270 !! end
10271
10272 # ------------------------------------------------------------------------
10273 # The next set of tests are about Parsoid's ability to handle badly nested
10274 # tags (parse, minimize scope of fixup, and roundtrip back)
10275 # ------------------------------------------------------------------------
10276
10277 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
10278 # Parsoid's list handling is more aware of block structure.
10279 !! test
10280 Unbalanced closing block tags break a list
10281 !! wikitext
10282 <div>
10283 *a</div><div>
10284 *b</div>
10285 !! html+tidy
10286 <div>
10287 <ul><li>a</li></ul></div><div>
10288 <li>b</li></div>
10289 !! html/parsoid
10290 <div><ul>
10291 <li>a</li>
10292 </ul></div>
10293 <div><ul>
10294 <li>b</li>
10295 </ul></div>
10296 !! end
10297
10298 !! test
10299 Unbalanced closing non-block tags don't break a list
10300 !! options
10301 parsoid=wt2html,html2html
10302 !! wikitext
10303 <span>
10304 *a</span><span>
10305 *b</span>
10306 !! html/php+tidy
10307 <p><span>
10308 </span></p>
10309 <ul><li>a<span></span></li>
10310 <li>b</li></ul>
10311 !! html/parsoid
10312 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></p>
10313 <ul><li>a<span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></li>
10314 <li>b</li></ul>
10315 !! end
10316
10317 # Parsoid does some post-dom-building cleanup
10318 # which is why its output differs from Remex.
10319 !! test
10320 Unclosed formatting tags that straddle lists are closed and reopened
10321 !! options
10322 parsoid=wt2html,wt2wt,html2html
10323 !! wikitext
10324 #<s> a
10325 #b </s>
10326 !! html/php+tidy
10327 <ol><li><s> a</s></li><s>
10328 </s><li><s>b </s></li></ol>
10329 !! html/parsoid
10330 <ol><li><s> a</s></li>
10331 <li><s>b </s></li></ol>
10332 !! end
10333
10334 # Output is ugly because of all the misnested tag fixups.
10335 !! test
10336 1. List embedded in a formatting tag
10337 !! wikitext
10338 <small>
10339 *foo
10340 </small>
10341 !! html/php+tidy
10342 <p><small>
10343 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10344 </p>
10345 !! html/parsoid
10346 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
10347 <ul><li data-parsoid='{}'>foo</li></ul></small>
10348 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p>
10349 !! end
10350
10351 # Output is ugly because of all the misnested tag fixups.
10352 !! test
10353 2. List embedded in a formatting tag in a misnested way
10354 !! wikitext
10355 <small>
10356 *a
10357 *b</small>
10358 !! html/php+tidy
10359 <p><small>
10360 </small></p><small></small><ul><small><li>a</li>
10361 </small><li><small>b</small></li></ul>
10362 !! html/parsoid
10363 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10364 <ul><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'><li>a</li></small>
10365 <li><small data-parsoid='{"stx":"html","autoInsertedStart":true}'>b</small></li></ul>
10366 !! end
10367
10368 # Output is ugly because of all the misnested tag fixups.
10369 !! test
10370 3. List embedded in a formatting tag in a misnested way
10371 !! wikitext
10372 <small>
10373
10374 ** 123</small>
10375 !! html/php+tidy
10376 <p><small>
10377 </small></p><small></small><ul><small></small><li><small></small><ul><small></small><li><small>123</small></li></ul></li></ul>
10378 !! html/parsoid
10379 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10380
10381 <ul><li><ul><li data-parsoid='{}'><small data-parsoid='{"stx":"html","autoInsertedStart":true}'> 123</small></li></ul></li></ul>
10382 !! end
10383
10384 ###
10385 ### Magic Words
10386 ###
10387
10388 # Note that the current date is hard-coded as
10389 # 1970-01-01T00:02:03Z (a Thursday)
10390 # when running parser tests. The timezone is also fixed to GMT, so
10391 # local date will be identical to current date.
10392
10393 !! test
10394 Magic Word: {{CURRENTDAY}}
10395 !! wikitext
10396 {{CURRENTDAY}}
10397 !! html
10398 <p>1
10399 </p>
10400 !! end
10401
10402 !! test
10403 Magic Word: {{CURRENTDAY2}}
10404 !! wikitext
10405 {{CURRENTDAY2}}
10406 !! html
10407 <p>01
10408 </p>
10409 !! end
10410
10411 !! test
10412 Magic Word: {{CURRENTDAYNAME}}
10413 !! wikitext
10414 {{CURRENTDAYNAME}}
10415 !! html
10416 <p>Thursday
10417 </p>
10418 !! end
10419
10420 !! test
10421 Magic Word: {{CURRENTDOW}}
10422 !! wikitext
10423 {{CURRENTDOW}}
10424 !! html
10425 <p>4
10426 </p>
10427 !! end
10428
10429 !! test
10430 Magic Word: {{CURRENTMONTH}}
10431 !! wikitext
10432 {{CURRENTMONTH}}
10433 !! html
10434 <p>01
10435 </p>
10436 !! end
10437
10438 !! test
10439 Magic Word: {{CURRENTMONTH1}}
10440 !! wikitext
10441 {{CURRENTMONTH1}}
10442 !! html
10443 <p>1
10444 </p>
10445 !! end
10446
10447 !! test
10448 Magic Word: {{CURRENTMONTHABBREV}}
10449 !! wikitext
10450 {{CURRENTMONTHABBREV}}
10451 !! html
10452 <p>Jan
10453 </p>
10454 !! end
10455
10456 !! test
10457 Magic Word: {{CURRENTMONTHNAME}}
10458 !! wikitext
10459 {{CURRENTMONTHNAME}}
10460 !! html
10461 <p>January
10462 </p>
10463 !! end
10464
10465 !! test
10466 Magic Word: {{CURRENTMONTHNAMEGEN}}
10467 !! wikitext
10468 {{CURRENTMONTHNAMEGEN}}
10469 !! html
10470 <p>January
10471 </p>
10472 !! end
10473
10474 !! test
10475 Magic Word: {{CURRENTTIME}}
10476 !! wikitext
10477 {{CURRENTTIME}}
10478 !! html
10479 <p>00:02
10480 </p>
10481 !! end
10482
10483 !! test
10484 Magic Word: {{CURRENTHOUR}}
10485 !! wikitext
10486 {{CURRENTHOUR}}
10487 !! html
10488 <p>00
10489 </p>
10490 !! end
10491
10492 !! test
10493 Magic Word: {{CURRENTWEEK}} (T6594)
10494 !! wikitext
10495 {{CURRENTWEEK}}
10496 !! html
10497 <p>1
10498 </p>
10499 !! end
10500
10501 !! test
10502 Magic Word: {{CURRENTYEAR}}
10503 !! wikitext
10504 {{CURRENTYEAR}}
10505 !! html
10506 <p>1970
10507 </p>
10508 !! end
10509
10510 !! test
10511 Magic Word: {{CURRENTTIMESTAMP}}
10512 !! wikitext
10513 {{CURRENTTIMESTAMP}}
10514 !! html
10515 <p>19700101000203
10516 </p>
10517 !! end
10518
10519 !! test
10520 Magic Words LOCAL (UTC)
10521 !! wikitext
10522 *{{LOCALMONTH}}
10523 *{{LOCALMONTH1}}
10524 *{{LOCALMONTHNAME}}
10525 *{{LOCALMONTHNAMEGEN}}
10526 *{{LOCALMONTHABBREV}}
10527 *{{LOCALDAY}}
10528 *{{LOCALDAY2}}
10529 *{{LOCALDAYNAME}}
10530 *{{LOCALYEAR}}
10531 *{{LOCALTIME}}
10532 *{{LOCALHOUR}}
10533 *{{LOCALWEEK}}
10534 *{{LOCALDOW}}
10535 *{{LOCALTIMESTAMP}}
10536 !! html
10537 <ul><li>01</li>
10538 <li>1</li>
10539 <li>January</li>
10540 <li>January</li>
10541 <li>Jan</li>
10542 <li>1</li>
10543 <li>01</li>
10544 <li>Thursday</li>
10545 <li>1970</li>
10546 <li>00:02</li>
10547 <li>00</li>
10548 <li>1</li>
10549 <li>4</li>
10550 <li>19700101000203</li></ul>
10551
10552 !! end
10553
10554 !! test
10555 Magic Word: {{FULLPAGENAME}}
10556 !! options
10557 title=[[User:Ævar Arnfjörð Bjarmason]]
10558 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10559 !! wikitext
10560 {{FULLPAGENAME}}
10561 !! html/*
10562 <p>User:Ævar Arnfjörð Bjarmason
10563 </p>
10564 !! end
10565
10566 !! test
10567 Magic Word: {{FULLPAGENAMEE}}
10568 !! options
10569 title=[[User:Ævar Arnfjörð Bjarmason]]
10570 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10571 !! wikitext
10572 {{FULLPAGENAMEE}}
10573 !! html/*
10574 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10575 </p>
10576 !! end
10577
10578 !! test
10579 Magic Word: {{TALKSPACE}}
10580 !! options
10581 title=[[User:Ævar Arnfjörð Bjarmason]]
10582 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10583 !! wikitext
10584 {{TALKSPACE}}
10585 !! html/*
10586 <p>User talk
10587 </p>
10588 !! end
10589
10590 !! test
10591 Magic Word: {{TALKSPACE}}, same namespace
10592 !! options
10593 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10594 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10595 !! wikitext
10596 {{TALKSPACE}}
10597 !! html/*
10598 <p>User talk
10599 </p>
10600 !! end
10601
10602 !! test
10603 Magic Word: {{TALKSPACE}}, main namespace
10604 !! options
10605 title=[[Parser Test]]
10606 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10607 !! wikitext
10608 {{TALKSPACE}}
10609 !! html/*
10610 <p>Talk
10611 </p>
10612 !! end
10613
10614 !! test
10615 Magic Word: {{TALKSPACEE}}
10616 !! options
10617 title=[[User:Ævar Arnfjörð Bjarmason]]
10618 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10619 !! wikitext
10620 {{TALKSPACEE}}
10621 !! html/*
10622 <p>User_talk
10623 </p>
10624 !! end
10625
10626 !! test
10627 Magic Word: {{SUBJECTSPACE}}
10628 !! options
10629 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10630 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10631 !! wikitext
10632 {{SUBJECTSPACE}}
10633 !! html/*
10634 <p>User
10635 </p>
10636 !! end
10637
10638 !! test
10639 Magic Word: {{SUBJECTSPACE}}, same namespace
10640 !! options
10641 title=[[User:Ævar Arnfjörð Bjarmason]]
10642 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10643 !! wikitext
10644 {{SUBJECTSPACE}}
10645 !! html/*
10646 <p>User
10647 </p>
10648 !! end
10649
10650 !! test
10651 Magic Word: {{SUBJECTSPACE}}, main namespace
10652 !! options
10653 title=[[Parser Test]]
10654 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10655 !! wikitext
10656 {{SUBJECTSPACE}}
10657 !! html/*
10658
10659 !! end
10660
10661 !! test
10662 Magic Word: {{SUBJECTSPACEE}}
10663 !! options
10664 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10665 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10666 !! wikitext
10667 {{SUBJECTSPACEE}}
10668 !! html/*
10669 <p>User
10670 </p>
10671 !! end
10672
10673 !! test
10674 Magic Word: {{NAMESPACE}}
10675 !! options
10676 title=[[User:Ævar Arnfjörð Bjarmason]]
10677 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10678 !! wikitext
10679 {{NAMESPACE}}
10680 !! html/*
10681 <p>User
10682 </p>
10683 !! end
10684
10685 !! test
10686 Magic Word: {{NAMESPACEE}}
10687 !! options
10688 title=[[User:Ævar Arnfjörð Bjarmason]]
10689 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10690 !! wikitext
10691 {{NAMESPACEE}}
10692 !! html/*
10693 <p>User
10694 </p>
10695 !! end
10696
10697 !! test
10698 Magic Word: {{NAMESPACENUMBER}}
10699 !! options
10700 title=[[User:Ævar Arnfjörð Bjarmason]]
10701 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10702 !! wikitext
10703 {{NAMESPACENUMBER}}
10704 !! html/*
10705 <p>2
10706 </p>
10707 !! end
10708
10709 !! test
10710 Magic Word: {{SUBPAGENAME}}
10711 !! options
10712 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10713 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10714 !! wikitext
10715 {{SUBPAGENAME}}
10716 !! html/*
10717 <p>sub ö
10718 </p>
10719 !! end
10720
10721 !! test
10722 Magic Word: {{SUBPAGENAMEE}}
10723 !! options
10724 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10725 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10726 !! wikitext
10727 {{SUBPAGENAMEE}}
10728 !! html/*
10729 <p>sub_%C3%B6
10730 </p>
10731 !! end
10732
10733 !! test
10734 Magic Word: {{ROOTPAGENAME}}
10735 !! options
10736 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10737 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10738 !! wikitext
10739 {{ROOTPAGENAME}}
10740 !! html/*
10741 <p>Ævar Arnfjörð Bjarmason
10742 </p>
10743 !! end
10744
10745 !! test
10746 Magic Word: {{ROOTPAGENAMEE}}
10747 !! options
10748 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10749 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10750 !! wikitext
10751 {{ROOTPAGENAMEE}}
10752 !! html/*
10753 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10754 </p>
10755 !! end
10756
10757 !! test
10758 Magic Word: {{BASEPAGENAME}}
10759 !! options
10760 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10761 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10762 !! wikitext
10763 {{BASEPAGENAME}}
10764 !! html/*
10765 <p>Ævar Arnfjörð Bjarmason
10766 </p>
10767 !! end
10768
10769 !! test
10770 Magic Word: {{BASEPAGENAMEE}}
10771 !! options
10772 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10773 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10774 !! wikitext
10775 {{BASEPAGENAMEE}}
10776 !! html/*
10777 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10778 </p>
10779 !! end
10780
10781 !! test
10782 Magic Word: {{TALKPAGENAME}}
10783 !! options
10784 title=[[User:Ævar Arnfjörð Bjarmason]]
10785 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10786 !! wikitext
10787 {{TALKPAGENAME}}
10788 !! html/*
10789 <p>User talk:Ævar Arnfjörð Bjarmason
10790 </p>
10791 !! end
10792
10793 !! test
10794 Magic Word: {{TALKPAGENAMEE}}
10795 !! options
10796 title=[[User:Ævar Arnfjörð Bjarmason]]
10797 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10798 !! wikitext
10799 {{TALKPAGENAMEE}}
10800 !! html/*
10801 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10802 </p>
10803 !! end
10804
10805 !! test
10806 Magic Word: {{SUBJECTPAGENAME}}
10807 !! options
10808 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10809 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10810 !! wikitext
10811 {{SUBJECTPAGENAME}}
10812 !! html/*
10813 <p>User:Ævar Arnfjörð Bjarmason
10814 </p>
10815 !! end
10816
10817 !! test
10818 Magic Word: {{SUBJECTPAGENAMEE}}
10819 !! options
10820 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10821 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10822 !! wikitext
10823 {{SUBJECTPAGENAMEE}}
10824 !! html/*
10825 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10826 </p>
10827 !! end
10828
10829 !! test
10830 Magic Word: {{NUMBEROFFILES}}
10831 !! options
10832 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10833 !! wikitext
10834 {{NUMBEROFFILES}}
10835 !! html/*
10836 <p>7
10837 </p>
10838 !! end
10839
10840 !! test
10841 Magic Word: {{PAGENAME}}
10842 !! options
10843 title=[[User:Ævar Arnfjörð Bjarmason]]
10844 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10845 !! wikitext
10846 {{PAGENAME}}
10847 !! html/*
10848 <p>Ævar Arnfjörð Bjarmason
10849 </p>
10850 !! end
10851
10852 !! test
10853 Magic Word: {{PAGENAME}} with metacharacters
10854 !! options
10855 title=[['foo & bar = baz']]
10856 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10857 !! wikitext
10858 ''{{PAGENAME}}''
10859 !! html+tidy
10860 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10861 </p>
10862 !! end
10863
10864 !! test
10865 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10866 !! options
10867 title=[[*RFC 1234 http://example.com/]]
10868 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10869 !! wikitext
10870 {{PAGENAME}}
10871 !! html+tidy
10872 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10873 </p>
10874 !! end
10875
10876 !! test
10877 Magic Word: {{PAGENAMEE}}
10878 !! options
10879 title=[[User:Ævar Arnfjörð Bjarmason]]
10880 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10881 !! wikitext
10882 {{PAGENAMEE}}
10883 !! html/*
10884 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10885 </p>
10886 !! end
10887
10888 !! test
10889 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10890 !! options
10891 title=[[*RFC 1234 http://example.com/]]
10892 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10893 !! wikitext
10894 {{PAGENAMEE}}
10895 !! html+tidy
10896 <p>&#42;RFC_1234_http&#58;//example.com/
10897 </p>
10898 !! end
10899
10900 !! test
10901 Magic Word: {{REVISIONID}}
10902 !! options
10903 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10904 showflags
10905 !! wikitext
10906 {{REVISIONID}}
10907 !! html/*
10908 <p>1337
10909 </p>
10910 flags=vary-revision-id
10911 !! end
10912
10913 !! test
10914 Magic Word: {{SCRIPTPATH}}
10915 !! options
10916 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10917 !! wikitext
10918 {{SCRIPTPATH}}
10919 !! html/*
10920
10921 !! end
10922
10923 !! test
10924 Magic Word: {{STYLEPATH}}
10925 !! options
10926 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10927 !! wikitext
10928 {{STYLEPATH}}
10929 !! html/*
10930 <p>/skins
10931 </p>
10932 !! end
10933
10934 !! test
10935 Magic Word: {{SERVER}}
10936 !! options
10937 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10938 !! wikitext
10939 {{SERVER}}
10940 !! html/*
10941 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10942 </p>
10943 !! end
10944
10945 !! test
10946 Magic Word: {{SERVERNAME}}
10947 !! options
10948 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10949 !! wikitext
10950 {{SERVERNAME}}
10951 !! html/*
10952 <p>example.org
10953 </p>
10954 !! end
10955
10956 !! test
10957 Magic Word: {{SITENAME}}
10958 !! options
10959 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10960 !! wikitext
10961 {{SITENAME}}
10962 !! html/*
10963 <p>MediaWiki
10964 </p>
10965 !! end
10966
10967 !! test
10968 Magic Word: {{PAGELANGUAGE}}
10969 !! options
10970 language=fr
10971 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10972 !! wikitext
10973 {{PAGELANGUAGE}}
10974 !! html/*
10975 <p>fr
10976 </p>
10977 !! end
10978
10979 !! test
10980 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10981 !! options
10982 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10983 !! wikitext
10984 {{PAGELANGUAGE}}
10985 !! html/*
10986 <p>en
10987 </p>
10988 !! end
10989
10990 !! test
10991 Case-sensitive magic words, when cased differently, should just be template transclusions
10992 !! wikitext
10993 {{CurrentMonth}}
10994 {{currentday}}
10995 {{cURreNTweEK}}
10996 {{currentHour}}
10997 !! html
10998 <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>
10999 <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>
11000 <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>
11001 <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>
11002 </p>
11003 !! end
11004
11005 !! test
11006 Case-insensitive magic words should still work with weird casing.
11007 !! wikitext
11008 {{sErVeRNaMe}}
11009 {{LCFirst:AOEU}}
11010 {{ucFIRST:aoeu}}
11011 {{SERver}}
11012 !! html
11013 <p>example.org
11014 aOEU
11015 Aoeu
11016 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
11017 </p>
11018 !! end
11019
11020 # From plwiki:PLOS_ONE
11021 !! test
11022 Parsoid: Page property magic word with magic word contents
11023 !! options
11024 showtitle
11025 !! config
11026 wgAllowDisplayTitle=true
11027 wgRestrictDisplayTitle=false
11028 !! wikitext
11029 {{DISPLAYTITLE:''{{PAGENAME}}''}}
11030 !! html/php+tidy
11031 <i>Parser test</i>
11032
11033 !! html/parsoid
11034 <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>"}]]}'/>
11035 !! end
11036
11037 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
11038 # But, this is a limitation of our representation and is documented in
11039 # TemplateHandler.js in processSpecialMagicWord
11040 !! test
11041 Parsoid: Template-generated DISPLAYTITLE
11042 !! wikitext
11043 {{{{echo|DISPLAYTITLE}}:Foo}}
11044 !! options
11045 showtitle
11046 !! config
11047 wgAllowDisplayTitle=true
11048 wgRestrictDisplayTitle=false
11049 !! html/php
11050 Foo
11051
11052 !! html/parsoid
11053 <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"}]]}'/>
11054 !! end
11055
11056 !! test
11057 Namespace 1 {{ns:1}}
11058 !! wikitext
11059 {{ns:1}}
11060 !! html
11061 <p>Talk
11062 </p>
11063 !! end
11064
11065 !! test
11066 Namespace 1 {{ns:01}}
11067 !! wikitext
11068 {{ns:01}}
11069 !! html
11070 <p>Talk
11071 </p>
11072 !! end
11073
11074 !! test
11075 Namespace 0 {{ns:0}} (T6783)
11076 !! wikitext
11077 {{ns:0}}
11078 !! html
11079
11080 !! end
11081
11082 !! test
11083 Namespace 0 {{ns:00}} (T6783)
11084 !! wikitext
11085 {{ns:00}}
11086 !! html
11087
11088 !! end
11089
11090 !! test
11091 Namespace -1 {{ns:-1}}
11092 !! wikitext
11093 {{ns:-1}}
11094 !! html
11095 <p>Special
11096 </p>
11097 !! end
11098
11099 !! test
11100 Namespace User {{ns:User}}
11101 !! wikitext
11102 {{ns:User}}
11103 !! html
11104 <p>User
11105 </p>
11106 !! end
11107
11108 !! test
11109 Namespace User talk {{ns:User_talk}}
11110 !! wikitext
11111 {{ns:User_talk}}
11112 !! html
11113 <p>User talk
11114 </p>
11115 !! end
11116
11117 !! test
11118 Namespace User talk {{ns:uSeR tAlK}}
11119 !! wikitext
11120 {{ns:uSeR tAlK}}
11121 !! html
11122 <p>User talk
11123 </p>
11124 !! end
11125
11126 !! test
11127 Namespace File {{ns:File}}
11128 !! wikitext
11129 {{ns:File}}
11130 !! html
11131 <p>File
11132 </p>
11133 !! end
11134
11135 !! test
11136 Namespace File {{ns:Image}}
11137 !! wikitext
11138 {{ns:Image}}
11139 !! html
11140 <p>File
11141 </p>
11142 !! end
11143
11144 !! test
11145 Namespace (lang=de) Benutzer {{ns:User}}
11146 !! options
11147 language=de
11148 !! wikitext
11149 {{ns:User}}
11150 !! html
11151 <p>Benutzer
11152 </p>
11153 !! end
11154
11155 !! test
11156 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
11157 !! options
11158 language=de
11159 !! wikitext
11160 {{ns:3}}
11161 !! html
11162 <p>Benutzer Diskussion
11163 </p>
11164 !! end
11165
11166 !! test
11167 Urlencode
11168 !! wikitext
11169 {{urlencode:hi world?!}}
11170 {{urlencode:hi world?!|WIKI}}
11171 {{urlencode:hi world?!|PATH}}
11172 {{urlencode:hi world?!|QUERY}}
11173 !! html/php
11174 <p>hi+world%3F%21
11175 hi_world%3F!
11176 hi%20world%3F%21
11177 hi+world%3F%21
11178 </p>
11179 !! end
11180
11181 !! test
11182 Magic Word: prioritize type info over data-parsoid
11183 !! options
11184 parsoid=html2wt
11185 !! html/parsoid
11186 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
11187 !! wikitext
11188 __FORCETOC__
11189 !! end
11190
11191 !! test
11192 Magic Word: serialize on separate line (parsoid)
11193 !! options
11194 parsoid=wt2wt,html2wt
11195 !! wikitext
11196 foo
11197 __NOTOC__
11198 bar
11199 !! html/parsoid
11200 foo<meta property="mw:PageProp/notoc"/>bar
11201 !! end
11202
11203 !! test
11204 Magic Word: rt non-english wikis
11205 !! options
11206 parsoid=wt2wt
11207 language=de
11208 !! wikitext
11209 __NOEDITSECTION__
11210 !! html/parsoid
11211 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
11212 !! end
11213
11214 !!test
11215 __proto__ is treated as normal wikitext (T105997)
11216 !!wikitext
11217 __proto__
11218 !!html
11219 <p>__proto__
11220 </p>
11221 !!end
11222
11223 ###
11224 ### Magic links
11225 ###
11226 !! test
11227 Magic links: internal link to RFC (T2479)
11228 !! wikitext
11229 [[RFC 123]]
11230 !! html/php
11231 <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>
11232 </p>
11233 !! html/parsoid
11234 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
11235 !! end
11236
11237 !! test
11238 Magic links: RFC (T2479)
11239 !! wikitext
11240 RFC 822
11241 !! html/php
11242 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11243 </p>
11244 !! html/parsoid
11245 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
11246 !! end
11247
11248 !! test
11249 Magic links: RFC (T67278)
11250 !! wikitext
11251 This is RFC 822 but thisRFC 822 is not RFC 822linked.
11252 !! html/php
11253 <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.
11254 </p>
11255 !! html/parsoid
11256 <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>
11257 !! end
11258
11259 !! test
11260 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
11261 !! wikitext
11262 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
11263 RFC
11264 822
11265 !! html/php
11266 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11267 RFC
11268 822
11269 </p>
11270 !! html/parsoid
11271 <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>
11272 RFC
11273 822</p>
11274 !! end
11275
11276 !! test
11277 Magic links: ISBN (T3937)
11278 !! wikitext
11279 ISBN 0-306-40615-2
11280 !! html/php
11281 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
11282 </p>
11283 !! html/parsoid
11284 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
11285 !! end
11286
11287 !! test
11288 Magic links: ISBN (T67278)
11289 !! wikitext
11290 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11291 !! html/php
11292 <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.
11293 </p>
11294 !! html/parsoid
11295 <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>
11296 !! end
11297
11298 !! test
11299 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
11300 !! wikitext
11301 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
11302 ISBN
11303 9780316098113
11304 ISBN 978
11305 0316098113
11306 !! html/php
11307 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11308 ISBN
11309 9780316098113
11310 ISBN 978
11311 0316098113
11312 </p>
11313 !! html/parsoid
11314 <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>
11315 ISBN
11316 9780316098113
11317 ISBN 978
11318 0316098113</p>
11319 !! end
11320
11321 !! test
11322 Magic links: PMID incorrectly converts space to underscore
11323 !! wikitext
11324 PMID 1234
11325 !! html/php
11326 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11327 </p>
11328 !! html/parsoid
11329 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
11330 !! end
11331
11332 !! test
11333 Magic links: PMID (T67278)
11334 !! wikitext
11335 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11336 !! html/php
11337 <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.
11338 </p>
11339 !! html/parsoid
11340 <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>
11341 !! end
11342
11343 !! test
11344 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11345 !! wikitext
11346 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11347 PMID
11348 1234
11349 !! html/php
11350 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11351 PMID
11352 1234
11353 </p>
11354 !! html/parsoid
11355 <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>
11356 PMID
11357 1234</p>
11358 !! end
11359
11360 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11361 # since these are ExtLinkText, not MagicLinkText
11362 !! test
11363 Magic links: use appropriate serialization for "almost" magic links.
11364 !! wikitext
11365 X[[Special:BookSources/0978739256|foo]]
11366
11367 X[https://tools.ietf.org/html/rfc1234 foo]
11368 !! html/php
11369 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11370 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11371 </p>
11372 !! html/parsoid
11373 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11374 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11375 !! end
11376
11377 !! test
11378 Magic links: All disabled (T47942)
11379 !! options
11380 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11381 !! wikitext
11382 ISBN 0-306-40615-2
11383 PMID 1234
11384 RFC 4321
11385 !! html/php
11386 <p>ISBN 0-306-40615-2
11387 PMID 1234
11388 RFC 4321
11389 </p>
11390 !! end
11391
11392 ###
11393 ### Templates
11394 ####
11395
11396 !! test
11397 Nonexistent template
11398 !! wikitext
11399 {{thistemplatedoesnotexist}}
11400 !! html
11401 <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>
11402 </p>
11403 !! end
11404
11405 !! test
11406 Template with invalid target containing tags
11407 !! wikitext
11408 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11409 !! html
11410 <p>{{a<b>b</b>|foo|a=b|a = b}}
11411 </p>
11412 !! end
11413
11414 !! test
11415 Template with invalid target containing unclosed tag
11416 !! wikitext
11417 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11418 !! html
11419 <p>{{a<b>|foo|a=b|a = b}}</b>
11420 </p>
11421 !! end
11422
11423 !! test
11424 Template with invalid target containing wikilink
11425 !! wikitext
11426 {{[[Main Page]]}}
11427 !! html/php
11428 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11429 </p>
11430 !! html/parsoid
11431 <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>
11432 !! end
11433
11434 !! test
11435 Template with just whitespace in it, T70421
11436 !! wikitext
11437 {{echo|{{ }}}}
11438 !! html/parsoid
11439 <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>
11440 !! end
11441
11442 !! article
11443 Template:test
11444 !! text
11445 This is a test template
11446 !! endarticle
11447
11448 !! test
11449 Simple template
11450 !! wikitext
11451 {{test}}
11452 !! html
11453 <p>This is a test template
11454 </p>
11455 !! end
11456
11457 !! test
11458 Template with explicit namespace
11459 !! wikitext
11460 {{Template:test}}
11461 !! html
11462 <p>This is a test template
11463 </p>
11464 !! end
11465
11466
11467 !! article
11468 Template:paramtest
11469 !! text
11470 This is a test template with parameter {{{param}}}
11471 !! endarticle
11472
11473 !! test
11474 Template parameter
11475 !! wikitext
11476 {{paramtest|param=foo}}
11477 !! html
11478 <p>This is a test template with parameter foo
11479 </p>
11480 !! end
11481
11482 !! article
11483 Template:paramtestnum
11484 !! text
11485 [[{{{1}}}|{{{2}}}]]
11486 !! endarticle
11487
11488 !! test
11489 Template unnamed parameter
11490 !! wikitext
11491 {{paramtestnum|Main Page|the main page}}
11492 !! html
11493 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11494 </p>
11495 !! end
11496
11497 !! article
11498 Template:templatesimple
11499 !! text
11500 (test)
11501 !! endarticle
11502
11503 !! article
11504 Template:templateredirect
11505 !! text
11506 #redirect [[Template:templatesimple]]
11507 !! endarticle
11508
11509 !! article
11510 Template:templateasargtestnum
11511 !! text
11512 {{{{{1}}}}}
11513 !! endarticle
11514
11515 !! article
11516 Template:templateasargtest
11517 !! text
11518 {{template{{{templ}}}}}
11519 !! endarticle
11520
11521 !! article
11522 Template:templateasargtest2
11523 !! text
11524 {{{{{templ}}}}}
11525 !! endarticle
11526
11527 !! test
11528 Template with template name as unnamed argument
11529 !! wikitext
11530 {{templateasargtestnum|templatesimple}}
11531 !! html
11532 <p>(test)
11533 </p>
11534 !! end
11535
11536 !! test
11537 Template with template name as argument
11538 !! wikitext
11539 {{templateasargtest|templ=simple}}
11540 !! html
11541 <p>(test)
11542 </p>
11543 !! end
11544
11545 !! test
11546 Template with template name as argument (2)
11547 !! wikitext
11548 {{templateasargtest2|templ=templatesimple}}
11549 !! html
11550 <p>(test)
11551 </p>
11552 !! end
11553
11554 !! article
11555 Template:templateasargtestdefault
11556 !! text
11557 {{{{{templ|templatesimple}}}}}
11558 !! endarticle
11559
11560 !! article
11561 Template:templa
11562 !! text
11563 '''templ'''
11564 !! endarticle
11565
11566 !! test
11567 Template with default value
11568 !! wikitext
11569 {{templateasargtestdefault}}
11570 !! html
11571 <p>(test)
11572 </p>
11573 !! end
11574
11575 !! test
11576 Template with default value (value set)
11577 !! wikitext
11578 {{templateasargtestdefault|templ=templa}}
11579 !! html
11580 <p><b>templ</b>
11581 </p>
11582 !! end
11583
11584 !! test
11585 Template redirect
11586 !! wikitext
11587 {{templateredirect}}
11588 !! html/php
11589 <p>(test)
11590 </p>
11591 !! html/parsoid
11592 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11593 !! end
11594
11595 !! test
11596 Template with argument in separate line
11597 !! wikitext
11598 {{ templateasargtest |
11599 templ = simple }}
11600 !! html
11601 <p>(test)
11602 </p>
11603 !! end
11604
11605 !! test
11606 Template with complex template as argument
11607 !! wikitext
11608 {{paramtest|
11609 param ={{ templateasargtest |
11610 templ = simple }}}}
11611 !! html
11612 <p>This is a test template with parameter (test)
11613 </p>
11614 !! end
11615
11616 !! test
11617 Templates with templated name
11618 !! wikitext
11619 {{{{echo|echo}}|foo}}
11620 {{{{echo|inner list}} }}
11621 !! html
11622 <p>foo
11623 </p>
11624 <ul><li>item 1</li></ul>
11625
11626 !! html/parsoid
11627 <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>
11628 <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>
11629 !! end
11630
11631 ## Regression test; the output here isn't really that interesting.
11632 !! test
11633 Templates with templated name and top level template args
11634 !! wikitext
11635 {{1{{2{{{3}}}|4=5}}}}
11636 !! html/parsoid
11637 <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>
11638 !! end
11639
11640 # Parsoid markup is deliberate "broken". This is an edge case.
11641 # See long comment in TemplateHandler.js:convertAttribsToString.
11642 !! test
11643 Templates with invalid templated targets
11644 !! wikitext
11645 {{echo
11646 {{echo|foo}}
11647 }}
11648 !! html/php
11649 <p>{{echo
11650 foo
11651 }}
11652 </p>
11653 !! html/parsoid
11654 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11655 foo }}</p>
11656 !! end
11657
11658 !! test
11659 Template with thumb image (with link in description)
11660 !! wikitext
11661 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11662 !! html/php
11663 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>
11664
11665 !! html+tidy
11666 <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>
11667 !! html/parsoid
11668 <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>
11669 !! end
11670
11671 !! article
11672 Template:complextemplate
11673 !! text
11674 {{{1}}} {{paramtest|
11675 param ={{{param}}}}}
11676 !! endarticle
11677
11678 !! test
11679 Template with complex arguments
11680 !! wikitext
11681 {{complextemplate|
11682 param ={{ templateasargtest |
11683 templ = simple }}|[[Template:complextemplate|link]]}}
11684 !! html
11685 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11686 </p>
11687 !! end
11688
11689 !! test
11690 T2553: link with two variables in a piped link
11691 !! wikitext
11692 {|
11693 |[[{{{1}}}|{{{2}}}]]
11694 |}
11695 !! html/php
11696 <table>
11697 <tr>
11698 <td>[[{{{1}}}|{{{2}}}]]
11699 </td></tr></table>
11700
11701 !! html/parsoid
11702 <table>
11703 <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>
11704 </tbody></table>
11705 !! end
11706
11707 # See: T2553
11708 !! test
11709 Abort table cell attribute parsing on wikilink
11710 !! wikitext
11711 {|
11712 |testing [[one|two]] |three||four
11713 |testing one two |three||four
11714 |testing="[[one|two]]" |three||four
11715 |}
11716 !! html/php
11717 <table>
11718 <tr>
11719 <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>
11720 <td>four
11721 </td>
11722 <td>three</td>
11723 <td>four
11724 </td>
11725 <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>
11726 <td>four
11727 </td></tr></table>
11728
11729 !! html/parsoid
11730 <table>
11731 <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>
11732 <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>
11733 <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>
11734 </tbody></table>
11735 !! end
11736
11737 !! test
11738 Don't abort table cell attribute parsing if wikilink is found in template arg
11739 !! wikitext
11740 {|
11741 |Test {{#tag:ref|One two "[[three]]" four}}
11742 |}
11743 !! html/parsoid
11744 <table>
11745 <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>
11746 </tbody></table>
11747 !! end
11748
11749 !! test
11750 Magic variable as template parameter
11751 !! wikitext
11752 {{paramtest|param={{SITENAME}}}}
11753 !! html
11754 <p>This is a test template with parameter MediaWiki
11755 </p>
11756 !! end
11757
11758 !! article
11759 Template:linktest
11760 !! text
11761 [[{{{param}}}|link]]
11762 !! endarticle
11763
11764 !! test
11765 Template parameter as link source
11766 !! wikitext
11767 {{linktest|param=Main Page}}
11768 !! html
11769 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11770 </p>
11771 !! end
11772
11773 !!article
11774 Template:paramtest2
11775 !! text
11776 including another template, {{paramtest|param={{{arg}}}}}
11777 !! endarticle
11778
11779 !! test
11780 Template passing argument to another template
11781 !! wikitext
11782 {{paramtest2|arg='hmm'}}
11783 !! html
11784 <p>including another template, This is a test template with parameter 'hmm'
11785 </p>
11786 !! end
11787
11788 !! article
11789 Template:Linktest2
11790 !! text
11791 Main Page
11792 !! endarticle
11793
11794 !! test
11795 Template as link source
11796 !! wikitext
11797 [[{{linktest2}}]]
11798
11799 [[{{linktest2}}|Main Page]]
11800
11801 [[{{linktest2}}]]Page
11802 !! html
11803 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11804 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11805 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11806 </p>
11807 !! end
11808
11809
11810 !! article
11811 Template:loop1
11812 !! text
11813 {{loop2}}
11814 !! endarticle
11815
11816 !! article
11817 Template:loop2
11818 !! text
11819 {{loop1}}
11820 !! endarticle
11821
11822 !! test
11823 Template infinite loop
11824 !! wikitext
11825 {{loop1}}
11826 !! html
11827 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11828 </p>
11829 !! end
11830
11831 !! test
11832 Template from main namespace
11833 !! wikitext
11834 {{:Main Page}}
11835 !! html
11836 <p>blah blah
11837 </p>
11838 !! end
11839
11840 !! test
11841 Template from non-includable namespace
11842 !! options
11843 wgNonincludableNamespaces=10
11844 !! wikitext
11845 {{echo|uh oh!}}
11846 !! html
11847 <p><a href="/wiki/Template:Echo" title="Template:Echo">Template:Echo</a>
11848 </p>
11849 !! end
11850
11851 !! article
11852 Template:table
11853 !! text
11854 {|
11855 | 1 || 2
11856 |-
11857 | 3 || 4
11858 |}
11859 !! endarticle
11860
11861 !! test
11862 T2529: Template with table, not included at beginning of line
11863 !! wikitext
11864 foo {{table}}
11865 !! html
11866 <p>foo
11867 </p>
11868 <table>
11869 <tr>
11870 <td>1</td>
11871 <td>2
11872 </td></tr>
11873 <tr>
11874 <td>3</td>
11875 <td>4
11876 </td></tr></table>
11877
11878 !! end
11879
11880 !! test
11881 T2523: Template shouldn't eat newline (or add an extra one before table)
11882 !! wikitext
11883 foo
11884 {{table}}
11885 !! html
11886 <p>foo
11887 </p>
11888 <table>
11889 <tr>
11890 <td>1</td>
11891 <td>2
11892 </td></tr>
11893 <tr>
11894 <td>3</td>
11895 <td>4
11896 </td></tr></table>
11897
11898 !! end
11899
11900 !! test
11901 T2041: Template parameters shown as broken links
11902 !! wikitext
11903 {{{parameter}}}
11904 !! html
11905 <p>{{{parameter}}}
11906 </p>
11907 !! end
11908
11909 !! test
11910 Template with targets containing wikilinks
11911 !! options
11912 parsoid=wt2html
11913 !! wikitext
11914 {{[[foo]]}}
11915
11916 {{[[{{echo|foo}}]]}}
11917
11918 {{{{echo|[[foo}}]]}}
11919 !! html/php
11920 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11921 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11922 </p><p>{{[[foo}}]]
11923 </p>
11924 !! html/parsoid
11925 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11926 <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>
11927 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11928 !! end
11929
11930 !! article
11931 Template:''
11932 !! text
11933 bar
11934 !! endarticle
11935
11936 !! test
11937 Templates: Double quotes as template target
11938 !! wikitext
11939 foo {{''}} baz
11940 !! html/php
11941 <p>foo bar baz
11942 </p>
11943 !! html/parsoid
11944 <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
11945 </p>
11946 !! end
11947
11948 ## This test is about making sure Parsoid's data-mw is well formed in the
11949 ## face of multiple templates with intersecting and overlapping ranges. The
11950 ## wikitext itself is wretched.
11951 !! test
11952 Templates with intersecting and overlapping ranges
11953 !! wikitext
11954 {|{{echo|
11955 <p>ha</p>}}
11956 {|{{echo|
11957 <p>ho</p>}}
11958 {{echo|{{!}}hi}}
11959 |}
11960 !! html/php+tidy
11961 <p>ha</p><table>
11962
11963 </table><p>ho</p><table>
11964
11965 <tbody><tr>
11966 <td>hi
11967 </td></tr></tbody></table>
11968 !! html/parsoid
11969 <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":""}]]}'>
11970
11971 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11972
11973 <tbody><tr><td>hi</td></tr>
11974 </tbody></table>
11975 !! end
11976
11977 !! article
11978 Template:MSGNW test
11979 !! text
11980 ''None'' of '''this''' should be
11981 * interpreted
11982 but rather passed unmodified
11983 {{test}}
11984 <gallery>
11985 File:Foobar.jpg
11986 </gallery>
11987 <!-- comment -->
11988 !! endarticle
11989
11990 # hmm, fix this or just deprecate msgnw and document its behavior?
11991 !! test
11992 msgnw keyword
11993 !! wikitext
11994 {{msgnw:MSGNW test}}
11995 !! html/php
11996 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11997 &#42; interpreted
11998 &#32;but rather passed unmodified
11999 &#123;&#123;test&#125;&#125;
12000 &#60;gallery&#62;
12001 File:Foobar.jpg
12002 &#60;/gallery&#62;
12003 &#60;!-- comment --&#62;
12004 </p>
12005 !! end
12006
12007 !! test
12008 int keyword
12009 !! wikitext
12010 {{int:youhavenewmessages|lots of money|not!}}
12011 !! html
12012 <p>You have lots of money (not!).
12013 </p>
12014 !! end
12015
12016 !! test
12017 int keyword - non-existing message
12018 !! wikitext
12019 {{int:var}}
12020 !! html
12021 <p>⧼var⧽
12022 </p>
12023 !! end
12024
12025 !! article
12026 Template:Includes
12027 !! text
12028 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
12029 !! endarticle
12030
12031 !! test
12032 <includeonly> and <noinclude> being included
12033 !! wikitext
12034 {{Includes}}
12035 !! html
12036 <p>Foobar
12037 </p>
12038 !! end
12039
12040 !! article
12041 Template:Includes2
12042 !! text
12043 <onlyinclude>Foo</onlyinclude>bar
12044 !! endarticle
12045
12046 !! test
12047 <onlyinclude> being included
12048 !! wikitext
12049 {{Includes2}}
12050 !! html
12051 <p>Foo
12052 </p>
12053 !! end
12054
12055
12056 !! article
12057 Template:Includes3
12058 !! text
12059 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
12060 !! endarticle
12061
12062 !! test
12063 <onlyinclude> and <includeonly> being included
12064 !! wikitext
12065 {{Includes3}}
12066 !! html
12067 <p>Foo
12068 </p>
12069 !! end
12070
12071 !! test
12072 <includeonly> and <noinclude> on a page
12073 !! wikitext
12074 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
12075 !! html
12076 <p>Foozar
12077 </p>
12078 !! end
12079
12080 !! test
12081 Un-closed <noinclude>
12082 !! wikitext
12083 <noinclude>
12084 !! html
12085 !! end
12086
12087 !! test
12088 <onlyinclude> on a page
12089 !! wikitext
12090 <onlyinclude>Foo</onlyinclude>bar
12091 !! html
12092 <p>Foobar
12093 </p>
12094 !! end
12095
12096 !! test
12097 Un-closed <onlyinclude>
12098 !! wikitext
12099 <onlyinclude>
12100 !! html
12101 !! end
12102
12103 !!test
12104 Self-closed noinclude, includeonly, onlyinclude tags
12105 !! wikitext
12106 <noinclude />
12107 <includeonly />
12108 <onlyinclude />
12109 !! html
12110 <p><br />
12111 </p>
12112 !!end
12113
12114 !!test
12115 Unbalanced includeonly and noinclude tags
12116 !! wikitext
12117 {|
12118 |a</noinclude>
12119 |b</noinclude></noinclude>
12120 |c</noinclude></includeonly>
12121 |d</includeonly></includeonly>
12122 |}
12123 !! html
12124 <table>
12125 <tr>
12126 <td>a
12127 </td>
12128 <td>b
12129 </td>
12130 <td>c&lt;/includeonly&gt;
12131 </td>
12132 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
12133 </td></tr></table>
12134
12135 !!end
12136
12137 !! article
12138 Template:Includeonly section
12139 !! text
12140 <includeonly>
12141 ==Includeonly section==
12142 </includeonly>
12143 ==Section T-1==
12144 !!endarticle
12145
12146 !! test
12147 T8563: Edit link generation for section shown by <includeonly>
12148 !! wikitext
12149 {{includeonly section}}
12150 !! html
12151 <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>
12152 <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>
12153
12154 !! end
12155
12156 # Uses same input as the contents of [[Template:Includeonly section]]
12157 !! test
12158 T8563: Section extraction for section shown by <includeonly>
12159 !! options
12160 section=T-2
12161 !! wikitext
12162 <includeonly>
12163 ==Includeonly section==
12164 </includeonly>
12165 ==Section T-2==
12166 !! html
12167 ==Section T-2==
12168 !! end
12169
12170 !! test
12171 T8563: Edit link generation for section suppressed by <includeonly>
12172 !! wikitext
12173 <includeonly>
12174 ==Includeonly section==
12175 </includeonly>
12176 ==Section 1==
12177 !! html
12178 <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>
12179
12180 !! end
12181
12182 !! test
12183 T8563: Section extraction for section suppressed by <includeonly>
12184 !! options
12185 section=1
12186 !! wikitext
12187 <includeonly>
12188 ==Includeonly section==
12189 </includeonly>
12190 ==Section 1==
12191 !! html
12192 ==Section 1==
12193 !! end
12194
12195 !! test
12196 Un-closed <includeonly>
12197 !! wikitext
12198 <includeonly>
12199 !! html/php
12200 !! html/parsoid
12201 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}' data-mw='{"src":"&lt;includeonly>"}'/>
12202 !! end
12203
12204 ## We used to, but no longer wt2wt this test since the default serializer
12205 ## will normalize the include directives to serialize on their own line.
12206 ## Selser will take care of preserving formatting in scenarios where they
12207 ## intermingled with other wikitext.
12208 !! test
12209 Includes and comments at SOL
12210 !! options
12211 parsoid=wt2html,html2html
12212 !! wikitext
12213 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
12214
12215 <noinclude>
12216 some
12217 </noinclude>*stuff
12218 *here
12219
12220 <noinclude>
12221 some</noinclude>* stuff
12222 * here
12223
12224 <includeonly>can have stuff</includeonly>===here===
12225
12226 !! html/php
12227 <h2><span class="mw-headline" id="hu">hu</span></h2>
12228 <p>some
12229 </p>
12230 <ul><li>stuff</li>
12231 <li>here</li></ul>
12232 <p><br />
12233 some* stuff
12234 </p>
12235 <ul><li>here</li></ul>
12236 <h3><span class="mw-headline" id="here">here</span></h3>
12237
12238 !! html/parsoid
12239 <!-- 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>
12240
12241 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12242 <p>some</p>
12243 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
12244 <li>here</li></ul>
12245
12246 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12247 <p>some<meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>* stuff</p>
12248 <ul><li>here</li></ul>
12249
12250 <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>
12251
12252 !! end
12253
12254 # TODO: test with DOM fragment reuse!
12255 !! test
12256 Parsoid: DOM fragment reuse
12257 !! options
12258 parsoid=wt2wt,wt2html
12259 !! wikitext
12260 a{{echo|b<table></table>c}}d
12261
12262 a{{echo|b
12263 <table></table>
12264 c}}d
12265
12266 {{echo|a
12267
12268 <table></table>
12269
12270 b}}
12271 !! html/php+tidy
12272 <p>ab</p><table></table><p>cd
12273 </p><p>ab
12274 </p>
12275 <table></table>
12276 <p>cd
12277 </p><p>a
12278 </p>
12279 <table></table>
12280 <p>b
12281 </p>
12282 !! html/parsoid
12283 <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>
12284
12285 <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">
12286 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
12287 </span><p about="#mwt2">cd</p>
12288
12289 <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">
12290
12291 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
12292
12293 </span><p about="#mwt3">b</p>
12294 !! end
12295
12296 !! test
12297 Parsoid: Merge double tds (T52603)
12298 !! wikitext
12299 {|
12300 |{{echo|{{!}} foo}}
12301 |}
12302 !! html/php+tidy
12303 <table>
12304 <tbody><tr>
12305 <td>foo
12306 </td></tr></tbody></table>
12307 !! html/parsoid
12308 <table><tbody>
12309 <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>
12310 </tbody></table>
12311 !! end
12312
12313 !! test
12314 Parsoid: Merge double tds in nested transclusion content (T52603)
12315 !! wikitext
12316 {{echo|<div>}}
12317 {|
12318 |{{echo|{{!}} foo}}
12319 |}
12320 {{echo|</div>}}
12321 !! html/php+tidy
12322 <div>
12323 <table>
12324 <tbody><tr>
12325 <td>foo
12326 </td></tr></tbody></table>
12327 </div>
12328 !! html/parsoid
12329 <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}}]}'>
12330 <table><tbody>
12331 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
12332 </tbody></table>
12333 </div>
12334 !! end
12335
12336 ###
12337 ### <includeonly> and <noinclude> in attributes
12338 ###
12339 !!test
12340 0. includeonly around the entire attribute
12341 !! wikitext
12342 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12343 !! html
12344 <p><span id="v2">bar</span>
12345 </p>
12346 !!end
12347
12348 !!test
12349 1. includeonly in html attr key
12350 !! wikitext
12351 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12352 !! html
12353 <p><span id="foo">bar</span>
12354 </p>
12355 !!end
12356
12357 !!test
12358 2. includeonly in html attr value
12359 !! wikitext
12360 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12361 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12362 !! html
12363 <p><span id="v1">bar</span>
12364 <span id="v1">bar</span>
12365 </p>
12366 !!end
12367
12368 !!test
12369 3. includeonly in part of an attr value
12370 !! wikitext
12371 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12372 !! html
12373 <p><span style="color:red;">bar</span>
12374 </p>
12375 !!end
12376
12377 !!test
12378 4. includeonly in table attributes
12379 !! wikitext
12380 {|
12381 |- <noinclude>
12382 |-
12383 |a
12384 </noinclude>
12385 |- <includeonly>
12386 |-
12387 |b
12388 </includeonly>
12389 |}
12390 !! html
12391 <table>
12392
12393
12394 <tr>
12395 <td>a
12396 </td></tr>
12397 </table>
12398
12399 !!end
12400
12401 ###
12402 ### Preprocessor precedence tests
12403 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12404 ###
12405 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12406 !! test
12407 Preprocessor precedence 1: link is rightmost opening
12408 !! options
12409 parsoid=wt2html
12410 !! wikitext
12411 {{[[Foo|bar}}]]
12412
12413 But close-brace is not a valid character in a link title:
12414 {{[[Foo}}|bar]]
12415
12416 However, we can still tell this was handled as a link in the preprocessor:
12417 {{echo|[[Foo}}|bar]]|bat}}
12418 !! html/php
12419 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12420 </p><p>But close-brace is not a valid character in a link title:
12421 {{[[Foo}}|bar]]
12422 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12423 [[Foo}}|bar]]
12424 </p>
12425 !! html/parsoid
12426 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12427 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12428 <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>
12429 !! end
12430
12431 !! test
12432 Preprocessor precedence 2: template is rightmost opening
12433 !! options
12434 language=zh
12435 !! wikitext
12436 -{{echo|foo}-}}-
12437 !! html/php
12438 <p>-foo}--
12439 </p>
12440 !! html/parsoid
12441 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12442 !! end
12443
12444 !! test
12445 Preprocessor precedence 3: language converter is rightmost opening
12446 !! options
12447 language=zh
12448 parsoid=wt2html
12449 !! wikitext
12450 {{echo|hi}}
12451
12452 {{-{R|echo|hi}}}-
12453
12454 [[-{R|raw]]}-
12455 !! html/php
12456 <p>hi
12457 </p><p>{{echo|hi}}
12458 </p><p>[[raw]]
12459 </p>
12460 !! html/parsoid
12461 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12462 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12463 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12464 !! end
12465
12466 !! test
12467 Preprocessor precedence 4: left-most angle bracket
12468 !! options
12469 language=zh
12470 !! wikitext
12471 <!--{raw}-->
12472 !! html/php
12473 !! html/parsoid
12474 <!--{raw}-->
12475 !! end
12476
12477 !! article
12478 Template:Precedence5
12479 !! text
12480 {{{{{1}}}}}
12481 !! endarticle
12482
12483 !! test
12484 Preprocessor precedence 5: tplarg takes precedence over template
12485 !! wikitext
12486 {{Precedence5|Bullet}}
12487 !! html/php
12488 <ul><li>Bar</li></ul>
12489
12490 !! html/parsoid
12491 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12492 !! end
12493
12494 !! test
12495 Preprocessor precedence 6: broken link is rightmost opening
12496 !! options
12497 parsoid=wt2html
12498 !! wikitext
12499 {{echo|[[Foo}}
12500
12501 {{echo|[[Foo|bar|bat=baz}}
12502 !! html/php
12503 <p>{{echo|[[Foo}}
12504 </p><p>{{echo|[[Foo|bar|bat=baz}}
12505 </p>
12506 !! html/parsoid
12507 <p>{{echo|[[Foo}}</p>
12508 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12509 !! end
12510
12511 # This next test exposes a difference between PHP and Parsoid:
12512 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12513 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12514 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12515 # outer `[[Foo` extends until the `y]]`
12516 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12517 # intermediate result (after template expansion), and link processing
12518 # happens on this intermediate result, which moves the wikilink
12519 # boundary leftward to `[[Foo|Bar]]`
12520 # 2b) Parsoid works in a single step, so it's going to keep the
12521 # wikilink as extending to the `y]]`
12522 # 3a) Then PHP does linktrail processing which slurps up the trailing
12523 # `xy` inside the link.
12524 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12525 # `z` inside the link.
12526 # This is "correct" behavior. Parsoid's basic worldview is that the
12527 # `]]` inside the template shouldn't be allowed to leak out to affect
12528 # the surrounding wikilink. PHP may match Parsoid (in the future)
12529 # if you use {{#balance}} (T114445).
12530
12531 !! test
12532 Preprocessor precedence 7: broken template is rightmost opening
12533 !! options
12534 parsoid=wt2html
12535 !! wikitext
12536 [[Foo|{{echo|Bar]]
12537
12538 [[Foo|{{echo|Bar]]-x}}-y]]-z
12539
12540 Careful: linktrails can move the end of the wikilink:
12541 [[Foo|{{echo|y']]a}}l]]l
12542 !! html/php
12543 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12544 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12545 </p><p>Careful: linktrails can move the end of the wikilink:
12546 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12547 </p>
12548 !! html/parsoid
12549 <p>[[Foo|{{echo|Bar]]</p>
12550 <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>
12551 <p>Careful: linktrails can move the end of the wikilink:
12552 <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>
12553 !! end
12554
12555 !! test
12556 Preprocessor precedence 8: broken language converter is rightmost opening
12557 !! options
12558 language=zh
12559 !! wikitext
12560 [[Foo-{R|raw]]
12561 !! html
12562 <p>[[Foo-{R|raw]]
12563 </p>
12564 !! end
12565
12566 !! article
12567 Template:Preprocessor_precedence_9
12568 !! text
12569 ;4: {{{{1}}}}
12570 ;5: {{{{{2}}}}}
12571 ;6: {{{{{{3}}}}}}
12572 ;7: {{{{{{{4}}}}}}}
12573 !! endarticle
12574
12575 !! test
12576 Preprocessor precedence 9: groups of braces
12577 !! wikitext
12578 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12579 !! html/php
12580 <dl><dt>4</dt>
12581 <dd>{Four}</dd>
12582 <dt>5</dt>
12583 <dd></dd></dl>
12584 <ul><li>Bar</li></ul>
12585 <dl><dt>6</dt>
12586 <dd>Four</dd>
12587 <dt>7</dt>
12588 <dd>{Bullet}</dd></dl>
12589
12590 !! html/parsoid
12591 <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}}]}'>
12592 <dt>4</dt>
12593 <dd>{Four}</dd>
12594 <dt>5</dt>
12595 <dd></dd>
12596 </dl><ul about="#mwt1">
12597 <li>Bar</li>
12598 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12599 <dt>6</dt>
12600 <dd>Four</dd>
12601 <dt>7</dt>
12602 <dd>{Bullet}</dd>
12603 </dl>
12604 !! end
12605
12606 !! article
12607 Template:Preprocessor_precedence_10
12608 !! text
12609 ;1: -{R|raw}-
12610 ;2: -{{Bullet}}-
12611 ;3: -{{{1}}}-
12612 ;4: -{{{{2}}}}-
12613 ;5: -{{{{{3}}}}}-
12614 ;6: -{{{{{{4}}}}}}-
12615 ;7: -{{{{{{{5}}}}}}}-
12616 !! endarticle
12617
12618 !! test
12619 Preprocessor precedence 10: groups of braces with leading dash
12620 !! options
12621 language=zh
12622 !! wikitext
12623 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12624 !! html/php
12625 <dl><dt>1</dt>
12626 <dd>raw</dd>
12627 <dt>2</dt>
12628 <dd>-</dd></dl>
12629 <ul><li>Bar-</li></ul>
12630 <dl><dt>3</dt>
12631 <dd>-Three-</dd>
12632 <dt>4</dt>
12633 <dd>raw2</dd>
12634 <dt>5</dt>
12635 <dd>-</dd></dl>
12636 <ul><li>Bar-</li></ul>
12637 <dl><dt>6</dt>
12638 <dd>-Three-</dd>
12639 <dt>7</dt>
12640 <dd>raw2</dd></dl>
12641
12642 !! html/parsoid
12643 <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}}]}'>
12644 <dt>1</dt>
12645 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12646 <dt>2</dt>
12647 <dd>-</dd>
12648 </dl><ul about="#mwt1">
12649 <li>Bar-</li>
12650 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12651 <dt>3</dt>
12652 <dd>-Three-</dd>
12653 <dt>4</dt>
12654 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12655 <dt>5</dt>
12656 <dd>-</dd>
12657 </dl><ul about="#mwt1">
12658 <li>Bar-</li>
12659 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12660 <dt>6</dt>
12661 <dd>-Three-</dd>
12662 <dt>7</dt>
12663 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12664 </dl>
12665 !! end
12666
12667 !! test
12668 Preprocessor precedence 11: found during visual diff testing
12669 !! wikitext
12670 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12671
12672 {{echo|-{{echo|-{{echo|x}}}}}}
12673
12674 {{echo|-{{echo|x}}}}
12675 !! html/php
12676 <p><span>-<span>-x</span></span>
12677 </p><p>--x
12678 </p><p>-x
12679 </p>
12680 !! html/parsoid
12681 <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>
12682
12683 <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>
12684
12685 <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>
12686 !! end
12687
12688 !! test
12689 Preprocessor precedence 12: broken language converter closed by brace.
12690 !! options
12691 parsoid=wt2html
12692 !! wikitext
12693 This form breaks the template, which is unfortunate:
12694 *{{echo|foo-{bar}bat}}
12695
12696 But if the broken language converter markup is inside an extension
12697 tag, nothing bad happens:
12698 *<nowiki>foo-{bar}bat</nowiki>
12699 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12700 *<pre>foo-{bar}bat</pre>
12701 *{{echo|<pre>foo-{bar}bat</pre>}}
12702
12703 <tag>foo-{bar}bat</tag>
12704 {{echo|<tag>foo-{bar}bat</tag>}}
12705
12706 !! html/php+tidy
12707 <p>This form breaks the template, which is unfortunate:
12708 </p>
12709 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12710 <p>But if the broken language converter markup is inside an extension
12711 tag, nothing bad happens:
12712 </p>
12713 <ul><li>foo-&#123;bar}bat</li>
12714 <li>foo-&#123;bar}bat</li>
12715 <li><pre>foo-{bar}bat</pre></li>
12716 <li><pre>foo-{bar}bat</pre></li></ul>
12717 <pre>'foo-{bar}bat'
12718 array (
12719 )
12720 </pre>
12721 <pre>'foo-{bar}bat'
12722 array (
12723 )
12724 </pre>
12725 !! html/parsoid
12726 <p>This form breaks the template, which is unfortunate:</p>
12727 <ul>
12728 <li>{{echo|foo-{bar}bat}}</li>
12729 </ul>
12730 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12731 <ul>
12732 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12733 <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>
12734 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12735 <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>
12736 </ul>
12737 <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>
12738 !! end
12739
12740 !! test
12741 Preprocessor precedence 13: broken language converter in external link
12742 !! options
12743 parsoid=wt2html
12744 !! wikitext
12745 *[http://example.com/-{foo Example in URL]
12746 *[http://example.com Example in -{link} description]
12747 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12748 !! html/php+tidy
12749 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12750 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12751 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12752 !! html/parsoid
12753 <ul>
12754 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12755 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12756 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12757 </ul>
12758 !! end
12759
12760 !! test
12761 Preprocessor precedence 14: broken language converter in comment
12762 !! wikitext
12763 *<!--{{foo}}-->...should be ok
12764 *<!---{{foo}}-->...extra dashes
12765 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12766 !! html/php+tidy
12767 <ul><li>...should be ok</li>
12768 <li>...extra dashes</li>
12769 <li>foobat...should be ok</li></ul>
12770 !! html/parsoid
12771 <ul>
12772 <li><!--{{foo}}-->...should be ok</li>
12773 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12774 <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>
12775 </ul>
12776 !! end
12777
12778 !! test
12779 Preprocessor precedence 15: broken brace markup in headings
12780 !! config
12781 wgFragmentMode=[ 'html5', 'legacy' ]
12782 !! options
12783 parsoid=wt2html
12784 !! wikitext
12785 __NOTOC__ __NOEDITSECTION__
12786 ===1 foo[bar 1===
12787 1
12788 ===2 foo[[bar 2===
12789 2
12790 ===3 foo{bar 3===
12791 3
12792 ===4 foo{{bar 4===
12793 4
12794 ===5 foo{{{bar 5===
12795 5
12796 ===6 foo-{bar 6===
12797 6
12798 !! html/php+tidy
12799 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12800 <p>1
12801 </p>
12802 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12803 <p>2
12804 </p>
12805 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12806 <p>3
12807 </p>
12808 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12809 <p>4
12810 </p>
12811 <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>
12812 <p>5
12813 </p>
12814 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12815 <p>6
12816 </p>
12817 !! html/parsoid
12818 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12819 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12820 <p>1</p>
12821 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12822 <p>2</p>
12823 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12824 <p>3</p>
12825 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12826 <p>4</p>
12827 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12828 <p>5</p>
12829 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12830 <p>6</p>
12831 !! end
12832
12833 !! test
12834 Preprocessor precedence 16: matching closing braces to opening braces
12835 !! options
12836 language=zh
12837 parsoid=wt2html
12838 !! wikitext
12839 -{{{echo|foo}}bar}-
12840 !! html/php
12841 <p>foobar
12842 </p>
12843 !! html/parsoid
12844 <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>
12845 !! end
12846
12847 !! test
12848 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12849 !! options
12850 parsoid=wt2html
12851 !! wikitext
12852 {{echo|hi {{}}}}
12853 !! html/php
12854 <p>hi {{}}
12855 </p>
12856 !! html/parsoid
12857 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12858 !! end
12859
12860 # Ensure we're using a language without variants for this test; even
12861 # if $wgUsePigLatinVariant is true. We've picked `de` arbitrarily.
12862 !! test
12863 Preprocessor precedence 18: another rightmost wins scenario
12864 !! options
12865 parsoid=wt2html
12866 language=de
12867 !! wikitext
12868 {{ -{{{{1|tplarg}}} }} }-
12869 !! html/php
12870 <p>{{ -{tplarg }} }-
12871 </p>
12872 !! html/parsoid
12873 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12874 !! end
12875
12876 !! test
12877 Preprocessor precedence 19: break syntax
12878 !! options
12879 parsoid=wt2html
12880 !! wikitext
12881 -{{
12882 !! html/php
12883 <p>-{{
12884 </p>
12885 !! html/parsoid
12886 <p>-{{</p>
12887 !! end
12888
12889 ###
12890 ### Token Stream Patcher tests
12891 ###
12892 ### These tests won't always pass wt2wt and other modes because
12893 ### on serialization, the table will be output on a new line.
12894 ### For now, we are blacklisting them, and using this to test selser.
12895 ###
12896
12897 !!test
12898 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12899 !!options
12900 parsoid=wt2html,wt2wt
12901 !!wikitext
12902 {{echo|}}{| width = '100%'
12903 |foo
12904 |}
12905 !!html/parsoid
12906 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12907 <tbody><tr><td>foo</td></tr>
12908 </tbody></table>
12909 !!end
12910
12911 ## We used to, but no longer wt2wt this test since the default serializer
12912 ## will normalize the include directives to serialize on their own line.
12913 ## Selser will take care of preserving formatting in scenarios where they
12914 ## intermingled with other wikitext.
12915 !!test
12916 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12917 !!options
12918 parsoid=wt2html
12919 !!wikitext
12920 <includeonly>a</includeonly>{| {{{b}}}
12921 |c
12922 |}
12923 !!html/parsoid
12924 <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":""}]]}'>
12925 <tbody><tr><td>c</td></tr>
12926 </tbody></table>
12927 !!end
12928
12929 !! test
12930 Table wikitext syntax outside wiki-tables
12931 !! wikitext
12932 a
12933 |+ not a caption
12934 ! not a table heading
12935 |- not a table row
12936 | not a table cell
12937 | class="foo bar" | baz
12938 b
12939 |}
12940 |-
12941 c
12942 !! html
12943 <p>a
12944 |+ not a caption
12945 ! not a table heading
12946 |- not a table row
12947 | not a table cell
12948 | class="foo bar" | baz
12949 b
12950 |}
12951 |-
12952 c
12953 </p>
12954 !! end
12955
12956 ###
12957 ### Testing parsing of templates where a template arg
12958 ### has the same name as the template itself.
12959 ###
12960
12961 !! article
12962 Template:quote
12963 !! text
12964 {{{quote|{{{1}}}}}}
12965 !! endarticle
12966
12967 !!test
12968 Templates: Template Name/Arg clash: 1. Use of positional param
12969 !! wikitext
12970 {{quote|foo}}
12971 !! html
12972 <p>foo
12973 </p>
12974 !!end
12975
12976 !!test
12977 Templates: Template Name/Arg clash: 2. Use of named param
12978 !! wikitext
12979 {{quote|quote=foo}}
12980 !! html
12981 <p>foo
12982 </p>
12983 !!end
12984
12985 !!test
12986 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12987 !! wikitext
12988 {{quote|quote}}
12989 !! html
12990 <p>quote
12991 </p>
12992 !!end
12993
12994 ###
12995 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12996 ###
12997
12998 !!test
12999 Templates: 1. Simple use
13000 !! wikitext
13001 {{echo|Foo}}
13002 !! html
13003 <p>Foo
13004 </p>
13005 !!end
13006
13007 !!test
13008 Templates: 2. Inside a block tag
13009 !! wikitext
13010 <div>{{echo|Foo}}</div>
13011 <blockquote>{{echo|Foo}}</blockquote>
13012 !! html
13013 <div>Foo</div>
13014 <blockquote>Foo</blockquote>
13015
13016 !! html+tidy
13017 <div>Foo</div>
13018 <blockquote><p>Foo</p></blockquote>
13019 !!end
13020
13021 !!test
13022 Templates: P-wrapping: 1a. Templates on consecutive lines
13023 !! wikitext
13024 {{echo|Foo}}
13025 {{echo|bar}}
13026 !! html
13027 <p>Foo
13028 bar
13029 </p>
13030 !!end
13031
13032 !!test
13033 Templates: P-wrapping: 1b. Templates on consecutive lines
13034 !! wikitext
13035 Foo
13036
13037 {{echo|bar}}
13038 {{echo|baz}}
13039 !! html
13040 <p>Foo
13041 </p><p>bar
13042 baz
13043 </p>
13044 !!end
13045
13046 !!test
13047 Templates: P-wrapping: 1c. Templates on consecutive lines
13048 !! wikitext
13049 {{echo|Foo}}
13050 {{echo|bar}} <div>baz</div>
13051 !! html
13052 <p>Foo
13053 </p>
13054 bar <div>baz</div>
13055
13056 !! html+tidy
13057 <p>Foo
13058 </p><p>
13059 bar </p><div>baz</div>
13060 !! end
13061
13062 !! test
13063 Templates: P-wrapping: 1d. Template preceded by comment-only line
13064 !! wikitext
13065 <!-- foo -->
13066 {{echo|Bar}}
13067 !! html/php+tidy
13068 <p>Bar
13069 </p>
13070 !! html/parsoid
13071 <!-- foo -->
13072
13073 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
13074 !!end
13075
13076 !! test
13077 Templates: Scopes should not be expanded unnecessarily
13078 !! options
13079 parsoid=wt2html,wt2wt
13080 !! wikitext
13081 {{echo|<div>a</div>}}b{{echo|
13082 <div>c</div>}}
13083 !! html/php+tidy
13084 <div>a</div><p>b
13085 </p><div>c</div>
13086 !! html/parsoid
13087 <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}}]}'>
13088 </span><div about="#mwt2">c</div>
13089 !! end
13090
13091 !!test
13092 Templates: Inline Text: 1. Multiple template uses
13093 !! wikitext
13094 {{echo|Foo}}bar{{echo|baz}}
13095 !! html
13096 <p>Foobarbaz
13097 </p>
13098 !!end
13099
13100 !!test
13101 Templates: Inline Text: 2. Back-to-back template uses
13102 !! wikitext
13103 {{echo|Foo}}{{echo|bar}}
13104 !! html
13105 <p>Foobar
13106 </p>
13107 !!end
13108
13109 !!test
13110 Templates: Block Tags: 1. Multiple template uses
13111 !! wikitext
13112 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
13113 !! html
13114 <div>Foo</div><div>bar</div><div>baz</div>
13115
13116 !!end
13117
13118 !!test
13119 Templates: Block Tags: 2. Back-to-back template uses
13120 !! wikitext
13121 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
13122 !! html
13123 <div>Foo</div><div>bar</div>
13124
13125 !!end
13126
13127 ## Parsoid drops empty elements in templates.
13128 !! test
13129 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
13130 !! wikitext
13131 {{echo|a
13132 b</p>}}
13133 !! html/php+tidy
13134 <p>a
13135 </p><p>
13136 b</p><p class="mw-empty-elt"></p>
13137 !! html/parsoid
13138 <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">
13139 </span><p about="#mwt1">b</p>
13140 !! end
13141
13142 !!test
13143 Templates: Links: 1. Simple example
13144 !! wikitext
13145 {{echo|[[Foo|bar]]}}
13146 !! html
13147 <p><a href="/wiki/Foo" title="Foo">bar</a>
13148 </p>
13149 !!end
13150
13151 !!test
13152 Templates: Links: 2. Generation of link href
13153 !! wikitext
13154 [[{{echo|Foo}}|bar]]
13155 !! html
13156 <p><a href="/wiki/Foo" title="Foo">bar</a>
13157 </p>
13158 !!end
13159
13160 !!test
13161 Templates: Links: 3. Generation of part of a link href
13162 !! wikitext
13163 [[Fo{{echo|o}}|bar]]
13164
13165 [[Foo{{echo|bar}}]]
13166
13167 [[Foo{{echo|bar}}baz]]
13168
13169 [[Foo{{echo|bar}}|bar]]
13170
13171 [[:Foo{{echo|bar}}]]
13172
13173 [[:Foo{{echo|bar}}|bar]]
13174 !! html
13175 <p><a href="/wiki/Foo" title="Foo">bar</a>
13176 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13177 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
13178 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13179 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13180 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13181 </p>
13182 !!end
13183
13184 !!test
13185 Templates: Links: 4. Multiple templates generating link href
13186 !! wikitext
13187 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
13188 !! html
13189 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13190 </p>
13191 !!end
13192
13193 !!test
13194 Templates: Links: 5. Generation of link text
13195 !! wikitext
13196 [[Foo|{{echo|bar}}]]
13197 !! html
13198 <p><a href="/wiki/Foo" title="Foo">bar</a>
13199 </p>
13200 !!end
13201
13202 !!test
13203 Templates: Links: 5. Nested templates (only outermost template should be marked)
13204 !! wikitext
13205 {{echo|[[{{echo|Foo}}|bar]]}}
13206 !! html
13207 <p><a href="/wiki/Foo" title="Foo">bar</a>
13208 </p>
13209 !!end
13210
13211 !!test
13212 Templates: HTML Tag: 1. Generation of HTML attr. key
13213 !! wikitext
13214 <div {{echo|style}}="color:red;">foo</div>
13215 !! html
13216 <div style="color:red;">foo</div>
13217
13218 !!end
13219
13220 !!test
13221 Templates: HTML Tag: 2. Generation of HTML attr. value
13222 !! wikitext
13223 <div style={{echo|'color:red;'}}>foo</div>
13224 !! html
13225 <div style="color:red;">foo</div>
13226
13227 !!end
13228
13229 !!test
13230 Templates: HTML Tag: 3. Generation of HTML attr key and value
13231 !! wikitext
13232 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
13233 !! html
13234 <div style="color:red;">foo</div>
13235
13236 !!end
13237
13238 !!test
13239 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
13240 !! wikitext
13241 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
13242 !! html
13243 <div title="This is a long title with just one piece templated">foo</div>
13244
13245 !!end
13246
13247 !!test
13248 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
13249 !! wikitext
13250 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
13251 !! html
13252 <div title="This is a long title with just one piece templated">foo</div>
13253
13254 !!end
13255
13256 !!test
13257 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
13258 !! wikitext
13259 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
13260 !! html
13261 <div title="This is a long title with just one piece templated">foo</div>
13262
13263 !!end
13264
13265 # SSS FIXME: While it is great we added support for all this,
13266 # do we want to make this part of the spec? Maybe we want to
13267 # deprecate this kind of usage in the future?
13268 !!test
13269 Templates: HTML Tag: 7. Generation of partial attribute key string
13270 !! wikitext
13271 <div st{{echo|yle}}="color:red;">foo</div>
13272 !! html
13273 <div style="color:red;">foo</div>
13274
13275 !!end
13276
13277 !! test
13278 Templates: HTML Tag: 8. Template-generated attribute (k=v)
13279 !! wikitext
13280 <div {{echo|1=id="v1"}}>bar</div>
13281 !! html
13282 <div id="v1">bar</div>
13283
13284 !!end
13285
13286 !! test
13287 Templates: HTML Tag: 9. Multiple template-generated attributes
13288 !! wikitext
13289 <div {{echo|1=id="v1" title="foo"}}>bar</div>
13290 !! html
13291 <div id="v1" title="foo">bar</div>
13292
13293 !!end
13294
13295 !! test
13296 Templates: Support for templates generating attributes and content
13297 !! wikitext
13298 {| {{mixed_attr_content_template}}
13299 |-
13300 |bar
13301 |}
13302 !! html/php
13303 <table style="color:red;" title="T48811">
13304
13305 <tr>
13306 <td>foo
13307 </td></tr>
13308 <tr>
13309 <td>bar
13310 </td></tr></table>
13311
13312 !! html/parsoid
13313 <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|}"]}'>
13314 <tbody><tr>
13315 <td>foo</td></tr>
13316 <tr>
13317 <td>bar</td></tr>
13318 </tbody></table>
13319 !!end
13320
13321 !! article
13322 Template:attribute_from_template
13323 !! text
13324 class="123"
13325 !! endarticle
13326
13327 !! test
13328 Table cell with attribute before expanded attribute
13329 !! wikitext
13330 {|
13331 | align="center" {{attribute_from_template}} |456
13332 |}
13333 !! html/parsoid
13334 <table>
13335 <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>
13336 </tbody></table>
13337 !! end
13338
13339 !! test
13340 1. Entities and nowikis inside templated attributes should be handled correctly
13341 !! wikitext
13342 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
13343 !! html/php
13344 <div style="background:#f9f9f9;">foo</div>
13345
13346 !! html/parsoid
13347 <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>
13348 !! end
13349
13350 !! test
13351 2. Entities and nowikis inside templated attributes should be handled correctly
13352 !! wikitext
13353 {|
13354 |{{table_attribs_3}}
13355 |}
13356 !! html/php
13357 <table>
13358 <tr>
13359 <td style="background:#f9f9f9;">Foo
13360 </td></tr></table>
13361
13362 !! html/parsoid
13363 <table>
13364 <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>
13365 </tbody></table>
13366 !! end
13367
13368 !! test
13369 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13370 !! wikitext
13371 {{tbl-start}}
13372 |{{table_attribs_3}}
13373 {{tbl-end}}
13374 !! html/php
13375 <table>
13376 <tr>
13377 <td style="background:#f9f9f9;">Foo
13378 </td></tr></table>
13379
13380 !! html/parsoid
13381 <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}}]}'>
13382 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
13383 </tbody></table>
13384 !! end
13385
13386 # T107622
13387 !! test
13388 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13389 !! wikitext
13390 {|
13391 |{{table_attribs_6}} hi
13392 |}
13393 !! html/php
13394 <table>
13395 <tr>
13396 <td style="background: red;">hi
13397 </td></tr></table>
13398
13399 !! html/parsoid
13400 <table>
13401 <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>
13402 </tbody></table>
13403 !! end
13404
13405 !!test
13406 Templates: HTML Tables: 1. Generating start of a HTML table
13407 !! wikitext
13408 {{echo|<table><tr><td>foo</td>}}</tr></table>
13409 !! html
13410 <table><tr><td>foo</td></tr></table>
13411
13412 !!end
13413
13414 !!test
13415 Templates: HTML Tables: 2a. Generating middle of a HTML table
13416 !! wikitext
13417 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13418 !! html
13419 <table><tr><td>foo</td></tr></table>
13420
13421 !!end
13422
13423 !!test
13424 Templates: HTML Tables: 2b. Generating middle of a HTML table
13425 !! wikitext
13426 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13427 !! html
13428 <table><tr><td>foo</td></tr></table>
13429
13430 !!end
13431
13432 !!test
13433 Templates: HTML Tables: 3. Generating end of a HTML table
13434 !! wikitext
13435 <table><tr>{{echo|<td>foo</td></tr></table>}}
13436 !! html
13437 <table><tr><td>foo</td></tr></table>
13438
13439 !!end
13440
13441 !!test
13442 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13443 !! wikitext
13444 {{echo|<table>}}<tr><td>foo</td></tr></table>
13445 !! html
13446 <table><tr><td>foo</td></tr></table>
13447
13448 !!end
13449
13450 !!test
13451 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13452 !! wikitext
13453 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13454 !! html
13455 <table><tr><td>foo</td></tr></table>
13456
13457 !!end
13458
13459 !!test
13460 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13461 !! wikitext
13462 <table><tr>{{echo|<td>}}foo</td></tr></table>
13463 !! html
13464 <table><tr><td>foo</td></tr></table>
13465
13466 !!end
13467
13468 !!test
13469 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13470 !! wikitext
13471 <table><tr><td>foo{{echo|</td>}}</tr></table>
13472 !! html
13473 <table><tr><td>foo</td></tr></table>
13474
13475 !!end
13476
13477 !!test
13478 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13479 !! wikitext
13480 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13481 !! html
13482 <table><tr><td>foo</td></tr></table>
13483
13484 !!end
13485
13486 !!test
13487 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13488 !! wikitext
13489 <table><tr><td>foo</td></tr>{{echo|</table>}}
13490 !! html
13491 <table><tr><td>foo</td></tr></table>
13492
13493 !!end
13494
13495 !!test
13496 Templates: HTML Tables: 5. Proper fostering of categories from inside
13497 !!options
13498 parsoid=wt2html,wt2wt
13499 !! wikitext
13500 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13501 <!--Two categories (T52330)-->
13502 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13503 !! html/php+tidy
13504 <table><tbody><tr><td>foo</td></tr></tbody></table>
13505 <table><tbody><tr><td>foo</td></tr></tbody></table>
13506 !! html/parsoid
13507 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13508 <!--Two categories (T52330)-->
13509 <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>
13510 !!end
13511
13512 ## Remex doesn't account for fostered content.
13513 !! test
13514 Templates: Wiki Tables: 1a. Fostering of entire template content
13515 !! wikitext
13516 {|
13517 {{echo|a}}
13518 |}
13519 !! html/php
13520 <table>
13521 a
13522 <tr><td></td></tr></table>
13523
13524 !! html/php+tidy
13525
13526 a
13527 <table><tbody><tr><td></td></tr></tbody></table>
13528 !! html/parsoid
13529 <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">
13530
13531 </table>
13532 !! end
13533
13534 !!test
13535 Templates: Wiki Tables: 1b. Fostering of entire template content
13536 !! wikitext
13537 {|
13538 {{echo|<div>}}
13539 foo
13540 {{echo|</div>}}
13541 |}
13542 !! html
13543 <table>
13544 <div>
13545 <p>foo
13546 </p>
13547 </div>
13548 <tr><td></td></tr></table>
13549
13550 !! html/php+tidy
13551 <div>
13552 <p>foo
13553 </p>
13554 </div><table>
13555
13556 <tbody><tr><td></td></tr></tbody></table>
13557 !! html/parsoid
13558 <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|}"]}'>
13559 <p>foo</p>
13560 </div><table about="#mwt3">
13561
13562 </table>
13563 !! end
13564
13565 ## Remex doesn't account for fostered content.
13566 !! test
13567 Templates: Wiki Tables: 2. Fostering of partial template content
13568 !! wikitext
13569 {|
13570 {{echo|a
13571 <div>b</div>}}
13572 |}
13573 !! html/php
13574 <table>
13575 a
13576 <div>b</div>
13577 <tr><td></td></tr></table>
13578
13579 !! html/php+tidy
13580
13581 a
13582 <div>b</div><table>
13583 <tbody><tr><td></td></tr></tbody></table>
13584 !! html/parsoid
13585 <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">
13586
13587
13588 </table>
13589 !! end
13590
13591 !!test
13592 Templates: Wiki Tables: 3. td-content via multiple templates
13593 !! wikitext
13594 {|
13595 {{echo|{{pipe}}a}}{{echo|b}}
13596 |}
13597 !! html
13598 <table>
13599 <tr>
13600 <td>ab
13601 </td></tr></table>
13602
13603 !!end
13604
13605 !!test
13606 Templates: Wiki Tables: 4. Templated tags, no content
13607 !! wikitext
13608 {{tbl-start}}
13609 {{tbl-end}}
13610 !! html
13611 <table>
13612 <tr><td></td></tr></table>
13613
13614 !!end
13615
13616 !!test
13617 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13618 !! wikitext
13619 {{tbl-start}}
13620 |foo
13621 {{tbl-end}}
13622 !! html
13623 <table>
13624 <tr>
13625 <td>foo
13626 </td></tr></table>
13627
13628 !!end
13629
13630 !!test
13631 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13632 !! wikitext
13633 {{tbl-start}}
13634 {{!}}foo
13635 {{tbl-end}}
13636 !! html
13637 <table>
13638 <tr>
13639 <td>foo
13640 </td></tr></table>
13641
13642 !!end
13643
13644 ## This test case is very specific to Parsoid's internals
13645 ## and is hence only tested for Parsoid's code. Parsoid uses
13646 ## a <meta> marker tag for <ref> tags and they are expanded
13647 ## much later. We are verifying that this <meta> tag usage
13648 ## doesn't prevent foster parenting.
13649 !! test
13650 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13651 !! wikitext
13652 {{PartialTable}}<ref>foo</ref>
13653 |}
13654
13655 <references />
13656 !! html/parsoid
13657 <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">
13658 <tbody>
13659 </tbody></table>
13660
13661 <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>
13662 !! end
13663
13664 !! test
13665 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13666 !! wikitext
13667 {{echo|
13668 {{{!}}
13669 {{!}}-}}
13670 <onlyinclude>
13671 |foo
13672 </onlyinclude>
13673 {{!}}}
13674 !! html/parsoid
13675 <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{{!}}}"]}'>
13676 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13677 <tbody><tr>
13678
13679 <td>foo
13680 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13681 </tbody></table>
13682 !! end
13683
13684 !!test
13685 Templates: Lists: Multi-line list-items via templates
13686 !! wikitext
13687 *{{echo|a {{nonexistent|
13688 unused}}}}
13689 *{{echo|b {{nonexistent|
13690 unused}}}}
13691 !! html
13692 <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>
13693 <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>
13694
13695 !!end
13696
13697 !!test
13698 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13699 !! wikitext
13700 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13701 !! html
13702 <p><i>ab</i>c<i>d</i>e
13703 </p>
13704 !!end
13705
13706 !!test
13707 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13708 (PHP parser generates misnested html)
13709 !! wikitext
13710 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13711 !! html/parsoid
13712 <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>
13713 !!end
13714
13715 !!test
13716 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13717 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13718 !! options
13719 parsoid=wt2html,wt2wt
13720 !! wikitext
13721 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13722 !! html/php+tidy
13723 <div><i>a</i></div><div><i>b</i>c<i>d</i></div><div>e</div>
13724 !! html/parsoid
13725 <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>
13726 <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>
13727 <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>
13728 !!end
13729
13730 !!test
13731 Templates: Ugly nesting: 4. Divs opened/closed across templates
13732 !! wikitext
13733 a<div>b{{echo|c</div>d}}e
13734 !! html
13735 a<div>bc</div>de
13736
13737 !! html+tidy
13738 <p>a</p><div>bc</div><p>de
13739 </p>
13740 !! end
13741
13742 !! test
13743 Templates: Ugly templates: 3. newline-only template parameter
13744 !! wikitext
13745 foo {{echo|
13746 }}
13747 !! html
13748 <p>foo
13749 </p>
13750 !! end
13751
13752 # This looks like a bug: a single newline triggers p/br for some reason.
13753 !! test
13754 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13755 !! wikitext
13756 {{echo|
13757 }}
13758 !! html
13759 <p><br />
13760 </p>
13761 !! end
13762
13763 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13764 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13765 !! test
13766 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13767 !! wikitext
13768 {{echo|<table>}}
13769 {{echo|<div>foo}}
13770 {{echo|</table>}}
13771 !! html/parsoid
13772 <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">
13773 </span><table about="#mwt1">
13774 </table>
13775 !! end
13776
13777 # T66017 -- ugly wikitext with fostered content generates two template ranges
13778 # that are "identical" and generate nesting cycles in the algorithm
13779 !! test
13780 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13781 !! wikitext
13782 {{echo|<table><tr><td><table>}}
13783 {{echo|<div>}}
13784 {{echo|</div>}}
13785 !! html/parsoid
13786 <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"}'>
13787 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13788 </table></td></tr></tbody></table>
13789 !! end
13790
13791 !! test
13792 Templates: Parameters substituted at the top-level
13793 !! wikitext
13794 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13795
13796 {{{foo|bar|baz}}}
13797 !! html/php
13798 <p><i>who</i> me? <b>never!</b>
13799 </p><p>bar
13800 </p>
13801 !! html/parsoid
13802 <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>
13803
13804 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13805 !! end
13806
13807 !! test
13808 Templates: Param with empty arg in the final position
13809 !! wikitext
13810 {{{hi|}}}
13811 !! html/parsoid
13812 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13813 !! end
13814
13815 !!test
13816 Parser Functions: 1. Simple example
13817 !! wikitext
13818 {{uc:foo}}
13819 !! html
13820 <p>FOO
13821 </p>
13822 !!end
13823
13824 !!test
13825 Parser Functions: 2. Nested use (only outermost should be marked up)
13826 !! wikitext
13827 {{uc:{{lc:FOO}}}}
13828 !! html
13829 <p>FOO
13830 </p>
13831 !!end
13832
13833 ## Note that the templates inside the references are not wrapped
13834 !! test
13835 Template nested in extension tag in template
13836 !! options
13837 language=zh
13838 !! wikitext
13839 {{echo|hi<ref>[[ho|{{echo|hi}}]]</ref>}}
13840 {{echo|hi<ref>[http://test.com?q={{echo|ho}}]</ref>}}
13841 {{echo|hi<ref>-{ho|{{echo|hi}}}-</ref>}}
13842 <references />
13843 !! html/parsoid
13844 <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>
13845 <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>
13846 <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>
13847 <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>
13848 !! end
13849
13850 ###
13851 ### Pre-save transform tests
13852 ###
13853
13854 !! test
13855 pre-save transform: subst:
13856 !! options
13857 pst
13858 !! wikitext
13859 {{subst:test}}
13860 !! html/php
13861 This is a test template
13862 !! end
13863
13864 !! test
13865 pre-save transform: normal template
13866 !! options
13867 pst
13868 !! wikitext
13869 {{test}}
13870 !! html/php
13871 {{test}}
13872 !! end
13873
13874 !! test
13875 pre-save transform: nonexistent template
13876 !! options
13877 pst
13878 !! wikitext
13879 {{thistemplatedoesnotexist}}
13880 !! html/php
13881 {{thistemplatedoesnotexist}}
13882 !! end
13883
13884 !! test
13885 pre-save transform: subst magic variables
13886 !! options
13887 pst
13888 !! wikitext
13889 {{subst:SITENAME}}
13890 !! html/php
13891 MediaWiki
13892 !! end
13893
13894 # This is T2089, which I fixed. -- wtm
13895 !! test
13896 pre-save transform: subst: templates with parameters
13897 !! options
13898 pst
13899 !! wikitext
13900 {{subst:paramtest|param="something else"}}
13901 !! html/php
13902 This is a test template with parameter "something else"
13903 !! end
13904
13905 !! article
13906 Template:nowikitest
13907 !! text
13908 <nowiki>'''not wiki'''</nowiki>
13909 !! endarticle
13910
13911 !! test
13912 pre-save transform: nowiki in subst (T3188)
13913 !! options
13914 pst
13915 !! wikitext
13916 {{subst:nowikitest}}
13917 !! html/php
13918 <nowiki>'''not wiki'''</nowiki>
13919 !! end
13920
13921 !! article
13922 Template:commenttest
13923 !! text
13924 This template has <!-- a comment --> in it.
13925 !! endarticle
13926
13927 !! test
13928 pre-save transform: comment in subst (T3936)
13929 !! options
13930 pst
13931 !! wikitext
13932 {{subst:commenttest}}
13933 !! html/php
13934 This template has <!-- a comment --> in it.
13935 !! end
13936
13937 !! test
13938 pre-save transform: unclosed tag
13939 !! options
13940 pst
13941 !! wikitext
13942 <nowiki>'''not wiki'''
13943 !! html/php
13944 <nowiki>'''not wiki'''
13945 !! end
13946
13947 !! test
13948 pre-save transform: mixed tag case
13949 !! options
13950 pst
13951 !! wikitext
13952 <NOwiki>'''not wiki'''</noWIKI>
13953 !! html/php
13954 <NOwiki>'''not wiki'''</noWIKI>
13955 !! end
13956
13957 !! test
13958 pre-save transform: unclosed comment in <nowiki>
13959 !! options
13960 pst
13961 !! wikitext
13962 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13963 !! html/php
13964 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13965 !!end
13966
13967 # Leading @ in this template definition works around a limitation
13968 # in parsoid's parserTests which otherwise strips the <span> from the
13969 # result (confusing it for a template wrapper)
13970 !! article
13971 Template:dangerous
13972 !!text
13973 @<span onmouseover="alert('crap')">Oh no</span>
13974 !!endarticle
13975
13976 !!test
13977 (confirming safety of fix for subst T3936)
13978 !! wikitext
13979 {{Template:dangerous}}
13980 !! html
13981 <p>@<span>Oh no</span>
13982 </p>
13983 !! end
13984
13985 !! test
13986 pre-save transform: comment containing gallery (T7024)
13987 !! options
13988 pst
13989 !! wikitext
13990 <!-- <gallery>data</gallery> -->
13991 !! html/php
13992 <!-- <gallery>data</gallery> -->
13993 !!end
13994
13995 !! test
13996 pre-save transform: comment containing extension
13997 !! options
13998 pst
13999 !! wikitext
14000 <!-- <tag>data</tag> -->
14001 !! html/php
14002 <!-- <tag>data</tag> -->
14003 !!end
14004
14005 !! test
14006 pre-save transform: comment containing nowiki
14007 !! options
14008 pst
14009 !! wikitext
14010 <!-- <nowiki>data</nowiki> -->
14011 !! html/php
14012 <!-- <nowiki>data</nowiki> -->
14013 !!end
14014
14015 !! test
14016 pre-save transform: <noinclude> in subst (T5298)
14017 !! options
14018 pst
14019 !! wikitext
14020 {{subst:Includes}}
14021 !! html/php
14022 Foobar
14023 !! end
14024
14025 !! test
14026 pre-save transform: <onlyinclude> in subst (T5298)
14027 !! options
14028 pst
14029 !! wikitext
14030 {{subst:Includes2}}
14031 !! html/php
14032 Foo
14033 !! end
14034
14035 !! article
14036 Template:SubstTest
14037 !!text
14038 {{<includeonly>subst:</includeonly>Includes}}
14039 !! endarticle
14040
14041 !! article
14042 Template:SafeSubstTest
14043 !! text
14044 {{<includeonly>safesubst:</includeonly>Includes}}
14045 !! endarticle
14046
14047 !! test
14048 T24297: safesubst: works during PST
14049 !! options
14050 pst
14051 !! wikitext
14052 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
14053 !! html/php
14054 FoobarFoobar
14055 !! end
14056
14057 !! test
14058 T24297: safesubst: works during normal parse
14059 !! wikitext
14060 {{SafeSubstTest}}
14061 !! html
14062 <p>Foobar
14063 </p>
14064 !! end
14065
14066 !! test
14067 subst: does not work during normal parse
14068 !! wikitext
14069 {{SubstTest}}
14070 !! html
14071 <p>{{subst:Includes}}
14072 </p>
14073 !! end
14074
14075 !! test
14076 pre-save transform: context links ("pipe trick")
14077 !! options
14078 pst
14079 !! wikitext
14080 [[Article (context)|]]
14081 [[Bar:Article|]]
14082 [[:Bar:Article|]]
14083 [[Bar:Article (context)|]]
14084 [[:Bar:Article (context)|]]
14085 [[|Article]]
14086 [[|Article (context)]]
14087 [[Bar:X (Y) Z|]]
14088 [[:Bar:X (Y) Z|]]
14089 !! html/php
14090 [[Article (context)|Article]]
14091 [[Bar:Article|Article]]
14092 [[:Bar:Article|Article]]
14093 [[Bar:Article (context)|Article]]
14094 [[:Bar:Article (context)|Article]]
14095 [[Article]]
14096 [[Article (context)]]
14097 [[Bar:X (Y) Z|X (Y) Z]]
14098 [[:Bar:X (Y) Z|X (Y) Z]]
14099 !! end
14100
14101 !! test
14102 pre-save transform: context links ("pipe trick") with interwiki prefix
14103 !! options
14104 pst
14105 !! wikitext
14106 [[interwiki:Article|]]
14107 [[:interwiki:Article|]]
14108 [[interwiki:Bar:Article|]]
14109 [[:interwiki:Bar:Article|]]
14110 !! html/php
14111 [[interwiki:Article|Article]]
14112 [[:interwiki:Article|Article]]
14113 [[interwiki:Bar:Article|Bar:Article]]
14114 [[:interwiki:Bar:Article|Bar:Article]]
14115 !! end
14116
14117 !! test
14118 pre-save transform: context links ("pipe trick") with parens in title
14119 !! options
14120 pst title=[[Somearticle (context)]]
14121 !! wikitext
14122 [[|Article]]
14123 !! html/php
14124 [[Article (context)|Article]]
14125 !! end
14126
14127 !! test
14128 pre-save transform: context links ("pipe trick") with comma in title
14129 !! options
14130 pst title=[[Someplace, Somewhere]]
14131 !! wikitext
14132 [[|Otherplace]]
14133 [[Otherplace, Elsewhere|]]
14134 [[Otherplace, Elsewhere, Anywhere|]]
14135 !! html/php
14136 [[Otherplace, Somewhere|Otherplace]]
14137 [[Otherplace, Elsewhere|Otherplace]]
14138 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
14139 !! end
14140
14141 !! test
14142 pre-save transform: context links ("pipe trick") with parens and comma
14143 !! options
14144 pst title=[[Someplace (IGNORED), Somewhere]]
14145 !! wikitext
14146 [[|Otherplace]]
14147 [[Otherplace (place), Elsewhere|]]
14148 !! html/php
14149 [[Otherplace, Somewhere|Otherplace]]
14150 [[Otherplace (place), Elsewhere|Otherplace]]
14151 !! end
14152
14153 !! test
14154 pre-save transform: context links ("pipe trick") with comma and parens
14155 !! options
14156 pst title=[[Who, me? (context)]]
14157 !! wikitext
14158 [[|Yes, you.]]
14159 [[Me, Myself, and I (1937 song)|]]
14160 !! html/php
14161 [[Yes, you. (context)|Yes, you.]]
14162 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
14163 !! end
14164
14165 !! test
14166 pre-save transform: context links ("pipe trick") with namespace
14167 !! options
14168 pst title=[[Ns:Somearticle]]
14169 !! wikitext
14170 [[|Article]]
14171 !! html/php
14172 [[Ns:Article|Article]]
14173 !! end
14174
14175 !! test
14176 pre-save transform: context links ("pipe trick") with namespace and parens
14177 !! options
14178 pst title=[[Ns:Somearticle (context)]]
14179 !! wikitext
14180 [[|Article]]
14181 !! html/php
14182 [[Ns:Article (context)|Article]]
14183 !! end
14184
14185 !! test
14186 pre-save transform: context links ("pipe trick") with namespace and comma
14187 !! options
14188 pst title=[[Ns:Somearticle, Context, Whatever]]
14189 !! wikitext
14190 [[|Article]]
14191 !! html/php
14192 [[Ns:Article, Context, Whatever|Article]]
14193 !! end
14194
14195 !! test
14196 pre-save transform: context links ("pipe trick") with namespace, comma and parens
14197 !! options
14198 pst title=[[Ns:Somearticle, Context (context)]]
14199 !! wikitext
14200 [[|Article]]
14201 !! html/php
14202 [[Ns:Article (context)|Article]]
14203 !! end
14204
14205 !! test
14206 pre-save transform: context links ("pipe trick") with namespace, parens and comma
14207 !! options
14208 pst title=[[Ns:Somearticle (IGNORED), Context]]
14209 !! wikitext
14210 [[|Article]]
14211 !! html/php
14212 [[Ns:Article, Context|Article]]
14213 !! end
14214
14215 !! test
14216 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
14217 !! options
14218 pst
14219 !! wikitext
14220 [[Article(context)|]]
14221 [[Bar:Article(context)|]]
14222 [[:Bar:Article(context)|]]
14223 [[|Article(context)]]
14224 [[Bar:X(Y)Z|]]
14225 [[:Bar:X(Y)Z|]]
14226 !! html/php
14227 [[Article(context)|Article]]
14228 [[Bar:Article(context)|Article]]
14229 [[:Bar:Article(context)|Article]]
14230 [[Article(context)]]
14231 [[Bar:X(Y)Z|X(Y)Z]]
14232 [[:Bar:X(Y)Z|X(Y)Z]]
14233 !! end
14234
14235 !! test
14236 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
14237 !! options
14238 pst
14239 !! wikitext
14240 [[Article (context)|]]
14241 [[Bar:Article (context)|]]
14242 [[:Bar:Article (context)|]]
14243 [[|Article (context)]]
14244 [[Bar:X (Y) Z|]]
14245 [[:Bar:X (Y) Z|]]
14246 !! html/php
14247 [[Article (context)|Article]]
14248 [[Bar:Article (context)|Article]]
14249 [[:Bar:Article (context)|Article]]
14250 [[Article (context)]]
14251 [[Bar:X (Y) Z|X (Y) Z]]
14252 [[:Bar:X (Y) Z|X (Y) Z]]
14253 !! end
14254
14255 !! test
14256 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
14257 !! options
14258 pst
14259 !! wikitext
14260 [[Article(context)|]]
14261 [[Bar:Article(context)|]]
14262 [[:Bar:Article(context)|]]
14263 [[|Article(context)]]
14264 [[Bar:X(Y)Z|]]
14265 [[:Bar:X(Y)Z|]]
14266 !! html/php
14267 [[Article(context)|Article]]
14268 [[Bar:Article(context)|Article]]
14269 [[:Bar:Article(context)|Article]]
14270 [[Article(context)]]
14271 [[Bar:X(Y)Z|X(Y)Z]]
14272 [[:Bar:X(Y)Z|X(Y)Z]]
14273 !! end
14274
14275 !! test
14276 pre-save transform: context links ("pipe trick") with commas (T23660)
14277 !! options
14278 pst
14279 !! wikitext
14280 [[Article (context), context|]]
14281 [[Article (context),context|]]
14282 [[Bar:Article (context), context|]]
14283 [[Bar:Article (context),context|]]
14284 [[:Bar:Article (context), context|]]
14285 [[:Bar:Article (context),context|]]
14286 !! html/php
14287 [[Article (context), context|Article]]
14288 [[Article (context),context|Article]]
14289 [[Bar:Article (context), context|Article]]
14290 [[Bar:Article (context),context|Article]]
14291 [[:Bar:Article (context), context|Article]]
14292 [[:Bar:Article (context),context|Article]]
14293 !! end
14294
14295 !! test
14296 Parsoid: backwards pipe trick
14297 !! wikitext
14298 [[|'''bar''']]
14299 !! html/php
14300 <p>[[|<b>bar</b>]]
14301 </p>
14302 !! html/parsoid
14303 <p>[[|<b>bar</b>]]</p>
14304 !! end
14305
14306 !! test
14307 pre-save transform: trim trailing empty lines
14308 !! options
14309 pst
14310 !! wikitext
14311 Empty lines are trimmed
14312
14313
14314
14315
14316 !! html/php
14317 Empty lines are trimmed
14318 !! end
14319
14320 !! test
14321 pre-save transform: Signature expansion
14322 !! options
14323 pst
14324 !! wikitext
14325 * ~~~
14326 * ~~~~
14327 * ~~~~~
14328 * <noinclude>~~~</noinclude>
14329 * <includeonly>~~~</includeonly>
14330 * <onlyinclude>~~~</onlyinclude>
14331 !! html/php
14332 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
14333 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14334 * 00:02, 1 January 1970 (UTC)
14335 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
14336 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
14337 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
14338 !! end
14339
14340
14341 !! test
14342 ParserOutput flags from signature expansion (T84843)
14343 !! options
14344 pst
14345 showflags
14346 !! wikitext
14347 ~~~~
14348 !! html/php
14349 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14350 flags=user-signature
14351 !! end
14352
14353
14354 !! test
14355 pre-save transform: Signature expansion in nowiki tags (T2093)
14356 !! options
14357 pst disabled
14358 !! wikitext
14359 Shall not expand:
14360
14361 <nowiki>~~~~</nowiki>
14362
14363 <includeonly><nowiki>~~~~</nowiki></includeonly>
14364
14365 <noinclude><nowiki>~~~~</nowiki></noinclude>
14366
14367 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14368
14369 {{subst:Foo}} shall be converted to FOO
14370
14371 As well as inside noinclude/onlyinclude
14372 <noinclude>{{subst:Foo}}</noinclude>
14373 <onlyinclude>{{subst:Foo}}</onlyinclude>
14374
14375 But not inside includeonly
14376 <includeonly>{{subst:Foo}}</includeonly>
14377 !! html/php
14378 Shall not expand:
14379
14380 <nowiki>~~~~</nowiki>
14381
14382 <includeonly><nowiki>~~~~</nowiki></includeonly>
14383
14384 <noinclude><nowiki>~~~~</nowiki></noinclude>
14385
14386 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14387
14388 FOO shall be converted to FOO
14389
14390 As well as inside noinclude/onlyinclude
14391 <noinclude>FOO</noinclude>
14392 <onlyinclude>FOO</onlyinclude>
14393
14394 But not inside includeonly
14395 <includeonly>{{subst:Foo}}</includeonly>
14396 !! end
14397
14398 !! test
14399 Parsoid: Recognize nowiki with trailing space in tags
14400 !! options
14401 parsoid=wt2html
14402 !! wikitext
14403 <nowiki ><div>[[foo]]</nowiki >
14404
14405 a<nowiki / >b
14406
14407 c<nowiki />d
14408
14409 e<nowiki/ >f
14410 !! html/php+tidy
14411 <p>&lt;div&gt;[[foo]]
14412 </p><p>a&lt;nowiki / &gt;b
14413 </p><p>cd
14414 </p><p>e&lt;nowiki/ &gt;f
14415 </p>
14416 !! html/parsoid
14417 <p><span typeof="mw:Nowiki">&lt;div>[[foo]]</span></p>
14418
14419 <p>a&lt;nowiki / >b</p>
14420
14421 <p>c<span typeof="mw:Nowiki"></span>d</p>
14422
14423 <p>e&lt;nowiki/ >f</p>
14424 !! end
14425
14426 !! test
14427 Parsoid: Recognize nowiki with odd capitalization
14428 !! options
14429 parsoid=wt2html
14430 !! wikitext
14431 <noWikI ><div>[[foo]]</Nowiki >
14432 !! html/php+tidy
14433 <p>&lt;div&gt;[[foo]]
14434 </p>
14435 !! html/parsoid
14436 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14437 !! end
14438
14439
14440 !! test
14441 Parsoid: Escape nowiki with trailing space in tags
14442 !! options
14443 parsoid=html2wt
14444 !! html/parsoid
14445 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14446 <p>a&lt;nowiki /&gt;b</p>
14447 <p>c&lt;nowiki/ &gt;d</p>
14448 !! wikitext
14449 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14450
14451 a&lt;nowiki /&gt;b
14452
14453 c&lt;nowiki/ &gt;d
14454 !! end
14455
14456 !! test
14457 Parsoid: Escape weird noWikI capitalizations
14458 !! options
14459 parsoid=html2wt
14460 !! html/parsoid
14461 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14462 !! wikitext
14463 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14464 !! end
14465
14466 ###
14467 ### Message transform tests
14468 ###
14469 !! test
14470 message transform: magic variables
14471 !! options
14472 msg
14473 !! wikitext
14474 {{SITENAME}}
14475 !! html
14476 MediaWiki
14477 !! end
14478
14479 !! test
14480 message transform: should not transform wiki markup
14481 !! options
14482 msg
14483 !! wikitext
14484 ''test''
14485 !! html
14486 ''test''
14487 !! end
14488
14489 !! test
14490 message transform: <noinclude> in transcluded template (T6926)
14491 !! options
14492 msg
14493 !! wikitext
14494 {{Includes}}
14495 !! html
14496 Foobar
14497 !! end
14498
14499 !! test
14500 message transform: <onlyinclude> in transcluded template (T6926)
14501 !! options
14502 msg
14503 !! wikitext
14504 {{Includes2}}
14505 !! html
14506 Foo
14507 !! end
14508
14509 !! test
14510 {{#special:}} page name, known
14511 !! options
14512 msg
14513 !! wikitext
14514 {{#special:Recentchanges}}
14515 !! html
14516 Special:RecentChanges
14517 !! end
14518
14519 !! test
14520 {{#special:}} page name with subpage, known
14521 !! options
14522 msg
14523 !! wikitext
14524 {{#special:Recentchanges/param}}
14525 !! html
14526 Special:RecentChanges/param
14527 !! end
14528
14529 !! test
14530 {{#special:}} page name, unknown
14531 !! options
14532 msg
14533 !! wikitext
14534 {{#special:foobar nonexistent}}
14535 !! html
14536 Special:Foobar nonexistent
14537 !! end
14538
14539 !! test
14540 {{#speciale:}} page name, known
14541 !! options
14542 msg
14543 !! wikitext
14544 {{#speciale:Recentchanges}}
14545 !! html
14546 Special:RecentChanges
14547 !! end
14548
14549 !! test
14550 {{#speciale:}} page name with subpage, known
14551 !! options
14552 msg
14553 !! wikitext
14554 {{#speciale:Recentchanges/param}}
14555 !! html
14556 Special:RecentChanges/param
14557 !! end
14558
14559 !! test
14560 {{#speciale:}} page name, unknown
14561 !! options
14562 msg
14563 !! wikitext
14564 {{#speciale:foobar nonexistent}}
14565 !! html
14566 Special:Foobar_nonexistent
14567 !! end
14568
14569 ###
14570 ### Images
14571 ###
14572 ### For Parsoid-specific tests, see
14573 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14574
14575 !! test
14576 Simple image
14577 !! options
14578 parsoid=wt2html,wt2wt,html2html
14579 !! wikitext
14580 [[Image:foobar.jpg]]
14581 !! html/php
14582 <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>
14583 </p>
14584 !! html/parsoid
14585 <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>
14586 !! end
14587
14588 !! test
14589 Serialize simple image with span wrapper
14590 !! options
14591 parsoid=html2wt
14592 !! html/parsoid
14593 <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>
14594 !! wikitext
14595 [[File:Foobar.jpg]]
14596 !! end
14597
14598 !! test
14599 Simple image (using File: namespace, now canonical)
14600 !! wikitext
14601 [[File:Foobar.jpg]]
14602 !! html/php
14603 <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>
14604 </p>
14605 !! html/parsoid
14606 <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>
14607 !! end
14608
14609 !! test
14610 Right-aligned image
14611 !! wikitext
14612 [[File:Foobar.jpg|right]]
14613 !! html/php
14614 <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>
14615
14616 !! html/parsoid
14617 <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>
14618 !! end
14619
14620 !! test
14621 Image with caption
14622 !! wikitext
14623 [[File:Foobar.jpg|right|Caption text]]
14624 !! html/php
14625 <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>
14626
14627 !! html/parsoid
14628 <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>
14629 !! end
14630
14631 !! test
14632 Image with caption, T55312 #1
14633 !! wikitext
14634 [[File:Foobar.jpg|right|Caption page stuff]]
14635 !! html/php
14636 <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>
14637
14638 !! html/parsoid
14639 <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>
14640 !! end
14641
14642 !! test
14643 Image with caption, T55312 #2
14644 !! wikitext
14645 [[File:Foobar.jpg|right|Caption page=]]
14646 !! html/php
14647 <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>
14648
14649 !! html/parsoid
14650 <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>
14651 !! end
14652
14653 !! test
14654 Image with caption, T55312 #3
14655 !! wikitext
14656 [[File:Foobar.jpg|right|Caption page=stuff]]
14657 !! html/php
14658 <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>
14659
14660 !! html/parsoid
14661 <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>
14662 !! end
14663
14664 !! test
14665 Image caption with pipe entity
14666 !! wikitext
14667 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14668 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14669 !! html/php
14670 <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>
14671 <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>
14672
14673 !! html/parsoid
14674 <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>
14675 <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>
14676 !! end
14677
14678 !! test
14679 Allow empty links in image captions (T62753)
14680 !! options
14681 thumbsize=220
14682 !! wikitext
14683 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14684 [[]]
14685 [[Link2]]
14686 ]]
14687 !! html/php
14688 <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>
14689
14690 !! html/parsoid
14691 <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>
14692 [[]]
14693 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14694 </figcaption></figure>
14695 !! end
14696
14697 !! test
14698 Titles in unlinked images (T23454)
14699 !! wikitext
14700 [[File:Foobar.jpg|link=|stuff]]
14701 !! html/php
14702 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14703 </p>
14704 !! html/parsoid
14705 <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>
14706 !! end
14707
14708 !! test
14709 Link with empty target
14710 !! wikitext
14711 [[]]
14712 !! html
14713 <p>[[]]
14714 </p>
14715 !! end
14716
14717 !! test
14718 Image with link trail
14719 !! wikitext
14720 Linktrails should not work for images: [[File:Foobar.jpg]]s
14721 !! html/php
14722 <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
14723 </p>
14724 !! html/parsoid
14725 <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>
14726 !! end
14727
14728 !! test
14729 Image with empty attribute
14730 !! options
14731 parsoid=wt2html,wt2wt,html2html
14732 !! wikitext
14733 [[File:Foobar.jpg|right||Caption text]]
14734 !! html/php
14735 <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>
14736
14737 !! html/parsoid
14738 <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>
14739 !! end
14740
14741 !! test
14742 1. Block image with individual attributes from templates
14743 !! wikitext
14744 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14745 !! html/php
14746 <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>
14747
14748 !! html/parsoid
14749 <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>
14750 !! end
14751
14752 !! test
14753 2. Block Image with individual attributes from templates
14754 !! wikitext
14755 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14756 !! html/php
14757 <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>
14758
14759 !! html/parsoid
14760 <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>
14761 !! end
14762
14763 !! test
14764 3. Inline image with individual attributes from templates
14765 !! wikitext
14766 [[File:Foobar.jpg|{{echo|50px}}]]
14767 !! html/php
14768 <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>
14769 </p>
14770 !! html/parsoid
14771 <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>
14772 !! end
14773
14774 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14775 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14776 !! test
14777 Image with multiple attributes from the same template
14778 !! wikitext
14779 [[File:Foobar.jpg|{{image_attribs}}]]
14780 !! html/php
14781 <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>
14782
14783 !! html/parsoid
14784 <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>
14785 !! end
14786
14787 !! test
14788 Image with link tails
14789 !! options
14790 thumbsize=220
14791 !! wikitext
14792 123[[File:Foobar.jpg]]456
14793 123[[File:Foobar.jpg|right]]456
14794 123[[File:Foobar.jpg|thumb]]456
14795 !! html/php
14796 <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
14797 </p>
14798 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
14799 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
14800
14801 !! html/php+tidy
14802 <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
14803 </p><p>
14804 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
14805 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
14806 </p>
14807 !! html/parsoid
14808 <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>
14809 <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
14810 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>
14811 !! end
14812
14813 !! test
14814 Image with multiple captions -- only last one is accepted
14815 !! wikitext
14816 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14817 !! html/php
14818 <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>
14819
14820 !! html/parsoid
14821 <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>
14822 !! end
14823
14824 !! test
14825 Image with multiple widths -- use last
14826 !! wikitext
14827 [[File:Foobar.jpg|200px|300px|caption]]
14828 !! html/php
14829 <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>
14830 </p>
14831 !! html/parsoid
14832 <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>
14833 !! end
14834
14835 !! test
14836 Image with multiple alignments -- use first (T50664)
14837 !! options
14838 thumbsize=220
14839 !! wikitext
14840 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14841
14842 [[File:Foobar.jpg|middle|text-top|caption]]
14843 !! html/php
14844 <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>
14845 <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>
14846 </p>
14847 !! html/parsoid
14848 <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>
14849 <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>
14850 !! end
14851
14852 !! test
14853 Image with width attribute at different positions
14854 !! wikitext
14855 [[File:Foobar.jpg|200px|right|Caption]]
14856 [[File:Foobar.jpg|right|200px|Caption]]
14857 [[File:Foobar.jpg|right|Caption|200px]]
14858 !! html/php
14859 <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>
14860 <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>
14861 <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>
14862
14863 !! html/parsoid
14864 <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>
14865 <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>
14866 <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>
14867 !! end
14868
14869 # a sad bit of backward-compatibility
14870 !! test
14871 Image with size specified with pxpx (T15500, T53628)
14872 !! options
14873 parsoid=wt2html,wt2wt,html2html
14874 !! wikitext
14875 [[File:Foobar.jpg|20pxpx]]
14876 [[File:Foobar.jpg|200x20pxpx]]
14877 !! html/php
14878 <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>
14879 <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>
14880 </p>
14881 !! html/parsoid
14882 <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>
14883 !! end
14884
14885 !! test
14886 Image with link parameter, wiki target
14887 !! wikitext
14888 [[File:Foobar.jpg|link=Main Page]]
14889 !! html/php
14890 <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>
14891 </p>
14892 !! html/parsoid
14893 <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>
14894 !! end
14895
14896 # parsoid T51293 (part 1)
14897 !! test
14898 Image with link parameter, URL target
14899 !! wikitext
14900 [[File:Foobar.jpg|link=http://example.com/]]
14901 !! html/php
14902 <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>
14903 </p>
14904 !! html/parsoid
14905 <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>
14906 !! end
14907
14908 # parsoid T51293 (part 2)
14909 !! test
14910 Image with link parameter, protocol-less URL target
14911 !! wikitext
14912 [[File:Foobar.jpg|link=//example.com/]]
14913 !! html/php
14914 <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>
14915 </p>
14916 !! html/parsoid
14917 <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>
14918 !! end
14919
14920 !! test
14921 Escaping non-block captions (T107435)
14922 !! options
14923 parsoid={
14924 "modes": ["wt2wt"],
14925 "changes": [
14926 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14927 ]
14928 }
14929 !! wikitext
14930 [[Image:Foobar.jpg|caption]]
14931 !! wikitext/edited
14932 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14933 !! end
14934
14935 # wgExternalLinkTarget not supported by Parsoid
14936 !! test
14937 Image with link parameter, wgExternalLinkTarget
14938 !! wikitext
14939 [[Image:foobar.jpg|link=http://example.com/]]
14940 !! config
14941 wgExternalLinkTarget='foobar'
14942 !! html/php
14943 <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>
14944 </p>
14945 !! end
14946
14947 !! test
14948 Image with link parameter, wgNoFollowLinks set to false
14949 !! wikitext
14950 [[Image:foobar.jpg|link=http://example.com/]]
14951 !! config
14952 wgNoFollowLinks=false
14953 !! html/php
14954 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14955 </p>
14956 !! end
14957
14958 !! test
14959 Image with link parameter, wgNoFollowDomainExceptions
14960 !! wikitext
14961 [[Image:foobar.jpg|link=http://example.com/]]
14962 !! config
14963 wgNoFollowDomainExceptions='example.com'
14964 !! html/php
14965 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14966 </p>
14967 !! end
14968
14969 # wgExternalLinkTarget not supported by Parsoid
14970 !! test
14971 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14972 !! wikitext
14973 [[Image:foobar.jpg|link=http://example.com/|Title]]
14974 !! config
14975 wgExternalLinkTarget='foobar'
14976 !! html/php
14977 <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>
14978 </p>
14979 !! end
14980
14981 !! test
14982 Image with empty link parameter
14983 !! wikitext
14984 [[File:Foobar.jpg|link=]]
14985 !! html/php
14986 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14987 </p>
14988 !! html/parsoid
14989 <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>
14990 !! end
14991
14992 !! test
14993 Image with link parameter (wiki target) and unnamed parameter
14994 !! wikitext
14995 [[File:Foobar.jpg|link=Main_Page|Title]]
14996 !! html/php
14997 <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>
14998 </p>
14999 !! html/parsoid
15000 <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>
15001 !! end
15002
15003 !! test
15004 Image with link parameter (URL target) and unnamed parameter
15005 !! wikitext
15006 [[File:Foobar.jpg|link=http://example.com/|Title]]
15007 !! html/php
15008 <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>
15009 </p>
15010 !! html/parsoid
15011 <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>
15012 !! end
15013
15014 !! test
15015 Thumbnail image with link parameter
15016 !! options
15017 thumbsize=220
15018 parsoid=wt2html,wt2wt,html2html
15019 !! wikitext
15020 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
15021 !! html/php
15022 <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>
15023
15024 !! html/parsoid
15025 <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>
15026 !! end
15027
15028 !! test
15029 Manually-specified thumbnail image
15030 !! options
15031 thumbsize=220
15032 !! wikitext
15033 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
15034 !! html/php
15035 <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>
15036
15037 !! html/parsoid
15038 <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>
15039 !! end
15040
15041 !! test
15042 Manually-specified thumbnail image with explicit link to wiki page
15043 !! options
15044 thumbsize=220
15045 parsoid=wt2html,wt2wt,html2html
15046 !! wikitext
15047 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
15048 !! html/php
15049 <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>
15050
15051 !! html/parsoid
15052 <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>
15053 !! end
15054
15055 !! test
15056 Manually-specified thumbnail image with explicit link to url
15057 !! options
15058 thumbsize=220
15059 parsoid=wt2html,wt2wt,html2html
15060 !! wikitext
15061 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
15062 !! html/php
15063 <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>
15064
15065 !! html/parsoid
15066 <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>
15067 !! end
15068
15069 !! test
15070 Manually-specified thumbnail image with explicit no link
15071 !! options
15072 thumbsize=220
15073 parsoid=wt2html,wt2wt,html2html
15074 !! wikitext
15075 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
15076 !! html/php
15077 <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>
15078
15079 !! html/parsoid
15080 <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>
15081 !! end
15082
15083 !! test
15084 Manually-specified thumbnail image with explicit link and alt text
15085 !! options
15086 thumbsize=220
15087 parsoid=wt2html,wt2wt,html2html
15088 !! wikitext
15089 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
15090 !! html/php
15091 <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>
15092
15093 !! html/parsoid
15094 <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>
15095 !! end
15096
15097 !! test
15098 Image with frame and link
15099 !! options
15100 parsoid=wt2html,wt2wt,html2html
15101 !! wikitext
15102 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
15103 !! html/php
15104 <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>
15105
15106 !! html/parsoid
15107 <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>
15108 !! end
15109
15110 !! test
15111 Image with frame and link and explicit alt
15112 !! options
15113 parsoid=wt2html,wt2wt,html2html
15114 !! wikitext
15115 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
15116 !! html/php
15117 <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>
15118
15119 !! html/parsoid
15120 <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>
15121 !! end
15122
15123 !! test
15124 Image with wiki markup in implicit alt
15125 !! wikitext
15126 [[Image:Foobar.jpg|testing '''bold''' in alt]]
15127
15128 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
15129 !! html/php
15130 <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>
15131 </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>
15132 </p>
15133 !! html/parsoid
15134 <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>
15135
15136 <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>
15137 !! end
15138
15139 !! test
15140 Alt image option should handle most kinds of wikitext without barfing
15141 !! wikitext
15142 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
15143 !! html/php
15144 <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>
15145
15146 !! html/parsoid
15147 <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>
15148 !! end
15149
15150 !! test
15151 Ampersand in alt attribute (T206940)
15152 !! options
15153 parsoid = {
15154 "nativeGallery": true
15155 }
15156 !! wikitext
15157 [[File:Foobar.jpg|alt=&amp;amp;]]
15158
15159 <!-- consistency with gallery extension -->
15160 <gallery>
15161 File:Foobar.jpg|alt=&amp;amp;
15162 </gallery>
15163 !! html/php+tidy
15164 <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>
15165 </p>
15166 <ul class="gallery mw-gallery-traditional">
15167 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15168 <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>
15169 <div class="gallerytext">
15170 </div>
15171 </div></li>
15172 </ul>
15173 !! html/parsoid
15174 <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>
15175
15176 <!-- consistency with gallery extension -->
15177 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15178 <li class="gallerybox">
15179 <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>
15180 <div class="gallerytext"></div>
15181 </li>
15182 </ul>
15183 !! end
15184
15185 !! test
15186 Italics markup in alt attribute (T206940)
15187 !! wikitext
15188 [[File:Foobar.jpg|alt=''x''|caption]]
15189
15190 <!-- consistency with gallery extension -->
15191 <gallery>
15192 File:Foobar.jpg|alt=''x''|caption
15193 </gallery>
15194 !! html/php+tidy
15195 <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>
15196 </p>
15197 <ul class="gallery mw-gallery-traditional">
15198 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15199 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
15200 <div class="gallerytext">
15201 <p>caption
15202 </p>
15203 </div>
15204 </div></li>
15205 </ul>
15206 !! html/parsoid
15207 <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>
15208
15209 <!-- consistency with gallery extension -->
15210 <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"}}'>
15211 <li class="gallerybox">
15212 <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>
15213 <div class="gallerytext">caption</div>
15214 </li>
15215 </ul>
15216 !! end
15217
15218 !! test
15219 Nowiki markup in alt attribute (T206940)
15220 !! wikitext
15221 [[File:Foobar.jpg|alt=<nowiki>''</nowiki>x<nowiki>''</nowiki>|caption]]
15222
15223 <!-- consistency with gallery extension -->
15224 <gallery>
15225 File:Foobar.jpg|alt=<nowiki>''</nowiki>x<nowiki>''</nowiki>|caption
15226 </gallery>
15227 !! html/php+tidy
15228 <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>
15229 </p>
15230 <ul class="gallery mw-gallery-traditional">
15231 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15232 <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>
15233 <div class="gallerytext">
15234 <p>caption
15235 </p>
15236 </div>
15237 </div></li>
15238 </ul>
15239 !! html/parsoid
15240 <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>
15241
15242 <!-- consistency with gallery extension -->
15243 <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"}}'>
15244 <li class="gallerybox">
15245 <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>
15246 <div class="gallerytext">caption</div>
15247 </li>
15248 </ul>
15249 !! end
15250
15251 !! test
15252 Nowiki markup in alt attribute (edited html, no data-parsoid) (T206940)
15253 !! options
15254 parsoid = {
15255 "nativeGallery": true
15256 }
15257 !! wikitext
15258 [[File:Foobar.jpg|alt=<nowiki>''x''</nowiki>|caption]]
15259
15260 <!-- consistency with gallery extension -->
15261 <gallery>
15262 File:Foobar.jpg|alt=<nowiki>''x''</nowiki>|caption
15263 </gallery>
15264 !! html/php+tidy
15265 <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>
15266 </p>
15267 <ul class="gallery mw-gallery-traditional">
15268 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15269 <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>
15270 <div class="gallerytext">
15271 <p>caption
15272 </p>
15273 </div>
15274 </div></li>
15275 </ul>
15276 !! html/parsoid
15277 <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>
15278
15279 <!-- consistency with gallery extension -->
15280 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15281 <li class="gallerybox">
15282 <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>
15283 <div class="gallerytext">caption</div>
15284 </li>
15285 </ul>
15286 !! end
15287
15288 !! test
15289 Ampersand in link attribute (T206940)
15290 !! wikitext
15291 [[File:Foobar.jpg|link=Foo &amp; bar]]
15292
15293 <!-- consistency with gallery extension -->
15294 <gallery>
15295 File:Foobar.jpg|link=Foo &amp; bar
15296 </gallery>
15297 !! html/php+tidy
15298 <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>
15299 </p>
15300 <ul class="gallery mw-gallery-traditional">
15301 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15302 <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>
15303 <div class="gallerytext">
15304 </div>
15305 </div></li>
15306 </ul>
15307 !! html/parsoid
15308 <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>
15309
15310 <!-- consistency with gallery extension -->
15311 <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"}}'>
15312 <li class="gallerybox">
15313 <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>
15314 <div class="gallerytext"></div>
15315 </li>
15316 </ul>
15317 !! end
15318
15319 !! test
15320 Ampersand in link attribute (edited html, no data-parsoid) (T206940)
15321 !! options
15322 parsoid = {
15323 "nativeGallery": true
15324 }
15325 !! wikitext
15326 [[File:Foobar.jpg|link=Foo_&_bar]]
15327
15328 <!-- consistency with gallery extension -->
15329 <gallery>
15330 File:Foobar.jpg|link=Foo_&_bar
15331 </gallery>
15332 !! html/php+tidy
15333 <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>
15334 </p>
15335 <ul class="gallery mw-gallery-traditional">
15336 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15337 <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>
15338 <div class="gallerytext">
15339 </div>
15340 </div></li>
15341 </ul>
15342 !! html/parsoid
15343 <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>
15344
15345 <!-- consistency with gallery extension -->
15346 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15347 <li class="gallerybox">
15348 <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>
15349 <div class="gallerytext"></div>
15350 </li>
15351 </ul>
15352 !! end
15353
15354 !! test
15355 Italics markup in link attribute (T206940)
15356 !! wikitext
15357 [[Foo''s bar''s]]
15358
15359 <!-- Note that "italics" are stripped, even though this is a valid page title -->
15360 [[File:Foobar.jpg|link=Foo''s bar''s|caption1]]
15361
15362 [[File:Foobar.jpg|link=''Main Page''|caption2]]
15363
15364 <!-- consistency with gallery extension -->
15365 <gallery>
15366 File:Foobar.jpg|link=Foo''s bar''s|caption1
15367 File:Foobar.jpg|link=''Main Page''|caption2
15368 </gallery>
15369 !! html/php+tidy
15370 <p><a href="/wiki/Foo%27%27s_bar%27%27s" title="Foo&#39;&#39;s bar&#39;&#39;s">Foo''s bar''s</a>
15371 </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>
15372 </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>
15373 </p>
15374 <ul class="gallery mw-gallery-traditional">
15375 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15376 <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>
15377 <div class="gallerytext">
15378 <p>caption1
15379 </p>
15380 </div>
15381 </div></li>
15382 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15383 <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>
15384 <div class="gallerytext">
15385 <p>caption2
15386 </p>
15387 </div>
15388 </div></li>
15389 </ul>
15390 !! html/parsoid
15391 <p><a rel="mw:WikiLink" href="./Foo''s_bar''s" title="Foo''s bar''s">Foo''s bar''s</a></p>
15392
15393 <!-- Note that "italics" are stripped, even though this is a valid page title -->
15394 <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>
15395
15396 <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>
15397
15398 <!-- consistency with gallery extension -->
15399 <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"}}'>
15400 <li class="gallerybox">
15401 <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>
15402 <div class="gallerytext">caption1</div>
15403 </li>
15404 <li class="gallerybox">
15405 <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>
15406 <div class="gallerytext">caption2</div>
15407 </li>
15408 </ul>
15409 !! end
15410
15411 !! test
15412 Nowiki markup in link attribute (T206940)
15413 !! wikitext
15414 [[File:Foobar.jpg|link=Foo<nowiki>''</nowiki>s_bar<nowiki>''</nowiki>s|caption]]
15415
15416 <!-- consistency with gallery extension -->
15417 <gallery>
15418 File:Foobar.jpg|link=Foo<nowiki>''</nowiki>s_bar<nowiki>''</nowiki>s|caption
15419 </gallery>
15420 !! html/php+tidy
15421 <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>
15422 </p>
15423 <ul class="gallery mw-gallery-traditional">
15424 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15425 <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>
15426 <div class="gallerytext">
15427 <p>caption
15428 </p>
15429 </div>
15430 </div></li>
15431 </ul>
15432 !! html/parsoid
15433 <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>
15434
15435 <!-- consistency with gallery extension -->
15436 <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"}}'>
15437 <li class="gallerybox">
15438 <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>
15439 <div class="gallerytext">caption</div>
15440 </li>
15441 </ul>
15442 !! end
15443
15444 !! test
15445 Nowiki markup in link attribute (edited html, no data-parsoid) (T206940)
15446 !! options
15447 parsoid = {
15448 "nativeGallery": true
15449 }
15450 !! wikitext
15451 [[File:Foobar.jpg|link=Foo<nowiki>''s_bar''</nowiki>s|caption]]
15452
15453 <!-- consistency with gallery extension -->
15454 <gallery>
15455 File:Foobar.jpg|link=Foo<nowiki>''s_bar''</nowiki>s|caption
15456 </gallery>
15457 !! html/php+tidy
15458 <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>
15459 </p>
15460 <ul class="gallery mw-gallery-traditional">
15461 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15462 <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>
15463 <div class="gallerytext">
15464 <p>caption
15465 </p>
15466 </div>
15467 </div></li>
15468 </ul>
15469 !! html/parsoid
15470 <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>
15471
15472 <!-- consistency with gallery extension -->
15473 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15474 <li class="gallerybox">
15475 <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>
15476 <div class="gallerytext">caption</div>
15477 </li>
15478 </ul>
15479 !! end
15480
15481 !! test
15482 Image with table with attributes in caption
15483 !! options
15484 parsoid=wt2html,html2html
15485 !! wikitext
15486 [[File:Foobar.jpg|thumb|
15487 {| class="123" |
15488 |- class="456" |
15489 | ha
15490 |}
15491 ]]
15492 !! html/parsoid
15493 <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>
15494 <table class="123">
15495 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
15496 <td> ha</td></tr>
15497 </tbody></table>
15498 </figcaption></figure>
15499 !! end
15500
15501 !! test
15502 Image with table with rows from templates in caption
15503 !! wikitext
15504 [[File:Foobar.jpg|thumb|
15505 {|
15506 {{echo|{{!}} hi}}
15507 |}
15508 ]]
15509 !! html/parsoid
15510 <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>
15511 <table>
15512 <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>
15513 </tbody></table>
15514 </figcaption></figure>
15515 !! end
15516
15517 !! test
15518 Image with nested tables in caption
15519 !! wikitext
15520 [[File:Foobar.jpg|thumb|Foo<br />
15521 {|
15522 |
15523 {|
15524 |z
15525 |}
15526 |}
15527 ]]
15528 !! html/parsoid
15529 <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}'/>
15530 <table>
15531 <tbody><tr><td>
15532 <table>
15533 <tbody><tr><td>z</td></tr>
15534 </tbody></table></td></tr>
15535 </tbody></table>
15536 </figcaption></figure>
15537 !! end
15538
15539 !! test
15540 Image with heading and horizontal rule in caption
15541 !! wikitext
15542 [[File:Foobar.jpg|thumb|
15543 ===Testing===
15544 123
15545 --------------
15546 ]]
15547 !! html/php
15548 <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>
15549
15550 !! html/parsoid
15551 <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>
15552 <h3 id="Testing">Testing</h3>
15553 123
15554 <hr data-parsoid='{"extra_dashes":10}'/>
15555 </figcaption></figure>
15556 !! end
15557
15558 ###################
15559 # Conflicting image format options.
15560 # First option specified should 'win'.
15561 # All three cases in each test should be identical.
15562
15563 !! test
15564 Image with 'frameless' first.
15565 !! options
15566 parsoid=wt2html,wt2wt,html2html
15567 !! wikitext
15568 [[File:Foobar.jpg|frameless|caption]]
15569
15570 [[File:Foobar.jpg|frameless|frame|caption]]
15571
15572 [[File:Foobar.jpg|frameless|thumb|caption]]
15573 !! html/php
15574 <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>
15575 </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>
15576 </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>
15577 </p>
15578 !! html/parsoid
15579 <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>
15580 <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>
15581 <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>
15582 !! end
15583
15584 !! test
15585 Image with 'frame' first.
15586 !! options
15587 parsoid=wt2html,wt2wt,html2html
15588 !! wikitext
15589 [[File:Foobar.jpg|frame|caption]]
15590 [[File:Foobar.jpg|frame|frameless|caption]]
15591 [[File:Foobar.jpg|frame|thumb|caption]]
15592 !! html/php
15593 <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>
15594 <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>
15595 <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>
15596
15597 !! html/parsoid
15598 <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>
15599 <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>
15600 <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>
15601 !! end
15602
15603 !! test
15604 Image with 'thumb' first.
15605 !! options
15606 parsoid=wt2html,wt2wt,html2html
15607 !! wikitext
15608 [[File:Foobar.jpg|thumb|caption]]
15609 [[File:Foobar.jpg|thumb|frameless|caption]]
15610 [[File:Foobar.jpg|thumb|frame|caption]]
15611 !! html/php
15612 <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>
15613 <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>
15614 <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>
15615
15616 !! html/parsoid
15617 <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>
15618 <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>
15619 <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>
15620 !! end
15621
15622 ###################
15623 # Image sizing.
15624 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
15625 # and https://phabricator.wikimedia.org/T64258
15626 # Foobar has actual size of 1941x220
15627 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
15628 # a scalable format.
15629 # 2. Framed images always ignore size options; always render at default size.
15630 # 3. "Unspecified format" and border are the only types which can be
15631 # enlarged.
15632
15633 !! test
15634 Image: unspecified format and border enlarge
15635 !! options
15636 parsoid=wt2html,wt2wt,html2html
15637 !! wikitext
15638 [[File:Foobar.jpg|2000px]]
15639
15640 [[File:Foobar.jpg|border|2000px]]
15641 !! html/php
15642 <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>
15643 </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>
15644 </p>
15645 !! html/parsoid
15646 <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>
15647 <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>
15648 !! end
15649
15650 !! test
15651 Image: "unspecified format" and border reduce
15652 !! options
15653 parsoid=wt2html,wt2wt,html2html
15654 !! wikitext
15655 [[File:Foobar.jpg|1000px]]
15656
15657 [[File:Foobar.jpg|border|1000px]]
15658 !! html/php
15659 <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>
15660 </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>
15661 </p>
15662 !! html/parsoid
15663 <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>
15664 <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>
15665 !! end
15666
15667 !! test
15668 Image: thumbs reduce
15669 !! options
15670 parsoid=wt2html,wt2wt,html2html
15671 !! wikitext
15672 [[File:Foobar.jpg|thumb|50px]]
15673 !! html/php
15674 <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>
15675
15676 !! html/parsoid
15677 <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>
15678 !! end
15679
15680 !! test
15681 Image: bitmap thumbs can't be enlarged past original size, but vector can.
15682 !! options
15683 parsoid=wt2html,wt2wt,html2html
15684 !! wikitext
15685 [[File:Foobar.jpg|thumb|2000px]]
15686
15687 [[File:Foobar.svg|thumb|2000px]]
15688 !! html/php
15689 <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>
15690 <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>
15691
15692 !! html/parsoid
15693 <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>
15694 <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>
15695 !! end
15696
15697 !! test
15698 Image: frameless can reduce in size
15699 !! options
15700 parsoid=wt2html,wt2wt,html2html
15701 !! wikitext
15702 [[File:Foobar.jpg|frameless|50px]]
15703 !! html/php
15704 <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>
15705 </p>
15706 !! html/parsoid
15707 <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>
15708 !! end
15709
15710 !! test
15711 Image: bitmap frameless can't be enlarged past original size, but vector can
15712 !! options
15713 parsoid=wt2html,wt2wt,html2html
15714 !! wikitext
15715 [[File:Foobar.jpg|frameless|2000px]]
15716
15717 [[File:Foobar.svg|frameless|2000px]]
15718 !! html/php
15719 <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>
15720 </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>
15721 </p>
15722 !! html/parsoid
15723 <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>
15724 <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>
15725 !! end
15726
15727 !! test
15728 Image: framed images are always unscaled.
15729 !! options
15730 parsoid=wt2html,wt2wt,html2html
15731 !! wikitext
15732 [[File:Foobar.jpg|frame]]
15733
15734 [[File:Foobar.jpg|frame|50px]]
15735
15736 [[File:Foobar.jpg|frame|50x50px]]
15737
15738 [[File:Foobar.jpg|frame|2000px]]
15739 !! html/php
15740 <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>
15741 <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>
15742 <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>
15743 <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>
15744
15745 !! html/parsoid
15746 <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>
15747 <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>
15748 <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>
15749 <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>
15750 !! end
15751
15752 ###################
15753
15754 !! test
15755 Link to image page- image page normally doesn't exists, hence edit link
15756 Add test with existing image page
15757 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
15758 !! wikitext
15759 [[:Image:test]]
15760 !! html
15761 <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>
15762 </p>
15763 !! end
15764
15765 !! test
15766 T20784 Link to non-existent image page with caption should use caption as link text
15767 !! wikitext
15768 [[:Image:test|caption]]
15769 !! html
15770 <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>
15771 </p>
15772 !! end
15773
15774 !! test
15775 Frameless image caption with a free URL
15776 !! wikitext
15777 [[File:Foobar.jpg|http://example.com]]
15778 !! html/php
15779 <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>
15780 </p>
15781 !! html/parsoid
15782 <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>
15783 !! end
15784
15785 !! test
15786 Thumbnail image caption with a free URL
15787 !! options
15788 thumbsize=220
15789 !! wikitext
15790 [[File:Foobar.jpg|thumb|http://example.com]]
15791 !! html/php
15792 <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>
15793
15794 !! html/parsoid
15795 <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>
15796 !! end
15797
15798 !! test
15799 Thumbnail image caption with a free URL and explicit alt
15800 !! options
15801 thumbsize=220
15802 parsoid=wt2html,wt2wt,html2html
15803 !! wikitext
15804 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15805 !! html/php
15806 <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>
15807
15808 !! html/parsoid
15809 <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>
15810 !! end
15811
15812 !! test
15813 SVG thumbnails with no language set
15814 !! options
15815 !! wikitext
15816 [[File:Foobar.svg|thumb|caption]]
15817 !! html/php
15818 <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>
15819
15820 !! html/parsoid
15821 <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>
15822 !! end
15823
15824 !! test
15825 SVG thumbnails with language de
15826 !! options
15827 parsoid=wt2html,wt2wt,html2html
15828 !! wikitext
15829 [[File:Foobar.svg|thumb|caption|lang=de]]
15830 !! html/php
15831 <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>
15832
15833 !! html/parsoid
15834 <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>
15835 !! end
15836
15837 !! test
15838 SVG thumbnails with invalid language code
15839 !! options
15840 parsoid=wt2html,wt2wt,html2html
15841 !! wikitext
15842 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15843 !! html/php
15844 <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>
15845
15846 !! html/parsoid
15847 <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>
15848 !! end
15849
15850 !! test
15851 SVG thumbnails in page language
15852 !! options
15853 language=ru
15854 wgMediaInTargetLanguage = true
15855 !! wikitext
15856 [[File:Foobar.svg]] [[File:Foobar.svg|lang=en]]
15857 !! html/php
15858 <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>
15859 </p>
15860 !! end
15861
15862 !! test
15863 SVG thumbnails in page language not present in the file
15864 !! options
15865 language=de
15866 wgMediaInTargetLanguage = true
15867 !! wikitext
15868 [[File:Foobar.svg]] [[File:Foobar.svg|lang=ru]]
15869 !! html/php
15870 <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>
15871 </p>
15872 !! end
15873
15874 !! test
15875 T3887: A ISBN with a thumbnail
15876 !! wikitext
15877 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15878 !! html/php
15879 <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>
15880
15881 !! html/parsoid
15882 <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>
15883 !! end
15884
15885 !! test
15886 T3887: A RFC with a thumbnail
15887 !! wikitext
15888 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15889 !! html/php
15890 <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>
15891
15892 !! html/parsoid
15893 <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>
15894 !! end
15895
15896 !! test
15897 T3887: A mailto link with a thumbnail
15898 !! wikitext
15899 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15900 !! html/php
15901 <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>
15902
15903 !! html/parsoid
15904 <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>
15905 !! end
15906
15907 # Pending resolution to T2368
15908 !! test
15909 T2648: Frameless image caption with a link
15910 !! wikitext
15911 [[File:Foobar.jpg|text with a [[link]] in it]]
15912 !! html/php
15913 <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>
15914 </p>
15915 !! html/parsoid
15916 <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>
15917 !! end
15918
15919 !! test
15920 T2648: Frameless image caption with a link (suffix)
15921 !! wikitext
15922 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15923 !! html/php
15924 <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>
15925 </p>
15926 !! html/parsoid
15927 <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>
15928 !! end
15929
15930 !! test
15931 T2648: Frameless image caption with an interwiki link
15932 !! wikitext
15933 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15934 !! html/php
15935 <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>
15936 </p>
15937 !! html/parsoid
15938 <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>
15939 !! end
15940
15941 !! test
15942 T2648: Frameless image caption with a piped interwiki link
15943 !! wikitext
15944 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15945 !! html/php
15946 <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>
15947 </p>
15948 !! html/parsoid
15949 <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>
15950 !! end
15951
15952 !! test
15953 T107474: Frameless image caption with <nowiki>
15954 !! wikitext
15955 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15956 !! html/parsoid
15957 <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>
15958 !! end
15959
15960 !! test
15961 Escape HTML special chars in image alt text
15962 !! wikitext
15963 [[File:Foobar.jpg|& < > "]]
15964 !! html/php
15965 <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>
15966 </p>
15967 !! html/parsoid
15968 <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>
15969 !! end
15970
15971 !! test
15972 Escape HTML special chars in image alt text with LanguageConverter
15973 !! options
15974 language=zh
15975 !! wikitext
15976 [[File:Foobar.jpg|& < > "]]
15977 !! html/php
15978 <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>
15979 </p>
15980 !! html/parsoid
15981 <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>
15982 !! end
15983
15984 !! test
15985 Entities in file name and attributes
15986 !! wikitext
15987 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15988 !! html/php
15989 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15990 </p>
15991 !! html/parsoid
15992 <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>
15993 !! end
15994
15995 !! test
15996 T2499: Alt text should have &#1234;, not &amp;1234;
15997 !! wikitext
15998 [[File:Foobar.jpg|&#9792;]]
15999 !! html/php
16000 <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>
16001 </p>
16002 !! html/parsoid
16003 <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>
16004 !! end
16005
16006 !! test
16007 Broken image caption with link
16008 !! options
16009 parsoid=wt2html,wt2wt,html2html
16010 !! wikitext
16011 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
16012 !! html/php
16013 <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.
16014 </p>
16015 !! html/parsoid
16016 <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>
16017 !! end
16018
16019 !! test
16020 Image caption containing another image
16021 !! wikitext
16022 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
16023 !! html/php
16024 <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>
16025
16026 !! html/parsoid
16027 <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>
16028 !! end
16029
16030 !! test
16031 Image: caption containing a newline
16032 !! wikitext
16033 [[File:Foobar.jpg|This
16034 *is some text]]
16035 !! html/php
16036 <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>
16037 </p>
16038 !! html/parsoid
16039 <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>
16040 !!end
16041
16042 !!test
16043 Image: caption containing leading space
16044 (The leading space should not trigger nowiki escaping in wt2wt mode)
16045 !! wikitext
16046 [[File:Foobar.jpg|thumb| bar]]
16047 !! html/php
16048 <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>
16049
16050 !! html/parsoid
16051 <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>
16052 !!end
16053
16054 # html/php output not have newlines after table, td, th, etc. because
16055 # Linker::makeThumbLink2() replaces the newlines with spaces since
16056 # the table is inside a caption.
16057 # FIXME: Verify if that circa 2004 fix is still required.
16058 !! test
16059 Image: caption containing a table
16060 !! options
16061 parsoid=wt2html,wt2wt,html2html
16062 !! wikitext
16063 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
16064 {|
16065 !Foo!!Bar
16066 |-
16067 |Foo1||Bar1
16068 |}
16069 and some more text.]]
16070 !! html/php
16071 <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>
16072
16073 !! html/parsoid
16074 <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
16075 <table>
16076 <tbody>
16077 <tr><th>Foo</th><th>Bar</th></tr>
16078 <tr>
16079 <td>Foo1</td>
16080 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
16081 !! end
16082
16083 !! test
16084 T5090: External links other than http: in image captions
16085 !! wikitext
16086 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
16087 !! html/php
16088 <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>
16089
16090 !! html/parsoid
16091 <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>
16092 !! end
16093
16094 !! test
16095 Custom class
16096 !! options
16097 parsoid=wt2html,wt2wt,html2html
16098 !! wikitext
16099 [[Image:foobar.jpg|a|class=b]]
16100 !! html/php
16101 <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>
16102 </p>
16103 !! html/parsoid
16104 <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>
16105 !! end
16106
16107 !! test
16108 Localized image handling (1).
16109 !! options
16110 parsoid=wt2html,wt2wt,html2html
16111 language=es
16112 !! wikitext
16113 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
16114 !! html/php
16115 <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>
16116
16117 !! html/parsoid
16118 <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>
16119 !! end
16120
16121 !! test
16122 Localized image handling (2).
16123 !! options
16124 thumbsize=220
16125 parsoid=wt2html,wt2wt,html2html
16126 language=es
16127 !! wikitext
16128 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
16129 !! html/php
16130 <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>
16131
16132 !! html/parsoid
16133 <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>
16134 !! end
16135
16136 !! test
16137 Localized image handling (3).
16138 !! options
16139 language=fa
16140 parsoid=html2wt
16141 !! html/parsoid
16142 <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>
16143 !! wikitext
16144 [[File:Foobar.jpg|بندانگشتی]]
16145 !! end
16146
16147 !! test
16148 "border", "frameless" and "class" attributes on an image.
16149 !! options
16150 thumbsize=220
16151 parsoid=wt2html,wt2wt,html2html
16152 !! wikitext
16153 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
16154 !! html/php
16155 <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>
16156 </p>
16157 !! html/parsoid
16158 <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>
16159 !! end
16160
16161 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
16162 !! test
16163 Invalid image attributes (T64500)
16164 !! options
16165 thumbsize=220
16166 parsoid=wt2html,wt2wt,html2html
16167 !! wikitext
16168 [[File:Foobar.jpg|thumb|float|left|caption]]
16169
16170 [[File:Foobar.jpg|thumb|righ|caption]]
16171
16172 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
16173 !! html/php
16174 <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>
16175 <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>
16176 <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>
16177
16178 !! html/parsoid
16179 <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>
16180 <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>
16181 <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>
16182 !! end
16183
16184 !! article
16185 File:Barfoo.jpg
16186 !! text
16187 #REDIRECT [[File:Barfoo.jpg]]
16188 !! endarticle
16189
16190 # FIXME: Parsoid should run this test -- but we'd need to teach the
16191 # mockAPI about the redirected Barfoo.jpg image.
16192 !! test
16193 Redirected image
16194 !! wikitext
16195 [[Image:Barfoo.jpg]]
16196 !! html/php
16197 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
16198 </p>
16199 !! end
16200
16201 !! test
16202 Missing image with uploads disabled
16203 !! options
16204 wgEnableUploads=0
16205 !! wikitext
16206 [[File:Foobaz.jpg]]
16207 !! html/php
16208 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
16209 </p>
16210 !! html/parsoid
16211 <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>
16212 !! end
16213
16214 # Parsoid-specific testing for images
16215 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
16216 # Currently imperfect due to a flaw in the Parsoid testrunner
16217 # Work in progress
16218 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
16219 # image tests.
16220
16221 !! test
16222 Parsoid-specific image handling - simple image with size and middle alignment
16223 !! wikitext
16224 [[File:Foobar.jpg|middle|50px]]
16225 !! html/parsoid
16226 <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>
16227 !! end
16228
16229 !! test
16230 Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
16231 !! options
16232 parsoid=wt2wt,wt2html,html2html
16233 !! wikitext
16234 [[Image:Foobar.jpg|middle|50px]]
16235 !! html/parsoid
16236 <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>
16237 !! end
16238
16239 !! test
16240 Parsoid-specific image handling - simple image with size and middle alignment (existing content)
16241 !! wikitext
16242 [[File:Foobar.jpg|50px|middle]]
16243 !! html/parsoid
16244 <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>
16245 !! end
16246
16247 !! test
16248 Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
16249 !! options
16250 parsoid=wt2html,wt2wt,html2html
16251 !! wikitext
16252 [[Image:Foobar.jpg|50px|middle]]
16253 !! html/parsoid
16254 <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>
16255 !! end
16256
16257 !! test
16258 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
16259 !! wikitext
16260 [[File:Foobar.jpg|500x10px|baseline|caption]]
16261 !! html/parsoid
16262 <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>
16263 !! end
16264
16265 !! test
16266 Parsoid-specific image handling - simple image with border and size spec
16267 !! wikitext
16268 [[File:Foobar.jpg|50px|border|caption]]
16269 !! html/parsoid
16270 <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>
16271 !! end
16272
16273 !! test
16274 Parsoid-specific image handling - thumbnail with halign, valign, and caption
16275 !! options
16276 parsoid=wt2html,html2html
16277 !! wikitext
16278 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
16279 !! html/parsoid
16280 <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>
16281 !! end
16282
16283 !! test
16284 Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
16285 !! options
16286 parsoid=wt2html,html2html
16287 !! wikitext
16288 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
16289 !! html/parsoid
16290 <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>
16291 !! end
16292
16293 !! test
16294 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
16295 !! options
16296 parsoid=wt2html,html2html
16297 !! wikitext
16298 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
16299 !! html/parsoid
16300 <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>
16301 !! end
16302
16303 !! test
16304 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
16305 !! options
16306 parsoid=wt2html,html2html
16307 !! wikitext
16308 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
16309 !! html/parsoid
16310 <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>
16311 !! end
16312
16313 !! test
16314 Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
16315 !! options
16316 parsoid=wt2html,wt2wt,html2html
16317 !! wikitext
16318 [[File:Foobar.jpg|frame|500x50px|caption]]
16319 !! html/parsoid
16320 <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>
16321 !! end
16322
16323 !! test
16324 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
16325 !! options
16326 parsoid=wt2html,html2html
16327 !! wikitext
16328 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
16329 !! html/parsoid
16330 <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>
16331 !! end
16332
16333 !! test
16334 Parsoid-specific image handling - frameless image with specific size, border, and caption
16335 !! wikitext
16336 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
16337 !! html/parsoid
16338 <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>
16339 !! end
16340
16341 !! test
16342 Parsoid-specific image handling - simple image with a formatted caption
16343 !! wikitext
16344 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
16345 !! html/parsoid
16346 <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>
16347 !! end
16348
16349 !! test
16350 Parsoid-specific image handling - caption with a template in it
16351 !! wikitext
16352 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
16353 !! html/parsoid
16354 <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>
16355 !! end
16356
16357 !! test
16358 Parsoid-specific image handling - caption with unbalanced tags in it
16359 !! options
16360 parsoid=wt2html,wt2wt,html2html
16361 !! wikitext
16362 foo
16363 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
16364 bar
16365 !! html/parsoid
16366 <p>foo</p>
16367 <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>
16368 <p>bar</p>
16369 !! end
16370
16371 !! test
16372 Parsoid-specific image handling - empty caption (1)
16373 !! options
16374 parsoid=wt2html,wt2wt
16375 !! wikitext
16376 [[File:Foobar.jpg|thumb|]]
16377 !! html/parsoid
16378 <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>
16379 !! end
16380
16381 # empty captions don't get serialized unless we're in the "round trip" case
16382 !! test
16383 Parsoid-specific image handling - empty caption (2)
16384 !! options
16385 parsoid=html2wt
16386 !! html/parsoid
16387 <figure class="mw-default-size" typeof="mw:Image/Thumb">
16388 <a href="./File:Foobar.jpg">
16389 <img resource="./File:Foobar.jpg"
16390 src="//example.com/images/3/3a/Foobar.jpg"
16391 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
16392 height="25" width="220"/>
16393 </a>
16394 <figcaption></figcaption>
16395 </figure>
16396 !! wikitext
16397 [[File:Foobar.jpg|thumb]]
16398 !! end
16399
16400 !! test
16401 Parsoid-specific image handling - whitespace caption
16402 !! wikitext
16403 [[File:Foobar.jpg|thumb| ]]
16404 !! html/parsoid
16405 <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>
16406 !! end
16407
16408 !! test
16409 Parsoid-specific image handling - lang option
16410 !! wikitext
16411 foo
16412 [[File:Foobar.svg|lang=de|caption]]
16413 bar
16414 !! html/parsoid
16415 <p>foo
16416 <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>
16417 bar</p>
16418 !! end
16419
16420 ## Edge case bugs in Parsoid from T93580
16421 !! test
16422 T93580: 1. Templated <ref> inside block images
16423 !! wikitext
16424 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
16425
16426 <references />
16427 !! html/parsoid
16428 <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>
16429
16430 <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>
16431 !! end
16432
16433 !! test
16434 T93580: 2. <ref> inside inline images
16435 !! wikitext
16436 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
16437
16438 <references />
16439 !! html/parsoid
16440 <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>
16441
16442 <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>
16443 !! end
16444
16445 !! test
16446 T93580: 3. Templated <ref> inside inline images
16447 !! wikitext
16448 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
16449
16450 <references />
16451 !! html/parsoid
16452 <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>
16453
16454 <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>
16455 !! end
16456
16457 ###
16458 ### Subpages
16459 ###
16460 !! article
16461 Subpage test/subpage
16462 !! text
16463 foo
16464 !! endarticle
16465
16466 !! test
16467 Subpage link
16468 !! options
16469 subpage title=[[Subpage test]]
16470 !! wikitext
16471 [[/subpage]]
16472 !! html
16473 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
16474 </p>
16475 !! end
16476
16477 !! test
16478 Subpage noslash link
16479 !! options
16480 subpage title=[[Subpage test]]
16481 !! wikitext
16482 [[/subpage/]]
16483 !! html
16484 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
16485 </p>
16486 !! end
16487
16488 !! article
16489 Subpage test/1/2/subpage
16490 !! text
16491 blah
16492 !! endarticle
16493
16494 !! test
16495 Relative subpage noslash link
16496 !! options
16497 parsoid=wt2wt,wt2html,html2html
16498 subpage title=[[Subpage test/1/2/3/4]]
16499 !! wikitext
16500 [[../../subpage/]]
16501
16502 [[../../subpage]]
16503 !! html/php
16504 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
16505 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
16506 </p>
16507 !! html/parsoid
16508 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
16509 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
16510 !! end
16511
16512 !! test
16513 Parsoid: dot-slash prefixed wikilinks
16514 !! wikitext
16515 [[./foo]]
16516
16517 [[././bar]]
16518
16519 [[././baz/]]
16520 !! html/php
16521 <p>[[./foo]]
16522 </p><p>[[././bar]]
16523 </p><p>[[././baz/]]
16524 </p>
16525 !! html/parsoid
16526 <p>[[./foo]]
16527 </p><p>[[././bar]]
16528 </p><p>[[././baz/]]
16529 </p>
16530 !! end
16531
16532 !! test
16533 Render invalid page names as plain text (T53090)
16534 !! wikitext
16535 [[./../foo|bar]]
16536 [[foo�|bar]]
16537 [[foo/.|bar]]
16538 [[foo/..|bar]]
16539 [[foo~~~bar]]
16540 [[foo>bar]]
16541 [[foo[bar]]
16542 [[.]]
16543 [[..]]
16544 [[foo././bar]]
16545 [[foo[http://example.com]xyz]]
16546
16547 [[{{echo|./../foo}}|bar]]
16548 [[{{echo|foo/.}}|bar]]
16549 [[{{echo|foo/..}}|bar]]
16550 [[{{echo|foo~~~~bar}}]]
16551 [[{{echo|foo>bar}}]]
16552 [[{{echo|foo././bar}}]]
16553 [[{{echo|foo{bar}}]]
16554 [[{{echo|foo}bar}}]]
16555 [[{{echo|foo[bar}}]]
16556 [[{{echo|foo]bar}}]]
16557 [[{{echo|foo<bar}}]]
16558 !!html/php
16559 <p>[[./../foo|bar]]
16560 [[foo�|bar]]
16561 [[foo/.|bar]]
16562 [[foo/..|bar]]
16563 [[foo~~~bar]]
16564 [[foo&gt;bar]]
16565 [[foo[bar]]
16566 [[.]]
16567 [[..]]
16568 [[foo././bar]]
16569 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
16570 </p><p>[[./../foo|bar]]
16571 [[foo/.|bar]]
16572 [[foo/..|bar]]
16573 [[foo~~~~bar]]
16574 [[foo&gt;bar]]
16575 [[foo././bar]]
16576 [[foo{bar]]
16577 [[foo}bar]]
16578 [[foo[bar]]
16579 [[foo]bar]]
16580 [[foo&lt;bar]]
16581 </p>
16582 !!html/parsoid
16583 <p>[[./../foo|bar]]
16584 [[foo�|bar]]
16585 [[foo/.|bar]]
16586 [[foo/..|bar]]
16587 [[foo~~~bar]]
16588 [[foo>bar]]
16589 [[foo[bar]]
16590 [[.]]
16591 [[..]]
16592 [[foo././bar]]
16593 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
16594
16595 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
16596 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
16597 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
16598 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
16599 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
16600 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
16601 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
16602 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
16603 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
16604 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
16605 [[<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>
16606 !!end
16607
16608 !! test
16609 Disabled subpages
16610 !! wikitext
16611 [[/subpage]]
16612 !! html
16613 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
16614 </p>
16615 !! end
16616
16617 !! test
16618 T2561: {{/Subpage}}
16619 !! options
16620 subpage title=[[Page]]
16621 !! wikitext
16622 {{/Subpage}}
16623 !! html
16624 <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>
16625 </p>
16626 !! end
16627
16628 ###
16629 ### Categories
16630 ###
16631 !! article
16632 Category:MediaWiki User's Guide
16633 !! text
16634 blah
16635 !! endarticle
16636
16637 !! test
16638 Link to category
16639 !! wikitext
16640 [[:Category:MediaWiki User's Guide]]
16641 !! html
16642 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
16643 </p>
16644 !! end
16645
16646 !! test
16647 Simple category
16648 !! options
16649 cat
16650 !! wikitext
16651 [[Category:MediaWiki User's Guide]]
16652 !! html/php
16653 cat=MediaWiki_User's_Guide sort=
16654 !! html/parsoid
16655 <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"}}'/>
16656 !! end
16657
16658 !! test
16659 PAGESINCATEGORY invalid title fatal (r33546 fix)
16660 !! wikitext
16661 {{PAGESINCATEGORY:<bogus>}}
16662 !! html
16663 <p>0
16664 </p>
16665 !! end
16666
16667 !! test
16668 Category with different sort key
16669 !! options
16670 cat
16671 !! wikitext
16672 [[Category:MediaWiki User's Guide|Foo]]
16673 !! html/php
16674 cat=MediaWiki_User's_Guide sort=Foo
16675 !! html/parsoid
16676 <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"}}'/>
16677 !! end
16678
16679 !! test
16680 Category with identical sort key
16681 !! options
16682 cat
16683 !! wikitext
16684 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16685 !! html/php
16686 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
16687 !! html/parsoid
16688 <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"}}'/>
16689 !! end
16690
16691 !! test
16692 Category with empty sort key
16693 !! options
16694 cat
16695 pst
16696 !! wikitext
16697 [[Category:MediaWiki User's Guide|]]
16698 !! html/php
16699 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16700 !! end
16701
16702 !! test
16703 Category with empty sort key and parentheses
16704 !! options
16705 cat
16706 pst
16707 !! wikitext
16708 [[Category:Foo (bar)|]]
16709 !! html/php
16710 [[Category:Foo (bar)|Foo]]
16711 !! end
16712
16713 !! test
16714 Category with link tail
16715 !! options
16716 cat
16717 pst
16718 !! wikitext
16719 123[[Category:Foo]]456
16720 !! html/php
16721 123[[Category:Foo]]456
16722 !! end
16723
16724 !! test
16725 Category with template
16726 !! options
16727 cat
16728 pst
16729 !! wikitext
16730 [[Category:{{echo|Foo}}]]
16731 !! html/php
16732 [[Category:{{echo|Foo}}]]
16733 !! end
16734
16735 !! test
16736 Category with template in sort key
16737 !! options
16738 cat
16739 pst
16740 !! wikitext
16741 [[Category:Foo|{{echo|Bar}}]]
16742 !! html/php
16743 [[Category:Foo|{{echo|Bar}}]]
16744 !! end
16745
16746 !! test
16747 Category with template in sort key and title
16748 !! options
16749 cat
16750 pst
16751 !! wikitext
16752 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16753 !! html/php
16754 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16755 !! end
16756
16757 ## We used to, but no longer wt2wt this test since the default serializer
16758 ## will normalize all categories to serialize on their own line.
16759 ## This wikitext usage is going to be fairly uncommon in production and
16760 ## selser will take care of preserving formatting in those scenarios.
16761 !! test
16762 Category / paragraph interactions
16763 !! options
16764 parsoid=wt2html
16765 !! wikitext
16766 Foo [[Category:Baz]] Bar
16767
16768 Foo [[Category:Baz]]
16769 Bar
16770
16771 Foo
16772 [[Category:Baz]]
16773 Bar
16774
16775 Foo
16776 [[Category:Baz]] Bar
16777
16778 Foo
16779 [[Category:Baz]]
16780 [[Category:Baz]]
16781 [[Category:Baz]]
16782 Bar
16783
16784 [[Category:Baz]]
16785 [[Category:Baz]]
16786 [[Category:Baz]]
16787
16788 [[Category:Baz]]
16789 {{echo|[[Category:Baz]]}}
16790 [[Category:Baz]]
16791 !! html/php
16792 <p>Foo Bar
16793 </p><p>Foo
16794 Bar
16795 </p><p>Foo
16796 Bar
16797 </p><p>Foo Bar
16798 </p><p>Foo
16799 Bar
16800 </p>
16801 !! html/parsoid
16802 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16803 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16804 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16805 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16806 <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>
16807 <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}}]}'/>
16808 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16809 !! end
16810
16811 ## We used to, but no longer wt2wt this test since the default serializer
16812 ## will normalize all categories to serialize on their own line.
16813 ## This wikitext usage is going to be fairly uncommon in production and
16814 ## selser will take care of preserving formatting in those scenarios.
16815 ##
16816 ## The whitespace on the empty line is part of the test. Please do not delete
16817 !! test
16818 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16819 !! options
16820 parsoid=wt2html
16821 !! wikitext
16822 This
16823
16824 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16825
16826 {{echo|[[Category:Foo]] and so should this!}}
16827 !! html/php
16828 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16829 </p>
16830 !! html/parsoid
16831 <p>This
16832
16833 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16834
16835 <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>
16836 !! end
16837
16838 ## Parsoid will not try to wt2wt this while preserving newlines because
16839 ## it suppresses excess newlines within list items -- and we don't want to
16840 ## introduce a special case just for categories, which is, in reality somewhat
16841 ## odd behavior -- categories are unlikely to be used in list items like this
16842 ## in top-level pages and are only likely to show up in template-generated
16843 ## list items where this RT-ing is a non-issue.
16844 ##
16845 ## The whitespace on the empty line is part of the test. Please do not delete
16846 !! test
16847 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16848 !! options
16849 parsoid=wt2html
16850 !! wikitext
16851 * This
16852
16853 [[Category:Foo]] and this should be part of the same list item
16854 * So should this
16855
16856 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16857 !! html/php+tidy
16858 <ul><li>This and this should be part of the same list item</li>
16859 <li>So should this and this should be part of the same list item</li></ul>
16860 !! html/parsoid
16861 <ul>
16862 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16863 <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>
16864 </ul>
16865 !! end
16866
16867 ## Newlines and categories that follow the last item of a list
16868 ## are treated differently because this (list followed by categories)
16869 ## is an extremely common pattern on wikis.
16870 !! test
16871 3. Categories and newlines: newline suppression for last list item should RT properly
16872 !! wikitext
16873 *a
16874 *b
16875
16876 [[Category:Foo]]
16877
16878 [[Category:Bar]]
16879 [[Category:Baz]]
16880
16881 :c
16882
16883 [[Category:C]]
16884
16885 ;d
16886
16887 [[Category:D]]
16888 !! html/parsoid
16889 <ul><li>a</li>
16890 <li>b</li></ul>
16891
16892 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16893
16894 <link rel="mw:PageProp/Category" href="./Category:Bar"/>
16895 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16896
16897 <dl><dd>c</dd></dl>
16898
16899 <link rel="mw:PageProp/Category" href="./Category:C"/>
16900
16901 <dl><dt>d</dt></dl>
16902
16903 <link rel="mw:PageProp/Category" href="./Category:D"/>
16904 !! end
16905
16906 !! test
16907 4. Categories and newlines: newline suppression for last list item should RT properly
16908 !! wikitext
16909 *a
16910 ****b
16911
16912 [[Category:Foo]]
16913 !! html/parsoid
16914 <ul><li>a
16915 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
16916
16917 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16918 !! end
16919
16920 ## only wt2html for this to make sure the algo only applies to the rightmost path
16921 !! test
16922 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16923 !! options
16924 parsoid=wt2html
16925 !! wikitext
16926 *a
16927 **b
16928 [[Category:Foo]]
16929 *c
16930 **d
16931 [[Category:Foo]]
16932 !! html/parsoid
16933 <ul><li>a
16934 <ul><li>b
16935 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16936 <li>c
16937 <ul><li>d</li></ul></li></ul>
16938 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16939 !! end
16940
16941 ## We used to, but no longer wt2wt this test since the default serializer
16942 ## will normalize all categories to serialize on their own line.
16943 ## This wikitext usage is going to be fairly uncommon in production and
16944 ## selser will take care of preserving formatting in those scenarios.
16945 !! test
16946 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16947 !! options
16948 parsoid=wt2html
16949 !! wikitext
16950 *a [[Category:Foo]]
16951 !! html/parsoid
16952 <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>
16953 !! end
16954
16955 # This test also demonstrates because of newline+category tunneling
16956 # through the list hander, template wrapping doesn't expand to the
16957 # containing list when the list item swallows the category.
16958 !! test
16959 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16960 !! wikitext
16961 *{{echo|a
16962 [[Category:Foo]]}}
16963 !! html/parsoid
16964 <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
16965 </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>
16966 !! end
16967
16968 !! test
16969 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16970 !! wikitext
16971 *a
16972
16973 {{echo|[[Category:Foo]]
16974 [[Category:Bar]]}}
16975 [[Category:Baz]]
16976 !! html/parsoid
16977 <ul><li>a</li></ul>
16978
16979 <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">
16980 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16981 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16982 !! end
16983
16984 !! test
16985 Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
16986 !! wikitext
16987 *a
16988
16989 [[Category:Bar]]<!--boo1--> <!--boo2-->
16990 [[Category:Baz]]<!--boo3--> <!--boo4-->
16991 !! html/parsoid
16992 <ul><li>a</li></ul>
16993
16994 <link rel="mw:PageProp/Category" href="./Category:Bar"/><!--boo1--> <!--boo2-->
16995 <link rel="mw:PageProp/Category" href="./Category:Baz"/><!--boo3--> <!--boo4-->
16996 !! end
16997
16998 !! test
16999 Categories and newlines: should behave properly with linkprefix (T87753)
17000 !! options
17001 language=ar
17002 !! wikitext
17003 foo bar
17004 foo bar
17005 [[تصنيف:Foo]]
17006 [[تصنيف:Bar]]
17007 !! html/php
17008 <p>foo bar
17009 foo bar
17010 </p>
17011 !! html/parsoid
17012 <p>foo bar
17013 foo bar</p>
17014 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
17015 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
17016 !! end
17017
17018 !! test
17019 No regressions on internal links following category (T174639)
17020 !! options
17021 parsoid=wt2html,html2html
17022 !! wikitext
17023 [[Category:Foo]]<div>a
17024
17025 [[Foo]]</div>
17026 !! html/php
17027 <div>a
17028 <a href="/wiki/Foo" title="Foo">Foo</a></div>
17029
17030 !! html/parsoid
17031 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
17032
17033 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
17034 !! end
17035
17036 # Note that Parsoid differs slightly from PHP due to T175421
17037 !! test
17038 11. Special case where only newlines separate links (T175416)
17039 !! options
17040 parsoid=wt2html,html2html
17041 !! wikitext
17042 [[Category:Foo]]
17043
17044 [[Foo]][[es:Alimento]]
17045
17046 [[Foo]]
17047 !! html/php
17048 <p><br />
17049 <a href="/wiki/Foo" title="Foo">Foo</a>
17050 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
17051 </p>
17052 !! html/parsoid
17053 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
17054
17055 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
17056
17057 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
17058 !! end
17059
17060 !! test
17061 Category links with multiple namespaces
17062 !! wikitext
17063 [[Category:Project:Foo]]
17064 !! html/parsoid
17065 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
17066 !! end
17067
17068 !! test
17069 Parsoid: Serialize link to category page with colon escape
17070 !! wikitext
17071
17072 [[:Category:Foo]]
17073 [[:Category:Foo|Bar]]
17074 !! html/php+tidy
17075 <p><a href="/index.php?title=Category:Foo&amp;action=edit&amp;redlink=1" class="new" title="Category:Foo (page does not exist)">Category:Foo</a>
17076 <a href="/index.php?title=Category:Foo&amp;action=edit&amp;redlink=1" class="new" title="Category:Foo (page does not exist)">Bar</a>
17077 </p>
17078 !! html/parsoid
17079 <p>
17080 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
17081 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
17082 </p>
17083 !! end
17084
17085 # We used to, but no longer wt2wt this test since the default serializer
17086 # will normalize all categories to serialize on their own line.
17087 # This wikitext usage is going to be fairly uncommon in production and
17088 # selser will take care of preventing whitespace insertion if this
17089 # occurs in an article.
17090 #
17091 # html2html disabled for the same reason (whitespace insertion between
17092 # x and y).
17093 #
17094 # html2wt disabled because it localizes the "Category" namespace.
17095 !! test
17096 Link prefix/suffixes aren't applied to category links
17097 !! options
17098 parsoid=wt2html
17099 language=is
17100 !! wikitext
17101 x[[Category:Foo]]y
17102 !! html/php
17103 <p>xy
17104 </p>
17105 !! html/parsoid
17106 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
17107 !! end
17108
17109 !! test
17110 Link prefix/suffixes aren't applied to language links
17111 !! options
17112 parsoid=wt2html
17113 language=is
17114 !! wikitext
17115 x[[es:Foo]]y
17116 !! html/php
17117 <p>xy
17118 </p>
17119 !! html/parsoid
17120 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
17121 !! end
17122
17123 !! test
17124 Parsoid: Serialize link to file page with colon escape
17125 !! wikitext
17126
17127 [[:File:Foo.png]]
17128 [[:File:Foo.png|Bar]]
17129 !! html/php+tidy
17130 <p><a href="/index.php?title=File:Foo.png&amp;action=edit&amp;redlink=1" class="new" title="File:Foo.png (page does not exist)">File:Foo.png</a>
17131 <a href="/index.php?title=File:Foo.png&amp;action=edit&amp;redlink=1" class="new" title="File:Foo.png (page does not exist)">Bar</a>
17132 </p>
17133 !! html/parsoid
17134 <p>
17135 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
17136 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
17137 </p>
17138 !! end
17139
17140 !! test
17141 Parsoid: Serialize a genuine category link without colon escape
17142 !! wikitext
17143 [[Category:Foo]]
17144 [[Category:Foo|Bar]]
17145 !! html/php+tidy
17146 !! html/parsoid
17147 <link rel="mw:PageProp/Category" href="./Category:Foo">
17148 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
17149 !! end
17150
17151 !! test
17152 Normalize hrefs properly before testing for invalid link targets (T72894)
17153 !! options
17154 parsoid=html2wt
17155 !! html/parsoid
17156 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
17157 !! wikitext
17158 [[Category:Toxine bactérienne]]
17159 !! end
17160
17161 !! test
17162 Parsoid: Defaultsort
17163 !! wikitext
17164 {{DEFAULTSORT:Foo}}
17165 !! html/parsoid
17166 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
17167 !! end
17168
17169 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
17170 # But, this is a limitation of our representation and is documented in
17171 # TemplateHandler.js in processSpecialMagicWord
17172 !! test
17173 Parsoid: Defaultsort (template-generated)
17174 !! wikitext
17175 {{{{echo|DEFAULTSORT}}:Foo}}
17176 !! html/parsoid
17177 <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"}]]}'/>
17178 !! end
17179
17180 ###
17181 ### Inter-language links
17182 ###
17183 !! test
17184 Interlanguage links
17185 !! options
17186 ill
17187 !! wikitext
17188 [[es:Alimento]]
17189 [[fr:Nourriture]]
17190 [[zh:食品]]
17191 !! html/php
17192 es:Alimento fr:Nourriture zh:食品
17193 !! html/parsoid
17194 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
17195 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
17196 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
17197 !! end
17198
17199 !! test
17200 Duplicate interlanguage links (T26502)
17201 !! options
17202 ill
17203 !! wikitext
17204 [[es:1]]
17205 [[es:2]]
17206 [[fr:1]]
17207 [[fr:2]]
17208 !! html/php
17209 es:1 fr:1
17210 !! html/parsoid
17211 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
17212 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
17213 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
17214 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
17215 !! end
17216
17217 ###
17218 ### Sections
17219 ###
17220 !! test
17221 Basic section headings
17222 !! wikitext
17223 ==Headline 1==
17224 Some text
17225
17226 ==Headline 2==
17227 More
17228 ===Smaller headline===
17229 Blah blah
17230 !! html
17231 <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>
17232 <p>Some text
17233 </p>
17234 <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>
17235 <p>More
17236 </p>
17237 <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>
17238 <p>Blah blah
17239 </p>
17240 !! end
17241
17242 !! test
17243 Section headings with TOC
17244 !! wikitext
17245 ==Headline 1==
17246 ===Subheadline 1===
17247 =====Skipping a level=====
17248 ======Skipping a level======
17249
17250 ==Headline 2==
17251 Some text
17252 ===Another headline===
17253 !! html
17254 <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>
17255 <ul>
17256 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
17257 <ul>
17258 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
17259 <ul>
17260 <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>
17261 <ul>
17262 <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>
17263 </ul>
17264 </li>
17265 </ul>
17266 </li>
17267 </ul>
17268 </li>
17269 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
17270 <ul>
17271 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
17272 </ul>
17273 </li>
17274 </ul>
17275 </div>
17276
17277 <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>
17278 <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>
17279 <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>
17280 <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>
17281 <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>
17282 <p>Some text
17283 </p>
17284 <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>
17285
17286 !! end
17287
17288 !! test
17289 TOC anchors don't collide
17290 !! wikitext
17291 __FORCETOC__
17292 ==Headline 2==
17293 ==Headline==
17294 ==Headline 2==
17295 ==Headline==
17296 !! html/php
17297 <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>
17298 <ul>
17299 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
17300 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
17301 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
17302 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
17303 </ul>
17304 </div>
17305
17306 <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>
17307 <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>
17308 <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>
17309 <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>
17310
17311 !! end
17312
17313 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
17314 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
17315 !! test
17316 Handling of sections up to level 6 and beyond
17317 !! options
17318 parsoid=wt2html
17319 !! wikitext
17320 =Level 1 Heading=
17321 ==Level 2 Heading==
17322 ===Level 3 Heading===
17323 ====Level 4 Heading====
17324 =====Level 5 Heading=====
17325 ======Level 6 Heading======
17326 =======Level 7 Heading=======
17327 ========Level 8 Heading========
17328 =========Level 9 Heading=========
17329 ==========Level 10 Heading==========
17330 !! html/php
17331 <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>
17332 <ul>
17333 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
17334 <ul>
17335 <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>
17336 <ul>
17337 <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>
17338 <ul>
17339 <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>
17340 <ul>
17341 <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>
17342 <ul>
17343 <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>
17344 <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>
17345 <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>
17346 <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>
17347 <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>
17348 </ul>
17349 </li>
17350 </ul>
17351 </li>
17352 </ul>
17353 </li>
17354 </ul>
17355 </li>
17356 </ul>
17357 </li>
17358 </ul>
17359 </div>
17360
17361 <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>
17362 <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>
17363 <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>
17364 <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>
17365 <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>
17366 <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>
17367 <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>
17368 <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>
17369 <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>
17370 <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>
17371
17372 !! html/parsoid
17373 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
17374 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
17375 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
17376 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
17377 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
17378 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
17379 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
17380 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
17381 <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>
17382 <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>
17383 !! end
17384
17385 !! test
17386 TOC regression (T11764)
17387 !! wikitext
17388 ==title 1==
17389 ===title 1.1===
17390 ====title 1.1.1====
17391 ===title 1.2===
17392 ==title 2==
17393 ===title 2.1===
17394 !! html
17395 <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>
17396 <ul>
17397 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17398 <ul>
17399 <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>
17400 <ul>
17401 <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>
17402 </ul>
17403 </li>
17404 <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>
17405 </ul>
17406 </li>
17407 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
17408 <ul>
17409 <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>
17410 </ul>
17411 </li>
17412 </ul>
17413 </div>
17414
17415 <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>
17416 <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>
17417 <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>
17418 <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>
17419 <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>
17420 <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>
17421
17422 !! end
17423
17424 !! test
17425 TOC for heading containing <span id="..."></span> (T96153)
17426 !! wikitext
17427 __FORCETOC__
17428 ==<span id="old-anchor"></span>New title==
17429 !! html/php
17430 <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>
17431 <ul>
17432 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
17433 </ul>
17434 </div>
17435
17436 <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>
17437
17438 !! end
17439
17440 !! test
17441 TOC with wgMaxTocLevel=3 (T8204)
17442 !! options
17443 wgMaxTocLevel=3
17444 !! wikitext
17445 ==title 1==
17446 ===title 1.1===
17447 ====title 1.1.1====
17448 ===title 1.2===
17449 ==title 2==
17450 ===title 2.1===
17451 !! html
17452 <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>
17453 <ul>
17454 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17455 <ul>
17456 <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>
17457 <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>
17458 </ul>
17459 </li>
17460 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
17461 <ul>
17462 <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>
17463 </ul>
17464 </li>
17465 </ul>
17466 </div>
17467
17468 <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>
17469 <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>
17470 <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>
17471 <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>
17472 <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>
17473 <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>
17474
17475 !! end
17476
17477 !! test
17478 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
17479 !! options
17480 wgMaxTocLevel=3
17481 !! wikitext
17482 ==Section 1==
17483 ===Section 1.1===
17484 ====Section 1.1.1====
17485 ====Section 1.1.1.1====
17486 ==Section 2==
17487 !! html
17488 <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>
17489 <ul>
17490 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
17491 <ul>
17492 <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>
17493 </ul>
17494 </li>
17495 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
17496 </ul>
17497 </div>
17498
17499 <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>
17500 <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>
17501 <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>
17502 <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>
17503 <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>
17504
17505 !! end
17506
17507
17508 !! test
17509 Resolving duplicate section names
17510 !! wikitext
17511 ==Foo bar==
17512 ==Foo bar==
17513 !! html
17514 <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>
17515 <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>
17516
17517 !! end
17518
17519 !! test
17520 Resolving duplicate section names with differing case (T12721)
17521 !! wikitext
17522 ==Foo bar==
17523 ==Foo Bar==
17524 !! html
17525 <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>
17526 <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>
17527
17528 !! end
17529
17530 !! article
17531 Template:sections
17532 !! text
17533 ===Section 1===
17534 ==Section 2==
17535 !! endarticle
17536
17537 !! test
17538 Template with sections, __NOTOC__
17539 !! wikitext
17540 __NOTOC__
17541 ==Section 0==
17542 {{sections}}
17543 ==Section 4==
17544 !! html
17545 <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>
17546 <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>
17547 <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>
17548 <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>
17549
17550 !! end
17551
17552 !! test
17553 __NOEDITSECTION__ keyword
17554 !! wikitext
17555 __NOEDITSECTION__
17556 ==Section 1==
17557 ==Section 2==
17558 !! html
17559 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
17560 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
17561
17562 !! end
17563
17564 !! test
17565 Link inside a section heading
17566 !! wikitext
17567 ==Section with a [[Main Page|link]] in it==
17568 !! html
17569 <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>
17570
17571 !! end
17572
17573 !! test
17574 TOC regression (T14077)
17575 !! wikitext
17576 __TOC__
17577 ==title 1==
17578 ===title 1.1===
17579 ==title 2==
17580 !! html
17581 <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>
17582 <ul>
17583 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17584 <ul>
17585 <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>
17586 </ul>
17587 </li>
17588 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
17589 </ul>
17590 </div>
17591
17592 <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>
17593 <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>
17594 <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>
17595
17596 !! end
17597
17598 !! test
17599 T3219 URL next to image (good)
17600 !! wikitext
17601 http://example.com [[File:Foobar.jpg]]
17602 !! html/php
17603 <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>
17604 </p>
17605 !! html/parsoid
17606 <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>
17607 !!end
17608
17609 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
17610 !! test
17611 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
17612 !! options
17613 parsoid=wt2html,html2html
17614 !! wikitext
17615 ===
17616 The line above must have a trailing space!
17617 === <!--
17618 --> <!-- -->
17619 But just in case it doesn't...
17620 !! html/php
17621 <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>
17622 <p>The line above must have a trailing space!
17623 </p>
17624 <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>
17625 <p>But just in case it doesn't...
17626 </p>
17627 !! html/parsoid
17628 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
17629 <p>The line above must have a trailing space!</p>
17630 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
17631 --> <!-- -->
17632 <p>But just in case it doesn't...</p>
17633 !! end
17634
17635 !! test
17636 Header with special characters (T27462)
17637 !! wikitext
17638 The tooltips shall not show entities to the user (ie. be double escaped)
17639
17640 ==text > text==
17641 section 1
17642
17643 ==text < text==
17644 section 2
17645
17646 ==text & text==
17647 section 3
17648
17649 ==text ' text==
17650 section 4
17651
17652 ==text " text==
17653 section 5
17654 !! html/php
17655 <p>The tooltips shall not show entities to the user (ie. be double escaped)
17656 </p>
17657 <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>
17658 <ul>
17659 <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>
17660 <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>
17661 <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>
17662 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
17663 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
17664 </ul>
17665 </div>
17666
17667 <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>
17668 <p>section 1
17669 </p>
17670 <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>
17671 <p>section 2
17672 </p>
17673 <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>
17674 <p>section 3
17675 </p>
17676 <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>
17677 <p>section 4
17678 </p>
17679 <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>
17680 <p>section 5
17681 </p>
17682 !! html/parsoid
17683 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
17684
17685 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
17686 <p>section 1</p>
17687
17688 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
17689 <p>section 2</p>
17690
17691 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
17692 <p>section 3</p>
17693
17694 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
17695 <p>section 4</p>
17696
17697 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
17698 <p>section 5</p>
17699 !! end
17700
17701 !! test
17702 Header with space, plus and underscore as entity
17703 !! wikitext
17704 Id should not contain + for spaces
17705
17706 ==Space between Text==
17707 section 1
17708
17709 ==Space-Entity&#32;between&#32;Text==
17710 section 2
17711
17712 ==Plus+between+Text==
17713 section 3
17714
17715 ==Plus-Entity&#43;between&#43;Text==
17716 section 4
17717
17718 ==Underscore_between_Text==
17719 section 5
17720
17721 ==Underscore-Entity&#95;between&#95;Text==
17722 section 6
17723
17724 [[#Space between Text]]
17725 [[#Space-Entity&#32;between&#32;Text]]
17726 [[#Plus+between+Text]]
17727 [[#Plus-Entity&#43;between&#43;Text]]
17728 [[#Underscore_between_Text]]
17729 [[#Underscore-Entity&#95;between&#95;Text]]
17730 !! html/php
17731 <p>Id should not contain + for spaces
17732 </p>
17733 <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>
17734 <ul>
17735 <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>
17736 <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>
17737 <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>
17738 <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>
17739 <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>
17740 <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>
17741 </ul>
17742 </div>
17743
17744 <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>
17745 <p>section 1
17746 </p>
17747 <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>
17748 <p>section 2
17749 </p>
17750 <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>
17751 <p>section 3
17752 </p>
17753 <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>
17754 <p>section 4
17755 </p>
17756 <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>
17757 <p>section 5
17758 </p>
17759 <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>
17760 <p>section 6
17761 </p><p><a href="#Space_between_Text">#Space between Text</a>
17762 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
17763 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
17764 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
17765 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17766 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17767 </p>
17768 !! html/parsoid
17769 <p>Id should not contain + for spaces</p>
17770
17771 <h2 id="Space_between_Text">Space between Text</h2>
17772 <p>section 1</p>
17773
17774 <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>
17775 <p>section 2</p>
17776
17777 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
17778 <p>section 3</p>
17779
17780 <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>
17781 <p>section 4</p>
17782
17783 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
17784 <p>section 5</p>
17785
17786 <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>
17787 <p>section 6</p>
17788
17789 <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>
17790 <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>
17791 <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>
17792 <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>
17793 <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>
17794 <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>
17795 !! end
17796
17797 # Parsoid html2wt disabled because it adds padding spaces around =
17798 !! test
17799 Headers with excess '=' characters
17800 (Are similar tests necessary beyond the 1st level?)
17801 !! options
17802 parsoid=wt2html,wt2wt,html2html
17803 !! wikitext
17804 =foo==
17805 ==foo=
17806 =''italic'' heading==
17807 ==''italic'' heading=
17808 !! html/php
17809 <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>
17810 <ul>
17811 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17812 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17813 <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>
17814 <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>
17815 </ul>
17816 </div>
17817
17818 <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>
17819 <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>
17820 <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>
17821 <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>
17822
17823 !! html/parsoid
17824 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
17825 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
17826 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
17827 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
17828 !! end
17829
17830 !! test
17831 HTML headers vs TOC (T25393)
17832 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17833 !! wikitext
17834 <h1>Header 1</h1>
17835 ==Header 1.1==
17836 ==Header 1.2==
17837
17838 <h1>Header 2
17839 </h1>
17840 ==Header 2.1==
17841 ==Header 2.2==
17842 __NOEDITSECTION__
17843 !! html/php
17844 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17845 <ul>
17846 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17847 <ul>
17848 <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>
17849 <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>
17850 </ul>
17851 </li>
17852 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
17853 <ul>
17854 <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>
17855 <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>
17856 </ul>
17857 </li>
17858 </ul>
17859 </div>
17860
17861 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17862 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17863 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17864 <h1><span class="mw-headline" id="Header_2">Header 2
17865 </span></h1>
17866 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17867 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17868
17869 !! html/parsoid
17870 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17871 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17872 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17873
17874 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17875 </h1>
17876 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17877 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17878 <meta property="mw:PageProp/noeditsection"/>
17879 !! end
17880
17881 !! test
17882 Single-line or multiline-comments can follow headings
17883 !! options
17884 parsoid=wt2html,wt2wt
17885 !! wikitext
17886 ==foo==<!---->
17887 ==bar==<!--c1-->
17888 ==baz==<!--
17889 c2
17890 c3-->
17891 !! html/php
17892 <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>
17893 <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>
17894 <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>
17895
17896 !! html/parsoid
17897 <h2 id="foo">foo</h2><!---->
17898 <h2 id="bar">bar</h2><!--c1-->
17899 <h2 id="baz">baz</h2><!--
17900 c2
17901 c3-->
17902 !! end
17903
17904 !! test
17905 T3219 URL next to image (broken)
17906 !! wikitext
17907 http://example.com[[File:Foobar.jpg]]
17908 !! html/php
17909 <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>
17910 </p>
17911 !! html/parsoid
17912 <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>
17913 !!end
17914
17915 !! test
17916 T3186 news: in the middle of text
17917 !! wikitext
17918 http://en.wikinews.org/wiki/Wikinews:Workplace
17919 !! html
17920 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17921 </p>
17922 !!end
17923
17924
17925 !! test
17926 Namespaced link must have a title
17927 !! wikitext
17928 [[Project:]]
17929 !! html
17930 <p>[[Project:]]
17931 </p>
17932 !!end
17933
17934 !! test
17935 Namespaced link must have a title (bad fragment version)
17936 !! wikitext
17937 [[Project:#fragment]]
17938 !! html
17939 <p>[[Project:#fragment]]
17940 </p>
17941 !!end
17942
17943
17944 ###
17945 ### HTML tags and HTML attributes
17946 ###
17947
17948 !! test
17949 div with no attributes
17950 !! wikitext
17951 <div>HTML rocks</div>
17952 !! html
17953 <div>HTML rocks</div>
17954
17955 !! end
17956
17957 !! test
17958 div with double-quoted attribute
17959 !! wikitext
17960 <div id="rock">HTML rocks</div>
17961 !! html
17962 <div id="rock">HTML rocks</div>
17963
17964 !! end
17965
17966 !! test
17967 div with single-quoted attribute
17968 !! wikitext
17969 <div id='rock'>HTML rocks</div>
17970 !! html
17971 <div id="rock">HTML rocks</div>
17972
17973 !! end
17974
17975 !! test
17976 div with unquoted attribute
17977 !! wikitext
17978 <div id=rock>HTML rocks</div>
17979 !! html
17980 <div id="rock">HTML rocks</div>
17981
17982 !! end
17983
17984 !! test
17985 div with illegal double attributes
17986 !! wikitext
17987 <div id="a" id="b">HTML rocks</div>
17988 !! html
17989 <div id="b">HTML rocks</div>
17990
17991 !!end
17992
17993 !! test
17994 div with empty attribute value, space before equals
17995 !! options
17996 parsoid=wt2html,html2html
17997 !! wikitext
17998 <div class =>HTML rocks</div>
17999 !! html/php
18000 <div class="">HTML rocks</div>
18001
18002 !! html/parsoid
18003 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
18004 !! end
18005
18006 !! test
18007 div with multiple empty attribute values
18008 !! config
18009 wgFragmentMode=[ 'html5', 'legacy' ]
18010 !! options
18011 parsoid=wt2html,html2html
18012 !! wikitext
18013 <div id= title=>HTML rocks</div>
18014 !! html/php
18015 <div id="title=">HTML rocks</div>
18016
18017 !! html/parsoid
18018 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
18019 !! end
18020
18021 # FIXME Parsoid doesn't actually match PHP here.
18022 # Probably we should use the synthetic <foo /> or <indicator>
18023 # extensions for this test, which are enabled when running parser tests.
18024 !! test
18025 Extension tag in attribute value
18026 !! wikitext
18027 <span title="<translate>123</translate>">ok</span>
18028 !! html/php+disabled
18029 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
18030 </p>
18031 !! html/parsoid
18032 <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>
18033 !! end
18034
18035 !! test
18036 table with multiple empty attribute values
18037 !! options
18038 parsoid=wt2html,html2html
18039 !! wikitext
18040 {| title= id=
18041 |hi
18042 |}
18043 !! html/php
18044 <table title="id=">
18045 <tr>
18046 <td>hi
18047 </td></tr></table>
18048
18049 !! html/parsoid
18050 <table title="id=">
18051 <tbody><tr><td>hi</td></tr>
18052 </tbody></table>
18053 !! end
18054
18055 !! test
18056 div with braces in attribute value
18057 !! wikitext
18058 <div title="{}">Foo</div>
18059 !! html/php
18060 <div title="&#123;&#125;">Foo</div>
18061
18062 !! html/parsoid
18063 <div title="{}">Foo</div>
18064 !! end
18065
18066 !! test
18067 div with empty attribute value, no space before equals
18068 !! options
18069 parsoid=wt2html,html2html
18070 !! wikitext
18071 <div class=>HTML rocks</div>
18072 !! html/php
18073 <div class="">HTML rocks</div>
18074
18075 !! html/parsoid
18076 <div class="">HTML rocks</div>
18077 !! end
18078
18079 !! test
18080 HTML multiple attributes correction
18081 !! wikitext
18082 <p class="error" class="awesome">Awesome!</p>
18083 !! html
18084 <p class="awesome">Awesome!</p>
18085
18086 !!end
18087
18088 !! test
18089 Table multiple attributes correction
18090 !! wikitext
18091 {|
18092 !+ class="error" class="awesome"|status
18093 |}
18094 !! html
18095 <table>
18096 <tr>
18097 <th class="awesome">status
18098 </th></tr></table>
18099
18100 !!end
18101
18102 !! test
18103 DIV IN UPPERCASE
18104 !! wikitext
18105 <DIV ID="x">HTML ROCKS</DIV>
18106 !! html
18107 <div id="x">HTML ROCKS</div>
18108
18109 !!end
18110
18111 !! test
18112 Non-ASCII pseudo-tags are rendered as text
18113 !! wikitext
18114 <khyô>
18115 !! html
18116 <p>&lt;khyô&gt;
18117 </p>
18118 !! end
18119
18120 !! test
18121 Pseudo-tag with URL 'name' renders as url link
18122 !! wikitext
18123 <http://example.com/>
18124 !! html
18125 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
18126 </p>
18127 !! end
18128
18129 !! test
18130 text with amp in the middle of nowhere
18131 !! wikitext
18132 Remember AT&T?
18133 !! html
18134 <p>Remember AT&amp;T?
18135 </p>
18136 !! end
18137
18138 !! test
18139 text with character entity: eacute
18140 !! wikitext
18141 I always thought &eacute; was a cute letter.
18142 !! html+tidy
18143 <p>I always thought &#233; was a cute letter.
18144 </p>
18145 !! end
18146
18147 !! test
18148 text with entity-escaped character entity-like string: eacute
18149 !! wikitext
18150 I always thought &amp;eacute; was a cute letter.
18151 !! html
18152 <p>I always thought &amp;eacute; was a cute letter.
18153 </p>
18154 !! end
18155
18156 !! test
18157 text with undefined character entity: xacute
18158 !! wikitext
18159 I always thought &xacute; was a cute letter.
18160 !! html
18161 <p>I always thought &amp;xacute; was a cute letter.
18162 </p>
18163 !! end
18164
18165 !! test
18166 HTML5 tags
18167 !! wikitext
18168 <data value="5">five</data>
18169 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
18170 <mark>This highlighted text</mark>
18171 !! html
18172 <p><data value="5">five</data>
18173 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
18174 <mark>This highlighted text</mark>
18175 </p>
18176 !! end
18177
18178 !! test
18179 HTML tag with leading space is parsed as text
18180 !! wikitext
18181 < div>foo< /div>
18182 !! html
18183 <p>&lt; div&gt;foo&lt; /div&gt;
18184 </p>
18185 !! end
18186
18187 ## FIXME: The untrimmed attribute in Parsoid is T205737
18188 !! test
18189 Element with broken attribute syntax
18190 !! options
18191 parsoid=wt2html
18192 !! wikitext
18193 <div style=" style="123">hi</div>
18194 <div =>ho</div>
18195 !! html/php
18196 <div style="style=">hi</div>
18197 <div>ho</div>
18198
18199 !! html/parsoid
18200 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
18201 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
18202 !! end
18203
18204 ###
18205 ### Nesting tests (see T43545, T52604, T53081)
18206 ###
18207
18208 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
18209 # Note that html2wt is considerably more difficult if we use <b> in
18210 # the test case, instead of <small>
18211 !! test
18212 Ensure that HTML adoption agency algorithm is properly implemented.
18213 !! wikitext
18214 <small>X<small>Y</small>Z</small>
18215 !! html
18216 <p><small>X<small>Y</small>Z</small>
18217 </p>
18218 !! end
18219
18220 # This was T43545 in the PHP parser.
18221 !! test
18222 Nesting of <kbd>
18223 !! wikitext
18224 <kbd>X<kbd>Y</kbd>Z</kbd>
18225 !! html+tidy
18226 <p><kbd>X<kbd>Y</kbd>Z</kbd>
18227 </p>
18228 !! end
18229
18230 # The following cases were T53081 in the PHP parser.
18231 # Note that there are some other nestable tags (b, i, etc) which are
18232 # not covered; see T53081 for discussion.
18233
18234 !! test
18235 Nesting of <em>
18236 !! wikitext
18237 <em>X<em>Y</em>Z</em>
18238 !! html+tidy
18239 <p><em>X<em>Y</em>Z</em>
18240 </p>
18241 !! end
18242
18243 !! test
18244 Nesting of <strong>
18245 !! wikitext
18246 <strong>X<strong>Y</strong>Z</strong>
18247 !! html+tidy
18248 <p><strong>X<strong>Y</strong>Z</strong>
18249 </p>
18250 !! end
18251
18252 !! test
18253 Nesting of <q>
18254 !! wikitext
18255 <q>X<q>Y</q>Z</q>
18256 !! html+tidy
18257 <p><q>X<q>Y</q>Z</q>
18258 </p>
18259 !! end
18260
18261 !! test
18262 Nesting of <ruby>
18263 !! wikitext
18264 <ruby>X<ruby>Y</ruby>Z</ruby>
18265 !! html
18266 <p><ruby>X<ruby>Y</ruby>Z</ruby>
18267 </p>
18268 !! end
18269
18270 !! test
18271 Nesting of <bdo>
18272 !! wikitext
18273 <bdo>X<bdo>Y</bdo>Z</bdo>
18274 !! html
18275 <p><bdo>X<bdo>Y</bdo>Z</bdo>
18276 </p>
18277 !! end
18278
18279
18280 ###
18281 ### Media links
18282 ###
18283
18284 !! test
18285 Media link
18286 !! wikitext
18287 [[Media:Foobar.jpg]]
18288 [[Media:Video.ogv]]
18289 [[:Media:Video.ogv]]
18290 !! html/php
18291 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
18292 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
18293 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
18294 </p>
18295 !! html/parsoid
18296 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
18297 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" resource="./Media:Video.ogv" title="Video.ogv">Media:Video.ogv</a>
18298 <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>
18299 !! end
18300
18301 !! test
18302 Media link with text
18303 !! wikitext
18304 [[Media:Foobar.jpg|A neat file to look at]]
18305 !! html/php
18306 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
18307 </p>
18308 !! html/parsoid
18309 <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>
18310 !! end
18311
18312 !! test
18313 Localized media link
18314 !! options
18315 language=is
18316 !! wikitext
18317 [[Miðill:Foobar.jpg]]
18318
18319 [[Miðill:Foobar.jpg|Icelandic]]
18320 !! html/php
18321 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Miðill:Foobar.jpg</a>
18322 </p><p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Icelandic</a>
18323 </p>
18324 !! html/parsoid
18325 <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>
18326 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Miðill:Foobar.jpg" title="Foobar.jpg">Icelandic</a></p>
18327 !! end
18328
18329 # FIXME: this is still bad HTML tag nesting
18330 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
18331 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
18332 !! test
18333 Media link with nasty text
18334 !! options
18335 parsoid=wt2html,html2html
18336 !! wikitext
18337 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
18338 !! html/php
18339 <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>
18340
18341 !! html/php+tidy
18342 <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>
18343 !! html/parsoid
18344 <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>
18345 !! end
18346
18347 !! test
18348 Media link from missing resource (parsoid-only)
18349 !! options
18350 parsoid=html2wt
18351 !! html/parsoid
18352 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
18353 !! wikitext
18354 [[Media:Foobar.jpg|Bat!]]
18355 !! end
18356
18357 !! test
18358 Media link from missing resource, localized (parsoid-only)
18359 !! options
18360 parsoid=html2wt
18361 language=is
18362 !! html/parsoid
18363 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
18364 !! wikitext
18365 [[Miðill:Foobar.jpg|Bat!]]
18366 !! end
18367
18368 # This is a sanity test to ensure we don't crash or choke when given
18369 # old cached 1.7.0 HTML for media links; we don't require that the
18370 # result be "valid" because wt2wt was completely broken in 1.7.0
18371 !! test
18372 Media link from old 1.7.0 DOM spec (crash test, parsoid-only) T198511
18373 !! options
18374 parsoid=html2wt
18375 !! html/parsoid
18376 <p>This is what Parsoid would emit (and we still handle this HTML fine):</p>
18377 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18378 <p>But VisualEditor would mangle the rel attribute, and give us back this:</p>
18379 <p><a rel="mw:ExtLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18380 <p>But at least we don't crash when trying to handle the mangled HTML!</p>
18381 !! wikitext
18382 This is what Parsoid would emit (and we still handle this HTML fine):
18383
18384 [[Media:Foobar.jpg|A neat file to look at]]
18385
18386 But VisualEditor would mangle the rel attribute, and give us back this:
18387
18388 [//example.com/images/3/3a/Foobar.jpg A neat file to look at]
18389
18390 But at least we don't crash when trying to handle the mangled HTML!
18391 !! end
18392
18393 !! test
18394 Media link to nonexistent file (T3702)
18395 !! wikitext
18396 [[Media:No such.jpg]]
18397 [[Media:No_such file.jpg]]
18398 !! html/php
18399 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
18400 <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>
18401 </p>
18402 !! html/parsoid
18403 <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>
18404 <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>
18405 !! end
18406
18407 !! test
18408 Image link to nonexistent file (T3850 - good)
18409 !! wikitext
18410 [[File:No_such.jpg]]
18411 !! html/php
18412 <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>
18413 </p>
18414 !! html/parsoid
18415 <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>
18416 !! end
18417
18418 !! test
18419 :Image link to nonexistent file (T3850 - bad)
18420 !! wikitext
18421 [[:Image:No such.jpg]]
18422 !! html/php
18423 <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>
18424 </p>
18425 !! html/parsoid
18426 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
18427 !! end
18428
18429 !! test
18430 Character reference normalization in link text (T3938)
18431 !! wikitext
18432 [[Main Page|this&that]]
18433 !! html
18434 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
18435 </p>
18436 !!end
18437
18438 !! article
18439 אַ
18440 !! text
18441 Test for unicode normalization
18442
18443 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
18444 !! endarticle
18445
18446 !! test
18447 (T21451) Links should refer to the normalized form.
18448 !! wikitext
18449 [[&#xFB2E;]]
18450 [[&#x5d0;&#x5b7;]]
18451 [[&#x5d0;ַ]]
18452 [[א&#x5b7;]]
18453 [[אַ]]
18454 !! html
18455 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
18456 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
18457 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
18458 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
18459 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
18460 </p>
18461 !! end
18462
18463 !! test
18464 Empty attribute crash test (T4067)
18465 !! wikitext
18466 <font color="">foo</font>
18467 !! html
18468 <p><font color="">foo</font>
18469 </p>
18470 !! end
18471
18472 !! test
18473 Empty attribute crash test single-quotes (T4067)
18474 !! wikitext
18475 <font color=''>foo</font>
18476 !! html
18477 <p><font color="">foo</font>
18478 </p>
18479 !! end
18480
18481 !! test
18482 Attribute test: equals, then nothing
18483 !! options
18484 parsoid=wt2html,html2html
18485 !! wikitext
18486 <font color=>foo</font>
18487 !! html/php
18488 <p><font color="">foo</font>
18489 </p>
18490 !! html/parsoid
18491 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
18492 !! end
18493
18494 !! test
18495 Attribute test: unquoted value
18496 !! options
18497 parsoid=wt2html,html2html
18498 !! wikitext
18499 <font color=x>foo</font>
18500 !! html/php
18501 <p><font color="x">foo</font>
18502 </p>
18503 !! html/parsoid
18504 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
18505 !! end
18506
18507 !! test
18508 Attribute test: unquoted but illegal value (hash)
18509 !! wikitext
18510 <font color=#x>foo</font>
18511 !! html
18512 <p><font color="#x">foo</font>
18513 </p>
18514 !! end
18515
18516 # Parsoid does not serialize to empty attribute syntax,
18517 # so wt2wt and html2wt cases are skipped
18518 !! test
18519 Attribute test: no value (T54330)
18520 !! options
18521 parsoid=wt2html,html2html
18522 !! wikitext
18523 <font color>foo</font>
18524 !! html/php
18525 <p><font color="">foo</font>
18526 </p>
18527 !! html/parsoid
18528 <p><font color="">foo</font></p>
18529 !! end
18530
18531 !! test
18532 T4095: link with three closing brackets
18533 !! wikitext
18534 [[Main Page]]]
18535 !! html/php
18536 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
18537 </p>
18538 !! html/parsoid
18539 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
18540 !! end
18541
18542 !! test
18543 T4095: link with pipe and three closing brackets
18544 !! wikitext
18545 [[Main Page|link]]]
18546 !! html/php
18547 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
18548 </p>
18549 !! html/parsoid
18550 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
18551 !! end
18552
18553 !! test
18554 T4095: link with pipe and three closing brackets, version 2
18555 !! wikitext
18556 [[Main Page|[http://example.com/]]]
18557 !! html/php
18558 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
18559 </p>
18560 !! html/parsoid
18561 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
18562 !! end
18563
18564
18565 ###
18566 ### Safety
18567 ###
18568
18569 !! article
18570 Template:Dangerous attribute
18571 !! text
18572 " onmouseover="alert(document.cookie)
18573 !! endarticle
18574
18575 !! article
18576 Template:Dangerous style attribute
18577 !! text
18578 border-size: expression(alert(document.cookie))
18579 !! endarticle
18580
18581 !! article
18582 Template:Div style
18583 !! text
18584 <div style="float: right; {{{1}}}">Magic div</div>
18585 !! endarticle
18586
18587 !! test
18588 T4304: HTML attribute safety (safe template; regression T4309)
18589 !! wikitext
18590 <div title="{{test}}"></div>
18591 !! html/php
18592 <div title="This is a test template"></div>
18593
18594 !! html/parsoid
18595 <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>
18596 !! end
18597
18598 # Parsoid has enough context to handle this case
18599 !! test
18600 T4304: HTML attribute safety (dangerous template; 2309)
18601 !! wikitext
18602 <div title="{{dangerous attribute}}"></div>
18603 !! html/php
18604 <div title=""></div>
18605
18606 !! html/parsoid
18607 <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>
18608 !! end
18609
18610 !! test
18611 T4304: HTML attribute safety (dangerous style template; 2309)
18612 !! wikitext
18613 <div style="{{dangerous style attribute}}"></div>
18614 !! html/php
18615 <div style="/* insecure input */"></div>
18616
18617 !! html/parsoid
18618 <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>
18619 !! end
18620
18621 !! test
18622 T4304: HTML attribute safety (safe parameter; 2309)
18623 !! wikitext
18624 {{div style|width: 200px}}
18625 !! html/php
18626 <div style="float: right; width: 200px">Magic div</div>
18627
18628 !! html/parsoid
18629 <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>
18630 !! end
18631
18632 !! test
18633 T4304: HTML attribute safety (unsafe parameter; 2309)
18634 !! wikitext
18635 {{div style|width: expression(alert(document.cookie))}}
18636 !! html/php
18637 <div style="/* insecure input */">Magic div</div>
18638
18639 !! html/parsoid
18640 <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>
18641 !! end
18642
18643 ## Parsoid output here differs; needs investigation.
18644 !! test
18645 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
18646 !! wikitext
18647 {{div style|"><script>alert(document.cookie)</script>}}
18648 !! html
18649 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18650
18651 !! end
18652
18653 ## Parsoid output here differs; needs investigation.
18654 !! test
18655 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
18656 !! wikitext
18657 {{div style|" ><script>alert(document.cookie)</script>}}
18658 !! html
18659 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18660
18661 !! end
18662
18663 !! test
18664 T4304: HTML attribute safety (link)
18665 !! wikitext
18666 <div title="[[Main Page]]"></div>
18667 !! html/php
18668 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
18669
18670 !! html/parsoid
18671 <div title="[[Main Page]]"></div>
18672 !! end
18673
18674 !! test
18675 T4304: HTML attribute safety (italics)
18676 !! wikitext
18677 <div title="''foobar''"></div>
18678 !! html
18679 <div title="&#39;&#39;foobar&#39;&#39;"></div>
18680
18681 !! end
18682
18683 !! test
18684 T4304: HTML attribute safety (bold)
18685 !! wikitext
18686 <div title="'''foobar'''"></div>
18687 !! html
18688 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
18689
18690 !! end
18691
18692 !! test
18693 T4304: HTML attribute safety (ISBN)
18694 !! wikitext
18695 <div title="ISBN 1234567890"></div>
18696 !! html
18697 <div title="&#73;SBN 1234567890"></div>
18698
18699 !! end
18700
18701 !! test
18702 T4304: HTML attribute safety (RFC)
18703 !! wikitext
18704 <div title="RFC 1234"></div>
18705 !! html
18706 <div title="&#82;FC 1234"></div>
18707
18708 !! end
18709
18710 !! test
18711 T4304: HTML attribute safety (PMID)
18712 !! wikitext
18713 <div title="PMID 1234567890"></div>
18714 !! html
18715 <div title="&#80;MID 1234567890"></div>
18716
18717 !! end
18718
18719 !! test
18720 T4304: HTML attribute safety (web link)
18721 !! wikitext
18722 <div title="http://example.com/"></div>
18723 !! html
18724 <div title="http&#58;//example.com/"></div>
18725
18726 !! end
18727
18728 !! test
18729 T4304: HTML attribute safety (named web link)
18730 !! wikitext
18731 <div title="[http://example.com/ link]"></div>
18732 !! html/php
18733 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
18734
18735 !! html/parsoid
18736 <div title="[http://example.com/ link]"></div>
18737 !! end
18738
18739 !! test
18740 T5244: HTML attribute safety (extension; safe)
18741 !! wikitext
18742 <div style="<nowiki>background:blue</nowiki>"></div>
18743 !! html/php
18744 <div style="background:blue"></div>
18745
18746 !! html/parsoid
18747 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
18748 !! end
18749
18750 !! test
18751 T5244: HTML attribute safety (extension; unsafe)
18752 !! wikitext
18753 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
18754 !! html/php
18755 <div style="/* insecure input */"></div>
18756
18757 !! html/parsoid
18758 <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>
18759 !! end
18760
18761 # More MSIE fun discovered by Tom Gilder
18762
18763 !! test
18764 MSIE CSS safety test: spurious slash
18765 !! wikitext
18766 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
18767 !! html/php
18768 <div style="/* insecure input */">evil</div>
18769
18770 !! html/parsoid
18771 <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>
18772 !! end
18773
18774 !! test
18775 MSIE CSS safety test: hex code
18776 !! wikitext
18777 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
18778 !! html/php
18779 <div style="/* insecure input */">evil</div>
18780
18781 !! html/parsoid
18782 <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>
18783 !! end
18784
18785 !! test
18786 MSIE CSS safety test: comment in url
18787 !! wikitext
18788 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
18789 !! html/php
18790 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
18791
18792 !! html/parsoid
18793 <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>
18794 !! end
18795
18796 !! test
18797 MSIE CSS safety test: comment in expression
18798 !! wikitext
18799 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
18800 !! html/php
18801 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
18802
18803 !! html/parsoid
18804 <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>
18805 !! end
18806
18807 !! test
18808 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
18809 !! wikitext
18810 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
18811 !! html/php
18812 <p style="/* invalid control char */">A</p>
18813
18814 !! html/parsoid
18815 <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>
18816 !! end
18817
18818 !! test
18819 MSIE 6 CSS safety test: Fullwidth (T57332)
18820 !! wikitext
18821 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
18822 <div style="top:EXPRESSION(alert())">B</div>
18823 !! html/php
18824 <p style="/* insecure input */">A</p>
18825 <div style="/* insecure input */">B</div>
18826
18827 !! html/parsoid
18828 <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>
18829 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
18830 !! end
18831
18832 !! test
18833 MSIE 6 CSS safety test: IPA extensions (T57332)
18834 !! wikitext
18835 <div style="background-image:uʀʟ(javascript:alert())">A</div>
18836 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
18837 !! html/php
18838 <div style="/* insecure input */">A</div>
18839 <p style="/* insecure input */">B</p>
18840
18841 !! html/parsoid
18842 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
18843 <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>
18844 !! end
18845
18846 !! test
18847 MSIE 6 CSS safety test: sup/sub script (T57332)
18848 !! wikitext
18849 <div style="background-image:url⁽javascript:alert())">A</div>
18850 <div style="background-image:url₍javascript:alert())">B</div>
18851 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
18852 !! html/php
18853 <div style="/* insecure input */">A</div>
18854 <div style="/* insecure input */">B</div>
18855 <p style="/* insecure input */">C</p>
18856
18857 !! html/parsoid
18858 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
18859 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
18860 <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>
18861 !! end
18862
18863 !! test
18864 Opera -o-link CSS
18865 !! options
18866 parsoid=wt2html,html2html
18867 !! wikitext
18868 <div
18869 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;"
18870 style="-o-link:attr(title);-o-link-source:current">X</div>
18871 !! html/php
18872 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
18873
18874 !! html/parsoid
18875 <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>
18876 !! end
18877
18878 !! test
18879 MSIE 6 CSS safety test: Repetition markers (T57332)
18880 !! wikitext
18881 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
18882 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
18883 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
18884 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
18885 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
18886 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
18887 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
18888 !! html/php
18889 <p style="/* insecure input */">A</p>
18890 <p style="/* insecure input */">B</p>
18891 <p style="/* insecure input */">C</p>
18892 <p style="/* insecure input */">D</p>
18893 <p style="/* insecure input */">E</p>
18894 <p style="/* insecure input */">F</p>
18895 <p style="/* insecure input */">G</p>
18896
18897 !! html/parsoid
18898 <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>
18899 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresゝion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
18900 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
18901 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresヽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>D</p>
18902 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>E</p>
18903 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹼion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>F</p>
18904 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>G</p>
18905 !! end
18906
18907 !! test
18908 Table attribute legitimate extension
18909 !! wikitext
18910 {|
18911 !+ style="<nowiki>color:blue</nowiki>"|status
18912 |}
18913 !! html
18914 <table>
18915 <tr>
18916 <th style="color:blue">status
18917 </th></tr></table>
18918
18919 !!end
18920
18921 !! test
18922 Table attribute safety
18923 !! wikitext
18924 {|
18925 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18926 |}
18927 !! html
18928 <table>
18929 <tr>
18930 <th style="/* insecure input */">status
18931 </th></tr></table>
18932
18933 !! end
18934
18935 !! test
18936 CSS line continuation 1
18937 !! wikitext
18938 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18939 !! html
18940 <div style="/* insecure input */"></div>
18941
18942 !! end
18943
18944 !! test
18945 CSS line continuation 2
18946 !! wikitext
18947 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18948 !! html
18949 <div style="/* invalid control char */"></div>
18950
18951 !! end
18952
18953 !! article
18954 Template:Identity
18955 !! text
18956 {{{1}}}
18957 !! endarticle
18958
18959 !! test
18960 Expansion of multi-line templates in attribute values (T8255)
18961 !! wikitext
18962 <div style="background: {{identity|#00FF00}}">-</div>
18963 !! html
18964 <div style="background: #00FF00">-</div>
18965
18966 !! end
18967
18968 !! test
18969 Expansion of multi-line templates in attribute values (T8255 sanity check)
18970 !! wikitext
18971 <div style="background:
18972 #00FF00">-</div>
18973 !! html/php
18974 <div style="background: #00FF00">-</div>
18975
18976 !! html/parsoid
18977 <div style="background:
18978 #00FF00">-</div>
18979 !! end
18980
18981 !! test
18982 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18983 !! wikitext
18984 <div style="background: &#10;#00FF00">-</div>
18985 !! html
18986 <div style="background: &#10;#00FF00">-</div>
18987
18988 !! end
18989
18990 !! test
18991 Tags which are hidden from tidiers cannot pass through the Sanitizer
18992 !! wikitext
18993 <mw:toc><script>alert();</script></mw:toc>
18994 !! html+tidy
18995 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18996 </p>
18997 !! end
18998
18999 ###
19000 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
19001 ###
19002
19003 !! test
19004 Parser hook: empty input
19005 !! wikitext
19006 <tag></tag>
19007 !! html/php
19008 <pre>
19009 ''
19010 array (
19011 )
19012 </pre>
19013
19014 !! html/parsoid
19015 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19016 !! end
19017
19018 ## Don't expect parsoid to rt this form.
19019 !! test
19020 Parser hook: empty input using terminated empty elements
19021 !! options
19022 parsoid=wt2html,html2html
19023 !! wikitext
19024 <tag/>
19025 !! html/php
19026 <pre>
19027 NULL
19028 array (
19029 )
19030 </pre>
19031
19032 !! html/parsoid
19033 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
19034 !! end
19035
19036 !! test
19037 Parser hook: empty input using terminated empty elements (space before)
19038 !! wikitext
19039 <tag />
19040 !! html/php
19041 <pre>
19042 NULL
19043 array (
19044 )
19045 </pre>
19046
19047 !! html/parsoid
19048 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
19049 !! end
19050
19051 !! test
19052 Parser hook: basic input
19053 !! wikitext
19054 <tag>input</tag>
19055 !! html/php
19056 <pre>
19057 'input'
19058 array (
19059 )
19060 </pre>
19061
19062 !! html/parsoid
19063 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
19064 !! end
19065
19066 ## Don't expect parsoid to rt this form.
19067 !! test
19068 Parser hook: case insensitive
19069 !! options
19070 parsoid=wt2html,html2html
19071 !! wikitext
19072 <TAG>input</TAG>
19073 !! html/php
19074 <pre>
19075 'input'
19076 array (
19077 )
19078 </pre>
19079
19080 !! html/parsoid
19081 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
19082 !! end
19083
19084 ## Don't expect parsoid to rt this form.
19085 !! test
19086 Parser hook: case insensitive, redux
19087 !! options
19088 parsoid=wt2html,html2html
19089 !! wikitext
19090 <TaG>input</TAg>
19091 !! html/php
19092 <pre>
19093 'input'
19094 array (
19095 )
19096 </pre>
19097
19098 !! html/parsoid
19099 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
19100 !! end
19101
19102 !! test
19103 Parser hook: nested tags
19104 !! options
19105 parsoid=wt2html
19106 !! wikitext
19107 <tag><tag></tag></tag>
19108 !! html/php
19109 <pre>
19110 '<tag>'
19111 array (
19112 )
19113 </pre>&lt;/tag&gt;
19114
19115 !! html/php+tidy
19116 <pre>'<tag>'
19117 array (
19118 )
19119 </tag></pre><p>&lt;/tag&gt;
19120 </p>
19121 !! html/parsoid
19122 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}'></pre><p>&lt;/tag></p>
19123 !! end
19124
19125 !! test
19126 Parser hook: basic arguments
19127 !! wikitext
19128 <tag width="200" height="100" depth="50" square=""></tag>
19129 !! html/php
19130 <pre>
19131 ''
19132 array (
19133 'width' => '200',
19134 'height' => '100',
19135 'depth' => '50',
19136 'square' => '',
19137 )
19138 </pre>
19139
19140 !! html/parsoid
19141 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19142 !! end
19143
19144 ## Don't expect parsoid to rt this form.
19145 !! test
19146 Parser hook: basic arguments, variations
19147 !! options
19148 parsoid=wt2html,html2html
19149 !! wikitext
19150 <tag width=200 height = "100" depth = '50' square></tag>
19151 !! html/php
19152 <pre>
19153 ''
19154 array (
19155 'width' => '200',
19156 'height' => '100',
19157 'depth' => '50',
19158 'square' => '',
19159 )
19160 </pre>
19161
19162 !! html/parsoid
19163 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19164 !! end
19165
19166 !! test
19167 Parser hook: argument containing a forward slash (T7344)
19168 !! wikitext
19169 <tag filename="/tmp/bla"></tag>
19170 !! html/php
19171 <pre>
19172 ''
19173 array (
19174 'filename' => '/tmp/bla',
19175 )
19176 </pre>
19177
19178 !! html/parsoid
19179 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19180 !! end
19181
19182 ## Don't expect parsoid to rt this form.
19183 !! test
19184 Parser hook: empty input using terminated empty elements (T4374)
19185 !! options
19186 parsoid=wt2html,html2html
19187 !! wikitext
19188 <tag foo=bar/>text
19189 !! html/php
19190 <pre>
19191 NULL
19192 array (
19193 'foo' => 'bar',
19194 )
19195 </pre>text
19196
19197 !! html/parsoid
19198 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{"foo":"bar"}}'></pre><p>text</p>
19199 !! end
19200
19201 ## </tag> should be output literally since there is no matching tag that begins it
19202 ## Don't expect parsoid to rt this form.
19203 !! test
19204 Parser hook: basic arguments using terminated empty elements (T4374)
19205 !! options
19206 parsoid=wt2html
19207 !! wikitext
19208 <tag width=200 height = "100" depth = '50' square/>
19209 other stuff
19210 </tag>
19211 !! html/php
19212 <pre>
19213 NULL
19214 array (
19215 'width' => '200',
19216 'height' => '100',
19217 'depth' => '50',
19218 'square' => '',
19219 )
19220 </pre>
19221 <p>other stuff
19222 &lt;/tag&gt;
19223 </p>
19224 !! html/parsoid
19225 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""}}' about="#mwt2"></pre><p>other stuff
19226 &lt;/tag></p>
19227 !! end
19228
19229 ## Don't expect parsoid to rt this form.
19230 !! test
19231 Parser hook: Don't allow unclosed extension tags
19232 !! options
19233 parsoid=wt2html
19234 !! wikitext
19235 test <tag>123
19236
19237 this is a '''test'''
19238 !! html/php
19239 <p>test &lt;tag&gt;123
19240 </p><p>this is a <b>test</b>
19241 </p>
19242 !! html/parsoid
19243 <p>test &lt;tag>123</p>
19244
19245 <p>this is a <b>test</b></p>
19246 !! end
19247
19248 !! test
19249 Parser hook: horizontal rule inside extension tag that outputs <pre>
19250 !! wikitext
19251 <tag>
19252 Hello
19253 <hr/>
19254 Goodbye
19255 </tag>
19256 !! html/php
19257 <pre>
19258 '
19259 Hello
19260 <hr/>
19261 Goodbye
19262 '
19263 array (
19264 )
19265 </pre>
19266
19267 !! end
19268
19269 ###
19270 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
19271 ###
19272
19273 !! test
19274 Parser hook: static parser hook not inside a comment
19275 !! wikitext
19276 <statictag>hello, world</statictag>
19277
19278 <statictag action="flush" />
19279 !! html/php
19280 <p><br />
19281 hello, world
19282 </p>
19283 !! html/parsoid
19284 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
19285 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about="#mwt4">hello, world</p>
19286 !! end
19287
19288 !! test
19289 Parser hook: static parser hook inside a comment
19290 !! wikitext
19291 <!-- <statictag>hello, world</statictag> -->
19292 <statictag action="flush" />
19293 !! html/php
19294 <p><br />
19295 </p>
19296 !! html/parsoid
19297 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
19298 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about='#mwt2'></p>
19299 !! end
19300
19301 # Nested template calls; this case was broken by Parser.php rev 1.506,
19302 # since reverted.
19303
19304 !! article
19305 Template:One-parameter
19306 !! text
19307 (My parameter is: {{{1}}})
19308 !! endarticle
19309
19310 !! article
19311 Template:Map-one-parameter
19312 !! text
19313 {{{{{1}}}|{{{2}}}}}
19314 !! endarticle
19315
19316 !! test
19317 Nested template calls
19318 !! wikitext
19319 {{Map-one-parameter|One-parameter|param}}
19320 !! html
19321 <p>(My parameter is: param)
19322 </p>
19323 !! end
19324
19325
19326 ###
19327 ### Sanitizer
19328 ###
19329
19330 !! test
19331 Sanitizer: Closing of open tags
19332 !! wikitext
19333 <s></s><table></table>
19334 !! html/php+tidy
19335 <p><s></s></p><table></table>
19336 !! html/parsoid
19337 <p><s data-parsoid='{"stx":"html"}'></s></p><table data-parsoid='{"stx":"html"}'></table>
19338 !! end
19339
19340 !! test
19341 Sanitizer: Closing of open but not closed tags
19342 !! wikitext
19343 <s>foo
19344 !! html
19345 <p><s>foo</s>
19346 </p>
19347 !! end
19348
19349 !! test
19350 Sanitizer: Closing of closed but not open tags
19351 !! options
19352 parsoid=wt2html
19353 !! wikitext
19354 </s>
19355 !! html+tidy
19356 <p class="mw-empty-elt">
19357 </p>
19358 !! end
19359
19360 !! test
19361 Sanitizer: Closing of closed but not open table tags
19362 !! options
19363 parsoid=wt2html
19364 !! wikitext
19365 Table not started</td></tr></table>
19366 !! html+tidy
19367 <p>Table not started
19368 </p>
19369 !! end
19370
19371 !! test
19372 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
19373 !! config
19374 wgFragmentMode=[ 'html5', 'legacy' ]
19375 !! wikitext
19376 <span id="æ: v">byte</span>[[#æ: v|backlink]]
19377 !! html/php
19378 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
19379 </p>
19380 !! html/parsoid
19381 <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>
19382 !! end
19383
19384 !! test
19385 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
19386 !! config
19387 wgFragmentMode=[ 'legacy' ]
19388 !! wikitext
19389 <span id="æ: v">byte</span>[[#æ: v|backlink]]
19390 !! html/php
19391 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
19392 </p>
19393 !! end
19394
19395 # In HTML5, the restrictions are that id must contain at least one character,
19396 # and must not contain any space characters.
19397 !! test
19398 Sanitizer: Validating the contents of the id attribute (T6515)
19399 !! options
19400 disabled
19401 !! wikitext
19402 <br id="" /><br id="a space" />
19403 !! html
19404 Something ...
19405 !! end
19406
19407 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
19408 !! test
19409 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
19410 !! options
19411 disabled
19412 !! wikitext
19413 <br id="foo" /><br id="foo" />
19414 !! html
19415 Something need to be done. foo-2 ?
19416 !! end
19417
19418 !! test
19419 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
19420 !! wikitext
19421 <div itemscope>
19422 <meta itemprop="hello" content="world">
19423 <meta http-equiv="refresh" content="5">
19424 <meta itemprop="hello" http-equiv="refresh" content="5">
19425 <link itemprop="hello" href="{{SERVER}}">
19426 <link rel="stylesheet" href="{{SERVER}}">
19427 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
19428 </div>
19429 !! html
19430 <div itemscope="">
19431 <p> <meta itemprop="hello" content="world" />
19432 &lt;meta http-equiv="refresh" content="5"&gt;
19433 <meta itemprop="hello" content="5" />
19434 <link itemprop="hello" href="http&#58;//example.org" />
19435 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
19436 <link itemprop="hello" href="http&#58;//example.org" />
19437 </p>
19438 </div>
19439
19440 !! end
19441
19442 !! test
19443 Sanitizer: Strip comments from CSS attributes
19444 !! options
19445 parsoid=wt2html,wt2wt
19446 !! wikitext
19447 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
19448 !! html/php
19449 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
19450 </p>
19451 !! html/parsoid
19452 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
19453 !! end
19454
19455 !! test
19456 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
19457 !! wikitext
19458 [[meatball:Soft"Security]]
19459 !! html/php
19460 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
19461 </p>
19462 !! html/parsoid
19463 <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>
19464 !! end
19465
19466 !! test
19467 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
19468 !! wikitext
19469 [[meatball:Foo<Bar]]
19470 [[meatball:Foo>Bar]]
19471 [[meatball:Foo&lt;bar]]
19472 [[meatball:Foo&gt;bar]]
19473 !! html/php
19474 <p>[[meatball:Foo&lt;Bar]]
19475 [[meatball:Foo&gt;Bar]]
19476 [[meatball:Foo&lt;bar]]
19477 [[meatball:Foo&gt;bar]]
19478 </p>
19479 !! html/parsoid
19480 <p>[[meatball:Foo&lt;Bar]]
19481 [[meatball:Foo>Bar]]
19482 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
19483 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
19484 !! end
19485
19486 !! test
19487 Language converter: output gets cut off unexpectedly (T7757)
19488 !! options
19489 language=zh
19490 !! wikitext
19491 this bit is safe: }-
19492
19493 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
19494
19495 then we get cut off here: }-
19496
19497 all additional text is vanished
19498 !! html/php
19499 <p>this bit is safe: }-
19500 </p><p>but if we add a conversion instance: xxx
19501 </p><p>then we get cut off here: }-
19502 </p><p>all additional text is vanished
19503 </p>
19504 !! html/parsoid
19505 <p>this bit is safe: }-</p>
19506 <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>
19507 <p>then we get cut off here: }-</p>
19508 <p>all additional text is vanished</p>
19509 !! end
19510
19511 !! test
19512 Language converter glossary rules inside attributes (T119158)
19513 !! options
19514 language=sr variant=sr-el
19515 !! wikitext
19516 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
19517
19518 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
19519 !! html/php
19520 <p>
19521 </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>
19522 </p>
19523 !! html/parsoid
19524 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
19525
19526 <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>
19527 !! end
19528
19529 !! test
19530 Self closed html pairs (T7487)
19531 !! wikitext
19532 <center><font id="bug" />Centered text</center>
19533 <div><font id="bug2" />In div text</div>
19534 !! html+tidy
19535 <center><font id="bug"></font>Centered text</center>
19536 <div><font id="bug2"></font>In div text</div>
19537 !! end
19538
19539 !! test
19540 Punctuation: nbsp before exclamation
19541 !! wikitext
19542 C'est grave !
19543 !! html
19544 <p>C'est grave&#160;!
19545 </p>
19546 !! end
19547
19548 !! test
19549 Punctuation: CSS !important (T13874)
19550 !! wikitext
19551 <div style="width:50% !important">important</div>
19552 !! html
19553 <div style="width:50% !important">important</div>
19554
19555 !!end
19556
19557 !! test
19558 Punctuation: CSS ! important (T13874; with space after)
19559 !! wikitext
19560 <div style="width:50% ! important">important</div>
19561 !! html
19562 <div style="width:50%&#32;! important">important</div>
19563
19564 !!end
19565
19566 !! test
19567 HTML bullet list, closed tags (T7497)
19568 !! wikitext
19569 <ul>
19570 <li>One</li>
19571 <li>Two</li>
19572 </ul>
19573 !! html/php
19574 <ul>
19575 <li>One</li>
19576 <li>Two</li>
19577 </ul>
19578
19579 !! html/parsoid
19580 <ul data-parsoid='{"stx":"html"}'>
19581 <li data-parsoid='{"stx":"html"}'>One</li>
19582 <li data-parsoid='{"stx":"html"}'>Two</li>
19583 </ul>
19584
19585 !! end
19586
19587 !! test
19588 HTML bullet list, unclosed tags (T7497)
19589 !! wikitext
19590 <ul>
19591 <li>One
19592 <li>Two
19593 </ul>
19594 !! html/php+tidy
19595 <ul>
19596 <li>One
19597 </li><li>Two
19598 </li></ul>
19599 !! html/parsoid
19600 <ul data-parsoid='{"stx":"html"}'>
19601 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19602 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19603 </ul>
19604
19605 !! end
19606
19607 !! test
19608 HTML ordered list, closed tags (T7497)
19609 !! wikitext
19610 <ol>
19611 <li>One</li>
19612 <li>Two</li>
19613 </ol>
19614 !! html/php
19615 <ol>
19616 <li>One</li>
19617 <li>Two</li>
19618 </ol>
19619
19620 !! html/parsoid
19621 <ol data-parsoid='{"stx":"html"}'>
19622 <li data-parsoid='{"stx":"html"}'>One</li>
19623 <li data-parsoid='{"stx":"html"}'>Two</li>
19624 </ol>
19625
19626 !! end
19627
19628 !! test
19629 HTML ordered list, unclosed tags (T7497)
19630 !! options
19631 !! wikitext
19632 <ol>
19633 <li>One
19634 <li>Two
19635 </ol>
19636 !! html/php+tidy
19637 <ol>
19638 <li>One
19639 </li><li>Two
19640 </li></ol>
19641 !! html/parsoid
19642 <ol data-parsoid='{"stx":"html"}'>
19643 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19644 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19645 </ol>
19646
19647 !! end
19648
19649 !! test
19650 HTML nested bullet list, closed tags (T7497)
19651 !! wikitext
19652 <ul>
19653 <li>One</li>
19654 <li>Two:
19655 <ul>
19656 <li>Sub-one</li>
19657 <li>Sub-two</li>
19658 </ul>
19659 </li>
19660 </ul>
19661 !! html/php
19662 <ul>
19663 <li>One</li>
19664 <li>Two:
19665 <ul>
19666 <li>Sub-one</li>
19667 <li>Sub-two</li>
19668 </ul>
19669 </li>
19670 </ul>
19671
19672 !! html/parsoid
19673 <ul data-parsoid='{"stx":"html"}'>
19674 <li data-parsoid='{"stx":"html"}'>One</li>
19675 <li data-parsoid='{"stx":"html"}'>Two:
19676 <ul data-parsoid='{"stx":"html"}'>
19677 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
19678 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
19679 </ul>
19680 </li>
19681 </ul>
19682 !! end
19683
19684 !! test
19685 HTML nested bullet list, open tags (T7497)
19686 !! wikitext
19687 <ul>
19688 <li>One
19689 <li>Two:
19690 <ul>
19691 <li>Sub-one
19692 <li>Sub-two
19693 </ul>
19694 </ul>
19695 !! html+tidy
19696 <ul>
19697 <li>One
19698 </li><li>Two:
19699 <ul>
19700 <li>Sub-one
19701 </li><li>Sub-two
19702 </li></ul>
19703 </li></ul>
19704 !! end
19705
19706 !! test
19707 HTML nested ordered list, closed tags (T7497)
19708 !! wikitext
19709 <ol>
19710 <li>One</li>
19711 <li>Two:
19712 <ol>
19713 <li>Sub-one</li>
19714 <li>Sub-two</li>
19715 </ol>
19716 </li>
19717 </ol>
19718 !! html
19719 <ol>
19720 <li>One</li>
19721 <li>Two:
19722 <ol>
19723 <li>Sub-one</li>
19724 <li>Sub-two</li>
19725 </ol>
19726 </li>
19727 </ol>
19728
19729 !! end
19730
19731 !! test
19732 HTML nested ordered list, open tags (T7497)
19733 !! wikitext
19734 <ol>
19735 <li>One
19736 <li>Two:
19737 <ol>
19738 <li>Sub-one
19739 <li>Sub-two
19740 </ol>
19741 </ol>
19742 !! html/php
19743 <ol>
19744 <li>One
19745 <li>Two:
19746 <ol>
19747 <li>Sub-one
19748 <li>Sub-two
19749 </ol>
19750 </ol>
19751
19752 !! html/parsoid
19753 <ol>
19754 <li>One
19755 </li>
19756 <li>Two:
19757 <ol>
19758 <li>Sub-one
19759 </li>
19760 <li>Sub-two
19761 </li>
19762 </ol>
19763 </li>
19764 </ol>
19765
19766 !! end
19767
19768 !! test
19769 HTML ordered list item with parameters oddity
19770 !! wikitext
19771 <ol><li id="fragment">One</li>
19772 </ol>
19773 !! html
19774 <ol><li id="fragment">One</li>
19775 </ol>
19776
19777 !! end
19778
19779 # parsoid doesn't explicitly mark autonumbered links, see T55505
19780 !!test
19781 T7918: autonumbering
19782 !! wikitext
19783 [http://first/] [http://second] [ftp://ftp]
19784
19785 ftp://inlineftp
19786
19787 [mailto:enclosed@mail.tld With target]
19788
19789 [mailto:enclosed@mail.tld]
19790
19791 mailto:inline@mail.tld
19792 !! html/php
19793 <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>
19794 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
19795 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
19796 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
19797 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
19798 </p>
19799 !! html/parsoid
19800 <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>
19801 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
19802 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
19803 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
19804 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
19805 !! end
19806
19807
19808 #
19809 # Security and HTML correctness
19810 # From Nick Jenkins' fuzz testing
19811 #
19812
19813 !! test
19814 Fuzz testing: Parser13
19815 !! wikitext
19816 {|
19817 | http://a|
19818 !! html
19819 <table>
19820 <tr>
19821 <td>
19822 </td>
19823 </tr>
19824 </table>
19825
19826 !! end
19827
19828 # Note that Parsoid output differs from the PHP parser here: the PHP
19829 # parser breaks the URL for the magic word, while in Parsoid the URL
19830 # production takes precedence.
19831 !! test
19832 Fuzz testing: Parser14
19833 !! wikitext
19834 ==onmouseover===
19835 http://__TOC__
19836 !! html/php
19837 <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>
19838 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>
19839 <ul>
19840 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19841 </ul>
19842 </div>
19843
19844
19845 !! html/php+tidy
19846 <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>
19847 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>
19848 <ul>
19849 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19850 </ul>
19851 </div>
19852 !! html/parsoid
19853 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
19854 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
19855 !! end
19856
19857 !! test
19858 Fuzz testing: Parser14-table
19859 !! options
19860 parsoid=wt2html,html2html
19861 !! wikitext
19862 ==a==
19863 {| STYLE=__TOC__
19864 !! html/php
19865 <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>
19866 <table style="&#95;_TOC&#95;_">
19867 <tr><td></td></tr>
19868 </table>
19869
19870 !! html/php+tidy
19871 <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>
19872 <table style="&#95;_TOC&#95;_">
19873 <tbody><tr><td></td></tr>
19874 </tbody></table>
19875 !! html/parsoid
19876 <h2 id="a">a</h2>
19877 <table style="__TOC__"></table>
19878 !! end
19879
19880 # Known to produce bogus xml (extra </td>)
19881 # Don't add the html/php section since it generates broken HTML
19882 !! test
19883 Fuzz testing: Parser16
19884 !! wikitext
19885 {|
19886 !https://||||||
19887 !! html+tidy
19888 <table>
19889 <tbody><tr>
19890 <th>https://</th>
19891 <th></th>
19892 <th></th>
19893 <th>
19894
19895 </th></tr>
19896 </tbody></table>
19897 !! end
19898
19899 !! test
19900 Fuzz testing: Parser21
19901 !! wikitext
19902 {|
19903 !irc://{{ftp://a" onmouseover="alert('hello world');"
19904 |
19905 !! html
19906 <table>
19907 <tr>
19908 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
19909 </th>
19910 <td>
19911 </td>
19912 </tr>
19913 </table>
19914
19915 !! end
19916
19917 !! test
19918 Fuzz testing: Parser22
19919 !! wikitext
19920 http://===r:::https://b
19921
19922 {|
19923 !! html
19924 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
19925 </p>
19926 <table>
19927 <tr><td></td></tr>
19928 </table>
19929
19930 !! end
19931
19932 ## Remex doesn't account for fostered content.
19933 ## Known to produce bad XML for now
19934 !! test
19935 Fuzz testing: Parser24
19936 !! options
19937 parsoid=wt2html
19938 !! wikitext
19939 {|
19940 {{{|
19941 <u CLASS=
19942 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19943 <br style="onmouseover='alert(document.cookie);' " />
19944
19945 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19946 |
19947 !! html/php
19948 <table>
19949 {{{|
19950 <u class="&#124;">}}}} &gt;
19951 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19952
19953 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19954 <tr>
19955 <td></u>
19956 </td>
19957 </tr>
19958 </table>
19959
19960 !! html/php+tidy
19961
19962 {{{|
19963 <u class="&#124;">}}}} &gt;
19964 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19965
19966 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19967 </u><table><tbody><tr>
19968 <td>
19969 </td>
19970 </tr>
19971 </tbody></table><p><u class="&#124;">
19972 </u></p>
19973 !! html/parsoid
19974 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
19975 {{{|
19976 <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>"}'/>}}}} >
19977 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/>
19978
19979 MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p>
19980 <table data-parsoid='{"autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedStart":true}'><td></td></tr></tbody></table>
19981 !! end
19982
19983 # Note: the current result listed for this is not what the original one was,
19984 # but the original bug was JavaScript injection, which is fixed in any case.
19985 # It's not clear that the original result listed was any more correct than the
19986 # current one. Original result:
19987 # <p>{{{|
19988 # </p>
19989 # <li class="&#124;&#124;">
19990 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19991 !!test
19992 Fuzz testing: Parser25 (T8055)
19993 !! wikitext
19994 {{{
19995 |
19996 <LI CLASS=||
19997 >
19998 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19999 !! html/php
20000 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
20001 </p>
20002 !! html/parsoid
20003 <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"]}'>
20004 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
20005 !! end
20006
20007 !!test
20008 Fuzz testing: URL adjacent extension (with space, clean)
20009 !! wikitext
20010 http://example.com <nowiki>junk</nowiki>
20011 !! html/php
20012 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
20013 </p>
20014 !! html/parsoid
20015 <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>
20016 !! end
20017
20018 !!test
20019 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
20020 !! wikitext
20021 http://example.com<nowiki>junk</nowiki>
20022 !! html/php
20023 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
20024 </p>
20025 !! html/parsoid
20026 <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>
20027 !! end
20028
20029 !! test
20030 Fuzz testing: URL adjacent extension (no space, dirty; pre)
20031 !! wikitext
20032 http://example.com<pre>junk</pre>
20033 !! html/php
20034 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
20035
20036 !! html/php+tidy
20037 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
20038 !! html/parsoid
20039 <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>
20040 !! end
20041
20042 !! test
20043 Fuzz testing: image with bogus manual thumbnail
20044 !! wikitext
20045 [[Image:foobar.jpg|thumbnail= ]]
20046 !! html/php
20047 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
20048
20049 !! html/parsoid
20050 <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>
20051 !! end
20052
20053 # Parsoid will emit the newline literally in wt2wt; see next test case.
20054 !! test
20055 Fuzz testing: encoded newline in generated HTML replacements (T8577)
20056 !! options
20057 parsoid=wt2html
20058 !! wikitext
20059 <pre dir="&#10;"></pre>
20060 !! html/php
20061 <pre dir="&#10;"></pre>
20062
20063 !! html/parsoid
20064 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
20065 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
20066 !! end
20067
20068 !! test
20069 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
20070 !! options
20071 parsoid=html2wt
20072 !! html/parsoid
20073 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
20074 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
20075 !! wikitext
20076 <pre dir="
20077 "></pre>
20078 !! html/php
20079 <pre dir=""></pre>
20080
20081 !! end
20082
20083 !! test
20084 Templates in extension attributes are not expanded
20085 !! wikitext
20086 <pre dir="{{echo|ltr}}"></pre>
20087 !! html/php
20088 <pre dir="{{echo|ltr}}"></pre>
20089
20090 !! html/parsoid
20091 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
20092 !! end
20093
20094 !! test
20095 Parsing optional HTML elements (T8171)
20096 !! options
20097 !! wikitext
20098 <table>
20099 <tr>
20100 <td> Some tabular data</td>
20101 <td> More tabular data ...
20102 <td> And yet som tabular data</td>
20103 </tr>
20104 </table>
20105 !! html
20106 <table>
20107 <tr>
20108 <td> Some tabular data</td>
20109 <td> More tabular data ...
20110 </td><td> And yet som tabular data</td>
20111 </tr>
20112 </table>
20113
20114 !! end
20115
20116 !! test
20117 Correct handling of <td>, <tr> (T8171)
20118 !! options
20119 !! wikitext
20120 <table>
20121 <tr>
20122 <td> Some tabular data</td>
20123 <td> More tabular data ...</td>
20124 <td> And yet som tabular data</td>
20125 </tr>
20126 </table>
20127 !! html
20128 <table>
20129 <tr>
20130 <td> Some tabular data</td>
20131 <td> More tabular data ...</td>
20132 <td> And yet som tabular data</td>
20133 </tr>
20134 </table>
20135
20136 !! end
20137
20138
20139 !! test
20140 Parsing crashing regression (fr:JavaScript)
20141 !! wikitext
20142 </body></x>
20143 !! html
20144 <p>&lt;/body&gt;&lt;/x&gt;
20145 </p>
20146 !! end
20147
20148 !! test
20149 Inline wiki vs wiki block nesting
20150 !! wikitext
20151 '''Bold paragraph
20152
20153 New wiki paragraph
20154 !! html
20155 <p><b>Bold paragraph</b>
20156 </p><p>New wiki paragraph
20157 </p>
20158 !! end
20159
20160 # FIXME: The current php output is documented
20161 # and desired output is the parsoid target.
20162 !! test
20163 Inline HTML vs wiki block nesting
20164 !! wikitext
20165 <b>Bold paragraph
20166
20167 New wiki paragraph
20168 !! html/php
20169 <p><b>Bold paragraph
20170 </p><p>New wiki paragraph</b>
20171 </p>
20172 !! html/php+tidy
20173 <p><b>Bold paragraph
20174 </b></p><p><b>New wiki paragraph
20175 </b></p>
20176 !! html/parsoid
20177 <p><b>Bold paragraph</b>
20178 </p><p>New wiki paragraph
20179 </p>
20180 !! end
20181
20182 # Original result was this:
20183 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
20184 # </p>
20185 # While that might be marginally more intuitive, maybe, the six-apostrophe
20186 # construct is clearly pathological and the result stated here (which is what
20187 # the parser actually does) is about as reasonable as anything.
20188 !!test
20189 Mixing markup for italics and bold
20190 !! options
20191 !! wikitext
20192 '''bold''''''bold''bolditalics'''''
20193 !! html
20194 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
20195 </p>
20196 !! end
20197
20198
20199 !! article
20200 Xyzzyx
20201 !! text
20202 Article for special page transclusion test
20203 !! endarticle
20204
20205 !! test
20206 Special page transclusion
20207 !! options
20208 !! wikitext
20209 {{Special:Prefixindex/Xyzzyx}}
20210 !! html
20211 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20212 </ul>
20213
20214 !! end
20215
20216 !! test
20217 Special page transclusion twice (T7021)
20218 !! options
20219 !! wikitext
20220 {{Special:Prefixindex/Xyzzyx}}
20221 {{Special:Prefixindex/Xyzzyx}}
20222 !! html
20223 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20224 </ul>
20225 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20226 </ul>
20227
20228 !! end
20229
20230 !! test
20231 Transclusion of default MediaWiki message
20232 !! wikitext
20233 {{MediaWiki:Mainpage}}
20234 !! html
20235 <p>Main Page
20236 </p>
20237 !! end
20238
20239 !! test
20240 Transclusion of nonexistent MediaWiki message
20241 !! wikitext
20242 {{MediaWiki:Mainpagexxx}}
20243 !! html
20244 <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>
20245 </p>
20246 !! end
20247
20248 !! test
20249 Transclusion of MediaWiki message with underscore
20250 !! wikitext
20251 {{MediaWiki:history_short}}
20252 !! html
20253 <p>History
20254 </p>
20255 !! end
20256
20257 !! test
20258 Transclusion of MediaWiki message with space
20259 !! wikitext
20260 {{MediaWiki:history short}}
20261 !! html
20262 <p>History
20263 </p>
20264 !! end
20265
20266 !! test
20267 Invalid header with following text
20268 !! wikitext
20269 = x = y
20270 !! html
20271 <p>= x = y
20272 </p>
20273 !! end
20274
20275
20276 !! test
20277 Section extraction test (section 0)
20278 !! options
20279 section=0
20280 !! wikitext
20281 start
20282 ==a==
20283 ===aa===
20284 ====aaa====
20285 ==b==
20286 ===ba===
20287 ===bb===
20288 ====bba====
20289 ===bc===
20290 ==c==
20291 ===ca===
20292 !! html/php
20293 start
20294 !! end
20295
20296 !! test
20297 Section extraction test (section 1)
20298 !! options
20299 section=1
20300 !! wikitext
20301 start
20302 ==a==
20303 ===aa===
20304 ====aaa====
20305 ==b==
20306 ===ba===
20307 ===bb===
20308 ====bba====
20309 ===bc===
20310 ==c==
20311 ===ca===
20312 !! html/php
20313 ==a==
20314 ===aa===
20315 ====aaa====
20316 !! end
20317
20318 !! test
20319 Section extraction test (section 2)
20320 !! options
20321 section=2
20322 !! wikitext
20323 start
20324 ==a==
20325 ===aa===
20326 ====aaa====
20327 ==b==
20328 ===ba===
20329 ===bb===
20330 ====bba====
20331 ===bc===
20332 ==c==
20333 ===ca===
20334 !! html/php
20335 ===aa===
20336 ====aaa====
20337 !! end
20338
20339 !! test
20340 Section extraction test (section 3)
20341 !! options
20342 section=3
20343 !! wikitext
20344 start
20345 ==a==
20346 ===aa===
20347 ====aaa====
20348 ==b==
20349 ===ba===
20350 ===bb===
20351 ====bba====
20352 ===bc===
20353 ==c==
20354 ===ca===
20355 !! html/php
20356 ====aaa====
20357 !! end
20358
20359 !! test
20360 Section extraction test (section 4)
20361 !! options
20362 section=4
20363 !! wikitext
20364 start
20365 ==a==
20366 ===aa===
20367 ====aaa====
20368 ==b==
20369 ===ba===
20370 ===bb===
20371 ====bba====
20372 ===bc===
20373 ==c==
20374 ===ca===
20375 !! html/php
20376 ==b==
20377 ===ba===
20378 ===bb===
20379 ====bba====
20380 ===bc===
20381 !! end
20382
20383 !! test
20384 Section extraction test (section 5)
20385 !! options
20386 section=5
20387 !! wikitext
20388 start
20389 ==a==
20390 ===aa===
20391 ====aaa====
20392 ==b==
20393 ===ba===
20394 ===bb===
20395 ====bba====
20396 ===bc===
20397 ==c==
20398 ===ca===
20399 !! html/php
20400 ===ba===
20401 !! end
20402
20403 !! test
20404 Section extraction test (section 6)
20405 !! options
20406 section=6
20407 !! wikitext
20408 start
20409 ==a==
20410 ===aa===
20411 ====aaa====
20412 ==b==
20413 ===ba===
20414 ===bb===
20415 ====bba====
20416 ===bc===
20417 ==c==
20418 ===ca===
20419 !! html/php
20420 ===bb===
20421 ====bba====
20422 !! end
20423
20424 !! test
20425 Section extraction test (section 7)
20426 !! options
20427 section=7
20428 !! wikitext
20429 start
20430 ==a==
20431 ===aa===
20432 ====aaa====
20433 ==b==
20434 ===ba===
20435 ===bb===
20436 ====bba====
20437 ===bc===
20438 ==c==
20439 ===ca===
20440 !! html/php
20441 ====bba====
20442 !! end
20443
20444 !! test
20445 Section extraction test (section 8)
20446 !! options
20447 section=8
20448 !! wikitext
20449 start
20450 ==a==
20451 ===aa===
20452 ====aaa====
20453 ==b==
20454 ===ba===
20455 ===bb===
20456 ====bba====
20457 ===bc===
20458 ==c==
20459 ===ca===
20460 !! html/php
20461 ===bc===
20462 !! end
20463
20464 !! test
20465 Section extraction test (section 9)
20466 !! options
20467 section=9
20468 !! wikitext
20469 start
20470 ==a==
20471 ===aa===
20472 ====aaa====
20473 ==b==
20474 ===ba===
20475 ===bb===
20476 ====bba====
20477 ===bc===
20478 ==c==
20479 ===ca===
20480 !! html/php
20481 ==c==
20482 ===ca===
20483 !! end
20484
20485 !! test
20486 Section extraction test (section 10)
20487 !! options
20488 section=10
20489 !! wikitext
20490 start
20491 ==a==
20492 ===aa===
20493 ====aaa====
20494 ==b==
20495 ===ba===
20496 ===bb===
20497 ====bba====
20498 ===bc===
20499 ==c==
20500 ===ca===
20501 !! html/php
20502 ===ca===
20503 !! end
20504
20505 !! test
20506 Section extraction test (nonexistent section 11)
20507 !! options
20508 section=11
20509 !! wikitext
20510 start
20511 ==a==
20512 ===aa===
20513 ====aaa====
20514 ==b==
20515 ===ba===
20516 ===bb===
20517 ====bba====
20518 ===bc===
20519 ==c==
20520 ===ca===
20521 !! html/php
20522 !! end
20523
20524 !! test
20525 Section extraction test with bogus heading (section 1)
20526 !! options
20527 section=1
20528 !! wikitext
20529 ==a==
20530 ==bogus== not a legal section
20531 ==b==
20532 !! html/php
20533 ==a==
20534 ==bogus== not a legal section
20535 !! end
20536
20537 !! test
20538 Section extraction test with bogus heading (section 2)
20539 !! options
20540 section=2
20541 !! wikitext
20542 ==a==
20543 ==bogus== not a legal section
20544 ==b==
20545 !! html/php
20546 ==b==
20547 !! end
20548
20549 !! test
20550 Section extraction test with comment after heading (section 1)
20551 !! options
20552 section=1
20553 !! wikitext
20554 ==a==
20555 ==b== <!-- -->
20556 ==c==
20557 !! html/php
20558 ==a==
20559 !! end
20560
20561 !! test
20562 Section extraction test with comment after heading (section 2)
20563 !! options
20564 section=2
20565 !! wikitext
20566 ==a==
20567 ==b== <!-- -->
20568 ==c==
20569 !! html/php
20570 ==b== <!-- -->
20571 !! end
20572
20573 !! test
20574 Section extraction test with bogus <nowiki> heading (section 1)
20575 !! options
20576 section=1
20577 !! wikitext
20578 ==a==
20579 ==bogus== <nowiki>not a legal section</nowiki>
20580 ==b==
20581 !! html/php
20582 ==a==
20583 ==bogus== <nowiki>not a legal section</nowiki>
20584 !! end
20585
20586 !! test
20587 Section extraction test with bogus <nowiki> heading (section 2)
20588 !! options
20589 section=2
20590 !! wikitext
20591 ==a==
20592 ==bogus== <nowiki>not a legal section</nowiki>
20593 ==b==
20594 !! html/php
20595 ==b==
20596 !! end
20597
20598 # Formerly testing for T4587, now resolved by the use of unmarked sections
20599 # instead of respecting commented sections
20600 !! test
20601 Section extraction prefixed by comment (section 1)
20602 !! options
20603 section=1
20604 !! wikitext
20605 <!-- -->==sec1==
20606 ==sec2==
20607 !! html/php
20608 ==sec2==
20609 !!end
20610
20611 !! test
20612 Section extraction prefixed by comment (section 2)
20613 !! options
20614 section=2
20615 !! wikitext
20616 <!-- -->==sec1==
20617 ==sec2==
20618 !! html/php
20619
20620 !!end
20621
20622 # Formerly testing for T4607, now resolved by the use of unmarked sections
20623 # instead of respecting HTML-style headings
20624 !! test
20625 Section extraction, mixed wiki and html (section 1)
20626 !! options
20627 section=1
20628 !! wikitext
20629 <h2>unmarked</h2>
20630 unmarked
20631 ==1==
20632 one
20633 ==2==
20634 two
20635 !! html/php
20636 ==1==
20637 one
20638 !! end
20639
20640 !! test
20641 Section extraction, mixed wiki and html (section 2)
20642 !! options
20643 section=2
20644 !! wikitext
20645 <h2>unmarked</h2>
20646 unmarked
20647 ==1==
20648 one
20649 ==2==
20650 two
20651 !! html/php
20652 ==2==
20653 two
20654 !! end
20655
20656
20657 # Formerly testing for T5342
20658 !! test
20659 Section extraction, heading surrounded by <noinclude>
20660 !! options
20661 section=1
20662 !! wikitext
20663 <noinclude>==unmarked==</noinclude>
20664 ==marked==
20665 !! html/php
20666 ==marked==
20667 !!end
20668
20669 # Test behavior of T21910
20670 !! test
20671 Sectiion with all-equals
20672 !! options
20673 section=2
20674 !! wikitext
20675 ===
20676 The line above must have a trailing space
20677 === <!--
20678 --> <!-- -->
20679 But just in case it doesn't...
20680 !! html/php
20681 === <!--
20682 --> <!-- -->
20683 But just in case it doesn't...
20684 !! end
20685
20686 !! test
20687 Section replacement test (section 0)
20688 !! options
20689 replace=0,"xxx"
20690 !! wikitext
20691 start
20692 ==a==
20693 ===aa===
20694 ====aaa====
20695 ==b==
20696 ===ba===
20697 ===bb===
20698 ====bba====
20699 ===bc===
20700 ==c==
20701 ===ca===
20702 !! html/php
20703 xxx
20704
20705 ==a==
20706 ===aa===
20707 ====aaa====
20708 ==b==
20709 ===ba===
20710 ===bb===
20711 ====bba====
20712 ===bc===
20713 ==c==
20714 ===ca===
20715 !! end
20716
20717 !! test
20718 Section replacement test (section 1)
20719 !! options
20720 replace=1,"xxx"
20721 !! wikitext
20722 start
20723 ==a==
20724 ===aa===
20725 ====aaa====
20726 ==b==
20727 ===ba===
20728 ===bb===
20729 ====bba====
20730 ===bc===
20731 ==c==
20732 ===ca===
20733 !! html/php
20734 start
20735 xxx
20736
20737 ==b==
20738 ===ba===
20739 ===bb===
20740 ====bba====
20741 ===bc===
20742 ==c==
20743 ===ca===
20744 !! end
20745
20746 !! test
20747 Section replacement test (section 2)
20748 !! options
20749 replace=2,"xxx"
20750 !! wikitext
20751 start
20752 ==a==
20753 ===aa===
20754 ====aaa====
20755 ==b==
20756 ===ba===
20757 ===bb===
20758 ====bba====
20759 ===bc===
20760 ==c==
20761 ===ca===
20762 !! html/php
20763 start
20764 ==a==
20765 xxx
20766
20767 ==b==
20768 ===ba===
20769 ===bb===
20770 ====bba====
20771 ===bc===
20772 ==c==
20773 ===ca===
20774 !! end
20775
20776 !! test
20777 Section replacement test (section 3)
20778 !! options
20779 replace=3,"xxx"
20780 !! wikitext
20781 start
20782 ==a==
20783 ===aa===
20784 ====aaa====
20785 ==b==
20786 ===ba===
20787 ===bb===
20788 ====bba====
20789 ===bc===
20790 ==c==
20791 ===ca===
20792 !! html/php
20793 start
20794 ==a==
20795 ===aa===
20796 xxx
20797
20798 ==b==
20799 ===ba===
20800 ===bb===
20801 ====bba====
20802 ===bc===
20803 ==c==
20804 ===ca===
20805 !! end
20806
20807 !! test
20808 Section replacement test (section 4)
20809 !! options
20810 replace=4,"xxx"
20811 !! wikitext
20812 start
20813 ==a==
20814 ===aa===
20815 ====aaa====
20816 ==b==
20817 ===ba===
20818 ===bb===
20819 ====bba====
20820 ===bc===
20821 ==c==
20822 ===ca===
20823 !! html/php
20824 start
20825 ==a==
20826 ===aa===
20827 ====aaa====
20828 xxx
20829
20830 ==c==
20831 ===ca===
20832 !! end
20833
20834 !! test
20835 Section replacement test (section 5)
20836 !! options
20837 replace=5,"xxx"
20838 !! wikitext
20839 start
20840 ==a==
20841 ===aa===
20842 ====aaa====
20843 ==b==
20844 ===ba===
20845 ===bb===
20846 ====bba====
20847 ===bc===
20848 ==c==
20849 ===ca===
20850 !! html/php
20851 start
20852 ==a==
20853 ===aa===
20854 ====aaa====
20855 ==b==
20856 xxx
20857
20858 ===bb===
20859 ====bba====
20860 ===bc===
20861 ==c==
20862 ===ca===
20863 !! end
20864
20865 !! test
20866 Section replacement test (section 6)
20867 !! options
20868 replace=6,"xxx"
20869 !! wikitext
20870 start
20871 ==a==
20872 ===aa===
20873 ====aaa====
20874 ==b==
20875 ===ba===
20876 ===bb===
20877 ====bba====
20878 ===bc===
20879 ==c==
20880 ===ca===
20881 !! html/php
20882 start
20883 ==a==
20884 ===aa===
20885 ====aaa====
20886 ==b==
20887 ===ba===
20888 xxx
20889
20890 ===bc===
20891 ==c==
20892 ===ca===
20893 !! end
20894
20895 !! test
20896 Section replacement test (section 7)
20897 !! options
20898 replace=7,"xxx"
20899 !! wikitext
20900 start
20901 ==a==
20902 ===aa===
20903 ====aaa====
20904 ==b==
20905 ===ba===
20906 ===bb===
20907 ====bba====
20908 ===bc===
20909 ==c==
20910 ===ca===
20911 !! html/php
20912 start
20913 ==a==
20914 ===aa===
20915 ====aaa====
20916 ==b==
20917 ===ba===
20918 ===bb===
20919 xxx
20920
20921 ===bc===
20922 ==c==
20923 ===ca===
20924 !! end
20925
20926 !! test
20927 Section replacement test (section 8)
20928 !! options
20929 replace=8,"xxx"
20930 !! wikitext
20931 start
20932 ==a==
20933 ===aa===
20934 ====aaa====
20935 ==b==
20936 ===ba===
20937 ===bb===
20938 ====bba====
20939 ===bc===
20940 ==c==
20941 ===ca===
20942 !! html/php
20943 start
20944 ==a==
20945 ===aa===
20946 ====aaa====
20947 ==b==
20948 ===ba===
20949 ===bb===
20950 ====bba====
20951 xxx
20952
20953 ==c==
20954 ===ca===
20955 !!end
20956
20957 !! test
20958 Section replacement test (section 9)
20959 !! options
20960 replace=9,"xxx"
20961 !! wikitext
20962 start
20963 ==a==
20964 ===aa===
20965 ====aaa====
20966 ==b==
20967 ===ba===
20968 ===bb===
20969 ====bba====
20970 ===bc===
20971 ==c==
20972 ===ca===
20973 !! html/php
20974 start
20975 ==a==
20976 ===aa===
20977 ====aaa====
20978 ==b==
20979 ===ba===
20980 ===bb===
20981 ====bba====
20982 ===bc===
20983 xxx
20984 !! end
20985
20986 !! test
20987 Section replacement test (section 10)
20988 !! options
20989 replace=10,"xxx"
20990 !! wikitext
20991 start
20992 ==a==
20993 ===aa===
20994 ====aaa====
20995 ==b==
20996 ===ba===
20997 ===bb===
20998 ====bba====
20999 ===bc===
21000 ==c==
21001 ===ca===
21002 !! html/php
21003 start
21004 ==a==
21005 ===aa===
21006 ====aaa====
21007 ==b==
21008 ===ba===
21009 ===bb===
21010 ====bba====
21011 ===bc===
21012 ==c==
21013 xxx
21014 !! end
21015
21016 !! test
21017 Section replacement test with initial whitespace (T15728)
21018 !! options
21019 replace=2,"xxx"
21020 !! wikitext
21021 Preformatted initial line
21022 ==a==
21023 ===a===
21024 !! html/php
21025 Preformatted initial line
21026 ==a==
21027 xxx
21028 !! end
21029
21030
21031 !! test
21032 Section extraction, heading followed by pre with 20 spaces (T8398)
21033 !! options
21034 section=1
21035 !! wikitext
21036 ==a==
21037 a
21038 !! html/php
21039 ==a==
21040 a
21041 !! end
21042
21043 !! test
21044 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
21045 !! options
21046 section=1
21047 !! wikitext
21048 ==a==
21049 a
21050 !! html/php
21051 ==a==
21052 a
21053 !! end
21054
21055
21056 !! test
21057 Section extraction, <pre> around bogus header (T12309)
21058 !! options
21059 section=2
21060 !! wikitext
21061 == Section One ==
21062 <pre>
21063 =======
21064 </pre>
21065
21066 == Section Two ==
21067 stuff
21068 !! html/php
21069 == Section Two ==
21070 stuff
21071 !! end
21072
21073 !! test
21074 Section replacement, <pre> around bogus header (T12309)
21075 !! options
21076 replace=2,"xxx"
21077 !! wikitext
21078 == Section One ==
21079 <pre>
21080 =======
21081 </pre>
21082
21083 == Section Two ==
21084 stuff
21085 !! html/php
21086 == Section One ==
21087 <pre>
21088 =======
21089 </pre>
21090
21091 xxx
21092 !! end
21093
21094 !! test
21095 Handling of &#x0A; in URLs
21096 !! wikitext
21097 *irc://&#x0A;a
21098 !! html/php
21099 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
21100
21101 !! html/parsoid
21102 <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>
21103 !! end
21104
21105 !! test
21106 Handling of %0A in URLs
21107 !! wikitext
21108 *irc://%0Aa
21109 !! html/php
21110 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
21111
21112 !! html/parsoid
21113 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
21114 !! end
21115
21116 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
21117 !! test
21118 5 quotes, code coverage +1 line
21119 !! options
21120 parsoid=wt2html
21121 !! wikitext
21122 '''''
21123 !! html/php
21124 !! html/parsoid
21125 <p><b><i></i></b></p>
21126 !! end
21127
21128 # same html as previous, but wikitext adjusted to match parsoid html2wt
21129 # note that wt2html and html2html will put the <i> before the <b>
21130 !! test
21131 5 quotes, code coverage +1 line w/ nowiki (1)
21132 !! options
21133 parsoid=wt2wt,html2wt
21134 !! wikitext
21135 '''''<nowiki/>'''''
21136 !! html/php
21137 <p><i></i>
21138 </p>
21139 !! html/parsoid
21140 <p><b><i></i></b></p>
21141 !! end
21142
21143 # same as previous, just swapping the <i> and <b>
21144 !! test
21145 5 quotes, code coverage +1 line w/ nowiki (2)
21146 !! wikitext
21147 '''''<nowiki/>'''''
21148 !! html/php
21149 <p><i></i>
21150 </p>
21151 !! html/parsoid
21152 <p><i><b></b></i></p>
21153 !! end
21154
21155 !! test
21156 Special:Search page linking.
21157 !! wikitext
21158 {{Special:search}}
21159 !! html
21160 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
21161 </p>
21162 !! end
21163
21164 !! test
21165 {{!}} is a magic word
21166 !! wikitext
21167 {{!}} is a magic word there and {{!}} is still a magic word here
21168 | is not a magic word here but {{!}} is still a magic word here
21169 !! html/php
21170 <p>| is a magic word there and | is still a magic word here
21171 | is not a magic word here but | is still a magic word here
21172 </p>
21173 !! html/parsoid
21174 <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
21175 | 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>
21176 !! end
21177
21178 !! test
21179 Say the magic word
21180 !! options
21181 title=[[Parser test]]
21182 !! wikitext
21183 *{{PAGENAME}}
21184 *{{PAGENAMEE}}
21185 *{{FULLPAGENAME}}
21186 *{{FULLPAGENAMEE}}
21187 *{{BASEPAGENAME}}
21188 *{{BASEPAGENAMEE}}
21189 *{{SUBPAGENAME}}
21190 *{{SUBPAGENAMEE}}
21191 *{{ROOTPAGENAME}}
21192 *{{ROOTPAGENAMEE}}
21193 *{{TALKPAGENAME}}
21194 *{{TALKPAGENAMEE}}
21195 *{{SUBJECTPAGENAME}}
21196 *{{SUBJECTPAGENAMEE}}
21197 *{{NAMESPACEE}}
21198 *{{NAMESPACE}}
21199 *{{NAMESPACENUMBER}}
21200 *{{TALKSPACE}}
21201 *{{TALKSPACEE}}
21202 *{{SUBJECTSPACE}}
21203 *{{SUBJECTSPACEE}}
21204 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
21205 !! html
21206 <ul><li>Parser test</li>
21207 <li>Parser_test</li>
21208 <li>Parser test</li>
21209 <li>Parser_test</li>
21210 <li>Parser test</li>
21211 <li>Parser_test</li>
21212 <li>Parser test</li>
21213 <li>Parser_test</li>
21214 <li>Parser test</li>
21215 <li>Parser_test</li>
21216 <li>Talk:Parser test</li>
21217 <li>Talk:Parser_test</li>
21218 <li>Parser test</li>
21219 <li>Parser_test</li>
21220 <li></li>
21221 <li></li>
21222 <li>0</li>
21223 <li>Talk</li>
21224 <li>Talk</li>
21225 <li></li>
21226 <li></li>
21227 <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>
21228
21229 !! end
21230 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
21231
21232 !! test
21233 Gallery with valid attributes
21234 !! wikitext
21235 <gallery type="123" summary="345">
21236 File:File:Foobar.jpg
21237 </gallery>
21238 !! html/php
21239 <ul class="gallery mw-gallery-traditional" type="123">
21240 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21241 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
21242 <div class="gallerytext">
21243 </div>
21244 </div></li>
21245 </ul>
21246
21247 !! html/parsoid
21248 <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"}}'>
21249 <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>
21250 </ul>
21251 !! end
21252
21253 ## Parsoid thinks the "centre" here is a property, not a caption.
21254 !! test
21255 Gallery
21256 !! options
21257 parsoid={
21258 "modes": ["wt2html"],
21259 "nativeGallery": true
21260 }
21261 !! wikitext
21262 <gallery>
21263 image1.png |
21264 image2.gif|||||
21265
21266 image3|
21267 image4 |300px| centre
21268 image5.svg| http://///////
21269 [[x|xx]]]]
21270 * image6
21271 </gallery>
21272 !! html/php
21273 <ul class="gallery mw-gallery-traditional">
21274 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21275 <div class="thumb" style="height: 150px;">Image1.png</div>
21276 <div class="gallerytext">
21277 </div>
21278 </div></li>
21279 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21280 <div class="thumb" style="height: 150px;">Image2.gif</div>
21281 <div class="gallerytext">
21282 </div>
21283 </div></li>
21284 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21285 <div class="thumb" style="height: 150px;">Image3</div>
21286 <div class="gallerytext">
21287 </div>
21288 </div></li>
21289 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21290 <div class="thumb" style="height: 150px;">Image4</div>
21291 <div class="gallerytext">
21292 <pre>centre
21293 </pre>
21294 </div>
21295 </div></li>
21296 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21297 <div class="thumb" style="height: 150px;">Image5.svg</div>
21298 <div class="gallerytext">
21299 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
21300 </p>
21301 </div>
21302 </div></li>
21303 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21304 <div class="thumb" style="height: 150px;">* image6</div>
21305 <div class="gallerytext">
21306 </div>
21307 </div></li>
21308 </ul>
21309
21310 !! html/parsoid
21311 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21312 <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>
21313 <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>
21314 <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>
21315 <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>
21316 <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>
21317 <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>
21318 </ul>
21319 !! end
21320
21321 !! test
21322 Gallery (with options, html)
21323 !! options
21324 parsoid={
21325 "modes": ["wt2html", "html2html"],
21326 "nativeGallery": true
21327 }
21328 !! wikitext
21329 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
21330 File:Nonexistent.jpg|caption
21331 File:Nonexistent.jpg
21332 image:foobar.jpg|some '''caption''' [[Main Page]]
21333 image:foobar.jpg
21334 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
21335 </gallery>
21336 !! html/php
21337 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
21338 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
21339 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21340 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21341 <div class="gallerytext">
21342 <p>caption
21343 </p>
21344 </div>
21345 </div></li>
21346 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21347 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21348 <div class="gallerytext">
21349 </div>
21350 </div></li>
21351 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21352 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" 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>
21353 <div class="gallerytext">
21354 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21355 </p>
21356 </div>
21357 </div></li>
21358 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21359 <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>
21360 <div class="gallerytext">
21361 </div>
21362 </div></li>
21363 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21364 <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>
21365 <div class="gallerytext">
21366 <p>blabla.
21367 </p>
21368 </div>
21369 </div></li>
21370 </ul>
21371
21372 !! html/parsoid
21373 <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":{}}'>
21374 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
21375 <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>
21376 <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>
21377 <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>
21378 <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>
21379 <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>
21380 </ul>
21381 !! end
21382
21383 !! test
21384 Gallery (with options, extsrc)
21385 !! options
21386 parsoid={
21387 "nativeGallery": false
21388 }
21389 !! wikitext
21390 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
21391 File:Nonexistent.jpg|caption
21392 File:Nonexistent.jpg
21393 image:foobar.jpg|some '''caption''' [[Main Page]]
21394 image:foobar.jpg
21395 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
21396 </gallery>
21397 !! html/php
21398 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
21399 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
21400 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21401 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21402 <div class="gallerytext">
21403 <p>caption
21404 </p>
21405 </div>
21406 </div></li>
21407 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21408 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21409 <div class="gallerytext">
21410 </div>
21411 </div></li>
21412 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21413 <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>
21414 <div class="gallerytext">
21415 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21416 </p>
21417 </div>
21418 </div></li>
21419 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21420 <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>
21421 <div class="gallerytext">
21422 </div>
21423 </div></li>
21424 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21425 <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>
21426 <div class="gallerytext">
21427 <p>blabla.
21428 </p>
21429 </div>
21430 </div></li>
21431 </ul>
21432
21433 !! html/parsoid
21434 <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"}}'>
21435 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
21436 <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>
21437 <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>
21438 <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>
21439 <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>
21440 <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>
21441 </ul>
21442 !! end
21443
21444 !! test
21445 Gallery (without px units)
21446 !! wikitext
21447 <gallery widths="70" heights="40">
21448 File:Foobar.jpg
21449 </gallery>
21450 !! html/php
21451 <ul class="gallery mw-gallery-traditional">
21452 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21453 <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>
21454 <div class="gallerytext">
21455 </div>
21456 </div></li>
21457 </ul>
21458
21459 !! html/parsoid
21460 <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"}}'>
21461 <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>
21462 </ul>
21463 !! end
21464
21465 !! test
21466 Gallery (with invalid units)
21467 !! wikitext
21468 <gallery widths="70em" heights="40em">
21469 File:Foobar.jpg
21470 </gallery>
21471 !! html/php
21472 <ul class="gallery mw-gallery-traditional">
21473 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21474 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21475 <div class="gallerytext">
21476 </div>
21477 </div></li>
21478 </ul>
21479
21480 !! html/parsoid
21481 <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"}}'>
21482 <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>
21483 </ul>
21484 !! end
21485
21486 !! test
21487 Gallery with link that has fragment
21488 !! options
21489 parsoid={
21490 "modes": ["wt2html", "html2html"],
21491 "nativeGallery": true
21492 }
21493 !! wikitext
21494 <gallery>
21495 image:foobar.jpg|link=Main_Page
21496 image:foobar.jpg|link=Main_Page#section
21497 image:foobar.jpg|link=Main Page#section|caption
21498 </gallery>
21499 !! html/php
21500 <ul class="gallery mw-gallery-traditional">
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/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>
21503 <div class="gallerytext">
21504 </div>
21505 </div></li>
21506 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21507 <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>
21508 <div class="gallerytext">
21509 </div>
21510 </div></li>
21511 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21512 <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>
21513 <div class="gallerytext">
21514 <p>caption
21515 </p>
21516 </div>
21517 </div></li>
21518 </ul>
21519
21520 !! html/parsoid
21521 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21522 <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>
21523 <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>
21524 <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>
21525 </ul>
21526 !! end
21527
21528 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
21529 !! test
21530 Gallery with template inside caption
21531 !! options
21532 parsoid={
21533 "nativeGallery": true
21534 }
21535 !! wikitext
21536 <gallery caption="{{echo|hi}}">
21537 File:Foobar.jpg|{{echo|ho}}
21538 </gallery>
21539 !! html/php
21540 <ul class="gallery mw-gallery-traditional">
21541 <li class='gallerycaption'>{{echo|hi}}</li>
21542 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21543 <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>
21544 <div class="gallerytext">
21545 <p>ho
21546 </p>
21547 </div>
21548 </div></li>
21549 </ul>
21550
21551 !! html/parsoid
21552 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21553 <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>
21554 <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>
21555 </ul>
21556 !! end
21557
21558 !! test
21559 Gallery with wikitext inside caption
21560 !! options
21561 parsoid={
21562 "nativeGallery": true
21563 }
21564 !! wikitext
21565 <gallery>
21566 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
21567 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
21568 </gallery>
21569 !! html/php
21570 <ul class="gallery mw-gallery-traditional">
21571 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21572 <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>
21573 <div class="gallerytext">
21574 <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>
21575 </p>
21576 </div>
21577 </div></li>
21578 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21579 <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>
21580 <div class="gallerytext">
21581 <p>This is a test template
21582 </p>
21583 </div>
21584 </div></li>
21585 </ul>
21586
21587 !! html/parsoid
21588 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21589 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img 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>
21590 <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>
21591 </ul>
21592 !! end
21593
21594 !! test
21595 Gallery (with showfilename option)
21596 !! options
21597 parsoid={
21598 "nativeGallery": true
21599 }
21600 !! wikitext
21601 <gallery showfilename="">
21602 File:Nonexistent.jpg|caption
21603 File:Nonexistent.jpg
21604 File:Foobar.jpg|some '''caption''' [[Main Page]]
21605 File:Foobar.jpg
21606 </gallery>
21607 !! html/php
21608 <ul class="gallery mw-gallery-traditional">
21609 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21610 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21611 <div class="gallerytext">
21612 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21613 caption
21614 </p>
21615 </div>
21616 </div></li>
21617 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21618 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21619 <div class="gallerytext">
21620 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21621 </p>
21622 </div>
21623 </div></li>
21624 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21625 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" 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>
21626 <div class="gallerytext">
21627 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21628 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21629 </p>
21630 </div>
21631 </div></li>
21632 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21633 <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>
21634 <div class="gallerytext">
21635 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21636 </p>
21637 </div>
21638 </div></li>
21639 </ul>
21640
21641 !! html/parsoid
21642 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
21643 <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>
21644 <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>
21645 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><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>
21646 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">File:Foobar.jpg</a></div></li>
21647 </ul>
21648 !! end
21649
21650 ## Should Parsoid be preserving these variations? See T151367
21651 !! test
21652 Gallery (with namespace-less filenames)
21653 !! options
21654 parsoid={
21655 "modes": ["wt2html", "html2html"],
21656 "nativeGallery": true
21657 }
21658 !! wikitext
21659 <gallery>
21660 File:Nonexistent.jpg
21661 Nonexistent.jpg
21662 image:foobar.jpg
21663 foobar.jpg
21664 </gallery>
21665 !! html/php
21666 <ul class="gallery mw-gallery-traditional">
21667 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21668 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21669 <div class="gallerytext">
21670 </div>
21671 </div></li>
21672 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21673 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21674 <div class="gallerytext">
21675 </div>
21676 </div></li>
21677 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21678 <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>
21679 <div class="gallerytext">
21680 </div>
21681 </div></li>
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: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>
21692 <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>
21693 <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>
21694 <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>
21695 </ul>
21696 !! end
21697
21698 !! test
21699 Gallery override link with wikilink (T36852)
21700 !! options
21701 parsoid={
21702 "nativeGallery": true
21703 }
21704 !! wikitext
21705 <gallery>
21706 File:Foobar.jpg|alt=galleryalt|link=Wikilink
21707 </gallery>
21708 !! html/php
21709 <ul class="gallery mw-gallery-traditional">
21710 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21711 <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>
21712 <div class="gallerytext">
21713 </div>
21714 </div></li>
21715 </ul>
21716
21717 !! html/parsoid
21718 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21719 <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>
21720 </ul>
21721 !! end
21722
21723 !! test
21724 Gallery override link with absolute external link (T36852)
21725 !! options
21726 parsoid={
21727 "nativeGallery": true
21728 }
21729 !! wikitext
21730 <gallery>
21731 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
21732 </gallery>
21733 !! html/php
21734 <ul class="gallery mw-gallery-traditional">
21735 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21736 <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>
21737 <div class="gallerytext">
21738 </div>
21739 </div></li>
21740 </ul>
21741
21742 !! html/parsoid
21743 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21744 <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>
21745 </ul>
21746 !! end
21747
21748 !! test
21749 Gallery override link with absolute external link with LanguageConverter
21750 !! options
21751 language=zh
21752 !! wikitext
21753 <gallery>
21754 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21755 </gallery>
21756 !! html/php
21757 <ul class="gallery mw-gallery-traditional">
21758 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21759 <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>
21760 <div class="gallerytext">
21761 <p>caption
21762 </p>
21763 </div>
21764 </div></li>
21765 </ul>
21766
21767 !! html/parsoid
21768 <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"}}'>
21769 <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>
21770 </ul>
21771 !! end
21772
21773 !! test
21774 Gallery override link with malicious javascript (T36852)
21775 !! options
21776 parsoid={
21777 "modes": ["wt2html", "html2html"],
21778 "nativeGallery": true
21779 }
21780 !! wikitext
21781 <gallery>
21782 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21783 </gallery>
21784 !! html/php
21785 <ul class="gallery mw-gallery-traditional">
21786 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21787 <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>
21788 <div class="gallerytext">
21789 </div>
21790 </div></li>
21791 </ul>
21792
21793 !! html/parsoid
21794 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21795 <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>
21796 </ul>
21797 !! end
21798
21799 # Note that parsoid uses the invalid link as a caption, PHP does not.
21800 !! test
21801 Gallery with invalid title as link (T45964)
21802 !! options
21803 parsoid={
21804 "modes": ["wt2html", "html2html"],
21805 "nativeGallery": true
21806 }
21807 !! wikitext
21808 <gallery>
21809 File:Foobar.jpg|link=<
21810 </gallery>
21811 !! html/php
21812 <ul class="gallery mw-gallery-traditional">
21813 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21814 <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>
21815 <div class="gallerytext">
21816 </div>
21817 </div></li>
21818 </ul>
21819
21820 !! html/parsoid
21821 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21822 <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>
21823 </ul>
21824 !! end
21825
21826 !! test
21827 Serialize gallery without attrs in data-mw
21828 !! options
21829 parsoid={
21830 "modes": ["html2wt"],
21831 "nativeGallery": true
21832 }
21833 !! html/parsoid
21834 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
21835 <li class="gallerycaption">123</li>
21836 <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>
21837 </ul>
21838 !! wikitext
21839 <gallery caption="123">
21840 File:Test.png
21841 </gallery>
21842 !! end
21843
21844 !! test
21845 Gallery with class and style attributes
21846 !! options
21847 parsoid={
21848 "nativeGallery": true
21849 }
21850 !! wikitext
21851 <gallery class="center" style="text-align: center;">
21852 File:Foobar.jpg
21853 </gallery>
21854 !! html/php
21855 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
21856 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21857 <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>
21858 <div class="gallerytext">
21859 </div>
21860 </div></li>
21861 </ul>
21862
21863 !! html/parsoid
21864 <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":{}}'>
21865 <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>
21866 </ul>
21867 !! end
21868
21869 !! test
21870 Gallery in slideshow mode
21871 !! options
21872 parsoid={
21873 "nativeGallery": true
21874 }
21875 !! wikitext
21876 <gallery mode="slideshow" showthumbnails="">
21877 File:Foobar.jpg
21878 </gallery>
21879 !! html/php
21880 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
21881 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21882 <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>
21883 <div class="gallerytext">
21884 </div>
21885 </div></li>
21886 </ul>
21887
21888 !! html/parsoid
21889 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
21890 <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>
21891 </ul>
21892 !! end
21893
21894 !! test
21895 Serialize gallery image captions on a line
21896 !! options
21897 parsoid={
21898 "modes": ["html2wt"],
21899 "nativeGallery": true
21900 }
21901 !! html/parsoid
21902 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21903 <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>
21904 <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>
21905 </ul>
21906 !! wikitext
21907 <gallery>
21908 File:Foobar.jpg| hi ho
21909 File:Foobar.jpg|hi<br />ho
21910 </gallery>
21911 !! end
21912
21913 !! test
21914 HTML Hex character encoding (spells the word "JavaScript")
21915 !! options
21916 parsoid=wt2html,wt2wt,html2html
21917 !! wikitext
21918 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
21919 !! html/php
21920 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
21921 </p>
21922 !! html/parsoid
21923 <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>
21924 !! end
21925
21926 !! test
21927 HTML Hex character encoding bogus encoding (T28437 regression check)
21928 !! wikitext
21929 &#xsee;&#XSEE;
21930 !! html
21931 <p>&amp;#xsee;&amp;#XSEE;
21932 </p>
21933 !! end
21934
21935 !! test
21936 HTML Hex character encoding mixed case
21937 !! options
21938 parsoid=wt2html,wt2wt,html2html
21939 !! wikitext
21940 &#xEE;&#Xee;
21941 !! html/php
21942 <p>&#xee;&#xee;
21943 </p>
21944 !! html/parsoid
21945 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
21946 !! end
21947
21948 # See: https://www.w3.org/TR/html5/syntax.html#character-references
21949 # Note that U+000C (form feed) is not a valid XML character, so
21950 # it is banned even though allowed in HTML5.
21951 !! test
21952 Illegal character references (T106578)
21953 !! wikitext
21954 ; Null: &#00;
21955 ; FF: &#xC;
21956 ; CR: &#xD;
21957 ; Control (low): &#8;
21958 ; Control (high): &#x7F; &#x9F;
21959 ; Surrogate: &#xD83D;&#xDCA9;
21960 ; This is an okay astral character: &#x1F4A9;
21961 !! html+tidy
21962 <dl><dt>Null</dt>
21963 <dd>&amp;#00;</dd>
21964 <dt>FF</dt>
21965 <dd>&amp;#xC;</dd>
21966 <dt>CR</dt>
21967 <dd>&amp;#xD;</dd>
21968 <dt>Control (low)</dt>
21969 <dd>&amp;#8;</dd>
21970 <dt>Control (high)</dt>
21971 <dd>&amp;#x7F; &amp;#x9F;</dd>
21972 <dt>Surrogate</dt>
21973 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
21974 <dt>This is an okay astral character</dt>
21975 <dd>&#x1f4a9;</dd></dl>
21976 !! end
21977
21978 !! test
21979 __FORCETOC__ override
21980 !! wikitext
21981 __NEWSECTIONLINK__
21982 __FORCETOC__
21983 !! html/php
21984 <p><br />
21985 </p>
21986 !! end
21987
21988 !! test
21989 ISBN code coverage
21990 !! wikitext
21991 ISBN 978-0-1234-56&#x20;789
21992 !! html/php
21993 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21994 </p>
21995 !! html/parsoid
21996 <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>
21997 !! end
21998
21999 !! test
22000 ISBN followed by 5 spaces
22001 !! wikitext
22002 ISBN
22003 !! html
22004 <p>ISBN
22005 </p>
22006 !! end
22007
22008 !! test
22009 Double ISBN
22010 !! wikitext
22011 ISBN ISBN 1234567890
22012 !! html/php
22013 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22014 </p>
22015 !! html/parsoid
22016 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
22017 !! end
22018
22019 # Uppercase X and lowercase x as well
22020 !! test
22021 ISBN with an X
22022 !! wikitext
22023 ISBN 3-462-04561-X
22024 ISBN 3-462-04561-x
22025 ISBN 080442957X
22026 ISBN 080442957x
22027 ISBN 978080442957X
22028 ISBN 978080442957x
22029 !! html/php
22030 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
22031 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
22032 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
22033 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
22034 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
22035 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
22036 </p>
22037 !! html/parsoid
22038 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
22039 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
22040 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
22041 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
22042 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
22043 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
22044 !! end
22045
22046 !! test
22047 ISBN with empty prefix (parsoid test)
22048 !! wikitext
22049 ISBN 1234567890
22050 !! html/php
22051 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22052 </p>
22053 !! html/parsoid
22054 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
22055 !! end
22056
22057 !! test
22058 T24905: <abbr> followed by ISBN followed by </a>
22059 !! wikitext
22060 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
22061 !! html/php
22062 <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>
22063 </p>
22064 !! html/parsoid
22065 <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>
22066 !! end
22067
22068 !! test
22069 Double RFC
22070 !! wikitext
22071 RFC RFC 1234
22072 !! html/php
22073 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
22074 </p>
22075 !! html/parsoid
22076 <p>RFC <a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
22077 !! end
22078
22079 !! test
22080 Double RFC with a wiki link
22081 !! wikitext
22082 RFC [[RFC 1234]]
22083 !! html/php
22084 <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>
22085 </p>
22086 !! html/parsoid
22087 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234" title="RFC 1234">RFC 1234</a></p>
22088 !! end
22089
22090 !! test
22091 RFC code coverage
22092 !! wikitext
22093 RFC 983&#x20;987
22094 !! html/php
22095 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
22096 </p>
22097 !! html/parsoid
22098 <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>
22099 !! end
22100
22101 !! test
22102 Centre-aligned image
22103 !! wikitext
22104 [[Image:foobar.jpg|centre]]
22105 !! html/php
22106 <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>
22107
22108 !! html/parsoid
22109 <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>
22110 !! end
22111
22112 !! test
22113 None-aligned image
22114 !! wikitext
22115 [[Image:foobar.jpg|none]]
22116 !! html/php
22117 <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>
22118
22119 !! html/parsoid
22120 <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>
22121 !! end
22122
22123 !! test
22124 Width + Height sized image (using px) (height is ignored)
22125 !! wikitext
22126 [[Image:foobar.jpg|640x480px]]
22127 !! html/php
22128 <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>
22129 </p>
22130 !! html/parsoid
22131 <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>
22132 !! end
22133
22134 !! test
22135 Width-sized image (using px, no following whitespace)
22136 !! wikitext
22137 [[Image:foobar.jpg|640px]]
22138 !! html/php
22139 <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>
22140 </p>
22141 !! html/parsoid
22142 <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>
22143 !! end
22144
22145 !! test
22146 Width-sized image (using px, with following whitespace - test regression from r39467)
22147 !! wikitext
22148 [[Image:foobar.jpg|640px ]]
22149 !! html/php
22150 <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>
22151 </p>
22152 !! html/parsoid
22153 <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>
22154 !!end
22155
22156 !! test
22157 Width-sized image (using px, with preceding whitespace - test regression from r39467)
22158 !! wikitext
22159 [[Image:foobar.jpg| 640px]]
22160 !! html/php
22161 <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>
22162 </p>
22163 !! html/parsoid
22164 <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>
22165 !! end
22166
22167 !! test
22168 Image with page parameter
22169 !! options
22170 djvu
22171 !! wikitext
22172 [[File:LoremIpsum.djvu|page=2]]
22173 !! html/php
22174 <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>
22175 </p>
22176 !! html/parsoid
22177 <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>
22178 !! end
22179
22180 !! test
22181 Another italics / bold test
22182 !! wikitext
22183 ''' ''x'
22184 !! html
22185 <pre>'<i> </i>x'
22186 </pre>
22187 !!end
22188
22189 # FIXME: The php output seems broken. It's interleaving some open/close tags.
22190 !! test
22191 dt/dd/dl test
22192 !! wikitext
22193 :;;;::
22194 !! html/php
22195 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
22196
22197 !! html/parsoid
22198 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
22199
22200 !!end
22201
22202 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
22203 !! test
22204 Images with the "|" character in the comment
22205 !! wikitext
22206 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
22207 !! html/php
22208 <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>
22209
22210 !! html/parsoid
22211 <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>
22212 !! end
22213
22214 !! test
22215 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
22216 !! wikitext
22217 <html><script>alert(1);</script></html>
22218 !! html
22219 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
22220 </p>
22221 !! end
22222
22223 !! test
22224 HTML with raw HTML ($wgRawHtml==true)
22225 !! options
22226 wgRawHtml=1
22227 !! wikitext
22228 <html><script>alert(1);</script></html>
22229 !! html/php
22230 <p><script>alert(1);</script>
22231 </p>
22232 !! html/parsoid
22233 <p><script typeof="mw:Extension/html" about="#mwt3" data-mw='{"name":"html","attrs":{},"body":{"extsrc":"&lt;script>alert(1);&lt;/script>"}}'>alert(1);</script></p>
22234 !! end
22235
22236 !! test
22237 Parents of subpages, one level up
22238 !! options
22239 subpage title=[[Subpage test/L1/L2/L3]]
22240 !! wikitext
22241 [[../|L2]]
22242 !! html
22243 <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>
22244 </p>
22245 !! end
22246
22247
22248 !! test
22249 Parents of subpages, one level up, not named
22250 !! options
22251 subpage title=[[Subpage test/L1/L2/L3]]
22252 !! wikitext
22253 [[../]]
22254 !! html
22255 <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>
22256 </p>
22257 !! end
22258
22259
22260
22261 !! test
22262 Parents of subpages, two levels up
22263 !! options
22264 subpage title=[[Subpage test/L1/L2/L3]]
22265 !! wikitext
22266 [[../../|L1]]2
22267
22268 [[../../|L1]]l
22269 !! html
22270 <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
22271 </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>
22272 </p>
22273 !! end
22274
22275 !! test
22276 Parents of subpages, two levels up, without trailing slash or name.
22277 !! options
22278 subpage title=[[Subpage test/L1/L2/L3]]
22279 !! wikitext
22280 [[../..]]
22281 !! html
22282 <p>[[../..]]
22283 </p>
22284 !! end
22285
22286 !! test
22287 Parents of subpages, two levels up, with lots of extra trailing slashes.
22288 !! options
22289 subpage title=[[Subpage test/L1/L2/L3]]
22290 !! wikitext
22291 [[../../////]]
22292 !! html
22293 <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>
22294 </p>
22295 !! end
22296
22297 !! article
22298 Subpage test/L1/L2/L3Sibling
22299 !! text
22300 Sibling article
22301 !! endarticle
22302
22303 !! test
22304 Transclusion of a sibling page (one level up)
22305 !! options
22306 subpage title=[[Subpage test/L1/L2/L3]]
22307 !! wikitext
22308 {{../L3Sibling}}
22309 !! html
22310 <p>Sibling article
22311 </p>
22312 !! end
22313
22314 !! test
22315 Transclusion of a child page
22316 !! options
22317 subpage title=[[Subpage test/L1/L2]]
22318 !! wikitext
22319 {{/L3Sibling}}
22320 !! html
22321 <p>Sibling article
22322 </p>
22323 !! end
22324
22325 # This is wt2html only in Parsoid because we add <nowiki>
22326 # because of {{..}} and we don't expect to fix that to
22327 # eliminate the nowikis selective for {{..}} markup.
22328 !! test
22329 Non-transclusion because of too many up levels
22330 !! options
22331 subpage title=[[Subpage test/L1/L2/L3]]
22332 parsoid=wt2html
22333 !! wikitext
22334 {{../../../../More than parent}}
22335 !! html/php
22336 <p>{{../../../../More than parent}}
22337 </p>
22338 !! html/parsoid
22339 <p>{{../../../../More than parent}}</p>
22340 !! end
22341
22342 !! test
22343 Definition list code coverage
22344 !! wikitext
22345 ;title :def
22346 ;title :def
22347 ;title:def
22348 !! html/php
22349 <dl><dt>title</dt>
22350 <dd>def</dd>
22351 <dt>title</dt>
22352 <dd>def</dd>
22353 <dt>title</dt>
22354 <dd>def</dd></dl>
22355
22356 !! html/parsoid
22357 <dl><dt>title </dt><dd>def</dd>
22358 <dt>title </dt><dd>def</dd>
22359 <dt>title</dt><dd>def</dd></dl>
22360 !! end
22361
22362 !! test
22363 Don't fall for the self-closing div
22364 !! wikitext
22365 <div>hello world</div/>
22366 !! html
22367 <div>hello world</div>
22368
22369 !! end
22370
22371 !! test
22372 MSGNW magic word
22373 !! wikitext
22374 {{MSGNW:msg}}
22375 !! html/php
22376 <p>&#91;&#91;:Template:Msg&#93;&#93;
22377 </p>
22378 !! end
22379
22380 !! test
22381 RAW magic word
22382 !! wikitext
22383 {{RAW:QUERTY}}
22384 !! html
22385 <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>
22386 </p>
22387 !! end
22388
22389 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
22390 !! test
22391 Always escape literal '>' in output, not just after '<'
22392 !! wikitext
22393 ><>
22394 !! html
22395 <p>&gt;&lt;&gt;
22396 </p>
22397 !! end
22398
22399 !! test
22400 Template caching
22401 !! wikitext
22402 {{Test}}
22403 {{Test}}
22404 !! html
22405 <p>This is a test template
22406 This is a test template
22407 </p>
22408 !! end
22409
22410
22411 !! article
22412 MediaWiki:Fake
22413 !! text
22414 ==header==
22415 !! endarticle
22416
22417 !! test
22418 Inclusion of !userCanEdit() content
22419 !! wikitext
22420 {{MediaWiki:Fake}}
22421 !! html
22422 <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>
22423
22424 !! end
22425
22426
22427 !! test
22428 Out-of-order TOC heading levels
22429 !! wikitext
22430 ==2==
22431 ======6======
22432 ===3===
22433 =1=
22434 =====5=====
22435 ==2==
22436 !! html
22437 <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>
22438 <ul>
22439 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
22440 <ul>
22441 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
22442 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
22443 </ul>
22444 </li>
22445 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
22446 <ul>
22447 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
22448 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
22449 </ul>
22450 </li>
22451 </ul>
22452 </div>
22453
22454 <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>
22455 <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>
22456 <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>
22457 <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>
22458 <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>
22459 <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>
22460
22461 !! end
22462
22463
22464 !! test
22465 ISBN with a dummy number
22466 !! wikitext
22467 ISBN ---
22468 !! html
22469 <p>ISBN ---
22470 </p>
22471 !! end
22472
22473
22474 !! test
22475 ISBN with space-delimited number
22476 !! wikitext
22477 ISBN 92 9017 032 8
22478 !! html/php
22479 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
22480 </p>
22481 !! html/parsoid
22482 <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>
22483 !! end
22484
22485
22486 !! test
22487 ISBN with multiple spaces, no number
22488 !! wikitext
22489 ISBN foo
22490 !! html
22491 <p>ISBN foo
22492 </p>
22493 !! end
22494
22495
22496 !! test
22497 ISBN length
22498 !! wikitext
22499 ISBN 123456789
22500
22501 ISBN 1234567890
22502
22503 ISBN 12345678901
22504 !! html/php
22505 <p>ISBN 123456789
22506 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22507 </p><p>ISBN 12345678901
22508 </p>
22509 !! html/parsoid
22510 <p>ISBN 123456789</p>
22511
22512 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
22513
22514 <p>ISBN 12345678901</p>
22515 !! end
22516
22517
22518 !! test
22519 ISBN with trailing year (T9110)
22520 !! wikitext
22521 ISBN 1-234-56789-0 - 2006
22522
22523 ISBN 1 234 56789 0 - 2006
22524 !! html/php
22525 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
22526 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
22527 </p>
22528 !! html/parsoid
22529 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
22530
22531 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
22532 !! end
22533
22534
22535 !! test
22536 anchorencode
22537 !! config
22538 wgFragmentMode=[ 'html5', 'legacy' ]
22539 !! wikitext
22540 {{anchorencode:foo bar©#%n}}
22541 !! html/php
22542 <p>foo_bar©#%n
22543 </p>
22544 !! html/parsoid
22545 <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>
22546 !! end
22547
22548 !! test
22549 anchorencode (legacy)
22550 !! config
22551 wgFragmentMode=[ 'legacy' ]
22552 !! wikitext
22553 {{anchorencode:foo bar©#%n}}
22554 !! html/php
22555 <p>foo_bar.C2.A9.23.25n
22556 </p>
22557 !! end
22558
22559 !! test
22560 anchorencode trims spaces
22561 !! config
22562 wgFragmentMode=[ 'html5', 'legacy' ]
22563 !! wikitext
22564 {{anchorencode: __pretty__please__}}
22565 !! html/php
22566 <p>pretty_please
22567 </p>
22568 !! html/parsoid
22569 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
22570 !! end
22571
22572 !! test
22573 anchorencode deals with links
22574 !! config
22575 wgFragmentMode=[ 'html5', 'legacy' ]
22576 !! wikitext
22577 {{anchorencode: [[hello|world]] [[hi]]}}
22578 !! html/php
22579 <p>world_hi
22580 </p>
22581 !! html/parsoid
22582 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
22583 !! end
22584
22585 !! test
22586 anchorencode deals with templates
22587 !! config
22588 wgFragmentMode=[ 'html5', 'legacy' ]
22589 !! wikitext
22590 {{anchorencode: {{Foo}} x}}
22591 !! html/php
22592 <p>FOO_x
22593 </p>
22594 !! html/parsoid
22595 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
22596 !! end
22597
22598 !! test
22599 anchorencode encodes like the TOC generator: (T20431)
22600 !! config
22601 wgFragmentMode=[ 'html5', 'legacy' ]
22602 !! wikitext
22603 ===_ +:.3A%3A _ &&amp;]] x===
22604 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
22605 __NOEDITSECTION__
22606 !! html/php
22607 <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>
22608 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
22609 </p>
22610 !! html/parsoid
22611 <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>
22612 <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>
22613 <meta property="mw:PageProp/noeditsection"/>
22614 !! end
22615
22616 !! test
22617 anchorencode encodes like the TOC generator: (T20431) (legacy)
22618 !! config
22619 wgFragmentMode=[ 'legacy' ]
22620 !! wikitext
22621 ===_ +:.3A%3A&&amp;]]===
22622 {{anchorencode: _ +:.3A%3A&&amp;]] }}
22623 __NOEDITSECTION__
22624 !! html/php
22625 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
22626 <p>.2B:.3A.253A.26.26.5D.5D
22627 </p>
22628 !! end
22629
22630 !! test
22631 T8200: blockquotes and paragraph formatting
22632 !! wikitext
22633 <blockquote>
22634 foo
22635 </blockquote>
22636
22637 bar
22638
22639 baz
22640 !! html
22641 <blockquote>
22642 <p>foo
22643 </p>
22644 </blockquote>
22645 <p>bar
22646 </p>
22647 <pre>baz
22648 </pre>
22649 !! end
22650
22651 !! test
22652 T10293: Use of center tag ruins paragraph formatting
22653 !! wikitext
22654 <center>
22655 foo
22656 </center>
22657
22658 bar
22659
22660 baz
22661 !! html
22662 <center>
22663 <p>foo
22664 </p>
22665 </center>
22666 <p>bar
22667 </p>
22668 <pre>baz
22669 </pre>
22670 !! end
22671
22672 !!test
22673 Parsing of overlapping (improperly nested) inline html tags
22674 !! wikitext
22675 <span><s>x</span></s>
22676 !! html/php
22677 <p><span><s>x&lt;/span&gt;</s></span>
22678 </p>
22679 !! html/parsoid
22680 <p><span><s>x</s></span>
22681 </p>
22682 !!end
22683
22684 ###
22685 ### Language variants related tests
22686 ###
22687
22688 # Parsoid does not mark self-links.
22689 # Parsoid does not convert links; PHP will do any necessary redirects.
22690
22691 !! test
22692 Self-link in language variants
22693 !! options
22694 title=[[Dunav]] language=sr
22695 !! wikitext
22696 Both [[Dunav]] and [[Дунав]] are names for this river.
22697 !! html/php
22698 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
22699 </p>
22700 !! html/parsoid
22701 <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>
22702 !! end
22703
22704 !! article
22705 Дуна
22706 !! text
22707 content
22708 !! endarticle
22709
22710 !! test
22711 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
22712 !! options
22713 title=[[Duna]] language=sr
22714 !! wikitext
22715 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
22716 !! html/php
22717 <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.
22718 </p>
22719 !! html/parsoid
22720 <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>
22721 !! end
22722
22723 !! test
22724 Link to a section of a variant of this title shouldn't be parsed as self-link
22725 !! options
22726 title=[[Duna]] language=sr
22727 !! wikitext
22728 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
22729 !! html/php
22730 <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.
22731 </p>
22732 !! html/parsoid
22733 <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>
22734 !! end
22735
22736 !! test
22737 Link to pages in language variants
22738 !! options
22739 language=sr
22740 !! wikitext
22741 Main Page can be written as [[Маин Паге]]
22742 !! html/php
22743 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
22744 </p>
22745 !! html/parsoid
22746 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
22747 !! end
22748
22749
22750 !! test
22751 Multiple links to pages in language variants
22752 !! options
22753 language=sr
22754 !! wikitext
22755 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
22756 !! html/php
22757 <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>.
22758 </p>
22759 !! html/parsoid
22760 <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>
22761 !! end
22762
22763
22764 !! test
22765 Simple template in language variants
22766 !! options
22767 language=sr
22768 !! wikitext
22769 {{тест}}
22770 !! html/php
22771 <p>This is a test template
22772 </p>
22773 !! end
22774
22775
22776 !! test
22777 Template with explicit namespace in language variants
22778 !! options
22779 language=sr
22780 !! wikitext
22781 {{Template:тест}}
22782 !! html/php
22783 <p>This is a test template
22784 </p>
22785 !! end
22786
22787
22788 !! test
22789 Basic test for template parameter in language variants
22790 !! options
22791 language=sr
22792 !! wikitext
22793 {{парамтест|param=foo}}
22794 !! html/php
22795 <p>This is a test template with parameter foo
22796 </p>
22797 !! end
22798
22799 !! test
22800 Simple category in language variants
22801 !! options
22802 language=sr cat
22803 !! wikitext
22804 [[Category:МедиаWики Усер'с Гуиде]]
22805 !! html/php
22806 cat=МедиаWики_Усер'с_Гуиде sort=
22807 !! html/parsoid
22808 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
22809 !! end
22810
22811 !! article
22812 Category:分类
22813 !! text
22814 blah
22815 !! endarticle
22816
22817 !! article
22818 Category:分類
22819 !! text
22820 blah
22821 !! endarticle
22822
22823 ## We used to, but no longer wt2wt this test since the default serializer
22824 ## will normalize all categories to serialize on their own line.
22825 ## This wikitext usage is going to be fairly uncommon in production and
22826 ## selser will take care of preserving formatting in those scenarios.
22827 !! test
22828 Don't convert blue categorylinks to another variant (T35210)
22829 !! options
22830 cat
22831 language=zh
22832 parsoid=wt2html
22833 !! wikitext
22834 [[A]][[Category:分类]]
22835 !! html/php
22836 cat=分类 sort=
22837 !! html/parsoid
22838 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
22839 <link rel="mw:PageProp/Category" href="./Category:分类"/>
22840 !! end
22841
22842 !! test
22843 Stripping -{}- tags (language variants)
22844 !! options
22845 language=sr
22846 !! wikitext
22847 Latin proverb: -{Ne nuntium necare}-
22848 !! html/php
22849 <p>Latin proverb: Ne nuntium necare
22850 </p>
22851 !! html/parsoid
22852 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22853 !! end
22854
22855
22856 !! test
22857 Prevent conversion with -{}- tags (language variants)
22858 !! options
22859 language=sr variant=sr-ec
22860 !! wikitext
22861 Latinski: -{Ne nuntium necare}-
22862 !! html/php
22863 <p>Латински: Ne nuntium necare
22864 </p>
22865 !! html/parsoid
22866 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22867 !! end
22868
22869
22870 !! test
22871 Prevent conversion of text with -{}- tags (language variants)
22872 !! options
22873 language=sr variant=sr-ec
22874 !! wikitext
22875 Latinski: -{Ne nuntium necare}-
22876 !! html/php
22877 <p>Латински: Ne nuntium necare
22878 </p>
22879 !! html/parsoid
22880 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22881 !! end
22882
22883
22884 !! test
22885 Prevent conversion of links with -{}- tags (language variants)
22886 !! options
22887 language=sr variant=sr-ec
22888 !! wikitext
22889 -{[[Main Page]]}-
22890 !! html/php
22891 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22892 </p>
22893 !! html/parsoid
22894 <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>
22895 !! end
22896
22897
22898 !! test
22899 -{}- tags within headlines (within html for parserConvert())
22900 !! config
22901 wgFragmentMode=[ 'html5', 'legacy' ]
22902 !! options
22903 language=sr variant=sr-ec
22904 !! wikitext
22905 ==-{Naslov}-==
22906
22907 Note that even an unprotected headline ID is not affected by language
22908 conversion:
22909
22910 ==Latinski==
22911 !! html/php
22912 <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>
22913 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
22914 цонверсион:
22915 </p>
22916 <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>
22917
22918 !! html/parsoid
22919 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
22920
22921 <p>Note that even an unprotected headline ID is not affected by language
22922 conversion:</p>
22923
22924 <h2 id="Latinski">Latinski</h2>
22925 !! end
22926
22927 !! test
22928 Explicit definition of language variant alternatives
22929 !! options
22930 language=zh variant=zh-tw
22931 !! wikitext
22932 -{zh:China;zh-tw:Taiwan}-, not China
22933 !! html/php
22934 <p>Taiwan, not China
22935 </p>
22936 !! html/parsoid
22937 <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>
22938 !! end
22939
22940 !! test
22941 Filter syntax for language variants
22942 !! options
22943 language=zh variant=zh-tw
22944 !! wikitext
22945 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
22946 !! html/php
22947 <p>fooblog, WEBJOURNAL, WEBLOGquux
22948 </p>
22949 !! html/parsoid
22950 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
22951 !! end
22952
22953 # Note that Parsoid post-processing for language variants needs to
22954 # update the `title` attribute here, based on the mw:ExpandedAttrs property
22955 !! test
22956 Conversion around HTML tags
22957 !! options
22958 language=sr variant=sr-ec
22959 !! wikitext
22960 -{H|span=>sr-ec:script;title=>sr-ec:src}-
22961 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
22962 !! html/php
22963 <p>
22964 <span title="ЛаCтин">ски</span>
22965 </p>
22966 !! html/parsoid
22967 <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"}]}'/>
22968 <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>
22969 !! end
22970
22971 !! test
22972 Explicit session-wise two-way language variant mapping (A flag and - flag)
22973 !! options
22974 language=zh variant=zh-tw
22975 !! wikitext
22976 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
22977
22978 Taiwan is not China.
22979
22980 But -{A|zh:China; zh-tw:Taiwan}- is China,
22981
22982 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
22983
22984 and -{China}- is China.
22985 !! html/php
22986 <p>This is Taiwan, but we'll forget that now.
22987 </p><p>Taiwan is not China.
22988 </p><p>But Taiwan is Taiwan,
22989 </p><p>(This should be stripped!)
22990 </p><p>and China is China.
22991 </p>
22992 !! html/parsoid
22993 <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>
22994 <p>Taiwan is not China.</p>
22995 <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>
22996 <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>
22997 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22998 !! end
22999
23000 !! test
23001 Explicit session-wise one-way language variant mapping (A flag and - flag)
23002 !! options
23003 language=zh variant=zh-tw
23004 !! wikitext
23005 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
23006
23007 COUNTRY is China or Taiwan.
23008
23009 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
23010
23011 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
23012
23013 and -{COUNTRY}- is COUNTRY.
23014 !! html/php
23015 <p>This is Taiwan, but we'll forget that now.
23016 </p><p>COUNTRY is China or Taiwan.
23017 </p><p>But Taiwan is Taiwan,
23018 </p><p>(This should be stripped!)
23019 </p><p>and COUNTRY is COUNTRY.
23020 </p>
23021 !! html/parsoid
23022 <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>
23023 <p>COUNTRY is China or Taiwan.</p>
23024 <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>
23025 <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>
23026 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
23027 !! end
23028
23029 !! test
23030 Explicit session-wise two-way language variant mapping (H flag for hide)
23031 !! options
23032 language=zh variant=zh-tw
23033 !! wikitext
23034 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
23035
23036 Taiwan is China.
23037 !! html/php
23038 <p>(This should be stripped!)
23039 </p><p>Taiwan is Taiwan.
23040 </p>
23041 !! html/parsoid
23042 <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>
23043 <p>Taiwan is China.</p>
23044 !! end
23045
23046 !! test
23047 Explicit session-wise one-way language variant mapping (H flag for hide)
23048 !! options
23049 language=zh variant=zh-tw
23050 !! wikitext
23051 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
23052
23053 COUNTRY is Taiwan or China.
23054 !! html/php
23055 <p>(This should be stripped!)
23056 </p><p>Taiwan is Taiwan or China.
23057 </p>
23058 !! html/parsoid
23059 <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>
23060 <p>COUNTRY is Taiwan or China.</p>
23061 !! end
23062
23063 ## Note that parsoid test runner does not support 'showtitle' option.
23064 !! test
23065 Adding explicit conversion rule for title (T flag)
23066 !! options
23067 language=zh variant=zh-tw showtitle
23068 !! wikitext
23069 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
23070
23071 Taiwan is China.
23072 !! html/php
23073 Taiwan
23074 <p>Should be stripped!
23075 </p><p>Taiwan is China.
23076 </p>
23077 !! html/parsoid
23078 <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>
23079 <p>Taiwan is China.</p>
23080 !! end
23081
23082 !! test
23083 Code coverage: T combined with H flag
23084 !! options
23085 language=zh variant=zh-tw showtitle
23086 !! wikitext
23087 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
23088
23089 Taiwan is China.
23090 !! html/php
23091 Taiwan
23092 <p>Should be stripped!
23093 </p><p>Taiwan is Taiwan.
23094 </p>
23095 !! html/parsoid
23096 <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>
23097 <p>Taiwan is China.</p>
23098 !! end
23099
23100 !! test
23101 Code coverage: T with no variants
23102 !! options
23103 language=zh variant=zh-tw showtitle
23104 !! wikitext
23105 -{H|zh:China; zh-tw:Taiwan}-
23106 Taiwan is China.-{T|Taiwan is China}-
23107 !! html/php
23108 Taiwan is China
23109 <p>
23110 Taiwan is Taiwan.
23111 </p>
23112 !! html/parsoid
23113 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
23114 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
23115 !! end
23116
23117 !! test
23118 Code coverage: rules with no variants
23119 !! options
23120 language=zh variant=zh-tw
23121 !! wikitext
23122 -{H|zh:China; zh-tw:Taiwan}-
23123 Taiwan is China.
23124 -{H|China}-
23125 Taiwan is China.
23126 !! html/php
23127 <p>
23128 Taiwan is Taiwan.
23129
23130 Taiwan is China.
23131 </p>
23132 !! html/parsoid
23133 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
23134 Taiwan is China.
23135 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
23136 Taiwan is China.</p>
23137 !! end
23138
23139
23140 !! test
23141 Code coverage: D flag for conversion rule
23142 !! options
23143 language=zh variant=zh-tw
23144 !! wikitext
23145 -{D|zh-cn:XA; zh-tw:YA}-
23146 -{A;D|zh-cn:XB; zh-tw:YB}-
23147 -{D;H|zh-cn:XC; zh-tw:YC}-
23148
23149 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
23150
23151 -{D|0=>zh-tw:1}-
23152 -{A;D|2=>zh-tw:3}-
23153 -{D;H|4=>zh-tw:5}-
23154
23155 XA XB XC YA YB YC FOO BAR BAT 012345
23156 !! html/php
23157 <p>大陆:XA;台灣:YA;
23158
23159 大陆:XC;台灣:YC;
23160 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
23161 </p><p>0⇒台灣:1;
23162
23163 4⇒台灣:5;
23164 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
23165 </p>
23166 !! html/parsoid
23167 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
23168 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
23169 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
23170 <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>
23171 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
23172 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
23173 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
23174 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
23175 !! end
23176
23177 !! test
23178 Code coverage: N flag for conversion rule
23179 !! options
23180 language=zh variant=zh-cn
23181 !! wikitext
23182 -{N|zh-cn}-
23183
23184 -{N|zh-tw}-
23185
23186 -{N|sr-ec}-
23187 !! html/php
23188 <p>大陆
23189 </p><p>台灣
23190 </p><p>српски (ћирилица)‎
23191 </p>
23192 !! html/parsoid
23193 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
23194 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
23195 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
23196 !! end
23197
23198 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
23199 !! test
23200 Code coverage: N flag for conversion rule (wt2html only)
23201 !! options
23202 language=zh variant=zh-cn
23203 parsoid=wt2html,html2html
23204 !! wikitext
23205 -{D;N|en}-
23206 !! html/php
23207 <p>English
23208 </p>
23209 !! html/parsoid
23210 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
23211 !! end
23212
23213 !! test
23214 Testing that changing the language variant here in the tests actually works
23215 !! options
23216 language=zh variant=zh showtitle
23217 !! wikitext
23218 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
23219 !! html/php
23220 China
23221 <p>Should be stripped!
23222 </p>
23223 !! html/parsoid
23224 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
23225 !! end
23226
23227 !! test
23228 Recursive conversion of alt and title attrs shouldn't clear converter state
23229 !! options
23230 language=zh variant=zh-cn
23231 showtitle
23232 !! wikitext
23233 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
23234 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
23235 !! html/php
23236 China
23237 <p>
23238 Should be stripped<span title="Exclamation">!</span>
23239 </p>
23240 !! html/parsoid
23241 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
23242 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>
23243 !! end
23244
23245 !! test
23246 T26072: more test on conversion rule for title
23247 !! options
23248 language=zh variant=zh-tw showtitle
23249 !! wikitext
23250 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
23251
23252 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
23253 !! html/php
23254 Taiwan
23255 <p>This should be stripped!
23256 </p><p>This won't take interferes with the title rule.
23257 </p>
23258 !! html/parsoid
23259 <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>
23260 <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>
23261 !! end
23262
23263 !! test
23264 Partly disable title conversion if variant == main language code
23265 !! options
23266 language=zh variant=zh title=[[ZH]] showtitle
23267 !! wikitext
23268 -{T|zh-cn:CN;zh-tw:TW}-
23269 !! html/php
23270 ZH
23271 <p>
23272 </p>
23273 !! html/parsoid
23274 <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>
23275 !! end
23276
23277 !! test
23278 Partly disable title conversion if variant == main language code, more
23279 !! options
23280 language=zh variant=zh title=[[ZH]] showtitle
23281 !! wikitext
23282 -{T|TW}-
23283 !! html/php
23284 ZH
23285 <p>
23286 </p>
23287 !! html/parsoid
23288 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
23289 !! end
23290
23291 !! test
23292 Raw output of variant escape tags (R flag)
23293 !! options
23294 language=zh variant=zh-tw
23295 !! wikitext
23296 Raw: -{R|zh:China;zh-tw:Taiwan}-
23297 !! html/php
23298 <p>Raw: zh:China;zh-tw:Taiwan
23299 </p>
23300 !! html/parsoid
23301 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
23302 !! end
23303
23304 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
23305 !! test
23306 Raw output of variant escape tags (R flag) (wt2html only)
23307 !! options
23308 language=zh variant=zh-tw
23309 parsoid=wt2html,html2html
23310 !! wikitext
23311 -{Variant}- -{D|syntax}- -{D;R|options}-
23312 !! html/php
23313 <p>Variant syntax options
23314 </p>
23315 !! html/parsoid
23316 <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>
23317 !! end
23318
23319 !! test
23320 Nested markup inside raw output of variant escape tags (R flag)
23321 !! options
23322 language=zh variant=zh-tw
23323 !! wikitext
23324 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
23325 !! html/php
23326 <p>Nested raw: nested Taiwan nested
23327 </p>
23328 !! html/parsoid
23329 <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>
23330 !! end
23331
23332 !! test
23333 Nested markup and spaces inside raw output of variant escape tags (R flag)
23334 !! options
23335 language=zh variant=zh-tw
23336 !! wikitext
23337 X-{ outer -{ inner }- outer }-X
23338 !! html/php
23339 <p>X outer inner outer X
23340 </p>
23341 !! html/parsoid
23342 <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>
23343 !! end
23344
23345 !! test
23346 Templates inside raw output of variant escape tags (R flag)
23347 !! options
23348 language=zh variant=zh-tw
23349 !! wikitext
23350 Nested raw: -{R|nested {{echo|hi}} templates}-
23351 !! html/php
23352 <p>Nested raw: nested hi templates
23353 </p>
23354 !! html/parsoid
23355 <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>
23356 !! end
23357
23358 !! test
23359 Strings evaluating false shouldn't be ignored by Language converter (T51072)
23360 !! options
23361 language=zh variant=zh-cn
23362 !! wikitext
23363 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
23364 !! html/php
23365 <p>0
23366 </p>
23367 !! html/parsoid
23368 <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>
23369 !! end
23370
23371 !! test
23372 Conversion rules from [numeric-only string] to [something else] (T48634)
23373 !! options
23374 language=zh variant=zh-cn
23375 !! wikitext
23376 -{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
23377 !! html/php
23378 <p>D12345EE12345
23379 </p>
23380 !! html/parsoid
23381 <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>
23382 !! end
23383
23384 !! test
23385 Two-way converter rule entries with an empty value should be ignored (T53551)
23386 !! options
23387 language=zh variant=zh-cn
23388 !! wikitext
23389 -{H|zh-cn:foo;zh-tw:;}-foobar
23390 !! html/php
23391 <p>foobar
23392 </p>
23393 !! html/parsoid
23394 <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>
23395 !! end
23396
23397 !! test
23398 One-way converter rule entries with an empty "from" string should be ignored (T53551)
23399 !! options
23400 language=zh variant=zh-cn
23401 !! wikitext
23402 -{H|=>zh-cn:foo;}-foobar
23403 !! html/php
23404 <p>foobar
23405 </p>
23406 !! html/parsoid
23407 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
23408 !! end
23409
23410 !! test
23411 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
23412 !! options
23413 language=zh variant=zh-cn
23414 !! wikitext
23415 -{H|}-foobar
23416 !! html/php
23417 <p>foobar
23418 </p>
23419 !! html/parsoid
23420 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
23421 !! end
23422
23423 !! test
23424 Nested using of manual convert syntax
23425 !! options
23426 language=zh variant=zh-hk
23427 !! wikitext
23428 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
23429 !! html/php
23430 <p>Nested: Hello Hong Kong!
23431 </p>
23432 !! html/parsoid
23433 <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>
23434 !! end
23435
23436 !! test
23437 HTML markups with conversion syntax in attribs, nested in other conversion blocks
23438 !! options
23439 language=zh variant=zh-cn
23440 !! wikitext
23441 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
23442 !! html/php
23443 <p><span title="X">A</span>
23444 </p>
23445 !! html/parsoid
23446 <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>
23447 !! end
23448
23449 !! test
23450 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
23451 !! options
23452 language=zh variant=zh-cn
23453 !! wikitext
23454 -{<span title="-{X}-">A</span>}-
23455 !! html/php+disabled
23456 <p><span title="X">A</span>
23457 </p>
23458 !! html/parsoid
23459 <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>
23460 !! end
23461
23462 # Parsoid and PHP disagree on how to parse this example: Parsoid
23463 # insists that the content of a language converter element be a valid
23464 # DOM fragment or attribute string
23465 !! test
23466 Language converter markup with block content
23467 !! options
23468 language=zh variant=zh-cn
23469 !! wikitext
23470 <span>a-{b<div>c}-d
23471
23472 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
23473
23474 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
23475 !! html/php+tidy
23476 <span>ab<div>cd
23477 <span>ab<div>cd
23478 <span>ad
23479 </span></div></span></div></span>
23480 !! html/parsoid
23481 <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
23482
23483 <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
23484
23485 <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>
23486 !! end
23487
23488 !! test
23489 LanguageConverter selser (1)
23490 !! options
23491 language=zh variant=zh-cn
23492 parsoid={
23493 "modes": ["wt2wt", "selser"],
23494 "changes": [
23495 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23496 ]
23497 }
23498 !! wikitext
23499 -{raw}-
23500 !! wikitext/edited
23501 -{edited}-
23502 !! end
23503
23504 !! test
23505 LanguageConverter selser (2)
23506 !! options
23507 language=zh variant=zh-cn
23508 parsoid={
23509 "modes": ["wt2wt", "selser"],
23510 "changes": [
23511 ["span[class='x']", "contents", "text", "-{foo}-"],
23512 ["a", "contents", "text", "-{"],
23513 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
23514 ]
23515 }
23516 !! wikitext
23517 <span class="x">TEXT1</span>
23518 [http://example.com TEXT2]
23519 [[Foo|TEXT3]]
23520 {{echo|TEXT4}}
23521 !! wikitext/edited
23522 <span class="x"><nowiki>-{foo}-</nowiki></span>
23523 [http://example.com -{]
23524 [[Foo|<nowiki>-{</nowiki>]]
23525 {{1x|<nowiki>-{</nowiki>}}
23526 !! end
23527
23528 # Tests LanguageVariantText in ConstrainedText
23529 !! test
23530 LanguageConverter selser (3)
23531 !! options
23532 language=zh variant=zh-cn
23533 parsoid={
23534 "modes": ["wt2wt", "selser"],
23535 "changes": [
23536 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
23537 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23538 ]
23539 }
23540 !! wikitext
23541 {|
23542 |-
23543 |<span>Foo</span>
23544 |}
23545 !! wikitext/edited
23546 {|
23547 |-
23548 |<nowiki/>-{edited}-
23549 |}
23550 !! end
23551
23552 # Tests LanguageVariantText._fromSelSer
23553 !! test
23554 LanguageConverter selser (4)
23555 !! options
23556 language=zh variant=zh-cn
23557 parsoid={
23558 "modes": ["wt2wt", "selser"],
23559 "changes": [
23560 ["td > span.x", "remove"]
23561 ]
23562 }
23563 !! wikitext
23564 {|
23565 |-
23566 |<span class="x">Foo</span>-{Bar}-
23567 ||<span class="x">Foo</span>-{Bar}-
23568 |}
23569 !! wikitext/edited
23570 {|
23571 |-
23572 |<nowiki/>-{Bar}-
23573 ||-{Bar}-
23574 |}
23575 !! end
23576
23577 # Since Parsoid is starting to emit canonical wikitext for links,
23578 # [http://example.com http://example.com] will not RT back to that
23579 # form anymore.
23580 # Parsoid does not language-convert links (it is done in a
23581 # post-processing step)
23582 !! test
23583 Proper conversion of text in external links
23584 !! options
23585 language=sr variant=sr-ec
23586 parsoid=wt2html
23587 !! wikitext
23588 http://www.google.com
23589 gopher://www.google.com
23590 [http://www.google.com http://www.google.com]
23591 [gopher://www.google.com gopher://www.google.com]
23592 [https://www.google.com irc://www.google.com]
23593 [ftp://www.google.com www.google.com/ftp://dir]
23594 [//www.google.com www.google.com]
23595 !! html/php
23596 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
23597 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23598 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
23599 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23600 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
23601 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
23602 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
23603 </p>
23604 !! html/parsoid
23605 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
23606 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23607 <a rel="mw:ExtLink" class="external text" href="http://www.google.com">http://www.google.com</a>
23608 <a rel="mw:ExtLink" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23609 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
23610 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
23611 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
23612 !! end
23613
23614 !! test
23615 Do not convert roman numbers to language variants
23616 !! options
23617 language=sr variant=sr-ec
23618 !! wikitext
23619 Fridrih IV je car.
23620 !! html/php
23621 <p>Фридрих IV је цар.
23622 </p>
23623 !! html/parsoid
23624 <p>Fridrih IV je car.</p>
23625 !! end
23626
23627 !! test
23628 Unclosed language converter markup "-{"
23629 !! options
23630 language=sr
23631 !! wikitext
23632 -{T|hello
23633 !! html
23634 <p>-{T|hello
23635 </p>
23636 !! end
23637
23638 !! test
23639 Don't convert raw rule "-{R|=&gt;}-" to "=>"
23640 !! options
23641 language=sr
23642 !! wikitext
23643 -{R|=&gt;}-
23644 !! html/php
23645 <p>=&gt;
23646 </p>
23647 !! html/parsoid
23648 <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>
23649 !!end
23650
23651 !! test
23652 Don't break link parsing if language converter markup is in the caption.
23653 !! options
23654 language=sr variant=sr-ec
23655 !! wikitext
23656 [[Main Page|-{R|main page}-]]
23657 !! html/php
23658 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
23659 </p>
23660 !! html/parsoid
23661 <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>
23662 !! end
23663
23664 !! test
23665 T146304: Don't break template parsing if language converter markup is in the parameter.
23666 !! options
23667 language=sr variant=sr-ec
23668 !! wikitext
23669 {{echo|-{R|foo}-}}
23670 !! html/php
23671 <p>foo
23672 </p>
23673 !! html/parsoid
23674 <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>
23675 !! end
23676
23677 !! test
23678 T146305: Don't break image parsing if language converter markup is in the caption.
23679 !! options
23680 language=sr
23681 !! wikitext
23682 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
23683 !! html/php
23684 <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>
23685
23686 !! html/parsoid
23687 <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>
23688 !! end
23689
23690 !! test
23691 T146305: Don't break image parsing if nested language converter markup is in the caption.
23692 !! options
23693 language=zh variant=zh-cn
23694 !! wikitext
23695 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
23696 !! html/php
23697 <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>
23698
23699 !! html/parsoid
23700 <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>
23701 !! end
23702
23703 # XXX html2wt disabled because rich markup in alt is not preserved.
23704 !! test
23705 Don't break gallery if language converter markup is inside.
23706 !! options
23707 language=zh
23708 !! wikitext
23709 <gallery>
23710 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
23711 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
23712 </gallery>
23713 !! html/php
23714 <ul class="gallery mw-gallery-traditional">
23715 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23716 <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>
23717 <div class="gallerytext">
23718 <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>
23719 </p>
23720 </div>
23721 </div></li>
23722 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23723 <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>
23724 <div class="gallerytext">
23725 <p>This is a test template
23726 </p>
23727 </div>
23728 </div></li>
23729 </ul>
23730
23731 !! html/parsoid
23732 <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"}}'>
23733 <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>
23734 <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>
23735 </ul>
23736 !! end
23737
23738 !! test
23739 T153135: Don't break list handling if language converter markup is in the item.
23740 !! options
23741 language=zh variant=zh-cn
23742 !! wikitext
23743 ;-{zh-cn:AAA;zh-tw:BBB}-
23744 ;-{R|foo:bar}-
23745 !! html/php
23746 <dl><dt>AAA</dt>
23747 <dt>foo:bar</dt></dl>
23748
23749 !! html/parsoid
23750 <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>
23751 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
23752 </dl>
23753 !! end
23754
23755 // Note that parsoid does not protect colons unless language converter
23756 // markup is properly nested, because it is a backtracking parser.
23757 !! test
23758 T153135: Unclosed markup in definition list (code coverage)
23759 !! options
23760 language=zh variant=zh-cn
23761 !! wikitext
23762 ;<b>foo:bar
23763 ;-{zh-cn:AAA
23764 !! html/php+tidy
23765 <dl><dt><b>foo:bar</b></dt><b>
23766 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
23767 </b></p>
23768 !! html/parsoid
23769 <dl><dt data-parsoid='{}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
23770 <dt data-parsoid='{}'>-{zh-cn</dt><dd data-parsoid='{"stx":"row"}'>AAA</dd></b></dl>
23771 !! end
23772
23773 !! test
23774 T153135: Nested language converter markup in definition list (code coverage)
23775 !! options
23776 language=zh variant=zh-cn
23777 !! wikitext
23778 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
23779 !! html/php
23780 <dl><dt>AAA foo:bar bat:baz</dt>
23781 <dd>def</dd></dl>
23782
23783 !! html/parsoid
23784 <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>
23785 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
23786 </dl>
23787 !! end
23788
23789 # html2wt mode disabled due to <nowiki> insertion.
23790 !! test
23791 T153140: Don't break table handling if language converter markup is in the cell.
23792 !! options
23793 language=sr variant=sr-ec
23794 parsoid=wt2html,wt2wt,html2html
23795 !! wikitext
23796 {|
23797 |-
23798 | -{R|B}-
23799 |}
23800 !! html/php
23801 <table>
23802
23803 <tr>
23804 <td>B
23805 </td></tr></table>
23806
23807 !! html/parsoid
23808 <table>
23809 <tbody>
23810 <tr>
23811 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
23812 </tr>
23813 </tbody>
23814 </table>
23815 !! end
23816
23817 !! test
23818 Language converter tricky html2wt cases (1)
23819 !! options
23820 language=sr
23821 parsoid=html2wt,wt2wt
23822 !! html/parsoid
23823 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
23824 !! wikitext
23825 -{<nowiki>}-</nowiki>}-
23826 !! html/php
23827 <p>&#125;-
23828 </p>
23829 !! end
23830
23831 !! test
23832 Language converter tricky html2wt cases (2)
23833 !! options
23834 language=sr
23835 parsoid=html2wt,wt2wt
23836 !! html/parsoid
23837 <p>-{foo}-</p>
23838 !! wikitext
23839 <nowiki>-{foo}-</nowiki>
23840 !! html/php
23841 <p>-&#123;foo&#125;-
23842 </p>
23843 !! end
23844
23845 !! test
23846 Language converter tricky html2wt cases (3)
23847 !! options
23848 language=sr
23849 parsoid=html2wt,wt2wt
23850 !! html/parsoid
23851 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
23852 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
23853 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
23854 !! wikitext
23855 -{R||}-
23856
23857 -{R|R|raw}-
23858
23859 -{<nowiki>-{foo}-</nowiki>}-
23860 !! html/php
23861 <p>|
23862 </p><p>R|raw
23863 </p><p>-&#123;foo&#125;-
23864 </p>
23865 !! end
23866
23867 !! test
23868 Language converter tricky html2wt cases (4)
23869 !! options
23870 language=sr
23871 parsoid=html2wt,wt2wt
23872 !! html/parsoid
23873 <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>
23874 !! wikitext
23875 -{R|{{echo|hey}}}-
23876 !! html/php
23877 <p>hey
23878 </p>
23879 !! end
23880
23881 # Note that the <nowiki> escaping added by parsoid for source text,
23882 # destination text, and language names only works on the PHP side
23883 # for *destination text*. (HTML entity escaping wouldn't work
23884 # any better.) This is probably a bug, at least for source texts.
23885 # (For language names PHP uses a precise regexp based on the languages
23886 # it currently knows have variants, which is fragile since this set
23887 # can grow/shrink over time.)
23888 !! test
23889 Language converter tricky html2wt cases (5)
23890 !! options
23891 language=zh variant=zh-cn
23892 !! html/parsoid
23893 <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>
23894 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
23895 <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>
23896 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
23897 <p>a:b=>c xyz</p>
23898 !! wikitext
23899 -{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
23900
23901 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
23902
23903 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
23904
23905 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
23906
23907 a:b=>c xyz
23908 !! html/php+disabled
23909 <p>foobat;xyz=&gt;zh-cn:abc
23910 </p><p>A
23911 </p><p>0;zh-tw:bar
23912 </p><p>abc
23913 </p><p>a:b=&gt;c 0;zh-tw:bar
23914 </p>
23915 !! end
23916
23917 !! test
23918 T179579: Nowiki and lc interaction
23919 !! options
23920 parsoid=wt2html
23921 language=sr
23922 !! wikitext
23923 -{</nowiki>123}-
23924
23925 -{123<nowiki>|</nowiki>456}-
23926 !! html/parsoid
23927 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
23928
23929 <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>
23930 !! end
23931
23932 !! test
23933 T2529: Uncovered bullet
23934 !! wikitext
23935 *Foo {{bullet}}
23936 !! html
23937 <ul><li>Foo</li>
23938 <li>Bar</li></ul>
23939
23940 !! end
23941
23942 !! test
23943 T2529: Uncovered bullet in a deeply nested list
23944 !! wikitext
23945 *******Foo {{bullet}}
23946 !! html
23947 <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>
23948 <li>Bar</li></ul>
23949
23950 !! end
23951
23952 !! test
23953 T2529: Uncovered table already at line-start
23954 !! wikitext
23955 x
23956
23957 {{table}}
23958 y
23959 !! html
23960 <p>x
23961 </p>
23962 <table>
23963 <tr>
23964 <td>1</td>
23965 <td>2
23966 </td></tr>
23967 <tr>
23968 <td>3</td>
23969 <td>4
23970 </td></tr></table>
23971 <p>y
23972 </p>
23973 !! end
23974
23975 !! test
23976 T2529: Uncovered bullet in parser function result
23977 !! wikitext
23978 *Foo {{lc:{{bullet}} }}
23979 !! html
23980 <ul><li>Foo</li>
23981 <li>bar</li></ul>
23982
23983 !! end
23984
23985 !! test
23986 T7678: Double-parsed template argument
23987 !! wikitext
23988 {{lc:{{{1}}}|hello}}
23989 !! html
23990 <p>{{{1}}}
23991 </p>
23992 !! end
23993
23994 !! test
23995 T7678: Double-parsed template invocation
23996 !! wikitext
23997 {{lc:{{paramtest {{!}} param = hello }} }}
23998 !! html
23999 <p>{{paramtest | param = hello }}
24000 </p>
24001 !! end
24002
24003 !! test
24004 Case insensitivity of parser functions for non-ASCII characters (T10143)
24005 !! options
24006 language=cs
24007 title=[[Main Page]]
24008 !! wikitext
24009 {{PRVNÍVELKÉ:ěščř}}
24010 {{prvnívelké:ěščř}}
24011 {{PRVNÍMALÉ:ěščř}}
24012 {{prvnímalé:ěščř}}
24013 {{MALÁ:ěščř}}
24014 {{malá:ěščř}}
24015 {{VELKÁ:ěščř}}
24016 {{velká:ěščř}}
24017 !! html
24018 <p>Ěščř
24019 Ěščř
24020 ěščř
24021 ěščř
24022 ěščř
24023 ěščř
24024 ĚŠČŘ
24025 ĚŠČŘ
24026 </p>
24027 !! end
24028
24029 !! test
24030 Morwen/13: Unclosed link followed by heading
24031 !! wikitext
24032 [[link
24033 ==heading==
24034 !! html
24035 <p>[[link
24036 </p>
24037 <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>
24038
24039 !! end
24040
24041 !! test
24042 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
24043 !! wikitext
24044 {{foo|
24045 =heading=
24046 !! html
24047 <p>{{foo|
24048 </p>
24049 <h1><span class="mw-headline" id="heading">heading</span></h1>
24050
24051 !! end
24052
24053 !! test
24054 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
24055 !! wikitext
24056 {{foo|
24057 ==heading==
24058 !! html
24059 <p>{{foo|
24060 </p>
24061 <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>
24062
24063 !! end
24064
24065 !! test
24066 Tildes in comments
24067 !! options
24068 pst
24069 !! wikitext
24070 <!-- ~~~~ -->
24071 !! html/php
24072 <!-- ~~~~ -->
24073 !! end
24074
24075 !! test
24076 Paragraphs inside divs (no extra line breaks)
24077 !! wikitext
24078 <div>Line one
24079
24080 Line two</div>
24081 !! html
24082 <div>Line one
24083 Line two</div>
24084
24085 !! end
24086
24087 !! test
24088 Paragraphs inside divs (extra line break on open)
24089 !! wikitext
24090 <div>
24091 Line one
24092
24093 Line two</div>
24094 !! html
24095 <div>
24096 <p>Line one
24097 </p>
24098 Line two</div>
24099
24100 !! end
24101
24102 !! test
24103 Paragraphs inside divs (extra line break on close)
24104 !! wikitext
24105 <div>Line one
24106
24107 Line two
24108 </div>
24109 !! html
24110 <div>Line one
24111 <p>Line two
24112 </p>
24113 </div>
24114
24115 !! end
24116
24117 !! test
24118 Paragraphs inside divs (extra line break on open and close)
24119 !! wikitext
24120 <div>
24121 Line one
24122
24123 Line two
24124 </div>
24125 !! html
24126 <div>
24127 <p>Line one
24128 </p><p>Line two
24129 </p>
24130 </div>
24131
24132 !! end
24133
24134 # doBlockLevels screws up this output and Remex cleans up as much as it can.
24135 !! test
24136 Nesting tags, paragraphs on lines which begin with <div>
24137 !! wikitext
24138 <div></div><strong>A
24139 B</strong>
24140 !! html/php+tidy
24141 <div></div><p><strong>A
24142 </strong></p><strong></strong><p><strong>B</strong>
24143 </p>
24144 !! html/parsoid
24145 <div data-parsoid='{"stx":"html"}'></div><p><strong data-parsoid='{"stx":"html","autoInsertedEnd":true}'>A</strong></p>
24146 <p><strong data-parsoid='{"stx":"html","autoInsertedStart":true}'>B</strong></p>
24147 !! end
24148
24149 # T8200: <blockquote> should behave like <div> with respect to line breaks
24150 !! test
24151 T8200: paragraphs inside blockquotes (no extra line breaks)
24152 !! wikitext
24153 <blockquote>Line one
24154
24155 Line two</blockquote>
24156 !! html
24157 <blockquote>Line one
24158 Line two</blockquote>
24159
24160 !! html+tidy
24161 <blockquote><p>Line one
24162 Line two</p></blockquote>
24163 !! end
24164
24165 !! test
24166 T8200: paragraphs inside blockquotes (extra line break on open)
24167 !! wikitext
24168 <blockquote>
24169 Line one
24170
24171 Line two</blockquote>
24172 !! html
24173 <blockquote>
24174 <p>Line one
24175 </p>
24176 Line two</blockquote>
24177
24178 !! html+tidy
24179 <blockquote>
24180 <p>Line one
24181 </p><p>
24182 Line two</p></blockquote>
24183 !! end
24184
24185 !! test
24186 T8200: paragraphs inside blockquotes (extra line break on close)
24187 !! wikitext
24188 <blockquote>Line one
24189
24190 Line two
24191 </blockquote>
24192 !! html
24193 <blockquote>Line one
24194 <p>Line two
24195 </p>
24196 </blockquote>
24197
24198 !! html+tidy
24199 <blockquote><p>Line one
24200 </p><p>Line two
24201 </p>
24202 </blockquote>
24203 !! end
24204
24205 !! test
24206 T8200: paragraphs inside blockquotes (extra line break on open and close)
24207 !! wikitext
24208 <blockquote>
24209 Line one
24210
24211 Line two
24212 </blockquote>
24213 !! html
24214 <blockquote>
24215 <p>Line one
24216 </p><p>Line two
24217 </p>
24218 </blockquote>
24219
24220 !! end
24221
24222 ## This is a corner case interaction between the paragraph wrapping in the
24223 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
24224 ## some tags which close paragraphs (and thus prevent wrapping on their line),
24225 ## of which "div" is one, but do p-wrapping inside them. These are referred
24226 ## to as "never suppressing". Remex, for its part, doesn't traverse into
24227 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
24228 !! test
24229 Paragraphs inside blockquotes/divs (no extra line breaks)
24230 !! wikitext
24231 <blockquote><div>Line one
24232
24233 Line two</div></blockquote>
24234 !! html
24235 <blockquote><div>Line one
24236 Line two</div></blockquote>
24237
24238 !! end
24239
24240 !! test
24241 Paragraphs inside blockquotes/divs (extra line break on open)
24242 !! wikitext
24243 <blockquote><div>
24244 Line one
24245
24246 Line two</div></blockquote>
24247 !! html
24248 <blockquote><div>
24249 <p>Line one
24250 </p>
24251 Line two</div></blockquote>
24252
24253 !! end
24254
24255 !! test
24256 Paragraphs inside blockquotes/divs (extra line break on close)
24257 !! wikitext
24258 <blockquote><div>Line one
24259
24260 Line two
24261 </div></blockquote>
24262 !! html
24263 <blockquote><div>Line one
24264 <p>Line two
24265 </p>
24266 </div></blockquote>
24267
24268 !! end
24269
24270 !! test
24271 Paragraphs inside blockquotes/divs (extra line break on open and close)
24272 !! wikitext
24273 <blockquote><div>
24274 Line one
24275
24276 Line two
24277 </div></blockquote>
24278 !! html
24279 <blockquote><div>
24280 <p>Line one
24281 </p><p>Line two
24282 </p>
24283 </div></blockquote>
24284
24285 !! end
24286
24287 !! test
24288 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
24289 !! options
24290 wgLinkHolderBatchSize=0
24291 !! wikitext
24292 [[meatball:1]]
24293 [[meatball:2]]
24294 [[meatball:3]]
24295 !! html
24296 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
24297 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
24298 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
24299 </p>
24300 !! end
24301
24302 !! test
24303 Free external link invading image caption
24304 !! wikitext
24305 [[Image:Foobar.jpg|thumb|http://x|hello]]
24306 !! html/php
24307 <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>
24308
24309 !! html/parsoid
24310 <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>
24311 !! end
24312
24313 !! test
24314 T17196: localised external link numbers
24315 !! options
24316 language=fa
24317 !! wikitext
24318 [http://en.wikipedia.org/]
24319 !! html/php
24320 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
24321 </p>
24322 !! html/parsoid
24323 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
24324 !! end
24325
24326 !! test
24327 Multibyte character in padleft
24328 !! wikitext
24329 {{padleft:-Hello|7|Æ}}
24330 !! html/php
24331 <p>Æ-Hello
24332 </p>
24333 !! html/parsoid
24334 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
24335 !! end
24336
24337 !! test
24338 Multibyte character in padright
24339 !! wikitext
24340 {{padright:Hello-|7|Æ}}
24341 !! html/php
24342 <p>Hello-Æ
24343 </p>
24344 !! html/parsoid
24345 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
24346 !! end
24347
24348 !!test
24349 formatdate parser function
24350 !! wikitext
24351 {{#formatdate:2009-03-24}}
24352 !! html
24353 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
24354 </p>
24355 !! end
24356
24357 !!test
24358 formatdate parser function, with default format
24359 !! wikitext
24360 {{#formatdate:2009-03-24|mdy}}
24361 !! html
24362 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
24363 </p>
24364 !! end
24365
24366 !! test
24367 Spacing of numbers in formatted dates
24368 !! wikitext
24369 {{#formatdate:January 15}}
24370 !! html
24371 <p><span class="mw-formatted-date" title="01-15">January 15</span>
24372 </p>
24373 !! end
24374
24375 !! test
24376 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
24377 !! options
24378 language=nl title=[[MediaWiki:Common.css]]
24379 !! wikitext
24380 {{#formatdate:2009-03-24|dmy}}
24381 !! html
24382 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
24383 </p>
24384 !! end
24385
24386 #
24387 #
24388 #
24389
24390 #
24391 # Edit comments
24392 #
24393
24394 !! test
24395 Edit comment with link
24396 !! options
24397 comment
24398 !! wikitext
24399 I like the [[Main Page]] a lot
24400 !! html/php
24401 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
24402 !!end
24403
24404 !! test
24405 Edit comment with link and link text
24406 !! options
24407 comment
24408 !! wikitext
24409 I like the [[Main Page|best pages]] a lot
24410 !! html/php
24411 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
24412 !!end
24413
24414 !! test
24415 Edit comment with link and link text with suffix
24416 !! options
24417 comment
24418 !! wikitext
24419 I like the [[Main Page|best page]]s a lot
24420 !! html/php
24421 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
24422 !!end
24423
24424 !! test
24425 Edit comment with section link (non-local, eg in history list)
24426 !! options
24427 comment title=[[Main Page]]
24428 !! wikitext
24429 /* External links */ removed bogus entries
24430 !! html/php
24431 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
24432 !!end
24433
24434 !! test
24435 Edit comment with section link and text before it (non-local, eg in history list)
24436 !! options
24437 comment title=[[Main Page]]
24438 !! wikitext
24439 pre-comment text /* External links */ removed bogus entries
24440 !! html/php
24441 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>
24442 !!end
24443
24444 !! test
24445 Edit comment with section link (local, eg in diff view)
24446 !! options
24447 comment local title=[[Main Page]]
24448 !! wikitext
24449 /* External links */ removed bogus entries
24450 !! html/php
24451 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
24452 !!end
24453
24454 !! test
24455 Edit comment with subpage link (T16080)
24456 !! options
24457 comment
24458 subpage
24459 title=[[Subpage test]]
24460 !! wikitext
24461 Poked at a [[/subpage]] here...
24462 !! html/php
24463 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
24464 !!end
24465
24466 !! test
24467 Edit comment with subpage link and link text (T16080)
24468 !! options
24469 comment
24470 subpage
24471 title=[[Subpage test]]
24472 !! wikitext
24473 Poked at a [[/subpage|neat little page]] here...
24474 !! html/php
24475 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
24476 !!end
24477
24478 !! test
24479 Edit comment with bogus subpage link in non-subpage NS (T16080)
24480 !! options
24481 comment
24482 title=[[Subpage test]]
24483 !! wikitext
24484 Poked at a [[/subpage]] here...
24485 !! html/php
24486 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...
24487 !!end
24488
24489 !! test
24490 Edit comment with bare anchor link (local, as on diff)
24491 !! options
24492 comment
24493 local
24494 title=[[Main Page]]
24495 !! wikitext
24496 [[#section]]
24497 !! html/php
24498 <a href="#section">#section</a>
24499 !! end
24500
24501 !! test
24502 Edit comment with bare anchor link (non-local, as on history)
24503 !! options
24504 comment
24505 title=[[Main Page]]
24506 !! wikitext
24507 [[#section]]
24508 !! html/php
24509 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
24510 !! end
24511
24512 !! test
24513 Anchor starting with underscore
24514 !! options
24515 title=[[Foo]]
24516 !! wikitext
24517 [[#_ref|One]]
24518 !! html/php
24519 <p><a href="#_ref">One</a>
24520 </p>
24521 !! html/parsoid
24522 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
24523 !! end
24524
24525 !! test
24526 Id starting with underscore
24527 !! wikitext
24528 <div id="_ref"></div>
24529 !! html/*
24530 <div id="_ref"></div>
24531
24532 !! end
24533
24534 !! test
24535 Edit comment with link with more than one pipe (T99346)
24536 !! options
24537 comment
24538 !! wikitext
24539 [[Main Page|Many|pipes]]
24540 !! html/php
24541 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
24542 !! end
24543
24544 !! test
24545 Complex edit comment with link with more than one pipe (T99346)
24546 !! options
24547 comment
24548 !! wikitext
24549 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
24550 !! html/php
24551 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;
24552 !! end
24553
24554 !! test
24555 Space normalisation on autocomment (T24784)
24556 !! options
24557 comment
24558 title=[[Main Page]]
24559 !! wikitext
24560 /* __hello__world__ */
24561 !! html/php
24562 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
24563 !! end
24564
24565 !! test
24566 percent-encoding and + signs in comments (T28410)
24567 !! options
24568 comment
24569 !! wikitext
24570 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
24571 !! html/php
24572 <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>
24573 !! end
24574
24575 # Parsoid doesn't support this yet: see T75581
24576 # but it *should* omit the 'src' attribute if the image is bad.
24577 # PHP side of tests was disabled in
24578 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
24579 # because of issues in the PHP parserTests infrastructure
24580 # (but the output below is indeed what the PHP side emits)
24581 !! test
24582 Bad images - basic functionality
24583 !! wikitext
24584 [[File:Bad.jpg]]
24585 !! html/php+disabled
24586 !! html/parsoid
24587 <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>
24588 !! end
24589
24590 !! test
24591 Bad images - T18039: text after bad image disappears
24592 !! wikitext
24593 Foo bar
24594 [[File:Bad.jpg]]
24595 Bar foo
24596 !! html/php+disabled
24597 <p>Foo bar
24598 </p><p>Bar foo
24599 </p>
24600 !! html/parsoid
24601 <p>Foo bar
24602 <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>
24603 Bar foo</p>
24604 !! end
24605
24606 !! test
24607 Verify that displaytitle works (T24501) no displaytitle
24608 !! options
24609 showtitle
24610 !! config
24611 wgAllowDisplayTitle=true
24612 wgRestrictDisplayTitle=false
24613 !! wikitext
24614 this is not the the title
24615 !! html/php
24616 Parser test
24617 <p>this is not the the title
24618 </p>
24619 !! end
24620
24621 !! test
24622 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
24623 !! options
24624 showtitle
24625 title=[[Screen]]
24626 !! config
24627 wgAllowDisplayTitle=true
24628 wgRestrictDisplayTitle=false
24629 !! wikitext
24630 this is not the the title
24631 {{DISPLAYTITLE:whatever}}
24632 !! html/php
24633 whatever
24634 <p>this is not the the title
24635 </p>
24636 !! end
24637
24638 !! test
24639 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
24640 !! options
24641 showtitle
24642 title=[[Screen]]
24643 !! config
24644 wgAllowDisplayTitle=true
24645 wgRestrictDisplayTitle=true
24646 !! wikitext
24647 this is not the the title
24648 {{DISPLAYTITLE:whatever}}
24649 !! html/php
24650 Screen
24651 <p>this is not the the title
24652 </p>
24653 !! end
24654
24655 !! test
24656 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
24657 !! options
24658 showtitle
24659 title=[[Screen]]
24660 !! config
24661 wgAllowDisplayTitle=true
24662 wgRestrictDisplayTitle=true
24663 !! wikitext
24664 this is not the the title
24665 {{DISPLAYTITLE:screen}}
24666 !! html/php
24667 screen
24668 <p>this is not the the title
24669 </p>
24670 !! end
24671
24672 !! test
24673 Verify that displaytitle works (T24501) AllowDisplayTitle=false
24674 !! options
24675 showtitle
24676 title=[[Screen]]
24677 !! config
24678 wgAllowDisplayTitle=false
24679 !! wikitext
24680 this is not the the title
24681 {{DISPLAYTITLE:screen}}
24682 !! html/php
24683 Screen
24684 <p>this is not the the title
24685 <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>
24686 </p>
24687 !! end
24688
24689 !! test
24690 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
24691 !! options
24692 showtitle
24693 title=[[Screen]]
24694 !! config
24695 wgAllowDisplayTitle=false
24696 !! wikitext
24697 this is not the the title
24698 !! html/php
24699 Screen
24700 <p>this is not the the title
24701 </p>
24702 !! end
24703
24704 !! test
24705 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
24706 !! options
24707 showtitle
24708 title=[[Screen]]
24709 !! config
24710 wgAllowDisplayTitle=true
24711 wgRestrictDisplayTitle=true
24712 !! wikitext
24713 this is not the the title
24714 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
24715 !! html/php
24716 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
24717 <p>this is not the the title
24718 </p>
24719 !! end
24720
24721 !! test
24722 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
24723 !! options
24724 showtitle
24725 title=[[Screen]]
24726 !! config
24727 wgAllowDisplayTitle=true
24728 wgRestrictDisplayTitle=true
24729 !! wikitext
24730 this is not the the title
24731 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
24732 !! html/php
24733 <span style="color: red;">s</span>creen
24734 <p>this is not the the title
24735 </p>
24736 !! end
24737
24738 !! test
24739 Page status indicators: Empty name is invalid
24740 !! options
24741 showindicators
24742 !! wikitext
24743 <indicator name=" "></indicator>
24744 <indicator></indicator>
24745 !! html/php
24746 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24747 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24748 </p>
24749 !! end
24750
24751 !! test
24752 Page status indicators: Weird syntaxes that are okay
24753 !! options
24754 showindicators
24755 !! wikitext
24756 <indicator name="empty" />
24757 <indicator name="name"></indicator>
24758 !! html/php
24759 empty=
24760 name=
24761 <p><br />
24762 </p>
24763 !! end
24764
24765 !! test
24766 Page status indicators: Torture test
24767 !! options
24768 showindicators
24769 !! wikitext
24770 <indicator name="01">hello world</indicator>
24771 <indicator name="02">[[Main Page]]</indicator>
24772 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
24773 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
24774 <indicator name="05">*foo
24775 *bar</indicator>
24776 <indicator name="06"><nowiki>foo</nowiki></indicator>
24777 <indicator name="07"> Preformatted</indicator>
24778 <indicator name="08"><div>Broken tag</indicator>
24779 <indicator name="09">{| class=wikitable
24780 |cell
24781 |}</indicator>
24782 <indicator name="10">Two
24783
24784 paragraphs</indicator>
24785 !! html/php
24786 01=hello world
24787 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
24788 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" />
24789 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>
24790 05=<ul><li>foo</li>
24791 <li>bar</li></ul>
24792
24793 06=foo
24794 07=<pre>Preformatted
24795 </pre>
24796 08=<div>Broken tag</div>
24797
24798 09=<table class="wikitable">
24799 <tr>
24800 <td>cell
24801 </td></tr></table>
24802
24803 10=<p>Two
24804 </p><p>paragraphs
24805 </p>
24806 <p><br />
24807 </p><p><br />
24808 </p><p><br />
24809 </p><p><br />
24810 </p><p><br />
24811 </p>
24812 !! end
24813
24814 !! test
24815 preload: check <noinclude> and <includeonly>
24816 !! options
24817 preload
24818 !! wikitext
24819 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
24820 !! html/php
24821 Hello kind world.
24822 !! end
24823
24824 !! test
24825 preload: check <onlyinclude>
24826 !! options
24827 preload
24828 !! wikitext
24829 Goodbye <onlyinclude>Hello world</onlyinclude>
24830 !! html/php
24831 Hello world
24832 !! end
24833
24834 !! test
24835 preload: can pass tags through if we want to
24836 !! options
24837 preload
24838 !! wikitext
24839 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
24840 !! html/php
24841 <includeonly>Hello world</includeonly>
24842 !! end
24843
24844 !! test
24845 preload: check that it doesn't try to do tricks
24846 !! options
24847 preload
24848 !! wikitext
24849 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24850 !! html/php
24851 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24852 !! end
24853
24854 !! test
24855 Play a bit with r67090 and T5158
24856 !! wikitext
24857 <div style="width:50% !important">&nbsp;</div>
24858 <div style="width:50%&nbsp;!important">&nbsp;</div>
24859 <div style="width:50%&#160;!important">&nbsp;</div>
24860 <div style="border : solid;">&nbsp;</div>
24861 !! html/php
24862 <div style="width:50% !important">&#160;</div>
24863 <div style="width:50% !important">&#160;</div>
24864 <div style="width:50% !important">&#160;</div>
24865 <div style="border&#32;: solid;">&#160;</div>
24866
24867 !! html/parsoid
24868 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24869 <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>
24870 <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>
24871 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24872
24873 !! end
24874
24875 !! test
24876 French spaces in wikitext
24877 !! wikitext
24878 foo ! bar ? bat 50 % is less than 75 %.
24879
24880 Hello : this ; is « something ‹ else › again »
24881 !! html
24882 <p>foo&#160;! bar&#160;? bat 50&#160;% is less than 75&#160;%.
24883 </p><p>Hello&#160;: this&#160;; is «&#160;something ‹&#160;else&#160;› again&#160;»
24884 </p>
24885 !! end
24886
24887 # It would be reasonable for Parsoid and PHP to differ here.
24888 # The PHP behavior is arguably a bug.
24889 !! test
24890 Corner case: french spaces in definition list
24891 !! wikitext
24892 ;foo : bar
24893 !! html+tidy
24894 <dl><dt>foo&#160;</dt>
24895 <dd>bar</dd></dl>
24896 !! end
24897
24898 !! test
24899 T5158: Test for French spaces in attributes
24900 !! wikitext
24901 <br style=" clear : both ; " />
24902 !! html/php
24903 <p><br style="clear&#32;: both&#32;;" />
24904 </p>
24905 !! end
24906
24907 !! test
24908 HTML5 data attributes
24909 !! wikitext
24910 <span data-foo="bar">Baz</span>
24911 <p data-abc-def_hij="">Quuz</p>
24912 !! html/php
24913 <p><span data-foo="bar">Baz</span>
24914 </p>
24915 <p data-abc-def_hij="">Quuz</p>
24916
24917 !! html/parsoid
24918 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
24919 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
24920 !! end
24921
24922 !! test
24923 Strip reserved data attributes
24924 !! wikitext
24925 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
24926 !! html/php
24927 <div data-ok="fred">d</div>
24928
24929 !! html/parsoid
24930 <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>
24931 !! end
24932
24933 !! test
24934 percent-encoding and + signs in internal links (T28410)
24935 !! wikitext
24936 [[User:+%]] [[Page+title%]]
24937 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
24938 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
24939 [[%33%45]] [[%33%45+]]
24940 !! html/php
24941 <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>
24942 <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>
24943 <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>
24944 <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>
24945 </p>
24946 !! html/parsoid
24947 <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>
24948 <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>
24949 <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>
24950 <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>
24951 !! end
24952
24953 !! test
24954 Special characters in embedded file links (T29679)
24955 !! wikitext
24956 [[File:Contains & ampersand.jpg]]
24957 [[File:Does not exist.jpg|Title with & ampersand]]
24958 !! html/php
24959 <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>
24960 <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>
24961 </p>
24962 !! html/parsoid
24963 <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>
24964 <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>
24965 !! end
24966
24967 !! test
24968 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
24969 !! wikitext
24970 Text&apos;s been normalized?
24971 !! html
24972 <p>Text&#39;s been normalized?
24973 </p>
24974 !! end
24975
24976 !! test
24977 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
24978 !! wikitext
24979 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
24980 !! html
24981 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
24982 </p>
24983 !! end
24984
24985 !! test
24986 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
24987 !! wikitext
24988 [http://www.example.org/ ideograms]
24989 !! html
24990 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
24991 </p>
24992 !! end
24993
24994 !! test
24995 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
24996 !! wikitext
24997 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
24998 !! html
24999 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
25000 </p>
25001 !! end
25002
25003 !! article
25004 Mediawiki:loop1
25005 !! text
25006 {{Identical|A}}
25007 !! endarticle
25008
25009 !! article
25010 Mediawiki:loop2
25011 !! text
25012 {{Identical|B}}
25013 !! endarticle
25014
25015 !! article
25016 Template:Identical
25017 !! text
25018 {{int:loop1}}
25019 {{int:loop2}}
25020 !! endarticle
25021
25022 !! test
25023 T33098 Template which includes system messages which includes the template
25024 !! wikitext
25025 {{Identical}}
25026 !! html
25027 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
25028 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
25029 </p>
25030 !! end
25031
25032 !! test
25033 T33490 Turkish: ucfirst 'blah'
25034 !! options
25035 language=tr
25036 !! wikitext
25037 {{ucfirst:blah}}
25038 !! html
25039 <p>Blah
25040 </p>
25041 !! end
25042
25043 !! test
25044 T33490 Turkish: ucfirst 'ix'
25045 !! options
25046 language=tr
25047 !! wikitext
25048 {{ucfirst:ix}}
25049 !! html
25050 <p>İx
25051 </p>
25052 !! end
25053
25054 !! test
25055 T33490 Turkish: lcfirst 'BLAH'
25056 !! options
25057 language=tr
25058 !! wikitext
25059 {{lcfirst:BLAH}}
25060 !! html
25061 <p>bLAH
25062 </p>
25063 !! end
25064
25065 !! test
25066 T33490 Turkish: ucfırst (with a dotless i)
25067 !! options
25068 language=tr
25069 !! wikitext
25070 {{ucfırst:blah}}
25071 !! html
25072 <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>
25073 </p>
25074 !! end
25075
25076 !! test
25077 T33490 ucfırst (with a dotless i) with English language
25078 !! options
25079 language=en
25080 !! wikitext
25081 {{ucfırst:blah}}
25082 !! html
25083 <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>
25084 </p>
25085 !! end
25086
25087 # Note that Parsoid doesn't emit an explicit TOC.
25088 # Note also that the html2wt direction tends to emit an extra newline
25089 # between the __TOC__ magicword and the first heading unless *both*
25090 # the <meta> and the <h2> have a data-parsoid attribute set (even if
25091 # it's "{}").
25092
25093 !! test
25094 T28375: TOC with italics
25095 !! options
25096 title=[[Main Page]]
25097 !! wikitext
25098 __TOC__
25099 ==''Lost'' episodes==
25100 !! html/php
25101 <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>
25102 <ul>
25103 <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>
25104 </ul>
25105 </div>
25106
25107 <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>
25108
25109 !! html/parsoid
25110 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25111 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
25112 !! end
25113
25114 !! test
25115 T28375: TOC with bold
25116 !! options
25117 title=[[Main Page]]
25118 !! wikitext
25119 __TOC__
25120 =='''should be bold''' then normal text==
25121 !! html/php
25122 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
25123 <ul>
25124 <li class="toclevel-1 tocsection-1"><a href="#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>
25125 </ul>
25126 </div>
25127
25128 <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>
25129
25130 !! html/parsoid
25131 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25132 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
25133 !! end
25134
25135 !! test
25136 T35845: Headings become cursive in TOC when they contain an image
25137 !! options
25138 title=[[Main Page]]
25139 !! wikitext
25140 __TOC__
25141 ==Image [[Image:foobar.jpg]]==
25142 !! html/php
25143 <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>
25144 <ul>
25145 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
25146 </ul>
25147 </div>
25148
25149 <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>
25150
25151 !! html/parsoid
25152 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25153 <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>
25154 !! end
25155
25156 !! test
25157 T35845 (2): Headings become bold in TOC when they contain a blockquote
25158 !! options
25159 title=[[Main Page]]
25160 !! wikitext
25161 __TOC__
25162 ==<blockquote>Quote</blockquote>==
25163 !! html/php
25164 <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>
25165 <ul>
25166 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
25167 </ul>
25168 </div>
25169
25170 <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>
25171
25172 !! html/php+tidy
25173 <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>
25174 <ul>
25175 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
25176 </ul>
25177 </div>
25178
25179 <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>
25180 !! html/parsoid
25181 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25182 <h2 id="Quote" data-parsoid='{}'><blockquote><p>Quote</p></blockquote></h2>
25183 !! end
25184
25185 !! test
25186 Unclosed tags in TOC
25187 !! config
25188 wgFragmentMode=[ 'html5', 'legacy' ]
25189 !! options
25190 title=[[Main Page]]
25191 !! wikitext
25192 __TOC__
25193 ==Proof: 2 < 3==
25194 <small>Hanc marginis exiguitas non caperet.</small>
25195 QED
25196 !! html/php
25197 <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>
25198 <ul>
25199 <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>
25200 </ul>
25201 </div>
25202
25203 <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>
25204 <p><small>Hanc marginis exiguitas non caperet.</small>
25205 QED
25206 </p>
25207 !! html/parsoid
25208 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25209 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
25210 <p><small>Hanc marginis exiguitas non caperet.</small>
25211 QED</p>
25212 !! end
25213
25214 !! test
25215 Multiple tags in TOC
25216 !! wikitext
25217 __TOC__
25218 ==<i>Foo</i> <b>Bar</b>==
25219
25220 ==<i>Foo</i> <blockquote>Bar</blockquote>==
25221 !! html/php
25222 <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>
25223 <ul>
25224 <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>
25225 <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>
25226 </ul>
25227 </div>
25228
25229 <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>
25230 <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>
25231
25232 !! html/php+tidy
25233 <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>
25234 <ul>
25235 <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>
25236 <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>
25237 </ul>
25238 </div>
25239
25240 <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>
25241 <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>
25242 !! html/parsoid
25243 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25244 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
25245
25246 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote><p>Bar</p></blockquote></h2>
25247 !! end
25248
25249 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
25250 # html5 tag parsing.
25251 !! test
25252 Tags with parameters in TOC
25253 !! options
25254 parsoid=wt2html
25255 !! wikitext
25256 __TOC__
25257 ==<sup class="in-h2">Hello</sup>==
25258
25259 ==<sup class="a > b">Evilbye</sup>==
25260 !! html/php
25261 <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>
25262 <ul>
25263 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
25264 <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>
25265 </ul>
25266 </div>
25267
25268 <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>
25269 <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>
25270
25271 !! html/parsoid
25272 <meta property="mw:PageProp/toc" />
25273 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
25274
25275 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
25276 !! end
25277
25278 !! test
25279 span tags with directionality in TOC
25280 !! wikitext
25281 __TOC__
25282 ==<span dir="ltr">C++</span>==
25283
25284 ==<span dir="rtl">זבנג!</span>==
25285
25286 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
25287
25288 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
25289
25290 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
25291 !! html/php
25292 <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>
25293 <ul>
25294 <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>
25295 <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>
25296 <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>
25297 <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>
25298 <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>
25299 </ul>
25300 </div>
25301
25302 <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>
25303 <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>
25304 <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>
25305 <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>
25306 <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>
25307
25308 !! html/parsoid
25309 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25310 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
25311 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
25312 <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>
25313 <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>
25314 <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>
25315 !! end
25316
25317 !! test
25318 T74884: bdi element in ToC
25319 !! wikitext
25320 __TOC__
25321 ==<bdi>test</bdi>==
25322 !! html/php
25323 <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>
25324 <ul>
25325 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
25326 </ul>
25327 </div>
25328
25329 <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>
25330
25331 !! html/parsoid
25332 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25333 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
25334 !! end
25335
25336 !! test
25337 T35715: s/strike element in ToC
25338 !! wikitext
25339 __TOC__
25340 ==<s>test</s> test <strike>test</strike>==
25341 !! html/php
25342 <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>
25343 <ul>
25344 <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>
25345 </ul>
25346 </div>
25347
25348 <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>
25349
25350 !! html/parsoid
25351 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25352 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
25353 !! end
25354
25355 !! test
25356 T198618: style element in ToC
25357 !! options
25358 styletag=1
25359 !! wikitext
25360 __TOC__
25361 ==<style>.foo {}</style>Style<style>.bar {}</style>==
25362 !! html/php
25363 <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>
25364 <ul>
25365 <li class="toclevel-1 tocsection-1"><a href="#Style"><span class="tocnumber">1</span> <span class="toctext">Style</span></a></li>
25366 </ul>
25367 </div>
25368
25369 <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>
25370
25371 !! html/parsoid
25372 <meta property="mw:PageProp/toc" data-parsoid="{}"/>
25373 <h2 id="Style" data-parsoid="{}"><style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo {}"}}'>.foo {}</style>Style<style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".bar {}"}}'>.bar {}</style></h2>
25374 !! end
25375
25376 !! test
25377 T198618: script element in ToC
25378 !! options
25379 wgRawHtml=1
25380 !! wikitext
25381 __TOC__
25382 ==<html><script>alert(1);</script></html>Script<html><script>alert(1);</script></html>==
25383 !! html/php
25384 <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>
25385 <ul>
25386 <li class="toclevel-1 tocsection-1"><a href="#Script"><span class="tocnumber">1</span> <span class="toctext">Script</span></a></li>
25387 </ul>
25388 </div>
25389
25390 <h2><span class="mw-headline" id="Script"><script>alert(1);</script>Script<script>alert(1);</script></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Script">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
25391
25392 !! html/parsoid
25393 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25394 <h2 id="Script" data-parsoid='{}'><script typeof="mw:Extension/html" about="#mwt4" data-mw='{"name":"html","attrs":{},"body":{"extsrc":"&lt;script>alert(1);&lt;/script>"}}'>alert(1);</script>Script<script typeof="mw:Extension/html" about="#mwt6" data-mw='{"name":"html","attrs":{},"body":{"extsrc":"&lt;script>alert(1);&lt;/script>"}}'>alert(1);</script></h2>
25395 !! end
25396
25397 !! test
25398 Empty <p> tag in TOC, removed by Sanitizer (T92892)
25399 !! wikitext
25400 __TOC__
25401 ==x==
25402 !! html/php
25403 <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>
25404 <ul>
25405 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
25406 </ul>
25407 </div>
25408
25409 <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>
25410
25411 !! html/parsoid
25412 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25413 <h2 id="x" data-parsoid='{}'>x</h2>
25414 !! end
25415
25416 !! article
25417 MediaWiki:T34057
25418 !! text
25419 == {{int:headline_sample}} ==
25420 !! endarticle
25421
25422 !! test
25423 T34057: Title needed when expanding <h> nodes.
25424 !! options
25425 title=[[Main Page]]
25426 !! wikitext
25427 {{int:T34057}}
25428 !! html
25429 <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>
25430
25431 !! end
25432
25433 !! test
25434 Strip marker in urlencode
25435 !! wikitext
25436 {{urlencode:x<nowiki/>y}}
25437 {{urlencode:x<nowiki/>y|wiki}}
25438 {{urlencode:x<nowiki/>y|path}}
25439 {{urlencode:x<pre id="one">two</pre>y}}
25440 !! html/php
25441 <p>xy
25442 xy
25443 xy
25444 xy
25445 </p>
25446 !! end
25447
25448 !! test
25449 Strip marker in lc
25450 !! wikitext
25451 {{lc:x<nowiki/>y}}
25452 !! html
25453 <p>xy
25454 </p>
25455 !! end
25456
25457 !! test
25458 Strip marker in uc
25459 !! wikitext
25460 {{uc:x<nowiki/>y}}
25461 !! html
25462 <p>XY
25463 </p>
25464 !! end
25465
25466 !! test
25467 Strip marker in formatNum
25468 !! wikitext
25469 {{formatnum:1<nowiki/>2}}
25470 {{formatnum:1<nowiki/>2|R}}
25471 !! html
25472 <p>12
25473 12
25474 </p>
25475 !! end
25476
25477 !! test
25478 Check noCommafy in formatNum
25479 !! options
25480 language=be-tarask
25481 !! wikitext
25482 {{formatnum:123456.78}}
25483 {{formatnum:123456.78|NOSEP}}
25484 !! html
25485 <p>123 456,78
25486 123456.78
25487 </p>
25488 !! end
25489
25490 !! test
25491 Wrong option for formatNum (T58199)
25492 !! wikitext
25493 {{formatnum:1,234.56|Random}}
25494 {{formatnum:1,234.56|EVERYTHING}}
25495 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
25496 !! html
25497 <p>1,234.56
25498 1,234.56
25499 1,234.56
25500 </p>
25501 !! end
25502
25503 !! test
25504 Strip marker in grammar
25505 !! options
25506 language=fi
25507 !! wikitext
25508 {{grammar:elative|foo<nowiki/>bar}}
25509 !! html
25510 <p>foobarista
25511 </p>
25512 !! end
25513
25514 !! test
25515 Strip marker in padleft
25516 !! wikitext
25517 {{padleft:|2|x<nowiki/>y}}
25518 !! html
25519 <p>xy
25520 </p>
25521 !! end
25522
25523 !! test
25524 Strip marker in padright
25525 !! wikitext
25526 {{padright:|2|x<nowiki/>y}}
25527 !! html
25528 <p>xy
25529 </p>
25530 !! end
25531
25532 !! test
25533 Strip marker in anchorencode
25534 !! wikitext
25535 {{anchorencode:x<nowiki/>y}}
25536 !! html/php
25537 <p>xy
25538 </p>
25539 !! html/parsoid
25540 <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>
25541 !! end
25542
25543 !! test
25544 nowiki inside link inside heading (T20295)
25545 !! wikitext
25546 ==[[foo|x<nowiki>y</nowiki>z]]==
25547 !! html
25548 <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>
25549
25550 !! end
25551
25552 !! test
25553 new support for bdi element (T33817)
25554 !! wikitext
25555 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25556 !! html
25557 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25558
25559 !!end
25560
25561 !! test
25562 Ignore pipe between table row attributes
25563 !! wikitext
25564 {|
25565 |quux
25566 |- id=foo | style='color: red'
25567 |bar
25568 |}
25569 !! html
25570 <table>
25571 <tr>
25572 <td>quux
25573 </td></tr>
25574 <tr id="foo" style="color: red">
25575 <td>bar
25576 </td></tr></table>
25577
25578 !! end
25579
25580 !!test
25581 Language parser function
25582 !! wikitext
25583 {{#language:ar}}
25584 !! html
25585 <p>العربية
25586 </p>
25587 !! end
25588
25589 !!test
25590 Padleft and padright (default 0-padding)
25591 !! wikitext
25592 {{padleft:xyz|5}}
25593 {{padright:xyz|5}}
25594 !! html/php
25595 <p>00xyz
25596 xyz00
25597 </p>
25598 !! html/parsoid
25599 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
25600 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
25601 !! end
25602
25603 !!test
25604 Padleft and padright (partial fill)
25605 !! wikitext
25606 {{padleft:xyz|6|ab}}
25607 {{padright:xyz|6|ab}}
25608 !! html/php
25609 <p>abaxyz
25610 xyzaba
25611 </p>
25612 !! html/parsoid
25613 <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>
25614 <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>
25615 !! end
25616
25617 !!test
25618 Padleft and padright as substr
25619 !! wikitext
25620 {{padleft:|3|abcde}}
25621 {{padright:|3|abcde}}
25622 !! html/php
25623 <p>abc
25624 abc
25625 </p>
25626 !! html/parsoid
25627 <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>
25628 <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>
25629 !! end
25630
25631 !! test
25632 Padleft and padright with non-numerical length (T180403)
25633 !! wikitext
25634 {{padleft:abcdef|junk}}
25635 {{padright:abcdef|junk}}
25636 !! html/php
25637 <p>abcdef
25638 abcdef
25639 </p>
25640 !! end
25641
25642 !!test
25643 Special parser function
25644 !! wikitext
25645 {{#special:RandomPage}}
25646 {{#special:BaDtItLe}}
25647 {{#special:Foobar}}
25648 !! html
25649 <p>Special:Random
25650 Special:Badtitle
25651 Special:Foobar
25652 </p>
25653 !! end
25654
25655 !!test
25656 T36939 - Case insensitive link parsing ([HttP://])
25657 !! wikitext
25658 [HttP://MediaWiki.Org/]
25659 !! html/php
25660 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
25661 </p>
25662 !! html/parsoid
25663 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
25664 !! end
25665
25666 !!test
25667 T36939 - Case insensitive link parsing ([HttP:// title])
25668 !! wikitext
25669 [HttP://MediaWiki.Org/ MediaWiki]
25670 !! html
25671 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
25672 </p>
25673 !! end
25674
25675 !!test
25676 T36939 - Case insensitive link parsing (HttP://)
25677 !! wikitext
25678 HttP://MediaWiki.Org/
25679 !! html/php
25680 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
25681 </p>
25682 !! html/parsoid
25683 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
25684 !! end
25685
25686 !!test
25687 Disable TOC
25688 !! options
25689 notoc
25690 !! wikitext
25691 Lead
25692 ==Section 1==
25693 ==Section 2==
25694 ==Section 3==
25695 ==Section 4==
25696 ==Section 5==
25697 !! html
25698 <p>Lead
25699 </p>
25700
25701 <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>
25702 <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>
25703 <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>
25704 <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>
25705 <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>
25706
25707 !! end
25708
25709
25710 ###
25711 ### Parsoid-specific tests
25712 ### Parsoid-PHP parser incompatibilities
25713 ###
25714 !!test
25715 1. SOL-sensitive wikitext tokens as template-args
25716 !! options
25717 parsoid=wt2html,wt2wt
25718 !! wikitext
25719 {{echo|*a}}
25720 {{echo|#a}}
25721 {{echo|:a}}
25722 !! html/php+tidy
25723 <ul><li>a</li></ul>
25724 <ol><li>a</li></ol>
25725 <dl><dd>a</dd></dl>
25726 !! html/parsoid
25727 <span about="#mwt1" typeof="mw:Transclusion">
25728 </span><ul about="#mwt1"><li>a</li>
25729 </ul>
25730 <span about="#mwt2" typeof="mw:Transclusion">
25731 </span><ol about="#mwt2"><li>a</li>
25732 </ol>
25733 <span about="#mwt3" typeof="mw:Transclusion">
25734 </span><dl about="#mwt3"><dd>a</dd>
25735 </dl>
25736 !!end
25737
25738 #### -----------------------------------------------------------------
25739 #### Parsoid-specific functionality tests
25740 #### -----------------------------------------------------------------
25741
25742 # T65642/T68749: Formatting elt fixup around images.
25743 # We know wt2wt will fail, but we expect selser to pass.
25744 # Due to the nature of our testing, wt2wt and selser tests will enter the
25745 # blacklist and we'll catch selser regressions based on changes to the
25746 # blacklist entries for selser tests.
25747 !! test
25748 1. Treebuilder fixup of formatting elt
25749 !! options
25750 parsoid=wt2html,wt2wt
25751 !! wikitext
25752 {|
25753 |
25754 <small>
25755 [[Image:Foobar.jpg|right|Test]]
25756 </small>
25757 |}
25758 !! html/php+tidy
25759 <table>
25760 <tbody><tr>
25761 <td>
25762 <p><small>
25763 </small></p><small>
25764 <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>
25765 </small><p><small></small>
25766 </p>
25767 </td></tr></tbody></table>
25768 !! html/parsoid
25769 <table>
25770 <tbody><tr><td>
25771 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
25772 <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>
25773 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p></td></tr>
25774 </tbody></table>
25775 !! end
25776
25777 !! test
25778 2. Treebuilder fixup of formatting elt
25779 !! options
25780 parsoid=wt2html,wt2wt
25781 !! wikitext
25782 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
25783
25784 <small>[[Image:Foobar.jpg|right|300px]]</small>
25785 !! html/php+tidy
25786 <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>
25787 </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>
25788 !! html/parsoid
25789 <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>
25790
25791 <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>
25792 !! end
25793
25794 !! test
25795 3. Treebuilder fixup of formatting elt
25796 !! options
25797 parsoid=wt2html,wt2wt
25798 !! wikitext
25799 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
25800 !! html/php+tidy
25801 <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>
25802 </p>
25803 !! html/parsoid
25804 <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>
25805 !! end
25806
25807 !! test
25808 4. Treebuilder fixup of formatting elt: formatting tags around captionless images
25809 !! options
25810 parsoid=wt2html,wt2wt
25811 !! wikitext
25812 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
25813 !! html/php+tidy
25814 <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>
25815 !! html/parsoid
25816 <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>
25817 !! end
25818
25819 #### ----------------------------------------------------------------
25820 #### Parsoid-only testing of Parsoid's impl of LST
25821 #### Not implemented yet, see
25822 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
25823 #### ----------------------------------------------------------------
25824
25825 ## We still need to support serializing the older format while content is stored.
25826 !! test
25827 LST Sections: Backwards compatibility
25828 !! options
25829 parsoid={
25830 "suppressErrors": true,
25831 "modes": ["html2wt"]
25832 }
25833 !! wikitext
25834 <section begin="2011-05-16" />
25835 <section end="2014-04-10 (MW 1.23wmf22)" />
25836 !! html/parsoid
25837 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
25838 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
25839 !! end
25840
25841 !! test
25842 LST Sections: Newfangled approach
25843 !! wikitext
25844 <section begin="2011-05-16" />
25845 <section end="2014-04-10 (MW 1.23wmf22)" />
25846 !! html/parsoid
25847 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"}}'>
25848 </span>
25849 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"}}'>
25850 </span></p>
25851 !! end
25852
25853 #--------- Test stripping of empty nodes in template content ----------
25854
25855 !! test
25856 Empty LI and TR nodes should be stripped from template content
25857 !! wikitext
25858 {{EmptyLITest}}
25859 {{EmptyTRTest}}
25860 !! html/parsoid
25861 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
25862 <li>a</li>
25863 <li>b</li>
25864 </ul>
25865 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
25866 <tbody>
25867 <tr>
25868 <td>foo</td>
25869 </tr>
25870 <tr>
25871 <td>bar</td>
25872 </tr>
25873 </tbody>
25874 </table>
25875 !! end
25876
25877 !! test
25878 Empty LI and TR nodes should not be stripped from top-level content
25879 !! wikitext
25880 *a
25881 *
25882 *b
25883
25884 {|
25885 |-
25886 |-
25887 |foo
25888 |}
25889 !! html/parsoid
25890 <ul>
25891 <li>a</li>
25892 <li class='mw-empty-elt'></li>
25893 <li>b</li>
25894 </ul>
25895 <table>
25896 <tbody>
25897 <tr class='mw-empty-elt'></tr>
25898 <tr>
25899 <td>foo</td>
25900 </tr>
25901 </tbody>
25902 </table>
25903 !! end
25904
25905 !! test
25906 Empty TR nodes should not be stripped if they have any attributes set
25907 !! wikitext
25908 {{EmptyTRWithHTMLAttrTest}}
25909 !! html/parsoid
25910 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
25911 <tr align='center'></tr>
25912 <tr><td>foo</td></tr>
25913 <tr align='center'></tr>
25914 <tr><td>bar</td></tr>
25915 </table>
25916 !! end
25917
25918 #### ----------------------------------------------------------------
25919 #### The following section of tests are primarily to test
25920 #### wikitext escaping capabilities of Parsoid. Given that
25921 #### escaping can be done any number of ways, the wikitext (input)
25922 #### is always adjusted to reflect how Parsoid adds nowiki
25923 #### escape tags.
25924 ####
25925 #### We are marking several tests as parsoid-only since the
25926 #### HTML in the result section is different from what the
25927 #### PHP parser generates for it.
25928 #### ----------------------------------------------------------------
25929
25930
25931 #### --------------- Headings ---------------
25932 #### 0. Unnested
25933 #### 1. Nested inside html <h1>=foo=</h1>
25934 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
25935 #### 3. Nested inside html with wikitext split by html tags
25936 #### 4. No escape needed
25937 #### 5. Empty headings <h1></h1>
25938 #### 6. Heading chars in SOL context
25939 #### ----------------------------------------
25940 !! test
25941 Headings: 0. Unnested
25942 !! options
25943 parsoid=html2wt
25944 !! html/parsoid
25945 <p>=foo=</p>
25946
25947 <p> =foo=
25948 <!--cmt-->
25949 =foo=</p>
25950
25951 <p>=foo<i>a</i>=</p>
25952 !! wikitext
25953 <nowiki>=foo=</nowiki>
25954
25955 <nowiki> </nowiki>=foo=
25956 <!--cmt-->
25957 <nowiki>=foo=</nowiki>
25958
25959 =foo''a''<nowiki>=</nowiki>
25960 !!end
25961
25962 # New headings and existing headings are handled differently
25963 !! test
25964 Headings: 1. Nested inside html
25965 !! options
25966 parsoid=html2wt
25967 !! html/parsoid
25968 <h1>=foo=</h1>
25969 <h2>=foo=</h2>
25970 <h3>=foo=</h3>
25971
25972 <h1 data-parsoid=''>=foo=</h1>
25973 <h2 data-parsoid=''>=foo=</h2>
25974 <h3 data-parsoid=''>=foo=</h3>
25975 <h4 data-parsoid=''>=foo=</h4>
25976 <h5 data-parsoid=''>=foo=</h5>
25977 <h6 data-parsoid=''>=foo=</h6>
25978 !! wikitext
25979 = =foo= =
25980
25981 == =foo= ==
25982
25983 === =foo= ===
25984
25985 =<nowiki>=foo=</nowiki>=
25986 ==<nowiki>=foo=</nowiki>==
25987 ===<nowiki>=foo=</nowiki>===
25988 ====<nowiki>=foo=</nowiki>====
25989 =====<nowiki>=foo=</nowiki>=====
25990 ======<nowiki>=foo=</nowiki>======
25991
25992 !!end
25993
25994 !! test
25995 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
25996 !! options
25997 parsoid=html2wt
25998 !! html/parsoid
25999 <h1>foo</h1>*bar
26000 <h1>foo</h1>=bar
26001 <h1>foo</h1>=bar=
26002 !! wikitext
26003 = foo =
26004 <nowiki>*</nowiki>bar
26005
26006 = foo =
26007 =bar
26008
26009 = foo =
26010 <nowiki>=bar=</nowiki>
26011 !!end
26012
26013 !! test
26014 Headings: 3. Nested inside html with wikitext split by html tags
26015 !! options
26016 parsoid=html2wt
26017 !! html/parsoid
26018 <h1>=<b>bold</b>foo=</h1>
26019 !! wikitext
26020 = ='''bold'''foo= =
26021 !!end
26022
26023 !! test
26024 Headings: 4a. No escaping needed (testing just h1 and h2)
26025 !! options
26026 parsoid=html2wt
26027 !! html/parsoid
26028 <h1>=foo</h1>
26029 <h1>foo=</h1>
26030 <h1> =foo= </h1>
26031 <h1>=foo= bar</h1>
26032 <h2>=foo</h2>
26033 <h2>foo=</h2>
26034 <h1>=</h1>
26035 <h1><i>=</i>foo=</h1>
26036 !! wikitext
26037 = =foo =
26038
26039 = foo= =
26040
26041 = =foo= =
26042
26043 = =foo= bar =
26044
26045 == =foo ==
26046
26047 == foo= ==
26048
26049 = = =
26050
26051 = ''=''foo= =
26052 !!end
26053
26054 !! test
26055 Headings: 4b. No escaping needed (inside p-tags)
26056 !! options
26057 parsoid=html2wt
26058 !! html/parsoid
26059 <p>=foo= x
26060 =foo= <s></s>
26061 </p>
26062 !! wikitext
26063 =foo= x
26064 =foo= <s></s>
26065 !! html/php
26066 <p>=foo= x
26067 =foo= <s></s>
26068 </p>
26069 !!end
26070
26071 !! test
26072 Headings: 4c. Short headings (1)
26073 !! options
26074 parsoid=html2wt
26075 !! html/parsoid
26076 <p>===
26077 </p>
26078 !! wikitext
26079 <nowiki>===</nowiki>
26080 !! html/php
26081 <p>===
26082 </p>
26083 !! end
26084
26085 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
26086 !! test
26087 Headings: 4d. Short headings (2)
26088 !! options
26089 parsoid=wt2html,html2html
26090 !! wikitext
26091 =
26092 ==
26093 ===
26094 ====
26095 =====
26096 !! html/php
26097 <p>=
26098 ==
26099 </p>
26100 <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>
26101 <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>
26102 <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>
26103
26104 !! html/parsoid
26105 <p>=
26106 ==</p>
26107 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
26108 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
26109 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
26110 !! end
26111
26112 !! test
26113 Headings: 5. Empty headings
26114 !! options
26115 parsoid=html2wt
26116 !! html/parsoid
26117 <h1 data-parsoid='{}'></h1>
26118
26119 <h2 data-parsoid='{}'></h2>
26120
26121 <h3 data-parsoid='{}'></h3>
26122
26123 <h4 data-parsoid='{}'></h4>
26124
26125 <h5 data-parsoid='{}'></h5>
26126
26127 <h6 data-parsoid='{}'></h6>
26128 !! wikitext
26129 =<nowiki/>=
26130
26131 ==<nowiki/>==
26132
26133 ===<nowiki/>===
26134
26135 ====<nowiki/>====
26136
26137 =====<nowiki/>=====
26138
26139 ======<nowiki/>======
26140 !!end
26141
26142 !! test
26143 Headings: 6a. Heading chars in SOL context (with trailing spaces)
26144 !! options
26145 parsoid=html2wt
26146 !! html/parsoid
26147 <p>=a=</p>
26148
26149 <p>=a=</p>
26150
26151 <p>=a=</p>
26152 !! wikitext
26153 <nowiki>=a=</nowiki>
26154
26155 <nowiki>=a=</nowiki>
26156
26157 <nowiki>=a=</nowiki>
26158 !!end
26159
26160 !! test
26161 Headings: 6b. Heading chars in SOL context (with trailing newlines)
26162 !! options
26163 parsoid=html2wt
26164 !! html/parsoid
26165 <p>=a=
26166 b</p>
26167
26168 <p>=a=
26169 b</p>
26170
26171 <p>=a=
26172 b</p>
26173 !! wikitext
26174 <nowiki>=a=</nowiki>
26175 b
26176
26177 <nowiki>=a=</nowiki>
26178 b
26179
26180 <nowiki>=a=</nowiki>
26181 b
26182 !!end
26183
26184 !! test
26185 Headings: 6c. Heading chars in SOL context (leading newline break)
26186 !! options
26187 parsoid=html2wt
26188 !! html/parsoid
26189 <p>a
26190 =b=</p>
26191 !! wikitext
26192 a
26193 <nowiki>=b=</nowiki>
26194 !!end
26195
26196 !! test
26197 Headings: 6d. Heading chars in SOL context (with interspersed comments)
26198 !! options
26199 parsoid=html2wt
26200 !! html/parsoid
26201 <!--c0--><p>=a=</p>
26202
26203 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
26204 !! wikitext
26205 <!--c0--><nowiki>=a=</nowiki>
26206
26207 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
26208 !!end
26209
26210 !! test
26211 Headings: 6d. Heading chars in SOL context (No escaping needed)
26212 !! options
26213 parsoid=html2wt
26214 !! html/parsoid
26215 =a=<div>b</div>
26216 !! wikitext
26217 =a=<div>b</div>
26218 !!end
26219
26220 !! test
26221 Headings: 7. Insert a newline between new content and headings
26222 !! options
26223 parsoid=html2wt
26224 !! html/parsoid
26225 <h2>NEW</h2>
26226 <p>new</p>
26227 <h2 data-parsoid='{}'>A</h2>
26228 <p data-parsoid='{}'>a</p>
26229 !! wikitext
26230 == NEW ==
26231 new
26232
26233 ==A==
26234 a
26235
26236 !! end
26237
26238 !! test
26239 Headings: Used as horizontal rule
26240 !! config
26241 wgFragmentMode=[ 'html5', 'legacy' ]
26242 !! options
26243 parsoid=wt2html
26244 !! wikitext
26245 ===============
26246 !! html/php
26247 <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>
26248
26249 !! html/parsoid
26250 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
26251 !! end
26252
26253 #### --------------- Lists ---------------
26254 #### 0. Outside nests (*foo, etc.)
26255 #### 1. Nested inside html <ul><li>*foo</li></ul>
26256 #### 2. Inside definition lists
26257 #### 3. Only bullets at start should be escaped
26258 #### 4. No escapes needed
26259 #### 5. No unnecessary escapes
26260 #### 6. Escape bullets in SOL position
26261 #### 7. Escape bullets in a multi-line context
26262 #### ----------------------------------------
26263
26264 !! test
26265 Lists: 0. Outside nests
26266 !! options
26267 parsoid=html2wt
26268 !! html/parsoid
26269 <p>*foo</p>
26270
26271 <p>#foo</p>
26272
26273 <p>;Foo:bar</p>
26274 !! wikitext
26275 <nowiki>*</nowiki>foo
26276
26277 <nowiki>#</nowiki>foo
26278
26279 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
26280 !!end
26281
26282 ## Making these next 3 tests Parsoid-only since they are html2wt tests
26283 ## to test wikitext escaping, and insignificant whitespace diffs
26284 ## cause PHP parser tests to barf
26285 !! test
26286 Lists: 1. Nested inside html (No unnecessary escapes)
26287 !! options
26288 parsoid=html2wt
26289 !! html/parsoid
26290 <ul>
26291 <li>*foo</li>
26292 <li>#foo</li>
26293 <li>:foo</li>
26294 <li>;foo</li>
26295 <li data-parsoid='{}'>*foo</li>
26296 <li data-parsoid='{}'>#foo</li>
26297 <li data-parsoid='{}'>:foo</li>
26298 <li data-parsoid='{}'>;foo</li>
26299 </ul>
26300
26301 <ol>
26302 <li>*foo</li>
26303 <li>#foo</li>
26304 <li>:foo</li>
26305 <li>;foo</li>
26306 <li data-parsoid='{}'>*foo</li>
26307 <li data-parsoid='{}'>#foo</li>
26308 <li data-parsoid='{}'>:foo</li>
26309 <li data-parsoid='{}'>;foo</li>
26310 </ol>
26311 !! wikitext
26312 * *foo
26313 * #foo
26314 * :foo
26315 * ;foo
26316 *<nowiki>*foo</nowiki>
26317 *<nowiki>#foo</nowiki>
26318 *<nowiki>:foo</nowiki>
26319 *<nowiki>;foo</nowiki>
26320
26321 # *foo
26322 # #foo
26323 # :foo
26324 # ;foo
26325 #<nowiki>*foo</nowiki>
26326 #<nowiki>#foo</nowiki>
26327 #<nowiki>:foo</nowiki>
26328 #<nowiki>;foo</nowiki>
26329 !!end
26330
26331 !! test
26332 Lists: 2. Inside definition lists
26333 !! options
26334 parsoid=html2wt
26335 !! html/parsoid
26336 <dl><dt>;foo</dt></dl>
26337 <dl><dt>:foo</dt></dl>
26338 <dl><dt>:foo</dt>
26339 <dd>bar</dd></dl>
26340 <dl><dd>:foo</dd></dl>
26341 !! wikitext
26342 ; ;foo
26343
26344 ; <nowiki>:foo</nowiki>
26345
26346 ; <nowiki>:foo</nowiki>
26347 : bar
26348
26349 : :foo
26350 !!end
26351
26352 !! test
26353 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
26354 !! options
26355 parsoid=html2wt
26356 !! html/parsoid
26357 <ul>
26358 <li>*foo*bar</li>
26359 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
26360 </ul>
26361 !! wikitext
26362 * *foo*bar
26363 *<nowiki>*foo</nowiki>''it''*bar
26364 !!end
26365
26366 !! test
26367 Lists: 4. No escapes needed
26368 !! options
26369 parsoid=html2wt
26370 !! html/parsoid
26371 <ul>
26372 <li>foo*bar
26373 </li>
26374 </ul>
26375 <ul>
26376 <li><i>foo</i>*bar
26377 </li>
26378 </ul>
26379 <ul>
26380 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
26381 </li>
26382 </ul>
26383 <ul>
26384 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
26385 </li>
26386 </ul>
26387 !! wikitext
26388 *foo*bar
26389
26390 *''foo''*bar
26391
26392 *[[Foo]]: bar
26393
26394 *[[Foo]]*bar
26395 !!end
26396
26397 !! test
26398 Lists: 5. No unnecessary escapes
26399 !! options
26400 parsoid=html2wt
26401 !! html/parsoid
26402 <ul><li> bar <span>[[foo]]</span></li></ul>
26403 <ul><li> =bar <span>[[foo]]</span></li></ul>
26404 <ul><li> [[bar <span>[[foo]]</span></li></ul>
26405 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
26406 <ul><li> =bar <span>foo]]</span>=</li></ul>
26407 <ul><li> <s></s>: a</li></ul>
26408 <ul><li> <i>* foo</i></li></ul>
26409
26410 !! wikitext
26411 * bar <span><nowiki>[[foo]]</nowiki></span>
26412
26413 * =bar <span><nowiki>[[foo]]</nowiki></span>
26414
26415 * [[bar <span><nowiki>[[foo]]</nowiki></span>
26416
26417 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
26418
26419 * =bar <span>foo]]</span>=
26420
26421 * <s></s>: a
26422
26423 * ''* foo''
26424 !!end
26425
26426 !! test
26427 Lists: 6. Escape bullets in SOL position
26428 !! options
26429 parsoid=html2wt
26430 !! html/parsoid
26431 <p><!--cmt-->*foo</p>
26432 !! wikitext
26433 <!--cmt--><nowiki>*</nowiki>foo
26434 !!end
26435
26436 !! test
26437 Lists: 7. Escape bullets in a multi-line context
26438 !! options
26439 parsoid=html2wt
26440 !! html/parsoid
26441 <p>a
26442 *b
26443 </p>
26444 !! wikitext
26445 a
26446 <nowiki>*</nowiki>b
26447 !!end
26448
26449 !! test
26450 Lists: 8. Escape colons only if not present in tags
26451 !! options
26452 parsoid=html2wt
26453 !! html/parsoid
26454 <dl><dt>a:b<i>c:d</i></dt></dl>
26455 !! wikitext
26456 ; <nowiki>a:b</nowiki>''c:d''
26457 !! end
26458
26459 #### --------------- HRs ---------------
26460 #### 1. Single line
26461 #### -----------------------------------
26462
26463 !! test
26464 HRs: 1. Single line
26465 !! options
26466 parsoid=html2wt
26467 !! html/parsoid
26468 <hr />----
26469 <hr />=foo=
26470 <hr />*foo
26471 !! wikitext
26472 ----<nowiki>----</nowiki>
26473 ----=foo=
26474 ----*foo
26475 !! end
26476
26477 #### --------------- Tables ---------------
26478 #### 1a. Simple example
26479 #### 1b. No escaping needed (!foo)
26480 #### 1c. No escaping needed (|foo)
26481 #### 1d. No escaping needed (|}foo)
26482 ####
26483 #### 2a. Nested in td (<td>foo|bar</td>)
26484 #### 2b. Nested in td (<td>foo||bar</td>)
26485 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
26486 ####
26487 #### 3a. Nested in th (<th>foo!bar</th>)
26488 #### 3b. Nested in th (<th>foo!!bar</th>)
26489 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
26490 ####
26491 #### 4a. Escape -
26492 #### 4b. Escape +
26493 #### 4c. No escaping needed
26494 #### --------------------------------------
26495
26496 !! test
26497 Tables: 1a. Simple example
26498 !! options
26499 parsoid=html2wt
26500 !! html/parsoid
26501 <p>{|
26502 |}
26503 </p>
26504 !! wikitext
26505 <nowiki>{|</nowiki>
26506 |}
26507 !! end
26508
26509 !! test
26510 Tables: 1b. No escaping needed
26511 !! options
26512 parsoid=html2wt
26513 !! html/parsoid
26514 <p>!foo
26515 </p>
26516 !! wikitext
26517 !foo
26518 !! end
26519
26520 !! test
26521 Tables: 1c. No escaping needed
26522 !! options
26523 parsoid=html2wt
26524 !! html/parsoid
26525 <p>|foo
26526 </p>
26527 !! wikitext
26528 |foo
26529 !! end
26530
26531 !! test
26532 Tables: 1d. No escaping needed
26533 !! options
26534 parsoid=html2wt
26535 !! html/parsoid
26536 <p>|}foo
26537 </p>
26538 !! wikitext
26539 |}foo
26540 !! end
26541
26542 !! test
26543 Tables: 2a. Nested in td
26544 !! options
26545 parsoid=html2wt
26546 !! html/parsoid
26547 <table><tbody><tr>
26548 <td>foo|bar</td></tr>
26549 <tr><td>x<div>a|b</div></td>
26550 </tbody></table>
26551 !! wikitext
26552 {|
26553 |<nowiki>foo|bar</nowiki>
26554 |-
26555 |x<div><nowiki>a|b</nowiki></div>
26556 |}
26557 !! html/php+tidy
26558 <table>
26559 <tbody><tr>
26560 <td>foo|bar
26561 </td></tr>
26562 <tr>
26563 <td>x<div>a|b</div>
26564 </td></tr></tbody></table>
26565 !! end
26566
26567 !! test
26568 Tables: 2b. Nested in td
26569 !! options
26570 parsoid=html2wt
26571 !! html/parsoid
26572 <table><tbody><tr>
26573 <td>foo||bar</td>
26574 <td>a<i>b||c</i></td>
26575 <td>a<i><div>b||c</div></i></td>
26576 </tr></tbody></table>
26577 !! wikitext
26578 {|
26579 |<nowiki>foo||bar</nowiki>
26580 |a''<nowiki>b||c</nowiki>''
26581 |a''<div><nowiki>b||c</nowiki></div>''
26582 |}
26583 !! html/php
26584 <table>
26585 <tr>
26586 <td>foo||bar
26587 </td>
26588 <td>a<i>b||c</i>
26589 </td>
26590 <td>a<i><div>b||c</div></i>
26591 </td></tr></table>
26592
26593 !! end
26594
26595 !! test
26596 Tables: 2c. Nested in td -- no escaping needed
26597 !! options
26598 parsoid=html2wt
26599 !! html/*
26600 <table>
26601 <tr>
26602 <td>foo!!bar
26603 </td></tr></table>
26604
26605 !! wikitext
26606 {|
26607 |foo!!bar
26608 |}
26609 !! end
26610
26611 !! test
26612 Tables: 3a. Nested in th
26613 !! options
26614 parsoid=html2wt
26615 !! html/*
26616 <table>
26617 <tr>
26618 <th>foo!bar
26619 </th></tr></table>
26620
26621 !! wikitext
26622 {|
26623 !foo!bar
26624 |}
26625 !! end
26626
26627 !! test
26628 Tables: 3b. Nested in th
26629 !! options
26630 parsoid=html2wt
26631 !! html/parsoid
26632 <table><tbody>
26633 <tr><th>foo!!bar</th>
26634 <th><i>foo|bar</i></th>
26635 <th><i>foo!!bar</i></th>
26636 <th><i><span>foo!!bar</span></i></th>
26637 </tr></tbody></table>
26638 !! wikitext
26639 {|
26640 !<nowiki>foo!!bar</nowiki>
26641 !''<nowiki>foo|bar</nowiki>''
26642 !''<nowiki>foo!!bar</nowiki>''
26643 !''<span><nowiki>foo!!bar</nowiki></span>''
26644 |}
26645 !! html/php
26646 <table>
26647 <tr>
26648 <th>foo!!bar
26649 </th>
26650 <th><i>foo|bar</i>
26651 </th>
26652 <th><i>foo!!bar</i>
26653 </th>
26654 <th><i><span>foo!!bar</span></i>
26655 </th></tr></table>
26656
26657 !! end
26658
26659 !! test
26660 Tables: 3c. Nested in th
26661 !! options
26662 parsoid=html2wt
26663 !! html/parsoid
26664 <table><tbody>
26665 <tr><th>foo||bar</th>
26666 <th><span typeof="mw:Nowiki">foo||bar</span></th>
26667 </tr></tbody></table>
26668 !! wikitext
26669 {|
26670 !<nowiki>foo||bar</nowiki>
26671 !<nowiki>foo||bar</nowiki>
26672 |}
26673 !! html/php
26674 <table>
26675 <tr>
26676 <th>foo||bar
26677 </th>
26678 <th>foo||bar
26679 </th></tr></table>
26680
26681 !! end
26682
26683 !! test
26684 Tables: 4a. Escape -
26685 !! options
26686 parsoid=html2wt
26687 !! html/*
26688 <table>
26689 <tr>
26690 <th>-bar
26691 </th></tr>
26692 <tr>
26693 <td>-bar
26694 </td></tr></table>
26695
26696 !! wikitext
26697 {|
26698 !-bar
26699 |-
26700 |<nowiki>-bar</nowiki>
26701 |}
26702 !! end
26703
26704 !! test
26705 Tables: 4b. Escape +
26706 !! options
26707 parsoid=html2wt
26708 !! html/*
26709 <table>
26710 <tr>
26711 <th>+bar
26712 </th></tr>
26713 <tr>
26714 <td>+bar
26715 </td></tr></table>
26716
26717 !! wikitext
26718 {|
26719 !+bar
26720 |-
26721 |<nowiki>+bar</nowiki>
26722 |}
26723 !! end
26724
26725 !! test
26726 Tables: 4c. No escaping needed
26727 !! options
26728 parsoid=html2wt
26729 !! html/parsoid
26730 <table><tbody>
26731 <tr><td>foo-bar</td><td>foo+bar</td></tr>
26732 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
26733 <tr><td>foo
26734 <p>bar|baz
26735 +bar
26736 -bar</p></td></tr>
26737 <tr><td>x
26738 <div>a|b</div></td>
26739 </tbody></table>
26740 !! wikitext
26741 {|
26742 |foo-bar
26743 |foo+bar
26744 |-
26745 |''foo''-bar
26746 |''foo''+bar
26747 |-
26748 |foo
26749 bar|baz
26750 +bar
26751 -bar
26752 |-
26753 |x
26754 <div>a|b</div>
26755 |}
26756 !! html/php
26757 <table>
26758 <tr>
26759 <td>foo-bar
26760 </td>
26761 <td>foo+bar
26762 </td></tr>
26763 <tr>
26764 <td><i>foo</i>-bar
26765 </td>
26766 <td><i>foo</i>+bar
26767 </td></tr>
26768 <tr>
26769 <td>foo
26770 <p>bar|baz
26771 +bar
26772 -bar
26773 </p>
26774 </td></tr>
26775 <tr>
26776 <td>x
26777 <div>a|b</div>
26778 </td></tr></table>
26779
26780 !! end
26781
26782 !! test
26783 Tables: 4d. No escaping needed
26784 !! options
26785 parsoid=html2wt
26786 !! html/parsoid
26787 <table>
26788 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
26789 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
26790 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
26791 </tbody></table>
26792 !! wikitext
26793 {|
26794 |[[Foo]]-bar
26795 ||+1
26796 ||-2
26797 |}
26798 !! html/php
26799 <table>
26800 <tr>
26801 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
26802 </td>
26803 <td>+1
26804 </td>
26805 <td>-2
26806 </td></tr></table>
26807
26808 !! end
26809
26810 !! test
26811 Tables: 5. Empty table cells should get whitespace to avoid need for nowikis
26812 !! options
26813 parsoid=html2wt
26814 !! html/parsoid
26815 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26816
26817 <table><tr><td></td><td align="center"></td><td></td></tr></table>
26818
26819 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26820
26821 <table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table>
26822 !! wikitext
26823 {|
26824 | || align="center" | ||
26825 |}
26826
26827 {|
26828 |
26829 | align="center" |
26830 |
26831 |}
26832
26833 {|
26834 | {{!}}{{!}} align="center" | ||
26835 |}
26836
26837 {|
26838 ! !! align="center" | !!
26839 |}
26840 !! html/php+tidy
26841 <table>
26842 <tbody><tr>
26843 <td></td>
26844 <td align="center"></td>
26845 <td>
26846 </td></tr></tbody></table>
26847 <table>
26848 <tbody><tr>
26849 <td>
26850 </td>
26851 <td align="center">
26852 </td>
26853 <td>
26854 </td></tr></tbody></table>
26855 <table>
26856 <tbody><tr>
26857 <td></td>
26858 <td align="center"></td>
26859 <td>
26860 </td></tr></tbody></table>
26861 <table>
26862 <tbody><tr>
26863 <th></th>
26864 <th align="center"></th>
26865 <th>
26866 </th></tr></tbody></table>
26867 !! end
26868
26869 !! test
26870 T97430: Don't emit empty nowiki pairs around marker meta tags
26871 !! options
26872 parsoid=html2wt
26873 !! html/parsoid
26874 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26875 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
26876 !! wikitext
26877 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26878 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
26879 !! end
26880
26881 !! test
26882 Unclosed xmlish element in table line shouldn't eat end delimiters
26883 !! options
26884 parsoid=html2wt
26885 !! html/parsoid
26886 <table>
26887 <tbody><tr><td> &lt;foo</td>
26888 <td> bar></td></tr>
26889 </tbody></table>
26890 !! wikitext
26891 {|
26892 | <foo
26893 | bar>
26894 |}
26895 !! html/php
26896 <table>
26897 <tr>
26898 <td>&lt;foo
26899 </td>
26900 <td>bar&gt;
26901 </td></tr></table>
26902
26903 !! end
26904
26905 #### --------------- Links ----------------
26906 #### 1. Quote marks in link text
26907 #### 2. Wikilinks: Escapes needed
26908 #### 3. Wikilinks: No escapes needed
26909 #### 4. Extlinks: Escapes needed
26910 #### 5. Extlinks: No escapes needed
26911 #### --------------------------------------
26912 !! test
26913 Links 1. WikiLinks: No escapes needed
26914 !! options
26915 parsoid=html2wt
26916 !! html/parsoid
26917 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
26918 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
26919 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
26920 !! wikitext
26921 [[Foo|Foo''boo'']]
26922 [[Foo|[Foobar]]]
26923 [[Foo|x [Foobar] x]]
26924 !! html/php
26925 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
26926 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
26927 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
26928 </p>
26929 !! end
26930
26931 !! test
26932 Links 2. WikiLinks: Escapes needed
26933 !! options
26934 parsoid=html2wt
26935 !! html/parsoid
26936 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
26937 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
26938 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
26939 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
26940 <a href="Foo" rel="mw:WikiLink">|Bar</a>
26941 <a href="Foo" rel="mw:WikiLink">]]bar</a>
26942 <a href="Foo" rel="mw:WikiLink">[[bar</a>
26943 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
26944 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
26945 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
26946 !! wikitext
26947 [[Foo|<nowiki>Foobar]</nowiki>]]
26948 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
26949 [[Foo|<nowiki>[[Bar]]</nowiki>]]
26950 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
26951 [[Foo|<nowiki>|Bar</nowiki>]]
26952 [[Foo|<nowiki>]]bar</nowiki>]]
26953 [[Foo|<nowiki>[[bar</nowiki>]]
26954 [[Foo|<nowiki>x [[ y</nowiki>]]
26955 [[Foo|<nowiki>x ]] y</nowiki>]]
26956 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
26957 !! html/php
26958 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
26959 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
26960 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
26961 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
26962 <a href="/wiki/Foo" title="Foo">|Bar</a>
26963 <a href="/wiki/Foo" title="Foo">]]bar</a>
26964 <a href="/wiki/Foo" title="Foo">[[bar</a>
26965 <a href="/wiki/Foo" title="Foo">x [[ y</a>
26966 <a href="/wiki/Foo" title="Foo">x ]] y</a>
26967 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
26968 </p>
26969 !! end
26970
26971 !! test
26972 Links 3. WikiLinks: No escapes needed
26973 !! options
26974 parsoid=html2wt
26975 !! html/parsoid
26976 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
26977 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
26978 !! wikitext
26979 [[Foo|[Foobar]]
26980 [[Foo|foo|bar]]
26981 !! html/php
26982 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
26983 <a href="/wiki/Foo" title="Foo">foo|bar</a>
26984 </p>
26985 !! end
26986
26987 !! test
26988 Links 4. ExtLinks: Escapes needed
26989 !! options
26990 parsoid=html2wt
26991 !! html/parsoid
26992 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
26993 <a rel="mw:ExtLink" href="http://google.com">google]</a>
26994 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
26995 <p>[http://google.com]</p>
26996 <p>[http://google.com google]</p>
26997 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
26998 <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>
26999 !! wikitext
27000 [http://google.com <nowiki>[google]</nowiki>]
27001 [http://google.com <nowiki>google]</nowiki>]
27002 [http://google.com <nowiki>goog] le</nowiki>]
27003
27004 <nowiki>[http://google.com]</nowiki>
27005
27006 <nowiki>[http://google.com google]</nowiki>
27007
27008 [http://google.com<nowiki>]</nowiki>
27009
27010 [{{echo|http://google.com}}<nowiki>]</nowiki>
27011 !! html/php
27012 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
27013 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
27014 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
27015 </p><p>[http://google.com]
27016 </p><p>[http://google.com google]
27017 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
27018 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
27019 </p>
27020 !! end
27021
27022 !! test
27023 Links 5. ExtLinks: No escapes needed
27024 !! options
27025 parsoid=html2wt
27026 !! html/parsoid
27027 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
27028 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
27029 !! wikitext
27030 [http://google.com [google]
27031
27032 [[http://google.com]]
27033 !! html/php
27034 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
27035 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
27036 </p>
27037 !! end
27038
27039 !! test
27040 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
27041 !! options
27042 parsoid=html2wt
27043 !! html/parsoid
27044 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
27045 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
27046 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
27047 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
27048 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
27049 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
27050 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
27051 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
27052 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
27053 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
27054 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
27055 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
27056 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
27057 </p>
27058 !! wikitext
27059 x<nowiki/>http://example.com<nowiki/>y
27060 http://example.com<nowiki/>?x
27061 http://example.com<nowiki/>&x
27062 http://example.com<nowiki/>'x
27063 http://example.com<nowiki/>,x
27064 http://example.com<nowiki/>.x
27065 http://example.com<nowiki/>;x
27066 http://example.com<nowiki/>:x
27067 http://example.com<nowiki/>;x
27068 http://example.com<nowiki/>!x
27069 http://example.com<nowiki/>=x
27070 http://example.com<nowiki/>(x)
27071 http://example.com(x<nowiki/>)
27072 !! end
27073
27074 !! test
27075 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
27076 !! options
27077 parsoid=html2wt
27078 !! html/parsoid
27079 <p>x
27080 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
27081 y
27082 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
27083 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
27084 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
27085 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
27086 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
27087 </p>
27088 !! wikitext
27089 x
27090 http://example.com
27091 y
27092 "http://example.com"
27093 (http://example.com)
27094 (http://example.com) foo
27095 http://example.com,
27096 http://example.com, foo
27097 !! html/php
27098 <p>x
27099 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
27100 y
27101 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
27102 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
27103 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
27104 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
27105 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
27106 </p>
27107 !! end
27108
27109 !! test
27110 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
27111 !! options
27112 parsoid=html2wt
27113 !! html/parsoid
27114 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
27115 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
27116 !! wikitext
27117 http://example.com.,;:!?\
27118 -http://example.com:
27119 !! html/php
27120 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
27121 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
27122 </p>
27123 !! end
27124
27125 !! test
27126 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
27127 !! options
27128 parsoid=html2wt
27129 !! html/parsoid
27130 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
27131 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
27132 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
27133 !! wikitext
27134 RFC 123<nowiki/>4
27135 RFC 123<nowiki/>y
27136 X<nowiki/>RFC 123<nowiki/>y
27137 !! end
27138
27139 !! test
27140 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
27141 !! options
27142 parsoid=html2wt
27143 !! html/parsoid
27144 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
27145 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
27146 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
27147 </p>
27148 !! wikitext
27149 RFC 123?foo
27150 RFC 123&foo
27151 -RFC 123-
27152 !! html/php
27153 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
27154 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
27155 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
27156 </p>
27157 !! end
27158
27159 !! test
27160 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
27161 !! options
27162 parsoid=html2wt
27163 !! html/parsoid
27164 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
27165 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
27166 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
27167 !! wikitext
27168 PMID 123<nowiki/>4
27169 PMID 123<nowiki/>y
27170 X<nowiki/>PMID 123<nowiki/>y
27171 !! end
27172
27173 !! test
27174 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
27175 !! options
27176 parsoid=html2wt
27177 !! html/parsoid
27178 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
27179 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
27180 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
27181 </p>
27182 !! wikitext
27183 PMID 123?foo
27184 PMID 123&foo
27185 -PMID 123-
27186 !! html/php
27187 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
27188 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
27189 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
27190 </p>
27191 !! end
27192
27193 !! test
27194 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
27195 !! options
27196 parsoid=html2wt
27197 !! html/parsoid
27198 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
27199 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
27200 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
27201 </p>
27202 !! wikitext
27203 ISBN 1234567890<nowiki/>1
27204 ISBN 1234567890<nowiki/>x
27205 a<nowiki/>ISBN 1234567890<nowiki/>b
27206 !! end
27207
27208 !! test
27209 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
27210 !! options
27211 parsoid=html2wt
27212 !! html/parsoid
27213 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
27214 !! wikitext
27215 -ISBN 1234567890's
27216 !! html/php
27217 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
27218 </p>
27219 !! end
27220
27221 !! test
27222 Links 14. Protect link-like plain text. (Parsoid bug T78425)
27223 !! options
27224 parsoid=html2wt
27225 !! html/*
27226 <p>this is not a link: http://example.com
27227 </p>
27228 !! wikitext
27229 this is not a link: <nowiki>http://example.com</nowiki>
27230 !! end
27231
27232 !! test
27233 Links 15. Link trails can't become link prefixes.
27234 !! options
27235 language=is
27236 parsoid=html2wt
27237 !! html/parsoid
27238 <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>
27239 !! wikitext
27240 [[Söfnuður]]-[[00]]
27241 !! html/php
27242 <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>
27243 </p>
27244 !! end
27245
27246 #### --------------- Quotes ---------------
27247 #### 1. Quotes inside <b> and <i>
27248 #### 2. Link fragments separated by <i> and <b> tags
27249 #### 3. Link fragments inside <i> and <b>
27250 #### 4. No escaping needed
27251 #### --------------------------------------
27252 !! test
27253 1a. Quotes inside <b> and <i>
27254 !! options
27255 parsoid=html2wt
27256 !! html/*
27257 <p><i>'foo'</i>
27258 <i>''foo''</i>
27259 <i>'''foo'''</i>
27260 <i>foo</i>'s
27261 <b>'foo'</b>
27262 <b>''foo''</b>
27263 <b>'''foo'''</b>
27264 <b>foo'<i>bar'</i>baz</b>
27265 <b>foo</b>'s
27266 '<i>foo</i>
27267 <i>foo</i>'
27268 <i>foo'</i>'
27269 '<i>foo</i>'
27270 '<b>foo</b>
27271 <b>foo</b>'
27272 '<b>foo</b>'
27273 <i>fools'<span> errand</span></i>
27274 <i><span>fool</span>'s errand</i>
27275 '<i>foo</i> bar '<i>baz</i>
27276 a|!*#-:;+-~[]{}b'<i>x</i>
27277 </p>
27278 !! wikitext
27279 ''<nowiki/>'foo'''
27280 ''<nowiki>''foo''</nowiki>''
27281 ''<nowiki>'''foo'''</nowiki>''
27282 ''foo''<nowiki/>'s
27283 '''<nowiki/>'foo''''
27284 '''<nowiki>''foo''</nowiki>'''
27285 '''<nowiki>'''foo'''</nowiki>'''
27286 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
27287 '''foo'''<nowiki/>'s
27288 '''foo''
27289 ''foo''<nowiki/>'
27290 ''foo'''<nowiki/>'
27291 '''foo''<nowiki/>'
27292 ''''foo'''
27293 '''foo'''<nowiki/>'
27294 ''''foo'''<nowiki/>'
27295 ''fools'<span> errand</span>''
27296 ''<span>fool</span>'s errand''
27297 '<nowiki/>''foo'' bar '''baz''
27298 a|!*#-:;+-~[]{}b'''x''
27299 !! end
27300
27301 !! test
27302 1b. Quotes inside <b> and <i> with other tags on same line
27303 !! options
27304 parsoid=html2wt
27305 !! html/parsoid
27306 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
27307 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
27308 <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>
27309 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
27310 '<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>
27311 '<i>foo</i> <div title="name">test</div>
27312 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
27313 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
27314 <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>
27315 </ol>
27316 !! wikitext
27317 '''a'' foo ''[[bar]]''
27318 ''a''' foo ''[[bar]]''
27319 ''a''' foo '''{{echo|[[bar]]}}'''
27320 [[foo]] x'''[[bar]]''
27321 '''foo'' <ref>test</ref>
27322 '''foo'' <div title="name">test</div>
27323 '''foo'' and <br> bar
27324 <references />
27325 !! end
27326
27327 !! test
27328 2. Link fragments separated by <i> and <b> tags
27329 !! options
27330 parsoid=html2wt
27331 !! html/parsoid
27332 <p>[[<i>foo</i>hello]]</p>
27333 <p>[[<b>foo</b>hello]]</p>
27334 !! wikitext
27335 [[''foo''<nowiki>hello]]</nowiki>
27336
27337 [['''foo'''<nowiki>hello]]</nowiki>
27338 !! end
27339
27340 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
27341 # this is one of the shortcomings of this format
27342 !! test
27343 3. Link fragments inside <i> and <b>
27344 !! options
27345 parsoid=html2wt
27346 !! html/parsoid
27347 <p><i>[[foo</i>]]</p>
27348 <p><b>[[foo</b>]]</p>
27349 !! wikitext
27350 ''[[foo''<nowiki>]]</nowiki>
27351
27352 '''[[foo'''<nowiki>]]</nowiki>
27353 !! end
27354
27355 !! test
27356 4. No escaping needed
27357 !! options
27358 parsoid=html2wt
27359 !! html/parsoid
27360 <p>'<span><i>bar</i></span>'
27361 '<span><b>bar</b></span>'
27362 'a:b'foo
27363 </p>
27364 !! wikitext
27365 '<span>''bar''</span>'
27366 '<span>'''bar'''</span>'
27367 'a:b'foo
27368 !! end
27369
27370 #### ----------- Paragraphs ---------------
27371 #### 1. No unnecessary escapes
27372 #### --------------------------------------
27373
27374 !! test
27375 1. No unnecessary escapes
27376 !! options
27377 parsoid=html2wt
27378 !! html/parsoid
27379 <p>bar <span>[[foo]]</span>
27380 </p><p>=bar <span>[[foo]]</span>
27381 </p><p>[[bar <span>[[foo]]</span>
27382 </p><p>]]bar <span>[[foo]]</span>
27383 </p><p>=bar <span>foo]]</span>=
27384 </p>
27385 !! wikitext
27386 bar <span><nowiki>[[foo]]</nowiki></span>
27387
27388 =bar <span><nowiki>[[foo]]</nowiki></span>
27389
27390 [[bar <span><nowiki>[[foo]]</nowiki></span>
27391
27392 ]]bar <span><nowiki>[[foo]]</nowiki></span>
27393
27394 =bar <span>foo]]</span><nowiki>=</nowiki>
27395 !!end
27396
27397 #### ----------------------- PRE --------------------------
27398 !! test
27399 1. Leading whitespace in SOL context should be escaped
27400 !! options
27401 parsoid=html2wt
27402 !! html/parsoid
27403 <p> a</p>
27404
27405 <p> a</p>
27406
27407 <p> a(tab)</p>
27408
27409 <p> a
27410 <!--cmt-->
27411 a</p>
27412
27413 <p>a
27414 b</p>
27415
27416 <p>a
27417 b</p>
27418
27419 <p>a
27420 b</p>
27421 !! wikitext
27422 <nowiki> </nowiki>a
27423
27424 <nowiki> </nowiki> a
27425
27426 a(tab)
27427
27428 <nowiki> </nowiki> a
27429 <!--cmt-->
27430 <nowiki> </nowiki>a
27431
27432 a
27433 <nowiki> </nowiki>b
27434
27435 a
27436 b
27437
27438 a
27439 b
27440 !! html/php
27441 <p> a
27442 </p><p> a
27443 </p><p> a(tab)
27444 </p><p> a
27445 a
27446 </p><p>a
27447 b
27448 </p><p>a
27449 b
27450 </p><p>a
27451 b
27452 </p>
27453 !! end
27454
27455 !! test
27456 2. Leading whitespace in non-indent-pre contexts should not be escaped
27457 !! options
27458 parsoid=html2wt
27459 !! html/parsoid
27460 <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>
27461 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
27462 <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>
27463 b</span></li>
27464 </ol>
27465 !! wikitext
27466 foo <ref>''a''
27467 b</ref>
27468 <references />
27469 !! end
27470
27471 !! test
27472 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
27473 !! options
27474 parsoid=html2wt
27475 !! html/parsoid
27476 <blockquote>
27477 <p>
27478 a
27479 <span>b</span>
27480 c</p>
27481 </blockquote>
27482 !! wikitext
27483 <blockquote>
27484 a
27485 <span>b</span>
27486 c
27487 </blockquote>
27488 !! end
27489
27490 !! test
27491 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
27492 !! options
27493 parsoid=html2wt
27494 !! html/parsoid
27495 <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>
27496 !! wikitext
27497 [[File:Foobar.jpg|thumb|caption]]
27498 !! end
27499
27500 !! test
27501 5. Nowiki escaping should account for indent-pres
27502 !! options
27503 parsoid=html2wt
27504 !! html/parsoid
27505 <pre>==foo==</pre>
27506 !! wikitext
27507 ==foo==
27508 !! end
27509
27510 !! test
27511 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
27512 !! options
27513 parsoid=html2wt
27514 !! html/parsoid
27515 <pre>
27516 * foo
27517 * bar
27518 </pre>
27519 !! wikitext
27520 * foo
27521 * bar
27522 !! end
27523
27524 !! test
27525 Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup
27526 !! options
27527 parsoid = {
27528 "modes": ["html2wt"],
27529 "scrubWikitext": true
27530 }
27531 !! html/parsoid
27532 <p> foo</p>
27533 <p> %foo</p>
27534 <p> *foo</p>
27535 <p> #foo</p>
27536 <p> =foo=</p>
27537 <p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p>
27538 <p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p>
27539 <p> <!--boo-->*foo</p>
27540 <p><!--boo--> *foo</p>
27541 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p>
27542 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p>
27543 !! wikitext
27544 foo
27545
27546 %foo
27547
27548 <nowiki/>*foo
27549
27550 <nowiki/>#foo
27551
27552 <nowiki/>=foo=
27553
27554 [[Category:Foo]]
27555 <nowiki/>*foo
27556
27557 [[Category:Foo]]
27558 <nowiki>*</nowiki>foo
27559
27560 <nowiki/><!--boo-->*foo
27561
27562 <!--boo--><nowiki/>*foo
27563
27564 <!--a--><!--b--><!--c--><!--d--><!--e-->foo
27565
27566 <!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo
27567 !! end
27568
27569 #### --------------- Behavior Switches --------------------
27570
27571 !! test
27572 1. Valid behavior switches should be escaped
27573 !! options
27574 parsoid=html2wt
27575 !! html/parsoid
27576 __TOC__
27577 <i>__TOC__</i>
27578 !! wikitext
27579 <nowiki>__TOC__</nowiki>
27580 ''<nowiki>__TOC__</nowiki>''
27581 !! end
27582
27583 !! test
27584 2. Invalid behavior switches should not be escaped
27585 !! options
27586 parsoid=html2wt
27587 !! html/parsoid
27588 __TOO__
27589 __|__
27590 !! wikitext
27591 __TOO__
27592 __|__
27593 !! end
27594
27595 # We use indent-pre as an indirect way to test for sol-transparent behavior.
27596 !! test
27597 Behavior switches should be SOL-transparent
27598 !! options
27599 parsoid=html2wt
27600 !! html/parsoid
27601 <meta property="mw:PageProp/toc" />
27602
27603 <!-- this one's bogus -->
27604 <pre>__TOO__</pre>
27605
27606 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
27607
27608 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
27609 !! wikitext
27610 __TOC__
27611
27612 <!-- this one's bogus -->
27613 __TOO__
27614
27615 __TOC__ foo
27616
27617 __TOC__
27618 bar
27619 !! end
27620
27621 #### --------------- HTML tags ---------------
27622 #### 1. a tags
27623 #### 2. other tags
27624 #### 3. multi-line html tag
27625 #### 4. extension tags
27626 #### -----------------------------------------
27627 !! test
27628 1. a tags
27629 !! options
27630 parsoid=html2wt
27631 !! html/parsoid
27632 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
27633 !! wikitext
27634 <a href="http://google.com">google</a>
27635 !! end
27636
27637 !! test
27638 2. other tags
27639 !! options
27640 parsoid=html2wt
27641 !! html/parsoid
27642 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
27643 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
27644 <li> &lt;td&gt;</li></ul>
27645
27646 !! wikitext
27647 * <nowiki><div>foo</div></nowiki>
27648 * <nowiki><div style="color:red">foo</div></nowiki>
27649 * <nowiki><td></nowiki>
27650 !! end
27651
27652 !! test
27653 3. multi-line html tag
27654 !! options
27655 parsoid=html2wt
27656 !! html/parsoid
27657 <p>&lt;div
27658 &gt;foo&lt;/div
27659 &gt;
27660 </p>
27661 !! wikitext
27662 <nowiki><div
27663 >foo</div
27664 ></nowiki>
27665 !! end
27666
27667 !! test
27668 4. extension tags
27669 !! options
27670 parsoid=html2wt
27671 !! html/parsoid
27672 <p>&lt;ref&gt;foo&lt;/ref&gt;
27673 </p><p>&lt;ref&gt;bar
27674 </p><p>baz&lt;/ref&gt;
27675 </p>
27676 !! wikitext
27677 <nowiki><ref>foo</ref></nowiki>
27678
27679 <nowiki><ref>bar</nowiki>
27680
27681 baz<nowiki></ref></nowiki>
27682 !! end
27683
27684 !! test
27685 Parsoid: newline inducing block nodes don't suppress <nowiki>
27686 !! options
27687 parsoid=html2wt
27688 !! html/parsoid
27689 a<h1>foo</h1>
27690 !! wikitext
27691 <nowiki> </nowiki>a
27692
27693 = foo =
27694 !! end
27695
27696 #### --------------- Others ---------------
27697 !! test
27698 Escaping nowikis
27699 !! options
27700 parsoid=html2wt
27701 !! html/parsoid
27702 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
27703 </p>
27704 !! wikitext
27705 &lt;nowiki&gt;foo&lt;/nowiki&gt;
27706 !! end
27707
27708 ## The quote-char in the input is necessary for triggering the bug
27709 !! test
27710 (T54035) Nowiki-escaping should not get tripped by " :" in text
27711 !! options
27712 parsoid=html2wt
27713 !! html/parsoid
27714 <p>foo's bar :</p>
27715 !! wikitext
27716 foo's bar :
27717 !! end
27718
27719 #----------- End of wikitext escaping tests --------------
27720
27721 !! test
27722
27723 Tag-like HTML structures are passed through as text
27724 !! wikitext
27725 <x y>
27726
27727 <x.y>
27728
27729 <x-y>
27730
27731 1>2
27732
27733 x<y
27734
27735 a>b
27736
27737 1<d e>f
27738 !! html
27739 <p>&lt;x y&gt;
27740 </p><p>&lt;x.y&gt;
27741 </p><p>&lt;x-y&gt;
27742 </p><p>1&gt;2
27743 </p><p>x&lt;y
27744 </p><p>a&gt;b
27745 </p><p>1&lt;d e&gt;f
27746 </p>
27747 !! end
27748
27749 !! test
27750 HTML tag with necessary entities in attributes
27751 !! wikitext
27752 <span title="&amp;amp;">foo</span>
27753 !! html
27754 <p><span title="&amp;amp;">foo</span>
27755 </p>
27756 !! end
27757
27758 !! test
27759 HTML tag with 'unnecessary' entity encoding in attributes
27760 !! wikitext
27761 <span title="&amp;">foo</span>
27762 !! html
27763 <p><span title="&amp;">foo</span>
27764 </p>
27765 !! end
27766
27767 !! test
27768 HTML tag with broken attribute value quoting
27769 !! options
27770 parsoid=wt2html,html2html
27771 !! wikitext
27772 <span title="Hello world>Foo</span>
27773 !! html/php
27774 <p><span title="Hello world">Foo</span>
27775 </p>
27776 !! html/parsoid
27777 <p><span title="Hello world">Foo</span></p>
27778 !! end
27779
27780 !! test
27781 Self-closed tag with broken attribute value quoting
27782 !! options
27783 parsoid=wt2html,html2html
27784 !! wikitext
27785 <div title="Hello world />Foo
27786 !! html/php+tidy
27787 <div title="Hello world"></div><p>Foo
27788 </p>
27789 !! html/parsoid
27790 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
27791 !! end
27792
27793 !! test
27794 Table with broken attribute value quoting
27795 !! options
27796 parsoid=wt2html,html2html
27797 !! wikitext
27798 {|
27799 | title="Hello world|Foo
27800 |}
27801 !! html/php
27802 <table>
27803 <tr>
27804 <td title="Hello world">Foo
27805 </td></tr></table>
27806
27807 !! html/parsoid
27808 <table>
27809 <tr>
27810 <td title="Hello world">Foo
27811 </td></tr></table>
27812
27813 !! end
27814
27815 !! test
27816 Table with broken attribute value quoting on consecutive lines
27817 !! options
27818 parsoid=wt2html,html2html
27819 !! wikitext
27820 {|
27821 | title="Hello world|Foo
27822 | style="color:red|Bar
27823 |}
27824 !! html/php
27825 <table>
27826 <tr>
27827 <td title="Hello world">Foo
27828 </td>
27829 <td style="color:red">Bar
27830 </td></tr></table>
27831
27832 !! html/parsoid
27833 <table><tbody>
27834 <tr>
27835 <td title="Hello world">Foo
27836 </td><td style="color: red">Bar
27837 </td></tr></tbody></table>
27838
27839 !! end
27840
27841 !!test
27842 Accept empty td cell attribute
27843 !! wikitext
27844 {|
27845 | align="center" |foo|| |
27846 |}
27847 !! html
27848 <table>
27849 <tr>
27850 <td align="center">foo</td>
27851 <td>
27852 </td></tr></table>
27853
27854 !!end
27855
27856 !!test
27857 Non-empty attributes in th-cells
27858 !! wikitext
27859 {|
27860 !Foo!! style="color: red" |Bar
27861 |}
27862 !! html
27863 <table>
27864 <tr>
27865 <th>Foo</th>
27866 <th style="color: red">Bar
27867 </th></tr></table>
27868
27869 !!end
27870
27871 !!test
27872 Accept empty attributes in th-cells
27873 !! wikitext
27874 {|
27875 !|foo!!|bar
27876 |}
27877 !! html
27878 <table>
27879 <tr>
27880 <th>foo</th>
27881 <th>bar
27882 </th></tr></table>
27883
27884 !!end
27885
27886 !!test
27887 Empty table rows go away
27888 !! wikitext
27889 {|
27890 |Hello
27891 |there
27892 |- class="foo"
27893 |-
27894 |}
27895 !! html
27896 <table>
27897 <tr>
27898 <td>Hello
27899 </td>
27900 <td>there
27901 </td></tr>
27902
27903 </table>
27904
27905 !! end
27906
27907 ###
27908 ### Parsoid-centric tests for testing RTing of inter-element separators
27909 ### Edge cases not tested by existing parser tests and specific to
27910 ### Parsoid-specific serialization strategies.
27911 ###
27912
27913 !!test
27914 RT-ed inter-element separators should be valid separators
27915 !! wikitext
27916 {|
27917 |- [[foo]]
27918 |}
27919 !! html/php
27920 <table>
27921
27922 </table>
27923
27924 !! html/parsoid
27925 <table>
27926 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
27927 </tbody></table>
27928 !!end
27929
27930 # Parsoid-only test of a DOM pass
27931 !!test
27932 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
27933 !! wikitext
27934 {|
27935 |<small>foo
27936 bar
27937 |}
27938
27939 {|
27940 |<small>foo<small>
27941 |}
27942 !! html/parsoid
27943 <table>
27944 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
27945 <p>bar</p></small></td></tr>
27946 </tbody></table>
27947
27948 <table>
27949 <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>
27950 </tbody></table>
27951 !!end
27952
27953 # Note that the "style" attribute is really a template parameter here.
27954 # The = would have to be {{=}} if you wanted the literal.
27955 !!test
27956 Empty TD followed by TD with tpl-generated attribute
27957 !! wikitext
27958 {|
27959 |-
27960 |
27961 |{{echo|style='color:red'}}|foo
27962 |}
27963 !! html
27964 <table>
27965
27966 <tr>
27967 <td>
27968 </td>
27969 <td>foo
27970 </td></tr></table>
27971
27972 !!end
27973
27974 !!test
27975 Indented table with an empty td
27976 !! wikitext
27977 {|
27978 |-
27979 |
27980 |foo
27981 |}
27982 !! html
27983 <table>
27984
27985 <tr>
27986 <td>
27987 </td>
27988 <td>foo
27989 </td></tr></table>
27990
27991 !!end
27992
27993 !! test
27994 Indented table with blank lines in between (T85627)
27995 !! wikitext
27996 {|
27997 |foo
27998
27999
28000 |}
28001 !! html/php
28002 <table>
28003 <tr>
28004 <td>foo
28005 <p><br />
28006 </p>
28007 </td></tr></table>
28008
28009 !! html/parsoid
28010 <table>
28011 <tbody><tr><td>foo
28012 <p>
28013 <br /></p></td></tr>
28014 </tbody></table>
28015 !! end
28016
28017 !!test
28018 Indented block & table
28019 !! wikitext
28020 <div>foo</div>
28021 {|
28022 |foo
28023 |}
28024 !! html/php
28025 <div>foo</div>
28026 <table>
28027 <tr>
28028 <td>foo
28029 </td></tr></table>
28030
28031 !! html/parsoid
28032 <div data-parsoid='{"stx":"html"}'>foo</div>
28033 <table><tbody>
28034 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
28035 </tbody></table>
28036 !!end
28037
28038 !! test
28039 Indent and comment before table row
28040 !! wikitext
28041 {|
28042 <!--hi-->|-
28043 |there
28044 |}
28045 !! html/php
28046 <table>
28047
28048 <tr>
28049 <td>there
28050 </td></tr></table>
28051
28052 !! html/parsoid
28053 <table>
28054 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
28055 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
28056 </tbody></table>
28057 !! end
28058
28059 # PHP parser omits empty TR
28060 !!test
28061 Empty TR followed by a template-generated TR
28062 !! wikitext
28063 {|
28064 |-
28065 {{echo|<tr><td>foo</td></tr>}}
28066 |}
28067 !! html/php+tidy
28068 <table>
28069
28070 <tbody><tr><td>foo</td></tr>
28071 </tbody></table>
28072 !! html/parsoid
28073 <table>
28074 <tbody>
28075 <tr class='mw-empty-elt'></tr>
28076 <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}}]}'>
28077 <td>foo</td></tr>
28078 </tbody></table>
28079 !!end
28080
28081 ## PHP and parsoid output differ for this; as usual PHP omits empty
28082 ## elements, and since it strips the comments the TR is empty.
28083 !!test
28084 Empty TR followed by mixed-ws-comment line should RT correctly
28085 !! wikitext
28086 {|
28087 |-
28088 <!--c-->
28089 |-
28090 <!--c--> <!--d-->
28091 |}
28092 !! html/php+tidy
28093 <table>
28094
28095
28096 </table>
28097 !! html/parsoid
28098 <table>
28099 <tbody>
28100 <tr class='mw-empty-elt'></tr>
28101 <!--c-->
28102 <tr>
28103 <!--c--> </tr><!--d-->
28104 </tbody></table>
28105
28106 !!end
28107
28108 !!test
28109 Multi-line image caption generated by templates with/without trailing newlines
28110 !! wikitext
28111 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
28112 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
28113 !! html/parsoid
28114 <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>
28115 <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>
28116 !!end
28117
28118 !! test
28119 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
28120 !! options
28121 parsoid=html2wt
28122 !! html/parsoid
28123 <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>
28124
28125 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
28126 !! wikitext
28127 <includeonly>foo</includeonly>
28128 new para
28129
28130 [[Category:Foo]]
28131
28132 = new heading =
28133 !! end
28134
28135 ## PHP emits broken html for this, and since this is primarily
28136 ## a Parsoid serializer test, marking this Parsoid only
28137 !!test
28138 Improperly nested inline or quotes tags with whitespace in between
28139 !! wikitext
28140 <span> <s>x</span> </s>
28141 ''' ''x''' ''
28142 !! html/parsoid
28143 <p><span> <s>x</s></span><s> </s>
28144 <b> <i>x</i></b><i> </i>
28145 </p>
28146 !!end
28147
28148 !!test
28149 Encapsulate protected attributes from wt
28150 !! wikitext
28151 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
28152
28153 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
28154 |ok
28155 |}
28156 !! html/parsoid
28157 <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>
28158
28159 <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">
28160 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'>ok</td></tr>
28161 </tbody></table>
28162 !!end
28163
28164 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
28165 ## Having nested or stray pre tags results in the attempt to add duplicates,
28166 ## causing an assertion fail. This test tries to prevent that situation.
28167 !! test
28168 Ensure ParagraphWrapper can deal with stray closing pre tags
28169 !! options
28170 parsoid=wt2html
28171 !! wikitext
28172 plain text</pre>
28173 !! html/parsoid
28174 <p>plain text</p>
28175 !! end
28176
28177 ## Remex doesn't account for fostered content.
28178 !! test
28179 1. Ensure fostered text content is wrapped in element nodes
28180 !! options
28181 parsoid=wt2html
28182 !! wikitext
28183 <table>hi</table><table>ho</table>
28184 !! html/php+tidy
28185 hi<table></table>ho<table></table>
28186 !! html/parsoid
28187 <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>
28188 !! end
28189
28190 ## Remex doesn't account for fostered content.
28191 !! test
28192 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
28193 !! options
28194 parsoid=wt2html,wt2wt
28195 !! wikitext
28196 <table>
28197 <tr> || ||
28198 <td> a
28199 </table>
28200 !! html/php+tidy
28201 || ||
28202 <table>
28203 <tbody><tr><td> a
28204 </td></tr></tbody></table>
28205 !! html/parsoid
28206 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||</p>
28207 <table data-parsoid='{"stx":"html"}'>
28208 <tbody><tr data-parsoid='{"stx":"html","autoInsertedEnd":true}'><td data-parsoid='{"stx":"html","autoInsertedEnd":true}'> a
28209 </td></tr></tbody></table>
28210 !! end
28211
28212 ## Remex doesn't account for fostered content.
28213 !! test
28214 Encapsulation properly handles null DSR information from foster box
28215 !! options
28216 parsoid=wt2html,wt2wt
28217 !! wikitext
28218 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
28219 !! html/parsoid
28220 <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>
28221 !! end
28222
28223 ## Remex doesn't account for fostered content.
28224 !! test
28225 1. Encapsulate foster-parented transclusion content
28226 !! options
28227 parsoid=wt2wt,wt2html
28228 !! wikitext
28229 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
28230 !! html/php+tidy
28231 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
28232 !! html/parsoid
28233 <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>
28234 !! end
28235
28236 !! test
28237 2. Encapsulate foster-parented transclusion content
28238 !! options
28239 parsoid=wt2wt,wt2html
28240 !! wikitext
28241 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
28242 !! html/parsoid
28243 <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>
28244 <table>
28245 <tbody>
28246 <tr>
28247 <td>bar</td>
28248 </tr>
28249 </tbody>
28250 </table>
28251 !! end
28252
28253 !! test
28254 3. Encapsulate foster-parented transclusion content
28255 !! options
28256 parsoid=wt2wt,wt2html
28257 !! wikitext
28258 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
28259 !! html/parsoid
28260 <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;]}">
28261 <p>foo</p>
28262 </div>
28263 <table>
28264 <tbody>
28265 <tr>
28266 <td>bar</td>
28267 </tr>
28268 </tbody>
28269 </table>
28270 !! end
28271
28272 !! test
28273 4. Encapsulate foster-parented transclusion content
28274 !! options
28275 parsoid=wt2wt,wt2html
28276 !! wikitext
28277 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
28278 !! html/parsoid
28279 <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;]}">
28280 <p>foo</p>
28281 </div>
28282 <table>
28283 <tbody>
28284 <tr>
28285 <td>bar</td>
28286 </tr>
28287 </tbody>
28288 </table>
28289 !! end
28290
28291 ## Remex doesn't account for fostered content.
28292 !! test
28293 5. Encapsulate foster-parented transclusion content
28294 !!options
28295 parsoid=wt2wt,wt2html
28296 !! wikitext
28297 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
28298 !! html/php+tidy
28299 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
28300 !! html/parsoid
28301 <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>
28302 !! end
28303
28304 ## Remex doesn't account for fostered content.
28305 !! test
28306 6. Encapsulate foster-parented transclusion content
28307 !! options
28308 parsoid=wt2wt,wt2html
28309 !! wikitext
28310 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
28311 !! html/php+tidy
28312 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
28313 !! html/parsoid
28314 <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>
28315 !! end
28316
28317 !! test
28318 7. Encapsulate foster-parented transclusion content
28319 !!options
28320 parsoid=wt2wt,wt2html
28321 !! wikitext
28322 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
28323 !! html/parsoid
28324 <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>
28325 <table>
28326 <tbody>
28327 <tr>
28328 <td>bar</td>
28329 </tr>
28330 </tbody>
28331 </table>
28332 !! end
28333
28334 ## Remex doesn't account for fostered content.
28335 # Note that the wt is broken on purpose: the = should be {{=}} if you
28336 # don't want it to be a template parameter key.
28337 !! test
28338 8. Encapsulate foster-parented transclusion content
28339 !! options
28340 parsoid=wt2wt,wt2html
28341 !! wikitext
28342 {{echo|a
28343 }}{|{{echo|style='color:red'}}
28344 |-
28345 |b
28346 |}
28347 !! html/php+tidy
28348 <p>a
28349 </p>
28350 <table>
28351
28352 <tbody><tr>
28353 <td>b
28354 </td></tr></tbody></table>
28355 !! html/parsoid
28356 <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">
28357 </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">
28358 <tbody><tr>
28359 <td>b
28360 </td></tr></tbody></table>
28361 !! end
28362
28363 ## Remex doesn't account for fostered content.
28364 !! test
28365 9. Encapsulate foster-parented transclusion content
28366 !!options
28367 parsoid=wt2wt,wt2html
28368 !! wikitext
28369 <table>{{echo|hi</table>hello}}
28370 !! html/php+tidy
28371 hi<table></table><p>hello
28372 </p>
28373 !! html/parsoid
28374 <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>
28375 !! end
28376
28377 !! test
28378 Table in fosterable position
28379 !!options
28380 parsoid=wt2html
28381 !! wikitext
28382 {{OpenTable}}
28383 <div>
28384 {|
28385 |}
28386 </div>
28387 |}
28388 !! html/parsoid
28389 <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">
28390 </span>
28391 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
28392
28393 <table>
28394 </table>
28395 !! end
28396
28397 # Parsoid only for T66747
28398 !! test
28399 Properly encapsulate empty-content transclusions in fosterable positions
28400 !! wikitext
28401 <table>
28402 {{#if:|
28403 <td>foo</td>
28404 }}
28405 </table>
28406 !! html/parsoid
28407 <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"}]]}'>
28408
28409 </table>
28410 !! end
28411
28412 ## No longer captures its original intention
28413 !! test
28414 Always encapsulate foster box when template range is expanded to table
28415 !! options
28416 disabled
28417 parsoid=wt2wt
28418 !! wikitext
28419 {|
28420 hello
28421 {{OpenTable}}
28422 |}
28423 !! html/parsoid
28424
28425 !! end
28426
28427 !! test
28428 T115289: Unclosed table
28429 !! wikitext
28430 {{echo|<table>}}<!--c-->[[Category:Two]]
28431 !! html/parsoid
28432 <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>
28433 !! end
28434
28435 !! test
28436 T115289: Don't migrate newlines out of tables with fostered content
28437 !! wikitext
28438 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
28439 !! html/parsoid
28440 <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>
28441 !! end
28442
28443 !! test
28444 T73074: More fostering fun
28445 !! wikitext
28446 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
28447 !! html/parsoid
28448 <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>
28449 !! end
28450
28451 !!test
28452 Support <object> element with .data attribute
28453 !!options
28454 parsoid=html2wt
28455 !! html/parsoid
28456 <object data="test.swf"></object>
28457 !! wikitext
28458 <object data="test.swf"></object>
28459 !!end
28460
28461 !! test
28462 Don't block XML namespace declaration
28463 !! wikitext
28464 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
28465 !! html/php
28466 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
28467 </p>
28468 !! html/parsoid
28469 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
28470 !! end
28471
28472 # -----------------------------------------------------------------
28473 # The following section of tests are primarily to spec requirements
28474 # around Parsoid's serialization (old, new, edited content)
28475 #
28476 # All these tests are marked Parsoid html2wt and html2html only
28477 # ----------------------------------------------------------------
28478
28479 !! test
28480 Ignore rel attribute in a-tags during serialization to url-links
28481 !! options
28482 parsoid=html2wt
28483 !! html/parsoid
28484 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
28485 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
28486 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
28487 !! wikitext
28488 http://en.wikipedia.org/wiki/Foobar
28489 http://en.wikipedia.org/wiki/Foobar
28490 http://en.wikipedia.org/wiki/Foobar
28491 !! end
28492
28493 # 'mi' is a localinterwiki prefix as well as a language
28494 !! test
28495 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
28496 !! options
28497 parsoid=html2wt
28498 !! html/parsoid
28499 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
28500 !! wikitext
28501 [[Foo]]
28502 !! end
28503
28504 !! test
28505 Parsoid should accept interwiki shortcuts
28506 !! options
28507 parsoid=html2wt
28508 !! html/parsoid
28509 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
28510 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
28511 <a href='./fr:Foo'>Foo</a></p>
28512 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
28513 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
28514 <a href='fr%3AFoo'>Foo</a></p>
28515 <p><a href='FR%3AFoo'>Foo</a>
28516 <a href='./FR:Foo'>Foo</a></p>
28517 !! wikitext
28518 [[:fr:Foo|Foo]]
28519 [[:fr:Foo|Foo]]
28520 [[:fr:Foo|Foo]]
28521
28522 [[:fr:Foo|Foo]]
28523 [[:fr:Foo|Foo]]
28524 [[:fr:Foo|Foo]]
28525
28526 [[:fr:Foo|Foo]]
28527 [[:fr:Foo|Foo]]
28528 !! end
28529
28530 !! test
28531 Parsoid should not accept invalid interwiki shortcuts
28532 !! options
28533 parsoid=html2wt
28534 !! html/parsoid
28535 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
28536 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
28537 <a href='news:Foo'>Foo</a></p>
28538 !! wikitext
28539 [news:Foo Foo]
28540 [news:Foo Foo]
28541 [news:Foo Foo]
28542 !! end
28543
28544 # See T93839
28545 !! test
28546 New wikilinks should be serialized properly
28547 !! options
28548 parsoid=html2wt
28549 !! html/parsoid
28550 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
28551 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
28552 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
28553 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
28554 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
28555 !! wikitext
28556 [[Foo]]
28557 [[Foo]]
28558 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
28559 http://en.wikipedia.org/wiki/Foo
28560 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
28561 !! end
28562
28563 !! test
28564 New wiki links (href variations)
28565 !! options
28566 parsoid=html2wt
28567 !! html/parsoid
28568 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28569 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
28570 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
28571 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
28572 !! wikitext
28573 [[Foo_bar]]
28574 [[Foo_bar]]
28575 [[Foo_bar]]
28576 [[Toxine bactérienne]]
28577 !! end
28578
28579 !! test
28580 New wiki links (content string variations)
28581 !! options
28582 parsoid=html2wt
28583 !! html/parsoid
28584 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28585 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
28586 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
28587 !! wikitext
28588 [[Foo_bar]]
28589 [[Foo bar]]
28590 [[Foo_bar|./Foo_bar]]
28591 !! end
28592
28593 !! test
28594 New category links (href variations)
28595 !! options
28596 parsoid=html2wt
28597 !! html/parsoid
28598 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
28599 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
28600 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
28601 !! wikitext
28602 [[Category:Toxine bactérienne]]
28603 [[Category:Toxine bactérienne]]
28604 [[Category:Toxine bactérienne]]
28605 !! end
28606
28607 !! test
28608 New sol transparent links don't need indent-pre nowiki protection
28609 !! options
28610 parsoid=html2wt
28611 language=de
28612 !! html/parsoid
28613 <link rel="mw:PageProp/redirect" href="./Main_Page">
28614 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
28615 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
28616 !! wikitext
28617 #WEITERLEITUNG [[Main Page]]
28618 <!-- this is good --> [[Category:Good]]
28619 <!-- this is great --> [[Kategorie:Great]]
28620 !! end
28621
28622 !! test
28623 New interlanguage links (href variations)
28624 !! options
28625 parsoid=html2wt
28626 !! html/parsoid
28627 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
28628 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
28629 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
28630 !! wikitext
28631 [[es:Toxine bactérienne]]
28632 [[es:Toxine_bactérienne]]
28633 [[es:Toxine_bactérienne]]
28634 !! end
28635
28636 !! test
28637 Image: Modifying size of an image (1)
28638 !! options
28639 parsoid={
28640 "modes": ["wt2wt"],
28641 "changes": [
28642 ["img[height]", "attr", "height", "22"],
28643 ["img[width]", "attr", "width", "200"]
28644 ]
28645 }
28646 !! wikitext
28647 [[Image:Foobar.jpg|230x230px]]
28648 !! wikitext/edited
28649 [[Image:Foobar.jpg|200x200px]]
28650 !!end
28651
28652 !! test
28653 Image: Modifying size of an image (2)
28654 !! options
28655 parsoid={
28656 "modes": ["wt2wt"],
28657 "changes": [
28658 ["img[height]", "attr", "height", "100"],
28659 ["img[width]", "attr", "width", "500"]
28660 ]
28661 }
28662 !! wikitext
28663 [[Image:Foobar.jpg|230x230px]]
28664 !! wikitext/edited
28665 [[Image:Foobar.jpg|500x500px]]
28666 !!end
28667
28668 # Change in size is ignored so long as class='mw-default-size'
28669 !! test
28670 Image: Modifying size of an image (3)
28671 !! options
28672 parsoid={
28673 "modes": ["wt2wt"],
28674 "changes": [
28675 ["figure[class]", "removeClass", "mw-default-size"],
28676 ["figure img", "attr", "height", "19"],
28677 ["figure img", "attr", "width", "170"]
28678 ]
28679 }
28680 !! wikitext
28681 [[Image:Foobar.jpg|thumb]]
28682 !! wikitext/edited
28683 [[Image:Foobar.jpg|thumb|170x170px]]
28684 !!end
28685
28686 !! test
28687 Image: Modifying alignment of an image (T50665)
28688 !! options
28689 parsoid={
28690 "modes": ["wt2wt"],
28691 "changes": [
28692 ["figure[class]", "removeClass", "mw-halign-right"],
28693 ["figure[class]", "addClass", "mw-halign-left"]
28694 ]
28695 }
28696 !! wikitext
28697 [[Image:Foobar.jpg|thumb|caption|right]]
28698 !! wikitext/edited
28699 [[Image:Foobar.jpg|thumb|caption|left]]
28700 !! end
28701
28702 !! test
28703 Image: Modifying mw-default-size of an frameless image (T64805)
28704 !! options
28705 parsoid={
28706 "modes": ["wt2wt"],
28707 "changes": [
28708 ["figure.mw-default-size", "removeClass", "mw-default-size"]
28709 ]
28710 }
28711 !! wikitext
28712 [[Image:Foobar.jpg|frameless|right]]
28713 !! wikitext/edited
28714 [[Image:Foobar.jpg|frameless|right|220x220px]]
28715 !! end
28716
28717 !! test
28718 Image: Modifying valign of an image (T51221)
28719 !! options
28720 parsoid={
28721 "modes": ["wt2wt"],
28722 "changes": [
28723 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
28724 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
28725 ]
28726 }
28727 !! wikitext
28728 [[File:Foobar.jpg|20px|middle]]
28729 !! wikitext/edited
28730 [[File:Foobar.jpg|20px|text-top]]
28731 !! end
28732
28733 !! test
28734 Image: Modifying alt attribute of an image (T58400)
28735 !! options
28736 parsoid={
28737 "modes": ["wt2wt"],
28738 "changes": [
28739 ["img[alt]", "attr", "alt", "some alternate edited text"]
28740 ]
28741 }
28742 !! wikitext
28743 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
28744 !! wikitext/edited
28745 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
28746 !!end
28747
28748 !! test
28749 Image: Modifying caption of an image
28750 !! options
28751 parsoid={
28752 "modes": ["wt2wt"],
28753 "changes": [
28754 ["figcaption", "text", "new caption"]
28755 ]
28756 }
28757 !! wikitext
28758 [[Image:Foobar.jpg|thumb|original caption]]
28759 !! wikitext/edited
28760 [[Image:Foobar.jpg|thumb|new caption]]
28761 !!end
28762
28763 !! test
28764 Image: empty alt attribute (T50924)
28765 !! wikitext
28766 [[File:Foobar.jpg|thumb|alt=|bar]]
28767 !! html/php+tidy
28768 <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>
28769 !! html/parsoid
28770 <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>
28771 !! end
28772
28773 !! test
28774 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
28775 !! options
28776 parsoid=html2wt
28777 language=ar
28778 disabled
28779 !! html/parsoid
28780 <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>
28781 !! wikitext
28782 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
28783 !! end
28784
28785 !! test
28786 Image: Block level image should have \n before and after
28787 !! wikitext
28788 123
28789 [[File:Foobar.jpg|right|thumb|150x150px]]
28790 456
28791 !! html/parsoid
28792 <p>123</p>
28793 <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>
28794 <p>456</p>
28795 !! end
28796
28797 !! test
28798 Image: New block level image should have \n before and after (existing content)
28799 !! wikitext
28800 123
28801 [[File:Foobar.jpg|right|thumb|150x150px]]
28802 456
28803 !! html/parsoid
28804 <p>123</p>
28805 <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>
28806 <p>456</p>
28807 !! end
28808
28809 !! test
28810 Image: upright option (parsoid)
28811 !! wikitext
28812 [[File:Foobar.jpg|thumb|upright|caption]]
28813 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
28814 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
28815 !! html/parsoid
28816 <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>
28817 <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>
28818 <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>
28819 !! end
28820
28821 !! test
28822 Image: upright option is ignored on inline and frame images (parsoid)
28823 !! wikitext
28824 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
28825 !! html/parsoid
28826 <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>
28827 !! end
28828
28829 !! test
28830 Image: in template parameter with empty parameter
28831 !! wikitext
28832 {{echo|[[File:Foobar.jpg|link=]]}}
28833 !! html/parsoid
28834 <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>
28835 !! end
28836
28837 !! test
28838 Image: from basic HTML (1)
28839 !! options
28840 parsoid=html2wt
28841 !! html/parsoid
28842 <span typeof="mw:Image">
28843 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28844 </span>
28845 !! wikitext
28846 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28847 !! end
28848
28849 !! test
28850 Image: from basic HTML (2)
28851 !! options
28852 parsoid=html2wt
28853 !! html/parsoid
28854 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28855 !! wikitext
28856 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28857 !! end
28858
28859 !! test
28860 Image: from basic HTML (3)
28861 !! options
28862 parsoid=html2wt
28863 !! html/parsoid
28864 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
28865 !! wikitext
28866 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
28867 !! end
28868
28869 !! test
28870 Image: from basic HTML (4)
28871 !! options
28872 parsoid=html2wt
28873 !! html/parsoid
28874 <img src="./File:Foobar.jpg">
28875 !! wikitext
28876 [[File:Foobar.jpg|link=]]
28877 !! end
28878
28879 !! test
28880 Image: Invalid title as link
28881 !! wikitext
28882 [[File:Foobar.jpg|link=<]]
28883 !! html/php
28884 <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>
28885 </p>
28886 !! html/parsoid
28887 <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>
28888 !! end
28889
28890 !! test
28891 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
28892 !! options
28893 parsoid=html2wt
28894 !! html/parsoid
28895 <ul>
28896 <li><p>foo</p></li>
28897 </ul>
28898 !! wikitext
28899 * foo
28900 !! end
28901
28902 !! test
28903 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
28904 !! options
28905 parsoid=html2wt
28906 !! html/parsoid
28907 <ul> <li>foo</li></ul>
28908 !! wikitext
28909 * foo
28910 !! end
28911
28912 !! test
28913 Don't strip leading whitespace when handling indent-pre suppressing tags
28914 !! options
28915 parsoid=html2wt
28916 !! html/parsoid
28917 <table>
28918 <tr><td> indented row</td></tr>
28919 </table>
28920 <blockquote><p>
28921 <b>This is very bold of you!</b>
28922 </p>
28923 <table><tr><td>
28924 indented cell (no pre-wrapping!)
28925 </td></tr></table>
28926 </blockquote>
28927 <p>foo</p>
28928 <div>bar</div>
28929 !! wikitext
28930 {|
28931 | indented row
28932 |}
28933 <blockquote>
28934 '''This is very bold of you!'''
28935
28936 {|
28937 |
28938 indented cell (no pre-wrapping!)
28939 |}
28940 </blockquote>
28941 foo
28942 <div>bar</div>
28943 !! end
28944
28945 !! test
28946 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
28947 !! options
28948 parsoid=html2wt
28949 !! html/parsoid
28950 <p>foo</p>
28951 <span>bar</span>
28952
28953 <span>foo2
28954 </span>bar2
28955
28956 <div>foo</div>
28957 <span>bar</span>
28958
28959 <div>
28960 <span>foo</span>
28961 </div>
28962 !! wikitext
28963 foo
28964
28965 <span>bar</span>
28966
28967 <span>foo2
28968 <nowiki> </nowiki></span>bar2
28969
28970 <div>foo</div>
28971 <nowiki> </nowiki><span>bar</span>
28972
28973 <div>
28974 <nowiki> </nowiki><span>foo</span>
28975 </div>
28976 !! end
28977
28978 !! test
28979 Lists: Dont insert newlines in a serialized list item.
28980 !! options
28981 parsoid=html2wt
28982 !! html/parsoid
28983 <ul><li>a<br>b</li><li>c</li></ul>
28984 !! wikitext
28985 * a<br />b
28986 * c
28987 !! end
28988
28989 !! test
28990 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
28991 !! options
28992 parsoid={
28993 "modes": ["html2wt"],
28994 "scrubWikitext": false
28995 }
28996 !! html/parsoid
28997 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28998 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28999
29000 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
29001 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
29002
29003 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
29004
29005 <h2><meta property="mw:PageProp/toc" /> ok</h2>
29006 !! wikitext
29007 == hello there [[Category:A1]] ==
29008
29009 == [[Category:A2]] hi pal ==
29010
29011 == <!--foo--> [[Category:A3]] how goes it ==
29012
29013 == it goes well [[Category:A4]] <!--bar--> ==
29014
29015 ==howdy [[Category:A5]]==
29016
29017 == __TOC__ ok ==
29018 !! end
29019
29020 !! test
29021 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
29022 !! options
29023 parsoid={
29024 "modes": ["html2wt"],
29025 "scrubWikitext": true
29026 }
29027 !! html/parsoid
29028 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
29029 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
29030
29031 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
29032 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
29033
29034 <h2><meta property="mw:PageProp/toc" /> ok</h2>
29035 !! wikitext
29036 == hello there ==
29037 [[Category:A1]]
29038 [[Category:A2]]
29039
29040 == hi pal ==
29041
29042 <!--foo-->[[Category:A3]]
29043
29044 == how goes it ==
29045
29046 == it goes well ==
29047 [[Category:A4]] <!--bar-->
29048
29049 __TOC__
29050
29051 == ok ==
29052 !! end
29053
29054 !! test
29055 Headings: Don't hoist metas that come from templates
29056 !! options
29057 parsoid={
29058 "modes": ["html2wt"],
29059 "scrubWikitext": true
29060 }
29061 !! html/parsoid
29062 <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>
29063 !! wikitext
29064 == {{echo|foo [[Category:Foo]]}} ==
29065 !! end
29066
29067 !! test
29068 Headings: Category in ref isn't hoisted
29069 !! options
29070 parsoid={
29071 "modes": ["html2wt"],
29072 "scrubWikitext": true
29073 }
29074 !! html/parsoid
29075 <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>
29076
29077 <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>
29078 !! wikitext
29079 == foo <ref>bar
29080 [[Category:Baz]] </ref> ==
29081
29082 <references />
29083 !! end
29084
29085 !! test
29086 Parsoid: Serialize positional parameters with = in them as named parameter
29087 !! options
29088 parsoid=html2wt
29089 !! html/parsoid
29090 <p about="#mwt1" typeof="mw:Transclusion"
29091 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
29092
29093 <p about="#mwt1" typeof="mw:Transclusion"
29094 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
29095
29096 <!--Orig params with data-parsoid has heuristics for handling = chars-->
29097 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
29098 <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>
29099 !! wikitext
29100 {{echo|1=f=oo}}
29101
29102 {{echo|1=f=oo|2=bar}}
29103
29104 <!--Orig params with data-parsoid has heuristics for handling = chars-->
29105 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
29106 {{echo|<nowiki>f=oo</nowiki>|bar}}
29107 !! end
29108
29109 !! test
29110 Parsoid: Serialize positional parameters with = in extlink as named parameter
29111 !! options
29112 parsoid=html2wt
29113 !! html/parsoid
29114 <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>
29115 !! wikitext
29116 {{echo|1=http://stuff?is=ok}}
29117 !! end
29118
29119 !! test
29120 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
29121 !! options
29122 parsoid=html2wt
29123 !! html/parsoid
29124 <div>a<p>b</p></div>
29125 <div>a
29126 <p>b</p></div>
29127 <div>
29128 a
29129 <p>b</p></div>
29130 !! wikitext
29131 <div>a
29132 b
29133 </div>
29134 <div>a
29135 b
29136 </div>
29137 <div>
29138 a
29139
29140 b
29141 </div>
29142 !! end
29143
29144 !! test
29145 Substrings resembling wikitext in hrefs should not get nowiki escapes
29146 !! options
29147 parsoid=html2wt
29148 !! html/parsoid
29149 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
29150 !! wikitext
29151 [[Foo''bar''baz]]
29152 !! end
29153
29154 !! test
29155 Enforce single-line context in the serializer
29156 !! options
29157 parsoid=html2wt
29158 !! html/parsoid
29159 <h2>testing
29160 123</h2>
29161
29162 <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">
29163 </span><span about="#mwt1">you</span> </h2>
29164
29165 <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>
29166
29167 <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
29168 there</span></li></ol>
29169
29170 <ul><li>asd
29171 sdf</li></ul>
29172
29173 <ul><li>foo
29174 bar
29175 baz</li>
29176 <li>foo <b>bar</b>
29177 baz</li></ul>
29178
29179 <dl><dt>hi
29180 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
29181 ho</dd></dl>
29182
29183 <dl><dd> <table>
29184 <tbody><tr><td> ha
29185 ha
29186 ha</td></tr>
29187 </tbody></table></dd></dl>
29188 !! wikitext
29189 == testing 123 ==
29190
29191 == hi {{bogus|there
29192 you}} ==
29193
29194 == foo <ref>hello
29195 there</ref> ==
29196
29197 <references />
29198
29199 * asd sdf
29200
29201 * foo bar baz
29202 * foo '''bar''' baz
29203
29204 ; hi ho : hi ho
29205
29206 : {|
29207 | ha
29208 ha
29209 ha
29210 |}
29211 !! end
29212
29213 !! test
29214 Serialize new placeholder space without spans
29215 !! options
29216 parsoid=html2wt
29217 !! html/parsoid
29218 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
29219
29220 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
29221
29222 <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>
29223 !! wikitext
29224 foo : bar
29225
29226 foo : bar
29227
29228 <ref>foo : bar</ref>ok
29229 !! end
29230
29231
29232 #-----------------------
29233 # Tag minimization tests
29234 #-----------------------
29235
29236 !! test
29237 1. I/B quote minimization: wikitext-only tags should be combined
29238 !! options
29239 parsoid=html2wt
29240 !! html/parsoid
29241 <p><i>A</i><i>B</i></p>
29242 <p><b>A</b><b>B</b></p>
29243 <p><i>A</i><b><i>B</i></b></p>
29244 <p><b>A</b><i><b>B</b></i></p>
29245 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
29246 <p><i><b>A</b></i><i><b>B</b></i></p>
29247 <p><i><b>A</b></i><b><i>B</i></b></p>
29248 <p><b><i>A</i></b><i><b>B</b></i></p>
29249 !! wikitext
29250 ''AB''
29251
29252 '''AB'''
29253
29254 ''A'''B'''''
29255
29256 '''A''B'''''
29257
29258 '''A''BC''D'''
29259
29260 '''''AB'''''
29261
29262 '''''AB'''''
29263
29264 '''''AB'''''
29265 !! end
29266
29267 !! test
29268 2. I/B quote minimization: wikitext and html tags should not be combined
29269 !! options
29270 parsoid=html2wt
29271 !! html/parsoid
29272 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
29273 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
29274 !! wikitext
29275 ''A''<i>B</i>
29276
29277 ''A''<nowiki/>'''<i>B</i>'''
29278 !! end
29279
29280 !! test
29281 3. I/B quote minimization: templated content stops minimization
29282 !! options
29283 parsoid=html2wt
29284 !! html/parsoid
29285 <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>
29286 <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>
29287 !! wikitext
29288 ''A''{{echo|''B''}}
29289
29290 ''A''{{echo|'''''B'''''}}
29291 !! end
29292
29293 !! test
29294 4. I/B quote minimization: new content should be mimimized with adjacent old content
29295 !! options
29296 parsoid=html2wt
29297 !! html/parsoid
29298 <p><i>A</i><i>B</i></p>
29299 <p><b>A</b><b>B</b></p>
29300 <p><i>A</i><b><i>B</i></b></p>
29301 !! wikitext
29302 ''AB''
29303
29304 '''AB'''
29305
29306 ''A'''B'''''
29307 !! end
29308
29309 !! test
29310 5a. Merge adjacent quote nodes if they've been edited
29311 !! options
29312 parsoid={
29313 "modes": ["wt2wt", "selser"],
29314 "changes": [
29315 ["p", "contents", "remove", ":contains('b')"]
29316 ]
29317 }
29318 !! wikitext
29319 ''a''b''c''
29320 !! wikitext/edited
29321 ''ac''
29322 !! end
29323
29324 !! test
29325 5b. Merge adjacent quote nodes if they've been edited
29326 !! options
29327 parsoid={
29328 "modes": ["wt2wt", "selser"],
29329 "changes": [
29330 ["#x", "remove"]
29331 ]
29332 }
29333 !! wikitext
29334 ''a''<span id="x">b</span>''c''
29335 !! wikitext/edited
29336 ''ac''
29337 !! end
29338
29339 !! test
29340 1. Merge adjacent link nodes as long as at least one element is new
29341 !! options
29342 parsoid={
29343 "modes": ["html2wt"],
29344 "scrubWikitext": true
29345 }
29346 !! html/parsoid
29347 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29348 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29349 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
29350 !! wikitext
29351 [[Football]]
29352 [[Football]]
29353 [[Football|Foot]][[Football|ball]]
29354 !! end
29355
29356 !! test
29357 2. Merge adjacent link nodes and enable additional normalizations
29358 !! options
29359 parsoid={
29360 "modes": ["html2wt"],
29361 "scrubWikitext": true
29362 }
29363 !! html/parsoid
29364 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
29365 !! wikitext
29366 ''[[Football]]''
29367 !! end
29368
29369 !! test
29370 3. Don't merge adjacent link nodes if scrubWikitext is false
29371 !! options
29372 parsoid={
29373 "modes": ["html2wt"],
29374 "scrubWikitext": false
29375 }
29376 !! html/parsoid
29377 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29378 !! wikitext
29379 [[Football|Foot]][[Football|ball]]
29380 !! end
29381
29382 !! test
29383 1. Move format tags outside of WikiLink
29384 !! options
29385 parsoid={
29386 "modes": ["html2wt"],
29387 "scrubWikitext": true
29388 }
29389 !! html/parsoid
29390 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
29391 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
29392 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
29393 !! wikitext
29394 ''[[Football]]''
29395 '''''[[Football]]'''''
29396 <u>'''''[[Football]]'''''</u>
29397 !! end
29398
29399 !! test
29400 2. Move format tags outside of WikiLink with mergable A tags
29401 !! options
29402 parsoid={
29403 "modes": ["html2wt"],
29404 "scrubWikitext": true
29405 }
29406 !! html/parsoid
29407 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
29408 !! wikitext
29409 '''''[[Football]]'''''
29410 !! end
29411
29412 !! test
29413 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
29414 !! options
29415 parsoid={
29416 "modes": ["html2wt"],
29417 "scrubWikitext": true
29418 }
29419 !! html/parsoid
29420 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
29421 !! wikitext
29422 <font color="red"><u>'''[[Foo]]'''</u></font>
29423 !! end
29424
29425 !! test
29426 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
29427 !! options
29428 parsoid={
29429 "modes": ["html2wt"],
29430 "scrubWikitext": true
29431 }
29432 !! html/parsoid
29433 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
29434 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
29435 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
29436 !! wikitext
29437 [[Foo|<font color="red">Foo</font>]]
29438 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
29439 [[Foo|<span class="Bar">Foo</span>]]
29440 !! end
29441
29442 !! test
29443 5. T194083 Regression test: Manual edit test that also enables scrubWikitext to move format tags outside wikilinks
29444 !! options
29445 parsoid={
29446 "modes": ["selser"],
29447 "scrubWikitext": true,
29448 "changes": [
29449 ["a", "html", "<i>Foo</i>"]
29450 ]
29451 }
29452 !! wikitext
29453 [[Foo]]
29454 !! wikitext/edited
29455 ''[[Foo]]''
29456 !! end
29457
29458 !! test
29459 6. Regression test: Manual edit test to ensure diff markers are not lost
29460 !! options
29461 parsoid={
29462 "modes": ["selser"],
29463 "scrubWikitext": true,
29464 "changes": [
29465 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
29466 ]
29467 }
29468 !! wikitext
29469 ''Foo''
29470 !! wikitext/edited
29471 ''[[Foo]]''
29472 !! end
29473
29474 !! test
29475 7. T194083 Regression test: Manual edit test to ensure nested diff markers aren't inserted
29476 !! options
29477 parsoid={
29478 "modes": ["selser"],
29479 "scrubWikitext": true,
29480 "changes": [
29481 ["div", "after", "\n<p><a href='./Foo' rel='mw:WikiLink'>Foo </a>, placeholder</p>"]
29482 ]
29483 }
29484 !! wikitext
29485 <div>placeholder</div>
29486 !! wikitext/edited
29487 <div>placeholder</div>
29488 [[Foo]] , placeholder
29489 !! end
29490
29491 #------------------------------
29492 # End of tag minimization tests
29493 #------------------------------
29494
29495 !!test
29496 T56262: New entities
29497 !! options
29498 parsoid=html2wt
29499 !! html/parsoid
29500 <span typeof="mw:Entity">&nbsp;</span>
29501 !! wikitext
29502 &nbsp;
29503 !! end
29504
29505 ## Note that there is no wikitext output for 'unknownproperty' ##
29506 ## Unknown magic words are silently dropped ##
29507
29508 !! test
29509 Magic words
29510 !! options
29511 parsoid=html2wt
29512 !! html/parsoid
29513 <meta property='mw:PageProp/toc' />
29514 <meta property='mw:PageProp/notoc' />
29515 <meta property='mw:PageProp/forcetoc' />
29516 <meta property='mw:PageProp/index' />
29517 <meta property='mw:PageProp/noindex' />
29518 <meta property='mw:PageProp/nogallery' />
29519 <meta property='mw:PageProp/noeditsection' />
29520 <meta property='mw:PageProp/notitleconvert' />
29521 <meta property='mw:PageProp/nocontentconvert' />
29522 <meta property='mw:PageProp/unknownproperty' />
29523 !! wikitext
29524 __TOC__
29525 __NOTOC__
29526 __FORCETOC__
29527 __INDEX__
29528 __NOINDEX__
29529 __NOGALLERY__
29530 __NOEDITSECTION__
29531 __NOTITLECONVERT__
29532 __NOCONTENTCONVERT__
29533 !! end
29534
29535 !! test
29536 Consecutive <pre>s should not get merged
29537 !! options
29538 parsoid=html2wt,html2html
29539 !! html/parsoid
29540 <pre>a</pre><pre>b</pre>
29541
29542 <pre>c
29543 </pre><pre>
29544 d</pre>
29545
29546 <pre>e
29547
29548 </pre><pre>
29549
29550 f</pre>
29551 !! wikitext
29552 a
29553
29554 b
29555
29556 c
29557
29558 d
29559
29560 e
29561
29562
29563
29564 f
29565 !! end
29566
29567 !! test
29568 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
29569 !! options
29570 parsoid=html2wt
29571 !! html/parsoid
29572 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
29573 !! wikitext
29574 [[Special:BookSources/1234567890|ISBN 1234567895]]
29575 !! end
29576
29577 !! test
29578 Edited RFC links not serializable as RFC links should serialize as extlinks
29579 !! options
29580 parsoid=html2wt
29581 !! html/parsoid
29582 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
29583 !! wikitext
29584 [https://tools.ietf.org/html/rfc123 New RFC]
29585 !! end
29586
29587 !! test
29588 Edited PMID links not serializable as PMID links should serialize as extlinks
29589 !! options
29590 parsoid=html2wt
29591 !! html/parsoid
29592 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
29593 !! wikitext
29594 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
29595 !! end
29596
29597 !! test
29598 WTS of autolinks with trailing/surrounding context
29599 !! options
29600 parsoid=html2wt
29601 !! html/parsoid
29602 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
29603 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
29604 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
29605 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
29606 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
29607 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
29608 !! wikitext
29609 http://cscott.net'''foo'''
29610
29611 http://cscott.net<b>foo</b>
29612
29613 '''http://cscott.net'''
29614
29615 '''http://cscott.net '''
29616
29617 '''http://cscott.net<nowiki/>x'''
29618
29619 http://cscott.net<nowiki/>x
29620 !! end
29621
29622 !! test
29623 WTS of autolinks with nowikis (round-trip)
29624 !! wikitext
29625 x<nowiki/>http://cscott.net<nowiki/>x
29626 !! html/parsoid
29627 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
29628 !! end
29629
29630 # this is the "easy" test because it leaves in place all the
29631 # data-parsoid information indicating this is an autolink
29632 !! test
29633 WTS of autolinks with escapes (editing)
29634 !! options
29635 parsoid={
29636 "modes": ["wt2wt"],
29637 "changes": [
29638 [ "span", "remove" ]
29639 ]
29640 }
29641 !! wikitext
29642 x<nowiki/>http://cscott.net<nowiki/>x
29643 !! wikitext/edited
29644 x<nowiki/>http://cscott.net<nowiki/>x
29645 !! end
29646
29647 !! test
29648 WTS of edited autolink-like text (T103364)
29649 !! options
29650 parsoid={
29651 "modes": ["wt2wt"],
29652 "changes": [
29653 [ "span[typeof]", "removeAttr", "typeof" ]
29654 ]
29655 }
29656 !! wikitext
29657 Not a link: <nowiki>http://example.com</nowiki>.
29658 !! wikitext/edited
29659 Not a link: <span><nowiki>http://example.com</nowiki></span>.
29660 !! end
29661
29662 !! test
29663 WTS of newly-authored autolink-like text (T103364)
29664 !! options
29665 parsoid=html2wt
29666 !! html/parsoid
29667 <p>http://example.com is not a link.</p>
29668 !! wikitext
29669 <nowiki>http://example.com</nowiki> is not a link.
29670 !! end
29671
29672 !! test
29673 WTS of autolink-like text after an autolink (T108563)
29674 !! options
29675 parsoid=html2wt
29676 !! html/parsoid
29677 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
29678 !! wikitext
29679 http://example.com <nowiki>http://example.com</nowiki> is not a link.
29680 !! end
29681
29682 !! test
29683 Magic links inside links (not autolinked)
29684 !! wikitext
29685 [[Foo|http://example.com]]
29686 [[Foo|RFC 1234]]
29687 [[Foo|PMID 1234]]
29688 [[Foo|ISBN 123456789x]]
29689
29690 [http://foo.com http://example.com]
29691 [http://foo.com RFC 1234]
29692 [http://foo.com PMID 1234]
29693 [http://foo.com ISBN 123456789x]
29694 !! html+tidy
29695 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
29696 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
29697 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
29698 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
29699 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
29700 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
29701 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
29702 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
29703 </p>
29704 !! html/parsoid
29705 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
29706 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
29707 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
29708 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
29709
29710 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
29711 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
29712 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
29713 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
29714 !! end
29715
29716 !! test
29717 Magic links inside image captions (autolinked)
29718 !! wikitext
29719 [[File:Foobar.jpg|thumb|http://example.com]]
29720 [[File:Foobar.jpg|thumb|RFC 1234]]
29721 [[File:Foobar.jpg|thumb|PMID 1234]]
29722 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
29723 !! html+tidy
29724 <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>
29725 <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>
29726 <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>
29727 <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>
29728 !! html/parsoid
29729 <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>
29730 <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>
29731 <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>
29732 <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>
29733 !! end
29734
29735 !! test
29736 WTS of magic word text (T109371)
29737 !! options
29738 parsoid=html2wt
29739 !! html/parsoid
29740 <p>RFC 1234</p>
29741 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
29742 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
29743 !! wikitext
29744 <nowiki>RFC 1234</nowiki>
29745
29746 [http://foo.com RFC 1234]
29747
29748 [[Foo|RFC 1234]]
29749 !! end
29750
29751 !! test
29752 Edited Redirect link should emit a non-piped wikitext link
29753 !! options
29754 parsoid=html2wt
29755 !! html/parsoid
29756 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
29757 !! wikitext
29758 #REDIRECT [[Bar]]
29759 !! end
29760
29761 !! test
29762 T75121: Infer extension name from typeOf if data-mw is not present
29763 !! options
29764 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29765 !! html/parsoid
29766 <div typeOf="mw:Extension/foo"></div>
29767 !! wikitext
29768 <foo />
29769 !! end
29770
29771 # Note that the <p> wrapping isn't present in PHP parser output
29772 # The important thing for this test is that P-wrapping doesn't
29773 # interfere with the <nowiki> protection for leading - in <td>
29774 # (which isn't necessary for <th>).
29775 !! test
29776 T88318: p-wrapped dash in table.
29777 !! options
29778 parsoid=html2wt,wt2wt
29779 !! html/parsoid
29780 <table><tbody>
29781 <tr><th><p>-</p></th><th><p>- </p></th></tr>
29782 <tr><td><p>-</p></td><td><p>- </p></td></tr>
29783 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
29784 </tbody></table>
29785 !! wikitext
29786 {|
29787 !-
29788 !-
29789 |-
29790 |<nowiki>-</nowiki>
29791 |<nowiki>- </nowiki>
29792 |-
29793 |<small>-</small>
29794 |<br />
29795 -
29796 |<br />-
29797 |}
29798 !! html/php+tidy
29799 <table>
29800 <tbody><tr>
29801 <th>-
29802 </th>
29803 <th>-
29804 </th></tr>
29805 <tr>
29806 <td>-
29807 </td>
29808 <td>-
29809 </td></tr>
29810 <tr>
29811 <td><small>-</small>
29812 </td>
29813 <td><br />
29814 <p>-
29815 </p>
29816 </td>
29817 <td><br />-
29818 </td></tr></tbody></table>
29819 !! end
29820
29821 !! test
29822 T149209: WTS: Handle newlines in table cells properly
29823 !! options
29824 parsoid=html2wt
29825 !! html/parsoid
29826 <table>
29827 <tbody>
29828 <tr><td>a
29829 b
29830 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
29831 <tr><td><p>x</p>
29832 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
29833 </tbody></table>
29834 <table>
29835 <tbody>
29836 <tr><th>a
29837 b
29838 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
29839 <tr><th><p>x</h>
29840 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
29841 </tbody></table>
29842 !! wikitext
29843 {|
29844 |a
29845 b
29846 |c
29847 |-
29848 |x
29849 {{!}}y
29850 |}
29851 {|
29852 !a
29853 b
29854 !c
29855 |-
29856 !x
29857 !y
29858 |}
29859 !! end
29860
29861 !! test
29862 T149209: Selser: Handle newlines in table cells properly
29863 !! options
29864 parsoid={
29865 "modes": ["selser"],
29866 "changes": [
29867 [ "#h1", "html", "a\nb\n" ],
29868 [ "#h2", "html", "a\nb\n" ],
29869 [ "#c1", "html", "a\nb\n" ],
29870 [ "#c2", "html", "<p>a</p>" ],
29871 [ "#c3", "html", "<p>a</p>" ],
29872 [ "#c4", "html", "edit-me<p>a</p>" ]
29873 ]
29874 }
29875 !! wikitext
29876 {|
29877 ! id="h1" |edit-me!!1
29878 |-
29879 ! id="h2" |edit-me||2
29880 |-
29881 | id="c1" |edit-me||3
29882 |-
29883 | id="c2" |edit-me||4
29884 |-
29885 | id="c3" |edit-me||p||q||r
29886 |-
29887 | id="c4" |edit-me||p||q||r
29888 |}
29889 !! wikitext/edited
29890 {|
29891 ! id="h1" |a
29892 b
29893 !1
29894 |-
29895 ! id="h2" |a
29896 b
29897 !2
29898 |-
29899 | id="c1" |a
29900 b
29901 |3
29902 |-
29903 | id="c2" |a
29904 |4
29905 |-
29906 | id="c3" |a
29907 |p||q||r
29908 |-
29909 | id="c4" |edit-me
29910 a
29911 |p||q||r
29912 |}
29913 !! end
29914
29915 !! test
29916 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
29917 !! options
29918 parsoid=html2wt
29919 !! html/parsoid
29920 <table id='mwAb'>
29921 <td id='mwAc'>foo</td>
29922 <td id='serialize-this'>bar</td>
29923 </table>
29924 !! wikitext
29925 {|
29926 |foo
29927 | id="serialize-this" |bar
29928 |}
29929 !! end
29930
29931 !! test
29932 Parsoid-like element ids should not be serialized to wikitext unless shadowed
29933 !! options
29934 parsoid=html2wt
29935 !! html/parsoid
29936 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
29937 !! wikitext
29938 <div id="hello">ok</div>
29939 !! end
29940
29941 !! test
29942 Testing serialization after deletion in references
29943 !! options
29944 parsoid={
29945 "modes": ["wt2wt"],
29946 "changes": [
29947 ["#x", "remove"]
29948 ]
29949 }
29950 !! wikitext
29951 hi <ref><div id="x">ho</div></ref>
29952
29953 <references />
29954 !! wikitext/edited
29955 hi <ref></ref>
29956
29957 <references />
29958 !! end
29959
29960 !!test
29961 Testing serialization after deletion of table cells
29962 !!options
29963 parsoid={
29964 "modes": ["wt2wt", "selser"],
29965 "changes": [
29966 ["#x", "remove"]
29967 ]
29968 }
29969 !!wikitext
29970 {|
29971 !h1 !!h2 !!h3
29972 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
29973 |}
29974 !! wikitext/edited
29975 {|
29976 !h1!!h2!!h3
29977 |c2|||c3
29978 |}
29979 !!end
29980
29981 !! test
29982 Testing selser after addition of new row before first row (T125419)
29983 !! options
29984 parsoid={
29985 "modes": ["wt2wt", "selser"],
29986 "changes": [
29987 [ "tr", "before", "<tr><td>X</td></tr>" ]
29988 ]
29989 }
29990 !! wikitext
29991 {|
29992 |a
29993 |}
29994 !! wikitext/edited
29995 {|
29996 |X
29997 |-
29998 |a
29999 |}
30000 !! end
30001
30002 !! test
30003 Serialize new table rows in a HTML table using HTML tags
30004 !! options
30005 parsoid={
30006 "modes": ["wt2wt", "selser"],
30007 "changes": [
30008 [ "tr", "before", "<tr><td>X</td></tr>" ]
30009 ]
30010 }
30011 !! wikitext
30012 <table><tr><td>a</td></tr></table>
30013 !! wikitext/edited
30014 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
30015 !! end
30016
30017 !! test
30018 Serialize new table cells in a HTML row using HTML tags
30019 !! options
30020 parsoid={
30021 "modes": ["wt2wt", "selser"],
30022 "changes": [
30023 [ "td", "before", "<td>X</td>" ]
30024 ]
30025 }
30026 !! wikitext
30027 <table><tr><td>a</td></tr></table>
30028 !! wikitext/edited
30029 <table><tr><td>X</td><td>a</td></tr></table>
30030 !! end
30031
30032 !! test
30033 Serialize wikitext list items as HTML list items when embedded in a HTML list
30034 !! options
30035 parsoid=html2wt
30036 !! html/parsoid
30037 <ul data-parsoid='{"stx": "html"}'>
30038 <li data-parsoid='{}'>a</li>
30039 <li>b</li>
30040 </ul>
30041 !! wikitext
30042 <ul>
30043 <li>a</li>
30044 <li>b</li>
30045 </ul>
30046 !! html/php+tidy
30047 <ul>
30048 <li>a</li>
30049 <li>b</li>
30050 </ul>
30051 !! end
30052
30053 # Nested list should be inside <li>, that is
30054 # <ul><li>foo<ul>..</ul></li></ul> instead of
30055 # <ul><li>foo</li><ul>..</ul></ul>
30056 # See https://stackoverflow.com/questions/5899337/proper-way-to-make-html-nested-list
30057 !! test
30058 Wikitext lists can be nested inside HTML lists
30059 !! options
30060 parsoid=html2wt
30061 !! html/parsoid
30062 <ul data-parsoid='{"stx": "html"}'>
30063 <li data-parsoid='{"stx": "html"}'>a
30064 <ul><li>b</li></ul>
30065 </li>
30066 </ul>
30067
30068 <ul data-parsoid='{"stx": "html"}'>
30069 <li>x
30070 <ul><li>y</li></ul>
30071 </li>
30072 </ul>
30073 !! wikitext
30074 <ul>
30075 <li>a
30076 * b
30077 </li>
30078 </ul>
30079
30080 <ul>
30081 <li>x
30082 * y
30083 </li>
30084 </ul>
30085 !! html/php+tidy
30086 <ul>
30087 <li>a
30088 <ul><li>b</li></ul>
30089 </li>
30090 </ul>
30091 <ul>
30092 <li>x
30093 <ul><li>y</li></ul>
30094 </li>
30095 </ul>
30096 !! end
30097
30098 !! test
30099 WTS change modes
30100 !! options
30101 parsoid={
30102 "modes": ["wt2wt"],
30103 "changes": [
30104 [ "#xyz", "before", "<b>before</b> stuff " ],
30105 [ "#xyz", "after", " stuff <i>after</i>" ],
30106 [ "#xyz", "html", "x <b>y</b> z" ]
30107 ]
30108 }
30109 !! wikitext
30110 <span id="xyz">hello</span>
30111 !! wikitext/edited
30112 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
30113 !! end
30114
30115 !! test
30116 Never serialize a-tag as html, regardless of what data-parsoid has to say
30117 !! options
30118 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30119 !! html/parsoid
30120 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
30121 !! wikitext
30122 [[Foo]]
30123 !! end
30124
30125 ## SSS FIXME: This is broken output nevertheless.
30126 ## What might be a reasonable non-broken output for this?
30127 ## This is an edge case unlikely to be seen in production
30128 ## that I am not wasting more time on this right now.
30129 !! test
30130 Never serialize a-tag as html, no matter what attributes it has
30131 !! options
30132 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30133 !! html/parsoid
30134 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
30135 !! wikitext
30136 [http://boo.org http://boohoo.org]
30137 !! end
30138
30139 # Misnested is an indication that selser can reuse the source but these have
30140 # shown to sneak through on occasion. See T101768.
30141 # The original wikitext here is: [http://test.com [[one]] two three]
30142 !! test
30143 Strip span tags added to mark misnested links
30144 !! options
30145 parsoid=html2wt
30146 !! html/parsoid
30147 <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>
30148 !! wikitext
30149 [http://test.com][[one]] two three
30150 !! end
30151
30152 !! test
30153 Catch regression when unpacking misnested links
30154 !! options
30155 parsoid=wt2html
30156 !! wikitext
30157 {{echo|hi}}[http://example.com [[ho]]]
30158 !! html/parsoid
30159 <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>
30160 !! end
30161
30162 !! test
30163 Catch regression when unpacking with trailing content
30164 !! wikitext
30165 {{echo|Foo <references/> bar}}
30166 !! html/parsoid
30167 <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>
30168 !! end
30169
30170 !! test
30171 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
30172 !! options
30173 parsoid=html2wt
30174 !! html/parsoid
30175 <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|}"]}'>
30176 <tbody><tr><td>d
30177 </td></tr>
30178 </tbody></table>
30179 !! wikitext
30180 {{echo|a}}
30181 {|{{echo|c
30182 {{!}}d
30183 }}
30184 |}
30185 !! end
30186
30187 ## This test verifies the presence and computation of this attribute indirectly
30188 ## by making an edit and ensuring that the serialization is correct (which it would be
30189 ## only if firstWikitextNode is properly set).
30190 !! test
30191 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
30192 !! options
30193 parsoid= {
30194 "modes": ["wt2wt"],
30195 "changes": [
30196 [ "div#x", "remove" ],
30197 [ "div", "before", "<div>new</div>" ]
30198 ]
30199 }
30200 !! wikitext
30201 <div id="x">foo</div>
30202 {|
30203 {{echo|<div>boo</div>
30204 {{!}}b}}
30205 |c
30206 |}
30207 !! wikitext/edited
30208
30209 <div>new</div>
30210 {|
30211 {{echo|<div>boo</div>
30212 {{!}}b}}
30213 |c
30214 |}
30215 !! end
30216
30217 # --------------------------------------------
30218 # Tests spec'ing wikitext serialization norms |
30219 # --------------------------------------------
30220
30221 !! test
30222 Serialize multi-line indent-pre starting with wikitext syntax
30223 !! options
30224 parsoid=html2wt
30225 !! html/parsoid
30226 <pre>* 1
30227 ** 2
30228 * 3</pre>
30229 !! wikitext
30230 * 1
30231 ** 2
30232 * 3
30233 !! end
30234
30235 !! test
30236 1. Categories should always be serialized on their own line
30237 !! options
30238 parsoid=html2wt
30239 !! html/parsoid
30240 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
30241 !! wikitext
30242 foo
30243 [[Category:Foo]]
30244 bar
30245 !! end
30246
30247 !! test
30248 2. Categories that are part of templates should not introduce a line break
30249 !! wikitext
30250 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
30251 !! html/parsoid
30252 <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>
30253 !! end
30254
30255 # Careful while editing these next 2 tests. There are \u200f characters
30256 # before and after the <link> tags in the HTML and following some
30257 # of the categories in wikitext
30258 # Do not remove these characters in edits.
30259 #
30260 # As part of the serialization, these bidi characters will get stripped.
30261 !! test
30262 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
30263 !! options
30264 parsoid={
30265 "modes": ["html2wt"],
30266 "scrubWikitext": true
30267 }
30268 !! html/parsoid
30269 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
30270 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
30271 !! wikitext
30272 [[קטגוריה:טקסים]]
30273 [[קטגוריה: שיטות משפט]]
30274 !! end
30275
30276 !! test
30277 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
30278 !! options
30279 parsoid={
30280 "modes": ["html2wt"],
30281 "scrubWikitext": true
30282 }
30283 !! html/parsoid
30284 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
30285 !! wikitext
30286 [[קטגוריה:טקסים]]
30287 ‏y
30288 !! end
30289
30290 !! test
30291 Lists: Add space after bullets
30292 !! options
30293 parsoid=html2wt
30294 !! html/parsoid
30295 <ul>
30296 <li>foo</li>
30297 <li> bar</li>
30298 <li><span> baz</span></li>
30299 </ul>
30300 !! wikitext
30301 * foo
30302 * bar
30303 * <span> baz</span>
30304 !! end
30305
30306 !! test
30307 1. Headings: Add space before/after == (T53744)
30308 !! options
30309 parsoid=html2wt
30310 !! html/parsoid
30311 <h2>foo</h2>
30312 <h2> bar</h2>
30313 <h2>baz </h2>
30314 <h2><span> baz</span></h2>
30315 !! wikitext
30316 == foo ==
30317
30318 == bar ==
30319
30320 == baz ==
30321
30322 == <span> baz</span> ==
30323 !! end
30324
30325 !! test
30326 2. Headings: Add space before/after == even after hoisted content
30327 !! options
30328 parsoid={
30329 "modes": ["html2wt"],
30330 "scrubWikitext": true
30331 }
30332 !! html/parsoid
30333 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
30334 !! wikitext
30335 [[Category:A2]]
30336
30337 == ok ==
30338 !! end
30339
30340 !! test
30341 1. Headings: suppress newly created empty headings
30342 !! options
30343 parsoid={
30344 "modes": ["html2wt"],
30345 "scrubWikitext": true
30346 }
30347 !! html/parsoid
30348 <h2></h2>
30349 !! wikitext
30350 !! end
30351
30352 !! test
30353 2. Headings: don't suppress empty headings if scrubWikitext is false
30354 !! options
30355 parsoid=html2wt
30356 !! html/parsoid
30357 <h2></h2>
30358 !! wikitext
30359 ==<nowiki/>==
30360 !! end
30361
30362 !! test
30363 3. Headings: suppress empty headings on edits
30364 !! options
30365 parsoid={
30366 "modes": ["selser"],
30367 "scrubWikitext": true,
30368 "changes": [
30369 [ "#x", "remove"]
30370 ]
30371 }
30372 !! wikitext
30373 ==<span id="x">foo</span>==
30374 !! wikitext/edited
30375 !! end
30376
30377 !! test
30378 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
30379 !! options
30380 parsoid={
30381 "modes": ["html2wt"],
30382 "scrubWikitext": true
30383 }
30384 !! html/parsoid
30385 <h2>foo<br/>bar</h2>
30386 <h2>foo <span><br/>bar</span> baz</h2>
30387 !! wikitext
30388 == foo bar ==
30389
30390 == foo <span> bar</span> baz ==
30391 !! end
30392
30393 !! test
30394 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
30395 !! options
30396 parsoid={
30397 "modes": ["html2wt"],
30398 "scrubWikitext": false
30399 }
30400 !! html/parsoid
30401 <h2>foo<br/>bar</h2>
30402 !! wikitext
30403 == foo<br />bar ==
30404 !! end
30405
30406 !! test
30407 1. WT Quote Tags: suppress newly created empty style tags
30408 !! options
30409 parsoid={
30410 "modes": ["html2wt"],
30411 "scrubWikitext": true
30412 }
30413 !! html/parsoid
30414 <i></i><b></b>
30415 !! wikitext
30416 !! end
30417
30418 !! test
30419 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
30420 !! options
30421 parsoid=html2wt
30422 !! html/parsoid
30423 <i></i><b></b>
30424 !! wikitext
30425 ''<nowiki/>'''''<nowiki/>'''
30426 !! end
30427
30428 !! test
30429 3. WT Quote Tags: suppress empty style tags on edits
30430 !! options
30431 parsoid={
30432 "modes": ["selser"],
30433 "scrubWikitext": true,
30434 "changes": [
30435 [ "#x", "remove"]
30436 ]
30437 }
30438 !! wikitext
30439 '''<span id="x">foo</span>'''
30440 !! wikitext/edited
30441 !! end
30442
30443 !! test
30444 1. Anchors: suppress newly created empty anchors
30445 !! options
30446 parsoid={
30447 "modes": ["html2wt"],
30448 "scrubWikitext": true
30449 }
30450 !! html/parsoid
30451 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
30452 !! wikitext
30453 !! end
30454
30455 !! test
30456 2. Anchors: don't suppress empty anchors if scrubWikitext is false
30457 !! options
30458 parsoid={
30459 "modes": ["html2wt"],
30460 "scrubWikitext": false
30461 }
30462 !! html/parsoid
30463 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
30464 !! wikitext
30465 [[Test|<nowiki/>]]
30466 !! end
30467
30468 !! test
30469 3. Anchors: suppress empty anchors on edits
30470 !! options
30471 parsoid={
30472 "modes": ["selser"],
30473 "scrubWikitext": true,
30474 "changes": [
30475 [ "#x", "remove"]
30476 ]
30477 }
30478 !! wikitext
30479 [[Test|<span id="x">foo</span>]]
30480 !! wikitext/edited
30481 !! end
30482
30483 !! test
30484 3a. Anchors: do not suppress numbered extlinks
30485 !! options
30486 parsoid={
30487 "modes": ["wt2wt"],
30488 "scrubWikitext": true
30489 }
30490 !! wikitext
30491 [http://foo.com]
30492 !! html/parsoid
30493 <a rel="mw:ExtLink" href="http://foo.com"></a>
30494 !! end
30495
30496 !! test
30497 3b. Anchors: do not suppress numbered extlinks
30498 !! options
30499 parsoid={
30500 "modes": ["wt2wt"],
30501 "scrubWikitext": true,
30502 "changes": [
30503 [ "#x", "remove"]
30504 ]
30505 }
30506 !! wikitext
30507 [http://foo.com <span id="x">foo</span>]
30508 !! wikitext/edited
30509 [http://foo.com]
30510 !! end
30511
30512 !!test
30513 Normalizations should be restricted to edited content
30514 !!options
30515 parsoid={
30516 "modes": ["selser"],
30517 "scrubWikitext": true,
30518 "changes": [
30519 [ "h1", "before", "<i></i>"]
30520 ]
30521 }
30522 !!wikitext
30523 a
30524 = =
30525 b
30526 !!wikitext/edited
30527 a
30528 = =
30529 b
30530 !!end
30531
30532 !! test
30533 1. Multiple normalizations (html2wt)
30534 !! options
30535 parsoid={
30536 "modes": ["html2wt"],
30537 "scrubWikitext": true
30538 }
30539 !! html/parsoid
30540 <h2><i></i></h2>
30541 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
30542 </a><b><i></i></b>x</p>
30543 !! wikitext
30544
30545 [[foo]]
30546 x
30547
30548 !! end
30549
30550 !! test
30551 2. Multiple normalizations (selser)
30552 !! options
30553 parsoid={
30554 "modes": ["selser"],
30555 "scrubWikitext": true,
30556 "changes": [
30557 [ "#x", "after", "<h1><i></i></h1>\n<p> bar<b></b></p>"]
30558 ]
30559 }
30560 !! wikitext
30561 <div id="x">foo</div>
30562 !! wikitext/edited
30563 <div id="x">foo</div>
30564 bar
30565 !! end
30566
30567 !! test
30568 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
30569 !! options
30570 parsoid={
30571 "modes": ["html2wt"],
30572 "scrubWikitext": true
30573 }
30574 !! html/parsoid
30575 <p> hi</p>
30576 <p> hello</p>
30577 !! wikitext
30578 hi
30579
30580 hello
30581 !! end
30582
30583 !! test
30584 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
30585 !! options
30586 parsoid=html2wt
30587 !! html/parsoid
30588 <p> hi</p>
30589 <p> hello</p>
30590 !! wikitext
30591 <nowiki> </nowiki>hi
30592
30593 <nowiki> </nowiki> hello
30594 !! end
30595
30596 !! test
30597 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
30598 !! options
30599 parsoid={
30600 "modes": ["html2wt"],
30601 "scrubWikitext": true
30602 }
30603 !! html/parsoid
30604 <p>Foo
30605 bar
30606 baz</p>
30607
30608 <table><tr><td>Foo
30609 bar
30610 baz bang</td></tr></table>
30611
30612 <p><!--boo--> foo
30613 bar</p>
30614
30615 <p> foo
30616 bar<span>boo</span></p>
30617 !! wikitext
30618 Foo
30619 bar
30620 baz
30621
30622 {|
30623 |Foo
30624 bar
30625 baz bang
30626 |}
30627
30628 <!--boo-->foo
30629 bar
30630
30631 foo
30632 bar<span>boo</span>
30633 !! end
30634
30635 !! test
30636 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
30637 !! options
30638 parsoid={
30639 "modes": ["selser"],
30640 "scrubWikitext": true,
30641 "changes": [
30642 [ "p", "html", " a\n b" ]
30643 ]
30644 }
30645 !! wikitext
30646 xyz
30647 !! wikitext/edited
30648 a
30649 b
30650 !! end
30651
30652 !! test
30653 1. New links that end in spaces
30654 !! options
30655 parsoid={
30656 "modes": ["html2wt"],
30657 "scrubWikitext": false
30658 }
30659 !! html/parsoid
30660 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30661 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30662 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30663 !! wikitext
30664 [[Berlin ]]<nowiki/>is the capital of Germany.
30665
30666 [[Foo ]]'''bar'''
30667
30668 [[Boston ]] is a city.
30669 !! end
30670
30671 !! test
30672 2. New links that end in spaces
30673 !! options
30674 parsoid={
30675 "modes": ["html2wt"],
30676 "scrubWikitext": true
30677 }
30678 !! html/parsoid
30679 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30680 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30681 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30682 !! wikitext
30683 [[Berlin]] is the capital of Germany.
30684
30685 [[Foo]] '''bar'''
30686
30687 [[Boston]] is a city.
30688 !! end
30689
30690 !! test
30691 1. Table cells with escapable prefixes
30692 !! options
30693 parsoid={
30694 "modes": ["html2wt"],
30695 "scrubWikitext": false
30696 }
30697 !! html/parsoid
30698 <table>
30699 <tr><td>a</td></tr>
30700 <tr><td>-</td></tr>
30701 <tr><td>+</td></tr>
30702 </table>
30703 !! wikitext
30704 {|
30705 |a
30706 |-
30707 |<nowiki>-</nowiki>
30708 |-
30709 |<nowiki>+</nowiki>
30710 |}
30711 !! end
30712
30713 !! test
30714 2. Table cells with escapable prefixes
30715 !! options
30716 parsoid={
30717 "modes": ["html2wt"],
30718 "scrubWikitext": true
30719 }
30720 !! html/parsoid
30721 <table>
30722 <tr><td>a</td></tr>
30723 <tr><td>-</td></tr>
30724 <tr><td>+</td></tr>
30725 </table>
30726 !! wikitext
30727 {|
30728 |a
30729 |-
30730 | -
30731 |-
30732 | +
30733 |}
30734 !! end
30735
30736 !! test
30737 3a. Table cells with escapable prefixes after edits
30738 !! options
30739 parsoid={
30740 "modes": ["selser"],
30741 "scrubWikitext": true,
30742 "changes": [
30743 [ "table tbody tr:first-child td:first-child", "remove"]
30744 ]
30745 }
30746 !! wikitext
30747 {|
30748 |a||-
30749 |}
30750 !! wikitext/edited
30751 {|
30752 | -
30753 |}
30754 !! end
30755
30756 !! test
30757 3b. Table cells with escapable prefixes after edits
30758 !! options
30759 parsoid={
30760 "modes": ["selser"],
30761 "scrubWikitext": true,
30762 "changes": [
30763 [ "table tbody tr:first-child td:first-child", "html", "-" ],
30764 [ "#x", "remove" ]
30765 ]
30766 }
30767 !! wikitext
30768 {|
30769 |pqr
30770 |<span id="x">foo</span>+
30771 |}
30772 !! wikitext/edited
30773 {|
30774 | -
30775 | +
30776 |}
30777 !! end
30778
30779 # FIXME: This test will fail because
30780 # normalization doesn't realize that the id attribute
30781 # will eliminate the escapable scenario
30782 !! test
30783 4a. Table cells without escapable prefixes after edits
30784 !! options
30785 parsoid={
30786 "modes": ["selser"],
30787 "scrubWikitext": true,
30788 "changes": [
30789 [ "#x", "html", "-" ]
30790 ]
30791 }
30792 !! wikitext
30793 {|
30794 | id="x" |abcd
30795 |}
30796 !! wikitext/edited
30797 {|
30798 | id="x" |-
30799 |}
30800 !! end
30801
30802 ## This tests normalizer's ability to discriminate between
30803 ## cells having identical content.
30804 !! test
30805 4b. Table cells without escapable prefixes after edits
30806 !! options
30807 parsoid={
30808 "modes": ["selser"],
30809 "scrubWikitext": true,
30810 "changes": [
30811 [ "td", "html", "-" ]
30812 ]
30813 }
30814 !! wikitext
30815 {|
30816 |a||b
30817 |}
30818 !! wikitext/edited
30819 {|
30820 | -||-
30821 |}
30822 !! end
30823
30824 ## This tests normalizer's ability to not be tripped by
30825 ## comments (and whitespace)
30826 !! test
30827 4c. Table cells without escapable prefixes after edits
30828 !! options
30829 parsoid={
30830 "modes": ["selser"],
30831 "scrubWikitext": true,
30832 "changes": [
30833 [ "table tbody tr td:first-child", "remove" ]
30834 ]
30835 }
30836 !! wikitext
30837 {|
30838 |-
30839 <!--foo--> |a||-
30840 |}
30841 !! wikitext/edited
30842 {|
30843 |-
30844 <!--foo--> | -
30845 |}
30846 !! end
30847
30848 ## This tests normalizer's ability to handle HTML cells
30849 !! test
30850 4d. Table cells without escapable prefixes after edits
30851 !! options
30852 parsoid={
30853 "modes": ["selser"],
30854 "scrubWikitext": true,
30855 "changes": [
30856 [ "td", "html", "-" ]
30857 ]
30858 }
30859 !! wikitext
30860 <table>
30861 <tr><td>a</td></tr>
30862 </table>
30863 !! wikitext/edited
30864 <table>
30865 <tr><td>-</td></tr>
30866 </table>
30867 !! end
30868
30869 ## T111151 Remove font elements without attributes
30870 !! test
30871 5a. font tags without attributes should be dropped in scrubWikitext mode
30872 !! options
30873 parsoid={
30874 "modes": ["html2wt"],
30875 "scrubWikitext": true
30876 }
30877 !! html/parsoid
30878 <font>foo</font>
30879 <font><font>bar</font></font>
30880 <font class="x">boo</font>
30881 !! wikitext
30882 foo
30883 bar
30884 <font class="x">boo</font>
30885 !! end
30886
30887 !! test
30888 5b. font tags should not be dropped without scrubWikitext being enabled
30889 !! options
30890 parsoid={
30891 "modes": ["html2wt"],
30892 "scrubWikitext": false
30893 }
30894 !! html/parsoid
30895 <font>foo</font>
30896 !! wikitext
30897 <font>foo</font>
30898 !! end
30899
30900 !! test
30901 Escape nowiki DOM elements
30902 !! options
30903 parsoid=html2wt
30904 !! html/parsoid
30905 <nowiki><i>foo</i></nowiki>
30906 !! wikitext
30907 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
30908 !! end
30909
30910 # This is meant to be an interim fix while we go about figuring out
30911 # how to not introduce these trailing <nowiki/>s in the first place.
30912 !! test
30913 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
30914 !! options
30915 parsoid=html2wt
30916 !! html/parsoid
30917 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
30918 y</p>
30919 <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>
30920 <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>
30921 !! wikitext
30922 x
30923 y
30924
30925 {{echo|
30926 1 = <nowiki/>}}
30927
30928 {{echo|
30929 1 = <nowiki/>
30930 }}
30931 !! end
30932
30933 !! test
30934 New list is serialized on newlines
30935 !! options
30936 parsoid=html2wt
30937 !! html/parsoid
30938 <p>The quick brown fox jumps over the lazy dog.</p><ul>
30939 <li>Yesterday</li>
30940 <li>Today</li>
30941 <li>Tomorrow</li>
30942 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
30943 !! wikitext
30944 The quick brown fox jumps over the lazy dog.
30945
30946 * Yesterday
30947 * Today
30948 * Tomorrow
30949
30950 The quick onyx goblin jumps over the lazy dwarf.
30951 !! end
30952
30953 !! test
30954 New lists in formatting elements serialized w/o newlines
30955 !! options
30956 parsoid=html2wt
30957 !! html/parsoid
30958 <small>
30959
30960 <ul>
30961 <li>123</li>
30962 </ul>
30963
30964 </small>
30965
30966 <small><ul><li>hi</li></ul></small>
30967 !! wikitext
30968 <small>
30969 * 123
30970 </small>
30971
30972 <small>
30973 * hi
30974 </small>
30975 !! end
30976
30977 !! test
30978 New list in table doesn't need newlines
30979 !! options
30980 parsoid=html2wt
30981 !! html/parsoid
30982 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
30983 !! wikitext
30984 {|
30985 |
30986 * test
30987 * 123
30988 |}
30989 !! end
30990
30991 # ---------------------------------------------------
30992 # End of tests spec'ing wikitext serialization norms |
30993 # ---------------------------------------------------
30994
30995 # T104032
30996 !! test
30997 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
30998 !! options
30999 parsoid=html2wt
31000 !! html/parsoid
31001 a<p>b</p>
31002 <b>c</b><p>d</p>
31003 <table><tr>
31004 <td>a<p>b</p></td>
31005 <td><b>c</b><p>d</p></td>
31006 </tr></table>
31007 !! wikitext
31008 a
31009
31010 b
31011
31012 '''c'''
31013
31014 d
31015 {|
31016 |a
31017 b
31018 |'''c'''
31019 d
31020 |}
31021 !! end
31022
31023 !! test
31024 Anchor without href scenarios
31025 !! options
31026 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
31027 !! html/parsoid
31028 <a class="bc"></a>
31029 <a class="no">dice</a>
31030 <a name="foo"></a>
31031 !! wikitext
31032
31033 dice
31034 <span name="foo"></span>
31035 !! end
31036
31037 !! test
31038 New transclusion added after a list should be serialized after the list
31039 !! options
31040 parsoid=html2wt
31041 !! html/parsoid
31042 <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>
31043 !! wikitext
31044 * a
31045 {{echo|foo}}
31046 !! end
31047
31048 # -----------------------------------------------------------------
31049 # End of section for Parsoid-only html2wt tests for serialization
31050 # of new content
31051 # -----------------------------------------------------------------
31052
31053 # -----------------------------------------------------------------
31054 # The following section of tests are primarily to spec behavior of
31055 # the selective serializer. All these tests have manual selser
31056 # changes. The automated selser changes for all tests handle the
31057 # wide variation of changes, but these tests here capture specs
31058 # deterministically.
31059 # ----------------------------------------------------------------
31060
31061 ## T90517
31062 !! test
31063 Selser: New comments should not be lost
31064 !! options
31065 parsoid={
31066 "modes": ["selser"],
31067 "changes": [
31068 [ "#a", "after", "<!--c1-->" ],
31069 [ "#b", "before", "<!--c2-->" ]
31070 ]
31071 }
31072 !! wikitext
31073 <span id="a">a</span>
31074
31075 <span id="b">b</span>
31076 !! wikitext/edited
31077 <span id="a">a</span><!--c1-->
31078
31079 <!--c2--><span id="b">b</span>
31080 !! end
31081
31082 ## T89383
31083 !! test
31084 Selser: Check for validity of DSR before using it
31085 !! options
31086 parsoid={
31087 "modes": ["selser"],
31088 "changes": [
31089 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
31090 ]
31091 }
31092 !! wikitext
31093 <span id="a">a</span>
31094 !! wikitext/edited
31095 {{DISPLAYTITLE:foo}}
31096 <span id="a">a</span>
31097 !! end
31098
31099 !! test
31100 1. DOMDiff: Changes to <ref> content should be looked up using id
31101 !! options
31102 parsoid={
31103 "modes": ["selser"],
31104 "changes": [
31105 ["#X", "after", "bar"],
31106 ["#Y", "after", "baz"]
31107 ]
31108 }
31109 !! wikitext
31110 X <ref><span id="X">foo</span></ref>
31111 Y <ref name="a" />
31112 <references>
31113 <ref name="a"><span id="Y">foo</span></ref>
31114 </references>
31115 !! wikitext/edited
31116 X <ref><span id="X">foo</span>bar</ref>
31117 Y <ref name="a" />
31118 <references>
31119 <ref name="a"><span id="Y">foo</span>baz</ref>
31120 </references>
31121 !! end
31122
31123 !! test
31124 2. DOMDiff: Changes to <ref> content should be looked up using id
31125 !! options
31126 parsoid={
31127 "modes": ["selser"],
31128 "changes": [
31129 ["#Z", "after", "bar"]
31130 ]
31131 }
31132 !! wikitext
31133 A <ref>foo bar for a</ref>
31134 B <ref group="X" name="b" />
31135
31136 <references />
31137
31138 <references group="X">
31139 <ref name="b"><span id="Z">foo</span></ref>
31140 </references>
31141 !! wikitext/edited
31142 A <ref>foo bar for a</ref>
31143 B <ref group="X" name="b" />
31144
31145 <references />
31146
31147 <references group="X">
31148 <ref name="b"><span id="Z">foo</span>bar</ref>
31149 </references>
31150 !! end
31151
31152 !! test
31153 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
31154 !! options
31155 parsoid={
31156 "modes": ["selser"],
31157 "changes": [
31158 [ "div:first-child", "text", "bar" ]
31159 ]
31160 }
31161 !! wikitext
31162 <div style="{{1x|color:red;}}%">foo</div>
31163 !! wikitext/edited
31164 <div style="{{1x|color:red;}}%">bar</div>
31165 !! end
31166
31167 !! test
31168 Empty LI (T49673)
31169 !! wikitext
31170 *a
31171 *
31172 *
31173 *b
31174 !! html+tidy
31175 <ul><li>a</li>
31176 <li class="mw-empty-elt"></li>
31177 <li class="mw-empty-elt"></li>
31178 <li>b</li></ul>
31179 !! end
31180
31181 !! test
31182 Thumbnail output
31183 !! wikitext
31184 [[File:Thumb.png|thumb]]
31185 !! html/php+tidy
31186 <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>
31187 !! html/parsoid
31188 <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>
31189 !! end
31190
31191 !! test
31192 unclosed internal link XSS (T137264)
31193 !! wikitext
31194 [[#%3Cscript%3Ealert(1)%3C/script%3E|
31195 !! html/php
31196 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
31197 </p>
31198 !! html/parsoid
31199 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
31200 !! end
31201
31202 !! test
31203 Validating that <style> isn't eaten by tidy (T167349)
31204 !! options
31205 styletag=1
31206 !! wikitext
31207 <div class="foo">
31208 <style>.foo::before { content: "<foo>"; }</style>
31209 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
31210 </div>
31211 !! html/php+tidy
31212 <div class="foo">
31213 <style>.foo::before { content: "<foo>"; }</style>
31214 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
31215 </div>
31216 !! html/parsoid
31217 <div class="foo">
31218 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31219 <style data-x-data-mw-foobar="baz" typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{"data-x-data-mw-foobar":"baz"},"body":{"extsrc":".foo::after { content: \"&lt;bar>\"; }"}}'>.foo::after { content: "<bar>"; }</style>
31220 </div>
31221 !! end
31222
31223 ## Right now, Parsoid doesn't de-duplicate style tags.
31224 ## So, we shouldn't see link tags that need to bypass the sanitizer.
31225 ## In a followup patch, when we de-duplicate style tags and
31226 ## introduce link tags, we'll add a hook for link tags in
31227 ## the parser test runner script.
31228 !! test
31229 Validating that <style> isn't wrapped in a paragraph (T186965)
31230 !! options
31231 styletag=1
31232 !! wikitext
31233 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31234
31235 <style>.foo::before { content: "<foo>"; }</style>
31236
31237 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
31238
31239 But if it's on a line with other content, let it be wrapped.
31240
31241 <style>.foo::before { content: "<foo>"; }</style> bar
31242
31243 foo <style>.foo::before { content: "<foo>"; }</style>
31244
31245 foo <style>.foo::before { content: "<foo>"; }</style> bar
31246
31247 And the same if we have non-paragraph-breaking whitespace
31248
31249 foo
31250 <style>.foo::before { content: "<foo>"; }</style>
31251 bar
31252 !! html/php
31253 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31254 </p>
31255 <style>.foo::before { content: "<foo>"; }</style>
31256 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
31257 <p>But if it's on a line with other content, let it be wrapped.
31258 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
31259 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
31260 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
31261 </p><p>And the same if we have non-paragraph-breaking whitespace
31262 </p><p>foo
31263 <style>.foo::before { content: "<foo>"; }</style>
31264 bar
31265 </p>
31266 !! html/parsoid
31267 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph</p>
31268
31269 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31270
31271 <p><style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style> &lt;link rel="foo" href="bar"/><style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style></p>
31272
31273 <p>But if it's on a line with other content, let it be wrapped.</p>
31274
31275 <p><style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style> bar</p>
31276
31277 <p>foo <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style></p>
31278
31279 <p>foo <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style> bar</p>
31280
31281 <p>And the same if we have non-paragraph-breaking whitespace</p>
31282
31283 <p>foo
31284 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31285 bar</p>
31286 !! end
31287
31288 !! test
31289 Validating that <link> isn't wrapped in a paragraph (T186965)
31290 !! options
31291 styletag=1
31292 !! wikitext
31293 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31294
31295 <link rel="foo" href="bar"/>
31296
31297 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
31298
31299 But if it's on a line with other content, let it be wrapped.
31300
31301 <link rel="foo" href="bar"/> bar
31302
31303 foo <link rel="foo" href="bar"/>
31304
31305 foo <link rel="foo" href="bar"/> bar
31306
31307 And the same if we have non-paragraph-breaking whitespace
31308
31309 foo
31310 <link rel="foo" href="bar"/>
31311 bar
31312 !! html/php
31313 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31314 </p>
31315 <link rel="foo" href="bar"/>
31316 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
31317 <p>But if it's on a line with other content, let it be wrapped.
31318 </p><p><link rel="foo" href="bar"/> bar
31319 </p><p>foo <link rel="foo" href="bar"/>
31320 </p><p>foo <link rel="foo" href="bar"/> bar
31321 </p><p>And the same if we have non-paragraph-breaking whitespace
31322 </p><p>foo
31323 <link rel="foo" href="bar"/>
31324 bar
31325 </p>
31326 !! end
31327
31328 !! test
31329 Extension returning multiple nodes starting with a style tag roundtrips
31330 !! options
31331 wgRawHtml=1
31332 !! wikitext
31333 <table>
31334 {{echo|<html><style>.hi { color: red; }</style>
31335 </html>}}
31336 <tr><td class="hi">ho</td></tr>
31337 </table>
31338 !! html/parsoid
31339 <p about="#mwt5" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;html>&lt;style>.hi { color: red; }&lt;/style>\n&lt;/html>"}},"i":0}},"\n&lt;tr>&lt;td class=\"hi\">ho&lt;/td>&lt;/tr>\n&lt;/table>"]}'><style typeof="mw:Extension/html" about="#mwt4" data-mw='{"name":"html","attrs":{},"body":{"extsrc":"&lt;style>.hi { color: red; }&lt;/style>\n"}}'>.hi { color: red; }</style><span about="#mwt4">
31340 </span></p><table about="#mwt5" data-parsoid='{"stx":"html"}'>
31341
31342 <tbody><tr><td class="hi">ho</td></tr>
31343 </tbody></table>
31344 !! end
31345
31346 !! test
31347 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
31348 !! config
31349 wgFragmentMode=[ 'html5', 'legacy' ]
31350 !! wikitext
31351 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
31352 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
31353 !! html/php
31354 <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>
31355 <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>
31356 </p>
31357 !! html/parsoid
31358 <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>
31359 <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>
31360 !! end
31361
31362 !! test
31363 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
31364 !! config
31365 wgFragmentMode=[ 'legacy' ]
31366 !! wikitext
31367 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
31368 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
31369 !! html/php
31370 <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>
31371 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
31372 </p>
31373 !! end
31374
31375 !! test
31376 Decoding of HTML entities in embedded HTML tags
31377 !! wikitext
31378 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
31379 !! html/php
31380 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
31381
31382 !! html/parsoid
31383 <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>
31384 !! end
31385
31386 !! test
31387 Decoding of HTML entities in indicator names for IDs (T104196)
31388 !! options
31389 parsoid=wt2html,html2html
31390 showindicators
31391 !! wikitext
31392 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
31393 !! html/php
31394 1&2&3&amp;4&amp;amp;5=Indicator
31395
31396 !! html/parsoid
31397 <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>
31398 !! end
31399
31400 # this version of the test strips out the ambiguity so Parsoid rts cleanly
31401 !! test
31402 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
31403 !! options
31404 showindicators
31405 !! wikitext
31406 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
31407 !! html/php
31408 1&2&3&amp;4&amp;amp;5=Indicator
31409
31410 !! html/parsoid
31411 <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>
31412 !! end
31413
31414 # This fragment mode is what Parsoid supports.
31415 !! test
31416 HTML5 ids: fallback to legacy
31417 !! config
31418 wgFragmentMode=[ 'html5', 'legacy' ]
31419 !! wikitext
31420 ==Foo bar==
31421
31422 ==foo Bar==
31423
31424 ==Тест==
31425
31426 ==Тест==
31427
31428 ==тест==
31429
31430 ==Hey < # " > % : '==
31431 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31432
31433 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31434
31435 <!-- These two links should produce identical HTML -->
31436 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31437
31438 !! html/php
31439 <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>
31440 <ul>
31441 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31442 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31443 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
31444 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
31445 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
31446 <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>
31447 </ul>
31448 </div>
31449
31450 <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>
31451 <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>
31452 <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>
31453 <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>
31454 <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>
31455 <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>
31456 <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>
31457 </p><p>💩 <span id="💩"></span>
31458 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
31459 </p>
31460 !! html/parsoid
31461 <h2 id="Foo_bar">Foo bar</h2>
31462
31463 <h2 id="foo_Bar_2">foo Bar</h2>
31464
31465 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
31466
31467 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
31468
31469 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
31470
31471 <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>
31472 <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>
31473
31474 <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>
31475
31476 <!-- These two links should produce identical HTML -->
31477 <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>
31478 !! end
31479
31480 # Parsoid doesn't support this mode
31481 !! test
31482 HTML5 ids: legacy with a fallback to modern
31483 !! config
31484 wgFragmentMode=[ 'legacy', 'html5' ]
31485 !! wikitext
31486 ==Foo bar==
31487
31488 ==foo Bar==
31489
31490 ==Тест==
31491
31492 ==Тест==
31493
31494 ==тест==
31495
31496 ==Hey < # " > % : '==
31497 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31498
31499 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31500
31501 <!-- These two links should produce identical HTML -->
31502 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31503
31504 !! html/php
31505 <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>
31506 <ul>
31507 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31508 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31509 <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>
31510 <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>
31511 <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>
31512 <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>
31513 </ul>
31514 </div>
31515
31516 <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>
31517 <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>
31518 <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>
31519 <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>
31520 <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>
31521 <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>
31522 <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>
31523 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
31524 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
31525 </p>
31526 !! end
31527
31528 # Parsoid doesn't support this mode.
31529 !! test
31530 HTML5 ids: no legacy
31531 !! config
31532 wgFragmentMode=[ 'html5' ]
31533 !! wikitext
31534 ==Foo bar==
31535
31536 ==foo Bar==
31537
31538 ==Тест==
31539
31540 ==Тест==
31541
31542 ==тест==
31543
31544 ==Hey < # " > % : '==
31545 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31546
31547 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31548
31549 <!-- These two links should produce identical HTML -->
31550 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31551
31552 !! html/php
31553 <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>
31554 <ul>
31555 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31556 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31557 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
31558 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
31559 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
31560 <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>
31561 </ul>
31562 </div>
31563
31564 <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>
31565 <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>
31566 <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>
31567 <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>
31568 <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>
31569 <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>
31570 <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>
31571 </p><p>💩 <span id="💩"></span>
31572 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
31573 </p>
31574 !! end
31575
31576 !! test
31577 T90902: Normalize weird characters in section IDs
31578 !! config
31579 wgFragmentMode=[ 'html5', 'legacy' ]
31580 !! wikitext
31581 ==Foo&nbsp;bar==
31582 [[#Foo&nbsp;bar]]
31583
31584 !! html/php
31585 <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>
31586 <p><a href="#Foo_bar">#Foo&#160;bar</a>
31587 </p>
31588 !! html/parsoid
31589 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
31590 <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>
31591 !! end
31592
31593 !! test
31594 T51672: Test for brackets in attributes of elements in external link texts
31595 !! wikitext
31596 [http://example.com/ link <span title="title with [brackets]">span</span>]
31597 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
31598
31599 !! html/php
31600 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31601 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31602 </p>
31603 !! html/parsoid
31604 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
31605 <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>
31606 !! end
31607
31608 !! test
31609 T72875: Test for brackets in attributes of elements in internal link texts
31610 !! wikitext
31611 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
31612 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
31613
31614 !! html/php
31615 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31616 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31617 </p>
31618 !! html/parsoid
31619 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
31620 <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>
31621 !! end
31622
31623 !! test
31624 T199926: html arrow wt: Parsoid sometimes trips up on verticalbar chars in hrefs
31625 !! options
31626 parsoid={
31627 "modes": ["html2wt"]
31628 }
31629 !! html/parsoid
31630 <a href="https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total">9</a>
31631 <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>
31632 !! wikitext
31633 [https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total 9]
31634 [[stats:v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total|10]]
31635 !! end
31636
31637 !! test
31638 T179544: {{anchorencode:}} output should be always usable in links
31639 !! config
31640 wgFragmentMode=[ 'html5' ]
31641 !! wikitext
31642 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
31643 !! html/php
31644 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
31645 </p>
31646 !! html/parsoid
31647 <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>
31648 !! end
31649
31650 ## ------------------------------
31651 ## Parsoid section-wrapping tests
31652 ## ------------------------------
31653 !! test
31654 Section wrapping for well-nested sections (no leading content)
31655 !! options
31656 parsoid={
31657 "wrapSections": true
31658 }
31659 !! wikitext
31660 =1=
31661 a
31662
31663 =2=
31664 b
31665
31666 ==2.1==
31667 c
31668
31669 ==2.2==
31670 d
31671
31672 ===2.2.1===
31673 e
31674
31675 =3=
31676 f
31677 !! html/parsoid
31678 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31679 <p>a</p>
31680
31681 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31682 <p>b</p>
31683
31684 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
31685 <p>c</p>
31686
31687 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
31688 <p>d</p>
31689
31690 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
31691 <p>e</p>
31692
31693 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
31694 <p>f</p>
31695
31696 </section>
31697 !! end
31698
31699 !! test
31700 Section wrapping for well-nested sections (with leading content)
31701 !! options
31702 parsoid={
31703 "wrapSections": true
31704 }
31705 !! wikitext
31706 Para 1.
31707
31708 Para 2 with a <div>nested in it</div>
31709
31710 Para 3.
31711
31712 =1=
31713 a
31714
31715 =2=
31716 b
31717
31718 ==2.1==
31719 c
31720 !! html/parsoid
31721 <section data-mw-section-id="0"><p>Para 1.</p>
31722
31723 <p>Para 2 with a </p><div>nested in it</div>
31724
31725 <p>Para 3.</p>
31726
31727 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
31728 <p>a</p>
31729
31730 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31731 <p>b</p>
31732
31733 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
31734 <p>c</p>
31735
31736 </section></section>
31737 !! end
31738
31739 !! test
31740 Section wrapping with template-generated sections (good nesting 1)
31741 !! options
31742 parsoid={
31743 "wrapSections": true
31744 }
31745 !! wikitext
31746 =1=
31747 a
31748
31749 {{echo|1=
31750 ==1.1==
31751 b
31752 }}
31753
31754 ==1.2==
31755 c
31756
31757 =2=
31758 d
31759 !! html/parsoid
31760 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31761 <p>a</p>
31762
31763 <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">
31764 </span><p about="#mwt1">b</p>
31765 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
31766 <p>c</p>
31767
31768 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
31769 <p>d</p></section>
31770 !! end
31771
31772 # In this example, the template scope is mildly expanded to incorporate the
31773 # trailing newline after the transclusion since that is part of section 1.1.1
31774 !! test
31775 Section wrapping with template-generated sections (good nesting 2)
31776 !! options
31777 parsoid={
31778 "wrapSections": true,
31779 "modes": ["wt2html", "wt2wt"]
31780 }
31781 !! wikitext
31782 =1=
31783 a
31784
31785 {{echo|1=
31786 ==1.1==
31787 b
31788 ===1.1.1===
31789 d
31790 }}
31791 =2=
31792 e
31793 !! html/parsoid
31794 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31795 <p>a</p>
31796
31797 <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">
31798 </span><p about="#mwt1">b</p><span about="#mwt1">
31799 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
31800 </span><p about="#mwt1">d</p><span about="#mwt1">
31801 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
31802 <p>e</p></section>
31803 !! end
31804
31805 # In this example, the template scope is mildly expanded to incorporate the
31806 # trailing newline after the transclusion since that is part of section 1.2.1
31807 !! test
31808 Section wrapping with template-generated sections (good nesting 3)
31809 !! options
31810 parsoid={
31811 "wrapSections": true,
31812 "modes": ["wt2html", "wt2wt"]
31813 }
31814 !! wikitext
31815 =1=
31816 a
31817
31818 {{echo|1=
31819 x
31820 ==1.1==
31821 b
31822 ==1.2==
31823 c
31824 ===1.2.1===
31825 d
31826 }}
31827 =2=
31828 e
31829 !! html/parsoid
31830 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
31831 <p>a</p>
31832
31833 <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">
31834 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
31835 </span><p about="#mwt1">b</p><span about="#mwt1">
31836 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
31837 </span><p about="#mwt1">c</p><span about="#mwt1">
31838 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
31839 </span><p about="#mwt1">d</p><span about="#mwt1">
31840 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
31841 <p>e</p></section>
31842 !! end
31843
31844 # Because of section-wrapping and template-wrapping interactions,
31845 # the scope of the template is expanded so that the template markup
31846 # is valid in the presence of <section> tags.
31847 # This exercises the s1 is null scenario in the wrapSections code
31848 !! test
31849 Section wrapping with template-generated sections (bad nesting 1)
31850 !! options
31851 parsoid={
31852 "wrapSections": true
31853 }
31854 !! wikitext
31855 <div>
31856 a
31857
31858 {{echo|
31859 =1=
31860 b
31861 }}
31862
31863 c
31864 </div>
31865 !! html/parsoid
31866 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
31867 <p>a</p>
31868
31869 <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"]}'>
31870 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
31871 </span><p about="#mwt1">b
31872 </p><span about="#mwt1">
31873
31874 </span><p about="#mwt1">c</p><span about="#mwt1">
31875 </span></section></div></section>
31876 !! end
31877
31878 # Because of section-wrapping and template-wrapping interactions,
31879 # the scope of the template is expanded so that the template markup
31880 # is valid in the presence of <section> tags.
31881 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
31882 !! test
31883 Section wrapping with template-generated sections (bad nesting 2)
31884 !! options
31885 parsoid={
31886 "wrapSections": true
31887 }
31888 !! wikitext
31889 =1=
31890 a
31891
31892 {{echo|1=
31893 =2=
31894 b
31895 ==2.1==
31896 c
31897 }}
31898
31899 d
31900
31901 =3=
31902 e
31903 !! html/parsoid
31904 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31905 <p>a</p>
31906
31907 </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">
31908 </span><p about="#mwt1">b</p><span about="#mwt1">
31909 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
31910 </span><p about="#mwt1">c</p><span about="#mwt1">
31911
31912 </span><p about="#mwt1">d</p><span about="#mwt1">
31913
31914 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
31915 <p>e</p></section>
31916 !! end
31917
31918 # Because of section-wrapping and template-wrapping interactions,
31919 # additional template wrappers are added to <section> tags
31920 # so that template wrapping semantics are valid whether section
31921 # tags are retained or stripped. But, the template scope can expand
31922 # greatly when accounting for section tags.
31923 # This exercises the s1 and s2 are in different subtrees scenario
31924 !! test
31925 Section wrapping with template-generated sections (bad nesting 3)
31926 !! options
31927 parsoid={
31928 "wrapSections": true,
31929 "modes": ["wt2html", "wt2wt"]
31930 }
31931 !! wikitext
31932 =1=
31933 a
31934
31935 {{echo|1=
31936 ==1.2==
31937 b
31938 =2=
31939 c
31940 }}
31941
31942 d
31943
31944 =3=
31945 e
31946 !! html/parsoid
31947 <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>
31948 <p>a</p>
31949
31950 <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">
31951 </span><p about="#mwt1">b</p><span about="#mwt1">
31952 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
31953 </span><p about="#mwt1">c</p>
31954
31955 <p>d</p>
31956 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
31957 <p>e</p></section>
31958 !! end
31959
31960 !! test
31961 Section wrapping with uneditable lead section + div wrapping multiple sections
31962 !! options
31963 parsoid={
31964 "wrapSections": true
31965 }
31966 !! wikitext
31967 foo
31968
31969 <div style="border:1px solid red;">
31970 =1=
31971 a
31972
31973 ==1.1==
31974 b
31975
31976 =2=
31977 c
31978 </div>
31979
31980 =3=
31981 d
31982
31983 ==3.1==
31984 e
31985 !! html/parsoid
31986 <section data-mw-section-id="-1"><p>foo</p>
31987
31988 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31989 <section data-mw-section-id="1"><h1 id="1">1</h1>
31990 <p>a</p>
31991
31992 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31993 <p>b</p>
31994
31995 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31996 <p>c</p>
31997 </section></div>
31998
31999 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
32000 <p>d</p>
32001
32002 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
32003 <p>e</p>
32004 </section></section>
32005 !! end
32006
32007 !! test
32008 Section wrapping with editable lead section + div overlapping multiple sections
32009 !! options
32010 parsoid={
32011 "wrapSections": true
32012 }
32013 !! wikitext
32014 foo
32015
32016 =1=
32017 a
32018 <div style="border:1px solid red;">
32019 b
32020
32021 ==1.1==
32022 c
32023
32024 =2=
32025 d
32026 </div>
32027 e
32028
32029 =3=
32030 f
32031
32032 ==3.1==
32033 g
32034 !! html/parsoid
32035 <section data-mw-section-id="0"><p>foo</p>
32036
32037 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
32038 <p>a</p>
32039 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
32040 <p>b</p>
32041
32042 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
32043 <p>c</p>
32044
32045 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
32046 <p>d</p>
32047 </section></div>
32048 <p>e</p>
32049
32050 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
32051 <p>f</p>
32052
32053 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
32054 <p>g</p>
32055 </section></section>
32056 !! end
32057
32058 !! test
32059 HTML header tags should not be wrapped in section tags
32060 !! options
32061 parsoid={
32062 "wrapSections": true
32063 }
32064 !! wikitext
32065 foo
32066
32067 <h1>a</h1>
32068
32069 =b=
32070
32071 <h1>c</h1>
32072
32073 =d=
32074 !! html/parsoid
32075 <section data-mw-section-id="0"><p>foo</p>
32076
32077 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
32078
32079 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
32080
32081 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
32082
32083 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
32084 !! end
32085
32086 !! test
32087 Lead section containing only whitespace and comments.
32088 !! options
32089 parsoid={
32090 "wrapSections": true
32091 }
32092 !! wikitext
32093
32094 <!-- this is a comment, presumably significant to editors -->
32095 =1=
32096 a
32097
32098 =2=
32099 b
32100 !! html/parsoid
32101 <section data-mw-section-id="0" data-parsoid="{}">
32102 <!-- this is a comment, presumably significant to editors -->
32103 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
32104 <p>a</p>
32105
32106 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
32107 <p>b</p></section>
32108 !! end
32109
32110 !! test
32111 Pseudo-sections emitted by templates should have id -2
32112 !! options
32113 parsoid={
32114 "wrapSections": true
32115 }
32116 !! wikitext
32117 foo
32118 {{echo|<div>
32119 ==a==
32120 ==b==
32121 </div>
32122 }}
32123 !! html/parsoid
32124 <section data-mw-section-id="-1"><p>foo</p>
32125 </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}}]}'>
32126 <section data-mw-section-id="-1"><h2 id="a">a</h2>
32127 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
32128 </section></div><span about="#mwt1">
32129 </span></section>
32130 !! end
32131
32132 ##########################################################################
32133 Tests demonstrating white-space insensitivity in input wikitext
32134 for wikitext headings, wikitext list items, and wikitext table captions,
32135 headings, and cells. HTML versions of the same should preserve whitespace.
32136 ##########################################################################
32137 !! test
32138 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
32139 !! options
32140 parsoid={
32141 "modes": ["wt2html"],
32142 "preserveIEW": true
32143 }
32144 !! wikitext
32145 __NOTOC__
32146 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
32147 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
32148 == <!--Headings with fallback ids--> Личная жизнь ==
32149 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
32150 ; <!--term to define--> term : <!--term's definition--> definition
32151 {|
32152 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
32153 |-
32154 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
32155 |-
32156 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
32157 |-
32158 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
32159 |-
32160 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
32161 |}
32162 : {|
32163 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
32164 |} foo <!--c1-->
32165 !! html/php+tidy
32166 <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>
32167 <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>
32168 <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>
32169 <ul><li>List item</li></ul>
32170 <dl><dt>term&#160;</dt>
32171 <dd>definition</dd></dl>
32172 <table>
32173 <caption>Table Caption
32174 </caption>
32175 <tbody><tr>
32176 <th>Table Heading 1</th>
32177 <th>Table Heading 2
32178 </th></tr>
32179 <tr>
32180 <td>Table Cell 1</td>
32181 <td>Table Cell 2
32182 </td></tr>
32183 <tr>
32184 <td>class="foo"</td>
32185 <td>Table Cell 3
32186 </td></tr>
32187 <tr>
32188 <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
32189 </td></tr></tbody></table>
32190 <dl><dd><table>
32191 <tbody><tr>
32192 <td>Table Cell 1</td>
32193 <td>Table Cell 2
32194 </td></tr></tbody></table> foo</dd></dl>
32195 !! html/parsoid
32196 <meta property="mw:PageProp/notoc">
32197 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
32198 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
32199 <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>
32200 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
32201 <dl><dt><!--term to define-->term&nbsp;</dt><dd><!--term's definition-->definition</dd></dl>
32202 <table>
32203 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
32204 <tbody><tr>
32205 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th>Table Heading 2<!--c5--></th></tr>
32206 <tr>
32207 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
32208 <tr>
32209 <td>class="foo"</td><td><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
32210 <tr>
32211 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One">two</a> <!--c2--> | <!--c3--> some content</td></tr>
32212 </tbody></table>
32213 <dl><dd><table>
32214 <tbody><tr><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
32215 </tbody></table> foo<!--c1--></dd></dl>
32216 !! end
32217
32218 # Looks like <caption> is not accepted in HTML
32219 !! test
32220 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
32221 !! options
32222 parsoid={
32223 "modes": ["wt2html"],
32224 "preserveIEW": true
32225 }
32226 !! wikitext
32227 __NOTOC__
32228 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
32229 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
32230 <table>
32231 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
32232 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
32233 </table>
32234 !! html/php+tidy
32235 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
32236 <ul><li> List item </li></ul>
32237 <table>
32238 <tbody><tr><th> Table Heading </th><th></th></tr>
32239 <tr><td> Table Cell </td><th></th></tr>
32240 </tbody></table>
32241 !! html/parsoid
32242 <meta property="mw:PageProp/notoc"/>
32243 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
32244 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
32245 <table>
32246 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
32247 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
32248 </tbody></table>
32249 !! end
32250
32251 !! test
32252 Do not trim whitespace in links and quotes
32253 !! options
32254 parsoid={
32255 "modes": ["wt2html"],
32256 "preserveIEW": true
32257 }
32258 !! wikitext
32259 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
32260 [[Foo| some text ]]
32261 !! html/php+tidy
32262 <p>foo <i> italic </i> and <b> bold </b>
32263 <a href="/wiki/Foo" title="Foo"> some text </a>
32264 </p>
32265 !! html/parsoid
32266 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
32267 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
32268 !! end
32269
32270 !! test
32271 Remove p tags surrounding a single element in a figcaption
32272 !! options
32273 parsoid=html2wt
32274 !! wikitext
32275 [[File:Foobar.jpg|right|200x200px|Caption]]
32276 !! html/parsoid
32277 <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>
32278 !! end
32279
32280 !! test
32281 Selser preserves lack of newline before list and allows newline after the list
32282 !! options
32283 parsoid={
32284 "modes": ["selser"],
32285 "scrubWikitext": true,
32286 "changes": [
32287 [ "ul", "after", "<p>footer</p>" ]
32288 ]
32289 }
32290 !! wikitext
32291 header
32292 *foo
32293 *bar
32294 !! wikitext/edited
32295 header
32296 *foo
32297 *bar
32298
32299 footer
32300 !! end
32301
32302
32303 !! test
32304 Selser does not introduce newlines between unedited paragraph preceding the list
32305 !! options
32306 parsoid={
32307 "modes": ["selser"],
32308 "changes": [
32309 [ "table tbody tr td p:last-child", "empty" ]
32310 ]
32311 }
32312 !! wikitext
32313 {|
32314 |
32315 header
32316 *foo
32317 *bar
32318 footer
32319 |}
32320 !! wikitext/edited
32321 {|
32322 |
32323 header
32324 *foo
32325 *bar
32326
32327 |}
32328 !! end
32329
32330 !! test
32331 Selser does not introduce newlines between unedited paragraph following the list
32332 !! options
32333 parsoid={
32334 "modes": ["selser"],
32335 "changes": [
32336 [ "table tbody tr td p:first-child", "empty" ]
32337 ]
32338 }
32339 !! wikitext
32340 {|
32341 |
32342 header
32343 *foo
32344 *bar
32345 footer
32346 |}
32347 !! wikitext/edited
32348 {|
32349 |
32350
32351 *foo
32352 *bar
32353 footer
32354 |}
32355 !! end
32356
32357 !! test
32358 Remove a list item but do not insert newline above list
32359 !! options
32360 parsoid={
32361 "modes": ["selser"],
32362 "changes": [
32363 [ "ul li:last-child", "remove" ]
32364 ]
32365 }
32366 !! wikitext
32367 header
32368 *foo
32369 *bar
32370 footer
32371 !! wikitext/edited
32372 header
32373 *foo
32374 footer
32375 !! end