<ins>/<del> elements can be phrasing or flow
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 # wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
40 # wgEnableMagicLinks
41 #
42 # For testing purposes, temporary articles can created:
43 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
44 # where '/' denotes a newline.
45
46 # This is the standard article assumed to exist.
47 !! article
48 Main Page
49 !! text
50 blah blah
51 !! endarticle
52
53 !!article
54 Foo
55 !!text
56 FOO
57 !!endarticle
58
59 !!article
60 Template:Foo
61 !!text
62 FOO
63 !!endarticle
64
65 !! article
66 Template:redirect to foo
67 !! text
68 #REDIRECT [[Template:Foo]]
69 !! endarticle
70
71 !! article
72 Template:Blank
73 !! text
74 !! endarticle
75
76 !! article
77 Template:pipe
78 !! text
79 |
80 !! endarticle
81
82 !! article
83 Template:=
84 !! text
85 <nowiki>=</nowiki>
86 !! endarticle
87
88 !!article
89 MediaWiki:bad image list
90 !!text
91 * [[File:Bad.jpg]] except [[Nasty page]]
92 !!endarticle
93
94 !! article
95 Template:inner list
96 !! text
97 * item 1
98 !! endarticle
99
100 !! article
101 Template:tbl-start
102 !! text
103 {|
104 !! endarticle
105
106 !! article
107 Template:tbl-end
108 !! text
109 |}
110 !! endarticle
111
112 !! article
113 Template:echo
114 !! text
115 {{{1}}}
116 !! endarticle
117
118 !! article
119 Template:echo3
120 !! text
121 {{{1}}}
122 {{{1}}}
123 {{{1}}}
124 !! endarticle
125
126 // For Serbian; localize Template namespace
127 !! article
128 Шаблон:Echo
129 !! text
130 {{{1}}}
131 !! endarticle
132
133 !! article
134 Template:echo_with_span
135 !! text
136 <span>{{{1}}}</span>
137 !! endarticle
138
139 !! article
140 Template:echo_with_div
141 !! text
142 <div>{{{1}}}</div>
143 !! endarticle
144
145 !! article
146 Template:echo with depth
147 !! text
148 {{echo|{{{1}}}}}
149 !! endarticle
150
151 !! article
152 Template:blank_param
153 !! text
154 {{{1}}}
155 {{{}}}
156 !! endarticle
157
158 !! article
159 Template:table_attribs
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"|Foo
163 !! endarticle
164
165 !! article
166 Template:table_attribs_2
167 !! text
168 <noinclude>
169 |</noinclude>style="color:red;"|Foo
170 |Bar||Baz
171 !! endarticle
172
173 !! article
174 Template:table_attribs_3
175 !! text
176 <noinclude>
177 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
178 !! endarticle
179
180 !! article
181 Template:table_attribs_4
182 !! text
183 | style="background-color:#DC241f;" width="10px" |
184 !! endarticle
185
186 !! article
187 Template:table_attribs_5
188 !! text
189 <noinclude>
190 |</noinclude>style="color:red;"||Bar
191 !! endarticle
192
193 !! article
194 Template:table_attribs_6
195 !! text
196 style="background: <nowiki>
197
198
199 red;</nowiki>" |
200 !! endarticle
201
202 !! article
203 Template:table_attribs_7
204 !! text
205 <noinclude>
206 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
207 !! endarticle
208
209 !! article
210 Template:table_header_cells
211 !! text
212 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
213 !! endarticle
214
215 !! article
216 Template:table_cells
217 !! text
218 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
219 !! endarticle
220
221 !! article
222 Template:PartialTable
223 !! text
224 {|
225 |-
226 !! endarticle
227
228 !! article
229 Template:image_attribs
230 !! text
231 <noinclude>
232 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
233 !! endarticle
234
235 ## See T48811 for details
236 !! article
237 Template:mixed_attr_content_template
238 !! text
239 style="color:red;" title="T48811"
240 |-
241 |foo
242 !! endarticle
243
244 !! article
245 Template:definition_list
246 !! text
247 one
248 ::two
249 !! endarticle
250
251 !! article
252 A?b
253 !! text
254 Weirdo titles!
255 !! endarticle
256
257 !!article
258 Template:Bullet
259 !!text
260 *Bar
261 !!endarticle
262
263 !!article
264 Template:OpenTable
265 !!text
266 {|
267 !!endarticle
268
269 !!article
270 Template:EmptyLITest
271 !!text
272 *a
273 *
274 *
275 *b
276 !!endarticle
277
278 !!article
279 Template:EmptyTRTest
280 !!text
281 {|
282 |-
283 |-
284 |foo
285 |-
286 |-
287 |bar
288 |}
289 !!endarticle
290
291 !!article
292 Template:EmptyTRWithHTMLAttrTest
293 !!text
294 <table>
295 <tr align="center"></tr>
296 <tr><td>foo</td></tr>
297 <tr align="center"></tr>
298 <tr><td>bar</td></tr>
299 </table>
300 !!endarticle
301
302 !! article
303 Template:With: Colon
304 !! text
305 Template with colon
306 !! endarticle
307
308 ###
309 ### Basic tests
310 ###
311
312 !! test
313 Blank input
314 !! wikitext
315 !! html
316 !! end
317
318 !! test
319 Simple paragraph
320 !! wikitext
321 This is a simple paragraph.
322 !! html
323 <p>This is a simple paragraph.
324 </p>
325 !! end
326
327 !! test
328 Paragraphs with extra newline spacing
329 !! wikitext
330 a
331
332 b (+2 nls)
333
334
335 c (+3 nls)
336
337
338
339 d (+4 nls)
340
341
342
343
344 e (+5 nls)
345 !! html
346 <p>a
347 </p><p>b (+2 nls)
348 </p><p><br />
349 c (+3 nls)
350 </p><p><br />
351 </p><p>d (+4 nls)
352 </p><p><br />
353 </p><p><br />
354 e (+5 nls)
355 </p>
356 !! end
357
358 !! test
359 Paragraphs with newline spacing with comment lines in between
360 !! wikitext
361 ----
362 a
363 <!--foo-->
364 b
365 ----
366 a
367 <!--foo--><!--More than 1 comment, still stripped-->
368 b
369 ----
370 a
371 <!--foo--> <!----> <!-- bar -->
372 b
373 ----
374 a
375 <!--foo-->
376
377 b
378 ----
379 a
380
381 <!--foo-->
382 b
383 ----
384 a
385 <!--foo-->
386
387
388 b
389 ----
390 a
391
392
393 <!--foo-->
394 b
395 ----
396 !! html
397 <hr />
398 <p>a
399 b
400 </p>
401 <hr />
402 <p>a
403 b
404 </p>
405 <hr />
406 <p>a
407 b
408 </p>
409 <hr />
410 <p>a
411 </p><p>b
412 </p>
413 <hr />
414 <p>a
415 </p><p>b
416 </p>
417 <hr />
418 <p>a
419 </p><p><br />
420 b
421 </p>
422 <hr />
423 <p>a
424 </p><p><br />
425 b
426 </p>
427 <hr />
428
429 !! end
430
431 !! test
432 Paragraphs with newline spacing with non-empty white-space lines in between
433 !! wikitext
434 ----
435 a
436
437 b
438 ----
439 a
440
441
442 b
443 ----
444 !! html
445 <hr />
446 <p>a
447 </p><p>b
448 </p>
449 <hr />
450 <p>a
451 </p><p><br />
452 b
453 </p>
454 <hr />
455
456 !! end
457
458 !! test
459 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
460 !! wikitext
461 ----
462 a
463 <!--foo-->
464 b
465 ----
466 a
467 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
468 b
469 ----
470 a
471
472 <!--foo-->
473 <!--bar-->
474 b
475 ----
476 a
477
478 <!--foo-->
479 <!--bar-->
480
481 b
482 ----
483 !! html
484 <hr />
485 <p>a
486 b
487 </p>
488 <hr />
489 <p>a
490 b
491 </p>
492 <hr />
493 <p>a
494 </p><p>b
495 </p>
496 <hr />
497 <p>a
498 </p><p><br />
499 b
500 </p>
501 <hr />
502
503 !! end
504
505 !! test
506 Extra newlines: More paragraphs with indented comment
507 !! wikitext
508 a
509
510 <!--boo-->
511
512 b
513 !! html
514 <p>a
515 </p><p><br />
516 b
517 </p>
518 !!end
519
520 !! test
521 Extra newlines followed by heading
522 !! wikitext
523 a
524
525
526 =b=
527 [[a]]
528
529
530 =b=
531 !! html
532 <p>a
533 </p><p><br />
534 </p>
535 <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>
536 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
537 </p><p><br />
538 </p>
539 <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>
540
541 !! end
542
543 !! test
544 Extra newlines between heading and content are swallowed (Parsoid does not)
545 !! wikitext
546 =b=
547
548
549
550 [[a]]
551 !! html/php+tidy
552 <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>
553 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
554 </p>
555 !! html/parsoid
556 <h1 id="b">b</h1>
557 <p>
558 <br></p>
559
560 <p><a rel="mw:WikiLink" href="./A" title="A">a</a></p>
561 !! end
562
563 !! test
564 Extra new lines before and after lists are preserved
565 !! wikitext
566 a
567
568
569 *b
570
571
572 c
573 !! html/php+tidy
574 <p>a
575 </p><p><br />
576 </p>
577 <ul><li>b</li></ul>
578 <p><br />
579 c
580 </p>
581 !! html/parsoid
582 <p>a</p>
583 <p>
584 <br></p>
585 <ul><li>b</li></ul>
586 <p>
587 <br>
588 c</p>
589 !! end
590
591 # Parsoid regression test
592 !!test
593 Multiple newlines after tables are converted to p-br-p tags
594 !!options
595 parsoid=wt2html,wt2wt
596 !!wikitext
597 {|
598 |x
599 |}
600
601
602
603
604 =b=
605 !!html/php+tidy
606 <table>
607 <tbody><tr>
608 <td>x
609 </td></tr></tbody></table>
610 <p><br />
611 </p><p><br />
612 </p>
613 <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>
614 !!html/parsoid
615 <table>
616 <tbody>
617 <tr>
618 <td>x</td>
619 </tr>
620 </tbody>
621 </table>
622 <p><br/></p>
623 <p><br/></p>
624 <h1 id="b">b</h1>
625 !!end
626
627 !! test
628 Heading with line break in nowiki
629 !! options
630 parsoid=wt2html
631 !! config
632 wgFragmentMode=[ 'html5', 'legacy' ]
633 !! wikitext
634 ==A <nowiki>B
635 C</nowiki>==
636 !! html/php
637 <h2><span id="A_B.0AC"></span><span class="mw-headline" id="A_B
638 C">A B
639 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>
640
641 !! html/parsoid
642 <h2 id="A_B
643 C"><span id="A_B.0AC" typeof="mw:FallbackId"></span>A <span typeof="mw:Nowiki">B
644 C</span></h2>
645 !! end
646
647 !! test
648 Parsing an URL
649 !! wikitext
650 http://fr.wikipedia.org/wiki/🍺
651 <!-- EasterEgg we love beer, better be able be able to link to it -->
652 !! html
653 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
654 </p>
655 !! end
656
657 !! test
658 Simple list
659 !! wikitext
660 *Item 1
661 *Item 2
662 !! html
663 <ul><li>Item 1</li>
664 <li>Item 2</li></ul>
665
666 !! end
667
668 !! test
669 Italics and bold
670 !! wikitext
671 *plain
672 *plain''italic''plain
673 *plain''italic''plain''italic''plain
674 *plain'''bold'''plain
675 *plain'''bold'''plain'''bold'''plain
676 *plain''italic''plain'''bold'''plain
677 *plain'''bold'''plain''italic''plain
678 *plain''italic'''bold-italic'''italic''plain
679 *plain'''bold''bold-italic''bold'''plain
680 *plain'''''bold-italic'''italic''plain
681 *plain'''''bold-italic''bold'''plain
682 *plain''italic'''bold-italic'''''plain
683 *plain'''bold''bold-italic'''''plain
684 *plain l'''italic''plain
685 *plain l''''bold''' plain
686 !! html
687 <ul><li>plain</li>
688 <li>plain<i>italic</i>plain</li>
689 <li>plain<i>italic</i>plain<i>italic</i>plain</li>
690 <li>plain<b>bold</b>plain</li>
691 <li>plain<b>bold</b>plain<b>bold</b>plain</li>
692 <li>plain<i>italic</i>plain<b>bold</b>plain</li>
693 <li>plain<b>bold</b>plain<i>italic</i>plain</li>
694 <li>plain<i>italic<b>bold-italic</b>italic</i>plain</li>
695 <li>plain<b>bold<i>bold-italic</i>bold</b>plain</li>
696 <li>plain<i><b>bold-italic</b>italic</i>plain</li>
697 <li>plain<b><i>bold-italic</i>bold</b>plain</li>
698 <li>plain<i>italic<b>bold-italic</b></i>plain</li>
699 <li>plain<b>bold<i>bold-italic</i></b>plain</li>
700 <li>plain l'<i>italic</i>plain</li>
701 <li>plain l'<b>bold</b> plain</li></ul>
702
703 !! end
704
705 # this example taken from the [[simple:Moon]] article (T49326)
706 !! test
707 Italics and possessives (1)
708 !! wikitext
709 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
710 !! html
711 <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
712 </p>
713 !! end
714
715 # this example taken from [[en:Flaming Pie]] (T51926)
716 !! test
717 Italics and possessives (2)
718 !! wikitext
719 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
720 !! html
721 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
722 </p>
723 !! end
724
725 # this example taken from [[en:Dictionary]] (T51926)
726 !! test
727 Italics and possessives (3)
728 !! wikitext
729 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''.
730 !! html
731 <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>.
732 </p>
733 !! end
734
735
736 ###
737 ### 2-quote opening sequence tests
738 ###
739 !! test
740 Italics and bold: 2-quote opening sequence: (2,2)
741 !! wikitext
742 ''foo''
743 !! html
744 <p><i>foo</i>
745 </p>
746 !!end
747
748 !! test
749 Italics and bold: 2-quote opening sequence: (2,3)
750 !! wikitext
751 ''foo'''
752 !! html/*
753 <p><i>foo'</i>
754 </p>
755 !!end
756
757 !! test
758 Italics and bold: 2-quote opening sequence: (2,4)
759 !! options
760 parsoid=wt2html
761 !! wikitext
762 ''foo''''
763 !! html/*
764 <p><i>foo''</i>
765 </p>
766 !!end
767
768 # same html as previous, but wikitext adjusted to match parsoid html2wt
769 !! test
770 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
771 !! wikitext
772 ''foo<nowiki>''</nowiki>''
773 !! html
774 <p><i>foo''</i>
775 </p>
776 !! end
777
778 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
779 !! test
780 Italics and bold: 2-quote opening sequence: (2,5)
781 !! options
782 parsoid=wt2html
783 !! wikitext
784 ''foo'''''
785 !! html/php
786 <p><i>foo</i>
787 </p>
788 !! html/parsoid
789 <p><i>foo</i><b></b>
790 </p>
791 !!end
792
793 # same html as previous, but wikitext adjusted to match parsoid html2wt
794 !! test
795 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
796 !! wikitext
797 ''foo'''''<nowiki/>'''
798 !! html/php
799 <p><i>foo</i>
800 </p>
801 !! html/parsoid
802 <p><i>foo</i><b></b>
803 </p>
804 !! end
805
806
807 ###
808 ### 3-quote opening sequence tests
809 ###
810
811 !! test
812 Italics and bold: 3-quote opening sequence: (3,2)
813 !! wikitext
814 '''foo''
815 !! html/*
816 <p>'<i>foo</i>
817 </p>
818 !!end
819
820 !! test
821 Italics and bold: 3-quote opening sequence: (3,3)
822 !! wikitext
823 '''foo'''
824 !! html
825 <p><b>foo</b>
826 </p>
827 !!end
828
829 !! test
830 Italics and bold: 3-quote opening sequence: (3,4)
831 !! wikitext
832 '''foo''''
833 !! html/*
834 <p><b>foo'</b>
835 </p>
836 !!end
837
838 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
839 !! test
840 Italics and bold: 3-quote opening sequence: (3,5)
841 !! options
842 parsoid=wt2html
843 !! wikitext
844 '''foo'''''
845 !! html/php
846 <p><b>foo</b>
847 </p>
848 !! html/parsoid
849 <p><b>foo</b><i></i>
850 </p>
851 !!end
852
853 # same html as previous, but wikitext adjusted to match parsoid html2wt
854 !! test
855 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
856 !! wikitext
857 '''foo'''''<nowiki/>''
858 !! html/php
859 <p><b>foo</b>
860 </p>
861 !! html/parsoid
862 <p><b>foo</b><i></i>
863 </p>
864 !! end
865
866
867 ###
868 ### 4-quote opening sequence tests
869 ###
870
871 !! test
872 Italics and bold: 4-quote opening sequence: (4,2)
873 !! options
874 parsoid=wt2html
875 !! wikitext
876 ''''foo''
877 !! html/*
878 <p>''<i>foo</i>
879 </p>
880 !!end
881
882 # same html as previous, but wikitext adjusted to match parsoid html2wt
883 !! test
884 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
885 !! wikitext
886 <nowiki>''</nowiki>''foo''
887 !! html
888 <p>''<i>foo</i>
889 </p>
890 !! end
891
892 !! test
893 Italics and bold: 4-quote opening sequence: (4,3)
894 !! wikitext
895 ''''foo'''
896 !! html/*
897 <p>'<b>foo</b>
898 </p>
899 !!end
900
901 !! test
902 Italics and bold: 4-quote opening sequence: (4,4)
903 !! options
904 parsoid=wt2html
905 !! wikitext
906 ''''foo''''
907 !! html/*
908 <p>'<b>foo'</b>
909 </p>
910 !!end
911
912 # same html as previous, but wikitext adjusted to match parsoid html2wt
913 !! test
914 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
915 !! wikitext
916 '<nowiki/>'''foo''''
917 !! html
918 <p>'<b>foo'</b>
919 </p>
920 !! end
921
922 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
923 !! test
924 Italics and bold: 4-quote opening sequence: (4,5)
925 !! options
926 parsoid=wt2html
927 !! wikitext
928 ''''foo'''''
929 !! html/php
930 <p>'<b>foo</b>
931 </p>
932 !! html/parsoid
933 <p>'<b>foo</b><i></i>
934 </p>
935 !!end
936
937 # same html as previous, but wikitext adjusted to match parsoid html2wt
938 !! test
939 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
940 !! wikitext
941 '<nowiki/>'''foo'''''<nowiki/>''
942 !! html/php
943 <p>'<b>foo</b>
944 </p>
945 !! html/parsoid
946 <p>'<b>foo</b><i></i>
947 </p>
948 !! end
949
950
951 ###
952 ### 5-quote opening sequence tests
953 ###
954
955 !! test
956 Italics and bold: 5-quote opening sequence: (5,2)
957 !! options
958 parsoid=wt2html
959 !! wikitext
960 '''''foo''
961 !! html/*
962 <p><b><i>foo</i></b>
963 </p>
964 !!end
965
966 # same html as previous, but wikitext adjusted to match parsoid html2wt
967 !! test
968 Italics and bold: 5-quote opening sequence: (5,2+3)
969 !! wikitext
970 '''''foo'''''
971 !! html/*
972 <p><i><b>foo</b></i>
973 </p>
974 !! end
975
976 !! test
977 Italics and bold: 5-quote opening sequence: (5,3)
978 !! options
979 parsoid=wt2html
980 !! wikitext
981 '''''foo'''
982 !! html/*
983 <p><i><b>foo</b></i>
984 </p>
985 !!end
986
987 # same html as previous, but wikitext adjusted to match parsoid html2wt
988 !! test
989 Italics and bold: 5-quote opening sequence: (5,3+2)
990 !! wikitext
991 '''''foo'''''
992 !! html
993 <p><i><b>foo</b></i>
994 </p>
995 !! end
996
997 !! test
998 Italics and bold: 5-quote opening sequence: (5,4)
999 !! options
1000 parsoid=wt2html
1001 !! wikitext
1002 '''''foo''''
1003 !! html/*
1004 <p><i><b>foo'</b></i>
1005 </p>
1006 !!end
1007
1008 !! test
1009 Italics and bold: 5-quote opening sequence: (5,5)
1010 !! wikitext
1011 '''''foo'''''
1012 !! html
1013 <p><i><b>foo</b></i>
1014 </p>
1015 !!end
1016
1017 !! test
1018 Italics and bold: 5-quote opening sequence: (5,6)
1019 !! wikitext
1020 '''''foo''''''
1021 !! html/*
1022 <p><i><b>foo'</b></i>
1023 </p>
1024 !! end
1025
1026 ###
1027 ### multiple quote sequences in a line
1028 ###
1029
1030 !! test
1031 Italics and bold: multiple quote sequences: (2,4,2)
1032 !! options
1033 parsoid=wt2html
1034 !! wikitext
1035 ''foo''''bar''
1036 !! html/*
1037 <p><i>foo'<b>bar</b></i>
1038 </p>
1039 !! end
1040
1041 # same html as previous, but wikitext adjusted to match parsoid html2wt
1042 !! test
1043 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
1044 !! wikitext
1045 ''foo'<nowiki/>'''bar'''''
1046 !! html
1047 <p><i>foo'<b>bar</b></i>
1048 </p>
1049 !! end
1050
1051 !! test
1052 Italics and bold: multiple quote sequences: (2,4,3)
1053 !! options
1054 parsoid=wt2html
1055 !! wikitext
1056 ''foo''''bar'''
1057 !! html/*
1058 <p><i>foo'<b>bar</b></i>
1059 </p>
1060 !! end
1061
1062 # same html as previous, but wikitext adjusted to match parsoid html2wt
1063 !! test
1064 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
1065 !! wikitext
1066 ''foo'<nowiki/>'''bar'''''
1067 !! html
1068 <p><i>foo'<b>bar</b></i>
1069 </p>
1070 !! end
1071
1072 !! test
1073 Italics and bold: multiple quote sequences: (2,4,4)
1074 !! options
1075 parsoid=wt2html
1076 !! wikitext
1077 ''foo''''bar''''
1078 !! html/*
1079 <p><i>foo'<b>bar'</b></i>
1080 </p>
1081 !! end
1082
1083 # same html as previous, but wikitext adjusted to match parsoid html2wt
1084 !! test
1085 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
1086 !! wikitext
1087 ''foo'<nowiki/>'''bar'<nowiki/>'''''
1088 !! html
1089 <p><i>foo'<b>bar'</b></i>
1090 </p>
1091 !! end
1092
1093 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1094 !! test
1095 Italics and bold: multiple quote sequences: (3,4,2)
1096 !! options
1097 parsoid=wt2html
1098 !! wikitext
1099 '''foo''''bar''
1100 !! html/php
1101 <p><b>foo'</b>bar
1102 </p>
1103 !! html/parsoid
1104 <p><b>foo'</b>bar<i></i>
1105 </p>
1106 !! end
1107
1108 # same html as previous, but wikitext adjusted to match parsoid html2wt
1109 !! test
1110 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1111 !! wikitext
1112 '''foo''''bar''<nowiki/>''
1113 !! html/php
1114 <p><b>foo'</b>bar
1115 </p>
1116 !! html/parsoid
1117 <p><b>foo'</b>bar<i></i>
1118 </p>
1119 !! end
1120
1121 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1122 !! test
1123 Italics and bold: multiple quote sequences: (3,4,3)
1124 !! options
1125 parsoid=wt2html
1126 !! wikitext
1127 '''foo''''bar'''
1128 !! html/php
1129 <p><b>foo'</b>bar
1130 </p>
1131 !! html/parsoid
1132 <p><b>foo'</b>bar<b></b>
1133 </p>
1134 !! end
1135
1136 # same html as previous, but wikitext adjusted to match parsoid html2wt
1137 !! test
1138 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1139 !! wikitext
1140 '''foo''''bar'''<nowiki/>'''
1141 !! html/php
1142 <p><b>foo'</b>bar
1143 </p>
1144 !! html/parsoid
1145 <p><b>foo'</b>bar<b></b>
1146 </p>
1147 !! end
1148
1149 ###
1150 ### other quote tests
1151 ###
1152 !! test
1153 Italics and bold: other quote tests: (2,3,5)
1154 !! wikitext
1155 ''this is about '''foo's family'''''
1156 !! html
1157 <p><i>this is about <b>foo's family</b></i>
1158 </p>
1159 !!end
1160
1161
1162 !! test
1163 Italics and bold: other quote tests: (2,(3,3),2)
1164 !! wikitext
1165 ''this is about '''foo's''' family''
1166 !! html
1167 <p><i>this is about <b>foo's</b> family</i>
1168 </p>
1169 !!end
1170
1171
1172 !! test
1173 Italics and bold: other quote tests: (3,2,3,2)
1174 !! options
1175 parsoid=wt2html
1176 !! wikitext
1177 '''this is about ''foo'''s family''
1178 !! html/*
1179 <p><b>this is about <i>foo</i></b><i>s family</i>
1180 </p>
1181 !!end
1182
1183
1184 # same html as previous, but wikitext adjusted to match parsoid html2wt
1185 !! test
1186 Italics and bold: other quote tests: (3,2,3+2+2,2)
1187 !! wikitext
1188 '''this is about ''foo'''''<nowiki/>''s family''
1189 !! html
1190 <p><b>this is about <i>foo</i></b><i>s family</i>
1191 </p>
1192 !! end
1193
1194
1195 !! test
1196 Italics and bold: other quote tests: (3,2,3,3)
1197 !! wikitext
1198 '''this is about ''foo'''s family'''
1199 !! html/*
1200 <p>'<i>this is about </i>foo<b>s family</b>
1201 </p>
1202 !!end
1203
1204
1205 !! test
1206 Italics and bold: other quote tests: (3,(2,2),3)
1207 !! wikitext
1208 '''this is about ''foo's'' family'''
1209 !! html
1210 <p><b>this is about <i>foo's</i> family</b>
1211 </p>
1212 !!end
1213
1214
1215 !! test
1216 Italicized possessive
1217 !! wikitext
1218 The ''[[Main Page]]'''s talk page.
1219 !! html/php
1220 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1221 </p>
1222 !! html/parsoid
1223 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1224 !! end
1225
1226 !! test
1227 Quote balancing context should be restricted to td/th cells on the same wikitext line
1228 !! options
1229 parsoid=wt2html,wt2wt
1230 !! wikitext
1231 {|
1232 !''a!!''b
1233 |''a||''b
1234 |}
1235 !! html+tidy
1236 <table>
1237 <tbody><tr>
1238 <th><i>a</i></th>
1239 <th><i>b</i>
1240 </th>
1241 <td><i>a</i></td>
1242 <td><i>b</i>
1243 </td></tr></tbody></table>
1244 !! end
1245
1246 ###
1247 ### Non-html5 tags
1248 ###
1249
1250 !! test
1251 Non-html5 tags should be accepted
1252 !! wikitext
1253 <center>''foo''</center>
1254 <big>''foo''</big>
1255 <font>''foo''</font>
1256 <strike>''foo''</strike>
1257 <tt>''foo''</tt>
1258 !! html
1259 <center><i>foo</i></center>
1260 <p><big><i>foo</i></big>
1261 <font><i>foo</i></font>
1262 <strike><i>foo</i></strike>
1263 <tt><i>foo</i></tt>
1264 </p>
1265 !! end
1266
1267 !! test
1268 <wbr> is valid wikitext (T54468)
1269 !! wikitext
1270 <wbr>
1271 !! html
1272 <p><wbr />
1273 </p>
1274 !! end
1275
1276 # <strike> is HTML4, <s> is HTML4/5.
1277 !! test
1278 <s> or <strike> for strikethrough
1279 !! wikitext
1280 <strike>strike</strike>
1281
1282 <s>s</s>
1283 !! html
1284 <p><strike>strike</strike>
1285 </p><p><s>s</s>
1286 </p>
1287 !! end
1288
1289 ## a not permitted
1290 ## i,b,br omitted
1291 !! test
1292 Text-level semantic html elements in wikitext
1293 !! wikitext
1294 <em>text</em>
1295 <strong>text</strong>
1296 <small>text</small>
1297 <s>text</s>
1298 <cite>text</cite>
1299 <q>text</q>
1300 <dfn>text</dfn>
1301 <abbr>text</abbr>
1302 <data>text</data>
1303 <time>text</time>
1304 <code>text</code>
1305 <var>text</var>
1306 <samp>text</samp>
1307 <kbd>text</kbd>
1308 <sub>text</sub>
1309 <u>text</u>
1310 <mark>text</mark>
1311 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1312 <bdi>text</bdi>
1313 <bdo>text</bdo>
1314 <span>text</span>
1315 <wbr />
1316 !! html
1317 <p><em>text</em>
1318 <strong>text</strong>
1319 <small>text</small>
1320 <s>text</s>
1321 <cite>text</cite>
1322 <q>text</q>
1323 <dfn>text</dfn>
1324 <abbr>text</abbr>
1325 <data>text</data>
1326 <time>text</time>
1327 <code>text</code>
1328 <var>text</var>
1329 <samp>text</samp>
1330 <kbd>text</kbd>
1331 <sub>text</sub>
1332 <u>text</u>
1333 <mark>text</mark>
1334 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1335 <bdi>text</bdi>
1336 <bdo>text</bdo>
1337 <span>text</span>
1338 <wbr />
1339 </p>
1340 !! end
1341
1342 # test cases taken from
1343 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1344 !! test
1345 Ruby markup (W3C-style)
1346 !! wikitext
1347 ;Mono-ruby for individual base characters
1348 :<ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1349 ;Group ruby
1350 :<ruby>今日<rt>きょう</rt></ruby>
1351 ;Jukugo ruby
1352 :<ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1353 ;Inline ruby
1354 :<ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1355 ;Double-sided ruby
1356 :<ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1357
1358 <ruby>
1359 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1360 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1361 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1362 </ruby>
1363 !! html
1364 <dl><dt>Mono-ruby for individual base characters</dt>
1365 <dd><ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1366 <dt>Group ruby</dt>
1367 <dd><ruby>今日<rt>きょう</rt></ruby></dd>
1368 <dt>Jukugo ruby</dt>
1369 <dd><ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1370 <dt>Inline ruby</dt>
1371 <dd><ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1372 <dt>Double-sided ruby</dt>
1373 <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>
1374 <p><ruby>
1375 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1376 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1377 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1378 </ruby>
1379 </p>
1380 !! end
1381
1382 # The next two test different paths in the sanitizer.
1383 !! test
1384 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1385 !! wikitext
1386 <blockquote|>a</blockquote>
1387
1388 <b→> doesn't terminate </b→>
1389
1390 <bä> doesn't terminate </bä>
1391
1392 <boo> doesn't terminate </boo>
1393
1394 <s.foo> doesn't terminate </s.foo>
1395
1396 <sub-ID#1>
1397 !! html
1398 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1399 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1400 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1401 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1402 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1403 </p><p>&lt;sub-ID#1&gt;
1404 </p>
1405 !! end
1406
1407 !! test
1408 Non-word characters don't terminate tag names
1409 !! wikitext
1410 <blockquote|>a</blockquote>
1411
1412 <b→> doesn't terminate </b→>
1413
1414 <bä> doesn't terminate </bä>
1415
1416 <boo> doesn't terminate </boo>
1417
1418 <s.foo> doesn't terminate </s.foo>
1419
1420 <sub-ID#1>
1421 !! html+tidy
1422 <p>&lt;blockquote|&gt;a
1423 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1424 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1425 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1426 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1427 </p><p>&lt;sub-ID#1&gt;
1428 </p>
1429 !! end
1430
1431 ###
1432 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1433 ### This checks that HTML5 tags (with non-word characters in the tag
1434 ### name) make it safely through the parser -- the Sanitizer will
1435 ### munge them later, as it should.
1436 ###
1437 !! test
1438 Non-word characters are valid in extension tags (T19663)
1439 !! wikitext
1440 <tåg>tåg</tåg>
1441 !! html/php
1442 <pre>
1443 'tåg'
1444 array (
1445 )
1446 </pre>
1447
1448 !! html/parsoid
1449 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1450 !! end
1451
1452 !! test
1453 Isolated close tags should be treated as literal text (T54760)
1454 !! options
1455 parsoid=wt2html
1456 !! wikitext
1457 </b>
1458
1459 <s.foo>s</s>
1460 !! html/php+tidy
1461 <p class="mw-empty-elt">
1462 </p><p>&lt;s.foo&gt;s
1463 </p>
1464 !! html/parsoid
1465 <p>&lt;s.foo&gt;s</p>
1466 !! end
1467
1468 ###
1469 ### Special characters
1470 ###
1471
1472 !! test
1473 Bare pipe character (T54363)
1474 !! wikitext
1475 |
1476 !! html
1477 <p>|
1478 </p>
1479 !! end
1480
1481 !! test
1482 Bare pipe character from a template (T54363)
1483 !! wikitext
1484 {{pipe}}
1485 !! html
1486 <p>|
1487 </p>
1488 !! end
1489
1490 ###
1491 ### <nowiki> test cases
1492 ###
1493
1494 !! test
1495 <nowiki> unordered list
1496 !! wikitext
1497 <nowiki>* This is not an unordered list item.</nowiki>
1498 !! html/php
1499 <p>* This is not an unordered list item.
1500 </p>
1501 !! html/parsoid
1502 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1503 !! end
1504
1505 !! test
1506 <nowiki> spacing
1507 !! wikitext
1508 <nowiki>Lorem ipsum dolor
1509
1510 sed abit.
1511 sed nullum.
1512
1513 :and a colon
1514 </nowiki>
1515 !! html/php
1516 <p>Lorem ipsum dolor
1517
1518 sed abit.
1519 sed nullum.
1520
1521 :and a colon
1522
1523 </p>
1524 !! html/parsoid
1525 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1526
1527 sed abit.
1528 sed nullum.
1529
1530 :and a colon
1531 </span></p>
1532 !! end
1533
1534 !! test
1535 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1536 !! wikitext
1537 <nowiki><span class="error"></nowiki>
1538 !! html/php
1539 <p>&lt;span class="error"&gt;
1540 </p>
1541 !! html/parsoid
1542 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1543 !! end
1544
1545 !! test
1546 nowiki 3
1547 !! wikitext
1548 :There is not nowiki.
1549 :There is <nowiki>nowiki</nowiki>.
1550
1551 #There is not nowiki.
1552 #There is <nowiki>nowiki</nowiki>.
1553
1554 *There is not nowiki.
1555 *There is <nowiki>nowiki</nowiki>.
1556 !! html/php
1557 <dl><dd>There is not nowiki.</dd>
1558 <dd>There is nowiki.</dd></dl>
1559 <ol><li>There is not nowiki.</li>
1560 <li>There is nowiki.</li></ol>
1561 <ul><li>There is not nowiki.</li>
1562 <li>There is nowiki.</li></ul>
1563
1564 !! html/parsoid
1565 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1566 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1567
1568 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1569 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1570
1571 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1572 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1573 !! end
1574
1575 !! test
1576 Entities inside <nowiki>
1577 !! wikitext
1578 <nowiki>&lt;</nowiki>
1579 !! html/php
1580 <p>&lt;
1581 </p>
1582 !! html/parsoid
1583 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1584 !! end
1585
1586 !! test
1587 Entities inside template parameters
1588 !! wikitext
1589 {{echo|&ndash;}}
1590 !! html/php+tidy
1591 <p>&#8211;
1592 </p>
1593 !! html/parsoid
1594 <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>
1595 !! end
1596
1597 !! test
1598 Properly escape nowiki when combined with other wiki markup
1599 !! options
1600 parsoid=html2wt
1601 !! html/parsoid
1602 <p>* &lt;/nowiki&gt; tag</p>
1603 !! wikitext
1604 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1605 !! end
1606
1607 !! test
1608 T93824: Put escaped HTML tags inside nowiki
1609 !! options
1610 parsoid=html2wt
1611 !! html/parsoid
1612 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1613 !! wikitext
1614 <nowiki><h2>foo</h2></nowiki>
1615 !! end
1616
1617 !! test
1618 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1619 !! options
1620 parsoid=html2wt
1621 !! html/parsoid
1622 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1623 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1624 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1625 !! wikitext
1626 This text: L'[[Foo]]
1627 This text: L<nowiki>''</nowiki>[[Foo]]
1628 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1629 !! end
1630
1631 # This test fails because wikitext whitespace is not normalized before comparing.
1632 !! test
1633 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1634 !! options
1635 parsoid=html2wt
1636 !! html/parsoid
1637 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1638 </p>
1639 !! wikitext
1640 This text : L<nowiki>''</nowiki>[[Foo]]
1641 !! end
1642
1643 # This test and the next one are html2wt only as they test that incorrect wikitext
1644 # passed in template arguments gets escaped or wrapped in nowikis where required.
1645 !! test
1646 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1647 !! options
1648 parsoid=html2wt
1649 !! html/parsoid
1650 <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>
1651 <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>
1652 !! wikitext
1653 {{echo|foo{{!}}bar}}
1654 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1655 !! end
1656
1657 !! test
1658 T53961: Output correct nowikis in template arguments
1659 !! options
1660 parsoid=html2wt
1661 !! html/parsoid
1662 <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>
1663 <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>
1664 <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>
1665 <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>
1666 <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>
1667 !! wikitext
1668 {{echo|a [ b}}
1669 {{echo|<nowiki>a }} b</nowiki>}}
1670 {{echo|<nowiki>a [[ b</nowiki>}}
1671 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1672 {{echo|a <nowiki>}</nowiki>}}
1673 !! end
1674
1675 !! test
1676 Cases where "!!" needs nowiki protection
1677 !! options
1678 parsoid=html2wt
1679 !! html/parsoid
1680 <table>
1681 <tr><th>this needs protection !! here</th></tr>
1682 </table>
1683
1684 <table>
1685 <tr><th>this does not need
1686 protection !! here</th></tr>
1687 </table>
1688 !! wikitext
1689 {|
1690 !<nowiki>this needs protection !! here</nowiki>
1691 |}
1692
1693 {|
1694 !this does not need
1695 protection !! here
1696 |}
1697 !! end
1698
1699 ###
1700 ### Comments
1701 ###
1702 !! test
1703 Comments and Indent-Pre
1704 !! wikitext
1705 <!-- comment 1 --> asdf
1706
1707 <!-- comment 1 --> asdf
1708 <!-- comment 2 -->
1709
1710 <!-- comment 1 --> asdf
1711 <!-- comment 2 -->xyz
1712
1713 <!-- comment 1 --> asdf
1714 <!-- comment 2 --> xyz
1715 !! html
1716 <pre>asdf
1717 </pre>
1718 <pre>asdf
1719 </pre>
1720 <pre>asdf
1721 </pre>
1722 <p>xyz
1723 </p>
1724 <pre>asdf
1725 xyz
1726 </pre>
1727 !! end
1728
1729 !! test
1730 Comment test 2a
1731 !! wikitext
1732 asdf
1733 <!-- comment 1 -->
1734 jkl
1735 !! html
1736 <p>asdf
1737 jkl
1738 </p>
1739 !! end
1740
1741 !! test
1742 Comment test 2b
1743 !! wikitext
1744 asdf
1745 <!-- comment 1 -->
1746
1747 jkl
1748 !! html
1749 <p>asdf
1750 </p><p>jkl
1751 </p>
1752 !! end
1753
1754 !! test
1755 Comment test 3
1756 !! wikitext
1757 asdf
1758 <!-- comment 1 -->
1759 <!-- comment 2 -->
1760 jkl
1761 !! html
1762 <p>asdf
1763 jkl
1764 </p>
1765 !! end
1766
1767 !! test
1768 Comment test 4
1769 !! wikitext
1770 asdf<!-- comment 1 -->jkl
1771 !! html
1772 <p>asdfjkl
1773 </p>
1774 !! end
1775
1776 !! test
1777 Comment spacing
1778 !! wikitext
1779 a
1780 <!-- foo --> b <!-- bar -->
1781 c
1782 !! html
1783 <p>a
1784 </p>
1785 <pre> b
1786 </pre>
1787 <p>c
1788 </p>
1789 !! end
1790
1791 !! test
1792 Comment whitespace
1793 !! wikitext
1794 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1795 !! html
1796
1797 !! end
1798
1799 !! test
1800 Comment semantics and delimiters
1801 !! wikitext
1802 <!-- --><!----><!-----><!------>
1803 !! html/php
1804
1805 !! html/parsoid
1806 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1807 !! end
1808
1809 !! test
1810 Comment semantics and delimiters, redux
1811 !! wikitext
1812 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1813 -- foo -- funky huh? ... -->
1814 !! html/php
1815
1816 !! html/parsoid
1817 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1818 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1819 !! end
1820
1821 !! test
1822 Comment semantics and delimiters: directors cut
1823 !! wikitext
1824 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1825 everything starting with < followed by !-- until the first -- and > we see,
1826 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1827 -->-->
1828 !! html/php
1829 <p>--&gt;
1830 </p>
1831 !! html/parsoid
1832 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1833 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1834 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1835 --><p>--></p>
1836 !! end
1837
1838 !! test
1839 Comment semantics: nesting
1840 !! wikitext
1841 <!--<!-- no, we're not going to do anything fancy here -->-->
1842 !! html/php
1843 <p>--&gt;
1844 </p>
1845 !! html/parsoid
1846 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1847 !! end
1848
1849 # Parsoid closes the unclosed comment, even if it means a slight
1850 # round-trip diff.
1851 !! test
1852 Comment semantics: unclosed comment at end
1853 !! options
1854 parsoid=wt2html,html2html
1855 !! wikitext
1856 <!--This comment will run out to the end of the document
1857 !! html/php
1858
1859 !! html/parsoid
1860 <!--This comment will run out to the end of the document-->
1861 !! end
1862
1863 !! test
1864 Comment semantics: normalize comments to play nice with XML and browsers
1865 !! wikitext
1866 <!-- Browsers --!> think this is closed -->
1867 <!--> This would normally be text -->
1868 <!---> As would this -->
1869 <!-- XML doesn't like trailing dashes -------->
1870 <!-- Nor doubled hyphens -- anywhere in the data -->
1871 But this is not a comment.
1872 !! html/php
1873 <p>But this is not a comment.
1874 </p>
1875 !! html/parsoid
1876 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1877 <!--&#x3E; This would normally be text -->
1878 <!--&#x2D;&#x3E; As would this -->
1879 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1880 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1881 <p>But this is not a comment.</p>
1882 !! end
1883
1884 !! test
1885 Comment semantics: round-trip even text which contains encoded -->
1886 !! wikitext
1887 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1888 !! html/parsoid
1889 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1890 !! end
1891
1892 !! test
1893 Comment in template title
1894 !! wikitext
1895 {{f<!---->oo}}
1896 !! html
1897 <p>FOO
1898 </p>
1899 !! end
1900
1901 !! test
1902 Comment on its own line post-expand
1903 !! wikitext
1904 a
1905 {{blank}}<!---->
1906 b
1907 !! html
1908 <p>a
1909 </p><p>b
1910 </p>
1911 !! end
1912
1913 !! test
1914 Comment on its own line post-expand with non-significant whitespace
1915 !! wikitext
1916 a
1917 {{blank}} <!---->
1918 b
1919 !! html
1920 <p>a
1921 </p><p>b
1922 </p>
1923 !! end
1924
1925 !! test
1926 post-expand include size being exceeded
1927 !! options
1928 maxincludesize=20
1929 !! wikitext
1930 {{echo3|1234567890}}
1931 !! html
1932 <p><a href="/wiki/Template:Echo3" title="Template:Echo3">Template:Echo3</a><!-- WARNING: template omitted, post-expand include size too large -->
1933 </p>
1934 !! end
1935
1936 !! test
1937 max template depth being reached
1938 !! options
1939 maxtemplatedepth=1
1940 !! wikitext
1941 {{echo with depth|too deep!}}
1942 !! html
1943 <p><span class="error">Template recursion depth limit exceeded (1)</span>
1944 </p>
1945 !! end
1946
1947 !! test
1948 multiple templates that are redirects
1949 !! wikitext
1950 {{redirect to foo}}
1951 {{redirect to foo}}
1952 !! html
1953 <p>FOO
1954 FOO
1955 </p>
1956 !! end
1957
1958 !! test
1959 Multiple comments should still parse as SOL-transparent
1960 !! options
1961 parsoid=wt2html,wt2wt
1962 !! wikitext
1963 <!--c1-->*a
1964 <!--c2--><!--c3--><!--c4-->*b
1965 !! html/php
1966 <ul><li>a</li>
1967 <li>b</li></ul>
1968
1969 !! html/parsoid
1970 <!--c1--><ul>
1971 <li>a
1972 </li>
1973 <!--c2--><!--c3--><!--c4-->
1974 <li>b
1975 </li>
1976 </ul>
1977 !! end
1978
1979 ## Make sure ">" gets escaped in comments to avoid XSS
1980 !! test
1981 IE conditional comments
1982 !! wikitext
1983 <!--[if lt IE 9]>
1984 <script>alert('hi');</script>
1985 <![endif]-->
1986 !! html/parsoid
1987 <!--[if lt IE 9]&#x3E;
1988 <script&#x3E;alert('hi');</script&#x3E;
1989 <![endif]-->
1990 !! end
1991
1992 ###
1993 ### paragraph wrapping tests
1994 ###
1995
1996 !! test
1997 No block tags
1998 !! wikitext
1999 a
2000
2001 b
2002 !! html
2003 <p>a
2004 </p><p>b
2005 </p>
2006 !! end
2007
2008 !! test
2009 Block tag on one line (<div>)
2010 !! wikitext
2011 a <div>foo</div>
2012
2013 b
2014 !! html
2015 a <div>foo</div>
2016 <p>b
2017 </p>
2018 !! html+tidy
2019 <p>a </p><div>foo</div>
2020 <p>b
2021 </p>
2022 !! end
2023
2024 # Remex wraps empty tag runs with p-tags.
2025 # Parsoid strips them out during p-wrapping.
2026 !! test
2027 No p-wrappable content
2028 !! wikitext
2029 <span><div>x</div></span>
2030 <span><s><div>x</div></s></span>
2031 <small><em></em></small><span><s><div>x</div></s></span>
2032 !! html/php+tidy
2033 <span><div>x</div></span>
2034 <span><s><div>x</div></s></span>
2035 <p><small><em></em></small></p><span><s><div>x</div></s></span>
2036 !! html/parsoid
2037 <span><div>x</div></span>
2038 <span><s><div>x</div></s></span>
2039 <small><em></em></small><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 # The difference between Parsoid & Remex here
2126 # is because of Parsoid's Tidy-emulation code
2127 # for p-wrapping. We'll start work to remove this
2128 # emulation code in Parsoid sooner than later.
2129 # Remex wraps empty tag runs with p-tags.
2130 # Parsoid strips them out in a separate pass.
2131 !! test
2132 Empty lines between lines with block tags
2133 !! wikitext
2134 <div></div>
2135
2136
2137 <div></div>a
2138
2139 b
2140 <div>a</div>b
2141
2142 <div>b</div>d
2143
2144
2145 <div>e</div>
2146 !! html
2147 <div></div>
2148 <p><br />
2149 </p>
2150 <div></div>a
2151 <p>b
2152 </p>
2153 <div>a</div>b
2154 <div>b</div>d
2155 <p><br />
2156 </p>
2157 <div>e</div>
2158
2159 !! html+tidy
2160 <div></div>
2161 <p><br />
2162 </p>
2163 <div></div><p>a
2164 </p><p>b
2165 </p>
2166 <div>a</div><p>b
2167 </p><div>b</div><p>d
2168 </p><p><br />
2169 </p>
2170 <div>e</div>
2171 !! html/parsoid
2172 <div data-parsoid='{"stx":"html"}'></div>
2173
2174 <p><br /></p>
2175 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2176
2177 <p>b</p>
2178 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2179
2180 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2181
2182 <p><br /></p>
2183 <div data-parsoid='{"stx":"html"}'>e</div>
2184 !! end
2185
2186 !! test
2187 Unclosed HTML p-tags should be handled properly
2188 !! wikitext
2189 <div><p>foo</div>
2190 a
2191
2192 b
2193 !! html/php+tidy
2194 <div><p>foo</p></div>
2195 <p>a
2196 </p><p>b
2197 </p>
2198 !! html/parsoid
2199 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2200 <p>a</p>
2201 <p>b</p>
2202 !! end
2203
2204 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2205 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2206 ## them for now.
2207 !! test
2208 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2209 !! options
2210 parsoid=wt2html
2211 !! wikitext
2212 a [[Category:A1]] [[Category:A2]]
2213 [[Category:A3]]
2214 [[Category:A4]]
2215 !! html/parsoid
2216 <p>a</p>
2217 <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"/>
2218 !! end
2219
2220 !! test
2221 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2222 !! options
2223 parsoid=wt2html
2224 !! wikitext
2225 [[Category:A1]]a
2226 !! html/parsoid
2227 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2228 !! end
2229
2230 !! test
2231 No paragraph necessary for SOL transparent template
2232 !! wikitext
2233 <span><div>foo</div></span>
2234 [[Category:Foo]]
2235
2236 <span><div>foo</div></span>
2237 {{echo|[[Category:Foo]]}}
2238 !! html/php
2239 <span><div>foo</div></span>
2240 <span><div>foo</div></span>
2241
2242 !! html/parsoid
2243 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2244 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
2245
2246 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2247 <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}}]}'/>
2248 !! end
2249
2250 !! test
2251 Avoid expanding multiline sol transparent template ranges unnecessarily
2252 !! wikitext
2253 hi
2254
2255
2256 {{echo|<br/>
2257 }}
2258
2259 [[Category:Ho]]
2260 !! html/php
2261 <p>hi
2262 </p><p><br />
2263 <br />
2264 </p>
2265 !! html/parsoid
2266 <p>hi</p>
2267
2268 <p><br />
2269 <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">
2270 </span></p>
2271
2272 <link rel="mw:PageProp/Category" href="./Category:Ho" />
2273 !! end
2274
2275 !! test
2276 Paragraph wrapping following unclosed table
2277 !! options
2278 parsoid=wt2html,html2html
2279 !! wikitext
2280 {|
2281 |-
2282
2283 {|
2284 | x
2285 |}
2286
2287 a
2288
2289 b
2290
2291 c
2292 !! html/php+tidy
2293 <table>
2294
2295
2296 </table><table>
2297 <tbody><tr>
2298 <td>x
2299 </td></tr></tbody></table>
2300 <p>a
2301 </p><p>b
2302 </p><p>c
2303 </p>
2304 !! html/parsoid
2305 <table data-parsoid='{"autoInsertedEnd":true}'>
2306 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr>
2307
2308 </tbody></table><table>
2309 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>x</td></tr>
2310 </tbody></table>
2311
2312 <p>a</p>
2313
2314 <p>b</p>
2315
2316 <p>c</p>
2317 !! end
2318
2319 !! test
2320 Paragraph wrapping suppressed in html p
2321 !! options
2322 parsoid=wt2html,html2html
2323 !! wikitext
2324 <p>
2325
2326
2327 hi
2328
2329
2330
2331 </p>
2332 !! html/php+tidy
2333 <p>
2334
2335
2336 hi
2337
2338
2339
2340 </p>
2341 !! html/parsoid
2342 <p data-parsoid='{"stx":"html"}'>
2343
2344
2345 hi
2346
2347
2348
2349 </p>
2350 !! end
2351
2352 ###
2353 ### Preformatted text
2354 ###
2355
2356 !! test
2357 Preformatted text
2358 !! wikitext
2359 This is some
2360 Preformatted text
2361 With ''italic''
2362 And '''bold'''
2363 And a [[Main Page|link]]
2364 !! html
2365 <pre>This is some
2366 Preformatted text
2367 With <i>italic</i>
2368 And <b>bold</b>
2369 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2370 </pre>
2371 !! end
2372
2373 !! test
2374 Tabs don't trigger preformatted text
2375 !! wikitext
2376 This is not
2377 preformatted text.
2378 This is preformatted text.
2379 So is this.
2380 !! html/php
2381 <p> This is not
2382 preformatted text.
2383 </p>
2384 <pre>This is preformatted text.
2385 So is this.
2386 </pre>
2387 !! html/parsoid
2388 <p> This is not
2389 preformatted text.</p>
2390 <pre>This is preformatted text.
2391 So is this.</pre>
2392 !! end
2393
2394 !! test
2395 Space before tab needs nowiki pre protection
2396 !! options
2397 parsoid=html2wt
2398 !! html/parsoid
2399 <p> a</p>
2400 !! wikitext
2401 <nowiki> </nowiki> a
2402 !! end
2403
2404 !! test
2405 Ident preformatting with inline content
2406 !! wikitext
2407 a
2408 ''b''
2409 !! html
2410 <pre>a
2411 <i>b</i>
2412 </pre>
2413 !! end
2414
2415 !! test
2416 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2417 !! wikitext
2418 <pre><nowiki>
2419 <b>
2420 <cite>
2421 <em>
2422 </nowiki></pre>
2423 !! html
2424 <pre>
2425 &lt;b&gt;
2426 &lt;cite&gt;
2427 &lt;em&gt;
2428 </pre>
2429
2430 !! end
2431
2432 !! test
2433 Regression with preformatted in <center>
2434 !! wikitext
2435 <center>
2436 Blah
2437 </center>
2438 !! html
2439 <center>
2440 <pre>Blah
2441 </pre>
2442 </center>
2443
2444 !! end
2445
2446 !! test
2447 T54763: Preformatted in <blockquote>
2448 !! wikitext
2449 <blockquote>
2450 Blah
2451 {|
2452 |
2453 indented cell (no pre-wrapping!)
2454 |}
2455 </blockquote>
2456 !! html
2457 <blockquote>
2458 <p> Blah
2459 </p>
2460 <table>
2461 <tr>
2462 <td>
2463 <p> indented cell (no pre-wrapping!)
2464 </p>
2465 </td></tr></table>
2466 </blockquote>
2467
2468 !! end
2469
2470 !! test
2471 T53086: Double newlines in blockquotes should be turned into paragraphs
2472 !! wikitext
2473 <blockquote>
2474 Foo
2475
2476 Bar
2477 </blockquote>
2478 !! html
2479 <blockquote>
2480 <p>Foo
2481 </p><p>Bar
2482 </p>
2483 </blockquote>
2484
2485 !! end
2486
2487 !! test
2488 T17491: <ins>/<del> in blockquote
2489 !! wikitext
2490 <blockquote>
2491 Foo <del>bar</del> <ins>baz</ins> quux
2492 </blockquote>
2493 !! html
2494 <blockquote>
2495 <p>Foo <del>bar</del> <ins>baz</ins> quux
2496 </p>
2497 </blockquote>
2498
2499 !! html+tidy
2500 <blockquote>
2501 <p>Foo <del>bar</del> <ins>baz</ins> quux
2502 </p>
2503 </blockquote>
2504 !! end
2505
2506 !! test
2507 T17491: <ins>/<del> in blockquote (2)
2508 !! wikitext
2509 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2510 </blockquote>
2511 !! html
2512 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2513 </blockquote>
2514
2515 !! html+tidy
2516 <blockquote><p>Foo <del>bar</del> <ins>baz</ins> quux
2517 </p></blockquote>
2518 !! end
2519
2520 !! test
2521 <pre> with attributes (T5202)
2522 !! wikitext
2523 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2524 !! html
2525 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2526
2527 !! end
2528
2529 !! test
2530 <pre> with width attribute (T5202)
2531 !! wikitext
2532 <pre width="8">Narrow screen goodies</pre>
2533 !! html
2534 <pre width="8">Narrow screen goodies</pre>
2535
2536 !! end
2537
2538 !! test
2539 <pre> with forbidden attribute (T5202)
2540 !! wikitext
2541 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2542 !! html
2543 <pre width="8">Narrow screen goodies</pre>
2544
2545 !! end
2546
2547 !! test
2548 Entities inside <pre>
2549 !! wikitext
2550 <pre>&lt;</pre>
2551 !! html
2552 <pre>&lt;</pre>
2553
2554 !! end
2555
2556 !! test
2557 <pre> with forbidden attribute values (T5202)
2558 !! wikitext
2559 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2560 !! html
2561 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2562
2563 !! end
2564
2565 !! test
2566 <nowiki> inside <pre> (T15238)
2567 !! wikitext
2568 <pre>
2569 <nowiki>
2570 </pre>
2571 <pre>
2572 <nowiki></nowiki>
2573 </pre>
2574 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2575 !! html
2576 <pre>
2577 &lt;nowiki&gt;
2578 </pre>
2579 <pre>
2580
2581 </pre>
2582 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2583
2584 !! end
2585
2586 !! test
2587 <nowiki> inside of #tag:pre
2588 !! wikitext
2589 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2590 !! html/php
2591 <pre>Foo &#8594;bar</pre>
2592
2593 !! html/parsoid
2594 <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>
2595 !! end
2596
2597 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2598 ## aren't enclosed in nowikis.
2599 !! test
2600 <nowiki> and <pre> preference (first one wins)
2601 !! options
2602 parsoid=wt2html
2603 !! wikitext
2604 <pre>
2605 <nowiki>
2606 </pre>
2607 </nowiki>
2608 </pre>
2609
2610 <nowiki>
2611 <pre>
2612 <nowiki>
2613 </pre>
2614 </nowiki>
2615 </pre>
2616
2617 !! html/php
2618 <pre>
2619 &lt;nowiki&gt;
2620 </pre>
2621 <p>&lt;/nowiki&gt;
2622 &lt;/pre&gt;
2623 </p><p>
2624 &lt;pre&gt;
2625 &lt;nowiki&gt;
2626 &lt;/pre&gt;
2627
2628 &lt;/pre&gt;
2629 </p>
2630 !! html/parsoid
2631 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2632 </pre>
2633 <p>&lt;/nowiki></p>
2634
2635
2636 <p><span typeof="mw:Nowiki">
2637 &lt;pre>
2638 &lt;nowiki>
2639 &lt;/pre>
2640 </span></p>
2641 !! end
2642
2643 !! test
2644 </pre> inside nowiki
2645 !! wikitext
2646 <nowiki></pre></nowiki>
2647 !! html
2648 <p>&lt;/pre&gt;
2649 </p>
2650 !! end
2651
2652 !! test
2653 Empty pre; pre inside other HTML tags (T56946)
2654 !! wikitext
2655 a
2656
2657 <div><pre>
2658 foo
2659 </pre></div>
2660 <pre></pre>
2661 !! html/php+tidy
2662 <p>a
2663 </p>
2664 <div><pre>foo
2665 </pre></div>
2666 <pre></pre>
2667 !! html/parsoid
2668 <p>a</p>
2669
2670 <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
2671 </pre></div>
2672 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2673 !! end
2674
2675 !! test
2676 HTML pre followed by indent-pre
2677 !! wikitext
2678 <pre>foo</pre>
2679 bar
2680 !! html
2681 <pre>foo</pre>
2682 <pre>bar
2683 </pre>
2684 !! end
2685
2686 !! test
2687 Block tag pre
2688 !! wikitext
2689 <p><pre>foo</pre></p>
2690 !! html/php+tidy
2691 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2692 !! html/parsoid
2693 <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>
2694 !! end
2695
2696 !!test
2697 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2698 !! wikitext
2699 {{echo|}}
2700 !! html
2701
2702 !!end
2703
2704 !!test
2705 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2706 !! wikitext
2707 {{echo|
2708 foo}}
2709 !! html
2710 <p>foo
2711 </p>
2712 !!end
2713
2714 !! test
2715 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2716 !! wikitext
2717 {{echo|a
2718 b}}
2719 !! html
2720 <pre>a
2721 </pre>
2722 <p>b
2723 </p>
2724 !!end
2725
2726 !! test
2727 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2728 !! wikitext
2729 {{echo|a
2730 b
2731 c
2732 d
2733 e
2734 }}
2735 !! html
2736 <pre>a
2737 </pre>
2738 <p>b
2739 c
2740 </p>
2741 <pre>d
2742 </pre>
2743 <p>e
2744 </p>
2745 !!end
2746
2747 !!test
2748 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2749 !! wikitext
2750 {{echo| foo}}
2751
2752 {{echo| foo}}{{echo| bar}}
2753
2754 {{echo| foo}}
2755 {{echo| bar}}
2756
2757 {{echo|<!--cmt--> foo}}
2758
2759 <!--cmt-->{{echo| foo}}
2760
2761 {{echo|{{echo| }}bar}}
2762 !! html
2763 <pre>foo
2764 </pre>
2765 <pre>foo bar
2766 </pre>
2767 <pre>foo
2768 bar
2769 </pre>
2770 <pre>foo
2771 </pre>
2772 <pre>foo
2773 </pre>
2774 <pre>bar
2775 </pre>
2776 !!end
2777
2778 !! test
2779 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2780 !! wikitext
2781 {{echo| }}a
2782
2783 {{echo|
2784 }}a
2785
2786 {{echo|
2787 b}}
2788
2789 {{echo|a
2790 }}b
2791
2792 {{echo|a
2793 }} b
2794 !! html
2795 <pre>a
2796 </pre>
2797 <p><br />
2798 </p>
2799 <pre>a
2800 </pre>
2801 <p><br />
2802 </p>
2803 <pre>b
2804 </pre>
2805 <p>a
2806 </p>
2807 <pre>b
2808 </pre>
2809 <p>a
2810 </p>
2811 <pre>b
2812 </pre>
2813 !!end
2814
2815 ## Hmm, should Parsoid rt this?
2816 !! test
2817 Pres with newline attributes
2818 !! options
2819 parsoid=wt2html,html2html
2820 !! wikitext
2821 <pre class="one
2822 two">hi</pre>
2823 !! html/php
2824 <pre class="one two">hi</pre>
2825
2826 !! html/parsoid
2827 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2828 !! end
2829
2830 !! test
2831 Things that look like <pre> tags aren't treated as such
2832 !! wikitext
2833 Barack Obama <President> of the United States
2834 <President></President>
2835 !! html
2836 <p>Barack Obama &lt;President&gt; of the United States
2837 &lt;President&gt;&lt;/President&gt;
2838 </p>
2839 !! end
2840
2841 !! test
2842 Handle broken pre-like tags (T66025)
2843 !! options
2844 parsoid=wt2html
2845 !! wikitext
2846 {{echo|<pre <pre>x</pre>}}
2847
2848 <table><pre </table>
2849 !! html/php
2850 <pre>x</pre>
2851 <table>&lt;pre </table>
2852
2853 !! html/php+tidy
2854 <pre>x</pre>
2855 &lt;pre <table></table>
2856 !! html/parsoid
2857 <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>
2858
2859 <span data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>&lt;pre </span><table data-parsoid='{"stx":"html"}'></table>
2860 !! end
2861
2862 !! test
2863 Parsoid: handle pre with space after attribute
2864 !! options
2865 parsoid=wt2html
2866 !! wikitext
2867 <pre style="width:50%;" >{{echo|foo}}</pre>
2868 !! html/php
2869 <pre style="width:50%;">{{echo|foo}}</pre>
2870
2871 !! html/parsoid
2872 <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>
2873 !! end
2874
2875 # TODO / maybe: fix wt2wt for this
2876 !! test
2877 Parsoid: Don't paragraph-wrap fosterable content
2878 !! options
2879 parsoid=wt2html
2880 !! wikitext
2881 {|
2882 <td></td>
2883 <td></td>
2884
2885
2886
2887 |}
2888 !! html
2889 <table>
2890
2891 <tbody>
2892 <tr>
2893 <td></td>
2894
2895 <td></td></tr>
2896
2897
2898
2899 </tbody></table>
2900 !! end
2901
2902 !! test
2903 Self-closed pre
2904 !! wikitext
2905 <pre />
2906 !! html/php
2907 <pre></pre>
2908
2909 !! html/parsoid
2910 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":null}'></pre>
2911 !! end
2912
2913 !! test
2914 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2915 !! options
2916 parsoid=wt2html
2917 !! wikitext
2918 {|
2919 <td>
2920 <td>
2921 </td>
2922
2923
2924
2925 |}
2926 !! html
2927 <table>
2928
2929 <tbody>
2930 <tr>
2931 <td></td>
2932
2933 <td>
2934 </td></tr>
2935
2936
2937
2938 </tbody></table>
2939 !! end
2940
2941
2942 #--------------------------------------------------------------------
2943 # Transclusion parameter whitespace stripping tests
2944 # Behavior is different for positional and named parameters
2945 #--------------------------------------------------------------------
2946 !! test
2947 Templates: Strip leading and trailing whitespace from named-param values
2948 !! wikitext
2949 {{echo|1= a }}
2950
2951 {{echo|1= {{echo|b}} }}
2952
2953 {{echo| 1 =
2954 c }}
2955
2956 {{echo| 1 =
2957 * d
2958 }}
2959 !! html
2960 <p>a
2961 </p><p>b
2962 </p><p>c
2963 </p>
2964 <ul><li>d</li></ul>
2965
2966 !! end
2967
2968 !! test
2969 Templates: Don't strip whitespace from positional-param values
2970 !! wikitext
2971 {{echo|a }}
2972
2973 {{echo|{{echo|b}} }}
2974
2975 {{echo| c
2976 }}
2977
2978 {{echo| {{echo|d}}
2979 }}
2980
2981 {{echo|
2982 e}}
2983
2984 {{echo|
2985 *f}}
2986
2987 {{echo|
2988 }}g
2989 !! html
2990 <p>a
2991 </p><p>b
2992 </p>
2993 <pre>c
2994 </pre>
2995 <p><br />
2996 </p>
2997 <pre>d
2998 </pre>
2999 <p><br />
3000 </p>
3001 <pre>e
3002 </pre>
3003 <p><br />
3004 </p>
3005 <ul><li>f</li></ul>
3006 <p><br />
3007 </p>
3008 <pre>g
3009 </pre>
3010 !! end
3011
3012 !! test
3013 Templates: Don't recognize targets split by newlines
3014 !! options
3015 parsoid=wt2html
3016 !! wikitext
3017 {{ech
3018 o|foo}}
3019 !! html/php
3020 <p>{{ech
3021 o|foo}}
3022 </p>
3023 !! html/parsoid
3024 <p>{{ech
3025 o|foo}}</p>
3026 !! end
3027
3028 !! test
3029 Templates: Recognize targets when newlines and comments don't split the target
3030 !! options
3031 parsoid=wt2html
3032 !! wikitext
3033 {{
3034 <!--X--> ech<!--X-->o<!--X-->
3035 <!--X--> <!--X-->
3036
3037 |foo}}
3038 !! html/php
3039 <p>foo
3040 </p>
3041 !! html/parsoid
3042 <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>
3043 !! end
3044
3045 !! test
3046 Templates: Handle empty comment-and-ws-only lines correctly
3047 !! wikitext
3048 {{echo|foo
3049 <!--should be ignored-->
3050 <!--should be ignored as well-->
3051 bar}}
3052 !! html/php
3053 <p>foo
3054 bar
3055 </p>
3056 !! html/parsoid
3057 <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>
3058 !! end
3059
3060 !! test
3061 Templates: Handle comments in the target
3062 !! wikitext
3063 {{echo
3064 <!-- should be ignored -->
3065 |foo}}
3066
3067 {{echo
3068 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
3069 |foo}}
3070
3071 {{echo<!-- should be ignored -->
3072 |foo}}
3073
3074 {{echo<!-- should be ignored -->|foo}}
3075
3076 {{<!-- should be ignored -->echo|foo}}
3077 !! html/php
3078 <p>foo
3079 </p><p>foo
3080 </p><p>foo
3081 </p><p>foo
3082 </p><p>foo
3083 </p>
3084 !! html/parsoid
3085 <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>
3086
3087 <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>
3088
3089 <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>
3090
3091 <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>
3092
3093 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3094 !! end
3095
3096 !! test
3097 Templates: Handle comments in parameter names (T69657)
3098 !! wikitext
3099 {{echo|1
3100 <!-- should be ignored -->
3101 =foo}}
3102
3103 {{echo|
3104 <!-- should be ignored -->
3105 1 = foo}}
3106
3107 {{echo|1<!-- should be ignored -->=foo}}
3108
3109 {{echo|<!-- should be ignored -->1=foo}}
3110 !! html/php
3111 <p>foo
3112 </p><p>foo
3113 </p><p>foo
3114 </p><p>foo
3115 </p>
3116 !! html/parsoid
3117 <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>
3118
3119 <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>
3120
3121 <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>
3122
3123 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
3124 !! end
3125
3126 !! test
3127 Templates: Other wikitext in parameter names (T69657)
3128 !! wikitext
3129 {{echo|''1''=foo}}
3130 !! html/php
3131 <p>{{{1}}}
3132 </p>
3133 !! html/parsoid
3134 <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>
3135 !! end
3136
3137 !! test
3138 Templates: With colons
3139 !! wikitext
3140 {{With: Colon}}
3141 !! html/php
3142 <p>Template with colon
3143 </p>
3144 !! html/parsoid
3145 <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>
3146 !! end
3147
3148 #--------------------------------------------------------------------
3149 # Transclusion parameter escaping tests
3150 #--------------------------------------------------------------------
3151
3152 !! test
3153 Templates: Parsoid parameter escaping test 1
3154 !! wikitext
3155 {{echo|[foo]|{{echo|[bar]}}}}
3156 !! html/php+tidy
3157 <p>[foo]
3158 </p>
3159 !! html/parsoid
3160 <p about="#mwt1" typeof="mw:Transclusion"
3161 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
3162 !! end
3163
3164 !! test
3165 Parsoid: Pipes in external links in template parameter
3166 !! wikitext
3167 {{echo|[{{echo|http://example.com}} link]}}
3168 !! html/php+tidy
3169 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
3170 </p>
3171 !! html/parsoid
3172 <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>
3173 !! end
3174
3175 !! test
3176 Parsoid: pipe in transclusion parameter
3177 !! wikitext
3178 {{echo|http://foo.com/a&#124;b}}
3179 !! html/php+tidy
3180 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
3181 </p>
3182 !! html/parsoid
3183 <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>
3184 !! end
3185
3186 !! test
3187 Parsoid: Pipe in external link target and content in template parameter
3188 !! options
3189 parsoid=html2wt,wt2wt
3190 !! wikitext
3191 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
3192 !! html/php+tidy
3193 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
3194 </p>
3195 !! html/parsoid
3196 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
3197 typeof="mw:Transclusion"
3198 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
3199 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
3200 !! end
3201
3202 !! test
3203 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
3204 !! options
3205 parsoid
3206 !! wikitext
3207 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
3208 !! html
3209 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
3210 !! end
3211
3212 !! test
3213 Templates: Don't escape already nowiki-escaped text in template parameters
3214 !! options
3215 parsoid=html2wt,wt2wt
3216 !! wikitext
3217 {{echo|foo<nowiki>|</nowiki>bar}}
3218 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3219 {{echo|<nowiki></nowiki>}}
3220 !! html/php+tidy
3221 <p>foo|bar
3222 &lt;div&gt;
3223
3224 </p>
3225 !! html/parsoid
3226 <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>
3227 <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>
3228 <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>
3229 </p>
3230 !! end
3231
3232 ## T54824
3233 !! test
3234 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3235 !! options
3236 parsoid=html2wt,wt2wt
3237 !! wikitext
3238 {{echo|{{echo|1=bar}}}}
3239 !! html/php+tidy
3240 <p>bar
3241 </p>
3242 !! html/parsoid
3243 <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>
3244 !! end
3245
3246 ## T58733
3247 !! test
3248 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3249 !! wikitext
3250 {{echo|a : b}}
3251 !! html/php+tidy
3252 <p>a&#160;: b
3253 </p>
3254 !! html/parsoid
3255 <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>
3256 !! end
3257
3258 ## T73412
3259 !! test
3260 Templates: Preserve blank parameter names
3261 !! wikitext
3262 {{echo|=foo}}
3263 !! html/php+tidy
3264 <p>{{{1}}}
3265 </p>
3266 !! html/parsoid
3267 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3268 !! end
3269
3270 !! test
3271 Templates: Preserve blank parameter names in other positions
3272 !! wikitext
3273 {{blank_param|bar|=foo}}
3274 !! html/php+tidy
3275 <p>bar
3276 foo
3277 </p>
3278 !! html/parsoid
3279 <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
3280 foo</p>
3281 !! end
3282
3283 ###
3284 ### Parsoid-centric tests for testing RT edge cases for pre
3285 ###
3286
3287 !!test
3288 1a. Indent-Pre and Comments
3289 !! wikitext
3290 a
3291 <!--a-->
3292 c
3293 !! html
3294 <pre>a
3295 </pre>
3296 <p>c
3297 </p>
3298 !!end
3299
3300 !!test
3301 1b. Indent-Pre and Comments
3302 !! wikitext
3303 a
3304 <!--a-->
3305 c
3306 !! html
3307 <pre>a
3308 </pre>
3309 <p>c
3310 </p>
3311 !!end
3312
3313 !!test
3314 1c. Indent-Pre and Comments
3315 !! wikitext
3316 <!--a--> a
3317
3318 <!--a--> a
3319 !! html
3320 <pre> a
3321 </pre>
3322 <pre> a
3323 </pre>
3324 !!end
3325
3326 !!test
3327 1d. Indent-Pre and Comments
3328 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3329 !! wikitext
3330 <!--a--> a
3331
3332 <!--b-->b
3333 !! html
3334 <pre>a
3335 </pre>
3336 <pre>b
3337 </pre>
3338 !!end
3339
3340 !!test
3341 2a. Indent-Pre and tables
3342 !! wikitext
3343 {|
3344 |-
3345 !h1!!h2
3346 |foo||bar
3347 |}
3348 !! html
3349 <table>
3350
3351 <tr>
3352 <th>h1</th>
3353 <th>h2
3354 </th>
3355 <td>foo</td>
3356 <td>bar
3357 </td></tr></table>
3358
3359 !!end
3360
3361 !!test
3362 2b. Indent-Pre and tables
3363 !! wikitext
3364 {|
3365 |-
3366 |foo
3367 |}
3368 !! html
3369 <table>
3370
3371 <tr>
3372 <td>foo
3373 </td></tr></table>
3374
3375 !!end
3376
3377 !!test
3378 2c. Indent-Pre and tables (T44252)
3379 !! wikitext
3380 {|
3381 |+foo
3382 ! |bar
3383 |}
3384 !! html
3385 <table>
3386 <caption>foo
3387 </caption>
3388 <tr>
3389 <th>bar
3390 </th></tr></table>
3391
3392 !!end
3393
3394 !!test
3395 2d. Indent-Pre and tables
3396 !! wikitext
3397 a
3398 {|
3399 |b
3400 |}
3401 !! html/php
3402 <pre>a
3403 </pre>
3404 <table>
3405 <tr>
3406 <td>b
3407 </td></tr></table>
3408
3409 !! html/parsoid
3410 <pre>a</pre>
3411 <table>
3412 <tbody><tr><td> b</td></tr>
3413 </tbody></table>
3414 !!end
3415
3416 !!test
3417 2e. Indent-Pre and table-line syntax
3418 !! wikitext
3419 a
3420 | b
3421 | c
3422 !! html/php
3423 <pre>a
3424 | b
3425 | c
3426 </pre>
3427 !!end
3428
3429 !!test
3430 2f. Indent-pre started by table-line syntax
3431 !! wikitext
3432 a
3433 | b
3434 | c
3435 !! html/php
3436 <p>a
3437 </p>
3438 <pre>| b
3439 | c
3440 </pre>
3441 !! html/parsoid
3442 <p>a</p>
3443 <pre>
3444 | b
3445 | c</pre>
3446 !!end
3447
3448 !! test
3449 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3450 !! wikitext
3451 <table>
3452 <tr>
3453 <td>
3454 Text that should be rendered preformatted
3455 </td>
3456 </tr>
3457 </table>
3458 !! html
3459 <table>
3460 <tr>
3461 <td>
3462 <pre>Text that should be rendered preformatted
3463 </pre>
3464 </td>
3465 </tr>
3466 </table>
3467
3468 !! end
3469
3470 !! test
3471 2h. Indent pre in tables
3472 !! options
3473 parsoid=wt2html,html2html
3474 !! wikitext
3475 {|
3476 !
3477 foo
3478 !
3479 bar
3480 |-
3481 |
3482 baz
3483 {{!}}
3484 bam
3485 |}
3486 !! html/php
3487 <table>
3488 <tr>
3489 <th>
3490 <pre>foo
3491 </pre>
3492 </th>
3493 <th>
3494 <pre>bar
3495 </pre>
3496 </th></tr>
3497 <tr>
3498 <td>
3499 <pre>baz
3500 </pre>
3501 </td>
3502 <td>
3503 <pre>bam
3504 </pre>
3505 </td></tr></table>
3506
3507 !! html/parsoid
3508 <table>
3509 <tbody><tr><th>
3510 <pre>foo</pre>
3511 </th><th>
3512 <pre>bar</pre>
3513 </th></tr><tr>
3514 <td>
3515 <pre>baz</pre>
3516 </td><td data-parsoid='{"startTagSrc":"{{!}}"}'>
3517 <pre>bam</pre>
3518 </td></tr></tbody></table>
3519 !! end
3520
3521 !!test
3522 3a. Indent-Pre and block tags (single-line html)
3523 !! wikitext
3524 a <p> foo </p>
3525 b <div> foo </div>
3526 c <blockquote> foo </blockquote>
3527 <span> foo </span>
3528 !! html
3529 a <p> foo </p>
3530 b <div> foo </div>
3531 c <blockquote> foo </blockquote>
3532 <pre><span> foo </span>
3533 </pre>
3534 !! html/parsoid
3535 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3536 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3537 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3538 <pre><span> foo </span>
3539 </pre>
3540 !! html/php+tidy
3541 <p> a </p><p> foo </p><p>
3542 b </p><div> foo </div><p>
3543 c </p><blockquote><p> foo </p></blockquote>
3544 <pre><span> foo </span>
3545 </pre>
3546 !! end
3547
3548 !! test
3549 3b. Indent-Pre and block tags (multi-line html)
3550 !! wikitext
3551 a <span>foo</span>
3552 <!-- comment --> b <div> foo </div>
3553 !! html/php
3554 <pre>a <span>foo</span>
3555 </pre>
3556 b <div> foo </div>
3557
3558 !! html/parsoid
3559 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3560 <!-- comment --> <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3561 !! html/php+tidy
3562 <pre>a <span>foo</span>
3563 </pre><p>
3564 b </p><div> foo </div>
3565 !! end
3566
3567 !!test
3568 3c. Indent-Pre and block tags (pre-content on separate line)
3569 !! wikitext
3570 <p>
3571 foo
3572 </p>
3573
3574 <div>
3575 foo
3576 </div>
3577
3578 <center>
3579 foo
3580 </center>
3581
3582 <blockquote>
3583 foo
3584 </blockquote>
3585
3586 <blockquote>
3587 <pre>
3588 foo
3589 </pre>
3590 </blockquote>
3591
3592 <table><tr><td>
3593 foo
3594 </td></tr></table>
3595
3596 <ul><li>
3597 foo
3598 </li></ul>
3599
3600 !! html
3601 <p>
3602 foo
3603 </p>
3604 <div>
3605 <pre>foo
3606 </pre>
3607 </div>
3608 <center>
3609 <pre>foo
3610 </pre>
3611 </center>
3612 <blockquote>
3613 <p> foo
3614 </p>
3615 </blockquote>
3616 <blockquote>
3617 <pre>
3618 foo
3619 </pre>
3620 </blockquote>
3621 <table><tr><td>
3622 <pre>foo
3623 </pre>
3624 </td></tr></table>
3625 <ul><li>
3626 foo
3627 </li></ul>
3628
3629 !!end
3630
3631 !! test
3632 4. Indent-Pre and extension tags
3633 !! wikitext
3634 a <tag />
3635 !! html/php
3636 a <pre>
3637 NULL
3638 array (
3639 )
3640 </pre>
3641
3642 !! html/parsoid
3643 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3644 !! end
3645
3646 !! test
3647 5. Indent-Pre and html pre
3648 !! wikitext
3649 <pre class="123">hi</pre>
3650 !! html/php
3651 <pre class="123">hi</pre>
3652
3653 !! html/parsoid
3654 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3655 !! end
3656
3657 !!test
3658 Render paragraphs when indent-pre is suppressed in blocklevels
3659 !! wikitext
3660 <blockquote>
3661 foo
3662
3663 bar
3664 </blockquote>
3665 !! html
3666 <blockquote>
3667 <p> foo
3668 </p><p> bar
3669 </p>
3670 </blockquote>
3671
3672 !!end
3673
3674 !!test
3675 4. Multiple spaces at start-of-line
3676 !! wikitext
3677 <p> foo </p>
3678 foo
3679 {|
3680 |foo
3681 |}
3682 !! html
3683 <p> foo </p>
3684 <pre> foo
3685 </pre>
3686 <table>
3687 <tr>
3688 <td>foo
3689 </td></tr></table>
3690
3691 !!end
3692
3693 ## NOTE: the leading white-space chars on empty line are significant
3694 !! test
3695 5a. White-space in indent-pre
3696 !! wikitext
3697 a<br />
3698
3699 b
3700 !! html
3701 <pre>a<br />
3702
3703 b
3704 </pre>
3705 !! end
3706
3707 ## NOTE: the leading white-space chars on empty line are significant
3708 !! test
3709 5b. White-space in indent-pre
3710 !! wikitext
3711 a
3712
3713 b
3714
3715
3716 c
3717 !! html
3718 <pre>a
3719
3720 b
3721
3722
3723 c
3724 </pre>
3725 !! end
3726
3727 !! test
3728 5c. White-space in indent-pre
3729 !! wikitext
3730 ''a''
3731 ''b''
3732 ''c''
3733 !! html
3734 <pre><i>a</i>
3735 <i>b</i>
3736 <i>c</i>
3737 </pre>
3738 !! end
3739
3740 !! test
3741 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3742 !! wikitext
3743 a
3744
3745 <!-- continue -->
3746 b
3747
3748 c
3749
3750 d
3751 !! html
3752 <pre>a
3753
3754 b
3755 </pre>
3756 <pre>c
3757
3758 </pre>
3759 <p>d
3760 </p>
3761 !! end
3762
3763 !! test
3764 7a. Indent-pre and category links
3765 !! options
3766 parsoid=wt2html,wt2wt
3767 !! wikitext
3768 [[Category:foo]] <!-- No pre-wrapping -->
3769 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3770 !! html/php+tidy
3771 !! html/parsoid
3772 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3773 <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 -->
3774 !! end
3775
3776 ## We used to, but no longer wt2wt this test since the default serializer
3777 ## will normalize all categories to serialize on their own line.
3778 ## This wikitext usage is going to be fairly uncommon in production and
3779 ## selser will take care of preserving formatting in those scenarios.
3780 !! test
3781 7b. Indent-pre and category links
3782 !! options
3783 parsoid=wt2html
3784 !! wikitext
3785 [[Category:foo]] a
3786 [[Category:foo]] {{echo|b}}
3787 !! html/parsoid
3788 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3789 <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>
3790 !! end
3791
3792 !! test
3793 Indent-Pre: Newlines in comments shouldn't affect sol state
3794 !! wikitext
3795 a <!--
3796 foo
3797 --> b
3798 !! html/php+tidy
3799 <p>a b
3800 </p>
3801 !! html/parsoid
3802 <p>a <!--
3803 foo
3804 --> b</p>
3805 !! end
3806
3807 ###
3808 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3809 ###
3810
3811 !!test
3812 HTML-pre: 1. embedded newlines
3813 !! wikitext
3814 <pre>foo</pre>
3815
3816 <pre>
3817 foo
3818 </pre>
3819
3820 <pre>
3821
3822 foo
3823 </pre>
3824
3825 <pre>
3826
3827
3828 foo
3829 </pre>
3830 !! html/php+tidy
3831 <pre>foo</pre>
3832 <pre>foo
3833 </pre>
3834 <pre>
3835
3836 foo
3837 </pre>
3838 <pre>
3839
3840
3841 foo
3842 </pre>
3843 !! html/parsoid
3844 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3845
3846 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3847 </pre>
3848
3849 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3850
3851 foo
3852 </pre>
3853
3854 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3855
3856
3857 foo
3858 </pre>
3859 !!end
3860
3861 !! test
3862 HTML-pre: big spaces
3863 !! wikitext
3864 <pre>
3865
3866
3867
3868
3869 haha
3870
3871
3872
3873
3874 haha
3875
3876
3877
3878
3879 </pre>
3880 !! html/php+tidy
3881 <pre>
3882
3883
3884
3885
3886 haha
3887
3888
3889
3890
3891 haha
3892
3893
3894
3895
3896 </pre>
3897 !! html/parsoid
3898 <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"}}'>
3899
3900
3901
3902
3903 haha
3904
3905
3906
3907
3908 haha
3909
3910
3911
3912
3913 </pre>
3914 !! end
3915
3916 !!test
3917 HTML-pre: 2: indented text
3918 !! wikitext
3919 <pre>
3920 foo
3921 </pre>
3922 !! html
3923 <pre>
3924 foo
3925 </pre>
3926
3927 !!end
3928
3929 !!test
3930 HTML-pre: 3: other wikitext
3931 !! wikitext
3932 <pre>
3933 * foo
3934 # bar
3935 = no-h =
3936 '' no-italic ''
3937 [[ NoLink ]]
3938 </pre>
3939 !! html/php
3940 <pre>
3941 * foo
3942 # bar
3943 = no-h =
3944 '' no-italic ''
3945 [[ NoLink ]]
3946 </pre>
3947
3948 !! html/parsoid
3949 <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
3950 # bar
3951 = no-h =
3952 '' no-italic ''
3953 [[ NoLink ]]
3954 </pre>
3955 !!end
3956
3957 ###
3958 ### Definition lists
3959 ###
3960 !! test
3961 Simple definition
3962 !! wikitext
3963 ;name :Definition
3964 !! html
3965 <dl><dt>name&#160;</dt>
3966 <dd>Definition</dd></dl>
3967
3968 !! end
3969
3970 !! test
3971 Definition list for indentation only
3972 !! wikitext
3973 :Indented text
3974 !! html
3975 <dl><dd>Indented text</dd></dl>
3976
3977 !! end
3978
3979 !! test
3980 Definition list with no space
3981 !! wikitext
3982 ;name:Definition
3983 !! html
3984 <dl><dt>name</dt>
3985 <dd>Definition</dd></dl>
3986
3987 !!end
3988
3989 !! test
3990 Definition list with URL link
3991 !! wikitext
3992 ;http://example.com/ :definition
3993 !! html
3994 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3995 <dd>definition</dd></dl>
3996
3997 !! end
3998
3999 !! test
4000 Definition list with bracketed URL link
4001 !! wikitext
4002 ;[http://www.example.com/ Example]:Something about it
4003 !! html
4004 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
4005 <dd>Something about it</dd></dl>
4006
4007 !! end
4008
4009 !! test
4010 Definition list with wikilink containing colon
4011 !! wikitext
4012 ;[[Help:FAQ]]:The least-read page on Wikipedia
4013 !! html
4014 <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>
4015 <dd>The least-read page on Wikipedia</dd></dl>
4016
4017 !! end
4018
4019 # At Brion's and JeLuF's insistence... :)
4020 !! test
4021 Definition list with news link containing colon
4022 !! wikitext
4023 ;news:alt.wikipedia.rox :This isn't even a real newsgroup!
4024 !! html/php
4025 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a>&#160;</dt>
4026 <dd>This isn't even a real newsgroup!</dd></dl>
4027
4028 !! html/parsoid
4029 <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>
4030 !! end
4031
4032 !! test
4033 Malformed definition list with colon
4034 !! wikitext
4035 ;news:alt.wikipedia.rox -- don't crash or enter an infinite loop
4036 !! html
4037 <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>
4038
4039 !! end
4040
4041 !! test
4042 Definition lists: colon in external link text
4043 !! wikitext
4044 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
4045 !! html
4046 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;:The Next Generation</a>&#160;</dt>
4047 <dd>OK, I made that up</dd></dl>
4048
4049 !! end
4050
4051 !! test
4052 Definition lists: colon in HTML attribute
4053 !! wikitext
4054 ;<b style="display: inline">bold</b>
4055 !! html
4056 <dl><dt><b style="display: inline">bold</b></dt></dl>
4057
4058 !! end
4059
4060 !! test
4061 Definition lists: self-closed tag
4062 !! wikitext
4063 ;one<br/>two :two-line fun
4064 !! html
4065 <dl><dt>one<br />two&#160;</dt>
4066 <dd>two-line fun</dd></dl>
4067
4068 !! end
4069
4070 !! test
4071 Definition lists: ignore colons inside tags
4072 !! wikitext
4073 ;one <b>two : tag <i>fun:</i>:</b>:def
4074 !! html
4075 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
4076 <dd>def</dd></dl>
4077
4078 !! end
4079
4080 !! test
4081 Definition lists: excess closed tags
4082 !! wikitext
4083 ;one</b>two :bad tag fun
4084 !! html/php+tidy
4085 <dl><dt>onetwo&#160;</dt>
4086 <dd>bad tag fun</dd></dl>
4087 !! html/parsoid
4088 <dl>
4089 <dt>onetwo</dt>
4090 <dd>bad tag fun</dd>
4091 </dl>
4092 !! end
4093
4094 !! test
4095 T13748: Literal closing tags
4096 !! wikitext
4097 <dl>
4098 <dt>test 1</dt>
4099 <dd>test test test test test</dd>
4100 <dt>test 2</dt>
4101 <dd>test test test test test</dd>
4102 </dl>
4103 !! html
4104 <dl>
4105 <dt>test 1</dt>
4106 <dd>test test test test test</dd>
4107 <dt>test 2</dt>
4108 <dd>test test test test test</dd>
4109 </dl>
4110
4111 !! end
4112
4113 !! test
4114 Definition and unordered list using wiki syntax nested in unordered list using html tags.
4115 !! wikitext
4116 <ul><li>
4117 ;term :description
4118 *unordered
4119 </li></ul>
4120 !! html
4121 <ul><li>
4122 <dl><dt>term&#160;</dt>
4123 <dd>description</dd></dl>
4124 <ul><li>unordered</li></ul>
4125 </li></ul>
4126
4127 !! end
4128
4129 !! test
4130 Definition list with empty definition and following paragraph
4131 !! wikitext
4132 ;term:
4133
4134 Paragraph text
4135 !! html
4136 <dl><dt>term</dt>
4137 <dd></dd></dl>
4138 <p>Paragraph text
4139 </p>
4140 !! end
4141
4142 !! test
4143 Nested definition lists using html syntax
4144 !! wikitext
4145 <dl><dt>x</dt>
4146 <dd>a</dd>
4147 <dd>b</dd></dl>
4148 !! html
4149 <dl><dt>x</dt>
4150 <dd>a</dd>
4151 <dd>b</dd></dl>
4152
4153 !! end
4154
4155 !! test
4156 Definition Lists: No nesting: Multiple dd's
4157 !! wikitext
4158 ;x
4159 :a
4160 :b
4161 !! html
4162 <dl><dt>x</dt>
4163 <dd>a</dd>
4164 <dd>b</dd></dl>
4165
4166 !! end
4167
4168 !! test
4169 Definition Lists: Indentation: Regular
4170 !! wikitext
4171 :i1
4172 ::i2
4173 :::i3
4174 !! html
4175 <dl><dd>i1
4176 <dl><dd>i2
4177 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4178
4179 !! end
4180
4181 !! test
4182 Definition Lists: Indentation: Missing 1st level
4183 !! wikitext
4184 ::i2
4185 :::i3
4186 !! html
4187 <dl><dd><dl><dd>i2
4188 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4189
4190 !! end
4191
4192 !! test
4193 Definition Lists: Indentation: Multi-level indent
4194 !! wikitext
4195 :::i3
4196 !! html
4197 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
4198
4199 !! end
4200
4201 !! test
4202 Definition Lists: Hacky use to indent tables
4203 !! wikitext
4204 ::{|
4205 |foo
4206 |bar
4207 |}
4208 this text
4209 should be left alone
4210 !! html
4211 <dl><dd><dl><dd><table>
4212 <tr>
4213 <td>foo
4214 </td>
4215 <td>bar
4216 </td></tr></table></dd></dl></dd></dl>
4217 <p>this text
4218 should be left alone
4219 </p>
4220 !! end
4221
4222 !! test
4223 Definition Lists: Hacky use to indent tables (with content following table)
4224 !! wikitext
4225 :{|
4226 |foo
4227 |bar
4228 |} <!--c1--> this text should be part of the dl
4229 !! html/php+tidy
4230 <dl><dd><table>
4231 <tbody><tr>
4232 <td>foo
4233 </td>
4234 <td>bar
4235 </td></tr></tbody></table> this text should be part of the dl</dd></dl>
4236 !! html/parsoid
4237 <dl><dd><table>
4238 <tbody><tr>
4239 <td>foo
4240 </td>
4241 <td>bar
4242 </td></tr></tbody></table> <!--c1--> this text should be part of the dl</dd></dl>
4243 !! end
4244
4245 !! test
4246 Definition Lists: Hacky use to indent tables, with comments (T65979)
4247 !! wikitext
4248 <!-- foo -->
4249 ::{|
4250 |foo
4251 |bar
4252 |}<!-- bar -->
4253 this text
4254 should be left alone
4255 !! html/parsoid
4256 <!-- foo -->
4257 <dl><dd><dl><dd><table><tr>
4258 <td>foo</td>
4259 <td>bar</td>
4260 </tr></table><!-- bar --></dd></dl></dd></dl>
4261 <p>this text
4262 should be left alone</p>
4263 !! end
4264
4265 !! test
4266 Definition Lists: Hacky use to indent tables, with comment before table
4267 !!options
4268 parsoid=wt2html
4269 !! wikitext
4270 ::<!-- foo -->{|
4271 |foo
4272 |}
4273 !! html/parsoid
4274 <dl><dd><dl><dd><!-- foo --><table><tr>
4275 <td>foo</td>
4276 </tr></table></dd></dl></dd></dl>
4277 !! end
4278
4279 # The trailing whitespace in this test is to catch a regression in
4280 # Parsoid after T54473.
4281 !! test
4282 Definition Lists: Hacky use to indent tables (WS-insensitive)
4283 !! wikitext
4284 :{|
4285 |a
4286 |}
4287 !! html/php
4288 <dl><dd><table>
4289 <tr>
4290 <td>a
4291 </td></tr></table></dd></dl>
4292
4293 !! html/parsoid
4294 <dl><dd><table>
4295 <tbody><tr><td>a</td></tr>
4296 </tbody></table></dd></dl>
4297 !! end
4298
4299 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4300 ## as an empty dt item. It also ignores all but the last ";" when followed
4301 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4302 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4303 ## ";"s.
4304 ##
4305 ## Ex: ";;t2 ::d2" is transformed into:
4306 ##
4307 ## <dl>
4308 ## <dt>t2 </dt>
4309 ## <dd>
4310 ## <dl>
4311 ## <dt></dt>
4312 ## <dd>d2</dd>
4313 ## </dl>
4314 ## </dd>
4315 ## </dl>
4316 ##
4317 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4318 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4319 ##
4320 ## <dl>
4321 ## <dt>
4322 ## <dl>
4323 ## <dt>t2 </dt>
4324 ## <dd>:d2</dd>
4325 ## </dl>
4326 ## </dt>
4327 ## </dl>
4328 ##
4329 ## All Parsoid only definition list tests have this difference.
4330 ##
4331 ## See also: https://phabricator.wikimedia.org/T8569
4332 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4333
4334 !! test
4335 Table / list interaction: indented table with lists in table contents
4336 !! wikitext
4337 :{|
4338 |-
4339 |a
4340
4341 *b
4342 |-
4343 |c
4344
4345 *d
4346 |}
4347 !! html
4348 <dl><dd><table>
4349
4350 <tr>
4351 <td>a
4352 <ul><li>b</li></ul>
4353 </td></tr>
4354 <tr>
4355 <td>c
4356 <ul><li>d</li></ul>
4357 </td></tr></table></dd></dl>
4358
4359 !! end
4360
4361 !!test
4362 Table / list interaction: lists nested in tables nested in indented lists
4363 !! wikitext
4364 :{|
4365 |
4366 :a
4367 :b
4368 |
4369 *c
4370 *d
4371 |}
4372
4373 *e
4374 *f
4375 !! html
4376 <dl><dd><table>
4377 <tr>
4378 <td>
4379 <dl><dd>a</dd>
4380 <dd>b</dd></dl>
4381 </td>
4382 <td>
4383 <ul><li>c</li>
4384 <li>d</li></ul>
4385 </td></tr></table></dd></dl>
4386 <ul><li>e</li>
4387 <li>f</li></ul>
4388
4389 !!end
4390
4391 !! test
4392 Definition Lists: Nesting: Multi-level (Parsoid only)
4393 !! wikitext
4394 ;t1 :d1
4395 ;;t2 ::d2
4396 ;;;t3 :::d3
4397 !! html/parsoid
4398 <dl>
4399 <dt>t1 </dt>
4400 <dd>d1</dd>
4401 <dt>
4402 <dl>
4403 <dt>t2 </dt>
4404 <dd>:d2</dd>
4405 <dt>
4406 <dl>
4407 <dt>t3 </dt>
4408 <dd>::d3</dd>
4409 </dl>
4410 </dt>
4411 </dl>
4412 </dt>
4413 </dl>
4414
4415
4416 !! end
4417
4418
4419 !! test
4420 Definition Lists: Nesting: Test 2
4421 !! wikitext
4422 ;t1
4423 ::d2
4424 !! html+tidy
4425 <dl><dt>t1</dt>
4426 <dd>
4427 <dl><dd>d2</dd></dl></dd></dl>
4428 !! end
4429
4430
4431 !! test
4432 Definition Lists: Nesting: Test 3
4433 !! wikitext
4434 :;t1
4435 ::::d2
4436 !! html+tidy
4437 <dl><dd><dl><dt>t1</dt>
4438 <dd>
4439 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4440 !! end
4441
4442
4443 !! test
4444 Definition Lists: Nesting: Test 4
4445 !! wikitext
4446 ::;t3
4447 :::d3
4448 !! html
4449 <dl><dd><dl><dd><dl><dt>t3</dt>
4450 <dd>d3</dd></dl></dd></dl></dd></dl>
4451
4452 !! end
4453
4454
4455 ## The Parsoid team believes the following three test exposes a
4456 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4457 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4458 ## It also exposes a "misfeature" in tidy, which doesn't like
4459 ## <dl> tags with a single <dt> child; it converts the <dt> into
4460 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4461 !! test
4462 Definition Lists: Mixed Lists: Test 1
4463 !! wikitext
4464 :;*foo
4465 ::*bar
4466 :;baz
4467 !! html/php
4468 <dl><dd><dl><dt><ul><li>foo</li>
4469 <li>bar</li></ul></dt></dl>
4470 <dl><dt>baz</dt></dl></dd></dl>
4471
4472 !! html/php+tidy
4473 <dl><dd><dl><dt><ul><li>foo</li>
4474 <li>bar</li></ul></dt></dl>
4475 <dl><dt>baz</dt></dl></dd></dl>
4476 !! html/parsoid
4477 <dl>
4478 <dd><dl>
4479 <dt><ul>
4480 <li>foo
4481 </li>
4482 </ul></dt>
4483 <dd><ul>
4484 <li>bar
4485 </li>
4486 </ul></dd>
4487 <dt>baz</dt>
4488 </dl></dd>
4489 </dl>
4490 !! end
4491
4492 !! test
4493 Definition Lists: Mixed Lists: Test 2
4494 !! wikitext
4495 *:d1
4496 *:d2
4497 !! html
4498 <ul><li><dl><dd>d1</dd>
4499 <dd>d2</dd></dl></li></ul>
4500
4501 !! end
4502
4503
4504 !! test
4505 Definition Lists: Mixed Lists: Test 3
4506 !! wikitext
4507 *:::d1
4508 *:::d2
4509 !! html
4510 <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
4511 <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
4512
4513 !! end
4514
4515
4516 !! test
4517 Definition Lists: Mixed Lists: Test 4
4518 !! wikitext
4519 *;d1 :d2
4520 *;d3 :d4
4521 !! html
4522 <ul><li><dl><dt>d1&#160;</dt>
4523 <dd>d2</dd>
4524 <dt>d3&#160;</dt>
4525 <dd>d4</dd></dl></li></ul>
4526
4527 !! end
4528
4529
4530 !! test
4531 Definition Lists: Mixed Lists: Test 5
4532 !! wikitext
4533 *:d1
4534 *::d2
4535 !! html
4536 <ul><li><dl><dd>d1
4537 <dl><dd>d2</dd></dl></dd></dl></li></ul>
4538
4539 !! end
4540
4541
4542 !! test
4543 Definition Lists: Mixed Lists: Test 6
4544 !! wikitext
4545 #*:d1
4546 #*:::d3
4547 !! html
4548 <ol><li><ul><li><dl><dd>d1
4549 <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4550
4551 !! end
4552
4553
4554 !! test
4555 Definition Lists: Mixed Lists: Test 7
4556 !! wikitext
4557 :*d1
4558 :*d2
4559 !! html
4560 <dl><dd><ul><li>d1</li>
4561 <li>d2</li></ul></dd></dl>
4562
4563 !! end
4564
4565
4566 !! test
4567 Definition Lists: Mixed Lists: Test 8
4568 !! wikitext
4569 :*d1
4570 ::*d2
4571 !! html
4572 <dl><dd><ul><li>d1</li></ul>
4573 <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
4574
4575 !! end
4576
4577
4578 !! test
4579 Definition Lists: Mixed Lists: Test 9
4580 !! wikitext
4581 *;foo :bar
4582 !! html
4583 <ul><li><dl><dt>foo&#160;</dt>
4584 <dd>bar</dd></dl></li></ul>
4585
4586 !! end
4587
4588
4589 !! test
4590 Definition Lists: Mixed Lists: Test 10
4591 !! wikitext
4592 *#;foo :bar
4593 !! html
4594 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4595 <dd>bar</dd></dl></li></ol></li></ul>
4596
4597 !! end
4598
4599 # The Parsoid team disagrees with the PHP parser's seemingly-random
4600 # rules regarding dd/dt on the next few tests. Parsoid is more
4601 # consistent, and recognizes the shared nesting and keeps the
4602 # still-open tags around until the nesting is complete.
4603
4604 # This is a regression test for T175099
4605 !! test
4606 Definition Lists: Mixed Lists: Test 11
4607 !! wikitext
4608 ;a
4609 :*b
4610 !! html/php
4611 <dl><dt>a</dt>
4612 <dd>
4613 <ul><li>b</li></ul></dd></dl>
4614
4615 !! html/parsoid
4616 <dl><dt>a
4617 <dd><ul><li>b</li></ul></dd></dl>
4618 !! end
4619
4620 # FIXME: Maybe get rid of this test?
4621 !! test
4622 Definition Lists: Mixed Lists: Test 12
4623 !! wikitext
4624 *#*#;*;;foo :bar
4625 *#*#;boo :baz
4626 !! html/php
4627 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4628 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4629 <dl><dt>boo&#160;</dt>
4630 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4631
4632 !! html/php+tidy
4633 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4634 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4635 <dl><dt>boo&#160;</dt>
4636 <dd>baz</dd></dl></li></ol></li></ul>
4637 !! html/parsoid
4638 <ul>
4639 <li>
4640 <ol>
4641 <li>
4642 <ul>
4643 <li>
4644 <ol>
4645 <li>
4646 <dl>
4647 <dt>
4648 <ul>
4649 <li>
4650 <dl>
4651 <dt>
4652 <dl>
4653 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4654 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4655 </dl></dt>
4656 </dl></li>
4657 </ul></dt>
4658 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4659 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4660 </dl></li>
4661 </ol></li>
4662 </ul></li>
4663 </ol></li>
4664 </ul>
4665 !! end
4666
4667 # FIXME: Maybe get rid of this test?
4668 # From whitelist:
4669 # * The test is wrong, there are two colons where there should be :;
4670 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4671 !! test
4672 Definition Lists: Weird Ones: Test 1
4673 !! wikitext
4674 *#;*::;;foo :bar (who uses this?)
4675 !! html/php+tidy
4676 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4677 <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>
4678 !! html/parsoid
4679 <ul>
4680 <li>
4681 <ol>
4682 <li>
4683 <dl>
4684 <dt>
4685 <ul>
4686 <li>
4687 <dl>
4688 <dd>
4689 <dl>
4690 <dd>
4691 <dl>
4692 <dt>
4693 <dl>
4694 <dt>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4695 <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
4696 </dl></dt>
4697 </dl></dd>
4698 </dl></dd>
4699 </dl></li>
4700 </ul></dt>
4701 </dl></li>
4702 </ol></li>
4703 </ul>
4704 !! end
4705
4706 !! test
4707 Definition Lists: colons occurring in tags
4708 !! wikitext
4709 ;a:b
4710 ;'''a:b'''
4711 ;<i>a:b</i>
4712 ;<span>a:b</span>
4713 ;<div>a:b</div>
4714 ;<div>a
4715 :b</div>
4716 ;{{echo|a:b}}
4717 ;{{echo|''a:b''}}
4718 ;;;''a:b''
4719 !! html+tidy
4720 <dl><dt>a</dt>
4721 <dd>b</dd>
4722 <dt><b>a:b</b></dt>
4723 <dt><i>a:b</i></dt>
4724 <dt><span>a:b</span></dt>
4725 <dt><div>a:b</div></dt>
4726 <dt><div>a</div></dt>
4727 <dd>b</dd>
4728 <dt>a</dt>
4729 <dd>b</dd>
4730 <dt><i>a:b</i></dt></dl>
4731 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4732 !! html/parsoid
4733 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4734 <dt><b>a:b</b></dt>
4735 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4736 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4737 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4738 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4739 <dd>b</dd>
4740 <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>
4741 <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>
4742 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4743 !! end
4744
4745 # Parsoid's output differs here again because it shares
4746 # nesting between the two lists unlike the PHP parser.
4747 # Unsure which is more desirable.
4748 !! test
4749 Definition Lists: colons and tables 1
4750 !! wikitext
4751 :{|
4752 |x
4753 |}
4754 :{|
4755 |y
4756 |}
4757 !! html/php
4758 <dl><dd><table>
4759 <tr>
4760 <td>x
4761 </td></tr></table></dd></dl>
4762 <dl><dd><table>
4763 <tr>
4764 <td>y
4765 </td></tr></table></dd></dl>
4766
4767 !! html/parsoid
4768 <dl><dd><table>
4769 <tr>
4770 <td>x
4771 </td></tr></table></dd>
4772 <dd><table>
4773 <tr>
4774 <td>y
4775 </td></tr></table></dd></dl>
4776 !! end
4777
4778 # FIXME: Does this need a html/php section?
4779 !! test
4780 Definition Lists: template interaction
4781 !! wikitext
4782 ::{{definition_list}}
4783
4784 :one
4785 ::{{definition_list}}
4786 :::two
4787 :::three
4788 ::four
4789 !! html/parsoid
4790 <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">
4791 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4792
4793 <dl><dd data-parsoid='{}'>one
4794 <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">
4795 </span><dd about="#mwt2">two
4796 <dl><dd>two</dd>
4797 <dd>three</dd></dl></dd>
4798 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4799 !! end
4800
4801
4802 ###
4803 ### External links
4804 ###
4805 !! test
4806 External links: non-bracketed
4807 !! wikitext
4808 Non-bracketed: http://example.com
4809 !! html
4810 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4811 </p>
4812 !! end
4813
4814 # parsoid doesn't explicitly mark autonumbered links, see T55505
4815 !! test
4816 External links: numbered
4817 !! wikitext
4818 Numbered: [http://example.com]
4819 Numbered: [http://example.net]
4820 Numbered: [http://example.com]
4821 !! html/php
4822 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4823 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4824 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4825 </p>
4826 !! html/parsoid
4827 <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
4828 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4829 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
4830 !!end
4831
4832 !! test
4833 External links: specified text
4834 !! wikitext
4835 Specified text: [http://example.com link]
4836 !! html
4837 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4838 </p>
4839 !!end
4840
4841 !! test
4842 External links: trail
4843 !! wikitext
4844 Linktrails should not work for external links: [http://example.com link]s
4845 !! html
4846 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4847 </p>
4848 !! end
4849
4850 !! test
4851 External links: dollar sign in URL
4852 !! wikitext
4853 http://example.com/1$2345
4854 !! html
4855 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4856 </p>
4857 !! end
4858
4859 # parsoid doesn't explicitly mark autonumbered links, see T55505
4860 !! test
4861 External links: dollar sign in URL (autonumber)
4862 !! wikitext
4863 [http://example.com/1$2345]
4864 !! html/php
4865 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4866 </p>
4867 !! html/parsoid
4868 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
4869 !!end
4870
4871 !! test
4872 External links: open square bracket forbidden in URL (T6377)
4873 !! options
4874 parsoid=wt2html,wt2wt,html2html
4875 !! wikitext
4876 http://example.com/1[2345
4877 !! html/php
4878 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4879 </p>
4880 !! html/parsoid
4881 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
4882 !! end
4883
4884 !! test
4885 External links: open square bracket forbidden in URL (named) (T6377)
4886 !! options
4887 parsoid=wt2html,html2html
4888 !! wikitext
4889 [http://example.com/1[2345]
4890 !! html/php
4891 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4892 </p>
4893 !! html/parsoid
4894 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
4895 !!end
4896
4897 # parsoid adds a space before the link name
4898 !! test
4899 External links: open square bracket forbidden in URL (named) (T6377)
4900 Parsoid variant.
4901 !! wikitext
4902 [http://example.com/1 [2345]
4903 !! html
4904 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4905 </p>
4906 !!end
4907
4908 !! test
4909 External links: nowiki in URL link text (T8230)
4910 !! wikitext
4911 [http://example.com/ <nowiki>''example site''</nowiki>]
4912 !! html
4913 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4914 </p>
4915 !! end
4916
4917 !! test
4918 External links: newline forbidden in text (T8230 regression check)
4919 !! wikitext
4920 [http://example.com/ first
4921 second]
4922 !! html
4923 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4924 second]
4925 </p>
4926 !!end
4927
4928 !! test
4929 External links: Pipe char between url and text
4930 !! wikitext
4931 [http://example.com | link]
4932 !! html
4933 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4934 </p>
4935 !!end
4936
4937 !! test
4938 External links: protocol-relative URL in brackets
4939 !! wikitext
4940 [//example.com/ Test]
4941 !! html
4942 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4943 </p>
4944 !! end
4945
4946 # parsoid doesn't explicitly mark autonumbered links, see T55505
4947 !! test
4948 External links: protocol-relative URL in brackets without text
4949 !! wikitext
4950 [//example.com]
4951 !! html/php
4952 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4953 </p>
4954 !! html/parsoid
4955 <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
4956 !! end
4957
4958 !! test
4959 External links: protocol-relative URL in free text is left alone
4960 !! wikitext
4961 //example.com/Foo
4962 !! html
4963 <p>//example.com/Foo
4964 </p>
4965 !!end
4966
4967 !! test
4968 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4969 !! wikitext
4970 foo//example.com/Foo
4971 !! html
4972 <p>foo//example.com/Foo
4973 </p>
4974 !! end
4975
4976 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
4977 !! test
4978 External links: with no contents
4979 !! options
4980 parsoid=wt2html,wt2wt
4981 !! wikitext
4982 [http://en.wikipedia.org/wiki/Foo]
4983
4984 [[wikipedia:Foo|Bar]]
4985
4986 [[wikipedia:Foo|<span>Bar</span>]]
4987 !! html/php
4988 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4989 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4990 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4991 </p>
4992 !! html/parsoid
4993 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4994 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4995 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4996 !! end
4997
4998 !! test
4999 External links: Free with trailing punctuation
5000 !! wikitext
5001 http://example.com,
5002 http://example.com;
5003 http://example.com\
5004 http://example.com.
5005 http://example.com:
5006 http://example.com!
5007 http://example.com?
5008 http://example.com)
5009 http://example.com/url_with_(brackets)
5010 (http://example.com/url_without_brackets)
5011 http://example.com/url_with_entity&amp;
5012 http://example.com/url_with_entity&#x26;
5013 http://example.com/url_with_entity&#038;
5014 http://example.com/url_with_entity&nbsp;
5015 http://example.com/url_with_entity&#xA0;
5016 http://example.com/url_with_entity&#160;
5017 http://example.com/url_with_entity&lt;
5018 http://example.com/url_with_entity&#x3C;
5019 http://example.com/url_with_entity&#60;
5020 !! html/php
5021 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
5022 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
5023 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
5024 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
5025 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
5026 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
5027 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
5028 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5029 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5030 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5031 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5032 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5033 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5034 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5035 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
5036 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5037 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
5038 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
5039 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
5040 </p>
5041 !! html/parsoid
5042 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
5043 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
5044 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
5045 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
5046 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
5047 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
5048 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
5049 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
5050 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5051 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5052 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5053 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5054 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5055 <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>
5056 <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>
5057 <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>
5058 <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>
5059 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
5060 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
5061 !! end
5062
5063 !! test
5064 External links: tricky Parsoid html2html case
5065 !! options
5066 parsoid=wt2html,wt2wt,html2html
5067 !! wikitext
5068 http://example.com/url_with_entity&amp;amp;
5069 !! html/php
5070 <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>;
5071 </p>
5072 !! html/parsoid
5073 <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>
5074 !! end
5075
5076 !! test
5077 External links: Free with trailing quotes (T113666)
5078 !! wikitext
5079 '''News:''' Stuff here
5080
5081 news:'a'b''c''d e
5082 !! html/php
5083 <p><b>News:</b> Stuff here
5084 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
5085 </p>
5086 !! html/parsoid
5087 <p><b>News:</b> Stuff here</p>
5088 <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
5089 !! end
5090
5091 !! test
5092 External links: with entity
5093 !! wikitext
5094 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
5095 !! html/php
5096 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
5097 </p>
5098 !! html/parsoid
5099 <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>
5100 !! end
5101
5102 !! test
5103 External links: Lone protocols are never linked (T105697)
5104 !! wikitext
5105 http://
5106 http://;
5107 (http://)
5108 bitcoin:
5109 bitcoin:;
5110 (bitcoin:)
5111 !! html
5112 <p>http://
5113 http://;
5114 (http://)
5115 bitcoin:
5116 bitcoin:;
5117 (bitcoin:)
5118 </p>
5119 !! end
5120
5121 !! test
5122 External links: No preceding word characters allowed (T67278)
5123 !! wikitext
5124 NOPEhttp://example.com
5125 N0http://example.com
5126 ok:http://example.com
5127 ok-http://example.com
5128 !! html
5129 <p>NOPEhttp://example.com
5130 N0http://example.com
5131 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5132 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5133 </p>
5134 !! end
5135
5136 !! test
5137 External links: nofollow domain exception
5138 !! wikitext
5139 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
5140 !! html
5141 <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>.
5142 </p>
5143 !!end
5144
5145 !! test
5146 External image
5147 !! wikitext
5148 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5149 !! html
5150 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5151 </p>
5152 !! end
5153
5154 !! test
5155 External image from https
5156 !! wikitext
5157 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5158 !! html
5159 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5160 </p>
5161 !! end
5162
5163 !! test
5164 External image (when not allowed)
5165 !! options
5166 wgAllowExternalImages=0
5167 !! wikitext
5168 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5169 !! html
5170 <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>
5171 </p>
5172 !! end
5173
5174 !! test
5175 Link to non-http image, no img tag
5176 !! wikitext
5177 Link to non-http image, no img tag: ftp://example.com/test.jpg
5178 !! html
5179 <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>
5180 </p>
5181 !! end
5182
5183 !! test
5184 External links: terminating separator
5185 !! wikitext
5186 Terminating separator: http://example.com/thing,
5187 !! html
5188 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
5189 </p>
5190 !! end
5191
5192 !! test
5193 External links: intervening separator
5194 !! wikitext
5195 Intervening separator: http://example.com/1,2,3
5196 !! html
5197 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
5198 </p>
5199 !! end
5200
5201 !! test
5202 External links: old bug with URL in query
5203 !! wikitext
5204 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
5205 !! html
5206 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
5207 </p>
5208 !! end
5209
5210 !! test
5211 External links: old URL-in-URL bug, mixed protocols
5212 !! wikitext
5213 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
5214 !! html
5215 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
5216 </p>
5217 !!end
5218
5219 # Since Parsoid is starting to emit canonical wikitext for links,
5220 # [http://example.com http://example.com] will not RT back to that
5221 # form anymore.
5222 !! test
5223 External links: URL in text
5224 !! options
5225 parsoid=wt2html
5226 !! wikitext
5227 URL in text: [http://example.com http://example.com]
5228 !! html/php
5229 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
5230 </p>
5231 !! html/parsoid
5232 <p>URL in text: <a rel="mw:ExtLink" class="external text" href="http://example.com">http://example.com</a></p>
5233 !! end
5234
5235 !! test
5236 External links: Clickable images
5237 !! wikitext
5238 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5239 !! html/php
5240 <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>
5241 </p>
5242 !! html/parsoid
5243 <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>
5244 !! end
5245
5246 !! test
5247 External links: raw ampersand
5248 !! wikitext
5249 Old &amp; use: http://x&y
5250 !! html
5251 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5252 </p>
5253 !! end
5254
5255 !! test
5256 External links: encoded ampersand
5257 !! wikitext
5258 Old &amp; use: http://x&amp;y
5259 !! html/php
5260 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5261 </p>
5262 !! html/parsoid
5263 <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>
5264 !! end
5265
5266 !! test
5267 External links: encoded equals (T8102)
5268 !! wikitext
5269 http://example.com/?foo&#61;bar
5270 !! html/php
5271 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5272 </p>
5273 !! html/parsoid
5274 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5275 !! end
5276
5277 ##
5278 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5279 ## does it number them. As discussed in T55505, we can identify
5280 ## autonumbered links via CSS.
5281 ##
5282
5283 !! test
5284 External links: [raw ampersand]
5285 !! wikitext
5286 Old &amp; use: [http://x&y]
5287 !! html/php
5288 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5289 </p>
5290 !! html/parsoid
5291 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5292 !! end
5293
5294 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5295 # mode will return the [raw ampersand] wikitext
5296 !! test
5297 External links: [encoded ampersand]
5298 !! options
5299 parsoid=wt2html,wt2wt,html2html
5300 !! wikitext
5301 Old &amp; use: [http://x&amp;y]
5302 !! html/php
5303 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5304 </p>
5305 !! html/parsoid
5306 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5307 !! end
5308
5309 !! test
5310 External links: [raw equals]
5311 !! wikitext
5312 [http://example.com/?foo=bar]
5313 !! html/php
5314 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5315 </p>
5316 !! html/parsoid
5317 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5318 !! end
5319
5320 # note that parsoid html is identical to [raw equals] case; so html2wt
5321 # mode will return the [raw equals] wikitext
5322 !! test
5323 External links: [encoded equals] (T8102)
5324 !! options
5325 parsoid=wt2html,wt2wt,html2html
5326 !! wikitext
5327 [http://example.com/?foo&#61;bar]
5328 !! html/php
5329 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5330 </p>
5331 !! html/parsoid
5332 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5333 !! end
5334
5335 # xxx parsoid strips the IDN character, so the round-trip tests will
5336 # obviously fail and are disabled. --cscott
5337 !! test
5338 External links: [IDN ignored character reference in hostname; strip it right off]
5339 !! options
5340 parsoid=wt2html,wt2wt,html2html
5341 !! wikitext
5342 [http://e&zwnj;xample.com/]
5343 !! html/php
5344 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5345 </p>
5346 !! html/parsoid
5347 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
5348 !! end
5349
5350 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5351 # Where an external link could easily circumvent the sanitization of the text of
5352 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5353 # test demands a higher standard. That's a bit strange.
5354 #
5355 # Example:
5356 #
5357 # http://e‌xample.com -> [http://example.com|http://example.com]
5358 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5359 #
5360 # The first example is sanitized, but the second is not. Any security benefits
5361 # from this production are trivial to circumvent. Either remove this test and
5362 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5363 # the test accordingly.
5364 #
5365 # All our love,
5366 # The Parsoid team.
5367 # xxx parsoid strips the IDN character, so the round-trip tests will
5368 # obviously fail and are disabled. --cscott
5369 !! test
5370 External links: IDN ignored character reference in hostname; strip it right off
5371 !! options
5372 parsoid=wt2html,html2html
5373 !! wikitext
5374 http://e&zwnj;xample.com/
5375 !! html/php
5376 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5377 </p>
5378 !! html/parsoid
5379 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
5380 !! end
5381
5382 !! test
5383 External links: www.jpeg.org (T2554)
5384 !! wikitext
5385 http://www.jpeg.org
5386 !! html
5387 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5388 </p>
5389 !! end
5390
5391 # parsoid doesn't explicitly mark autonumbered links, see T55505
5392 !! test
5393 External links: URL within URL (T2002)
5394 !! wikitext
5395 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5396 !! html/php
5397 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5398 </p>
5399 !! html/parsoid
5400 <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>
5401 !! end
5402
5403 !! test
5404 T2361: URL inside bracketed URL
5405 !! wikitext
5406 [http://www.example.com/foo http://www.example.com/bar]
5407 !! html
5408 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5409 </p>
5410 !! end
5411
5412 !! test
5413 T2361: URL within URL, not bracketed
5414 !! wikitext
5415 http://www.example.com/foo?=http://www.example.com/bar
5416 !! html
5417 <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>
5418 </p>
5419 !! end
5420
5421 !! test
5422 T2289: ">"-token in URL-tail
5423 !! wikitext
5424 http://www.example.com/<hello>
5425 !! html
5426 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5427 </p>
5428 !!end
5429
5430 !! test
5431 T2289: literal ">"-token in URL-tail
5432 !! wikitext
5433 http://www.example.com/<b>html</b>
5434 !! html/php
5435 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5436 </p>
5437 !! html/parsoid
5438 <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>
5439 !! end
5440
5441 !! test
5442 T2289: ">"-token in bracketed URL
5443 !! wikitext
5444 [http://www.example.com/<hello> stuff]
5445 !! html
5446 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5447 </p>
5448 !!end
5449
5450 !! test
5451 T2289: literal ">"-token in bracketed URL
5452 !! wikitext
5453 [http://www.example.com/<b>html</b> stuff]
5454 !! html
5455 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5456 </p>
5457 !!end
5458
5459 !! test
5460 T2289: literal double quote at end of URL
5461 !! wikitext
5462 http://www.example.com/"hello"
5463 !! html
5464 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5465 </p>
5466 !!end
5467
5468 !! test
5469 T2289: literal double quote in bracketed URL
5470 !! wikitext
5471 [http://www.example.com/"hello" stuff]
5472 !! html
5473 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5474 </p>
5475 !!end
5476
5477 !! test
5478 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5479 !! wikitext
5480 [http://www.example.com test]
5481 !! html
5482 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5483 </p>
5484 !! end
5485
5486 !! test
5487 External links: link text with spaces
5488 !! wikitext
5489 [http://www.example.com a b c]
5490 [http://www.example.com ''a'' ''b'']
5491 !! html
5492 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5493 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5494 </p>
5495 !! end
5496
5497 # Note edge case difference between PHP and Parsoid here.
5498 !! test
5499 External links: wiki links within external link (T5695)
5500 !! options
5501 parsoid=wt2html,html2html
5502 !! wikitext
5503 [http://example.com [[wikilink]] embedded in ext link]
5504
5505 [http://example.com test [[wikilink]] embedded in ext link]
5506 !! html/php
5507 <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>
5508 </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>
5509 </p>
5510 !! html/parsoid
5511 <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>
5512 <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>
5513 !! end
5514
5515 !! test
5516 T2787: Links with one slash after the url protocol are invalid
5517 !! wikitext
5518 http:/example.com
5519
5520 [http:/example.com title]
5521 !! html
5522 <p>http:/example.com
5523 </p><p>[http:/example.com title]
5524 </p>
5525 !! end
5526
5527 !! test
5528 Bracketed external links with template-generated invalid target
5529 !! wikitext
5530 [{{echo|http:/example.com}} title]
5531 !! html
5532 <p>[http:/example.com title]
5533 </p>
5534 !! end
5535
5536 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5537 !! test
5538 Broken wikilinks (but not external links) prevent templates from closing
5539 !! options
5540 parsoid=wt2html
5541 !! wikitext
5542 [http://example.com x
5543
5544 {{echo|[http://example.com x}}
5545
5546 [[Foo
5547
5548 {{echo|[[Foo}}
5549 !! html/php
5550 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5551 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5552 </p><p>[[Foo
5553 </p><p>{{echo|[[Foo}}
5554 </p>
5555 !! html/parsoid
5556 <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5557 <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>
5558 <p>[[Foo</p>
5559 <p>{{echo|[[Foo}}</p>
5560 !! end
5561
5562 !! test
5563 Wikilinks with embedded newlines are not broken
5564 !! wikitext
5565 {{echo|[[ Foo
5566 B
5567 C]]}}
5568 !! html/php
5569 <p>[[ Foo
5570 B
5571 C]]
5572 </p>
5573 !! html/parsoid
5574 <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>
5575 !! end
5576
5577 !! test
5578 Broken templates
5579 !! options
5580 parsoid=wt2html
5581 !! wikitext
5582 {{echo|[[Foo|}}]]
5583
5584 [[Foo|{{echo|]]}}
5585 !! html/php
5586 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5587 </p><p>[[Foo|]]
5588 </p>
5589 !! html/parsoid
5590 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5591 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5592 !! end
5593
5594 !! test
5595 T4702: Mismatched <i>, <b> and <a> tags are invalid
5596 !! wikitext
5597 ''[http://example.com text'']
5598 [http://example.com '''text]'''
5599 ''Something [http://example.com in italic'']
5600 ''Something [http://example.com mixed''''', even bold]'''
5601 '''''Now [http://example.com both''''']
5602 !! html
5603 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5604 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5605 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5606 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5607 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5608 </p>
5609 !! end
5610
5611
5612 !! test
5613 T6781: %26 in URL
5614 !! wikitext
5615 http://www.example.com/?title=AT%26T
5616 !! html/php
5617 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5618 </p>
5619 !! html/parsoid
5620 <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>
5621 !! end
5622
5623 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5624 # % is actually legal in HTML5. Any change in output would need testing though.
5625 !! test
5626 T6781, T7267: %25 in URL
5627 !! wikitext
5628 http://www.example.com/?title=100%25_Bran
5629 !! html/php
5630 <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>
5631 </p>
5632 !! html/parsoid
5633 <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>
5634 !! end
5635
5636 !! test
5637 T6781, T7267: %28, %29 in URL
5638 !! wikitext
5639 http://www.example.com/?title=Ben-Hur_%281959_film%29
5640 !! html/php
5641 <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>
5642 </p>
5643 !! html/parsoid
5644 <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>
5645 !! end
5646
5647
5648 !! test
5649 T6781: %26 in autonumber URL
5650 !! wikitext
5651 [http://www.example.com/?title=AT%26T]
5652 !! html/php
5653 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5654 </p>
5655 !! html/parsoid
5656 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5657 !! end
5658
5659 !! test
5660 T6781, T7267: %26 in autonumber URL
5661 !! wikitext
5662 [http://www.example.com/?title=100%25_Bran]
5663 !! html/php
5664 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5665 </p>
5666 !! html/parsoid
5667 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5668 !! end
5669
5670 !! test
5671 T6781, T7267: %28, %29 in autonumber URL
5672 !! wikitext
5673 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5674 !! html/php
5675 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5676 </p>
5677 !! html/parsoid
5678 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5679 !! end
5680
5681
5682 !! test
5683 T6781: %26 in bracketed URL
5684 !! wikitext
5685 [http://www.example.com/?title=AT%26T link]
5686 !! html/php
5687 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5688 </p>
5689 !! html/parsoid
5690 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5691 !! end
5692
5693 !! test
5694 T6781, T7267: %25 in bracketed URL
5695 !! wikitext
5696 [http://www.example.com/?title=100%25_Bran link]
5697 !! html
5698 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5699 </p>
5700 !! end
5701
5702 !! test
5703 T6781, T7267: %28, %29 in bracketed URL
5704 !! wikitext
5705 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5706 !! html/php
5707 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5708 </p>
5709 !! html/parsoid
5710 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5711 !! end
5712
5713 !! test
5714 External link containing a period in the anchor. (T65947)
5715 !! wikitext
5716 [//foo.org/bar#baz. bang]
5717
5718 [//foo.org/bar. bang]
5719 !! html/php
5720 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5721 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5722 </p>
5723 !! html/parsoid
5724 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5725 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5726 !! end
5727
5728 !! test
5729 External link containing a single quote. (T65947)
5730 !! wikitext
5731 [//foo.org/bar'baz]
5732
5733 [//foo.org/bar'baz bang]
5734 !! html/php
5735 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5736 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5737 </p>
5738 !! html/parsoid
5739 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5740 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5741 !! end
5742
5743 !! test
5744 External link containing double-single-quotes in text '' (T6598 sanity check)
5745 !! wikitext
5746 Some [http://example.com/ pretty ''italics'' and stuff]!
5747 !! html
5748 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5749 </p>
5750 !! end
5751
5752 !! test
5753 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5754 !! wikitext
5755 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5756 !! html
5757 <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>
5758 </p>
5759 !! end
5760
5761 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5762 !! test
5763 External link containing double-single-quotes with no space separating the url from text in italics
5764 !! wikitext
5765 [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]].]
5766 !! html/php+tidy
5767 <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>.
5768 </p>
5769 !! html/parsoid
5770 <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>
5771 !! end
5772
5773 !! test
5774 External link with comments in link text
5775 !! wikitext
5776 [http://www.google.com Google <!-- comment -->]
5777 !! html/php
5778 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5779 </p>
5780 !! html/parsoid
5781 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5782 !! end
5783
5784 !! test
5785 External link to bare IPv4 address
5786 !! wikitext
5787 [http://192.168.0.1 Link]
5788 !! html/php
5789 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5790 </p>
5791 !! html/parsoid
5792 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5793 !! end
5794
5795 !! test
5796 URL-encoding in URL functions (single parameter)
5797 !! wikitext
5798 {{localurl:Some page|amp=&}}
5799 !! html
5800 <p>/index.php?title=Some_page&amp;amp=&amp;
5801 </p>
5802 !! end
5803
5804 !! test
5805 URL-encoding in URL functions (multiple parameters)
5806 !! wikitext
5807 {{localurl:Some page|q=?&amp=&}}
5808 !! html
5809 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5810 </p>
5811 !! end
5812
5813 !! test
5814 Brackets in urls
5815 !! wikitext
5816 http://example.com/index.php?foozoid%5B%5D=bar
5817
5818 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5819 !! html/php
5820 <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>
5821 </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>
5822 </p>
5823 !! html/parsoid
5824 <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>
5825
5826 <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>
5827 !! end
5828
5829 !! test
5830 IPv6 urls, autolink format (T23261)
5831 !! wikitext
5832 http://[2404:130:0:1000::187:2]/index.php
5833
5834 Examples from RFC 2373, section 2.2:
5835
5836 *http://[1080::8:800:200C:417A]/unicast
5837 *http://[FF01::101]/multicast
5838 *http://[::1]/loopback
5839 *http://[::]/unspecified
5840 *http://[::13.1.68.3]/ipv4compat
5841 *http://[::FFFF:129.144.52.38]/ipv4compat
5842
5843 Examples from RFC 2732, section 2:
5844
5845 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5846 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5847 *http://[3ffe:2a00:100:7031::1]
5848 *http://[1080::8:800:200C:417A]/foo
5849 *http://[::192.9.5.5]/ipng
5850 *http://[::FFFF:129.144.52.38]:80/index.html
5851 *http://[2010:836B:4179::836B:4179]
5852 !! html/php
5853 <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>
5854 </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:
5855 </p>
5856 <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>
5857 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5858 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5859 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5860 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5861 <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>
5862 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5863 </p>
5864 <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>
5865 <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>
5866 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5867 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5868 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5869 <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>
5870 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5871
5872 !! html/parsoid
5873 <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>
5874
5875 <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>
5876 <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>
5877 <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5878 <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5879 <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5880 <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5881 <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>
5882
5883 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5884 <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>
5885 <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>
5886 <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5887 <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>
5888 <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5889 <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>
5890 <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5891 !! end
5892
5893 !! test
5894 IPv6 urls, bracketed format (T23261)
5895 !! wikitext
5896 [http://[2404:130:0:1000::187:2]/index.php test]
5897
5898 Examples from RFC 2373, section 2.2:
5899
5900 *[http://[1080::8:800:200C:417A] unicast]
5901 *[http://[FF01::101] multicast]
5902 *[http://[::1]/ loopback]
5903 *[http://[::] unspecified]
5904 *[http://[::13.1.68.3] ipv4compat]
5905 *[http://[::FFFF:129.144.52.38] ipv4compat]
5906
5907 Examples from RFC 2732, section 2:
5908
5909 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5910 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5911 *[http://[3ffe:2a00:100:7031::1] 3]
5912 *[http://[1080::8:800:200C:417A]/foo 4]
5913 *[http://[::192.9.5.5]/ipng 5]
5914 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5915 *[http://[2010:836B:4179::836B:4179] 7]
5916 !! html/php
5917 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5918 </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:
5919 </p>
5920 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5921 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5922 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5923 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5924 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5925 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5926 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5927 </p>
5928 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5929 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5930 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5931 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5932 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5933 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5934 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5935
5936 !! html/parsoid
5937 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5938
5939 <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>
5940 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5941 <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5942 <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5943 <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5944 <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5945 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5946
5947 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5948 <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>
5949 <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5950 <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5951 <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5952 <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5953 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5954 <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5955 !! end
5956
5957 !! test
5958 Non-extlinks in brackets
5959 !! wikitext
5960 [foo]
5961 [foo bar]
5962 [foo ''bar'']
5963 [fool's] errand
5964 [fool's errand]
5965 [{{echo|foo}}]
5966 [{{echo|foo}} bar]
5967 [{{echo|foo}} ''bar'']
5968 [{{echo|foo}}l's] errand
5969 [{{echo|foo}}l's errand]
5970 [url={{echo|foo}}]
5971 [url=http://example.com]
5972 [http:// bare protocols don't count]
5973 !! html/php
5974 <p>[foo]
5975 [foo bar]
5976 [foo <i>bar</i>]
5977 [fool's] errand
5978 [fool's errand]
5979 [foo]
5980 [foo bar]
5981 [foo <i>bar</i>]
5982 [fool's] errand
5983 [fool's errand]
5984 [url=foo]
5985 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5986 [http:// bare protocols don't count]
5987 </p>
5988 !! html/parsoid
5989 <p>[foo]
5990 [foo bar]
5991 [foo <i>bar</i>]
5992 [fool's] errand
5993 [fool's errand]
5994 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
5995 [<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]
5996 [<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>]
5997 [<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
5998 [<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]
5999 [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>]
6000 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
6001 [http:// bare protocols don't count]</p>
6002 !! end
6003
6004 !! test
6005 Percent encoding in external links
6006 !! wikitext
6007 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
6008 !! html/php
6009 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
6010 </p>
6011 !! html/parsoid
6012 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
6013 !! end
6014
6015 !! test
6016 Use url link syntax for links where the content is equal the link target
6017 !! wikitext
6018 http://example.com
6019 !! html/php
6020 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
6021 </p>
6022 !! html/parsoid
6023 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
6024 !! end
6025
6026 !! test
6027 Parenthesis in external links, especially URL links
6028 !! wikitext
6029 http://example.com)
6030
6031 http://example.com/test)
6032
6033 http://example.com/(test)
6034
6035 http://example.com/((test)
6036
6037 (http://example.com/(test))
6038
6039 (http://example.com/(test)))))
6040
6041 http://example.com/a)b
6042
6043 [http://example.com) foo]
6044 !! html/php
6045 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6046 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
6047 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
6048 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
6049 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
6050 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
6051 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
6052 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
6053 </p>
6054 !! html/parsoid
6055 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
6056 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
6057 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
6058 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
6059 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
6060 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
6061 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
6062 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
6063 !! end
6064
6065 !! test
6066 Parenthesis in external links, w/ transclusion or comment
6067 !! wikitext
6068 (http://example.com/{{echo|hi}})
6069
6070 (http://example.com<!-- hi -->)
6071 !! html/php
6072 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
6073 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6074 </p>
6075 !! html/parsoid
6076 <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>
6077
6078 <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>
6079 !! end
6080
6081 !! test
6082 Serialize <a> tags with invalid link targets as plain text
6083 !! options
6084 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
6085 !! html/parsoid
6086 <a rel="mw:WikiLink" href="[[foo]]">text</a>
6087 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
6088 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
6089 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
6090 !! wikitext
6091 text
6092 <nowiki>*</nowiki>text
6093 <nowiki>[[foo]]</nowiki>
6094 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
6095 !! end
6096
6097 !! test
6098 mw:ExtLink -vs- mw:WikiLink (T94723)
6099 !! options
6100 parsoid=html2wt
6101 !! html/parsoid
6102 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
6103 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
6104 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6105 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6106 <p>
6107 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6108 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6109 </p>
6110 !! wikitext
6111 [[Foo|Bar]]
6112 [[Foo|Bar]]
6113 [[:en:Foo|Bar]]
6114 [[:en:Foo|Bar]]
6115
6116 [[:en:European_Robin|European Robin]]
6117 [[:en:European_Robin|European Robin]]
6118 !! end
6119
6120 !! test
6121 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
6122 !! options
6123 parsoid=wt2wt
6124 !! wikitext
6125 [http://en.wikipedia.org/wiki/European_Robin European Robin]
6126 !! html/parsoid
6127 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
6128 !! end
6129
6130
6131 ###
6132 ### Quotes
6133 ###
6134
6135 !! test
6136 Quotes
6137 !! wikitext
6138 Normal text. '''Bold text.''' Normal text. ''Italic text.''
6139
6140 Normal text. '''''Bold italic text.''''' Normal text.
6141 !! html
6142 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
6143 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
6144 </p>
6145 !! end
6146
6147
6148 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
6149 # parser strips. The wikitext contains just the first half of the bold
6150 # quote pair.
6151 !! test
6152 Unclosed and unmatched quotes
6153 !! wikitext
6154 '''''Bold italic text '''with bold deactivated''' in between.'''''
6155
6156 '''''Bold italic text ''with italic deactivated'' in between.'''''
6157
6158 '''Bold text..
6159
6160 ..spanning two paragraphs (should not work).'''
6161
6162 '''Bold tag left open
6163
6164 ''Italic tag left open
6165
6166 Normal text.
6167
6168 <!-- Unmatching number of opening, closing tags: -->
6169 '''This year''''s election ''should'' beat '''last year''''s.
6170
6171 ''Tom'''s car is bigger than ''Susan'''s.
6172
6173 Plain ''italic'''s plain
6174 !! html/php
6175 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6176 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6177 </p><p><b>Bold text..</b>
6178 </p><p>..spanning two paragraphs (should not work).
6179 </p><p><b>Bold tag left open</b>
6180 </p><p><i>Italic tag left open</i>
6181 </p><p>Normal text.
6182 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6183 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6184 </p><p>Plain <i>italic'</i>s plain
6185 </p>
6186 !! html/parsoid
6187 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6188 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6189 </p><p><b>Bold text..</b>
6190 </p><p>..spanning two paragraphs (should not work).<b></b>
6191 </p><p><b>Bold tag left open</b>
6192 </p><p><i>Italic tag left open</i>
6193 </p><p>Normal text.
6194 </p>
6195 <!-- Unmatching number of opening, closing tags: -->
6196 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6197 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6198 </p><p>Plain <i>italic'</i>s plain
6199 </p>
6200 !! end
6201
6202 ###
6203 ### Tables
6204 ###
6205 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
6206 ###
6207
6208 # This should not produce <table></table> as <table><tr><td></td></tr></table>
6209 # is the bare minimum required by the spec, see:
6210 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
6211 # Parsoid team replies: empty table tags are legal in HTML5
6212 !! test
6213 A table with no data.
6214 !! options
6215 parsoid=wt2html
6216 !! wikitext
6217 {||}
6218 !! html/php
6219
6220 !! html/parsoid
6221 <table></table>
6222
6223 !! end
6224
6225 !! test
6226 A table with stray table end tags on start tag line (wt2html)
6227 !! options
6228 parsoid=wt2html
6229 !! wikitext
6230 {|style="color: red;"|}
6231
6232 {|style="color: red;" |}
6233 |foo
6234 |}
6235
6236 {|style="color: red;"|} id="foo"
6237 |foo
6238 |}
6239
6240 {|style="color: red;" |} id="foo"
6241 |foo
6242 |}
6243 !! html
6244 <table style="color: red;"></table>
6245
6246 <table style="color: red;">
6247 <tbody><tr>
6248 <td>foo</td>
6249 </tr></tbody>
6250 </table>
6251
6252 <table style="color: red;" id="foo">
6253 <tbody><tr>
6254 <td>foo</td>
6255 </tr></tbody>
6256 </table>
6257
6258 <table style="color: red;" id="foo">
6259 <tbody><tr>
6260 <td>foo</td>
6261 </tr></tbody>
6262 </table>
6263
6264 !! end
6265
6266 !! test
6267 A table with no data (take 2)
6268 !! wikitext
6269 {|
6270 |}
6271 !! html/parsoid
6272 <table></table>
6273 !! end
6274
6275 # A table with nothing but a caption is invalid XHTML, we might want to render
6276 # this as <p>caption</p>
6277 # Parsoid team replies: table with only a caption is legal in HTML5
6278 !! test
6279 A table with nothing but a caption
6280 !! wikitext
6281 {|
6282 |+caption
6283 |}
6284 !! html/php
6285 <table>
6286 <caption>caption
6287 </caption><tr><td></td></tr></table>
6288
6289 !! html/parsoid
6290 <table><caption>caption</caption></table>
6291 !! end
6292
6293 !! test
6294 A table with caption with default-spaced attributes and a table row
6295 !! wikitext
6296 {|
6297 |+ style="color: red;" |caption1
6298 |-
6299 |foo
6300 |}
6301 !! html
6302 <table>
6303 <caption style="color: red;">caption1
6304 </caption>
6305 <tr>
6306 <td>foo
6307 </td></tr></table>
6308
6309 !! end
6310
6311 !! test
6312 A table with captions with non-default spaced attributes and a table row
6313 !! wikitext
6314 {|
6315 |+style="color: red;"|caption2
6316 |+ style="color: red;"|caption3
6317 |-
6318 |foo
6319 |}
6320 !! html
6321 <table>
6322 <caption style="color: red;">caption2
6323 </caption>
6324 <caption style="color: red;">caption3
6325 </caption>
6326 <tr>
6327 <td>foo
6328 </td></tr></table>
6329
6330 !! end
6331
6332 !! test
6333 Table td-cell syntax variations
6334 !! wikitext
6335 {|
6336 |foo bar foo|baz
6337 |foo bar foo||baz
6338 |style='color:red;'|baz
6339 |style='color:red;'||baz
6340 |}
6341 !! html
6342 <table>
6343 <tr>
6344 <td>baz
6345 </td>
6346 <td>foo bar foo</td>
6347 <td>baz
6348 </td>
6349 <td style="color:red;">baz
6350 </td>
6351 <td>style='color:red;'</td>
6352 <td>baz
6353 </td></tr></table>
6354
6355 !! end
6356
6357 !! test
6358 Simple table
6359 !! wikitext
6360 {|
6361 |1||2
6362 |-
6363 |3||4
6364 |}
6365 !! html
6366 <table>
6367 <tr>
6368 <td>1</td>
6369 <td>2
6370 </td></tr>
6371 <tr>
6372 <td>3</td>
6373 <td>4
6374 </td></tr></table>
6375
6376 !! end
6377
6378 !! test
6379 Simple table but with multiple dashes for row wikitext
6380 !! wikitext
6381 {|
6382 |foo
6383 |-----
6384 |bar
6385 |}
6386 !! html
6387 <table>
6388 <tr>
6389 <td>foo
6390 </td></tr>
6391 <tr>
6392 <td>bar
6393 </td></tr></table>
6394
6395 !! end
6396
6397 !! test
6398 Multiplication table
6399 !! wikitext
6400 {| border="1" cellpadding="2"
6401 |+Multiplication table
6402 |-
6403 !&times;!!1!!2!!3
6404 |-
6405 !1
6406 |1||2||3
6407 |-
6408 !2
6409 |2||4||6
6410 |-
6411 !3
6412 |3||6||9
6413 |-
6414 !4
6415 |4||8||12
6416 |-
6417 !5
6418 |5||10||15
6419 |}
6420 !! html
6421 <table border="1" cellpadding="2">
6422 <caption>Multiplication table
6423 </caption>
6424 <tr>
6425 <th>&#215;</th>
6426 <th>1</th>
6427 <th>2</th>
6428 <th>3
6429 </th></tr>
6430 <tr>
6431 <th>1
6432 </th>
6433 <td>1</td>
6434 <td>2</td>
6435 <td>3
6436 </td></tr>
6437 <tr>
6438 <th>2
6439 </th>
6440 <td>2</td>
6441 <td>4</td>
6442 <td>6
6443 </td></tr>
6444 <tr>
6445 <th>3
6446 </th>
6447 <td>3</td>
6448 <td>6</td>
6449 <td>9
6450 </td></tr>
6451 <tr>
6452 <th>4
6453 </th>
6454 <td>4</td>
6455 <td>8</td>
6456 <td>12
6457 </td></tr>
6458 <tr>
6459 <th>5
6460 </th>
6461 <td>5</td>
6462 <td>10</td>
6463 <td>15
6464 </td></tr></table>
6465
6466 !! end
6467
6468 !! test
6469 Accept "||" in table headings
6470 !! wikitext
6471 {|
6472 !h1||h2
6473 |}
6474 !! html
6475 <table>
6476 <tr>
6477 <th>h1</th>
6478 <th>h2
6479 </th></tr></table>
6480
6481 !! end
6482
6483 !! test
6484 Accept "!!" in table data
6485 !! wikitext
6486 {|
6487 |Foo!!||
6488 |}
6489 !! html
6490 <table>
6491 <tr>
6492 <td>Foo!!</td>
6493 <td>
6494 </td></tr></table>
6495
6496 !! html/parsoid
6497 <table>
6498 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6499 </tbody></table>
6500 !! end
6501
6502 !! test
6503 Accept "||" in indented table headings
6504 !! wikitext
6505 :{|
6506 !h1||h2
6507 |}
6508 !! html
6509 <dl><dd><table>
6510 <tr>
6511 <th>h1</th>
6512 <th>h2
6513 </th></tr></table></dd></dl>
6514
6515 !! end
6516
6517 !! test
6518 Accept "!!" in templates
6519 !! wikitext
6520 {|
6521 !a {{echo|b!!c}}
6522 |}
6523 !! html/php
6524 <table>
6525 <tr>
6526 <th>a b</th>
6527 <th>c
6528 </th></tr></table>
6529
6530 !! html/parsoid
6531 <table>
6532 <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>
6533 !! end
6534
6535 !! test
6536 Accept "!!" in table headings after newline
6537 !! wikitext
6538 {|
6539 !a
6540 b!!c
6541 |}
6542 !! html/php
6543 <table>
6544 <tr>
6545 <th>a
6546 <p>b!!c
6547 </p>
6548 </th></tr></table>
6549
6550 !! html/parsoid
6551 <table>
6552 <tbody><tr><th>a
6553 <p>b!!c</p></th></tr>
6554 </tbody></table>
6555 !! end
6556
6557 !! test
6558 Accept "!!" in table data of mixed wikitext / html syntax
6559 !! wikitext
6560 {|
6561 !a
6562 <tr><td>b!!c</td></tr>
6563 |}
6564 !! html/php+tidy
6565 <table>
6566 <tbody><tr>
6567 <th>a
6568 </th></tr><tr><td>b!!c</td></tr>
6569 </tbody></table>
6570 !! html/parsoid
6571 <table>
6572 <tbody><tr><th>a</th></tr>
6573 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6574 </tbody></table>
6575 !! end
6576
6577 !! test
6578 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6579 !! wikitext
6580 {|
6581 !|h1
6582 ||a
6583 |}
6584 !! html
6585 <table>
6586 <tr>
6587 <th>h1
6588 </th>
6589 <td>a
6590 </td></tr></table>
6591
6592 !! end
6593
6594 !!test
6595 Accept "| !" at start of line in tables (ignore !-attribute)
6596 !! wikitext
6597 {|
6598 |-
6599 |!style="color:red"|bar
6600 |}
6601 !! html
6602 <table>
6603
6604 <tr>
6605 <td>bar
6606 </td></tr></table>
6607
6608 !!end
6609
6610 !!test
6611 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 +/-
6612 !! wikitext
6613 {|
6614 |-
6615 |style='color:red;'|+1
6616 |style='color:blue;'|-1
6617 |-
6618 |1||2||3
6619 |1||+2||-3
6620 |-
6621 | +1
6622 | -1
6623 |}
6624 !! html
6625 <table>
6626
6627 <tr>
6628 <td style="color:red;">+1
6629 </td>
6630 <td style="color:blue;">-1
6631 </td></tr>
6632 <tr>
6633 <td>1</td>
6634 <td>2</td>
6635 <td>3
6636 </td>
6637 <td>1</td>
6638 <td>+2</td>
6639 <td>-3
6640 </td></tr>
6641 <tr>
6642 <td>+1
6643 </td>
6644 <td>-1
6645 </td></tr></table>
6646
6647 !!end
6648
6649 !! test
6650 Table rowspan
6651 !! wikitext
6652 {| border=1
6653 |Cell 1, row 1
6654 |rowspan=2|Cell 2, row 1 (and 2)
6655 |Cell 3, row 1
6656 |-
6657 |Cell 1, row 2
6658 |Cell 3, row 2
6659 |}
6660 !! html
6661 <table border="1">
6662 <tr>
6663 <td>Cell 1, row 1
6664 </td>
6665 <td rowspan="2">Cell 2, row 1 (and 2)
6666 </td>
6667 <td>Cell 3, row 1
6668 </td></tr>
6669 <tr>
6670 <td>Cell 1, row 2
6671 </td>
6672 <td>Cell 3, row 2
6673 </td></tr></table>
6674
6675 !! end
6676
6677 !! test
6678 Nested table
6679 !! wikitext
6680 {| border=1
6681 | &alpha;
6682 |
6683 {| bgcolor=#ABCDEF border=2
6684 |nested
6685 |-
6686 |table
6687 |}
6688 |the original table again
6689 |}
6690 !! html
6691 <table border="1">
6692 <tr>
6693 <td>&#945;
6694 </td>
6695 <td>
6696 <table bgcolor="#ABCDEF" border="2">
6697 <tr>
6698 <td>nested
6699 </td></tr>
6700 <tr>
6701 <td>table
6702 </td></tr></table>
6703 </td>
6704 <td>the original table again
6705 </td></tr></table>
6706
6707 !! end
6708
6709 !! test
6710 Invalid attributes in table cell (T3830)
6711 !! wikitext
6712 {|
6713 |Cell:|broken
6714 |}
6715 !! html
6716 <table>
6717 <tr>
6718 <td>broken
6719 </td></tr></table>
6720
6721 !! end
6722
6723 !! test
6724 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6725 !! wikitext
6726 {|
6727 |title="foo" |bar
6728 |title="foo<nowiki>|</nowiki>" |bar
6729 |title="foo<nowiki>|</nowiki>" bar
6730 |}
6731 !! html/php
6732 <table>
6733 <tr>
6734 <td title="foo">bar
6735 </td>
6736 <td title="foo&#124;">bar
6737 </td>
6738 <td>title="foo|" bar
6739 </td></tr></table>
6740
6741 !! html/parsoid
6742 <table>
6743 <tbody><tr><td title="foo">bar</td>
6744 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6745 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6746 </tbody></table>
6747 !! end
6748
6749 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6750 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6751 # *2wt modes will fail.
6752 !! test
6753 Table security: embedded pipes
6754 !! options
6755 parsoid=wt2html,html2html
6756 !! wikitext
6757 {|
6758 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6759 !! html/php
6760 <table>
6761 <tr>
6762 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6763 <td>]" onmouseover="alert(document.cookie)"&gt;test
6764 </td>
6765 </tr>
6766 </table>
6767
6768 !! html/parsoid
6769 <table><tbody>
6770 <tr>
6771 <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>
6772 !! end
6773
6774 !! test
6775 Element attributes with double ! should not be broken up by <th>
6776 !! wikitext
6777 {|
6778 !hi <div class="!!">ha</div> ho
6779 |}
6780 !! html/php
6781 <table>
6782 <tr>
6783 <th>hi <div class="!!">ha</div> ho
6784 </th></tr></table>
6785
6786 !! html/parsoid
6787 <table>
6788 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6789 </tbody></table>
6790 !! end
6791
6792 !! test
6793 ! and || in element attributes should not be parsed as <th>/<td>
6794 !! wikitext
6795 {|
6796 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6797 |}
6798 !! html/php
6799 <table>
6800 <tr>
6801 <td><div style="color: red&#32;!important;" data-contrived="put this here &#124;&#124;">hi</div>
6802 </td></tr></table>
6803
6804 !! html/parsoid
6805 <table>
6806 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6807 </tbody></table>
6808 !! end
6809
6810 # FIXME: The output seems broken. Filed as T110268.
6811 !! test
6812 ! and || in td attributes should not be parsed as <th>/<td>
6813 !! options
6814 parsoid=wt2html
6815 !! wikitext
6816 {|
6817 |style="color: red !important;" data-contrived="put this here ||"|foo
6818 |}
6819 !! html/php
6820 <table>
6821 <tr>
6822 <td>style="color: red&#160;!important;" data-contrived="put this here</td>
6823 <td>foo
6824 </td></tr></table>
6825
6826 !! html/parsoid
6827 <table>
6828 <tbody><tr><td>style="color: red !important;" data-contrived="put this here</td><td data-parsoid='{"stx":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'>foo</td></tr>
6829 </tbody></table>
6830 !! end
6831
6832 !! test
6833 Break on | in element attribute in template
6834 !! options
6835 parsoid=wt2html,html2html
6836 !! wikitext
6837 {{echo|1=<div class="hi|ho">ha</div>}}
6838 !! html/php
6839 <p>ho"&gt;ha&lt;/div&gt;
6840 </p>
6841 !! html/parsoid
6842 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
6843 !! end
6844
6845 !! test
6846 Break on | in element attribute name in template
6847 !! wikitext
6848 {{echo|<div cla|ss="hiho">ha</div>}}
6849 !! html/parsoid
6850 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</p>
6851 !! end
6852
6853 !! test
6854 Don't break on | in extension attribute in template
6855 !! wikitext
6856 {{echo|<ref name="hi|ho">ha</ref>}}
6857
6858 <references />
6859 !! html/parsoid
6860 <p><sup about="#mwt2" class="mw-ref" id="cite_ref-hi|ho_1-0" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref name=\"hi|ho\">ha&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-hi|ho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
6861
6862 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi|ho-1" id="cite_note-hi|ho-1"><a href="./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>
6863 !! end
6864
6865 ## We don't support roundtripping of these attributes in Parsoid.
6866 ## Selective serialization takes care of preventing dirty diffs.
6867 ## But, on edits, we dirty-diff the invalid attribute text.
6868 !! test
6869 Invalid text in table attributes should be discarded
6870 !! options
6871 parsoid=wt2html
6872 !! wikitext
6873 {| <span>boo</span> style='border:1px solid black'
6874 | <span>boo</span> style='color:blue' |1
6875 |<span>boo</span> style='color:blue'|2
6876 |}
6877 !! html/php
6878 <table style="border:1px solid black">
6879 <tr>
6880 <td style="color:blue">1
6881 </td>
6882 <td style="color:blue">2
6883 </td></tr></table>
6884
6885 !! html/parsoid
6886 <table style="border:1px solid black">
6887 <tr>
6888 <td style="color:blue">1</td>
6889 <td style="color:blue">2</td>
6890 </tr>
6891 </table>
6892 !! end
6893
6894 !! test
6895 Invalid text in table attributes should be preserved by selective serializer
6896 !! options
6897 parsoid={
6898 "modes": ["selser"],
6899 "changes": [
6900 ["td:first-child", "text", "abc"],
6901 ["td + td", "text", "xyz"]
6902 ]
6903 }
6904 !! wikitext
6905 {| <span>boo</span> style='border:1px solid black'
6906 | <span>boo</span> style='color:blue' | 1
6907 |<span>boo</span> style='color:blue'| 2
6908 |}
6909 !! wikitext/edited
6910 {| <span>boo</span> style='border:1px solid black'
6911 | <span>boo</span> style='color:blue' | abc
6912 |<span>boo</span> style='color:blue'| xyz
6913 |}
6914 !! end
6915
6916 !! test
6917 1. Template-generated table cell attributes and cell content
6918 !! wikitext
6919 {|
6920 |{{table_attribs}}
6921 | {{table_attribs}}
6922 || {{table_attribs_5}}
6923 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6924 |align=center {{table_attribs}}
6925 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6926 |}
6927 !! html
6928 <table>
6929 <tr>
6930 <td style="color:red;">Foo
6931 </td>
6932 <td style="color:red;">Foo
6933 </td>
6934 <td>style="color:red;"</td>
6935 <td>Bar
6936 </td>
6937 <td style="color:red;">Foo
6938 </td>
6939 <td align="center" style="color:red;">Foo
6940 </td>
6941 <td align="center" style="color:red;">Foo
6942 </td></tr></table>
6943
6944 !! end
6945
6946 !! test
6947 2. Template-generated table cell attributes and cell content
6948 !! wikitext
6949 {|
6950 |{{table_attribs_2}}
6951 |}
6952 !! html/php
6953 <table>
6954 <tr>
6955 <td style="color:red;">Foo
6956 </td>
6957 <td>Bar</td>
6958 <td>Baz
6959 </td></tr></table>
6960
6961 !! html/parsoid
6962 <table>
6963 <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>
6964 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6965 </tbody></table>
6966 !! end
6967
6968 !! test
6969 3. Template-generated table cell attributes and cell content
6970 !! wikitext
6971 {|
6972 !align=center {{table_header_cells}}
6973 |-
6974 |align=center {{table_cells}}
6975 |}
6976 !! html/php
6977 <table>
6978 <tr>
6979 <th align="center" style="color:red;">Foo</th>
6980 <th style="color:red;"><i>Bar</i></th>
6981 <th style="color:brown;"><i>Foo</i> and Baz
6982 </th></tr>
6983 <tr>
6984 <td align="center" style="color:red;">Foo</td>
6985 <td style="color:red;"><i>Bar</i></td>
6986 <td style="color:brown;"><i>Foo</i> and Baz
6987 </td></tr></table>
6988
6989 !! html/parsoid
6990 <table>
6991 <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>
6992 <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>
6993 </tbody></table>
6994 !! end
6995
6996 !! test
6997 4. Template-generated table cell attributes and cell content inside a templated table
6998 !! wikitext
6999 {{tbl-start}}
7000 !align=center {{table_header_cells}}
7001 |-
7002 |align=center {{table_cells}}
7003 {{tbl-end}}
7004 !! html/php
7005 <table>
7006 <tr>
7007 <th align="center" style="color:red;">Foo</th>
7008 <th style="color:red;"><i>Bar</i></th>
7009 <th style="color:brown;"><i>Foo</i> and Baz
7010 </th></tr>
7011 <tr>
7012 <td align="center" style="color:red;">Foo</td>
7013 <td style="color:red;"><i>Bar</i></td>
7014 <td style="color:brown;"><i>Foo</i> and Baz
7015 </td></tr></table>
7016
7017 !! html/parsoid
7018 <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}}]}'>
7019 <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>
7020 <tr>
7021 <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>
7022 </tbody></table>
7023 !! end
7024
7025 ## Edge case fix to prevent future regressions
7026 !! test
7027 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
7028 !! wikitext
7029 {|
7030 |{{table_attribs_7}}
7031 |}
7032 <references />
7033 !! html/parsoid
7034 <table>
7035 <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","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></s></td></tr>
7036 </tbody></table>
7037 <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>
7038 !! end
7039
7040 !! test
7041 Table with row followed by newlines and table heading
7042 !! options
7043 parsoid=wt2html,html2html
7044 !! wikitext
7045 {|
7046 |-
7047
7048 !foo
7049 |}
7050 !! html/*
7051 <table>
7052
7053
7054 <tr>
7055 <th>foo
7056 </th></tr></table>
7057
7058 !! end
7059
7060 !! test
7061 Table with empty line following the start tag
7062 !! options
7063 parsoid=wt2html,html2html
7064 !! wikitext
7065 {|
7066
7067 |-
7068 |foo
7069 |}
7070 !! html/*
7071 <table>
7072
7073
7074 <tr>
7075 <td>foo
7076 </td></tr></table>
7077
7078 !! end
7079
7080 !! test
7081 Table attributes with empty value
7082 !! options
7083 parsoid=wt2html,html2html
7084 !! wikitext
7085 {|
7086 | style=|hello
7087 |}
7088 !! html/php
7089 <table>
7090 <tr>
7091 <td style="">hello
7092 </td></tr></table>
7093
7094 !! html/parsoid
7095 <table>
7096 <tbody><tr><td style="">hello</td></tr>
7097 </tbody></table>
7098 !! end
7099
7100 !! test
7101 Wikitext table with a lot of comments
7102 !! wikitext
7103 {|
7104 <!-- c0 -->
7105 |foo
7106 <!-- c1 -->
7107 |-<!-- c2 -->
7108 <!-- c3 -->
7109 |<!-- c4 -->
7110 <!-- c5 -->
7111 |}
7112 !! html
7113 <table>
7114 <tr>
7115 <td>foo
7116 </td></tr>
7117 <tr>
7118 <td>
7119 </td></tr></table>
7120
7121 !! end
7122
7123 !! test
7124 Wikitext table comments represented in parsoid dom
7125 !! wikitext
7126 {|<!--c1--><!--c2-->
7127 |-<!--c3-->
7128 |x
7129 |}
7130 !! html/php+tidy
7131 <table>
7132
7133 <tbody><tr>
7134 <td>x
7135 </td></tr></tbody></table>
7136 !! html/parsoid
7137 <table><!--c1--><!--c2-->
7138 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
7139 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
7140 </tbody></table>
7141 !! end
7142
7143 !! test
7144 Wikitext table with double-line table cell
7145 !! wikitext
7146 {|
7147 |a
7148 b
7149 |}
7150 !! html
7151 <table>
7152 <tr>
7153 <td>a
7154 <p>b
7155 </p>
7156 </td></tr></table>
7157
7158 !! end
7159
7160 !! test
7161 Table cell with a single comment
7162 !! wikitext
7163 {|
7164 |<!-- c1 -->
7165 |a
7166 |}
7167 !! html
7168 <table>
7169 <tr>
7170 <td>
7171 </td>
7172 <td>a
7173 </td></tr></table>
7174
7175 !! end
7176
7177 !! test
7178 Table-cell after a comment-only-empty-line
7179 !! wikitext
7180 {|
7181 |a
7182 <!--c1-->
7183 <!--c2-->|b
7184 |}
7185 !! html
7186 <table>
7187 <tr>
7188 <td>a
7189 </td>
7190 <td>b
7191 </td></tr></table>
7192
7193 !! html/parsoid
7194 <table>
7195 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7196 <!--c1-->
7197 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
7198 </tbody></table>
7199
7200 !! end
7201
7202 !! test
7203 Build table with {{!}}
7204 !! wikitext
7205 {{{!}} class="wikitable"
7206 !header
7207 !second header
7208 {{!}}- style="color:red;"
7209 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
7210 {{!}}}
7211 !! html
7212 <table class="wikitable">
7213 <tr>
7214 <th>header
7215 </th>
7216 <th>second header
7217 </th></tr>
7218 <tr style="color:red;">
7219 <td>data</td>
7220 <td style="color:red;">second data
7221 </td></tr></table>
7222
7223 !! end
7224
7225 !! test
7226 Build table with pipe as data
7227 !! wikitext
7228 {| class="wikitable"
7229 !header
7230 !second header
7231 |- style="color:red;"
7232 |data|| style="color:red;" |second data
7233 |-
7234 | style="color:red;" |data with | || style="color:red;" | second data with |
7235 |-
7236 ||data with | |||second data with |
7237 |}
7238 !! html
7239 <table class="wikitable">
7240 <tr>
7241 <th>header
7242 </th>
7243 <th>second header
7244 </th></tr>
7245 <tr style="color:red;">
7246 <td>data</td>
7247 <td style="color:red;">second data
7248 </td></tr>
7249 <tr>
7250 <td style="color:red;">data with |</td>
7251 <td style="color:red;">second data with |
7252 </td></tr>
7253 <tr>
7254 <td>data with |</td>
7255 <td>second data with |
7256 </td></tr></table>
7257
7258 !! end
7259
7260 !! test
7261 Build table with wikilink
7262 !! wikitext
7263 {| class="wikitable"
7264 !header||second header
7265 |- style="color:red;"
7266 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
7267 |-
7268 |data||second data [[Main Page|link|text with pipe]]
7269 |}
7270 !! html
7271 <table class="wikitable">
7272 <tr>
7273 <th>header</th>
7274 <th>second header
7275 </th></tr>
7276 <tr style="color:red;">
7277 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
7278 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7279 </td></tr>
7280 <tr>
7281 <td>data</td>
7282 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7283 </td></tr></table>
7284
7285 !! end
7286
7287 # The expected HTML structure in this test is debatable. The PHP parser does
7288 # not parse this kind of table at all. The main focus for Parsoid is on
7289 # round-tripping, so this output is ok for now. TODO: revisit!
7290 !! test
7291 Wikitext table with html-syntax row
7292 !! wikitext
7293 {|
7294 |-
7295 <td>foo</td>
7296 |}
7297 !! html/parsoid
7298 <table>
7299 <tbody>
7300 <tr>
7301 <td>foo</td></tr></tbody></table>
7302 !! end
7303
7304 !! test
7305 Fostered content in tables: Plain text
7306 !! options
7307 parsoid=wt2html,html2html
7308 !! wikitext
7309 {|
7310 |-
7311 a
7312 |}
7313 !! html/php
7314 <table>
7315
7316 a
7317 </table>
7318
7319 !! html/php+tidy
7320
7321
7322 a
7323 <table></table>
7324 !! html/parsoid
7325 <span data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
7326 a
7327 </span><table>
7328 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr></tbody></table>
7329 !! end
7330
7331 !! test
7332 Fostered content in tables: Lists
7333 !! options
7334 parsoid=wt2html,html2html
7335 !! wikitext
7336 {|
7337 |-
7338 *a
7339 |}
7340 !! html/php
7341 <table>
7342
7343 <ul><li>a</li></ul>
7344 </table>
7345
7346 !! html/php+tidy
7347 <ul><li>a</li></ul><table>
7348
7349
7350 </table>
7351 !! html/parsoid
7352 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7353 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7354
7355 </tr></tbody></table>
7356 !! end
7357
7358 !! test
7359 Template generated table cell with attributes
7360 !! wikitext
7361 {|
7362 |-
7363 {{table_attribs_4}} ||a||b
7364 |}
7365 !! html/php+tidy
7366 <table>
7367
7368 <tbody><tr>
7369 <td style="background-color:#DC241f;" width="10px"></td>
7370 <td>a</td>
7371 <td>b
7372 </td></tr></tbody></table>
7373 !! html/parsoid
7374 <table>
7375 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7376 <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>
7377 !! end
7378
7379 !! test
7380 Parsoid: Round-trip tables directly followed by content (T53219)
7381 !! options
7382 parsoid=wt2html,wt2wt
7383 !! wikitext
7384 {|
7385 |foo
7386 |} bar
7387
7388 {|
7389 |baz
7390 |}<b>quux</b>
7391 !! html+tidy
7392 <table>
7393 <tbody><tr>
7394 <td>foo
7395 </td></tr></tbody></table><p> bar
7396 </p><table>
7397 <tbody><tr>
7398 <td>baz
7399 </td></tr></tbody></table><p><b>quux</b>
7400 </p>
7401 !! end
7402
7403 !! test
7404 Parsoid: Default to a newline after tables in new content (T53219)
7405 !! options
7406 parsoid=html2wt
7407 !! html/parsoid
7408 <table><tbody>
7409 <tr><td>foo</td></tr></tbody></table> bar
7410 <table><tbody>
7411 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7412 !! wikitext
7413 {|
7414 |foo
7415 |}
7416 <nowiki> </nowiki>bar
7417 {|
7418 |baz
7419 |}
7420 '''quux'''
7421 !! end
7422
7423 !! test
7424 Parsoid: Row-syntax table headings followed by comment & table cells
7425 !! options
7426 parsoid=wt2html,wt2wt
7427 !! wikitext
7428 {|
7429 !foo||bar
7430 <!-- foo --> ||baz||quux
7431 |}
7432 !! html/php
7433 <table>
7434 <tr>
7435 <th>foo</th>
7436 <th>bar
7437 </th>
7438 <td>baz</td>
7439 <td>quux
7440 </td></tr></table>
7441
7442 !! html/parsoid
7443 <table>
7444 <tbody><tr><th>foo</th><th>bar
7445 <!-- foo --></th><td> baz </td><td>quux</td></tr>
7446 </tbody></table>
7447 !! end
7448
7449 !!test
7450 Parsoid: Recover better from broken table attributes
7451 !!options
7452 parsoid=wt2html
7453 !!wikitext
7454 {| class="foo
7455 | class="bar" |
7456 foo
7457 |}
7458 !!html/php+tidy
7459 <table class="foo">
7460 <tbody><tr>
7461 <td class="bar">
7462 <p>foo
7463 </p>
7464 </td></tr></tbody></table>
7465 !!html/parsoid
7466 <table class="foo">
7467 <tr>
7468 <td class="bar">
7469 <p>foo</p></td></tr>
7470 </tbody></table>
7471 !!end
7472
7473 !! test
7474 Tables: Digest broken attributes on table and tr tag
7475 !! options
7476 parsoid=wt2html
7477 !! wikitext
7478 {| || |} ++
7479 |- || || ++ --
7480 |- > [
7481 |}
7482 !! html
7483 <table>
7484 <tbody>
7485 <tr class='mw-empty-elt'></tr>
7486 <tr class='mw-empty-elt'></tr>
7487 </tbody></table>
7488 !! end
7489
7490 !! test
7491 Table with missing opening <tr> tag
7492 !! options
7493 parsoid=wt2html,wt2wt
7494 !! wikitext
7495 <table>
7496 <td>foo</td>
7497 </tr>
7498 </table>
7499 !! html+tidy
7500 <table>
7501 <tbody><tr><td>foo</td>
7502 </tr>
7503 </tbody></table>
7504 !! end
7505
7506 # T137406: Whitespace in the HTML
7507 !! test
7508 1. Generate correct wikitext for tables with thead/tbody/tfoot
7509 !! options
7510 parsoid=html2wt
7511 !! html/parsoid
7512 <table>
7513 <caption>Test</caption>
7514 <thead>
7515 <tr>
7516 <th>Month</th>
7517 <th>Savings</th>
7518 </tr>
7519 </thead>
7520 <tbody>
7521 <tr>
7522 <td>January</td>
7523 <td>$100</td>
7524 </tr>
7525 <tr>
7526 <td>February</td>
7527 <td>$80</td>
7528 </tr>
7529 </tbody>
7530 <tfoot>
7531 <tr>
7532 <td>Sum</td>
7533 <td>$180</td>
7534 </tr>
7535 </tfoot>
7536 </table>
7537 !! wikitext
7538 {|
7539 |+Test
7540 !Month
7541 !Savings
7542 |-
7543 |January
7544 |$100
7545 |-
7546 |February
7547 |$80
7548 |-
7549 |Sum
7550 |$180
7551 |}
7552 !! html/php+tidy
7553 <table>
7554 <caption>Test
7555 </caption>
7556 <tbody><tr>
7557 <th>Month
7558 </th>
7559 <th>Savings
7560 </th></tr>
7561 <tr>
7562 <td>January
7563 </td>
7564 <td>$100
7565 </td></tr>
7566 <tr>
7567 <td>February
7568 </td>
7569 <td>$80
7570 </td></tr>
7571 <tr>
7572 <td>Sum
7573 </td>
7574 <td>$180
7575 </td></tr></tbody></table>
7576 !! end
7577
7578 # T137406: No whitespace in the HTML
7579 !! test
7580 2. Generate correct wikitext for tables with thead/tbody/tfoot
7581 !! options
7582 parsoid=html2wt
7583 !! html/parsoid
7584 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7585 !! wikitext
7586 {|
7587 !heading
7588 |-
7589 |foo
7590 |}
7591 !! end
7592
7593 !! test
7594 Wikitext tables can be nested inside HTML tables
7595 !! options
7596 parsoid=html2wt
7597 !! html
7598 <table data-parsoid='{"stx":"html"}'>
7599 <tr><td>
7600 <table>
7601 <tr><td>foo</td></tr>
7602 </table>
7603 </td></tr>
7604 </table>
7605 !! wikitext
7606 <table>
7607 <tr><td>
7608 {|
7609 |foo
7610 |}
7611 </td></tr>
7612 </table>
7613 !! end
7614
7615 ###
7616 ### Internal links
7617 ###
7618 !! test
7619 Plain link, capitalized
7620 !! wikitext
7621 [[Main Page]]
7622 !! html
7623 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7624 </p>
7625 !! end
7626
7627 !! test
7628 Plain link, uncapitalized
7629 !! wikitext
7630 [[main Page]]
7631 !! html
7632 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7633 </p>
7634 !! end
7635
7636 !! test
7637 Piped link
7638 !! wikitext
7639 [[Main Page|The Main Page]]
7640 !! html
7641 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7642 </p>
7643 !! end
7644
7645 !! test
7646 Piped link with comment in link text
7647 !! wikitext
7648 [[Main Page|The Main<!--front--> Page]]
7649 !! html
7650 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7651 </p>
7652 !! end
7653
7654 !! test
7655 Piped link with multiple pipe characters in link text
7656 !! wikitext
7657 [[Main Page||The|Main|Page|]]
7658 !! html/php
7659 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7660 </p>
7661 !! html/parsoid
7662 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7663 !! end
7664
7665 !! test
7666 Piped link with no link text
7667 !! wikitext
7668 [[Thomas Bek (bishop of St David's)|]]
7669 !! html/php
7670 <p>[[Thomas Bek (bishop of St David's)|]]
7671 </p>
7672 !! html/parsoid
7673 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7674 !! end
7675
7676 !! test
7677 Piped link with empty link text
7678 !! wikitext
7679 [[Main Page|<nowiki/>]] - empty nowiki
7680 [[Main Page| ]] - empty space
7681 [[Main Page|&nbsp;]] - empty non breaking space
7682 !! html/php
7683 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7684 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7685 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7686 </p>
7687 !! html/parsoid
7688 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7689 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7690 <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>
7691 !! end
7692
7693 !! test
7694 Broken link
7695 !! wikitext
7696 [[Zigzagzogzagzig]]
7697 !! html
7698 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7699 </p>
7700 !! end
7701
7702 !! test
7703 Broken link with fragment
7704 !! wikitext
7705 [[Zigzagzogzagzig#zug]]
7706 !! html
7707 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7708 </p>
7709 !! end
7710
7711 !! test
7712 Special page link with fragment
7713 !! wikitext
7714 [[Special:Version#anchor]]
7715 !! html
7716 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7717 </p>
7718 !! end
7719
7720 !! test
7721 Nonexistent special page link with fragment
7722 !! wikitext
7723 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7724 !! html
7725 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7726 </p>
7727 !! end
7728
7729 !! test
7730 Link with prefix
7731 !! wikitext
7732 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7733 !! html
7734 <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>
7735 </p>
7736 !! end
7737
7738 !! test
7739 Link with suffix
7740 !! wikitext
7741 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7742 !! html
7743 <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>!!!
7744 </p>
7745 !! end
7746
7747 !! article
7748 prefixed article
7749 !! text
7750 Some text
7751 !! endarticle
7752
7753 !! test
7754 T45661: Piped links with identical prefixes
7755 !! wikitext
7756 [[prefixed article|prefixed articles with spaces]]
7757
7758 [[prefixed article|prefixed articlesaoeu]]
7759
7760 [[Main Page|Main Page test]]
7761 !! html
7762 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7763 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7764 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7765 </p>
7766 !! end
7767
7768
7769 !! test
7770 Link with HTML entity in suffix / tail
7771 !! wikitext
7772 [[Main Page]]&quot;, [[Main Page]]&#97;
7773 !! html/php
7774 <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;
7775 </p>
7776 !! html/parsoid
7777 <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>
7778 !! end
7779
7780 !! test
7781 Link with 3 brackets
7782 !! wikitext
7783 [[[Main Page]]]
7784 Foo [[[Main Page]]]
7785 !! html
7786 <p>[[[Main Page]]]
7787 Foo [[[Main Page]]]
7788 </p>
7789 !! end
7790
7791 !! test
7792 Link with 4 brackets
7793 !! wikitext
7794 [[[[Main Page]]]]
7795 !! html
7796 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7797 </p>
7798 !! end
7799
7800 !! test
7801 Piped link with 3 brackets
7802 !! wikitext
7803 [[[main page|the main page]]]
7804 !! html
7805 <p>[[[main page|the main page]]]
7806 </p>
7807 !! end
7808
7809 !! test
7810 Piped link with extlink-like text
7811 !! wikitext
7812 [[Main Page|[bar]]]
7813 [[Main Page|This is a [bar]]]
7814 [[Main Page|[bar]]
7815 !! html/php
7816 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7817 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7818 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7819 </p>
7820 !! html/parsoid
7821 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7822 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7823 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7824 !! end
7825
7826 !! test
7827 Link with multiple pipes
7828 !! wikitext
7829 [[Main Page|The|Main|Page]]
7830 !! html
7831 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7832 </p>
7833 !! end
7834
7835 !! test
7836 Anchor containing a #. (T65430)
7837 !! config
7838 wgFragmentMode=[ 'html5', 'legacy' ]
7839 !! wikitext
7840 [[Main Page#And#Link]]
7841 !! html/php
7842 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7843 </p>
7844 !! html/parsoid
7845 <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>
7846 !! end
7847
7848 !! test
7849 Link to namespaces
7850 !! wikitext
7851 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7852 !! html
7853 <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>
7854 </p>
7855 !! end
7856
7857 !! test
7858 Link with space in namespace
7859 !! wikitext
7860 [[User talk:Foo bar]]
7861 !! html
7862 <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>
7863 </p>
7864 !! end
7865
7866 !! article
7867 MemoryAlpha:AlphaTest
7868 !! text
7869 This is an article in the MemoryAlpha namespace
7870 (which shadows the memoryalpha interwiki link).
7871 !! endarticle
7872
7873 !! test
7874 Namespace takes precedence over interwiki link (T53680)
7875 !! wikitext
7876 [[MemoryAlpha:AlphaTest]]
7877 !! html
7878 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7879 </p>
7880 !! end
7881
7882 # The previous test doesn't work correctly in html2*, due to not recognizing the
7883 # link as an internal one. This one checks for the correct behavior.
7884 !! test
7885 Link to namespace preferred over interwiki with correct rel attribute
7886 !! options
7887 parsoid=html2wt,html2html
7888 !! html/parsoid
7889 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7890 !! wikitext
7891 [[MemoryAlpha:AlphaTest]]
7892 !! end
7893
7894 !! test
7895 Piped link to namespace
7896 !! wikitext
7897 [[Meta:Disclaimers|The disclaimers]]
7898 !! html
7899 <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>
7900 </p>
7901 !! end
7902
7903 !! test
7904 Link containing }
7905 !! wikitext
7906 [[Usually caused by a typo (oops}]]
7907 !! html
7908 <p>[[Usually caused by a typo (oops}]]
7909 </p>
7910 !! end
7911
7912 !! article
7913 7% Solution
7914 !! text
7915 Just a test of an article title containing a percent.
7916 !! endarticle
7917
7918 !! test
7919 Link containing % (not as a hex sequence)
7920 !! wikitext
7921 [[7% Solution]]
7922 [[7% Solution|7%25 Solution]]
7923 !! html/php
7924 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7925 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7926 </p>
7927 !! html/parsoid
7928 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7929 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7930 !! end
7931
7932 # note that the parsoid HTML is identical to the previous test output,
7933 # so the previous test ensures that the html2wt mode will generate the
7934 # "not as a hex sequence" wikitext.
7935 !! test
7936 Link containing % as a single hex sequence interpreted to char
7937 !! options
7938 parsoid=wt2wt,wt2html,html2html
7939 !! wikitext
7940 [[7%25 Solution]]
7941 [[7%25 Solution|7%25 Solution]]
7942 !! html/php
7943 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7944 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7945 </p>
7946 !! html/parsoid
7947 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7948 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7949 !!end
7950
7951 !! test
7952 Link containing % as a double hex sequence interpreted to hex sequence
7953 !! wikitext
7954 [[7%2525 Solution]]
7955 !! html
7956 <p>[[7%2525 Solution]]
7957 </p>
7958 !!end
7959
7960 ## Example for such a section: == < ==
7961 !! test
7962 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7963 !! config
7964 wgFragmentMode=[ 'html5', 'legacy' ]
7965 !! wikitext
7966 [[%23%3c]][[%23%3e]]
7967 !! html/php
7968 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
7969 </p>
7970 !! html/parsoid
7971 <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>
7972 !! end
7973
7974 ## Example for such a section: == < ==
7975 !! test
7976 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
7977 !! config
7978 wgFragmentMode=[ 'legacy' ]
7979 !! wikitext
7980 [[%23%3c]][[%23%3e]]
7981 !! html/php
7982 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7983 </p>
7984 !! end
7985
7986 !! test
7987 Link containing "<#" and ">#" as a hex sequences
7988 !! wikitext
7989 [[%3c%23]][[%3e%23]]
7990 !! html
7991 <p>[[%3c%23]][[%3e%23]]
7992 </p>
7993 !! end
7994
7995 !! test
7996 Link containing an equals sign
7997 !! wikitext
7998 [[Special:BookSources/isbn=4-00-026157-6]]
7999 !! html/php
8000 <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>
8001 </p>
8002 !! html/parsoid
8003 <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>
8004 !! end
8005
8006 !! article
8007 Foo~bar
8008 !! text
8009 Just a test of an article title containing a tilde.
8010 !! endarticle
8011
8012 # note that links containing signatures, like [[Foo~~~~]], are
8013 # massaged by the pre-save transform (PST) and so the tildes are never
8014 # seen by the parser.
8015 !! test
8016 Link containing a tilde
8017 !! wikitext
8018 [[Foo~bar]]
8019 !! html/php
8020 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
8021 </p>
8022 !! html/parsoid
8023 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
8024 !! end
8025
8026 !! test
8027 Link containing double-single-quotes '' (T6598)
8028 !! wikitext
8029 [[Lista d''e paise d''o munno]]
8030 !! html/php
8031 <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>
8032 </p>
8033 !! html/parsoid
8034 <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>
8035 !! end
8036
8037 !! test
8038 Link containing double quotes and spaces
8039 !! wikitext
8040 [[Cool "Gator"]]
8041 !! html/php
8042 <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>
8043 </p>
8044 !! html/parsoid
8045 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
8046 !! end
8047
8048 !! test
8049 File containing double quotes and spaces
8050 !! wikitext
8051 [[File:Cool "Gator".png]]
8052 !! html/parsoid
8053 <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>
8054 !! end
8055
8056 !! test
8057 Redirect containing double quotes and spaces
8058 !! wikitext
8059 #REDIRECT [[Cool "Gator"]]
8060 !! html/parsoid
8061 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
8062 !! end
8063
8064 !! test
8065 Link containing double-single-quotes '' in text (T6598 sanity check)
8066 !! wikitext
8067 Some [[Link|pretty ''italics'' and stuff]]!
8068 !! html/php
8069 <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>!
8070 </p>
8071 !! html/parsoid
8072 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8073 !! end
8074
8075 !! test
8076 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8077 !! wikitext
8078 ''Some [[Link|pretty ''italics'' and stuff]]!''
8079 !! html
8080 <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>
8081 </p>
8082 !! end
8083
8084 !! test
8085 Link with double quotes in title part (literal) and alternate part (interpreted)
8086 !! wikitext
8087 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8088
8089 [[''Pentecoste'']]
8090
8091 [[''Pentecoste''|Pentecoste]]
8092
8093 [[''Pentecoste''|''Pentecoste'']]
8094 !! html/php
8095 <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>
8096 </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>
8097 </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>
8098 </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>
8099 </p>
8100 !! html/parsoid
8101 <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>
8102 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8103 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8104 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8105 !! end
8106
8107 !! test
8108 Broken image links with HTML captions (T41700)
8109 !! wikitext
8110 [[File:Nonexistent|<script></script>]]
8111 [[File:Nonexistent|100x100px|<script></script>]]
8112 [[File:Nonexistent|&lt;]]
8113 [[File:Nonexistent|a<i>b</i>c]]
8114 !! html/php
8115 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8116 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8117 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8118 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8119 </p>
8120 !! html/parsoid
8121 <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>
8122 <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>
8123 <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>
8124 <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>
8125 !! end
8126
8127 !! test
8128 Plain link to URL
8129 !! wikitext
8130 [[http://www.example.com]]
8131 !! html/php
8132 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8133 </p>
8134 !! html/parsoid
8135 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
8136 !! end
8137
8138 !! test
8139 Plain link to URL with link text
8140 !! wikitext
8141 [[http://www.example.com Link text]]
8142 !! html
8143 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8144 </p>
8145 !! end
8146
8147 !! test
8148 Plain link to protocol-relative URL
8149 !! wikitext
8150 [[//www.example.com]]
8151 !! html/php
8152 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8153 </p>
8154 !! html/parsoid
8155 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8156 !! end
8157
8158 !! test
8159 Plain link to protocol-relative URL with link text
8160 !! wikitext
8161 [[//www.example.com Link text]]
8162 !! html
8163 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8164 </p>
8165 !! end
8166
8167 !! test
8168 Plain link to page with question mark in title
8169 !! wikitext
8170 [[A?b]]
8171
8172 [[A?b|Baz]]
8173 !! html
8174 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8175 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8176 </p>
8177 !! end
8178
8179 # I'm fairly sure the expected result here is wrong.
8180 # We want these to be URL links, not pseudo-pages with URLs for titles....
8181 # However the current output is also pretty screwy.
8182 #
8183 # ----
8184 # I'm changing it to match the current output--it arguably makes more
8185 # sense in the light of the test above. Old expected result was:
8186 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8187 #</p>
8188 # But I think this test is bordering on "garbage in, garbage out" anyway.
8189 # -- wtm
8190 !! test
8191 Piped link to URL
8192 !! wikitext
8193 Piped link to URL: [[http://www.example.com|an example URL]]
8194 !! html/php
8195 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8196 </p>
8197 !! html/parsoid
8198 <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>
8199 !! end
8200
8201 !! test
8202 Plain link in template argument
8203 !! options
8204 parsoid=wt2html
8205 !! wikitext
8206 {{echo|[http://www.example.com |123]}}
8207
8208 {{echo|[[http://www.example.com |123]]}}
8209
8210 {{echo|[[http://www.example.com |123]}}
8211
8212 {{echo|[http://www.example.com |123]]}}
8213 !! html/php
8214 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8215 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8216 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8217 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8218 </p>
8219 !! html/parsoid
8220 <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>
8221
8222 <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>
8223
8224 <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>
8225
8226 <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>
8227 !! end
8228
8229 !! test
8230 T2002: [[page|http://url/]] should link to page, not http://url/
8231 !! wikitext
8232 [[Main Page|http://url/]]
8233 !! html/php
8234 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8235 </p>
8236 !! html/parsoid
8237 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8238 !! end
8239
8240 # Parsoid does not mark self-links, by design.
8241 !! test
8242 T2337: Escaped self-links should be bold
8243 !! options
8244 title=[[Bug462]]
8245 !! wikitext
8246 [[Bu&#103;462]] [[Bug462]]
8247 !! html/php+tidy
8248 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8249 </p>
8250 !! html/parsoid
8251 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8252 !! end
8253
8254 !! test
8255 Self-link to section should not be bold
8256 !! options
8257 title=[[Main Page]]
8258 !! wikitext
8259 [[Main Page#section]]
8260 !! html
8261 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8262 </p>
8263 !! end
8264
8265 !! article
8266 00
8267 !! text
8268 This is 00.
8269 !! endarticle
8270
8271 !!test
8272 Self-link to numeric title
8273 !!options
8274 title=[[0]]
8275 !! wikitext
8276 [[0]]
8277 !! html
8278 <p><a class="mw-selflink selflink">0</a>
8279 </p>
8280 !!end
8281
8282 !!test
8283 Link to numeric-equivalent title
8284 !!options
8285 title=[[0]]
8286 !! wikitext
8287 [[00]]
8288 !! html
8289 <p><a href="/wiki/00" title="00">00</a>
8290 </p>
8291 !!end
8292
8293 !! test
8294 <nowiki> inside a link
8295 !! wikitext
8296 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8297 !! html
8298 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8299 </p>
8300 !! end
8301
8302 !! test
8303 Non-breaking spaces in title
8304 !! wikitext
8305 [[&nbsp; Main &nbsp; Page &nbsp;]]
8306 !! html
8307 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8308 </p>
8309 !!end
8310
8311 # Add new article for the test below so that it doesn't red-link
8312 !! article
8313 Foo bar baz
8314 !! text
8315 boo
8316 !! endarticle
8317
8318 !! test
8319 Multiple spaces in titles should normalize to a single underscore
8320 !! options
8321 parsoid=wt2html,wt2wt
8322 !! wikitext
8323 [[Foo bar baz|x]]
8324 [[Foo bar baz|x]]
8325 [[Foo bar baz|x]]
8326 !! html/php
8327 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8328 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8329 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8330 </p>
8331 !! html/parsoid
8332 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8333 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8334 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8335 </p>
8336 !! end
8337
8338 !! test
8339 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8340 !! options
8341 language=ca
8342 !! wikitext
8343 '''[[Main Page]]'''
8344 !! html
8345 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8346 </p>
8347 !! end
8348
8349 !! test
8350 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8351 !! options
8352 language=ca
8353 !! wikitext
8354 ''[[Main Page]]''
8355 !! html
8356 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8357 </p>
8358 !! end
8359
8360 !! test
8361 Internal link with en linktrail: no apostrophes (T29473)
8362 !! options
8363 language=en
8364 !! wikitext
8365 [[Something]]'nice
8366 !! html
8367 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8368 </p>
8369 !! end
8370
8371 !! test
8372 Internal link with ca linktrail with apostrophes (T29473)
8373 !! options
8374 language=ca
8375 !! wikitext
8376 [[Something]]'nice
8377 !! html
8378 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8379 </p>
8380 !! end
8381
8382 !! test
8383 Internal link with kaa linktrail with apostrophes (T29473)
8384 !! options
8385 language=kaa
8386 !! wikitext
8387 [[Something]]'nice
8388 !! html
8389 <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>
8390 </p>
8391 !! end
8392
8393 !! test
8394 Link with multiple ":" in a subpage-supporting namespace (T65636)
8395 !! wikitext
8396 [[User:Foo/Test/63636:Bar|Test]]
8397 !! html/php
8398 <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>
8399 </p>
8400 !! html/parsoid
8401 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8402 !! end
8403
8404 ## Mainly a sanity check for Parsoid
8405 !! test
8406 Handle title parsing for subpages
8407 !! options
8408 title=[[/123123]]
8409 subpage
8410 !! wikitext
8411 123
8412 !! html/php
8413 <p>123
8414 </p>
8415 !! html/parsoid
8416 <p>123</p>
8417 !! end
8418
8419 !! article
8420 User:Test/123
8421 !! text
8422 test 123
8423 !! endarticle
8424
8425 !! test
8426 Link to a subpage from a namespace other than main
8427 !! options
8428 title=[[User:Test]]
8429 subpage
8430 !! wikitext
8431 [[/123]]
8432 !! html/php
8433 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8434 </p>
8435 !! html/parsoid
8436 <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>
8437 !! end
8438
8439 !! test
8440 Ensure that transclusion titles are not url-decoded
8441 !! options
8442 subpage title=[[Test]]
8443 parsoid=wt2html
8444 !! wikitext
8445 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8446 !! html/php
8447 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8448 </p>
8449 !! html/parsoid
8450 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8451 !! end
8452
8453 !! test
8454 Purely hash wikilink
8455 !! options
8456 title=[[User:Test/123]]
8457 subpage
8458 !! wikitext
8459 [[#a|b]]
8460 !! html/php
8461 <p><a href="#a">b</a>
8462 </p>
8463 !! html/parsoid
8464 <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>
8465 !! end
8466
8467 !! test
8468 Serialization of purely hash wikilink
8469 !! options
8470 title=[[User:Test/123]]
8471 subpage
8472 parsoid=html2wt
8473 !! html/parsoid
8474 <p><a href="#a">[[</a></p>
8475 !! wikitext
8476 [[#a|<nowiki>[[</nowiki>]]
8477 !! html/php
8478 <p><a href="#a">[[</a>
8479 </p>
8480 !! end
8481
8482 !! test
8483 1. Interaction of linktrail and template encapsulation
8484 !! wikitext
8485 {{echo|[[Foo]]}}l
8486 !! html/parsoid
8487 <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>
8488 !! end
8489
8490 !! test
8491 2. Interaction of linktrail and template encapsulation
8492 !! options
8493 parsoid
8494 !! wikitext
8495 {{echo|Some [[Fool]]}}s
8496 !! html
8497 <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>
8498 !! end
8499
8500 !! test
8501 3. Interaction of linktrail and template encapsulation
8502 !! options
8503 parsoid
8504 !! wikitext
8505 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8506 !! html
8507 <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>
8508 !! end
8509
8510 !! article
8511 Söfnuður
8512 !! text
8513 Test.
8514 !! endarticle
8515
8516 !! test
8517 Internal link with is link prefix
8518 !! options
8519 language=is
8520 !! wikitext
8521 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8522 !! html
8523 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8524 </p>
8525 !! end
8526
8527 !! article
8528 Mótmælendatrú
8529 !! text
8530 Test.
8531 !! endarticle
8532
8533 !! test
8534 Internal link with is link trail and link prefix
8535 !! options
8536 language=is
8537 !! wikitext
8538 [[mótmælendatrú|xxx]]ar
8539 [[mótmælendatrú]]ar
8540 mótmælenda[[söfnuður]]
8541 mótmælenda[[söfnuður|söfnuðir]]
8542 mótmælenda[[söfnuður|söfnuðir]]xxx
8543 !! html
8544 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8545 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8546 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8547 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8548 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8549 </p>
8550 !! end
8551
8552 !! test
8553 Parsoid link trail escaping
8554 !! options
8555 parsoid=html2wt,html2html
8556 !! html/parsoid
8557 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8558 !! wikitext
8559 [[apple]]<nowiki/>s
8560 !! end
8561
8562 !! test
8563 Parsoid link prefix escaping
8564 !! options
8565 language=is
8566 parsoid=html2wt,html2html
8567 !! html/parsoid
8568 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8569 !! wikitext
8570 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8571 !! end
8572
8573 !! test
8574 Parsoid link bracket escaping
8575 !! options
8576 parsoid=html2wt,html2html
8577 !! html/parsoid
8578 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8579 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8580 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8581 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8582 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8583 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8584 !! wikitext
8585 [[Test]]
8586
8587 [<nowiki/>[[Test]]]
8588
8589 [[[[Test]]]]
8590
8591 [[[<nowiki/>[[Test]]]]]
8592
8593 [[[[[[Test]]]]]]
8594
8595 [[[[[<nowiki/>[[Test]]]]]]]
8596 !! end
8597
8598 !! test
8599 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8600 !! wikitext
8601 [[Foo| bar]]
8602
8603 [[Foo| ''bar'']]
8604
8605 [http://wp.org foo]
8606
8607 [http://wp.org ''foo'']
8608 !! html
8609 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8610 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8611 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8612 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8613 </p>
8614 !! end
8615
8616 !! test
8617 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8618 !! wikitext
8619 [[Foo|{{echo|a}} b {{echo|c}}]]
8620 !! html/parsoid
8621 <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>
8622 !! end
8623
8624 !! test
8625 Link with angle bracket after anchor
8626 !! config
8627 wgFragmentMode=[ 'html5', 'legacy' ]
8628 !! wikitext
8629 [[Foo#<bar>]]
8630 !! html/php
8631 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8632 </p>
8633 !! html/parsoid
8634 <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>
8635 !! end
8636
8637 !! test
8638 Link with angle bracket after anchor (legacy)
8639 !! config
8640 wgFragmentMode=[ 'legacy' ]
8641 !! wikitext
8642 [[Foo#<bar>]]
8643 !! html/php
8644 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8645 </p>
8646 !! end
8647
8648 ###
8649 ### Interwiki links (see maintenance/interwiki.sql)
8650 ###
8651
8652 !! test
8653 Inline interwiki link
8654 !! options
8655 parsoid=wt2html,wt2wt,html2html
8656 !! wikitext
8657 [[MeatBall:SoftSecurity]]
8658 !! html/php
8659 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8660 </p>
8661 !! html/parsoid
8662 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8663 !! end
8664
8665 !! test
8666 Inline interwiki link with empty title (T4372)
8667 !! options
8668 parsoid=wt2html,wt2wt,html2html
8669 !! wikitext
8670 [[MeatBall:]]
8671 !! html/php
8672 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8673 </p>
8674 !! html/parsoid
8675 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8676 !! end
8677
8678 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8679 !! test
8680 Interwiki link encoding conversion (T3636)
8681 !! options
8682 parsoid=wt2html,wt2wt
8683 !! wikitext
8684 *[[Wikipedia:ro:Olteni&#0355;a]]
8685 *[[Wikipedia:ro:Olteni&#355;a]]
8686 !! html
8687 <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>
8688 <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>
8689
8690 !! html/php+tidy
8691 <ul>
8692 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8693 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8694 </ul>
8695 !! html/parsoid
8696 <ul>
8697 <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>
8698 <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>
8699 </ul>
8700 !! end
8701
8702 !! test
8703 Interwiki link with fragment (T4130)
8704 !! wikitext
8705 [[MeatBall:SoftSecurity#foo]]
8706 !! html
8707 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8708 </p>
8709 !! end
8710
8711 !! test
8712 Link scenarios with escaped fragments
8713 !! config
8714 wgFragmentMode=[ 'html5', 'legacy' ]
8715 !! wikitext
8716 [[#Is this great?]]
8717 [[Foo#Is this great?]]
8718 [[meatball:Foo#Is this great?]]
8719 !! html/php
8720 <p><a href="#Is_this_great?">#Is this great?</a>
8721 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8722 <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>
8723 </p>
8724 !! html/parsoid
8725 <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>
8726 <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>
8727 <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>
8728 !! end
8729
8730 !! test
8731 Link scenarios with escaped fragments (legacy)
8732 !! config
8733 wgFragmentMode=[ 'legacy' ]
8734 !! wikitext
8735 [[#Is this great?]]
8736 [[Foo#Is this great?]]
8737 [[meatball:Foo#Is this great?]]
8738 !! html/php
8739 <p><a href="#Is_this_great.3F">#Is this great?</a>
8740 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8741 <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>
8742 </p>
8743 !! end
8744
8745 # Ideally the wikipedia: prefix here should be proto-relative too
8746 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8747 # define the 'en' prefix, and originally the test used 'wikipedia',
8748 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8749 # article.
8750 !! test
8751 Different interwiki prefixes mapping to the same URL
8752 !! wikitext
8753 [[:en:Foo]]
8754
8755 [[:en:Foo|Foo]]
8756
8757 [[wikipedia:Foo]]
8758
8759 [[:wikipedia:Foo|Foo]]
8760
8761 [[wikipedia:en:Foo]]
8762
8763 [[:wikipedia:en:Foo]]
8764
8765 [[ wikiPEdia :Foo]]
8766 !! html/parsoid
8767 <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>
8768
8769 <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>
8770
8771 <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>
8772
8773 <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>
8774
8775 <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>
8776
8777 <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>
8778
8779 <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>
8780 !! end
8781
8782 !! test
8783 Interwiki links that cannot be represented in wiki syntax
8784 !! wikitext
8785 [[meatball:ok]]
8786 [[meatball:ok#foo|ok with fragment]]
8787 [[meatball:ok_as_well?|ok ending with ? mark]]
8788 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8789 [http://de.wikipedia.org/wiki/#foo is just fragment]
8790
8791 !! html/php
8792 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8793 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8794 <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>
8795 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8796 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8797 </p>
8798 !! html/parsoid
8799 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8800 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8801 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
8802 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8803 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8804 !! end
8805
8806 !! test
8807 Interwiki links: trail
8808 !! wikitext
8809 [[wikipedia:Foo|Ba]]r
8810 !! html/php
8811 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8812 </p>
8813 !! html/parsoid
8814 <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>
8815 !! end
8816
8817 !! test
8818 Local interwiki link
8819 !! options
8820 parsoid=wt2html,wt2wt,html2html
8821 !! wikitext
8822 [[local:Template:Foo]]
8823 !! html/php
8824 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8825 </p>
8826 !! html/parsoid
8827 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8828 !! end
8829
8830 # Parsoid does not mark self-links, by design.
8831 !! test
8832 Local interwiki link: self-link to current page
8833 !! options
8834 title=[[Main Page]]
8835 parsoid=wt2html,wt2wt,html2html
8836 !! wikitext
8837 [[local:Main Page]]
8838 !! html/php
8839 <p><a class="mw-selflink selflink">local:Main Page</a>
8840 </p>
8841 !! html/parsoid
8842 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8843 !! end
8844
8845 !! test
8846 Local interwiki link: prefix only (T66167)
8847 !! options
8848 parsoid=wt2html,wt2wt,html2html
8849 !! wikitext
8850 [[local:]]
8851 !! html/php
8852 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8853 </p>
8854 !! html/parsoid
8855 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8856 !! end
8857
8858 !! test
8859 Local interwiki link: with additional interwiki prefix (T63357)
8860 !! options
8861 parsoid=wt2html,wt2wt,html2html
8862 !! wikitext
8863 [[local:meatball:Hello]]
8864 !! html/php
8865 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8866 </p>
8867 !! html/parsoid
8868 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8869 !! end
8870
8871 !! test
8872 Multiple local interwiki link prefixes
8873 !! wikitext
8874 [[local:local:local:local:mi:local:Foo]]
8875 !! options
8876 parsoid=wt2html,wt2wt,html2html
8877 !! html/php
8878 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8879 </p>
8880 !! html/parsoid
8881 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8882 !! end
8883
8884 ###
8885 ### Interlanguage links
8886 ### Language links (so that searching for '### language' matches..)
8887 ###
8888
8889 !! test
8890 Interlanguage link
8891 !! wikitext
8892 Blah blah blah
8893 [[zh:Chinese]]
8894 !! html/php
8895 <p>Blah blah blah
8896 </p>
8897 !! html/parsoid
8898 <p>Blah blah blah</p>
8899 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8900 !! end
8901
8902 ## parsoid html2wt will lose the space variations
8903 !! test
8904 Interlanguage link with spacing
8905 !! options
8906 parsoid=wt2html,wt2wt,html2html
8907 !! wikitext
8908 Blah blah blah
8909 [[ zh : Chinese ]]
8910 !! html/php
8911 <p>Blah blah blah
8912 </p>
8913 !! html/parsoid
8914 <p>Blah blah blah</p>
8915 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8916 !! end
8917
8918 !! test
8919 Double interlanguage link
8920 !! wikitext
8921 Blah blah blah
8922 [[es:Spanish]]
8923 [[zh:Chinese]]
8924 !! html/php
8925 <p>Blah blah blah
8926 </p>
8927 !! html/parsoid
8928 <p>Blah blah blah</p>
8929 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8930 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8931 !! end
8932
8933 ## parsoid html2wt will lose the space variations
8934 !! test
8935 Interlanguage link variations
8936 !! options
8937 parsoid=wt2html,wt2wt,html2html
8938 !! wikitext
8939 Blah blah blah
8940 [[ es :Spanish]]
8941 [[ ZH :Chinese]]
8942 [[es:Foo_bar]]
8943 !! html/php
8944 <p>Blah blah blah
8945 </p>
8946 !! html/parsoid
8947 <p>Blah blah blah</p>
8948 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8949 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8950 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8951 !! end
8952
8953 !! test
8954 Escaping of interlanguage links (T129218, T156308)
8955 !! wikitext
8956 Blah blah blah
8957 [[:es:Spanish]]
8958 [[ : zh : Chinese ]]
8959 !! html/php
8960 <p>Blah blah blah
8961 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8962 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8963 </p>
8964 !! html/parsoid
8965 <p>Blah blah blah
8966 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8967 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8968 !! end
8969
8970 !! test
8971 Multiple colons escaping interlanguage links
8972 !! options
8973 parsoid=wt2html
8974 !! wikitext
8975 [[:es:Spanish]]
8976 [[::es:Spanish]]
8977 [[:::es:Spanish]]
8978 !! html/php
8979 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8980 [[::es:Spanish]]
8981 [[:::es:Spanish]]
8982 </p>
8983 !! html/parsoid
8984 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8985 [[::es:Spanish]]
8986 [[:::es:Spanish]]</p>
8987 !! end
8988
8989 ## parsoid html2wt will normalize the space to _
8990 !! test
8991 Space and question mark encoding in interlanguage links (T95473)
8992 !! options
8993 parsoid=wt2html,wt2wt,html2html
8994 !! wikitext
8995 Blah blah blah
8996 [[es:Foo bar?]]
8997 !! html/php
8998 <p>Blah blah blah
8999 </p>
9000 !! html/parsoid
9001 <p>Blah blah blah</p>
9002 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
9003 !! end
9004
9005 !! test
9006 Interlanguage link, with prefix links
9007 !! options
9008 language=ln
9009 !! wikitext
9010 Blah blah blah
9011 [[zh:Chinese]]
9012 !! html/php
9013 <p>Blah blah blah
9014 </p>
9015 !! html/parsoid
9016 <p>Blah blah blah</p>
9017 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9018 !! end
9019
9020 !! test
9021 Double interlanguage link, with prefix links (T10897)
9022 !! options
9023 language=ln
9024 !! wikitext
9025 Blah blah blah
9026 [[es:Spanish]]
9027 [[zh:Chinese]]
9028 !! html/php
9029 <p>Blah blah blah
9030 </p>
9031 !! html/parsoid
9032 <p>Blah blah blah</p>
9033 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9034 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9035 !! end
9036
9037 !! test
9038 "Extra" interlanguage links (T34189 / gerrit 111390)
9039 !! wikitext
9040 Blah blah blah
9041 [[mul:Article]]
9042 !! html/php
9043 <p>Blah blah blah
9044 </p>
9045 !! html/parsoid
9046 <p>Blah blah blah</p>
9047 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
9048 !! end
9049
9050 ## PHP parser tests script needs an update
9051 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9052 !! test
9053 Language links render as inline links if $wgInterwikiMagic=false
9054 !! options
9055 wgInterwikiMagic=false
9056 parsoid=wt2html,wt2wt,html2html
9057 !! wikitext
9058 Blah blah blah
9059 [[zh:Chinese]]
9060 !! html/parsoid
9061 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9062 !! end
9063
9064 ## PHP parser tests script needs an update
9065 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9066 !! test
9067 Language links render as inline links in the Talk namespace
9068 !! options
9069 title=Talk:Foo
9070 parsoid=wt2html,wt2wt,html2html
9071 !! wikitext
9072 Blah blah blah
9073 [[zh:Chinese]]
9074 !! html/parsoid
9075 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9076 !! end
9077
9078 !! test
9079 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
9080 !! options
9081 language=ln
9082 !! wikitext
9083 [[WW&nbsp;II]]
9084 !! html
9085 <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>
9086 </p>
9087 !! end
9088
9089 !! test
9090 Parsoid T55221: Wikilinks should be properly entity-escaped
9091 !! options
9092 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
9093 !! html/parsoid
9094 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9095 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9096 !! wikitext
9097 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
9098
9099 He&amp;nbsp;llo He&amp;nbsp;llo
9100 !! html/php
9101 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
9102 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
9103 </p>
9104 !! end
9105
9106 # html2wt will fail because of title normalization without data-parsoid
9107 !! test
9108 Parsoid: handle constructor well
9109 !! options
9110 parsoid=wt2html,wt2wt
9111 !! wikitext
9112 [[constructor]]
9113
9114 [[constructor:foo]]
9115 !! html/php
9116 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9117 </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>
9118 </p>
9119 !! html/parsoid
9120 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9121
9122 <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>
9123 !! end
9124
9125 !! test
9126 Template parameter named "constructor"
9127 !! wikitext
9128 {{echo| constructor = |hi}}
9129 !! html/parsoid
9130 <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>
9131 !! end
9132
9133 !! article
9134 ko:
9135 !! text
9136 Test.
9137 !! endarticle
9138
9139 # Note that `ko` isn't a known interlanguage prefix
9140 !! test
9141 Parsoid: recognize interlanguage links without a target page
9142 !! options
9143 ill
9144 !! wikitext
9145 [[es:]]
9146
9147 [[ko:]]
9148 !! html/php
9149 es:
9150 !! html/parsoid
9151 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9152
9153 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9154 !! end
9155
9156 # Note that `ko` isn't a known interwiki prefix
9157 !! test
9158 Parsoid: recognize interwiki links without a target page
9159 !! options
9160 parsoid=wt2html,wt2wt,html2html
9161 !! wikitext
9162 [[:es:]]
9163
9164 [[:ko:]]
9165 !! html/php
9166 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9167 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9168 </p>
9169 !! html/parsoid
9170 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9171 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9172 !! end
9173
9174 !! test
9175 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9176 !! wikitext
9177 [[mi:Foo]]
9178 !! html/php
9179 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9180 </p>
9181 !! html/parsoid
9182 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9183 !! end
9184
9185 !! test
9186 Interlanguage link with preceding local interwiki link (T70085)
9187 !! options
9188 parsoid=wt2html,wt2wt,html2html
9189 !! wikitext
9190 Blah blah blah
9191 [[local:es:Spanish]]
9192 !! html/php
9193 <p>Blah blah blah
9194 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9195 </p>
9196 !! html/parsoid
9197 <p>Blah blah blah
9198 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9199 !! end
9200
9201 !! test
9202 Looks like an interlanguage link, but is actually a local interwiki
9203 !! options
9204 parsoid=wt2html,wt2wt,html2html
9205 !! wikitext
9206 Blah blah blah
9207 [[mi:Template:Foo]]
9208 !! html/php
9209 <p>Blah blah blah
9210 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9211 </p>
9212 !! html/parsoid
9213 <p>Blah blah blah
9214 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9215 !! end
9216
9217 ###
9218 ### Redirects, Parsoid-only
9219 ###
9220
9221 !! test
9222 1. Simple redirect to page
9223 !! wikitext
9224 #REDIRECT [[Main Page]]
9225 !! html/parsoid
9226 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9227 !! end
9228
9229 !! test
9230 2. Other redirect variants
9231 !! wikitext
9232 #REDIRECT [[Main_Page]]
9233 !! html/parsoid
9234 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9235 !! end
9236
9237 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9238 # This tests the Parsoid bail-out code.
9239 !! test
9240 3. Other redirect variants
9241 !! options
9242 parsoid=wt2html
9243 !! wikitext
9244 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9245 !! html/parsoid
9246 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9247 !! end
9248
9249 !! test
9250 4. Redirect to a templated destination
9251 !! wikitext
9252 #REDIRECT [[{{echo|Foo}}bar]]
9253 !! html/parsoid
9254 <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"}]]}'/>
9255 !! end
9256
9257 !! test
9258 Empty redirect
9259 !! options
9260 parsoid=wt2html,wt2wt
9261 !! wikitext
9262 #REDIRECT [[]]
9263 !! html/parsoid
9264 <ol>
9265 <li>REDIRECT [[]]</li></ol>
9266 !! end
9267
9268 !! test
9269 Optional colon in #REDIRECT
9270 !! options
9271 # the colon is archaic syntax. we support it for wt2html, but we
9272 # don't care that it roundtrips back to the modern syntax.
9273 parsoid=wt2html,html2html
9274 !! wikitext
9275 #REDIRECT:[[Main Page]]
9276 !! html/parsoid
9277 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9278 !! end
9279
9280 !! test
9281 Whitespace in #REDIRECT with optional colon
9282 !! options
9283 # the colon and gratuitous whitespace is archaic syntax. we support
9284 # it for wt2html, but we don't care that it roundtrips back to the
9285 # modern syntax (without extra whitespace)
9286 parsoid=wt2html,html2html
9287 !! wikitext
9288
9289 #REDIRECT
9290 :
9291 [[Main Page]]
9292 !! html/parsoid
9293 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9294 !! end
9295
9296 !! test
9297 Piped link in #REDIRECT
9298 !! options
9299 # content after piped link is ignored. we support this syntax,
9300 # but don't care that the piped link is lost when we roundtrip this.
9301 parsoid=wt2html
9302 !! wikitext
9303 #REDIRECT [[Main Page|bar]]
9304 !! html/parsoid
9305 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9306 !! end
9307
9308 !! test
9309 Redirect to category (T104502)
9310 !! options
9311 parsoid=wt2html,wt2wt
9312 !! wikitext
9313 #REDIRECT [[Category:Foo]]
9314 !! html/parsoid
9315 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9316 !! end
9317
9318 !! test
9319 Redirect to category with URL encoding (T104502)
9320 !! options
9321 parsoid=wt2html
9322 !! wikitext
9323 #REDIRECT [[Category%3AFoo]]
9324 !! html/parsoid
9325 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9326 !! end
9327
9328 !! test
9329 Redirect to category page
9330 !! wikitext
9331 #REDIRECT [[:Category:Foo]]
9332 !! html/parsoid
9333 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9334 !! end
9335
9336 !! test
9337 Redirect to image page (1)
9338 !! wikitext
9339 #REDIRECT [[File:Wiki.png]]
9340 !! html/parsoid
9341 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9342 !! end
9343
9344 !! test
9345 Redirect to image page (2)
9346 !! wikitext
9347 #REDIRECT [[Image:Wiki.png]]
9348 !! html/parsoid
9349 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9350 !! end
9351
9352 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9353 # Next test confirms this.
9354 !! test
9355 Redirect to language (1) (T104918)
9356 !! options
9357 parsoid=wt2html,wt2wt,html2html
9358 !! wikitext
9359 #REDIRECT [[en:File:Wiki.png]]
9360 !! html/parsoid
9361 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9362 !! end
9363
9364 !! test
9365 Redirect to language (2) (T104918)
9366 !! wikitext
9367 #REDIRECT [[:en:File:Wiki.png]]
9368 !! html/parsoid
9369 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9370 !! end
9371
9372 !! test
9373 Redirect to interwiki (T104918)
9374 !! wikitext
9375 #REDIRECT [[meatball:File:Wiki.png]]
9376 !! html/parsoid
9377 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9378 !! end
9379
9380 !! test
9381 Non-English #REDIRECT
9382 !! options
9383 language=is
9384 !! wikitext
9385 #TILVÍSUN [[Main Page]]
9386 !! html/parsoid
9387 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9388 !! end
9389
9390 !! test
9391 Redirect syntax under text isn't considered a redirect
9392 !! wikitext
9393 some text
9394
9395 #redirect [[Main Page]]
9396 !! html/parsoid
9397 <p>some text</p>
9398 <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>
9399 !! end
9400
9401 !! test
9402 New redirect
9403 !! options
9404 parsoid=html2wt
9405 !! html/parsoid
9406 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9407 !! wikitext
9408 #REDIRECT [[Foo]]
9409 Foo
9410 !! end
9411
9412 !! test
9413 Redirect followed by block on the same line
9414 !! options
9415 parsoid=wt2html
9416 !! wikitext
9417 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9418 !! html/parsoid
9419 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9420 !! end
9421
9422 !! test
9423 Redirect followed by a newline
9424 !! wikitext
9425 #REDIRECT [[Main Page]]
9426 A newline
9427 !! html/parsoid
9428 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9429 <p>A newline</p>
9430 !! end
9431
9432 !! test
9433 Redirect followed by multiple newlines
9434 !! wikitext
9435 #REDIRECT [[Main Page]]
9436
9437
9438 A newline
9439 !! html/parsoid
9440 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9441
9442 <p><br/>
9443 A newline</p>
9444 !! end
9445
9446 !! test
9447 Drop duplicate redirects
9448 !! options
9449 parsoid=html2wt
9450 !! html/parsoid
9451 <link rel="mw:PageProp/redirect" href="./Foo"/>
9452 <link rel="mw:PageProp/redirect" href="./Bar"/>
9453 <link rel="mw:PageProp/redirect" href="./Baz"/>
9454 !! wikitext
9455 #REDIRECT [[Foo]]
9456 !! end
9457
9458 ##
9459 ## XHTML tidiness
9460 ###
9461
9462 !! test
9463 <br> to <br />
9464 !! wikitext
9465 1<br>2<br />3
9466 !! html
9467 <p>1<br />2<br />3
9468 </p>
9469 !! end
9470
9471 !! test
9472 Broken br tag sanitization
9473 !! wikitext
9474 </br>
9475 !! html/php
9476 <p>&lt;/br&gt;
9477 </p>
9478 !! end
9479
9480 # TODO: Fix html2html mode (T53055)!
9481 !! test
9482 Parsoid: Broken br tag recognition
9483 !! options
9484 parsoid=wt2html
9485 !! wikitext
9486 </br>
9487
9488 <br/ >
9489 !! html+tidy
9490 <p><br />
9491 </p><p><br />
9492 </p>
9493 !! end
9494
9495 !! test
9496 Incorrecly removing closing slashes from correctly formed XHTML
9497 !! wikitext
9498 <br style="clear:both;" />
9499 !! html
9500 <p><br style="clear:both;" />
9501 </p>
9502 !! end
9503
9504 !! test
9505 Failing to transform badly formed HTML into correct XHTML
9506 !! wikitext
9507 <br style="clear: left;">
9508 <br style="clear: right;">
9509 <br style="clear: both;">
9510 !! html
9511 <p><br style="clear: left;" />
9512 <br style="clear: right;" />
9513 <br style="clear: both;" />
9514 </p>
9515 !!end
9516
9517 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9518 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9519 !! test
9520 Handling html with a div self-closing tag
9521 !! wikitext
9522 <div title />
9523 <div title/>
9524 <div title/ >
9525 <div title=bar />
9526 <div title=bar/>
9527 <div title=bar/ >
9528 !! html/php
9529 <p>&lt;div title /&gt;
9530 &lt;div title/&gt;
9531 </p>
9532 <div>
9533 <p>&lt;div title=bar /&gt;
9534 &lt;div title=bar/&gt;
9535 </p>
9536 <div title="bar/"></div>
9537 </div>
9538
9539 !! html/parsoid
9540 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9541 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9542 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9543 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9544 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9545 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9546 !! end
9547
9548 !! test
9549 Handling html with a br self-closing tag
9550 !! wikitext
9551 <br title />
9552 <br title/>
9553 <br title/ >
9554 <br title=bar />
9555 <br title=bar/>
9556 <br title=bar/ >
9557 !! html/php
9558 <p><br title="" />
9559 <br title="" />
9560 <br />
9561 <br title="bar" />
9562 <br title="bar" />
9563 <br title="bar/" />
9564 </p>
9565 !! html/parsoid
9566 <p><br title="" />
9567 <br title="" />
9568 <br title="" />
9569 <br title="bar" />
9570 <br title="bar" />
9571 <br title="bar/" />
9572 </p>
9573 !! end
9574
9575 !! test
9576 Horizontal ruler (should it add that extra space?)
9577 !! wikitext
9578 <hr>
9579 <hr >
9580 foo <hr
9581 > bar
9582 !! html+tidy
9583 <hr />
9584 <hr /><p>
9585 foo </p><hr /><p> bar
9586 </p>
9587 !! end
9588
9589 !! test
9590 Horizontal ruler -- 4+ dashes render hr
9591 !! wikitext
9592 ----
9593 !! html
9594 <hr />
9595
9596 !! end
9597
9598 !! test
9599 Horizontal ruler -- eats additional dashes on the same line
9600 !! wikitext
9601 ---------
9602 !! html
9603 <hr />
9604
9605 !! end
9606
9607 !! test
9608 Horizontal ruler -- does not collapse dashes on consecutive lines
9609 !! wikitext
9610 ----
9611 ----
9612 !! html
9613 <hr />
9614 <hr />
9615
9616 !! end
9617
9618 !! test
9619 Horizontal ruler -- <4 dashes render as plain text
9620 !! wikitext
9621 ---
9622 !! html
9623 <p>---
9624 </p>
9625 !! end
9626
9627 !! test
9628 Horizontal ruler -- Supports content following dashes on same line
9629 !! wikitext
9630 ---- Foo
9631 !! html
9632 <hr /> Foo
9633
9634 !! html+tidy
9635 <hr /><p> Foo
9636 </p>
9637 !! end
9638
9639 ###
9640 ### Block-level elements
9641 ###
9642 !! test
9643 Common list
9644 !! wikitext
9645 *Common list
9646 *item 2
9647 *item 3
9648 !! html
9649 <ul><li>Common list</li>
9650 <li>item 2</li>
9651 <li>item 3</li></ul>
9652
9653 !! end
9654
9655 !! test
9656 Numbered list
9657 !! wikitext
9658 #Numbered list
9659 #item 2
9660 #item 3
9661 !! html
9662 <ol><li>Numbered list</li>
9663 <li>item 2</li>
9664 <li>item 3</li></ol>
9665
9666 !! end
9667
9668 # the switch from level 3 to ordered should not introduce a newline between
9669 !! test
9670 Mixed list
9671 !! wikitext
9672 *Mixed list
9673 *#with numbers
9674 **and bullets
9675 *#and numbers
9676 *bullets again
9677 **bullet level 2
9678 ***bullet level 3
9679 ***#Number on level 4
9680 **bullet level 2
9681 **#Number on level 3
9682 **#Number on level 3
9683 *#number level 2
9684 *Level 1
9685 ***Level 3
9686 #**Level 3, but ordered
9687 !! html
9688 <ul><li>Mixed list
9689 <ol><li>with numbers</li></ol>
9690 <ul><li>and bullets</li></ul>
9691 <ol><li>and numbers</li></ol></li>
9692 <li>bullets again
9693 <ul><li>bullet level 2
9694 <ul><li>bullet level 3
9695 <ol><li>Number on level 4</li></ol></li></ul></li>
9696 <li>bullet level 2
9697 <ol><li>Number on level 3</li>
9698 <li>Number on level 3</li></ol></li></ul>
9699 <ol><li>number level 2</li></ol></li>
9700 <li>Level 1
9701 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9702 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9703
9704 !! end
9705
9706 !! test
9707 1. Nested mixed wikitext and html list
9708 !! wikitext
9709 *hi
9710 *<ul><li>ho</li></ul>
9711 *hi
9712 **ho
9713 !! html/php
9714 <ul><li>hi</li>
9715 <li><ul><li>ho</li></ul></li>
9716 <li>hi
9717 <ul><li>ho</li></ul></li></ul>
9718
9719 !! html/parsoid
9720 <ul><li>hi</li>
9721 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9722 <li>hi
9723 <ul><li>ho</li></ul></li></ul>
9724 !! end
9725
9726 !! test
9727 2. Nested mixed wikitext and html list (incompatible)
9728 !! wikitext
9729 ;hi
9730 :{{echo|<li>ho</li>}}
9731 !! html/php
9732 <dl><dt>hi</dt>
9733 <dd><li>ho</li></dd></dl>
9734
9735 !! html/parsoid
9736 <dl><dt>hi</dt>
9737 <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>
9738 !! end
9739
9740 !! test
9741 Nested lists 1
9742 !! wikitext
9743 *foo
9744 **bar
9745 !! html
9746 <ul><li>foo
9747 <ul><li>bar</li></ul></li></ul>
9748
9749 !! end
9750
9751 !! test
9752 Nested lists 2
9753 !! wikitext
9754 **foo
9755 *bar
9756 !! html
9757 <ul><li><ul><li>foo</li></ul></li>
9758 <li>bar</li></ul>
9759
9760 !! end
9761
9762 !! test
9763 Nested lists 3 (first element empty)
9764 !! wikitext
9765 *
9766 **bar
9767 !! html
9768 <ul><li>
9769 <ul><li>bar</li></ul></li></ul>
9770
9771 !! end
9772
9773 !! test
9774 Nested lists 4 (first element empty)
9775 !! wikitext
9776 **
9777 *bar
9778 !! html
9779 <ul><li><ul><li></li></ul></li>
9780 <li>bar</li></ul>
9781
9782 !! end
9783
9784 !! test
9785 Nested lists 5 (both elements empty)
9786 !! wikitext
9787 **
9788 *
9789 !! html
9790 <ul><li><ul><li></li></ul></li>
9791 <li></li></ul>
9792
9793 !! end
9794
9795 !! test
9796 Nested lists 6 (both elements empty)
9797 !! wikitext
9798 *
9799 **
9800 !! html
9801 <ul><li>
9802 <ul><li></li></ul></li></ul>
9803
9804 !! end
9805
9806 !! test
9807 Nested lists 7 (skip initial nesting levels)
9808 !! wikitext
9809 ***foo
9810 !! html
9811 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9812
9813 !! end
9814
9815 !! test
9816 Nested lists 8 (multiple nesting transitions)
9817 !! wikitext
9818 *foo
9819 ***bar
9820 **baz
9821 *boo
9822 !! html
9823 <ul><li>foo
9824 <ul><li><ul><li>bar</li></ul></li>
9825 <li>baz</li></ul></li>
9826 <li>boo</li></ul>
9827
9828 !! end
9829
9830 !! test
9831 Nested lists 9 (extension interaction)
9832 !! options
9833 parsoid
9834 !! wikitext
9835 *<references />
9836 !! html/parsoid
9837 <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>
9838 !! end
9839
9840 !! test
9841 1. Lists with start-of-line-transparent tokens before bullets: Comments
9842 !! wikitext
9843 *foo
9844 *<!--cmt-->bar
9845 <!--cmt-->*baz
9846 !! html
9847 <ul><li>foo</li>
9848 <li>bar</li>
9849 <li>baz</li></ul>
9850
9851 !! end
9852
9853 !! test
9854 Nested lists 10 (list and span siblings: wt2wt regression)
9855 !! wikitext
9856 *a <span>x</span>
9857 **b <span>y</span>
9858 !! html/parsoid
9859 <ul><li>a <span>x</span>
9860 <ul><li>b <span>y</span></li></ul></li></ul>
9861 !! end
9862
9863 !! test
9864 2. Lists with start-of-line-transparent tokens before bullets: Template close
9865 !! wikitext
9866 *foo {{echo|bar
9867 }}*baz
9868 !! html
9869 <ul><li>foo bar</li>
9870 <li>baz</li></ul>
9871
9872 !! end
9873
9874 !! test
9875 List items are not parsed correctly following a <pre> block (T2785)
9876 !! wikitext
9877 *<pre>foo</pre>
9878 *<pre>bar</pre>
9879 *zar
9880 !! html/php
9881 <ul><li><pre>foo</pre></li>
9882 <li><pre>bar</pre></li>
9883 <li>zar</li></ul>
9884
9885 !! html/parsoid
9886 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9887 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9888 <li>zar</li></ul>
9889 !! end
9890
9891 # FIXME: Might benefit from a html/parsoid since this has a template
9892 !! test
9893 List items from template
9894 !! wikitext
9895
9896 {{inner list}}
9897 *item 2
9898
9899 *item 0
9900 {{inner list}}
9901 *item 2
9902
9903 *item 0
9904 *notSOL{{inner list}}
9905 *item 2
9906 !! html
9907 <ul><li>item 1</li>
9908 <li>item 2</li></ul>
9909 <ul><li>item 0</li>
9910 <li>item 1</li>
9911 <li>item 2</li></ul>
9912 <ul><li>item 0</li>
9913 <li>notSOL</li>
9914 <li>item 1</li>
9915 <li>item 2</li></ul>
9916
9917 !! end
9918
9919 !! test
9920 List interrupted by empty line or heading
9921 !! wikitext
9922 *foo
9923
9924 **bar
9925 ==A heading==
9926 *Another list item
9927 !! html
9928 <ul><li>foo</li></ul>
9929 <ul><li><ul><li>bar</li></ul></li></ul>
9930 <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>
9931 <ul><li>Another list item</li></ul>
9932
9933 !!end
9934
9935 !!test
9936 Multiple list tags generated by templates
9937 !! wikitext
9938 {{echo|<li>}}a
9939 {{echo|<li>}}b
9940 {{echo|<li>}}c
9941 !! html
9942 <li>a
9943 <li>b
9944 <li>c</li>
9945 </li>
9946 </li>
9947
9948 !! html+tidy
9949 <li>a
9950 </li><li>b
9951 </li><li>c
9952 </li>
9953 !! html/parsoid
9954 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[0,44,null,null],"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"a\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":1}},"b\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":2}},"c"]}'>a
9955 </li><li about="#mwt1">b
9956 </li><li about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[null,44,null,0]}'>c</li>
9957 !!end
9958
9959 !!test
9960 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9961 !! wikitext
9962 *a
9963 <!--This line will NOT split the list-->
9964 *b
9965 <!--This line will NOT split the list either-->
9966 *c
9967 <!--foo--> <!----> <!--This line NOT split the list either-->
9968 *d
9969 !! html
9970 <ul><li>a</li>
9971 <li>b</li>
9972 <li>c</li>
9973 <li>d</li></ul>
9974
9975 !!end
9976
9977 !!test
9978 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9979 !! wikitext
9980 *a
9981 <!--This line will NOT split the list-->
9982 *b
9983 <!--This line will NOT split the list either-->
9984 *c
9985 <!--foo--> <!----> <!--This line NOT split the list
9986 either-->
9987 *d
9988 !! html
9989 <ul><li>a</li>
9990 <li>b</li>
9991 <li>c</li>
9992 <li>d</li></ul>
9993
9994 !!end
9995
9996 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
9997 # That pass could possibly be removed.
9998 !!test
9999 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
10000 !!options
10001 parsoid=wt2html,wt2wt
10002 !! wikitext
10003 *foo
10004 *<li>li-hack
10005 *{{echo|<li>templated li-hack}}
10006 *<!--foo--><li> unsupported li-hack with preceding comments
10007
10008 <ul>
10009 <li><li>not a li-hack
10010 </li>
10011 </ul>
10012 !! html+tidy
10013 <ul><li>foo</li>
10014 <li class="mw-empty-elt"></li><li>li-hack</li>
10015 <li class="mw-empty-elt"></li><li>templated li-hack</li>
10016 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
10017 <ul>
10018 <li class="mw-empty-elt"></li><li>not a li-hack
10019 </li>
10020 </ul>
10021 !! html/parsoid
10022 <ul><li> foo</li>
10023 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
10024 <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>
10025 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
10026
10027 <ul data-parsoid='{"stx":"html"}'>
10028 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
10029 </li>
10030 </ul>
10031
10032 !!end
10033
10034 !! test
10035 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
10036 !! options
10037 parsoid
10038 !! wikitext
10039 #foo
10040 ##bar
10041
10042 *foo
10043 **bar
10044
10045 :foo
10046 ::bar
10047 !! html
10048 <ol>
10049 <li>foo<ol>
10050 <li>bar</li>
10051 </ol></li>
10052 </ol><ul>
10053 <li>foo<ul>
10054 <li>bar</li>
10055 </ul></li>
10056 </ul><dl>
10057 <dd>foo<dl>
10058 <dd>bar</dd>
10059 </dl></dd>
10060 </dl>
10061 !! end
10062
10063 !! test
10064 Parsoid: Test of whitespace serialization with Templated bullets
10065 !! options
10066 parsoid=wt2html
10067 !! wikitext
10068 * {{bullet}}
10069 !! html/parsoid
10070 <ul>
10071 <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>
10072 </ul>
10073 !! end
10074
10075 # ------------------------------------------------------------------------
10076 # The next set of tests are about Parsoid's ability to handle badly nested
10077 # tags (parse, minimize scope of fixup, and roundtrip back)
10078 # ------------------------------------------------------------------------
10079
10080 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
10081 # Parsoid's list handling is more aware of block structure.
10082 !! test
10083 Unbalanced closing block tags break a list
10084 !! wikitext
10085 <div>
10086 *a</div><div>
10087 *b</div>
10088 !! html+tidy
10089 <div>
10090 <ul><li>a</li></ul></div><div>
10091 <li>b</li></div>
10092 !! html/parsoid
10093 <div><ul>
10094 <li>a</li>
10095 </ul></div>
10096 <div><ul>
10097 <li>b</li>
10098 </ul></div>
10099 !! end
10100
10101 !! test
10102 Unbalanced closing non-block tags don't break a list
10103 !! wikitext
10104 <span>
10105 *a</span><span>
10106 *b</span>
10107 !! html/php+tidy
10108 <p><span>
10109 </span></p>
10110 <ul><li>a<span></span></li>
10111 <li>b</li></ul>
10112 !! html/parsoid
10113 <span>
10114 <ul>
10115 <li>a<span></span></li>
10116 <li>b</li>
10117 </ul>
10118 </span>
10119 !! end
10120
10121 # Parsoid does some post-dom-building cleanup
10122 # which is why its output differs from Remex.
10123 !! test
10124 Unclosed formatting tags that straddle lists are closed and reopened
10125 !! options
10126 parsoid=wt2html,wt2wt,html2html
10127 !! wikitext
10128 #<s> a
10129 #b </s>
10130 !! html/php+tidy
10131 <ol><li><s> a</s></li><s>
10132 </s><li><s>b </s></li></ol>
10133 !! html/parsoid
10134 <ol><li><s> a</s></li>
10135 <li><s>b </s></li></ol>
10136 !! end
10137
10138 # Output is ugly because of all the misnested tag fixups.
10139 # Remex is wrapping p-tags around empty elements.
10140 # Parsoid has special-case handling of this pattern of
10141 # wrapping lists in formatting tags.
10142 # FIXME: Should we remove this code from Parsoid? Or add
10143 # special support in Remex? If the latter, maybe just wait
10144 # for Parsoid to become the default parser.
10145 # See T70395.
10146 !!test
10147 1. List embedded in a formatting tag
10148 !! wikitext
10149 <small>
10150 *foo
10151 </small>
10152 !! html/php+tidy
10153 <p><small>
10154 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10155 </p>
10156 !! html/parsoid
10157 <small>
10158 <ul>
10159 <li>foo</li>
10160 </ul>
10161 </small>
10162 !!end
10163
10164 # Output is ugly because of all the misnested tag fixups
10165 # Remex is wrapping p-tags around empty elements.
10166 # Parsoid has code that strips useless p-tags.
10167 !!test
10168 2. List embedded in a formatting tag in a misnested way
10169 !! wikitext
10170 <small>
10171 *a
10172 *b</small>
10173 !! html/php+tidy
10174 <p><small>
10175 </small></p><small></small><ul><small><li>a</li>
10176 </small><li><small>b</small></li></ul>
10177 !! html/parsoid
10178 <small></small>
10179 <ul><small>
10180 <li>a</li>
10181 </small>
10182 <li><small>b</small></li>
10183 </ul>
10184 !!end
10185
10186 ###
10187 ### Magic Words
10188 ###
10189
10190 # Note that the current date is hard-coded as
10191 # 1970-01-01T00:02:03Z (a Thursday)
10192 # when running parser tests. The timezone is also fixed to GMT, so
10193 # local date will be identical to current date.
10194
10195 !! test
10196 Magic Word: {{CURRENTDAY}}
10197 !! wikitext
10198 {{CURRENTDAY}}
10199 !! html
10200 <p>1
10201 </p>
10202 !! end
10203
10204 !! test
10205 Magic Word: {{CURRENTDAY2}}
10206 !! wikitext
10207 {{CURRENTDAY2}}
10208 !! html
10209 <p>01
10210 </p>
10211 !! end
10212
10213 !! test
10214 Magic Word: {{CURRENTDAYNAME}}
10215 !! wikitext
10216 {{CURRENTDAYNAME}}
10217 !! html
10218 <p>Thursday
10219 </p>
10220 !! end
10221
10222 !! test
10223 Magic Word: {{CURRENTDOW}}
10224 !! wikitext
10225 {{CURRENTDOW}}
10226 !! html
10227 <p>4
10228 </p>
10229 !! end
10230
10231 !! test
10232 Magic Word: {{CURRENTMONTH}}
10233 !! wikitext
10234 {{CURRENTMONTH}}
10235 !! html
10236 <p>01
10237 </p>
10238 !! end
10239
10240 !! test
10241 Magic Word: {{CURRENTMONTH1}}
10242 !! wikitext
10243 {{CURRENTMONTH1}}
10244 !! html
10245 <p>1
10246 </p>
10247 !! end
10248
10249 !! test
10250 Magic Word: {{CURRENTMONTHABBREV}}
10251 !! wikitext
10252 {{CURRENTMONTHABBREV}}
10253 !! html
10254 <p>Jan
10255 </p>
10256 !! end
10257
10258 !! test
10259 Magic Word: {{CURRENTMONTHNAME}}
10260 !! wikitext
10261 {{CURRENTMONTHNAME}}
10262 !! html
10263 <p>January
10264 </p>
10265 !! end
10266
10267 !! test
10268 Magic Word: {{CURRENTMONTHNAMEGEN}}
10269 !! wikitext
10270 {{CURRENTMONTHNAMEGEN}}
10271 !! html
10272 <p>January
10273 </p>
10274 !! end
10275
10276 !! test
10277 Magic Word: {{CURRENTTIME}}
10278 !! wikitext
10279 {{CURRENTTIME}}
10280 !! html
10281 <p>00:02
10282 </p>
10283 !! end
10284
10285 !! test
10286 Magic Word: {{CURRENTHOUR}}
10287 !! wikitext
10288 {{CURRENTHOUR}}
10289 !! html
10290 <p>00
10291 </p>
10292 !! end
10293
10294 !! test
10295 Magic Word: {{CURRENTWEEK}} (T6594)
10296 !! wikitext
10297 {{CURRENTWEEK}}
10298 !! html
10299 <p>1
10300 </p>
10301 !! end
10302
10303 !! test
10304 Magic Word: {{CURRENTYEAR}}
10305 !! wikitext
10306 {{CURRENTYEAR}}
10307 !! html
10308 <p>1970
10309 </p>
10310 !! end
10311
10312 !! test
10313 Magic Word: {{CURRENTTIMESTAMP}}
10314 !! wikitext
10315 {{CURRENTTIMESTAMP}}
10316 !! html
10317 <p>19700101000203
10318 </p>
10319 !! end
10320
10321 !! test
10322 Magic Words LOCAL (UTC)
10323 !! wikitext
10324 *{{LOCALMONTH}}
10325 *{{LOCALMONTH1}}
10326 *{{LOCALMONTHNAME}}
10327 *{{LOCALMONTHNAMEGEN}}
10328 *{{LOCALMONTHABBREV}}
10329 *{{LOCALDAY}}
10330 *{{LOCALDAY2}}
10331 *{{LOCALDAYNAME}}
10332 *{{LOCALYEAR}}
10333 *{{LOCALTIME}}
10334 *{{LOCALHOUR}}
10335 *{{LOCALWEEK}}
10336 *{{LOCALDOW}}
10337 *{{LOCALTIMESTAMP}}
10338 !! html
10339 <ul><li>01</li>
10340 <li>1</li>
10341 <li>January</li>
10342 <li>January</li>
10343 <li>Jan</li>
10344 <li>1</li>
10345 <li>01</li>
10346 <li>Thursday</li>
10347 <li>1970</li>
10348 <li>00:02</li>
10349 <li>00</li>
10350 <li>1</li>
10351 <li>4</li>
10352 <li>19700101000203</li></ul>
10353
10354 !! end
10355
10356 !! test
10357 Magic Word: {{FULLPAGENAME}}
10358 !! options
10359 title=[[User:Ævar Arnfjörð Bjarmason]]
10360 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10361 !! wikitext
10362 {{FULLPAGENAME}}
10363 !! html/*
10364 <p>User:Ævar Arnfjörð Bjarmason
10365 </p>
10366 !! end
10367
10368 !! test
10369 Magic Word: {{FULLPAGENAMEE}}
10370 !! options
10371 title=[[User:Ævar Arnfjörð Bjarmason]]
10372 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10373 !! wikitext
10374 {{FULLPAGENAMEE}}
10375 !! html/*
10376 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10377 </p>
10378 !! end
10379
10380 !! test
10381 Magic Word: {{TALKSPACE}}
10382 !! options
10383 title=[[User:Ævar Arnfjörð Bjarmason]]
10384 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10385 !! wikitext
10386 {{TALKSPACE}}
10387 !! html/*
10388 <p>User talk
10389 </p>
10390 !! end
10391
10392 !! test
10393 Magic Word: {{TALKSPACE}}, same namespace
10394 !! options
10395 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10396 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10397 !! wikitext
10398 {{TALKSPACE}}
10399 !! html/*
10400 <p>User talk
10401 </p>
10402 !! end
10403
10404 !! test
10405 Magic Word: {{TALKSPACE}}, main namespace
10406 !! options
10407 title=[[Parser Test]]
10408 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10409 !! wikitext
10410 {{TALKSPACE}}
10411 !! html/*
10412 <p>Talk
10413 </p>
10414 !! end
10415
10416 !! test
10417 Magic Word: {{TALKSPACEE}}
10418 !! options
10419 title=[[User:Ævar Arnfjörð Bjarmason]]
10420 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10421 !! wikitext
10422 {{TALKSPACEE}}
10423 !! html/*
10424 <p>User_talk
10425 </p>
10426 !! end
10427
10428 !! test
10429 Magic Word: {{SUBJECTSPACE}}
10430 !! options
10431 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10432 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10433 !! wikitext
10434 {{SUBJECTSPACE}}
10435 !! html/*
10436 <p>User
10437 </p>
10438 !! end
10439
10440 !! test
10441 Magic Word: {{SUBJECTSPACE}}, same namespace
10442 !! options
10443 title=[[User:Ævar Arnfjörð Bjarmason]]
10444 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10445 !! wikitext
10446 {{SUBJECTSPACE}}
10447 !! html/*
10448 <p>User
10449 </p>
10450 !! end
10451
10452 !! test
10453 Magic Word: {{SUBJECTSPACE}}, main namespace
10454 !! options
10455 title=[[Parser Test]]
10456 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10457 !! wikitext
10458 {{SUBJECTSPACE}}
10459 !! html/*
10460
10461 !! end
10462
10463 !! test
10464 Magic Word: {{SUBJECTSPACEE}}
10465 !! options
10466 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10467 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10468 !! wikitext
10469 {{SUBJECTSPACEE}}
10470 !! html/*
10471 <p>User
10472 </p>
10473 !! end
10474
10475 !! test
10476 Magic Word: {{NAMESPACE}}
10477 !! options
10478 title=[[User:Ævar Arnfjörð Bjarmason]]
10479 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10480 !! wikitext
10481 {{NAMESPACE}}
10482 !! html/*
10483 <p>User
10484 </p>
10485 !! end
10486
10487 !! test
10488 Magic Word: {{NAMESPACEE}}
10489 !! options
10490 title=[[User:Ævar Arnfjörð Bjarmason]]
10491 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10492 !! wikitext
10493 {{NAMESPACEE}}
10494 !! html/*
10495 <p>User
10496 </p>
10497 !! end
10498
10499 !! test
10500 Magic Word: {{NAMESPACENUMBER}}
10501 !! options
10502 title=[[User:Ævar Arnfjörð Bjarmason]]
10503 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10504 !! wikitext
10505 {{NAMESPACENUMBER}}
10506 !! html/*
10507 <p>2
10508 </p>
10509 !! end
10510
10511 !! test
10512 Magic Word: {{SUBPAGENAME}}
10513 !! options
10514 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10515 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10516 !! wikitext
10517 {{SUBPAGENAME}}
10518 !! html/*
10519 <p>sub ö
10520 </p>
10521 !! end
10522
10523 !! test
10524 Magic Word: {{SUBPAGENAMEE}}
10525 !! options
10526 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10527 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10528 !! wikitext
10529 {{SUBPAGENAMEE}}
10530 !! html/*
10531 <p>sub_%C3%B6
10532 </p>
10533 !! end
10534
10535 !! test
10536 Magic Word: {{ROOTPAGENAME}}
10537 !! options
10538 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10539 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10540 !! wikitext
10541 {{ROOTPAGENAME}}
10542 !! html/*
10543 <p>Ævar Arnfjörð Bjarmason
10544 </p>
10545 !! end
10546
10547 !! test
10548 Magic Word: {{ROOTPAGENAMEE}}
10549 !! options
10550 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10551 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10552 !! wikitext
10553 {{ROOTPAGENAMEE}}
10554 !! html/*
10555 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10556 </p>
10557 !! end
10558
10559 !! test
10560 Magic Word: {{BASEPAGENAME}}
10561 !! options
10562 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10563 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10564 !! wikitext
10565 {{BASEPAGENAME}}
10566 !! html/*
10567 <p>Ævar Arnfjörð Bjarmason
10568 </p>
10569 !! end
10570
10571 !! test
10572 Magic Word: {{BASEPAGENAMEE}}
10573 !! options
10574 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10575 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10576 !! wikitext
10577 {{BASEPAGENAMEE}}
10578 !! html/*
10579 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10580 </p>
10581 !! end
10582
10583 !! test
10584 Magic Word: {{TALKPAGENAME}}
10585 !! options
10586 title=[[User:Ævar Arnfjörð Bjarmason]]
10587 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10588 !! wikitext
10589 {{TALKPAGENAME}}
10590 !! html/*
10591 <p>User talk:Ævar Arnfjörð Bjarmason
10592 </p>
10593 !! end
10594
10595 !! test
10596 Magic Word: {{TALKPAGENAMEE}}
10597 !! options
10598 title=[[User:Ævar Arnfjörð Bjarmason]]
10599 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10600 !! wikitext
10601 {{TALKPAGENAMEE}}
10602 !! html/*
10603 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10604 </p>
10605 !! end
10606
10607 !! test
10608 Magic Word: {{SUBJECTPAGENAME}}
10609 !! options
10610 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10611 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10612 !! wikitext
10613 {{SUBJECTPAGENAME}}
10614 !! html/*
10615 <p>User:Ævar Arnfjörð Bjarmason
10616 </p>
10617 !! end
10618
10619 !! test
10620 Magic Word: {{SUBJECTPAGENAMEE}}
10621 !! options
10622 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10623 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10624 !! wikitext
10625 {{SUBJECTPAGENAMEE}}
10626 !! html/*
10627 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10628 </p>
10629 !! end
10630
10631 !! test
10632 Magic Word: {{NUMBEROFFILES}}
10633 !! options
10634 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10635 !! wikitext
10636 {{NUMBEROFFILES}}
10637 !! html/*
10638 <p>7
10639 </p>
10640 !! end
10641
10642 !! test
10643 Magic Word: {{PAGENAME}}
10644 !! options
10645 title=[[User:Ævar Arnfjörð Bjarmason]]
10646 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10647 !! wikitext
10648 {{PAGENAME}}
10649 !! html/*
10650 <p>Ævar Arnfjörð Bjarmason
10651 </p>
10652 !! end
10653
10654 !! test
10655 Magic Word: {{PAGENAME}} with metacharacters
10656 !! options
10657 title=[['foo & bar = baz']]
10658 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10659 !! wikitext
10660 ''{{PAGENAME}}''
10661 !! html+tidy
10662 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10663 </p>
10664 !! end
10665
10666 !! test
10667 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10668 !! options
10669 title=[[*RFC 1234 http://example.com/]]
10670 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10671 !! wikitext
10672 {{PAGENAME}}
10673 !! html+tidy
10674 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10675 </p>
10676 !! end
10677
10678 !! test
10679 Magic Word: {{PAGENAMEE}}
10680 !! options
10681 title=[[User:Ævar Arnfjörð Bjarmason]]
10682 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10683 !! wikitext
10684 {{PAGENAMEE}}
10685 !! html/*
10686 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10687 </p>
10688 !! end
10689
10690 !! test
10691 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10692 !! options
10693 title=[[*RFC 1234 http://example.com/]]
10694 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10695 !! wikitext
10696 {{PAGENAMEE}}
10697 !! html+tidy
10698 <p>&#42;RFC_1234_http&#58;//example.com/
10699 </p>
10700 !! end
10701
10702 !! test
10703 Magic Word: {{REVISIONID}}
10704 !! options
10705 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10706 showflags
10707 !! wikitext
10708 {{REVISIONID}}
10709 !! html/*
10710 <p>1337
10711 </p>
10712 flags=vary-revision-id
10713 !! end
10714
10715 !! test
10716 Magic Word: {{SCRIPTPATH}}
10717 !! options
10718 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10719 !! wikitext
10720 {{SCRIPTPATH}}
10721 !! html/*
10722
10723 !! end
10724
10725 !! test
10726 Magic Word: {{STYLEPATH}}
10727 !! options
10728 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10729 !! wikitext
10730 {{STYLEPATH}}
10731 !! html/*
10732 <p>/skins
10733 </p>
10734 !! end
10735
10736 !! test
10737 Magic Word: {{SERVER}}
10738 !! options
10739 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10740 !! wikitext
10741 {{SERVER}}
10742 !! html/*
10743 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10744 </p>
10745 !! end
10746
10747 !! test
10748 Magic Word: {{SERVERNAME}}
10749 !! options
10750 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10751 !! wikitext
10752 {{SERVERNAME}}
10753 !! html/*
10754 <p>example.org
10755 </p>
10756 !! end
10757
10758 !! test
10759 Magic Word: {{SITENAME}}
10760 !! options
10761 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10762 !! wikitext
10763 {{SITENAME}}
10764 !! html/*
10765 <p>MediaWiki
10766 </p>
10767 !! end
10768
10769 !! test
10770 Magic Word: {{PAGELANGUAGE}}
10771 !! options
10772 language=fr
10773 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10774 !! wikitext
10775 {{PAGELANGUAGE}}
10776 !! html/*
10777 <p>fr
10778 </p>
10779 !! end
10780
10781 !! test
10782 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10783 !! options
10784 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10785 !! wikitext
10786 {{PAGELANGUAGE}}
10787 !! html/*
10788 <p>en
10789 </p>
10790 !! end
10791
10792 !! test
10793 Case-sensitive magic words, when cased differently, should just be template transclusions
10794 !! wikitext
10795 {{CurrentMonth}}
10796 {{currentday}}
10797 {{cURreNTweEK}}
10798 {{currentHour}}
10799 !! html
10800 <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>
10801 <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>
10802 <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>
10803 <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>
10804 </p>
10805 !! end
10806
10807 !! test
10808 Case-insensitive magic words should still work with weird casing.
10809 !! wikitext
10810 {{sErVeRNaMe}}
10811 {{LCFirst:AOEU}}
10812 {{ucFIRST:aoeu}}
10813 {{SERver}}
10814 !! html
10815 <p>example.org
10816 aOEU
10817 Aoeu
10818 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10819 </p>
10820 !! end
10821
10822 # From plwiki:PLOS_ONE
10823 !! test
10824 Parsoid: Page property magic word with magic word contents
10825 !! wikitext
10826 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10827 !! html/parsoid
10828 <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>"}]]}'/>
10829 !! end
10830
10831 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10832 # But, this is a limitation of our representation and is documented in
10833 # TemplateHandler.js in processSpecialMagicWord
10834 !! test
10835 Parsoid: Template-generated DISPLAYTITLE
10836 !! wikitext
10837 {{{{echo|DISPLAYTITLE}}:Foo}}
10838 !! options
10839 showtitle
10840 !! config
10841 wgAllowDisplayTitle=true
10842 wgRestrictDisplayTitle=false
10843 !! html/php
10844 Foo
10845
10846 !! html/parsoid
10847 <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"}]]}'/>
10848 !! end
10849
10850 !! test
10851 Namespace 1 {{ns:1}}
10852 !! wikitext
10853 {{ns:1}}
10854 !! html
10855 <p>Talk
10856 </p>
10857 !! end
10858
10859 !! test
10860 Namespace 1 {{ns:01}}
10861 !! wikitext
10862 {{ns:01}}
10863 !! html
10864 <p>Talk
10865 </p>
10866 !! end
10867
10868 !! test
10869 Namespace 0 {{ns:0}} (T6783)
10870 !! wikitext
10871 {{ns:0}}
10872 !! html
10873
10874 !! end
10875
10876 !! test
10877 Namespace 0 {{ns:00}} (T6783)
10878 !! wikitext
10879 {{ns:00}}
10880 !! html
10881
10882 !! end
10883
10884 !! test
10885 Namespace -1 {{ns:-1}}
10886 !! wikitext
10887 {{ns:-1}}
10888 !! html
10889 <p>Special
10890 </p>
10891 !! end
10892
10893 !! test
10894 Namespace User {{ns:User}}
10895 !! wikitext
10896 {{ns:User}}
10897 !! html
10898 <p>User
10899 </p>
10900 !! end
10901
10902 !! test
10903 Namespace User talk {{ns:User_talk}}
10904 !! wikitext
10905 {{ns:User_talk}}
10906 !! html
10907 <p>User talk
10908 </p>
10909 !! end
10910
10911 !! test
10912 Namespace User talk {{ns:uSeR tAlK}}
10913 !! wikitext
10914 {{ns:uSeR tAlK}}
10915 !! html
10916 <p>User talk
10917 </p>
10918 !! end
10919
10920 !! test
10921 Namespace File {{ns:File}}
10922 !! wikitext
10923 {{ns:File}}
10924 !! html
10925 <p>File
10926 </p>
10927 !! end
10928
10929 !! test
10930 Namespace File {{ns:Image}}
10931 !! wikitext
10932 {{ns:Image}}
10933 !! html
10934 <p>File
10935 </p>
10936 !! end
10937
10938 !! test
10939 Namespace (lang=de) Benutzer {{ns:User}}
10940 !! options
10941 language=de
10942 !! wikitext
10943 {{ns:User}}
10944 !! html
10945 <p>Benutzer
10946 </p>
10947 !! end
10948
10949 !! test
10950 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10951 !! options
10952 language=de
10953 !! wikitext
10954 {{ns:3}}
10955 !! html
10956 <p>Benutzer Diskussion
10957 </p>
10958 !! end
10959
10960 !! test
10961 Urlencode
10962 !! wikitext
10963 {{urlencode:hi world?!}}
10964 {{urlencode:hi world?!|WIKI}}
10965 {{urlencode:hi world?!|PATH}}
10966 {{urlencode:hi world?!|QUERY}}
10967 !! html/php
10968 <p>hi+world%3F%21
10969 hi_world%3F!
10970 hi%20world%3F%21
10971 hi+world%3F%21
10972 </p>
10973 !! end
10974
10975 !! test
10976 Magic Word: prioritize type info over data-parsoid
10977 !! options
10978 parsoid=html2wt
10979 !! html/parsoid
10980 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10981 !! wikitext
10982 __FORCETOC__
10983 !! end
10984
10985 !! test
10986 Magic Word: serialize on separate line (parsoid)
10987 !! options
10988 parsoid=wt2wt,html2wt
10989 !! wikitext
10990 foo
10991 __NOTOC__
10992 bar
10993 !! html/parsoid
10994 foo<meta property="mw:PageProp/notoc"/>bar
10995 !! end
10996
10997 !! test
10998 Magic Word: rt non-english wikis
10999 !! options
11000 parsoid=wt2wt
11001 language=de
11002 !! wikitext
11003 __NOEDITSECTION__
11004 !! html/parsoid
11005 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
11006 !! end
11007
11008 !!test
11009 __proto__ is treated as normal wikitext (T105997)
11010 !!wikitext
11011 __proto__
11012 !!html
11013 <p>__proto__
11014 </p>
11015 !!end
11016
11017 ###
11018 ### Magic links
11019 ###
11020 !! test
11021 Magic links: internal link to RFC (T2479)
11022 !! wikitext
11023 [[RFC 123]]
11024 !! html/php
11025 <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>
11026 </p>
11027 !! html/parsoid
11028 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
11029 !! end
11030
11031 !! test
11032 Magic links: RFC (T2479)
11033 !! wikitext
11034 RFC 822
11035 !! html/php
11036 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11037 </p>
11038 !! html/parsoid
11039 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
11040 !! end
11041
11042 !! test
11043 Magic links: RFC (T67278)
11044 !! wikitext
11045 This is RFC 822 but thisRFC 822 is not RFC 822linked.
11046 !! html/php
11047 <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.
11048 </p>
11049 !! html/parsoid
11050 <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>
11051 !! end
11052
11053 !! test
11054 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
11055 !! wikitext
11056 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
11057 RFC
11058 822
11059 !! html/php
11060 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11061 RFC
11062 822
11063 </p>
11064 !! html/parsoid
11065 <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>
11066 RFC
11067 822</p>
11068 !! end
11069
11070 !! test
11071 Magic links: ISBN (T3937)
11072 !! wikitext
11073 ISBN 0-306-40615-2
11074 !! html/php
11075 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
11076 </p>
11077 !! html/parsoid
11078 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
11079 !! end
11080
11081 !! test
11082 Magic links: ISBN (T67278)
11083 !! wikitext
11084 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11085 !! html/php
11086 <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.
11087 </p>
11088 !! html/parsoid
11089 <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>
11090 !! end
11091
11092 !! test
11093 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
11094 !! wikitext
11095 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
11096 ISBN
11097 9780316098113
11098 ISBN 978
11099 0316098113
11100 !! html/php
11101 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11102 ISBN
11103 9780316098113
11104 ISBN 978
11105 0316098113
11106 </p>
11107 !! html/parsoid
11108 <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>
11109 ISBN
11110 9780316098113
11111 ISBN 978
11112 0316098113</p>
11113 !! end
11114
11115 !! test
11116 Magic links: PMID incorrectly converts space to underscore
11117 !! wikitext
11118 PMID 1234
11119 !! html/php
11120 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11121 </p>
11122 !! html/parsoid
11123 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
11124 !! end
11125
11126 !! test
11127 Magic links: PMID (T67278)
11128 !! wikitext
11129 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11130 !! html/php
11131 <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.
11132 </p>
11133 !! html/parsoid
11134 <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>
11135 !! end
11136
11137 !! test
11138 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11139 !! wikitext
11140 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11141 PMID
11142 1234
11143 !! html/php
11144 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11145 PMID
11146 1234
11147 </p>
11148 !! html/parsoid
11149 <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>
11150 PMID
11151 1234</p>
11152 !! end
11153
11154 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11155 # since these are ExtLinkText, not MagicLinkText
11156 !! test
11157 Magic links: use appropriate serialization for "almost" magic links.
11158 !! wikitext
11159 X[[Special:BookSources/0978739256|foo]]
11160
11161 X[https://tools.ietf.org/html/rfc1234 foo]
11162 !! html/php
11163 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11164 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11165 </p>
11166 !! html/parsoid
11167 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11168 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11169 !! end
11170
11171 !! test
11172 Magic links: All disabled (T47942)
11173 !! options
11174 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11175 !! wikitext
11176 ISBN 0-306-40615-2
11177 PMID 1234
11178 RFC 4321
11179 !! html/php
11180 <p>ISBN 0-306-40615-2
11181 PMID 1234
11182 RFC 4321
11183 </p>
11184 !! end
11185
11186 ###
11187 ### Templates
11188 ####
11189
11190 !! test
11191 Nonexistent template
11192 !! wikitext
11193 {{thistemplatedoesnotexist}}
11194 !! html
11195 <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>
11196 </p>
11197 !! end
11198
11199 !! test
11200 Template with invalid target containing tags
11201 !! wikitext
11202 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11203 !! html
11204 <p>{{a<b>b</b>|foo|a=b|a = b}}
11205 </p>
11206 !! end
11207
11208 !! test
11209 Template with invalid target containing unclosed tag
11210 !! wikitext
11211 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11212 !! html
11213 <p>{{a<b>|foo|a=b|a = b}}</b>
11214 </p>
11215 !! end
11216
11217 !! test
11218 Template with invalid target containing wikilink
11219 !! wikitext
11220 {{[[Main Page]]}}
11221 !! html/php
11222 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11223 </p>
11224 !! html/parsoid
11225 <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>
11226 !! end
11227
11228 !! test
11229 Template with just whitespace in it, T70421
11230 !! wikitext
11231 {{echo|{{ }}}}
11232 !! html/parsoid
11233 <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>
11234 !! end
11235
11236 !! article
11237 Template:test
11238 !! text
11239 This is a test template
11240 !! endarticle
11241
11242 !! test
11243 Simple template
11244 !! wikitext
11245 {{test}}
11246 !! html
11247 <p>This is a test template
11248 </p>
11249 !! end
11250
11251 !! test
11252 Template with explicit namespace
11253 !! wikitext
11254 {{Template:test}}
11255 !! html
11256 <p>This is a test template
11257 </p>
11258 !! end
11259
11260
11261 !! article
11262 Template:paramtest
11263 !! text
11264 This is a test template with parameter {{{param}}}
11265 !! endarticle
11266
11267 !! test
11268 Template parameter
11269 !! wikitext
11270 {{paramtest|param=foo}}
11271 !! html
11272 <p>This is a test template with parameter foo
11273 </p>
11274 !! end
11275
11276 !! article
11277 Template:paramtestnum
11278 !! text
11279 [[{{{1}}}|{{{2}}}]]
11280 !! endarticle
11281
11282 !! test
11283 Template unnamed parameter
11284 !! wikitext
11285 {{paramtestnum|Main Page|the main page}}
11286 !! html
11287 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11288 </p>
11289 !! end
11290
11291 !! article
11292 Template:templatesimple
11293 !! text
11294 (test)
11295 !! endarticle
11296
11297 !! article
11298 Template:templateredirect
11299 !! text
11300 #redirect [[Template:templatesimple]]
11301 !! endarticle
11302
11303 !! article
11304 Template:templateasargtestnum
11305 !! text
11306 {{{{{1}}}}}
11307 !! endarticle
11308
11309 !! article
11310 Template:templateasargtest
11311 !! text
11312 {{template{{{templ}}}}}
11313 !! endarticle
11314
11315 !! article
11316 Template:templateasargtest2
11317 !! text
11318 {{{{{templ}}}}}
11319 !! endarticle
11320
11321 !! test
11322 Template with template name as unnamed argument
11323 !! wikitext
11324 {{templateasargtestnum|templatesimple}}
11325 !! html
11326 <p>(test)
11327 </p>
11328 !! end
11329
11330 !! test
11331 Template with template name as argument
11332 !! wikitext
11333 {{templateasargtest|templ=simple}}
11334 !! html
11335 <p>(test)
11336 </p>
11337 !! end
11338
11339 !! test
11340 Template with template name as argument (2)
11341 !! wikitext
11342 {{templateasargtest2|templ=templatesimple}}
11343 !! html
11344 <p>(test)
11345 </p>
11346 !! end
11347
11348 !! article
11349 Template:templateasargtestdefault
11350 !! text
11351 {{{{{templ|templatesimple}}}}}
11352 !! endarticle
11353
11354 !! article
11355 Template:templa
11356 !! text
11357 '''templ'''
11358 !! endarticle
11359
11360 !! test
11361 Template with default value
11362 !! wikitext
11363 {{templateasargtestdefault}}
11364 !! html
11365 <p>(test)
11366 </p>
11367 !! end
11368
11369 !! test
11370 Template with default value (value set)
11371 !! wikitext
11372 {{templateasargtestdefault|templ=templa}}
11373 !! html
11374 <p><b>templ</b>
11375 </p>
11376 !! end
11377
11378 !! test
11379 Template redirect
11380 !! wikitext
11381 {{templateredirect}}
11382 !! html/php
11383 <p>(test)
11384 </p>
11385 !! html/parsoid
11386 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11387 !! end
11388
11389 !! test
11390 Template with argument in separate line
11391 !! wikitext
11392 {{ templateasargtest |
11393 templ = simple }}
11394 !! html
11395 <p>(test)
11396 </p>
11397 !! end
11398
11399 !! test
11400 Template with complex template as argument
11401 !! wikitext
11402 {{paramtest|
11403 param ={{ templateasargtest |
11404 templ = simple }}}}
11405 !! html
11406 <p>This is a test template with parameter (test)
11407 </p>
11408 !! end
11409
11410 !! test
11411 Templates with templated name
11412 !! wikitext
11413 {{{{echo|echo}}|foo}}
11414 {{{{echo|inner list}} }}
11415 !! html
11416 <p>foo
11417 </p>
11418 <ul><li>item 1</li></ul>
11419
11420 !! html/parsoid
11421 <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>
11422 <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>
11423 !! end
11424
11425 ## Regression test; the output here isn't really that interesting.
11426 !! test
11427 Templates with templated name and top level template args
11428 !! wikitext
11429 {{1{{2{{{3}}}|4=5}}}}
11430 !! html/parsoid
11431 <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>
11432 !! end
11433
11434 # Parsoid markup is deliberate "broken". This is an edge case.
11435 # See long comment in TemplateHandler.js:convertAttribsToString.
11436 !! test
11437 Templates with invalid templated targets
11438 !! wikitext
11439 {{echo
11440 {{echo|foo}}
11441 }}
11442 !! html/php
11443 <p>{{echo
11444 foo
11445 }}
11446 </p>
11447 !! html/parsoid
11448 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11449 foo }}</p>
11450 !! end
11451
11452 !! test
11453 Template with thumb image (with link in description)
11454 !! wikitext
11455 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11456 !! html/php
11457 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>
11458
11459 !! html+tidy
11460 <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>
11461 !! html/parsoid
11462 <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>
11463 !! end
11464
11465 !! article
11466 Template:complextemplate
11467 !! text
11468 {{{1}}} {{paramtest|
11469 param ={{{param}}}}}
11470 !! endarticle
11471
11472 !! test
11473 Template with complex arguments
11474 !! wikitext
11475 {{complextemplate|
11476 param ={{ templateasargtest |
11477 templ = simple }}|[[Template:complextemplate|link]]}}
11478 !! html
11479 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11480 </p>
11481 !! end
11482
11483 !! test
11484 T2553: link with two variables in a piped link
11485 !! wikitext
11486 {|
11487 |[[{{{1}}}|{{{2}}}]]
11488 |}
11489 !! html/php
11490 <table>
11491 <tr>
11492 <td>[[{{{1}}}|{{{2}}}]]
11493 </td></tr></table>
11494
11495 !! html/parsoid
11496 <table>
11497 <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>
11498 </tbody></table>
11499 !! end
11500
11501 # See: T2553
11502 !! test
11503 Abort table cell attribute parsing on wikilink
11504 !! wikitext
11505 {|
11506 |testing [[one|two]] |three||four
11507 |testing one two |three||four
11508 |testing="[[one|two]]" |three||four
11509 |}
11510 !! html/php
11511 <table>
11512 <tr>
11513 <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>
11514 <td>four
11515 </td>
11516 <td>three</td>
11517 <td>four
11518 </td>
11519 <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>
11520 <td>four
11521 </td></tr></table>
11522
11523 !! html/parsoid
11524 <table>
11525 <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>
11526 <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>
11527 <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>
11528 </tbody></table>
11529 !! end
11530
11531 !! test
11532 Don't abort table cell attribute parsing if wikilink is found in template arg
11533 !! wikitext
11534 {|
11535 |Test {{#tag:ref|One two "[[three]]" four}}
11536 |}
11537 !! html/parsoid
11538 <table>
11539 <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>
11540 </tbody></table>
11541 !! end
11542
11543 !! test
11544 Magic variable as template parameter
11545 !! wikitext
11546 {{paramtest|param={{SITENAME}}}}
11547 !! html
11548 <p>This is a test template with parameter MediaWiki
11549 </p>
11550 !! end
11551
11552 !! article
11553 Template:linktest
11554 !! text
11555 [[{{{param}}}|link]]
11556 !! endarticle
11557
11558 !! test
11559 Template parameter as link source
11560 !! wikitext
11561 {{linktest|param=Main Page}}
11562 !! html
11563 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11564 </p>
11565 !! end
11566
11567 !!article
11568 Template:paramtest2
11569 !! text
11570 including another template, {{paramtest|param={{{arg}}}}}
11571 !! endarticle
11572
11573 !! test
11574 Template passing argument to another template
11575 !! wikitext
11576 {{paramtest2|arg='hmm'}}
11577 !! html
11578 <p>including another template, This is a test template with parameter 'hmm'
11579 </p>
11580 !! end
11581
11582 !! article
11583 Template:Linktest2
11584 !! text
11585 Main Page
11586 !! endarticle
11587
11588 !! test
11589 Template as link source
11590 !! wikitext
11591 [[{{linktest2}}]]
11592
11593 [[{{linktest2}}|Main Page]]
11594
11595 [[{{linktest2}}]]Page
11596 !! html
11597 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11598 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11599 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11600 </p>
11601 !! end
11602
11603
11604 !! article
11605 Template:loop1
11606 !! text
11607 {{loop2}}
11608 !! endarticle
11609
11610 !! article
11611 Template:loop2
11612 !! text
11613 {{loop1}}
11614 !! endarticle
11615
11616 !! test
11617 Template infinite loop
11618 !! wikitext
11619 {{loop1}}
11620 !! html
11621 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11622 </p>
11623 !! end
11624
11625 !! test
11626 Template from main namespace
11627 !! wikitext
11628 {{:Main Page}}
11629 !! html
11630 <p>blah blah
11631 </p>
11632 !! end
11633
11634 !! test
11635 Template from non-includable namespace
11636 !! options
11637 wgNonincludableNamespaces=10
11638 !! wikitext
11639 {{echo|uh oh!}}
11640 !! html
11641 <p><a href="/wiki/Template:Echo" title="Template:Echo">Template:Echo</a>
11642 </p>
11643 !! end
11644
11645 !! article
11646 Template:table
11647 !! text
11648 {|
11649 | 1 || 2
11650 |-
11651 | 3 || 4
11652 |}
11653 !! endarticle
11654
11655 !! test
11656 T2529: Template with table, not included at beginning of line
11657 !! wikitext
11658 foo {{table}}
11659 !! html
11660 <p>foo
11661 </p>
11662 <table>
11663 <tr>
11664 <td>1</td>
11665 <td>2
11666 </td></tr>
11667 <tr>
11668 <td>3</td>
11669 <td>4
11670 </td></tr></table>
11671
11672 !! end
11673
11674 !! test
11675 T2523: Template shouldn't eat newline (or add an extra one before table)
11676 !! wikitext
11677 foo
11678 {{table}}
11679 !! html
11680 <p>foo
11681 </p>
11682 <table>
11683 <tr>
11684 <td>1</td>
11685 <td>2
11686 </td></tr>
11687 <tr>
11688 <td>3</td>
11689 <td>4
11690 </td></tr></table>
11691
11692 !! end
11693
11694 !! test
11695 T2041: Template parameters shown as broken links
11696 !! wikitext
11697 {{{parameter}}}
11698 !! html
11699 <p>{{{parameter}}}
11700 </p>
11701 !! end
11702
11703 !! test
11704 Template with targets containing wikilinks
11705 !! options
11706 parsoid=wt2html
11707 !! wikitext
11708 {{[[foo]]}}
11709
11710 {{[[{{echo|foo}}]]}}
11711
11712 {{{{echo|[[foo}}]]}}
11713 !! html/php
11714 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11715 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11716 </p><p>{{[[foo}}]]
11717 </p>
11718 !! html/parsoid
11719 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11720 <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>
11721 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11722 !! end
11723
11724 !! article
11725 Template:''
11726 !! text
11727 bar
11728 !! endarticle
11729
11730 !! test
11731 Templates: Double quotes as template target
11732 !! wikitext
11733 foo {{''}} baz
11734 !! html/php
11735 <p>foo bar baz
11736 </p>
11737 !! html/parsoid
11738 <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
11739 </p>
11740 !! end
11741
11742 ## This test is about making sure Parsoid's data-mw is well formed in the
11743 ## face of multiple templates with intersecting and overlapping ranges. The
11744 ## wikitext itself is wretched.
11745 !! test
11746 Templates with intersecting and overlapping ranges
11747 !! wikitext
11748 {|{{echo|
11749 <p>ha</p>}}
11750 {|{{echo|
11751 <p>ho</p>}}
11752 {{echo|{{!}}hi}}
11753 |}
11754 !! html/php+tidy
11755 <p>ha</p><table>
11756
11757 </table><p>ho</p><table>
11758
11759 <tbody><tr>
11760 <td>hi
11761 </td></tr></tbody></table>
11762 !! html/parsoid
11763 <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":""}]]}'>
11764
11765 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11766
11767 <tbody><tr><td>hi</td></tr>
11768 </tbody></table>
11769 !! end
11770
11771 !! article
11772 Template:MSGNW test
11773 !! text
11774 ''None'' of '''this''' should be
11775 * interpreted
11776 but rather passed unmodified
11777 {{test}}
11778 <gallery>
11779 File:Foobar.jpg
11780 </gallery>
11781 <!-- comment -->
11782 !! endarticle
11783
11784 # hmm, fix this or just deprecate msgnw and document its behavior?
11785 !! test
11786 msgnw keyword
11787 !! wikitext
11788 {{msgnw:MSGNW test}}
11789 !! html/php
11790 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11791 &#42; interpreted
11792 &#32;but rather passed unmodified
11793 &#123;&#123;test&#125;&#125;
11794 &#60;gallery&#62;
11795 File:Foobar.jpg
11796 &#60;/gallery&#62;
11797 &#60;!-- comment --&#62;
11798 </p>
11799 !! end
11800
11801 !! test
11802 int keyword
11803 !! wikitext
11804 {{int:youhavenewmessages|lots of money|not!}}
11805 !! html
11806 <p>You have lots of money (not!).
11807 </p>
11808 !! end
11809
11810 !! test
11811 int keyword - non-existing message
11812 !! wikitext
11813 {{int:var}}
11814 !! html
11815 <p>⧼var⧽
11816 </p>
11817 !! end
11818
11819 !! article
11820 Template:Includes
11821 !! text
11822 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11823 !! endarticle
11824
11825 !! test
11826 <includeonly> and <noinclude> being included
11827 !! wikitext
11828 {{Includes}}
11829 !! html
11830 <p>Foobar
11831 </p>
11832 !! end
11833
11834 !! article
11835 Template:Includes2
11836 !! text
11837 <onlyinclude>Foo</onlyinclude>bar
11838 !! endarticle
11839
11840 !! test
11841 <onlyinclude> being included
11842 !! wikitext
11843 {{Includes2}}
11844 !! html
11845 <p>Foo
11846 </p>
11847 !! end
11848
11849
11850 !! article
11851 Template:Includes3
11852 !! text
11853 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11854 !! endarticle
11855
11856 !! test
11857 <onlyinclude> and <includeonly> being included
11858 !! wikitext
11859 {{Includes3}}
11860 !! html
11861 <p>Foo
11862 </p>
11863 !! end
11864
11865 !! test
11866 <includeonly> and <noinclude> on a page
11867 !! wikitext
11868 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11869 !! html
11870 <p>Foozar
11871 </p>
11872 !! end
11873
11874 !! test
11875 Un-closed <noinclude>
11876 !! wikitext
11877 <noinclude>
11878 !! html
11879 !! end
11880
11881 !! test
11882 <onlyinclude> on a page
11883 !! wikitext
11884 <onlyinclude>Foo</onlyinclude>bar
11885 !! html
11886 <p>Foobar
11887 </p>
11888 !! end
11889
11890 !! test
11891 Un-closed <onlyinclude>
11892 !! wikitext
11893 <onlyinclude>
11894 !! html
11895 !! end
11896
11897 !!test
11898 Self-closed noinclude, includeonly, onlyinclude tags
11899 !! wikitext
11900 <noinclude />
11901 <includeonly />
11902 <onlyinclude />
11903 !! html
11904 <p><br />
11905 </p>
11906 !!end
11907
11908 !!test
11909 Unbalanced includeonly and noinclude tags
11910 !! wikitext
11911 {|
11912 |a</noinclude>
11913 |b</noinclude></noinclude>
11914 |c</noinclude></includeonly>
11915 |d</includeonly></includeonly>
11916 |}
11917 !! html
11918 <table>
11919 <tr>
11920 <td>a
11921 </td>
11922 <td>b
11923 </td>
11924 <td>c&lt;/includeonly&gt;
11925 </td>
11926 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11927 </td></tr></table>
11928
11929 !!end
11930
11931 !! article
11932 Template:Includeonly section
11933 !! text
11934 <includeonly>
11935 ==Includeonly section==
11936 </includeonly>
11937 ==Section T-1==
11938 !!endarticle
11939
11940 !! test
11941 T8563: Edit link generation for section shown by <includeonly>
11942 !! wikitext
11943 {{includeonly section}}
11944 !! html
11945 <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>
11946 <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>
11947
11948 !! end
11949
11950 # Uses same input as the contents of [[Template:Includeonly section]]
11951 !! test
11952 T8563: Section extraction for section shown by <includeonly>
11953 !! options
11954 section=T-2
11955 !! wikitext
11956 <includeonly>
11957 ==Includeonly section==
11958 </includeonly>
11959 ==Section T-2==
11960 !! html
11961 ==Section T-2==
11962 !! end
11963
11964 !! test
11965 T8563: Edit link generation for section suppressed by <includeonly>
11966 !! wikitext
11967 <includeonly>
11968 ==Includeonly section==
11969 </includeonly>
11970 ==Section 1==
11971 !! html
11972 <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>
11973
11974 !! end
11975
11976 !! test
11977 T8563: Section extraction for section suppressed by <includeonly>
11978 !! options
11979 section=1
11980 !! wikitext
11981 <includeonly>
11982 ==Includeonly section==
11983 </includeonly>
11984 ==Section 1==
11985 !! html
11986 ==Section 1==
11987 !! end
11988
11989 !! test
11990 Un-closed <includeonly>
11991 !! wikitext
11992 <includeonly>
11993 !! html/php
11994 !! html/parsoid
11995 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11996 !! end
11997
11998 ## We used to, but no longer wt2wt this test since the default serializer
11999 ## will normalize the include directives to serialize on their own line.
12000 ## Selser will take care of preserving formatting in scenarios where they
12001 ## intermingled with other wikitext.
12002 !! test
12003 Includes and comments at SOL
12004 !! options
12005 parsoid=wt2html,html2html
12006 !! wikitext
12007 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
12008
12009 <noinclude>
12010 some
12011 </noinclude>*stuff
12012 *here
12013
12014 <includeonly>can have stuff</includeonly>===here===
12015
12016 !! html/php
12017 <h2><span class="mw-headline" id="hu">hu</span></h2>
12018 <p>some
12019 </p>
12020 <ul><li>stuff</li>
12021 <li>here</li></ul>
12022 <h3><span class="mw-headline" id="here">here</span></h3>
12023
12024 !! html/parsoid
12025 <!-- 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>
12026
12027 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12028 <p>some</p>
12029 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
12030 <li>here</li></ul>
12031
12032 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3 id="here">here</h3>
12033
12034 !! end
12035
12036 # TODO: test with DOM fragment reuse!
12037 !! test
12038 Parsoid: DOM fragment reuse
12039 !! options
12040 parsoid=wt2wt,wt2html
12041 !! wikitext
12042 a{{echo|b<table></table>c}}d
12043
12044 a{{echo|b
12045 <table></table>
12046 c}}d
12047
12048 {{echo|a
12049
12050 <table></table>
12051
12052 b}}
12053 !! html
12054 <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>
12055
12056 <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">
12057 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
12058 </span><p about="#mwt2">cd</p>
12059
12060 <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">
12061
12062 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
12063
12064 </span><p about="#mwt3">b</p>
12065 !! end
12066
12067 !! test
12068 Parsoid: Merge double tds (T52603)
12069 !! options
12070 parsoid
12071 !! wikitext
12072 {|
12073 |{{echo|{{!}} foo}}
12074 |}
12075 !! html
12076 <table><tbody>
12077 <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>
12078 </tbody></table>
12079 !! end
12080
12081 !! test
12082 Parsoid: Merge double tds in nested transclusion content (T52603)
12083 !! options
12084 parsoid
12085 !! wikitext
12086 {{echo|<div>}}
12087 {|
12088 |{{echo|{{!}} foo}}
12089 |}
12090 {{echo|</div>}}
12091 !! html
12092 <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}}]}'>
12093 <table><tbody>
12094 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
12095 </tbody></table>
12096 </div>
12097 !! end
12098
12099 ###
12100 ### <includeonly> and <noinclude> in attributes
12101 ###
12102 !!test
12103 0. includeonly around the entire attribute
12104 !! wikitext
12105 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12106 !! html
12107 <p><span id="v2">bar</span>
12108 </p>
12109 !!end
12110
12111 !!test
12112 1. includeonly in html attr key
12113 !! wikitext
12114 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12115 !! html
12116 <p><span id="foo">bar</span>
12117 </p>
12118 !!end
12119
12120 !!test
12121 2. includeonly in html attr value
12122 !! wikitext
12123 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12124 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12125 !! html
12126 <p><span id="v1">bar</span>
12127 <span id="v1">bar</span>
12128 </p>
12129 !!end
12130
12131 !!test
12132 3. includeonly in part of an attr value
12133 !! wikitext
12134 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12135 !! html
12136 <p><span style="color:red;">bar</span>
12137 </p>
12138 !!end
12139
12140 !!test
12141 4. includeonly in table attributes
12142 !! wikitext
12143 {|
12144 |- <noinclude>
12145 |-
12146 |a
12147 </noinclude>
12148 |- <includeonly>
12149 |-
12150 |b
12151 </includeonly>
12152 |}
12153 !! html
12154 <table>
12155
12156
12157 <tr>
12158 <td>a
12159 </td></tr>
12160 </table>
12161
12162 !!end
12163
12164 ###
12165 ### Preprocessor precedence tests
12166 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12167 ###
12168 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12169 !! test
12170 Preprocessor precedence 1: link is rightmost opening
12171 !! options
12172 parsoid=wt2html
12173 !! wikitext
12174 {{[[Foo|bar}}]]
12175
12176 But close-brace is not a valid character in a link title:
12177 {{[[Foo}}|bar]]
12178
12179 However, we can still tell this was handled as a link in the preprocessor:
12180 {{echo|[[Foo}}|bar]]|bat}}
12181 !! html/php
12182 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12183 </p><p>But close-brace is not a valid character in a link title:
12184 {{[[Foo}}|bar]]
12185 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12186 [[Foo}}|bar]]
12187 </p>
12188 !! html/parsoid
12189 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12190 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12191 <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>
12192 !! end
12193
12194 !! test
12195 Preprocessor precedence 2: template is rightmost opening
12196 !! options
12197 language=zh
12198 !! wikitext
12199 -{{echo|foo}-}}-
12200 !! html/php
12201 <p>-foo}--
12202 </p>
12203 !! html/parsoid
12204 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12205 !! end
12206
12207 !! test
12208 Preprocessor precedence 3: language converter is rightmost opening
12209 !! options
12210 language=zh
12211 parsoid=wt2html
12212 !! wikitext
12213 {{echo|hi}}
12214
12215 {{-{R|echo|hi}}}-
12216
12217 [[-{R|raw]]}-
12218 !! html/php
12219 <p>hi
12220 </p><p>{{echo|hi}}
12221 </p><p>[[raw]]
12222 </p>
12223 !! html/parsoid
12224 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12225 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12226 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12227 !! end
12228
12229 !! test
12230 Preprocessor precedence 4: left-most angle bracket
12231 !! options
12232 language=zh
12233 !! wikitext
12234 <!--{raw}-->
12235 !! html/php
12236 !! html/parsoid
12237 <!--{raw}-->
12238 !! end
12239
12240 !! article
12241 Template:Precedence5
12242 !! text
12243 {{{{{1}}}}}
12244 !! endarticle
12245
12246 !! test
12247 Preprocessor precedence 5: tplarg takes precedence over template
12248 !! wikitext
12249 {{Precedence5|Bullet}}
12250 !! html/php
12251 <ul><li>Bar</li></ul>
12252
12253 !! html/parsoid
12254 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12255 !! end
12256
12257 !! test
12258 Preprocessor precedence 6: broken link is rightmost opening
12259 !! options
12260 parsoid=wt2html
12261 !! wikitext
12262 {{echo|[[Foo}}
12263
12264 {{echo|[[Foo|bar|bat=baz}}
12265 !! html/php
12266 <p>{{echo|[[Foo}}
12267 </p><p>{{echo|[[Foo|bar|bat=baz}}
12268 </p>
12269 !! html/parsoid
12270 <p>{{echo|[[Foo}}</p>
12271 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12272 !! end
12273
12274 # This next test exposes a difference between PHP and Parsoid:
12275 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12276 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12277 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12278 # outer `[[Foo` extends until the `y]]`
12279 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12280 # intermediate result (after template expansion), and link processing
12281 # happens on this intermediate result, which moves the wikilink
12282 # boundary leftward to `[[Foo|Bar]]`
12283 # 2b) Parsoid works in a single step, so it's going to keep the
12284 # wikilink as extending to the `y]]`
12285 # 3a) Then PHP does linktrail processing which slurps up the trailing
12286 # `xy` inside the link.
12287 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12288 # `z` inside the link.
12289 # This is "correct" behavior. Parsoid's basic worldview is that the
12290 # `]]` inside the template shouldn't be allowed to leak out to affect
12291 # the surrounding wikilink. PHP may match Parsoid (in the future)
12292 # if you use {{#balance}} (T114445).
12293
12294 !! test
12295 Preprocessor precedence 7: broken template is rightmost opening
12296 !! options
12297 parsoid=wt2html
12298 !! wikitext
12299 [[Foo|{{echo|Bar]]
12300
12301 [[Foo|{{echo|Bar]]-x}}-y]]-z
12302
12303 Careful: linktrails can move the end of the wikilink:
12304 [[Foo|{{echo|y']]a}}l]]l
12305 !! html/php
12306 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12307 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12308 </p><p>Careful: linktrails can move the end of the wikilink:
12309 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12310 </p>
12311 !! html/parsoid
12312 <p>[[Foo|{{echo|Bar]]</p>
12313 <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>
12314 <p>Careful: linktrails can move the end of the wikilink:
12315 <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>
12316 !! end
12317
12318 !! test
12319 Preprocessor precedence 8: broken language converter is rightmost opening
12320 !! options
12321 language=zh
12322 !! wikitext
12323 [[Foo-{R|raw]]
12324 !! html
12325 <p>[[Foo-{R|raw]]
12326 </p>
12327 !! end
12328
12329 !! article
12330 Template:Preprocessor_precedence_9
12331 !! text
12332 ;4: {{{{1}}}}
12333 ;5: {{{{{2}}}}}
12334 ;6: {{{{{{3}}}}}}
12335 ;7: {{{{{{{4}}}}}}}
12336 !! endarticle
12337
12338 !! test
12339 Preprocessor precedence 9: groups of braces
12340 !! wikitext
12341 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12342 !! html/php
12343 <dl><dt>4</dt>
12344 <dd>{Four}</dd>
12345 <dt>5</dt>
12346 <dd></dd></dl>
12347 <ul><li>Bar</li></ul>
12348 <dl><dt>6</dt>
12349 <dd>Four</dd>
12350 <dt>7</dt>
12351 <dd>{Bullet}</dd></dl>
12352
12353 !! html/parsoid
12354 <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}}]}'>
12355 <dt>4</dt>
12356 <dd>{Four}</dd>
12357 <dt>5</dt>
12358 <dd></dd>
12359 </dl><ul about="#mwt1">
12360 <li>Bar</li>
12361 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12362 <dt>6</dt>
12363 <dd>Four</dd>
12364 <dt>7</dt>
12365 <dd>{Bullet}</dd>
12366 </dl>
12367 !! end
12368
12369 !! article
12370 Template:Preprocessor_precedence_10
12371 !! text
12372 ;1: -{R|raw}-
12373 ;2: -{{Bullet}}-
12374 ;3: -{{{1}}}-
12375 ;4: -{{{{2}}}}-
12376 ;5: -{{{{{3}}}}}-
12377 ;6: -{{{{{{4}}}}}}-
12378 ;7: -{{{{{{{5}}}}}}}-
12379 !! endarticle
12380
12381 !! test
12382 Preprocessor precedence 10: groups of braces with leading dash
12383 !! options
12384 language=zh
12385 !! wikitext
12386 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12387 !! html/php
12388 <dl><dt>1</dt>
12389 <dd>raw</dd>
12390 <dt>2</dt>
12391 <dd>-</dd></dl>
12392 <ul><li>Bar-</li></ul>
12393 <dl><dt>3</dt>
12394 <dd>-Three-</dd>
12395 <dt>4</dt>
12396 <dd>raw2</dd>
12397 <dt>5</dt>
12398 <dd>-</dd></dl>
12399 <ul><li>Bar-</li></ul>
12400 <dl><dt>6</dt>
12401 <dd>-Three-</dd>
12402 <dt>7</dt>
12403 <dd>raw2</dd></dl>
12404
12405 !! html/parsoid
12406 <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}}]}'>
12407 <dt>1</dt>
12408 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12409 <dt>2</dt>
12410 <dd>-</dd>
12411 </dl><ul about="#mwt1">
12412 <li>Bar-</li>
12413 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12414 <dt>3</dt>
12415 <dd>-Three-</dd>
12416 <dt>4</dt>
12417 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12418 <dt>5</dt>
12419 <dd>-</dd>
12420 </dl><ul about="#mwt1">
12421 <li>Bar-</li>
12422 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12423 <dt>6</dt>
12424 <dd>-Three-</dd>
12425 <dt>7</dt>
12426 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12427 </dl>
12428 !! end
12429
12430 !! test
12431 Preprocessor precedence 11: found during visual diff testing
12432 !! wikitext
12433 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12434
12435 {{echo|-{{echo|-{{echo|x}}}}}}
12436
12437 {{echo|-{{echo|x}}}}
12438 !! html/php
12439 <p><span>-<span>-x</span></span>
12440 </p><p>--x
12441 </p><p>-x
12442 </p>
12443 !! html/parsoid
12444 <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>
12445
12446 <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>
12447
12448 <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>
12449 !! end
12450
12451 !! test
12452 Preprocessor precedence 12: broken language converter closed by brace.
12453 !! options
12454 parsoid=wt2html
12455 !! wikitext
12456 This form breaks the template, which is unfortunate:
12457 *{{echo|foo-{bar}bat}}
12458
12459 But if the broken language converter markup is inside an extension
12460 tag, nothing bad happens:
12461 *<nowiki>foo-{bar}bat</nowiki>
12462 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12463 *<pre>foo-{bar}bat</pre>
12464 *{{echo|<pre>foo-{bar}bat</pre>}}
12465
12466 <tag>foo-{bar}bat</tag>
12467 {{echo|<tag>foo-{bar}bat</tag>}}
12468
12469 !! html/php+tidy
12470 <p>This form breaks the template, which is unfortunate:
12471 </p>
12472 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12473 <p>But if the broken language converter markup is inside an extension
12474 tag, nothing bad happens:
12475 </p>
12476 <ul><li>foo-&#123;bar}bat</li>
12477 <li>foo-&#123;bar}bat</li>
12478 <li><pre>foo-{bar}bat</pre></li>
12479 <li><pre>foo-{bar}bat</pre></li></ul>
12480 <pre>'foo-{bar}bat'
12481 array (
12482 )
12483 </pre>
12484 <pre>'foo-{bar}bat'
12485 array (
12486 )
12487 </pre>
12488 !! html/parsoid
12489 <p>This form breaks the template, which is unfortunate:</p>
12490 <ul>
12491 <li>{{echo|foo-{bar}bat}}</li>
12492 </ul>
12493 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12494 <ul>
12495 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12496 <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>
12497 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12498 <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>
12499 </ul>
12500 <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>
12501 !! end
12502
12503 !! test
12504 Preprocessor precedence 13: broken language converter in external link
12505 !! options
12506 parsoid=wt2html
12507 !! wikitext
12508 *[http://example.com/-{foo Example in URL]
12509 *[http://example.com Example in -{link} description]
12510 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12511 !! html/php+tidy
12512 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12513 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12514 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12515 !! html/parsoid
12516 <ul>
12517 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12518 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12519 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12520 </ul>
12521 !! end
12522
12523 !! test
12524 Preprocessor precedence 14: broken language converter in comment
12525 !! wikitext
12526 *<!--{{foo}}-->...should be ok
12527 *<!---{{foo}}-->...extra dashes
12528 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12529 !! html/php+tidy
12530 <ul><li>...should be ok</li>
12531 <li>...extra dashes</li>
12532 <li>foobat...should be ok</li></ul>
12533 !! html/parsoid
12534 <ul>
12535 <li><!--{{foo}}-->...should be ok</li>
12536 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12537 <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>
12538 </ul>
12539 !! end
12540
12541 !! test
12542 Preprocessor precedence 15: broken brace markup in headings
12543 !! config
12544 wgFragmentMode=[ 'html5', 'legacy' ]
12545 !! options
12546 parsoid=wt2html
12547 !! wikitext
12548 __NOTOC__ __NOEDITSECTION__
12549 ===1 foo[bar 1===
12550 1
12551 ===2 foo[[bar 2===
12552 2
12553 ===3 foo{bar 3===
12554 3
12555 ===4 foo{{bar 4===
12556 4
12557 ===5 foo{{{bar 5===
12558 5
12559 ===6 foo-{bar 6===
12560 6
12561 !! html/php+tidy
12562 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12563 <p>1
12564 </p>
12565 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12566 <p>2
12567 </p>
12568 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12569 <p>3
12570 </p>
12571 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12572 <p>4
12573 </p>
12574 <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>
12575 <p>5
12576 </p>
12577 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12578 <p>6
12579 </p>
12580 !! html/parsoid
12581 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12582 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12583 <p>1</p>
12584 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12585 <p>2</p>
12586 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12587 <p>3</p>
12588 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12589 <p>4</p>
12590 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12591 <p>5</p>
12592 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12593 <p>6</p>
12594 !! end
12595
12596 !! test
12597 Preprocessor precedence 16: matching closing braces to opening braces
12598 !! options
12599 language=zh
12600 parsoid=wt2html
12601 !! wikitext
12602 -{{{echo|foo}}bar}-
12603 !! html/php
12604 <p>foobar
12605 </p>
12606 !! html/parsoid
12607 <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>
12608 !! end
12609
12610 !! test
12611 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12612 !! options
12613 parsoid=wt2html
12614 !! wikitext
12615 {{echo|hi {{}}}}
12616 !! html/php
12617 <p>hi {{}}
12618 </p>
12619 !! html/parsoid
12620 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12621 !! end
12622
12623 !! test
12624 Preprocessor precedence 18: another rightmost wins scenario
12625 !! options
12626 parsoid=wt2html
12627 !! wikitext
12628 {{ -{{{{1|tplarg}}} }} }-
12629 !! html/php
12630 <p>{{ -{tplarg }} }-
12631 </p>
12632 !! html/parsoid
12633 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12634 !! end
12635
12636 !! test
12637 Preprocessor precedence 19: break syntax
12638 !! options
12639 parsoid=wt2html
12640 !! wikitext
12641 -{{
12642 !! html/php
12643 <p>-{{
12644 </p>
12645 !! html/parsoid
12646 <p>-{{</p>
12647 !! end
12648
12649 ###
12650 ### Token Stream Patcher tests
12651 ###
12652 ### These tests won't always pass wt2wt and other modes because
12653 ### on serialization, the table will be output on a new line.
12654 ### For now, we are blacklisting them, and using this to test selser.
12655 ###
12656
12657 !!test
12658 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12659 !!options
12660 parsoid=wt2html,wt2wt
12661 !!wikitext
12662 {{echo|}}{| width = '100%'
12663 |foo
12664 |}
12665 !!html/parsoid
12666 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12667 <tbody><tr><td>foo</td></tr>
12668 </tbody></table>
12669 !!end
12670
12671 ## We used to, but no longer wt2wt this test since the default serializer
12672 ## will normalize the include directives to serialize on their own line.
12673 ## Selser will take care of preserving formatting in scenarios where they
12674 ## intermingled with other wikitext.
12675 !!test
12676 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12677 !!options
12678 parsoid=wt2html
12679 !!wikitext
12680 <includeonly>a</includeonly>{| {{{b}}}
12681 |c
12682 |}
12683 !!html/parsoid
12684 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"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":""}]]}'>
12685 <tbody><tr><td>c</td></tr>
12686 </tbody></table>
12687 !!end
12688
12689 !! test
12690 Table wikitext syntax outside wiki-tables
12691 !! wikitext
12692 a
12693 |+ not a caption
12694 ! not a table heading
12695 |- not a table row
12696 | not a table cell
12697 | class="foo bar" | baz
12698 b
12699 |}
12700 |-
12701 c
12702 !! html
12703 <p>a
12704 |+ not a caption
12705 ! not a table heading
12706 |- not a table row
12707 | not a table cell
12708 | class="foo bar" | baz
12709 b
12710 |}
12711 |-
12712 c
12713 </p>
12714 !! end
12715
12716 ###
12717 ### Testing parsing of templates where a template arg
12718 ### has the same name as the template itself.
12719 ###
12720
12721 !! article
12722 Template:quote
12723 !! text
12724 {{{quote|{{{1}}}}}}
12725 !! endarticle
12726
12727 !!test
12728 Templates: Template Name/Arg clash: 1. Use of positional param
12729 !! wikitext
12730 {{quote|foo}}
12731 !! html
12732 <p>foo
12733 </p>
12734 !!end
12735
12736 !!test
12737 Templates: Template Name/Arg clash: 2. Use of named param
12738 !! wikitext
12739 {{quote|quote=foo}}
12740 !! html
12741 <p>foo
12742 </p>
12743 !!end
12744
12745 !!test
12746 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12747 !! wikitext
12748 {{quote|quote}}
12749 !! html
12750 <p>quote
12751 </p>
12752 !!end
12753
12754 ###
12755 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12756 ###
12757
12758 !!test
12759 Templates: 1. Simple use
12760 !! wikitext
12761 {{echo|Foo}}
12762 !! html
12763 <p>Foo
12764 </p>
12765 !!end
12766
12767 !!test
12768 Templates: 2. Inside a block tag
12769 !! wikitext
12770 <div>{{echo|Foo}}</div>
12771 <blockquote>{{echo|Foo}}</blockquote>
12772 !! html
12773 <div>Foo</div>
12774 <blockquote>Foo</blockquote>
12775
12776 !! html+tidy
12777 <div>Foo</div>
12778 <blockquote><p>Foo</p></blockquote>
12779 !!end
12780
12781 !!test
12782 Templates: P-wrapping: 1a. Templates on consecutive lines
12783 !! wikitext
12784 {{echo|Foo}}
12785 {{echo|bar}}
12786 !! html
12787 <p>Foo
12788 bar
12789 </p>
12790 !!end
12791
12792 !!test
12793 Templates: P-wrapping: 1b. Templates on consecutive lines
12794 !! wikitext
12795 Foo
12796
12797 {{echo|bar}}
12798 {{echo|baz}}
12799 !! html
12800 <p>Foo
12801 </p><p>bar
12802 baz
12803 </p>
12804 !!end
12805
12806 !!test
12807 Templates: P-wrapping: 1c. Templates on consecutive lines
12808 !! wikitext
12809 {{echo|Foo}}
12810 {{echo|bar}} <div>baz</div>
12811 !! html
12812 <p>Foo
12813 </p>
12814 bar <div>baz</div>
12815
12816 !! html+tidy
12817 <p>Foo
12818 </p><p>
12819 bar </p><div>baz</div>
12820 !! end
12821
12822 !!test
12823 Templates: P-wrapping: 1d. Template preceded by comment-only line
12824 !!options
12825 parsoid
12826 !! wikitext
12827 <!-- foo -->
12828 {{echo|Bar}}
12829 !! html
12830 <!-- foo -->
12831
12832 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12833 !!end
12834
12835 !!test
12836 Templates: Inline Text: 1. Multiple template uses
12837 !! wikitext
12838 {{echo|Foo}}bar{{echo|baz}}
12839 !! html
12840 <p>Foobarbaz
12841 </p>
12842 !!end
12843
12844 !!test
12845 Templates: Inline Text: 2. Back-to-back template uses
12846 !! wikitext
12847 {{echo|Foo}}{{echo|bar}}
12848 !! html
12849 <p>Foobar
12850 </p>
12851 !!end
12852
12853 !!test
12854 Templates: Block Tags: 1. Multiple template uses
12855 !! wikitext
12856 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12857 !! html
12858 <div>Foo</div><div>bar</div><div>baz</div>
12859
12860 !!end
12861
12862 !!test
12863 Templates: Block Tags: 2. Back-to-back template uses
12864 !! wikitext
12865 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12866 !! html
12867 <div>Foo</div><div>bar</div>
12868
12869 !!end
12870
12871 ## This is an edge case relating to paragraph wrapping.
12872 ## Note that Parsoid fails to match Remex because it's using the closing tag
12873 ## as a heuristic to determine if it's in a block, rather than SAX based events.
12874 ## And Parsoid drops empty elements in templates.
12875 !! test
12876 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12877 !! wikitext
12878 {{echo|a
12879 b</p>}}
12880 !! html/php+tidy
12881 <p>a
12882 </p><p>
12883 b</p><p class="mw-empty-elt"></p>
12884 !! html/parsoid
12885 <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">
12886 </span><span about="#mwt1">b</span>
12887 !! end
12888
12889 !!test
12890 Templates: Links: 1. Simple example
12891 !! wikitext
12892 {{echo|[[Foo|bar]]}}
12893 !! html
12894 <p><a href="/wiki/Foo" title="Foo">bar</a>
12895 </p>
12896 !!end
12897
12898 !!test
12899 Templates: Links: 2. Generation of link href
12900 !! wikitext
12901 [[{{echo|Foo}}|bar]]
12902 !! html
12903 <p><a href="/wiki/Foo" title="Foo">bar</a>
12904 </p>
12905 !!end
12906
12907 !!test
12908 Templates: Links: 3. Generation of part of a link href
12909 !! wikitext
12910 [[Fo{{echo|o}}|bar]]
12911
12912 [[Foo{{echo|bar}}]]
12913
12914 [[Foo{{echo|bar}}baz]]
12915
12916 [[Foo{{echo|bar}}|bar]]
12917
12918 [[:Foo{{echo|bar}}]]
12919
12920 [[:Foo{{echo|bar}}|bar]]
12921 !! html
12922 <p><a href="/wiki/Foo" title="Foo">bar</a>
12923 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12924 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12925 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12926 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12927 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12928 </p>
12929 !!end
12930
12931 !!test
12932 Templates: Links: 4. Multiple templates generating link href
12933 !! wikitext
12934 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12935 !! html
12936 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12937 </p>
12938 !!end
12939
12940 !!test
12941 Templates: Links: 5. Generation of link text
12942 !! wikitext
12943 [[Foo|{{echo|bar}}]]
12944 !! html
12945 <p><a href="/wiki/Foo" title="Foo">bar</a>
12946 </p>
12947 !!end
12948
12949 !!test
12950 Templates: Links: 5. Nested templates (only outermost template should be marked)
12951 !! wikitext
12952 {{echo|[[{{echo|Foo}}|bar]]}}
12953 !! html
12954 <p><a href="/wiki/Foo" title="Foo">bar</a>
12955 </p>
12956 !!end
12957
12958 !!test
12959 Templates: HTML Tag: 1. Generation of HTML attr. key
12960 !! wikitext
12961 <div {{echo|style}}="color:red;">foo</div>
12962 !! html
12963 <div style="color:red;">foo</div>
12964
12965 !!end
12966
12967 !!test
12968 Templates: HTML Tag: 2. Generation of HTML attr. value
12969 !! wikitext
12970 <div style={{echo|'color:red;'}}>foo</div>
12971 !! html
12972 <div style="color:red;">foo</div>
12973
12974 !!end
12975
12976 !!test
12977 Templates: HTML Tag: 3. Generation of HTML attr key and value
12978 !! wikitext
12979 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12980 !! html
12981 <div style="color:red;">foo</div>
12982
12983 !!end
12984
12985 !!test
12986 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12987 !! wikitext
12988 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12989 !! html
12990 <div title="This is a long title with just one piece templated">foo</div>
12991
12992 !!end
12993
12994 !!test
12995 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12996 !! wikitext
12997 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12998 !! html
12999 <div title="This is a long title with just one piece templated">foo</div>
13000
13001 !!end
13002
13003 !!test
13004 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
13005 !! wikitext
13006 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
13007 !! html
13008 <div title="This is a long title with just one piece templated">foo</div>
13009
13010 !!end
13011
13012 # SSS FIXME: While it is great we added support for all this,
13013 # do we want to make this part of the spec? Maybe we want to
13014 # deprecate this kind of usage in the future?
13015 !!test
13016 Templates: HTML Tag: 7. Generation of partial attribute key string
13017 !! wikitext
13018 <div st{{echo|yle}}="color:red;">foo</div>
13019 !! html
13020 <div style="color:red;">foo</div>
13021
13022 !!end
13023
13024 !! test
13025 Templates: HTML Tag: 8. Template-generated attribute (k=v)
13026 !! wikitext
13027 <div {{echo|1=id="v1"}}>bar</div>
13028 !! html
13029 <div id="v1">bar</div>
13030
13031 !!end
13032
13033 !! test
13034 Templates: HTML Tag: 9. Multiple template-generated attributes
13035 !! wikitext
13036 <div {{echo|1=id="v1" title="foo"}}>bar</div>
13037 !! html
13038 <div id="v1" title="foo">bar</div>
13039
13040 !!end
13041
13042 !! test
13043 Templates: Support for templates generating attributes and content
13044 !! wikitext
13045 {| {{mixed_attr_content_template}}
13046 |-
13047 |bar
13048 |}
13049 !! html/php
13050 <table style="color:red;" title="T48811">
13051
13052 <tr>
13053 <td>foo
13054 </td></tr>
13055 <tr>
13056 <td>bar
13057 </td></tr></table>
13058
13059 !! html/parsoid
13060 <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|}"]}'>
13061 <tbody><tr>
13062 <td>foo</td></tr>
13063 <tr>
13064 <td>bar</td></tr>
13065 </tbody></table>
13066 !!end
13067
13068 !! article
13069 Template:attribute_from_template
13070 !! text
13071 class="123"
13072 !! endarticle
13073
13074 !! test
13075 Table cell with attribute before expanded attribute
13076 !! wikitext
13077 {|
13078 | align="center" {{attribute_from_template}} |456
13079 |}
13080 !! html/parsoid
13081 <table>
13082 <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>
13083 </tbody></table>
13084 !! end
13085
13086 !! test
13087 1. Entities and nowikis inside templated attributes should be handled correctly
13088 !! wikitext
13089 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
13090 !! html/php
13091 <div style="background:#f9f9f9;">foo</div>
13092
13093 !! html/parsoid
13094 <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>
13095 !! end
13096
13097 !! test
13098 2. Entities and nowikis inside templated attributes should be handled correctly
13099 !! wikitext
13100 {|
13101 |{{table_attribs_3}}
13102 |}
13103 !! html/php
13104 <table>
13105 <tr>
13106 <td style="background:#f9f9f9;">Foo
13107 </td></tr></table>
13108
13109 !! html/parsoid
13110 <table>
13111 <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>
13112 </tbody></table>
13113 !! end
13114
13115 !! test
13116 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13117 !! wikitext
13118 {{tbl-start}}
13119 |{{table_attribs_3}}
13120 {{tbl-end}}
13121 !! html/php
13122 <table>
13123 <tr>
13124 <td style="background:#f9f9f9;">Foo
13125 </td></tr></table>
13126
13127 !! html/parsoid
13128 <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}}]}'>
13129 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
13130 </tbody></table>
13131 !! end
13132
13133 # T107622
13134 !! test
13135 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13136 !! wikitext
13137 {|
13138 |{{table_attribs_6}} hi
13139 |}
13140 !! html/php
13141 <table>
13142 <tr>
13143 <td style="background: red;">hi
13144 </td></tr></table>
13145
13146 !! html/parsoid
13147 <table>
13148 <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>
13149 </tbody></table>
13150 !! end
13151
13152 !!test
13153 Templates: HTML Tables: 1. Generating start of a HTML table
13154 !! wikitext
13155 {{echo|<table><tr><td>foo</td>}}</tr></table>
13156 !! html
13157 <table><tr><td>foo</td></tr></table>
13158
13159 !!end
13160
13161 !!test
13162 Templates: HTML Tables: 2a. Generating middle of a HTML table
13163 !! wikitext
13164 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13165 !! html
13166 <table><tr><td>foo</td></tr></table>
13167
13168 !!end
13169
13170 !!test
13171 Templates: HTML Tables: 2b. Generating middle of a HTML table
13172 !! wikitext
13173 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13174 !! html
13175 <table><tr><td>foo</td></tr></table>
13176
13177 !!end
13178
13179 !!test
13180 Templates: HTML Tables: 3. Generating end of a HTML table
13181 !! wikitext
13182 <table><tr>{{echo|<td>foo</td></tr></table>}}
13183 !! html
13184 <table><tr><td>foo</td></tr></table>
13185
13186 !!end
13187
13188 !!test
13189 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13190 !! wikitext
13191 {{echo|<table>}}<tr><td>foo</td></tr></table>
13192 !! html
13193 <table><tr><td>foo</td></tr></table>
13194
13195 !!end
13196
13197 !!test
13198 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13199 !! wikitext
13200 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13201 !! html
13202 <table><tr><td>foo</td></tr></table>
13203
13204 !!end
13205
13206 !!test
13207 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13208 !! wikitext
13209 <table><tr>{{echo|<td>}}foo</td></tr></table>
13210 !! html
13211 <table><tr><td>foo</td></tr></table>
13212
13213 !!end
13214
13215 !!test
13216 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13217 !! wikitext
13218 <table><tr><td>foo{{echo|</td>}}</tr></table>
13219 !! html
13220 <table><tr><td>foo</td></tr></table>
13221
13222 !!end
13223
13224 !!test
13225 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13226 !! wikitext
13227 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13228 !! html
13229 <table><tr><td>foo</td></tr></table>
13230
13231 !!end
13232
13233 !!test
13234 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13235 !! wikitext
13236 <table><tr><td>foo</td></tr>{{echo|</table>}}
13237 !! html
13238 <table><tr><td>foo</td></tr></table>
13239
13240 !!end
13241
13242 !!test
13243 Templates: HTML Tables: 5. Proper fostering of categories from inside
13244 !!options
13245 parsoid=wt2html,wt2wt
13246 !! wikitext
13247 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13248 <!--Two categories (T52330)-->
13249 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13250 !! html
13251 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13252 <!--Two categories (T52330)-->
13253 <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>
13254 !!end
13255
13256 !! test
13257 Templates: Wiki Tables: 1a. Fostering of entire template content
13258 !! wikitext
13259 {|
13260 {{echo|a}}
13261 |}
13262 !! html/php
13263 <table>
13264 a
13265 <tr><td></td></tr></table>
13266
13267 !! html/php+tidy
13268
13269 a
13270 <table><tbody><tr><td></td></tr></tbody></table>
13271 !! html/parsoid
13272 <span 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</span><table about="#mwt2">
13273
13274 </table>
13275 !! end
13276
13277 !!test
13278 Templates: Wiki Tables: 1b. Fostering of entire template content
13279 !! wikitext
13280 {|
13281 {{echo|<div>}}
13282 foo
13283 {{echo|</div>}}
13284 |}
13285 !! html
13286 <table>
13287 <div>
13288 <p>foo
13289 </p>
13290 </div>
13291 <tr><td></td></tr></table>
13292
13293 !! html/php+tidy
13294 <div>
13295 <p>foo
13296 </p>
13297 </div><table>
13298
13299 <tbody><tr><td></td></tr></tbody></table>
13300 !! html/parsoid
13301 <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|}"]}'>
13302 <p>foo</p>
13303 </div><table about="#mwt3">
13304
13305 </table>
13306 !! end
13307
13308 !! test
13309 Templates: Wiki Tables: 2. Fostering of partial template content
13310 !! wikitext
13311 {|
13312 {{echo|a
13313 <div>b</div>}}
13314 |}
13315 !! html/php
13316 <table>
13317 a
13318 <div>b</div>
13319 <tr><td></td></tr></table>
13320
13321 !! html/php+tidy
13322
13323 a
13324 <div>b</div><table>
13325 <tbody><tr><td></td></tr></tbody></table>
13326 !! html/parsoid
13327 <span 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</span><div about="#mwt2">b</div><table about="#mwt2">
13328
13329
13330 </table>
13331 !! end
13332
13333 !!test
13334 Templates: Wiki Tables: 3. td-content via multiple templates
13335 !! wikitext
13336 {|
13337 {{echo|{{pipe}}a}}{{echo|b}}
13338 |}
13339 !! html
13340 <table>
13341 <tr>
13342 <td>ab
13343 </td></tr></table>
13344
13345 !!end
13346
13347 !!test
13348 Templates: Wiki Tables: 4. Templated tags, no content
13349 !! wikitext
13350 {{tbl-start}}
13351 {{tbl-end}}
13352 !! html
13353 <table>
13354 <tr><td></td></tr></table>
13355
13356 !!end
13357
13358 !!test
13359 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13360 !! wikitext
13361 {{tbl-start}}
13362 |foo
13363 {{tbl-end}}
13364 !! html
13365 <table>
13366 <tr>
13367 <td>foo
13368 </td></tr></table>
13369
13370 !!end
13371
13372 !!test
13373 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13374 !! wikitext
13375 {{tbl-start}}
13376 {{!}}foo
13377 {{tbl-end}}
13378 !! html
13379 <table>
13380 <tr>
13381 <td>foo
13382 </td></tr></table>
13383
13384 !!end
13385
13386 ## This test case is very specific to Parsoid's internals
13387 ## and is hence only tested for Parsoid's code. Parsoid uses
13388 ## a <meta> marker tag for <ref> tags and they are expanded
13389 ## much later. We are verifying that this <meta> tag usage
13390 ## doesn't prevent foster parenting.
13391 !!test
13392 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13393 !!wikitext
13394 {{PartialTable}}<ref>foo</ref>
13395 |}
13396
13397 <references />
13398 !!html/parsoid
13399 <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup><table about="#mwt2">
13400 <tbody>
13401 </tbody></table>
13402
13403 <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>
13404 !!end
13405
13406 !! test
13407 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13408 !! wikitext
13409 {{echo|
13410 {{{!}}
13411 {{!}}-}}
13412 <onlyinclude>
13413 |foo
13414 </onlyinclude>
13415 {{!}}}
13416 !! html/parsoid
13417 <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{{!}}}"]}'>
13418 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13419 <tbody><tr>
13420
13421 <td>foo
13422 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13423 </tbody></table>
13424 !! end
13425
13426 !!test
13427 Templates: Lists: Multi-line list-items via templates
13428 !! wikitext
13429 *{{echo|a {{nonexistent|
13430 unused}}}}
13431 *{{echo|b {{nonexistent|
13432 unused}}}}
13433 !! html
13434 <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>
13435 <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>
13436
13437 !!end
13438
13439 !!test
13440 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13441 !! wikitext
13442 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13443 !! html
13444 <p><i>ab</i>c<i>d</i>e
13445 </p>
13446 !!end
13447
13448 !!test
13449 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13450 (PHP parser generates misnested html)
13451 !! wikitext
13452 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13453 !! html/parsoid
13454 <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>
13455 !!end
13456
13457 !!test
13458 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13459 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13460 !! options
13461 parsoid=wt2html,wt2wt
13462 !! wikitext
13463 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13464 !! html
13465 <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>
13466 <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>
13467 <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>
13468 !!end
13469
13470 !!test
13471 Templates: Ugly nesting: 4. Divs opened/closed across templates
13472 !! wikitext
13473 a<div>b{{echo|c</div>d}}e
13474 !! html
13475 a<div>bc</div>de
13476
13477 !! html+tidy
13478 <p>a</p><div>bc</div><p>de
13479 </p>
13480 !! end
13481
13482 !! test
13483 Templates: Ugly templates: 3. newline-only template parameter
13484 !! wikitext
13485 foo {{echo|
13486 }}
13487 !! html
13488 <p>foo
13489 </p>
13490 !! end
13491
13492 # This looks like a bug: a single newline triggers p/br for some reason.
13493 !! test
13494 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13495 !! wikitext
13496 {{echo|
13497 }}
13498 !! html
13499 <p><br />
13500 </p>
13501 !! end
13502
13503 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13504 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13505 !! test
13506 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13507 !! wikitext
13508 {{echo|<table>}}
13509 {{echo|<div>foo}}
13510 {{echo|</table>}}
13511 !! html/parsoid
13512 <div about="#mwt1" typeof="mw:Transclusion" 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}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'>foo
13513 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13514 </table>
13515 !! end
13516
13517 # T66017 -- ugly wikitext with fostered content generates two template ranges
13518 # that are "identical" and generate nesting cycles in the algorithm
13519 !! test
13520 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13521 !! wikitext
13522 {{echo|<table><tr><td><table>}}
13523 {{echo|<div>}}
13524 {{echo|</div>}}
13525 !! html/parsoid
13526 <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"}'>
13527 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13528 </table></td></tr></tbody></table>
13529 !! end
13530
13531 !! test
13532 Templates: Parameters substituted at the top-level
13533 !! wikitext
13534 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13535
13536 {{{foo|bar|baz}}}
13537 !! html/php
13538 <p><i>who</i> me? <b>never!</b>
13539 </p><p>bar
13540 </p>
13541 !! html/parsoid
13542 <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>
13543
13544 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13545 !! end
13546
13547 !! test
13548 Templates: Param with empty arg in the final position
13549 !! wikitext
13550 {{{hi|}}}
13551 !! html/parsoid
13552 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13553 !! end
13554
13555 !!test
13556 Parser Functions: 1. Simple example
13557 !! wikitext
13558 {{uc:foo}}
13559 !! html
13560 <p>FOO
13561 </p>
13562 !!end
13563
13564 !!test
13565 Parser Functions: 2. Nested use (only outermost should be marked up)
13566 !! wikitext
13567 {{uc:{{lc:FOO}}}}
13568 !! html
13569 <p>FOO
13570 </p>
13571 !!end
13572
13573 ## Note that the templates inside the references are not wrapped
13574 !! test
13575 Template nested in extension tag in template
13576 !! wikitext
13577 {{echo|hi<ref>[[ho|{{echo|hi}}]]</ref>}}
13578 {{echo|hi<ref>[http://test.com?q={{echo|ho}}]</ref>}}
13579 <references />
13580 !! html/parsoid
13581 <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","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
13582 <span about="#mwt7" 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="#mwt7" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
13583 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><a rel="mw:WikiLink" href="./Ho" title="Ho" data-parsoid='{"stx":"piped","a":{"href":"./Ho"},"sa":{"href":"ho"}}'>hi</a></span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"><a typeof="mw:ExpandedAttrs" about="#mwt11" rel="mw:ExtLink" class="external autonumber" href="http://test.com?q=ho" data-mw='{"attribs":[[{"txt":"href"},{"html":"http://test.com?q=ho"}]]}'></a></span></li></ol>
13584 !! end
13585
13586 ###
13587 ### Pre-save transform tests
13588 ###
13589 !! test
13590 pre-save transform: subst:
13591 !! options
13592 pst
13593 !! wikitext
13594 {{subst:test}}
13595 !! html/php
13596 This is a test template
13597 !! end
13598
13599 !! test
13600 pre-save transform: normal template
13601 !! options
13602 pst
13603 !! wikitext
13604 {{test}}
13605 !! html/php
13606 {{test}}
13607 !! end
13608
13609 !! test
13610 pre-save transform: nonexistent template
13611 !! options
13612 pst
13613 !! wikitext
13614 {{thistemplatedoesnotexist}}
13615 !! html/php
13616 {{thistemplatedoesnotexist}}
13617 !! end
13618
13619 !! test
13620 pre-save transform: subst magic variables
13621 !! options
13622 pst
13623 !! wikitext
13624 {{subst:SITENAME}}
13625 !! html/php
13626 MediaWiki
13627 !! end
13628
13629 # This is T2089, which I fixed. -- wtm
13630 !! test
13631 pre-save transform: subst: templates with parameters
13632 !! options
13633 pst
13634 !! wikitext
13635 {{subst:paramtest|param="something else"}}
13636 !! html/php
13637 This is a test template with parameter "something else"
13638 !! end
13639
13640 !! article
13641 Template:nowikitest
13642 !! text
13643 <nowiki>'''not wiki'''</nowiki>
13644 !! endarticle
13645
13646 !! test
13647 pre-save transform: nowiki in subst (T3188)
13648 !! options
13649 pst
13650 !! wikitext
13651 {{subst:nowikitest}}
13652 !! html/php
13653 <nowiki>'''not wiki'''</nowiki>
13654 !! end
13655
13656 !! article
13657 Template:commenttest
13658 !! text
13659 This template has <!-- a comment --> in it.
13660 !! endarticle
13661
13662 !! test
13663 pre-save transform: comment in subst (T3936)
13664 !! options
13665 pst
13666 !! wikitext
13667 {{subst:commenttest}}
13668 !! html/php
13669 This template has <!-- a comment --> in it.
13670 !! end
13671
13672 !! test
13673 pre-save transform: unclosed tag
13674 !! options
13675 pst
13676 !! wikitext
13677 <nowiki>'''not wiki'''
13678 !! html/php
13679 <nowiki>'''not wiki'''
13680 !! end
13681
13682 !! test
13683 pre-save transform: mixed tag case
13684 !! options
13685 pst
13686 !! wikitext
13687 <NOwiki>'''not wiki'''</noWIKI>
13688 !! html/php
13689 <NOwiki>'''not wiki'''</noWIKI>
13690 !! end
13691
13692 !! test
13693 pre-save transform: unclosed comment in <nowiki>
13694 !! options
13695 pst
13696 !! wikitext
13697 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13698 !! html/php
13699 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13700 !!end
13701
13702 # Leading @ in this template definition works around a limitation
13703 # in parsoid's parserTests which otherwise strips the <span> from the
13704 # result (confusing it for a template wrapper)
13705 !! article
13706 Template:dangerous
13707 !!text
13708 @<span onmouseover="alert('crap')">Oh no</span>
13709 !!endarticle
13710
13711 !!test
13712 (confirming safety of fix for subst T3936)
13713 !! wikitext
13714 {{Template:dangerous}}
13715 !! html
13716 <p>@<span>Oh no</span>
13717 </p>
13718 !! end
13719
13720 !! test
13721 pre-save transform: comment containing gallery (T7024)
13722 !! options
13723 pst
13724 !! wikitext
13725 <!-- <gallery>data</gallery> -->
13726 !! html/php
13727 <!-- <gallery>data</gallery> -->
13728 !!end
13729
13730 !! test
13731 pre-save transform: comment containing extension
13732 !! options
13733 pst
13734 !! wikitext
13735 <!-- <tag>data</tag> -->
13736 !! html/php
13737 <!-- <tag>data</tag> -->
13738 !!end
13739
13740 !! test
13741 pre-save transform: comment containing nowiki
13742 !! options
13743 pst
13744 !! wikitext
13745 <!-- <nowiki>data</nowiki> -->
13746 !! html/php
13747 <!-- <nowiki>data</nowiki> -->
13748 !!end
13749
13750 !! test
13751 pre-save transform: <noinclude> in subst (T5298)
13752 !! options
13753 pst
13754 !! wikitext
13755 {{subst:Includes}}
13756 !! html/php
13757 Foobar
13758 !! end
13759
13760 !! test
13761 pre-save transform: <onlyinclude> in subst (T5298)
13762 !! options
13763 pst
13764 !! wikitext
13765 {{subst:Includes2}}
13766 !! html/php
13767 Foo
13768 !! end
13769
13770 !! article
13771 Template:SubstTest
13772 !!text
13773 {{<includeonly>subst:</includeonly>Includes}}
13774 !! endarticle
13775
13776 !! article
13777 Template:SafeSubstTest
13778 !! text
13779 {{<includeonly>safesubst:</includeonly>Includes}}
13780 !! endarticle
13781
13782 !! test
13783 T24297: safesubst: works during PST
13784 !! options
13785 pst
13786 !! wikitext
13787 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13788 !! html/php
13789 FoobarFoobar
13790 !! end
13791
13792 !! test
13793 T24297: safesubst: works during normal parse
13794 !! wikitext
13795 {{SafeSubstTest}}
13796 !! html
13797 <p>Foobar
13798 </p>
13799 !! end
13800
13801 !! test
13802 subst: does not work during normal parse
13803 !! wikitext
13804 {{SubstTest}}
13805 !! html
13806 <p>{{subst:Includes}}
13807 </p>
13808 !! end
13809
13810 !! test
13811 pre-save transform: context links ("pipe trick")
13812 !! options
13813 pst
13814 !! wikitext
13815 [[Article (context)|]]
13816 [[Bar:Article|]]
13817 [[:Bar:Article|]]
13818 [[Bar:Article (context)|]]
13819 [[:Bar:Article (context)|]]
13820 [[|Article]]
13821 [[|Article (context)]]
13822 [[Bar:X (Y) Z|]]
13823 [[:Bar:X (Y) Z|]]
13824 !! html/php
13825 [[Article (context)|Article]]
13826 [[Bar:Article|Article]]
13827 [[:Bar:Article|Article]]
13828 [[Bar:Article (context)|Article]]
13829 [[:Bar:Article (context)|Article]]
13830 [[Article]]
13831 [[Article (context)]]
13832 [[Bar:X (Y) Z|X (Y) Z]]
13833 [[:Bar:X (Y) Z|X (Y) Z]]
13834 !! end
13835
13836 !! test
13837 pre-save transform: context links ("pipe trick") with interwiki prefix
13838 !! options
13839 pst
13840 !! wikitext
13841 [[interwiki:Article|]]
13842 [[:interwiki:Article|]]
13843 [[interwiki:Bar:Article|]]
13844 [[:interwiki:Bar:Article|]]
13845 !! html/php
13846 [[interwiki:Article|Article]]
13847 [[:interwiki:Article|Article]]
13848 [[interwiki:Bar:Article|Bar:Article]]
13849 [[:interwiki:Bar:Article|Bar:Article]]
13850 !! end
13851
13852 !! test
13853 pre-save transform: context links ("pipe trick") with parens in title
13854 !! options
13855 pst title=[[Somearticle (context)]]
13856 !! wikitext
13857 [[|Article]]
13858 !! html/php
13859 [[Article (context)|Article]]
13860 !! end
13861
13862 !! test
13863 pre-save transform: context links ("pipe trick") with comma in title
13864 !! options
13865 pst title=[[Someplace, Somewhere]]
13866 !! wikitext
13867 [[|Otherplace]]
13868 [[Otherplace, Elsewhere|]]
13869 [[Otherplace, Elsewhere, Anywhere|]]
13870 !! html/php
13871 [[Otherplace, Somewhere|Otherplace]]
13872 [[Otherplace, Elsewhere|Otherplace]]
13873 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13874 !! end
13875
13876 !! test
13877 pre-save transform: context links ("pipe trick") with parens and comma
13878 !! options
13879 pst title=[[Someplace (IGNORED), Somewhere]]
13880 !! wikitext
13881 [[|Otherplace]]
13882 [[Otherplace (place), Elsewhere|]]
13883 !! html/php
13884 [[Otherplace, Somewhere|Otherplace]]
13885 [[Otherplace (place), Elsewhere|Otherplace]]
13886 !! end
13887
13888 !! test
13889 pre-save transform: context links ("pipe trick") with comma and parens
13890 !! options
13891 pst title=[[Who, me? (context)]]
13892 !! wikitext
13893 [[|Yes, you.]]
13894 [[Me, Myself, and I (1937 song)|]]
13895 !! html/php
13896 [[Yes, you. (context)|Yes, you.]]
13897 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13898 !! end
13899
13900 !! test
13901 pre-save transform: context links ("pipe trick") with namespace
13902 !! options
13903 pst title=[[Ns:Somearticle]]
13904 !! wikitext
13905 [[|Article]]
13906 !! html/php
13907 [[Ns:Article|Article]]
13908 !! end
13909
13910 !! test
13911 pre-save transform: context links ("pipe trick") with namespace and parens
13912 !! options
13913 pst title=[[Ns:Somearticle (context)]]
13914 !! wikitext
13915 [[|Article]]
13916 !! html/php
13917 [[Ns:Article (context)|Article]]
13918 !! end
13919
13920 !! test
13921 pre-save transform: context links ("pipe trick") with namespace and comma
13922 !! options
13923 pst title=[[Ns:Somearticle, Context, Whatever]]
13924 !! wikitext
13925 [[|Article]]
13926 !! html/php
13927 [[Ns:Article, Context, Whatever|Article]]
13928 !! end
13929
13930 !! test
13931 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13932 !! options
13933 pst title=[[Ns:Somearticle, Context (context)]]
13934 !! wikitext
13935 [[|Article]]
13936 !! html/php
13937 [[Ns:Article (context)|Article]]
13938 !! end
13939
13940 !! test
13941 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13942 !! options
13943 pst title=[[Ns:Somearticle (IGNORED), Context]]
13944 !! wikitext
13945 [[|Article]]
13946 !! html/php
13947 [[Ns:Article, Context|Article]]
13948 !! end
13949
13950 !! test
13951 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13952 !! options
13953 pst
13954 !! wikitext
13955 [[Article(context)|]]
13956 [[Bar:Article(context)|]]
13957 [[:Bar:Article(context)|]]
13958 [[|Article(context)]]
13959 [[Bar:X(Y)Z|]]
13960 [[:Bar:X(Y)Z|]]
13961 !! html/php
13962 [[Article(context)|Article]]
13963 [[Bar:Article(context)|Article]]
13964 [[:Bar:Article(context)|Article]]
13965 [[Article(context)]]
13966 [[Bar:X(Y)Z|X(Y)Z]]
13967 [[:Bar:X(Y)Z|X(Y)Z]]
13968 !! end
13969
13970 !! test
13971 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13972 !! options
13973 pst
13974 !! wikitext
13975 [[Article (context)|]]
13976 [[Bar:Article (context)|]]
13977 [[:Bar:Article (context)|]]
13978 [[|Article (context)]]
13979 [[Bar:X (Y) Z|]]
13980 [[:Bar:X (Y) Z|]]
13981 !! html/php
13982 [[Article (context)|Article]]
13983 [[Bar:Article (context)|Article]]
13984 [[:Bar:Article (context)|Article]]
13985 [[Article (context)]]
13986 [[Bar:X (Y) Z|X (Y) Z]]
13987 [[:Bar:X (Y) Z|X (Y) Z]]
13988 !! end
13989
13990 !! test
13991 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13992 !! options
13993 pst
13994 !! wikitext
13995 [[Article(context)|]]
13996 [[Bar:Article(context)|]]
13997 [[:Bar:Article(context)|]]
13998 [[|Article(context)]]
13999 [[Bar:X(Y)Z|]]
14000 [[:Bar:X(Y)Z|]]
14001 !! html/php
14002 [[Article(context)|Article]]
14003 [[Bar:Article(context)|Article]]
14004 [[:Bar:Article(context)|Article]]
14005 [[Article(context)]]
14006 [[Bar:X(Y)Z|X(Y)Z]]
14007 [[:Bar:X(Y)Z|X(Y)Z]]
14008 !! end
14009
14010 !! test
14011 pre-save transform: context links ("pipe trick") with commas (T23660)
14012 !! options
14013 pst
14014 !! wikitext
14015 [[Article (context), context|]]
14016 [[Article (context),context|]]
14017 [[Bar:Article (context), context|]]
14018 [[Bar:Article (context),context|]]
14019 [[:Bar:Article (context), context|]]
14020 [[:Bar:Article (context),context|]]
14021 !! html/php
14022 [[Article (context), context|Article]]
14023 [[Article (context),context|Article]]
14024 [[Bar:Article (context), context|Article]]
14025 [[Bar:Article (context),context|Article]]
14026 [[:Bar:Article (context), context|Article]]
14027 [[:Bar:Article (context),context|Article]]
14028 !! end
14029
14030 !! test
14031 Parsoid: backwards pipe trick
14032 !! wikitext
14033 [[|'''bar''']]
14034 !! html/php
14035 <p>[[|<b>bar</b>]]
14036 </p>
14037 !! html/parsoid
14038 <p>[[|<b>bar</b>]]</p>
14039 !! end
14040
14041 !! test
14042 pre-save transform: trim trailing empty lines
14043 !! options
14044 pst
14045 !! wikitext
14046 Empty lines are trimmed
14047
14048
14049
14050
14051 !! html/php
14052 Empty lines are trimmed
14053 !! end
14054
14055 !! test
14056 pre-save transform: Signature expansion
14057 !! options
14058 pst
14059 !! wikitext
14060 * ~~~
14061 * ~~~~
14062 * ~~~~~
14063 * <noinclude>~~~</noinclude>
14064 * <includeonly>~~~</includeonly>
14065 * <onlyinclude>~~~</onlyinclude>
14066 !! html/php
14067 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
14068 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14069 * 00:02, 1 January 1970 (UTC)
14070 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
14071 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
14072 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
14073 !! end
14074
14075
14076 !! test
14077 ParserOutput flags from signature expansion (T84843)
14078 !! options
14079 pst
14080 showflags
14081 !! wikitext
14082 ~~~~
14083 !! html/php
14084 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14085 flags=user-signature
14086 !! end
14087
14088
14089 !! test
14090 pre-save transform: Signature expansion in nowiki tags (T2093)
14091 !! options
14092 pst disabled
14093 !! wikitext
14094 Shall not expand:
14095
14096 <nowiki>~~~~</nowiki>
14097
14098 <includeonly><nowiki>~~~~</nowiki></includeonly>
14099
14100 <noinclude><nowiki>~~~~</nowiki></noinclude>
14101
14102 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14103
14104 {{subst:Foo}} shall be converted to FOO
14105
14106 As well as inside noinclude/onlyinclude
14107 <noinclude>{{subst:Foo}}</noinclude>
14108 <onlyinclude>{{subst:Foo}}</onlyinclude>
14109
14110 But not inside includeonly
14111 <includeonly>{{subst:Foo}}</includeonly>
14112 !! html/php
14113 Shall not expand:
14114
14115 <nowiki>~~~~</nowiki>
14116
14117 <includeonly><nowiki>~~~~</nowiki></includeonly>
14118
14119 <noinclude><nowiki>~~~~</nowiki></noinclude>
14120
14121 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14122
14123 FOO shall be converted to FOO
14124
14125 As well as inside noinclude/onlyinclude
14126 <noinclude>FOO</noinclude>
14127 <onlyinclude>FOO</onlyinclude>
14128
14129 But not inside includeonly
14130 <includeonly>{{subst:Foo}}</includeonly>
14131 !! end
14132
14133 !! test
14134 Parsoid: Recognize nowiki with trailing space in tags
14135 !! options
14136 parsoid=wt2html
14137 !! wikitext
14138 <nowiki ><div>[[foo]]</nowiki >
14139
14140 a<nowiki / >b
14141
14142 c<nowiki />d
14143
14144 e<nowiki/ >f
14145 !! html
14146 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14147 <p>ab</p>
14148 <p>cd</p>
14149 <p>ef</p>
14150 !! end
14151
14152 !! test
14153 Parsoid: Recognize nowiki with odd capitalization
14154 !! options
14155 parsoid=wt2html
14156 !! wikitext
14157 <noWikI ><div>[[foo]]</Nowiki >
14158 !! html
14159 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14160 !! end
14161
14162
14163 !! test
14164 Parsoid: Escape nowiki with trailing space in tags
14165 !! options
14166 parsoid=html2wt
14167 !! html/parsoid
14168 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14169 <p>a&lt;nowiki /&gt;b</p>
14170 <p>c&lt;nowiki/ &gt;d</p>
14171 !! wikitext
14172 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14173
14174 a&lt;nowiki /&gt;b
14175
14176 c&lt;nowiki/ &gt;d
14177 !! end
14178
14179 !! test
14180 Parsoid: Escape weird noWikI capitalizations
14181 !! options
14182 parsoid=html2wt
14183 !! html/parsoid
14184 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14185 !! wikitext
14186 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14187 !! end
14188
14189 ###
14190 ### Message transform tests
14191 ###
14192 !! test
14193 message transform: magic variables
14194 !! options
14195 msg
14196 !! wikitext
14197 {{SITENAME}}
14198 !! html
14199 MediaWiki
14200 !! end
14201
14202 !! test
14203 message transform: should not transform wiki markup
14204 !! options
14205 msg
14206 !! wikitext
14207 ''test''
14208 !! html
14209 ''test''
14210 !! end
14211
14212 !! test
14213 message transform: <noinclude> in transcluded template (T6926)
14214 !! options
14215 msg
14216 !! wikitext
14217 {{Includes}}
14218 !! html
14219 Foobar
14220 !! end
14221
14222 !! test
14223 message transform: <onlyinclude> in transcluded template (T6926)
14224 !! options
14225 msg
14226 !! wikitext
14227 {{Includes2}}
14228 !! html
14229 Foo
14230 !! end
14231
14232 !! test
14233 {{#special:}} page name, known
14234 !! options
14235 msg
14236 !! wikitext
14237 {{#special:Recentchanges}}
14238 !! html
14239 Special:RecentChanges
14240 !! end
14241
14242 !! test
14243 {{#special:}} page name with subpage, known
14244 !! options
14245 msg
14246 !! wikitext
14247 {{#special:Recentchanges/param}}
14248 !! html
14249 Special:RecentChanges/param
14250 !! end
14251
14252 !! test
14253 {{#special:}} page name, unknown
14254 !! options
14255 msg
14256 !! wikitext
14257 {{#special:foobar nonexistent}}
14258 !! html
14259 Special:Foobar nonexistent
14260 !! end
14261
14262 !! test
14263 {{#speciale:}} page name, known
14264 !! options
14265 msg
14266 !! wikitext
14267 {{#speciale:Recentchanges}}
14268 !! html
14269 Special:RecentChanges
14270 !! end
14271
14272 !! test
14273 {{#speciale:}} page name with subpage, known
14274 !! options
14275 msg
14276 !! wikitext
14277 {{#speciale:Recentchanges/param}}
14278 !! html
14279 Special:RecentChanges/param
14280 !! end
14281
14282 !! test
14283 {{#speciale:}} page name, unknown
14284 !! options
14285 msg
14286 !! wikitext
14287 {{#speciale:foobar nonexistent}}
14288 !! html
14289 Special:Foobar_nonexistent
14290 !! end
14291
14292 ###
14293 ### Images
14294 ###
14295 ### For Parsoid-specific tests, see
14296 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14297
14298 !! test
14299 Simple image
14300 !! options
14301 parsoid=wt2html,wt2wt,html2html
14302 !! wikitext
14303 [[Image:foobar.jpg]]
14304 !! html/php
14305 <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>
14306 </p>
14307 !! html/parsoid
14308 <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>
14309 !! end
14310
14311 !! test
14312 Serialize simple image with span wrapper
14313 !! options
14314 parsoid=html2wt
14315 !! html/parsoid
14316 <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>
14317 !! wikitext
14318 [[File:Foobar.jpg]]
14319 !! end
14320
14321 !! test
14322 Simple image (using File: namespace, now canonical)
14323 !! wikitext
14324 [[File:Foobar.jpg]]
14325 !! html/php
14326 <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>
14327 </p>
14328 !! html/parsoid
14329 <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>
14330 !! end
14331
14332 !! test
14333 Right-aligned image
14334 !! wikitext
14335 [[File:Foobar.jpg|right]]
14336 !! html/php
14337 <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>
14338
14339 !! html/parsoid
14340 <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>
14341 !! end
14342
14343 !! test
14344 Image with caption
14345 !! wikitext
14346 [[File:Foobar.jpg|right|Caption text]]
14347 !! html/php
14348 <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>
14349
14350 !! html/parsoid
14351 <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>
14352 !! end
14353
14354 !! test
14355 Image with caption, T55312 #1
14356 !! wikitext
14357 [[File:Foobar.jpg|right|Caption page stuff]]
14358 !! html/php
14359 <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>
14360
14361 !! html/parsoid
14362 <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>
14363 !! end
14364
14365 !! test
14366 Image with caption, T55312 #2
14367 !! wikitext
14368 [[File:Foobar.jpg|right|Caption page=]]
14369 !! html/php
14370 <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>
14371
14372 !! html/parsoid
14373 <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>
14374 !! end
14375
14376 !! test
14377 Image with caption, T55312 #3
14378 !! wikitext
14379 [[File:Foobar.jpg|right|Caption page=stuff]]
14380 !! html/php
14381 <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>
14382
14383 !! html/parsoid
14384 <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>
14385 !! end
14386
14387 !! test
14388 Image caption with pipe entity
14389 !! wikitext
14390 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14391 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14392 !! html/php
14393 <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>
14394 <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>
14395
14396 !! html/parsoid
14397 <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>
14398 <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>
14399 !! end
14400
14401 !! test
14402 Allow empty links in image captions (T62753)
14403 !! options
14404 thumbsize=220
14405 !! wikitext
14406 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14407 [[]]
14408 [[Link2]]
14409 ]]
14410 !! html/php
14411 <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>
14412
14413 !! html/parsoid
14414 <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>
14415 [[]]
14416 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14417 </figcaption></figure>
14418 !! end
14419
14420 !! test
14421 Titles in unlinked images (T23454)
14422 !! wikitext
14423 [[File:Foobar.jpg|link=|stuff]]
14424 !! html/php
14425 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14426 </p>
14427 !! html/parsoid
14428 <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>
14429 !! end
14430
14431 !! test
14432 Link with empty target
14433 !! wikitext
14434 [[]]
14435 !! html
14436 <p>[[]]
14437 </p>
14438 !! end
14439
14440 !! test
14441 Image with link trail
14442 !! wikitext
14443 Linktrails should not work for images: [[File:Foobar.jpg]]s
14444 !! html/php
14445 <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
14446 </p>
14447 !! html/parsoid
14448 <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>
14449 !! end
14450
14451 !! test
14452 Image with empty attribute
14453 !! options
14454 parsoid=wt2html,wt2wt,html2html
14455 !! wikitext
14456 [[File:Foobar.jpg|right||Caption text]]
14457 !! html/php
14458 <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>
14459
14460 !! html/parsoid
14461 <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>
14462 !! end
14463
14464 !! test
14465 1. Block image with individual attributes from templates
14466 !! wikitext
14467 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14468 !! html/php
14469 <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>
14470
14471 !! html/parsoid
14472 <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>
14473 !! end
14474
14475 !! test
14476 2. Block Image with individual attributes from templates
14477 !! wikitext
14478 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14479 !! html/php
14480 <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>
14481
14482 !! html/parsoid
14483 <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>
14484 !! end
14485
14486 !! test
14487 3. Inline image with individual attributes from templates
14488 !! wikitext
14489 [[File:Foobar.jpg|{{echo|50px}}]]
14490 !! html/php
14491 <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>
14492 </p>
14493 !! html/parsoid
14494 <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>
14495 !! end
14496
14497 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14498 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14499 !! test
14500 Image with multiple attributes from the same template
14501 !! wikitext
14502 [[File:Foobar.jpg|{{image_attribs}}]]
14503 !! html/php
14504 <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>
14505
14506 !! html/parsoid
14507 <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>
14508 !! end
14509
14510 !! test
14511 Image with link tails
14512 !! options
14513 thumbsize=220
14514 !! wikitext
14515 123[[File:Foobar.jpg]]456
14516 123[[File:Foobar.jpg|right]]456
14517 123[[File:Foobar.jpg|thumb]]456
14518 !! html/php
14519 <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
14520 </p>
14521 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
14522 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
14523
14524 !! html/php+tidy
14525 <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
14526 </p><p>
14527 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
14528 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
14529 </p>
14530 !! html/parsoid
14531 <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>
14532 <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</p>
14533 <p>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>
14534 !! end
14535
14536 !! test
14537 Image with multiple captions -- only last one is accepted
14538 !! wikitext
14539 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14540 !! html/php
14541 <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>
14542
14543 !! html/parsoid
14544 <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>
14545 !! end
14546
14547 !! test
14548 Image with multiple widths -- use last
14549 !! wikitext
14550 [[File:Foobar.jpg|200px|300px|caption]]
14551 !! html/php
14552 <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>
14553 </p>
14554 !! html/parsoid
14555 <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>
14556 !! end
14557
14558 !! test
14559 Image with multiple alignments -- use first (T50664)
14560 !! options
14561 thumbsize=220
14562 !! wikitext
14563 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14564
14565 [[File:Foobar.jpg|middle|text-top|caption]]
14566 !! html/php
14567 <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>
14568 <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>
14569 </p>
14570 !! html/parsoid
14571 <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>
14572 <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>
14573 !! end
14574
14575 !! test
14576 Image with width attribute at different positions
14577 !! wikitext
14578 [[File:Foobar.jpg|200px|right|Caption]]
14579 [[File:Foobar.jpg|right|200px|Caption]]
14580 [[File:Foobar.jpg|right|Caption|200px]]
14581 !! html/php
14582 <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>
14583 <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>
14584 <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>
14585
14586 !! html/parsoid
14587 <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>
14588 <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>
14589 <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>
14590 !! end
14591
14592 # a sad bit of backward-compatibility
14593 !! test
14594 Image with size specified with pxpx (T15500, T53628)
14595 !! options
14596 parsoid=wt2html,wt2wt,html2html
14597 !! wikitext
14598 [[File:Foobar.jpg|20pxpx]]
14599 [[File:Foobar.jpg|200x20pxpx]]
14600 !! html/php
14601 <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>
14602 <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>
14603 </p>
14604 !! html/parsoid
14605 <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>
14606 !! end
14607
14608 !! test
14609 Image with link parameter, wiki target
14610 !! wikitext
14611 [[File:Foobar.jpg|link=Main Page]]
14612 !! html/php
14613 <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>
14614 </p>
14615 !! html/parsoid
14616 <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>
14617 !! end
14618
14619 # parsoid T51293 (part 1)
14620 !! test
14621 Image with link parameter, URL target
14622 !! wikitext
14623 [[File:Foobar.jpg|link=http://example.com/]]
14624 !! html/php
14625 <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>
14626 </p>
14627 !! html/parsoid
14628 <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>
14629 !! end
14630
14631 # parsoid T51293 (part 2)
14632 !! test
14633 Image with link parameter, protocol-less URL target
14634 !! wikitext
14635 [[File:Foobar.jpg|link=//example.com/]]
14636 !! html/php
14637 <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>
14638 </p>
14639 !! html/parsoid
14640 <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>
14641 !! end
14642
14643 !! test
14644 Escaping non-block captions (T107435)
14645 !! options
14646 parsoid={
14647 "modes": ["wt2wt"],
14648 "changes": [
14649 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14650 ]
14651 }
14652 !! wikitext
14653 [[Image:Foobar.jpg|caption]]
14654 !! wikitext/edited
14655 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14656 !! end
14657
14658 # wgExternalLinkTarget not supported by Parsoid
14659 !! test
14660 Image with link parameter, wgExternalLinkTarget
14661 !! wikitext
14662 [[Image:foobar.jpg|link=http://example.com/]]
14663 !! config
14664 wgExternalLinkTarget='foobar'
14665 !! html/php
14666 <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>
14667 </p>
14668 !! end
14669
14670 !! test
14671 Image with link parameter, wgNoFollowLinks set to false
14672 !! wikitext
14673 [[Image:foobar.jpg|link=http://example.com/]]
14674 !! config
14675 wgNoFollowLinks=false
14676 !! html/php
14677 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14678 </p>
14679 !! end
14680
14681 !! test
14682 Image with link parameter, wgNoFollowDomainExceptions
14683 !! wikitext
14684 [[Image:foobar.jpg|link=http://example.com/]]
14685 !! config
14686 wgNoFollowDomainExceptions='example.com'
14687 !! html/php
14688 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14689 </p>
14690 !! end
14691
14692 # wgExternalLinkTarget not supported by Parsoid
14693 !! test
14694 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14695 !! wikitext
14696 [[Image:foobar.jpg|link=http://example.com/|Title]]
14697 !! config
14698 wgExternalLinkTarget='foobar'
14699 !! html/php
14700 <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>
14701 </p>
14702 !! end
14703
14704 !! test
14705 Image with empty link parameter
14706 !! wikitext
14707 [[File:Foobar.jpg|link=]]
14708 !! html/php
14709 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14710 </p>
14711 !! html/parsoid
14712 <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>
14713 !! end
14714
14715 !! test
14716 Image with link parameter (wiki target) and unnamed parameter
14717 !! wikitext
14718 [[File:Foobar.jpg|link=Main_Page|Title]]
14719 !! html/php
14720 <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>
14721 </p>
14722 !! html/parsoid
14723 <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>
14724 !! end
14725
14726 !! test
14727 Image with link parameter (URL target) and unnamed parameter
14728 !! wikitext
14729 [[File:Foobar.jpg|link=http://example.com/|Title]]
14730 !! html/php
14731 <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>
14732 </p>
14733 !! html/parsoid
14734 <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>
14735 !! end
14736
14737 !! test
14738 Thumbnail image with link parameter
14739 !! options
14740 thumbsize=220
14741 parsoid=wt2html,wt2wt,html2html
14742 !! wikitext
14743 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14744 !! html/php
14745 <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>
14746
14747 !! html/parsoid
14748 <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>
14749 !! end
14750
14751 !! test
14752 Manually-specified thumbnail image
14753 !! options
14754 thumbsize=220
14755 !! wikitext
14756 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14757 !! html/php
14758 <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>
14759
14760 !! html/parsoid
14761 <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>
14762 !! end
14763
14764 !! test
14765 Manually-specified thumbnail image with explicit link to wiki page
14766 !! options
14767 thumbsize=220
14768 parsoid=wt2html,wt2wt,html2html
14769 !! wikitext
14770 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14771 !! html/php
14772 <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>
14773
14774 !! html/parsoid
14775 <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>
14776 !! end
14777
14778 !! test
14779 Manually-specified thumbnail image with explicit link to url
14780 !! options
14781 thumbsize=220
14782 parsoid=wt2html,wt2wt,html2html
14783 !! wikitext
14784 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14785 !! html/php
14786 <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>
14787
14788 !! html/parsoid
14789 <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>
14790 !! end
14791
14792 !! test
14793 Manually-specified thumbnail image with explicit no link
14794 !! options
14795 thumbsize=220
14796 parsoid=wt2html,wt2wt,html2html
14797 !! wikitext
14798 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14799 !! html/php
14800 <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>
14801
14802 !! html/parsoid
14803 <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>
14804 !! end
14805
14806 !! test
14807 Manually-specified thumbnail image with explicit link and alt text
14808 !! options
14809 thumbsize=220
14810 parsoid=wt2html,wt2wt,html2html
14811 !! wikitext
14812 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14813 !! html/php
14814 <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>
14815
14816 !! html/parsoid
14817 <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>
14818 !! end
14819
14820 !! test
14821 Image with frame and link
14822 !! options
14823 parsoid=wt2html,wt2wt,html2html
14824 !! wikitext
14825 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14826 !! html/php
14827 <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>
14828
14829 !! html/parsoid
14830 <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>
14831 !! end
14832
14833 !! test
14834 Image with frame and link and explicit alt
14835 !! options
14836 parsoid=wt2html,wt2wt,html2html
14837 !! wikitext
14838 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14839 !! html/php
14840 <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>
14841
14842 !! html/parsoid
14843 <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>
14844 !! end
14845
14846 !! test
14847 Image with wiki markup in implicit alt
14848 !! wikitext
14849 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14850
14851 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14852 !! html/php
14853 <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>
14854 </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>
14855 </p>
14856 !! html/parsoid
14857 <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>
14858
14859 <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>
14860 !! end
14861
14862 !! test
14863 Alt image option should handle most kinds of wikitext without barfing
14864 !! wikitext
14865 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14866 !! html/php
14867 <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>
14868
14869 !! html/parsoid
14870 <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>
14871 !! end
14872
14873 !! test
14874 Image with table with attributes in caption
14875 !! options
14876 parsoid=wt2html,html2html
14877 !! wikitext
14878 [[File:Foobar.jpg|thumb|
14879 {| class="123" |
14880 |- class="456" |
14881 | ha
14882 |}
14883 ]]
14884 !! html/parsoid
14885 <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>
14886 <table class="123">
14887 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
14888 <td> ha</td></tr>
14889 </tbody></table>
14890 </figcaption></figure>
14891 !! end
14892
14893 !! test
14894 Image with table with rows from templates in caption
14895 !! wikitext
14896 [[File:Foobar.jpg|thumb|
14897 {|
14898 {{echo|{{!}} hi}}
14899 |}
14900 ]]
14901 !! html/parsoid
14902 <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>
14903 <table>
14904 <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>
14905 </tbody></table>
14906 </figcaption></figure>
14907 !! end
14908
14909 !! test
14910 Image with nested tables in caption
14911 !! wikitext
14912 [[File:Foobar.jpg|thumb|Foo<br />
14913 {|
14914 |
14915 {|
14916 |z
14917 |}
14918 |}
14919 ]]
14920 !! html/parsoid
14921 <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}'/>
14922 <table>
14923 <tbody><tr><td>
14924 <table>
14925 <tbody><tr><td>z</td></tr>
14926 </tbody></table></td></tr>
14927 </tbody></table>
14928 </figcaption></figure>
14929 !! end
14930
14931 !! test
14932 Image with heading and horizontal rule in caption
14933 !! wikitext
14934 [[File:Foobar.jpg|thumb|
14935 ===Testing===
14936 123
14937 --------------
14938 ]]
14939 !! html/php
14940 <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>
14941
14942 !! html/parsoid
14943 <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>
14944 <h3 id="Testing">Testing</h3>
14945 123
14946 <hr data-parsoid='{"extra_dashes":10}'/>
14947 </figcaption></figure>
14948 !! end
14949
14950 ###################
14951 # Conflicting image format options.
14952 # First option specified should 'win'.
14953 # All three cases in each test should be identical.
14954
14955 !! test
14956 Image with 'frameless' first.
14957 !! options
14958 parsoid=wt2html,wt2wt,html2html
14959 !! wikitext
14960 [[File:Foobar.jpg|frameless|caption]]
14961
14962 [[File:Foobar.jpg|frameless|frame|caption]]
14963
14964 [[File:Foobar.jpg|frameless|thumb|caption]]
14965 !! html/php
14966 <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>
14967 </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>
14968 </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>
14969 </p>
14970 !! html/parsoid
14971 <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>
14972 <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>
14973 <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>
14974 !! end
14975
14976 !! test
14977 Image with 'frame' first.
14978 !! options
14979 parsoid=wt2html,wt2wt,html2html
14980 !! wikitext
14981 [[File:Foobar.jpg|frame|caption]]
14982 [[File:Foobar.jpg|frame|frameless|caption]]
14983 [[File:Foobar.jpg|frame|thumb|caption]]
14984 !! html/php
14985 <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>
14986 <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>
14987 <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>
14988
14989 !! html/parsoid
14990 <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>
14991 <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>
14992 <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>
14993 !! end
14994
14995 !! test
14996 Image with 'thumb' first.
14997 !! options
14998 parsoid=wt2html,wt2wt,html2html
14999 !! wikitext
15000 [[File:Foobar.jpg|thumb|caption]]
15001 [[File:Foobar.jpg|thumb|frameless|caption]]
15002 [[File:Foobar.jpg|thumb|frame|caption]]
15003 !! html/php
15004 <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>
15005 <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>
15006 <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>
15007
15008 !! html/parsoid
15009 <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>
15010 <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>
15011 <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>
15012 !! end
15013
15014 ###################
15015 # Image sizing.
15016 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
15017 # and https://phabricator.wikimedia.org/T64258
15018 # Foobar has actual size of 1941x220
15019 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
15020 # a scalable format.
15021 # 2. Framed images always ignore size options; always render at default size.
15022 # 3. "Unspecified format" and border are the only types which can be
15023 # enlarged.
15024
15025 !! test
15026 Image: unspecified format and border enlarge
15027 !! options
15028 parsoid=wt2html,wt2wt,html2html
15029 !! wikitext
15030 [[File:Foobar.jpg|2000px]]
15031
15032 [[File:Foobar.jpg|border|2000px]]
15033 !! html/php
15034 <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>
15035 </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>
15036 </p>
15037 !! html/parsoid
15038 <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>
15039 <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>
15040 !! end
15041
15042 !! test
15043 Image: "unspecified format" and border reduce
15044 !! options
15045 parsoid=wt2html,wt2wt,html2html
15046 !! wikitext
15047 [[File:Foobar.jpg|1000px]]
15048
15049 [[File:Foobar.jpg|border|1000px]]
15050 !! html/php
15051 <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>
15052 </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>
15053 </p>
15054 !! html/parsoid
15055 <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>
15056 <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>
15057 !! end
15058
15059 !! test
15060 Image: thumbs reduce
15061 !! options
15062 parsoid=wt2html,wt2wt,html2html
15063 !! wikitext
15064 [[File:Foobar.jpg|thumb|50px]]
15065 !! html/php
15066 <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>
15067
15068 !! html/parsoid
15069 <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>
15070 !! end
15071
15072 !! test
15073 Image: bitmap thumbs can't be enlarged past original size, but vector can.
15074 !! options
15075 parsoid=wt2html,wt2wt,html2html
15076 !! wikitext
15077 [[File:Foobar.jpg|thumb|2000px]]
15078
15079 [[File:Foobar.svg|thumb|2000px]]
15080 !! html/php
15081 <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>
15082 <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>
15083
15084 !! html/parsoid
15085 <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>
15086 <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>
15087 !! end
15088
15089 !! test
15090 Image: frameless can reduce in size
15091 !! options
15092 parsoid=wt2html,wt2wt,html2html
15093 !! wikitext
15094 [[File:Foobar.jpg|frameless|50px]]
15095 !! html/php
15096 <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>
15097 </p>
15098 !! html/parsoid
15099 <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>
15100 !! end
15101
15102 !! test
15103 Image: bitmap frameless can't be enlarged past original size, but vector can
15104 !! options
15105 parsoid=wt2html,wt2wt,html2html
15106 !! wikitext
15107 [[File:Foobar.jpg|frameless|2000px]]
15108
15109 [[File:Foobar.svg|frameless|2000px]]
15110 !! html/php
15111 <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>
15112 </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>
15113 </p>
15114 !! html/parsoid
15115 <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>
15116 <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>
15117 !! end
15118
15119 !! test
15120 Image: framed images are always unscaled.
15121 !! options
15122 parsoid=wt2html,wt2wt,html2html
15123 !! wikitext
15124 [[File:Foobar.jpg|frame]]
15125
15126 [[File:Foobar.jpg|frame|50px]]
15127
15128 [[File:Foobar.jpg|frame|50x50px]]
15129
15130 [[File:Foobar.jpg|frame|2000px]]
15131 !! html/php
15132 <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>
15133 <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>
15134 <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>
15135 <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>
15136
15137 !! html/parsoid
15138 <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>
15139 <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>
15140 <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>
15141 <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>
15142 !! end
15143
15144 ###################
15145
15146 !! test
15147 Link to image page- image page normally doesn't exists, hence edit link
15148 Add test with existing image page
15149 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
15150 !! wikitext
15151 [[:Image:test]]
15152 !! html
15153 <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>
15154 </p>
15155 !! end
15156
15157 !! test
15158 T20784 Link to non-existent image page with caption should use caption as link text
15159 !! wikitext
15160 [[:Image:test|caption]]
15161 !! html
15162 <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>
15163 </p>
15164 !! end
15165
15166 !! test
15167 Frameless image caption with a free URL
15168 !! wikitext
15169 [[File:Foobar.jpg|http://example.com]]
15170 !! html/php
15171 <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>
15172 </p>
15173 !! html/parsoid
15174 <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>
15175 !! end
15176
15177 !! test
15178 Thumbnail image caption with a free URL
15179 !! options
15180 thumbsize=220
15181 !! wikitext
15182 [[File:Foobar.jpg|thumb|http://example.com]]
15183 !! html/php
15184 <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>
15185
15186 !! html/parsoid
15187 <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>
15188 !! end
15189
15190 !! test
15191 Thumbnail image caption with a free URL and explicit alt
15192 !! options
15193 thumbsize=220
15194 parsoid=wt2html,wt2wt,html2html
15195 !! wikitext
15196 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15197 !! html/php
15198 <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>
15199
15200 !! html/parsoid
15201 <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>
15202 !! end
15203
15204 !! test
15205 SVG thumbnails with no language set
15206 !! options
15207 !! wikitext
15208 [[File:Foobar.svg|thumb|caption]]
15209 !! html/php
15210 <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>
15211
15212 !! html/parsoid
15213 <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>
15214 !! end
15215
15216 !! test
15217 SVG thumbnails with language de
15218 !! options
15219 parsoid=wt2html,wt2wt,html2html
15220 !! wikitext
15221 [[File:Foobar.svg|thumb|caption|lang=de]]
15222 !! html/php
15223 <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>
15224
15225 !! html/parsoid
15226 <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>
15227 !! end
15228
15229 !! test
15230 SVG thumbnails with invalid language code
15231 !! options
15232 parsoid=wt2html,wt2wt,html2html
15233 !! wikitext
15234 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15235 !! html/php
15236 <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>
15237
15238 !! html/parsoid
15239 <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>
15240 !! end
15241
15242 !! test
15243 T3887: A ISBN with a thumbnail
15244 !! wikitext
15245 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15246 !! html/php
15247 <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>
15248
15249 !! html/parsoid
15250 <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>
15251 !! end
15252
15253 !! test
15254 T3887: A RFC with a thumbnail
15255 !! wikitext
15256 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15257 !! html/php
15258 <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>
15259
15260 !! html/parsoid
15261 <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>
15262 !! end
15263
15264 !! test
15265 T3887: A mailto link with a thumbnail
15266 !! wikitext
15267 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15268 !! html/php
15269 <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>
15270
15271 !! html/parsoid
15272 <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>
15273 !! end
15274
15275 # Pending resolution to T2368
15276 !! test
15277 T2648: Frameless image caption with a link
15278 !! wikitext
15279 [[File:Foobar.jpg|text with a [[link]] in it]]
15280 !! html/php
15281 <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>
15282 </p>
15283 !! html/parsoid
15284 <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>
15285 !! end
15286
15287 !! test
15288 T2648: Frameless image caption with a link (suffix)
15289 !! wikitext
15290 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15291 !! html/php
15292 <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>
15293 </p>
15294 !! html/parsoid
15295 <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>
15296 !! end
15297
15298 !! test
15299 T2648: Frameless image caption with an interwiki link
15300 !! wikitext
15301 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15302 !! html/php
15303 <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>
15304 </p>
15305 !! html/parsoid
15306 <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>
15307 !! end
15308
15309 !! test
15310 T2648: Frameless image caption with a piped interwiki link
15311 !! wikitext
15312 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15313 !! html/php
15314 <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>
15315 </p>
15316 !! html/parsoid
15317 <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>
15318 !! end
15319
15320 !! test
15321 T107474: Frameless image caption with <nowiki>
15322 !! wikitext
15323 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15324 !! html/parsoid
15325 <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>
15326 !! end
15327
15328 !! test
15329 Escape HTML special chars in image alt text
15330 !! wikitext
15331 [[File:Foobar.jpg|& < > "]]
15332 !! html/php
15333 <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>
15334 </p>
15335 !! html/parsoid
15336 <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>
15337 !! end
15338
15339 !! test
15340 Escape HTML special chars in image alt text with LanguageConverter
15341 !! options
15342 language=zh
15343 !! wikitext
15344 [[File:Foobar.jpg|& < > "]]
15345 !! html/php
15346 <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>
15347 </p>
15348 !! html/parsoid
15349 <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>
15350 !! end
15351
15352 !! test
15353 Entities in file name and attributes
15354 !! wikitext
15355 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15356 !! html/php
15357 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15358 </p>
15359 !! html/parsoid
15360 <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>
15361 !! end
15362
15363 !! test
15364 T2499: Alt text should have &#1234;, not &amp;1234;
15365 !! wikitext
15366 [[File:Foobar.jpg|&#9792;]]
15367 !! html/php
15368 <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>
15369 </p>
15370 !! html/parsoid
15371 <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>
15372 !! end
15373
15374 !! test
15375 Broken image caption with link
15376 !! options
15377 parsoid=wt2html,wt2wt,html2html
15378 !! wikitext
15379 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15380 !! html/php
15381 <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.
15382 </p>
15383 !! html/parsoid
15384 <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>
15385 !! end
15386
15387 !! test
15388 Image caption containing another image
15389 !! wikitext
15390 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15391 !! html/php
15392 <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>
15393
15394 !! html/parsoid
15395 <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>
15396 !! end
15397
15398 !! test
15399 Image: caption containing a newline
15400 !! wikitext
15401 [[File:Foobar.jpg|This
15402 *is some text]]
15403 !! html/php
15404 <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>
15405 </p>
15406 !! html/parsoid
15407 <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>
15408 !!end
15409
15410 !!test
15411 Image: caption containing leading space
15412 (The leading space should not trigger nowiki escaping in wt2wt mode)
15413 !! wikitext
15414 [[File:Foobar.jpg|thumb| bar]]
15415 !! html/php
15416 <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>
15417
15418 !! html/parsoid
15419 <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>
15420 !!end
15421
15422 # html/php output not have newlines after table, td, th, etc. because
15423 # Linker::makeThumbLink2() replaces the newlines with spaces since
15424 # the table is inside a caption.
15425 # FIXME: Verify if that circa 2004 fix is still required.
15426 !! test
15427 Image: caption containing a table
15428 !! options
15429 parsoid=wt2html,wt2wt,html2html
15430 !! wikitext
15431 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15432 {|
15433 !Foo!!Bar
15434 |-
15435 |Foo1||Bar1
15436 |}
15437 and some more text.]]
15438 !! html/php
15439 <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>
15440
15441 !! html/parsoid
15442 <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
15443 <table>
15444 <tbody>
15445 <tr><th>Foo</th><th>Bar</th></tr>
15446 <tr>
15447 <td>Foo1</td>
15448 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15449 !! end
15450
15451 !! test
15452 T5090: External links other than http: in image captions
15453 !! wikitext
15454 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15455 !! html/php
15456 <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>
15457
15458 !! html/parsoid
15459 <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>
15460 !! end
15461
15462 !! test
15463 Custom class
15464 !! options
15465 parsoid=wt2html,wt2wt,html2html
15466 !! wikitext
15467 [[Image:foobar.jpg|a|class=b]]
15468 !! html/php
15469 <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>
15470 </p>
15471 !! html/parsoid
15472 <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>
15473 !! end
15474
15475 !! test
15476 Localized image handling (1).
15477 !! options
15478 parsoid=wt2html,wt2wt,html2html
15479 language=es
15480 !! wikitext
15481 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15482 !! html/php
15483 <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>
15484
15485 !! html/parsoid
15486 <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>
15487 !! end
15488
15489 !! test
15490 Localized image handling (2).
15491 !! options
15492 thumbsize=220
15493 parsoid=wt2html,wt2wt,html2html
15494 language=es
15495 !! wikitext
15496 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15497 !! html/php
15498 <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>
15499
15500 !! html/parsoid
15501 <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>
15502 !! end
15503
15504 !! test
15505 Localized image handling (3).
15506 !! options
15507 language=fa
15508 parsoid=html2wt
15509 !! html/parsoid
15510 <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>
15511 !! wikitext
15512 [[File:Foobar.jpg|بندانگشتی]]
15513 !! end
15514
15515 !! test
15516 "border", "frameless" and "class" attributes on an image.
15517 !! options
15518 thumbsize=220
15519 parsoid=wt2html,wt2wt,html2html
15520 !! wikitext
15521 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15522 !! html/php
15523 <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>
15524 </p>
15525 !! html/parsoid
15526 <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>
15527 !! end
15528
15529 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15530 !! test
15531 Invalid image attributes (T64500)
15532 !! options
15533 thumbsize=220
15534 parsoid=wt2html,wt2wt,html2html
15535 !! wikitext
15536 [[File:Foobar.jpg|thumb|float|left|caption]]
15537
15538 [[File:Foobar.jpg|thumb|righ|caption]]
15539
15540 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15541 !! html/php
15542 <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>
15543 <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>
15544 <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>
15545
15546 !! html/parsoid
15547 <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>
15548 <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>
15549 <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>
15550 !! end
15551
15552 !! article
15553 File:Barfoo.jpg
15554 !! text
15555 #REDIRECT [[File:Barfoo.jpg]]
15556 !! endarticle
15557
15558 # FIXME: Parsoid should run this test -- but we'd need to teach the
15559 # mockAPI about the redirected Barfoo.jpg image.
15560 !! test
15561 Redirected image
15562 !! wikitext
15563 [[Image:Barfoo.jpg]]
15564 !! html/php
15565 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15566 </p>
15567 !! end
15568
15569 !! test
15570 Missing image with uploads disabled
15571 !! options
15572 wgEnableUploads=0
15573 !! wikitext
15574 [[File:Foobaz.jpg]]
15575 !! html/php
15576 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15577 </p>
15578 !! html/parsoid
15579 <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>
15580 !! end
15581
15582 # Parsoid-specific testing for images
15583 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15584 # Currently imperfect due to a flaw in the Parsoid testrunner
15585 # Work in progress
15586 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15587 # image tests.
15588
15589 !! test
15590 Parsoid-specific image handling - simple image with size and middle alignment
15591 !! wikitext
15592 [[File:Foobar.jpg|middle|50px]]
15593 !! html/parsoid
15594 <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>
15595 !! end
15596
15597 !! test
15598 Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
15599 !! options
15600 parsoid=wt2wt,wt2html,html2html
15601 !! wikitext
15602 [[Image:Foobar.jpg|middle|50px]]
15603 !! html/parsoid
15604 <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>
15605 !! end
15606
15607 !! test
15608 Parsoid-specific image handling - simple image with size and middle alignment (existing content)
15609 !! wikitext
15610 [[File:Foobar.jpg|50px|middle]]
15611 !! html/parsoid
15612 <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>
15613 !! end
15614
15615 !! test
15616 Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
15617 !! options
15618 parsoid=wt2html,wt2wt,html2html
15619 !! wikitext
15620 [[Image:Foobar.jpg|50px|middle]]
15621 !! html/parsoid
15622 <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>
15623 !! end
15624
15625 !! test
15626 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15627 !! wikitext
15628 [[File:Foobar.jpg|500x10px|baseline|caption]]
15629 !! html/parsoid
15630 <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>
15631 !! end
15632
15633 !! test
15634 Parsoid-specific image handling - simple image with border and size spec
15635 !! wikitext
15636 [[File:Foobar.jpg|50px|border|caption]]
15637 !! html/parsoid
15638 <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>
15639 !! end
15640
15641 !! test
15642 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15643 !! options
15644 parsoid=wt2html,html2html
15645 !! wikitext
15646 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15647 !! html/parsoid
15648 <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>
15649 !! end
15650
15651 !! test
15652 Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
15653 !! options
15654 parsoid=wt2html,html2html
15655 !! wikitext
15656 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15657 !! html/parsoid
15658 <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>
15659 !! end
15660
15661 !! test
15662 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15663 !! options
15664 parsoid=wt2html,html2html
15665 !! wikitext
15666 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15667 !! html/parsoid
15668 <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>
15669 !! end
15670
15671 !! test
15672 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
15673 !! options
15674 parsoid=wt2html,html2html
15675 !! wikitext
15676 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15677 !! html/parsoid
15678 <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>
15679 !! end
15680
15681 !! test
15682 Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
15683 !! options
15684 parsoid=wt2html,wt2wt,html2html
15685 !! wikitext
15686 [[File:Foobar.jpg|frame|500x50px|caption]]
15687 !! html/parsoid
15688 <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>
15689 !! end
15690
15691 !! test
15692 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
15693 !! options
15694 parsoid=wt2html,html2html
15695 !! wikitext
15696 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15697 !! html/parsoid
15698 <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>
15699 !! end
15700
15701 !! test
15702 Parsoid-specific image handling - frameless image with specific size, border, and caption
15703 !! wikitext
15704 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15705 !! html/parsoid
15706 <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>
15707 !! end
15708
15709 !! test
15710 Parsoid-specific image handling - simple image with a formatted caption
15711 !! wikitext
15712 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15713 !! html/parsoid
15714 <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>
15715 !! end
15716
15717 !! test
15718 Parsoid-specific image handling - caption with a template in it
15719 !! wikitext
15720 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15721 !! html/parsoid
15722 <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>
15723 !! end
15724
15725 !! test
15726 Parsoid-specific image handling - caption with unbalanced tags in it
15727 !! options
15728 parsoid=wt2html,wt2wt,html2html
15729 !! wikitext
15730 foo
15731 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15732 bar
15733 !! html/parsoid
15734 <p>foo</p>
15735 <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>
15736 <p>bar</p>
15737 !! end
15738
15739 !! test
15740 Parsoid-specific image handling - empty caption (1)
15741 !! options
15742 parsoid=wt2html,wt2wt
15743 !! wikitext
15744 [[File:Foobar.jpg|thumb|]]
15745 !! html/parsoid
15746 <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>
15747 !! end
15748
15749 # empty captions don't get serialized unless we're in the "round trip" case
15750 !! test
15751 Parsoid-specific image handling - empty caption (2)
15752 !! options
15753 parsoid=html2wt
15754 !! html/parsoid
15755 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15756 <a href="./File:Foobar.jpg">
15757 <img resource="./File:Foobar.jpg"
15758 src="//example.com/images/3/3a/Foobar.jpg"
15759 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15760 height="25" width="220"/>
15761 </a>
15762 <figcaption></figcaption>
15763 </figure>
15764 !! wikitext
15765 [[File:Foobar.jpg|thumb]]
15766 !! end
15767
15768 !! test
15769 Parsoid-specific image handling - whitespace caption
15770 !! wikitext
15771 [[File:Foobar.jpg|thumb| ]]
15772 !! html/parsoid
15773 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> </figcaption></figure>
15774 !! end
15775
15776 !! test
15777 Parsoid-specific image handling - lang option
15778 !! wikitext
15779 foo
15780 [[File:Foobar.svg|lang=de|caption]]
15781 bar
15782 !! html/parsoid
15783 <p>foo
15784 <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>
15785 bar</p>
15786 !! end
15787
15788 ## Edge case bugs in Parsoid from T93580
15789 !! test
15790 T93580: 1. Templated <ref> inside block images
15791 !! wikitext
15792 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15793
15794 <references />
15795 !! html/parsoid
15796 <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>
15797
15798 <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>
15799 !! end
15800
15801 !! test
15802 T93580: 2. <ref> inside inline images
15803 !! wikitext
15804 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15805
15806 <references />
15807 !! html/parsoid
15808 <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\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#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>
15809
15810 <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>
15811 !! end
15812
15813 !! test
15814 T93580: 3. Templated <ref> inside inline images
15815 !! wikitext
15816 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15817
15818 <references />
15819 !! html/parsoid
15820 <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>
15821
15822 <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>
15823 !! end
15824
15825 ###
15826 ### Subpages
15827 ###
15828 !! article
15829 Subpage test/subpage
15830 !! text
15831 foo
15832 !! endarticle
15833
15834 !! test
15835 Subpage link
15836 !! options
15837 subpage title=[[Subpage test]]
15838 !! wikitext
15839 [[/subpage]]
15840 !! html
15841 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15842 </p>
15843 !! end
15844
15845 !! test
15846 Subpage noslash link
15847 !! options
15848 subpage title=[[Subpage test]]
15849 !! wikitext
15850 [[/subpage/]]
15851 !! html
15852 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15853 </p>
15854 !! end
15855
15856 !! article
15857 Subpage test/1/2/subpage
15858 !! text
15859 blah
15860 !! endarticle
15861
15862 !! test
15863 Relative subpage noslash link
15864 !! options
15865 parsoid=wt2wt,wt2html,html2html
15866 subpage title=[[Subpage test/1/2/3/4]]
15867 !! wikitext
15868 [[../../subpage/]]
15869
15870 [[../../subpage]]
15871 !! html/php
15872 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15873 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15874 </p>
15875 !! html/parsoid
15876 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15877 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15878 !! end
15879
15880 !! test
15881 Parsoid: dot-slash prefixed wikilinks
15882 !! wikitext
15883 [[./foo]]
15884
15885 [[././bar]]
15886
15887 [[././baz/]]
15888 !! html/php
15889 <p>[[./foo]]
15890 </p><p>[[././bar]]
15891 </p><p>[[././baz/]]
15892 </p>
15893 !! html/parsoid
15894 <p>[[./foo]]
15895 </p><p>[[././bar]]
15896 </p><p>[[././baz/]]
15897 </p>
15898 !! end
15899
15900 !! test
15901 Render invalid page names as plain text (T53090)
15902 !! wikitext
15903 [[./../foo|bar]]
15904 [[foo�|bar]]
15905 [[foo/.|bar]]
15906 [[foo/..|bar]]
15907 [[foo~~~bar]]
15908 [[foo>bar]]
15909 [[foo[bar]]
15910 [[.]]
15911 [[..]]
15912 [[foo././bar]]
15913 [[foo[http://example.com]xyz]]
15914
15915 [[{{echo|./../foo}}|bar]]
15916 [[{{echo|foo/.}}|bar]]
15917 [[{{echo|foo/..}}|bar]]
15918 [[{{echo|foo~~~~bar}}]]
15919 [[{{echo|foo>bar}}]]
15920 [[{{echo|foo././bar}}]]
15921 [[{{echo|foo{bar}}]]
15922 [[{{echo|foo}bar}}]]
15923 [[{{echo|foo[bar}}]]
15924 [[{{echo|foo]bar}}]]
15925 [[{{echo|foo<bar}}]]
15926 !!html/php
15927 <p>[[./../foo|bar]]
15928 [[foo�|bar]]
15929 [[foo/.|bar]]
15930 [[foo/..|bar]]
15931 [[foo~~~bar]]
15932 [[foo&gt;bar]]
15933 [[foo[bar]]
15934 [[.]]
15935 [[..]]
15936 [[foo././bar]]
15937 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15938 </p><p>[[./../foo|bar]]
15939 [[foo/.|bar]]
15940 [[foo/..|bar]]
15941 [[foo~~~~bar]]
15942 [[foo&gt;bar]]
15943 [[foo././bar]]
15944 [[foo{bar]]
15945 [[foo}bar]]
15946 [[foo[bar]]
15947 [[foo]bar]]
15948 [[foo&lt;bar]]
15949 </p>
15950 !!html/parsoid
15951 <p>[[./../foo|bar]]
15952 [[foo�|bar]]
15953 [[foo/.|bar]]
15954 [[foo/..|bar]]
15955 [[foo~~~bar]]
15956 [[foo>bar]]
15957 [[foo[bar]]
15958 [[.]]
15959 [[..]]
15960 [[foo././bar]]
15961 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
15962
15963 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15964 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15965 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15966 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15967 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15968 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15969 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15970 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15971 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15972 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15973 [[<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>
15974 !!end
15975
15976 !! test
15977 Disabled subpages
15978 !! wikitext
15979 [[/subpage]]
15980 !! html
15981 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15982 </p>
15983 !! end
15984
15985 !! test
15986 T2561: {{/Subpage}}
15987 !! options
15988 subpage title=[[Page]]
15989 !! wikitext
15990 {{/Subpage}}
15991 !! html
15992 <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>
15993 </p>
15994 !! end
15995
15996 ###
15997 ### Categories
15998 ###
15999 !! article
16000 Category:MediaWiki User's Guide
16001 !! text
16002 blah
16003 !! endarticle
16004
16005 !! test
16006 Link to category
16007 !! wikitext
16008 [[:Category:MediaWiki User's Guide]]
16009 !! html
16010 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
16011 </p>
16012 !! end
16013
16014 !! test
16015 Simple category
16016 !! options
16017 cat
16018 !! wikitext
16019 [[Category:MediaWiki User's Guide]]
16020 !! html/php
16021 cat=MediaWiki_User's_Guide sort=
16022 !! html/parsoid
16023 <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"}}'/>
16024 !! end
16025
16026 !! test
16027 PAGESINCATEGORY invalid title fatal (r33546 fix)
16028 !! wikitext
16029 {{PAGESINCATEGORY:<bogus>}}
16030 !! html
16031 <p>0
16032 </p>
16033 !! end
16034
16035 !! test
16036 Category with different sort key
16037 !! options
16038 cat
16039 !! wikitext
16040 [[Category:MediaWiki User's Guide|Foo]]
16041 !! html/php
16042 cat=MediaWiki_User's_Guide sort=Foo
16043 !! html/parsoid
16044 <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"}}'/>
16045 !! end
16046
16047 !! test
16048 Category with identical sort key
16049 !! options
16050 cat
16051 !! wikitext
16052 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16053 !! html/php
16054 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
16055 !! html/parsoid
16056 <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"}}'/>
16057 !! end
16058
16059 !! test
16060 Category with empty sort key
16061 !! options
16062 cat
16063 pst
16064 !! wikitext
16065 [[Category:MediaWiki User's Guide|]]
16066 !! html/php
16067 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16068 !! end
16069
16070 !! test
16071 Category with empty sort key and parentheses
16072 !! options
16073 cat
16074 pst
16075 !! wikitext
16076 [[Category:Foo (bar)|]]
16077 !! html/php
16078 [[Category:Foo (bar)|Foo]]
16079 !! end
16080
16081 !! test
16082 Category with link tail
16083 !! options
16084 cat
16085 pst
16086 !! wikitext
16087 123[[Category:Foo]]456
16088 !! html/php
16089 123[[Category:Foo]]456
16090 !! end
16091
16092 !! test
16093 Category with template
16094 !! options
16095 cat
16096 pst
16097 !! wikitext
16098 [[Category:{{echo|Foo}}]]
16099 !! html/php
16100 [[Category:{{echo|Foo}}]]
16101 !! end
16102
16103 !! test
16104 Category with template in sort key
16105 !! options
16106 cat
16107 pst
16108 !! wikitext
16109 [[Category:Foo|{{echo|Bar}}]]
16110 !! html/php
16111 [[Category:Foo|{{echo|Bar}}]]
16112 !! end
16113
16114 !! test
16115 Category with template in sort key and title
16116 !! options
16117 cat
16118 pst
16119 !! wikitext
16120 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16121 !! html/php
16122 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16123 !! end
16124
16125 ## We used to, but no longer wt2wt this test since the default serializer
16126 ## will normalize all categories to serialize on their own line.
16127 ## This wikitext usage is going to be fairly uncommon in production and
16128 ## selser will take care of preserving formatting in those scenarios.
16129 !! test
16130 Category / paragraph interactions
16131 !! options
16132 parsoid=wt2html
16133 !! wikitext
16134 Foo [[Category:Baz]] Bar
16135
16136 Foo [[Category:Baz]]
16137 Bar
16138
16139 Foo
16140 [[Category:Baz]]
16141 Bar
16142
16143 Foo
16144 [[Category:Baz]] Bar
16145
16146 Foo
16147 [[Category:Baz]]
16148 [[Category:Baz]]
16149 [[Category:Baz]]
16150 Bar
16151
16152 [[Category:Baz]]
16153 [[Category:Baz]]
16154 [[Category:Baz]]
16155
16156 [[Category:Baz]]
16157 {{echo|[[Category:Baz]]}}
16158 [[Category:Baz]]
16159 !! html/php
16160 <p>Foo Bar
16161 </p><p>Foo
16162 Bar
16163 </p><p>Foo
16164 Bar
16165 </p><p>Foo Bar
16166 </p><p>Foo
16167 Bar
16168 </p>
16169 !! html/parsoid
16170 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16171 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16172 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16173 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16174 <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>
16175 <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}}]}'/>
16176 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16177 !! end
16178
16179 ## We used to, but no longer wt2wt this test since the default serializer
16180 ## will normalize all categories to serialize on their own line.
16181 ## This wikitext usage is going to be fairly uncommon in production and
16182 ## selser will take care of preserving formatting in those scenarios.
16183 ##
16184 ## The whitespace on the empty line is part of the test. Please do not delete
16185 !! test
16186 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16187 !! options
16188 parsoid=wt2html
16189 !! wikitext
16190 This
16191
16192 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16193
16194 {{echo|[[Category:Foo]] and so should this!}}
16195 !! html/php
16196 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16197 </p>
16198 !! html/parsoid
16199 <p>This
16200
16201 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16202
16203 <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>
16204 !! end
16205
16206 ## Parsoid will not try to wt2wt this while preserving newlines because
16207 ## it suppresses excess newlines within list items -- and we don't want to
16208 ## introduce a special case just for categories, which is, in reality somewhat
16209 ## odd behavior -- categories are unlikely to be used in list items like this
16210 ## in top-level pages and are only likely to show up in template-generated
16211 ## list items where this RT-ing is a non-issue.
16212 ##
16213 ## The whitespace on the empty line is part of the test. Please do not delete
16214 !! test
16215 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16216 !! options
16217 parsoid=wt2html
16218 !! wikitext
16219 * This
16220
16221 [[Category:Foo]] and this should be part of the same list item
16222 * So should this
16223
16224 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16225 !! html
16226 <ul><li>This and this should be part of the same list item</li>
16227 <li>So should this and this should be part of the same list item</li></ul>
16228 !! html/parsoid
16229 <ul>
16230 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16231 <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>
16232 </ul>
16233 !! end
16234
16235 ## Newlines and categories that follow the last item of a list
16236 ## are treated differently because this (list followed by categories)
16237 ## is an extremely common pattern on wikis.
16238 !! test
16239 3. Categories and newlines: newline suppression for last list item should RT properly
16240 !! wikitext
16241 *a
16242 *b
16243
16244 [[Category:Foo]]
16245
16246 [[Category:Bar]]
16247 [[Category:Baz]]
16248
16249 :c
16250
16251 [[Category:C]]
16252
16253 ;d
16254
16255 [[Category:D]]
16256 !! html/parsoid
16257 <ul><li>a</li>
16258 <li>b</li></ul>
16259
16260 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16261
16262 <link rel="mw:PageProp/Category" href="./Category:Bar"/>
16263 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16264
16265 <dl><dd>c</dd></dl>
16266
16267 <link rel="mw:PageProp/Category" href="./Category:C"/>
16268
16269 <dl><dt>d</dt></dl>
16270
16271 <link rel="mw:PageProp/Category" href="./Category:D"/>
16272 !! end
16273
16274 !! test
16275 4. Categories and newlines: newline suppression for last list item should RT properly
16276 !! wikitext
16277 *a
16278 ****b
16279
16280 [[Category:Foo]]
16281 !! html/parsoid
16282 <ul><li>a
16283 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
16284
16285 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16286 !! end
16287
16288 ## only wt2html for this to make sure the algo only applies to the rightmost path
16289 !! test
16290 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16291 !! options
16292 parsoid=wt2html
16293 !! wikitext
16294 *a
16295 **b
16296 [[Category:Foo]]
16297 *c
16298 **d
16299 [[Category:Foo]]
16300 !! html/parsoid
16301 <ul><li>a
16302 <ul><li>b
16303 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16304 <li>c
16305 <ul><li>d</li></ul></li></ul>
16306 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16307 !! end
16308
16309 ## We used to, but no longer wt2wt this test since the default serializer
16310 ## will normalize all categories to serialize on their own line.
16311 ## This wikitext usage is going to be fairly uncommon in production and
16312 ## selser will take care of preserving formatting in those scenarios.
16313 !! test
16314 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16315 !! options
16316 parsoid=wt2html
16317 !! wikitext
16318 *a [[Category:Foo]]
16319 !! html/parsoid
16320 <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>
16321 !! end
16322
16323 # This test also demonstrates because of newline+category tunneling
16324 # through the list hander, template wrapping doesn't expand to the
16325 # containing list when the list item swallows the category.
16326 !! test
16327 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16328 !! wikitext
16329 *{{echo|a
16330 [[Category:Foo]]}}
16331 !! html/parsoid
16332 <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
16333 </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>
16334 !! end
16335
16336 !! test
16337 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16338 !! wikitext
16339 *a
16340
16341 {{echo|[[Category:Foo]]
16342 [[Category:Bar]]}}
16343 [[Category:Baz]]
16344 !! html/parsoid
16345 <ul><li>a</li></ul>
16346
16347 <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">
16348 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16349 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16350 !! end
16351
16352 !! test
16353 Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
16354 !! wikitext
16355 *a
16356
16357 [[Category:Bar]]<!--boo1--> <!--boo2-->
16358 [[Category:Baz]]<!--boo3--> <!--boo4-->
16359 !! html/parsoid
16360 <ul><li>a</li></ul>
16361
16362 <link rel="mw:PageProp/Category" href="./Category:Bar"/><!--boo1--> <!--boo2-->
16363 <link rel="mw:PageProp/Category" href="./Category:Baz"/><!--boo3--> <!--boo4-->
16364 !! end
16365
16366 !! test
16367 Categories and newlines: should behave properly with linkprefix (T87753)
16368 !! options
16369 language=ar
16370 !! wikitext
16371 foo bar
16372 foo bar
16373 [[تصنيف:Foo]]
16374 [[تصنيف:Bar]]
16375 !! html/php
16376 <p>foo bar
16377 foo bar
16378 </p>
16379 !! html/parsoid
16380 <p>foo bar
16381 foo bar</p>
16382 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16383 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16384 !! end
16385
16386 !! test
16387 No regressions on internal links following category (T174639)
16388 !! options
16389 parsoid=wt2html,html2html
16390 !! wikitext
16391 [[Category:Foo]]<div>a
16392
16393 [[Foo]]</div>
16394 !! html/php
16395 <div>a
16396 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16397
16398 !! html/parsoid
16399 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16400
16401 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16402 !! end
16403
16404 # Note that Parsoid differs slightly from PHP due to T175421
16405 !! test
16406 11. Special case where only newlines separate links (T175416)
16407 !! options
16408 parsoid=wt2html,html2html
16409 !! wikitext
16410 [[Category:Foo]]
16411
16412 [[Foo]][[es:Alimento]]
16413
16414 [[Foo]]
16415 !! html/php
16416 <p><br />
16417 <a href="/wiki/Foo" title="Foo">Foo</a>
16418 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16419 </p>
16420 !! html/parsoid
16421 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16422
16423 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16424
16425 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16426 !! end
16427
16428 !! test
16429 Category links with multiple namespaces
16430 !! wikitext
16431 [[Category:Project:Foo]]
16432 !! html/parsoid
16433 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16434 !! end
16435
16436 !! test
16437 Parsoid: Serialize link to category page with colon escape
16438 !! options
16439 parsoid
16440 !! wikitext
16441
16442 [[:Category:Foo]]
16443 [[:Category:Foo|Bar]]
16444 !! html
16445 <p>
16446 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16447 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16448 </p>
16449 !! end
16450
16451 # We used to, but no longer wt2wt this test since the default serializer
16452 # will normalize all categories to serialize on their own line.
16453 # This wikitext usage is going to be fairly uncommon in production and
16454 # selser will take care of preventing whitespace insertion if this
16455 # occurs in an article.
16456 #
16457 # html2html disabled for the same reason (whitespace insertion between
16458 # x and y).
16459 #
16460 # html2wt disabled because it localizes the "Category" namespace.
16461 !! test
16462 Link prefix/suffixes aren't applied to category links
16463 !! options
16464 parsoid=wt2html
16465 language=is
16466 !! wikitext
16467 x[[Category:Foo]]y
16468 !! html/php
16469 <p>xy
16470 </p>
16471 !! html/parsoid
16472 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16473 !! end
16474
16475 !! test
16476 Link prefix/suffixes aren't applied to language links
16477 !! options
16478 parsoid=wt2html
16479 language=is
16480 !! wikitext
16481 x[[es:Foo]]y
16482 !! html/php
16483 <p>xy
16484 </p>
16485 !! html/parsoid
16486 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16487 !! end
16488
16489 !! test
16490 Parsoid: Serialize link to file page with colon escape
16491 !! options
16492 parsoid
16493 !! wikitext
16494
16495 [[:File:Foo.png]]
16496 [[:File:Foo.png|Bar]]
16497 !! html
16498 <p>
16499 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16500 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16501 </p>
16502 !! end
16503
16504 !! test
16505 Parsoid: Serialize a genuine category link without colon escape
16506 !! options
16507 parsoid
16508 !! wikitext
16509 [[Category:Foo]]
16510 [[Category:Foo|Bar]]
16511 !! html
16512 <link rel="mw:PageProp/Category" href="./Category:Foo">
16513 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16514 !! end
16515
16516 !! test
16517 Normalize hrefs properly before testing for invalid link targets (T72894)
16518 !! options
16519 parsoid=html2wt
16520 !! html/parsoid
16521 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16522 !! wikitext
16523 [[Category:Toxine bactérienne]]
16524 !! end
16525
16526 !! test
16527 Parsoid: Defaultsort
16528 !! wikitext
16529 {{DEFAULTSORT:Foo}}
16530 !! html/parsoid
16531 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16532 !! end
16533
16534 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16535 # But, this is a limitation of our representation and is documented in
16536 # TemplateHandler.js in processSpecialMagicWord
16537 !! test
16538 Parsoid: Defaultsort (template-generated)
16539 !! wikitext
16540 {{{{echo|DEFAULTSORT}}:Foo}}
16541 !! html/parsoid
16542 <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"}]]}'/>
16543 !! end
16544
16545 ###
16546 ### Inter-language links
16547 ###
16548 !! test
16549 Interlanguage links
16550 !! options
16551 ill
16552 !! wikitext
16553 [[es:Alimento]]
16554 [[fr:Nourriture]]
16555 [[zh:食品]]
16556 !! html/php
16557 es:Alimento fr:Nourriture zh:食品
16558 !! html/parsoid
16559 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16560 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16561 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16562 !! end
16563
16564 !! test
16565 Duplicate interlanguage links (T26502)
16566 !! options
16567 ill
16568 !! wikitext
16569 [[es:1]]
16570 [[es:2]]
16571 [[fr:1]]
16572 [[fr:2]]
16573 !! html/php
16574 es:1 fr:1
16575 !! html/parsoid
16576 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16577 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16578 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16579 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16580 !! end
16581
16582 ###
16583 ### Sections
16584 ###
16585 !! test
16586 Basic section headings
16587 !! wikitext
16588 ==Headline 1==
16589 Some text
16590
16591 ==Headline 2==
16592 More
16593 ===Smaller headline===
16594 Blah blah
16595 !! html
16596 <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>
16597 <p>Some text
16598 </p>
16599 <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>
16600 <p>More
16601 </p>
16602 <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>
16603 <p>Blah blah
16604 </p>
16605 !! end
16606
16607 !! test
16608 Section headings with TOC
16609 !! wikitext
16610 ==Headline 1==
16611 ===Subheadline 1===
16612 =====Skipping a level=====
16613 ======Skipping a level======
16614
16615 ==Headline 2==
16616 Some text
16617 ===Another headline===
16618 !! html
16619 <div id="toc" class="toc"><input type="checkbox" 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>
16620 <ul>
16621 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16622 <ul>
16623 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16624 <ul>
16625 <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>
16626 <ul>
16627 <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>
16628 </ul>
16629 </li>
16630 </ul>
16631 </li>
16632 </ul>
16633 </li>
16634 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16635 <ul>
16636 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16637 </ul>
16638 </li>
16639 </ul>
16640 </div>
16641
16642 <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>
16643 <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>
16644 <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>
16645 <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>
16646 <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>
16647 <p>Some text
16648 </p>
16649 <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>
16650
16651 !! end
16652
16653 !! test
16654 TOC anchors don't collide
16655 !! wikitext
16656 __FORCETOC__
16657 ==Headline 2==
16658 ==Headline==
16659 ==Headline 2==
16660 ==Headline==
16661 !! html/php
16662 <div id="toc" class="toc"><input type="checkbox" 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>
16663 <ul>
16664 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16665 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16666 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16667 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16668 </ul>
16669 </div>
16670
16671 <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>
16672 <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>
16673 <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>
16674 <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>
16675
16676 !! end
16677
16678 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16679 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
16680 !! test
16681 Handling of sections up to level 6 and beyond
16682 !! options
16683 parsoid=wt2html
16684 !! wikitext
16685 =Level 1 Heading=
16686 ==Level 2 Heading==
16687 ===Level 3 Heading===
16688 ====Level 4 Heading====
16689 =====Level 5 Heading=====
16690 ======Level 6 Heading======
16691 =======Level 7 Heading=======
16692 ========Level 8 Heading========
16693 =========Level 9 Heading=========
16694 ==========Level 10 Heading==========
16695 !! html/php
16696 <div id="toc" class="toc"><input type="checkbox" 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>
16697 <ul>
16698 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16699 <ul>
16700 <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>
16701 <ul>
16702 <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>
16703 <ul>
16704 <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>
16705 <ul>
16706 <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>
16707 <ul>
16708 <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>
16709 <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>
16710 <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>
16711 <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>
16712 <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>
16713 </ul>
16714 </li>
16715 </ul>
16716 </li>
16717 </ul>
16718 </li>
16719 </ul>
16720 </li>
16721 </ul>
16722 </li>
16723 </ul>
16724 </div>
16725
16726 <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>
16727 <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>
16728 <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>
16729 <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>
16730 <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>
16731 <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>
16732 <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>
16733 <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>
16734 <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>
16735 <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>
16736
16737 !! html/parsoid
16738 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
16739 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
16740 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
16741 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
16742 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
16743 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
16744 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
16745 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
16746 <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>
16747 <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>
16748 !! end
16749
16750 !! test
16751 TOC regression (T11764)
16752 !! wikitext
16753 ==title 1==
16754 ===title 1.1===
16755 ====title 1.1.1====
16756 ===title 1.2===
16757 ==title 2==
16758 ===title 2.1===
16759 !! html
16760 <div id="toc" class="toc"><input type="checkbox" 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>
16761 <ul>
16762 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16763 <ul>
16764 <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>
16765 <ul>
16766 <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>
16767 </ul>
16768 </li>
16769 <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>
16770 </ul>
16771 </li>
16772 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16773 <ul>
16774 <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>
16775 </ul>
16776 </li>
16777 </ul>
16778 </div>
16779
16780 <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>
16781 <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>
16782 <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>
16783 <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>
16784 <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>
16785 <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>
16786
16787 !! end
16788
16789 !! test
16790 TOC for heading containing <span id="..."></span> (T96153)
16791 !! wikitext
16792 __FORCETOC__
16793 ==<span id="old-anchor"></span>New title==
16794 !! html/php
16795 <div id="toc" class="toc"><input type="checkbox" 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>
16796 <ul>
16797 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16798 </ul>
16799 </div>
16800
16801 <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>
16802
16803 !! end
16804
16805 !! test
16806 TOC with wgMaxTocLevel=3 (T8204)
16807 !! options
16808 wgMaxTocLevel=3
16809 !! wikitext
16810 ==title 1==
16811 ===title 1.1===
16812 ====title 1.1.1====
16813 ===title 1.2===
16814 ==title 2==
16815 ===title 2.1===
16816 !! html
16817 <div id="toc" class="toc"><input type="checkbox" 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>
16818 <ul>
16819 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16820 <ul>
16821 <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>
16822 <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>
16823 </ul>
16824 </li>
16825 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16826 <ul>
16827 <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>
16828 </ul>
16829 </li>
16830 </ul>
16831 </div>
16832
16833 <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>
16834 <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>
16835 <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>
16836 <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>
16837 <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>
16838 <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>
16839
16840 !! end
16841
16842 !! test
16843 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16844 !! options
16845 wgMaxTocLevel=3
16846 !! wikitext
16847 ==Section 1==
16848 ===Section 1.1===
16849 ====Section 1.1.1====
16850 ====Section 1.1.1.1====
16851 ==Section 2==
16852 !! html
16853 <div id="toc" class="toc"><input type="checkbox" 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>
16854 <ul>
16855 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16856 <ul>
16857 <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>
16858 </ul>
16859 </li>
16860 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16861 </ul>
16862 </div>
16863
16864 <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>
16865 <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>
16866 <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>
16867 <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>
16868 <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>
16869
16870 !! end
16871
16872
16873 !! test
16874 Resolving duplicate section names
16875 !! wikitext
16876 ==Foo bar==
16877 ==Foo bar==
16878 !! html
16879 <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>
16880 <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>
16881
16882 !! end
16883
16884 !! test
16885 Resolving duplicate section names with differing case (T12721)
16886 !! wikitext
16887 ==Foo bar==
16888 ==Foo Bar==
16889 !! html
16890 <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>
16891 <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>
16892
16893 !! end
16894
16895 !! article
16896 Template:sections
16897 !! text
16898 ===Section 1===
16899 ==Section 2==
16900 !! endarticle
16901
16902 !! test
16903 Template with sections, __NOTOC__
16904 !! wikitext
16905 __NOTOC__
16906 ==Section 0==
16907 {{sections}}
16908 ==Section 4==
16909 !! html
16910 <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>
16911 <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>
16912 <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>
16913 <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>
16914
16915 !! end
16916
16917 !! test
16918 __NOEDITSECTION__ keyword
16919 !! wikitext
16920 __NOEDITSECTION__
16921 ==Section 1==
16922 ==Section 2==
16923 !! html
16924 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16925 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16926
16927 !! end
16928
16929 !! test
16930 Link inside a section heading
16931 !! wikitext
16932 ==Section with a [[Main Page|link]] in it==
16933 !! html
16934 <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>
16935
16936 !! end
16937
16938 !! test
16939 TOC regression (T14077)
16940 !! wikitext
16941 __TOC__
16942 ==title 1==
16943 ===title 1.1===
16944 ==title 2==
16945 !! html
16946 <div id="toc" class="toc"><input type="checkbox" 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>
16947 <ul>
16948 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16949 <ul>
16950 <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>
16951 </ul>
16952 </li>
16953 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16954 </ul>
16955 </div>
16956
16957 <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>
16958 <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>
16959 <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>
16960
16961 !! end
16962
16963 !! test
16964 T3219 URL next to image (good)
16965 !! wikitext
16966 http://example.com [[File:Foobar.jpg]]
16967 !! html/php
16968 <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>
16969 </p>
16970 !! html/parsoid
16971 <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>
16972 !!end
16973
16974 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
16975 !! test
16976 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16977 !! options
16978 parsoid=wt2html,html2html
16979 !! wikitext
16980 ===
16981 The line above must have a trailing space!
16982 === <!--
16983 --> <!-- -->
16984 But just in case it doesn't...
16985 !! html/php
16986 <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>
16987 <p>The line above must have a trailing space!
16988 </p>
16989 <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>
16990 <p>But just in case it doesn't...
16991 </p>
16992 !! html/parsoid
16993 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
16994 <p>The line above must have a trailing space!</p>
16995 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
16996 --> <!-- -->
16997 <p>But just in case it doesn't...</p>
16998 !! end
16999
17000 !! test
17001 Header with special characters (T27462)
17002 !! wikitext
17003 The tooltips shall not show entities to the user (ie. be double escaped)
17004
17005 ==text > text==
17006 section 1
17007
17008 ==text < text==
17009 section 2
17010
17011 ==text & text==
17012 section 3
17013
17014 ==text ' text==
17015 section 4
17016
17017 ==text " text==
17018 section 5
17019 !! html/php
17020 <p>The tooltips shall not show entities to the user (ie. be double escaped)
17021 </p>
17022 <div id="toc" class="toc"><input type="checkbox" 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>
17023 <ul>
17024 <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>
17025 <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>
17026 <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>
17027 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
17028 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
17029 </ul>
17030 </div>
17031
17032 <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>
17033 <p>section 1
17034 </p>
17035 <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>
17036 <p>section 2
17037 </p>
17038 <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>
17039 <p>section 3
17040 </p>
17041 <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>
17042 <p>section 4
17043 </p>
17044 <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>
17045 <p>section 5
17046 </p>
17047 !! html/parsoid
17048 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
17049
17050 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
17051 <p>section 1</p>
17052
17053 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
17054 <p>section 2</p>
17055
17056 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
17057 <p>section 3</p>
17058
17059 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
17060 <p>section 4</p>
17061
17062 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
17063 <p>section 5</p>
17064 !! end
17065
17066 !! test
17067 Header with space, plus and underscore as entity
17068 !! wikitext
17069 Id should not contain + for spaces
17070
17071 ==Space between Text==
17072 section 1
17073
17074 ==Space-Entity&#32;between&#32;Text==
17075 section 2
17076
17077 ==Plus+between+Text==
17078 section 3
17079
17080 ==Plus-Entity&#43;between&#43;Text==
17081 section 4
17082
17083 ==Underscore_between_Text==
17084 section 5
17085
17086 ==Underscore-Entity&#95;between&#95;Text==
17087 section 6
17088
17089 [[#Space between Text]]
17090 [[#Space-Entity&#32;between&#32;Text]]
17091 [[#Plus+between+Text]]
17092 [[#Plus-Entity&#43;between&#43;Text]]
17093 [[#Underscore_between_Text]]
17094 [[#Underscore-Entity&#95;between&#95;Text]]
17095 !! html/php
17096 <p>Id should not contain + for spaces
17097 </p>
17098 <div id="toc" class="toc"><input type="checkbox" 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>
17099 <ul>
17100 <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>
17101 <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>
17102 <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>
17103 <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>
17104 <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>
17105 <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>
17106 </ul>
17107 </div>
17108
17109 <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>
17110 <p>section 1
17111 </p>
17112 <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>
17113 <p>section 2
17114 </p>
17115 <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>
17116 <p>section 3
17117 </p>
17118 <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>
17119 <p>section 4
17120 </p>
17121 <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>
17122 <p>section 5
17123 </p>
17124 <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>
17125 <p>section 6
17126 </p><p><a href="#Space_between_Text">#Space between Text</a>
17127 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
17128 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
17129 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
17130 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17131 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17132 </p>
17133 !! html/parsoid
17134 <p>Id should not contain + for spaces</p>
17135
17136 <h2 id="Space_between_Text">Space between Text</h2>
17137 <p>section 1</p>
17138
17139 <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>
17140 <p>section 2</p>
17141
17142 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
17143 <p>section 3</p>
17144
17145 <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>
17146 <p>section 4</p>
17147
17148 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
17149 <p>section 5</p>
17150
17151 <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>
17152 <p>section 6</p>
17153
17154 <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>
17155 <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>
17156 <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>
17157 <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>
17158 <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>
17159 <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>
17160 !! end
17161
17162 # Parsoid html2wt disabled because it adds padding spaces around =
17163 !! test
17164 Headers with excess '=' characters
17165 (Are similar tests necessary beyond the 1st level?)
17166 !! options
17167 parsoid=wt2html,wt2wt,html2html
17168 !! wikitext
17169 =foo==
17170 ==foo=
17171 =''italic'' heading==
17172 ==''italic'' heading=
17173 !! html/php
17174 <div id="toc" class="toc"><input type="checkbox" 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>
17175 <ul>
17176 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17177 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17178 <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>
17179 <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>
17180 </ul>
17181 </div>
17182
17183 <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>
17184 <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>
17185 <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>
17186 <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>
17187
17188 !! html/parsoid
17189 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
17190 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
17191 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
17192 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
17193 !! end
17194
17195 !! test
17196 HTML headers vs TOC (T25393)
17197 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17198 !! wikitext
17199 <h1>Header 1</h1>
17200 ==Header 1.1==
17201 ==Header 1.2==
17202
17203 <h1>Header 2
17204 </h1>
17205 ==Header 2.1==
17206 ==Header 2.2==
17207 __NOEDITSECTION__
17208 !! html/php
17209 <div id="toc" class="toc"><input type="checkbox" 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>
17210 <ul>
17211 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17212 <ul>
17213 <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>
17214 <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>
17215 </ul>
17216 </li>
17217 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
17218 <ul>
17219 <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>
17220 <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>
17221 </ul>
17222 </li>
17223 </ul>
17224 </div>
17225
17226 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17227 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17228 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17229 <h1><span class="mw-headline" id="Header_2">Header 2
17230 </span></h1>
17231 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17232 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17233
17234 !! html/parsoid
17235 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17236 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17237 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17238
17239 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17240 </h1>
17241 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17242 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17243 <meta property="mw:PageProp/noeditsection"/>
17244 !! end
17245
17246 !! test
17247 Single-line or multiline-comments can follow headings
17248 !! options
17249 parsoid=wt2html,wt2wt
17250 !! wikitext
17251 ==foo==<!---->
17252 ==bar==<!--c1-->
17253 ==baz==<!--
17254 c2
17255 c3-->
17256 !! html/php
17257 <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>
17258 <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>
17259 <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>
17260
17261 !! html/parsoid
17262 <h2 id="foo">foo</h2><!---->
17263 <h2 id="bar">bar</h2><!--c1-->
17264 <h2 id="baz">baz</h2><!--
17265 c2
17266 c3-->
17267 !! end
17268
17269 !! test
17270 T3219 URL next to image (broken)
17271 !! wikitext
17272 http://example.com[[File:Foobar.jpg]]
17273 !! html/php
17274 <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>
17275 </p>
17276 !! html/parsoid
17277 <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>
17278 !!end
17279
17280 !! test
17281 T3186 news: in the middle of text
17282 !! wikitext
17283 http://en.wikinews.org/wiki/Wikinews:Workplace
17284 !! html
17285 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17286 </p>
17287 !!end
17288
17289
17290 !! test
17291 Namespaced link must have a title
17292 !! wikitext
17293 [[Project:]]
17294 !! html
17295 <p>[[Project:]]
17296 </p>
17297 !!end
17298
17299 !! test
17300 Namespaced link must have a title (bad fragment version)
17301 !! wikitext
17302 [[Project:#fragment]]
17303 !! html
17304 <p>[[Project:#fragment]]
17305 </p>
17306 !!end
17307
17308
17309 ###
17310 ### HTML tags and HTML attributes
17311 ###
17312
17313 !! test
17314 div with no attributes
17315 !! wikitext
17316 <div>HTML rocks</div>
17317 !! html
17318 <div>HTML rocks</div>
17319
17320 !! end
17321
17322 !! test
17323 div with double-quoted attribute
17324 !! wikitext
17325 <div id="rock">HTML rocks</div>
17326 !! html
17327 <div id="rock">HTML rocks</div>
17328
17329 !! end
17330
17331 !! test
17332 div with single-quoted attribute
17333 !! wikitext
17334 <div id='rock'>HTML rocks</div>
17335 !! html
17336 <div id="rock">HTML rocks</div>
17337
17338 !! end
17339
17340 !! test
17341 div with unquoted attribute
17342 !! wikitext
17343 <div id=rock>HTML rocks</div>
17344 !! html
17345 <div id="rock">HTML rocks</div>
17346
17347 !! end
17348
17349 !! test
17350 div with illegal double attributes
17351 !! wikitext
17352 <div id="a" id="b">HTML rocks</div>
17353 !! html
17354 <div id="b">HTML rocks</div>
17355
17356 !!end
17357
17358 !! test
17359 div with empty attribute value, space before equals
17360 !! options
17361 parsoid=wt2html,html2html
17362 !! wikitext
17363 <div class =>HTML rocks</div>
17364 !! html/php
17365 <div class="">HTML rocks</div>
17366
17367 !! html/parsoid
17368 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17369 !! end
17370
17371 !! test
17372 div with multiple empty attribute values
17373 !! config
17374 wgFragmentMode=[ 'html5', 'legacy' ]
17375 !! options
17376 parsoid=wt2html,html2html
17377 !! wikitext
17378 <div id= title=>HTML rocks</div>
17379 !! html/php
17380 <div id="title=">HTML rocks</div>
17381
17382 !! html/parsoid
17383 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17384 !! end
17385
17386 # FIXME Parsoid doesn't actually match PHP here.
17387 # Probably we should use the synthetic <foo /> or <indicator>
17388 # extensions for this test, which are enabled when running parser tests.
17389 !! test
17390 Extension tag in attribute value
17391 !! wikitext
17392 <span title="<translate>123</translate>">ok</span>
17393 !! html/php+disabled
17394 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17395 </p>
17396 !! html/parsoid
17397 <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>
17398 !! end
17399
17400 !! test
17401 table with multiple empty attribute values
17402 !! options
17403 parsoid=wt2html,html2html
17404 !! wikitext
17405 {| title= id=
17406 |hi
17407 |}
17408 !! html/php
17409 <table title="id=">
17410 <tr>
17411 <td>hi
17412 </td></tr></table>
17413
17414 !! html/parsoid
17415 <table title="id=">
17416 <tbody><tr><td>hi</td></tr>
17417 </tbody></table>
17418 !! end
17419
17420 !! test
17421 div with braces in attribute value
17422 !! wikitext
17423 <div title="{}">Foo</div>
17424 !! html/php
17425 <div title="&#123;&#125;">Foo</div>
17426
17427 !! html/parsoid
17428 <div title="{}">Foo</div>
17429 !! end
17430
17431 !! test
17432 div with empty attribute value, no space before equals
17433 !! options
17434 parsoid=wt2html,html2html
17435 !! wikitext
17436 <div class=>HTML rocks</div>
17437 !! html/php
17438 <div class="">HTML rocks</div>
17439
17440 !! html/parsoid
17441 <div class="">HTML rocks</div>
17442 !! end
17443
17444 !! test
17445 HTML multiple attributes correction
17446 !! wikitext
17447 <p class="error" class="awesome">Awesome!</p>
17448 !! html
17449 <p class="awesome">Awesome!</p>
17450
17451 !!end
17452
17453 !! test
17454 Table multiple attributes correction
17455 !! wikitext
17456 {|
17457 !+ class="error" class="awesome"|status
17458 |}
17459 !! html
17460 <table>
17461 <tr>
17462 <th class="awesome">status
17463 </th></tr></table>
17464
17465 !!end
17466
17467 !! test
17468 DIV IN UPPERCASE
17469 !! wikitext
17470 <DIV ID="x">HTML ROCKS</DIV>
17471 !! html
17472 <div id="x">HTML ROCKS</div>
17473
17474 !!end
17475
17476 !! test
17477 Non-ASCII pseudo-tags are rendered as text
17478 !! wikitext
17479 <khyô>
17480 !! html
17481 <p>&lt;khyô&gt;
17482 </p>
17483 !! end
17484
17485 !! test
17486 Pseudo-tag with URL 'name' renders as url link
17487 !! wikitext
17488 <http://example.com/>
17489 !! html
17490 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17491 </p>
17492 !! end
17493
17494 !! test
17495 text with amp in the middle of nowhere
17496 !! wikitext
17497 Remember AT&T?
17498 !! html
17499 <p>Remember AT&amp;T?
17500 </p>
17501 !! end
17502
17503 !! test
17504 text with character entity: eacute
17505 !! wikitext
17506 I always thought &eacute; was a cute letter.
17507 !! html+tidy
17508 <p>I always thought &#233; was a cute letter.
17509 </p>
17510 !! end
17511
17512 !! test
17513 text with entity-escaped character entity-like string: eacute
17514 !! wikitext
17515 I always thought &amp;eacute; was a cute letter.
17516 !! html
17517 <p>I always thought &amp;eacute; was a cute letter.
17518 </p>
17519 !! end
17520
17521 !! test
17522 text with undefined character entity: xacute
17523 !! wikitext
17524 I always thought &xacute; was a cute letter.
17525 !! html
17526 <p>I always thought &amp;xacute; was a cute letter.
17527 </p>
17528 !! end
17529
17530 !! test
17531 HTML5 tags
17532 !! wikitext
17533 <data value="5">five</data>
17534 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17535 <mark>This highlighted text</mark>
17536 !! html
17537 <p><data value="5">five</data>
17538 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17539 <mark>This highlighted text</mark>
17540 </p>
17541 !! end
17542
17543 !! test
17544 HTML tag with leading space is parsed as text
17545 !! wikitext
17546 < div>foo< /div>
17547 !! html
17548 <p>&lt; div&gt;foo&lt; /div&gt;
17549 </p>
17550 !! end
17551
17552 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17553 ## the HTML5 parsing spec.
17554 !! test
17555 Element with broken attribute syntax
17556 !! options
17557 parsoid=wt2html
17558 !! wikitext
17559 <div style=" style="123">hi</div>
17560 <div =>ho</div>
17561 !! html/php
17562 <div style="123">hi</div>
17563 <div>ho</div>
17564
17565 !! html/parsoid
17566 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17567 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17568 !! end
17569
17570 ###
17571 ### Nesting tests (see T43545, T52604, T53081)
17572 ###
17573
17574 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17575 # Note that html2wt is considerably more difficult if we use <b> in
17576 # the test case, instead of <small>
17577 !! test
17578 Ensure that HTML adoption agency algorithm is properly implemented.
17579 !! wikitext
17580 <small>X<small>Y</small>Z</small>
17581 !! html
17582 <p><small>X<small>Y</small>Z</small>
17583 </p>
17584 !! end
17585
17586 # This was T43545 in the PHP parser.
17587 !! test
17588 Nesting of <kbd>
17589 !! wikitext
17590 <kbd>X<kbd>Y</kbd>Z</kbd>
17591 !! html+tidy
17592 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17593 </p>
17594 !! end
17595
17596 # The following cases were T53081 in the PHP parser.
17597 # Note that there are some other nestable tags (b, i, etc) which are
17598 # not covered; see T53081 for discussion.
17599
17600 !! test
17601 Nesting of <em>
17602 !! wikitext
17603 <em>X<em>Y</em>Z</em>
17604 !! html+tidy
17605 <p><em>X<em>Y</em>Z</em>
17606 </p>
17607 !! end
17608
17609 !! test
17610 Nesting of <strong>
17611 !! wikitext
17612 <strong>X<strong>Y</strong>Z</strong>
17613 !! html+tidy
17614 <p><strong>X<strong>Y</strong>Z</strong>
17615 </p>
17616 !! end
17617
17618 !! test
17619 Nesting of <q>
17620 !! wikitext
17621 <q>X<q>Y</q>Z</q>
17622 !! html+tidy
17623 <p><q>X<q>Y</q>Z</q>
17624 </p>
17625 !! end
17626
17627 !! test
17628 Nesting of <ruby>
17629 !! wikitext
17630 <ruby>X<ruby>Y</ruby>Z</ruby>
17631 !! html
17632 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17633 </p>
17634 !! end
17635
17636 !! test
17637 Nesting of <bdo>
17638 !! wikitext
17639 <bdo>X<bdo>Y</bdo>Z</bdo>
17640 !! html
17641 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17642 </p>
17643 !! end
17644
17645
17646 ###
17647 ### Media links
17648 ###
17649
17650 !! test
17651 Media link
17652 !! wikitext
17653 [[Media:Foobar.jpg]]
17654 [[Media:Video.ogv]]
17655 [[:Media:Video.ogv]]
17656 !! html/php
17657 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17658 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17659 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17660 </p>
17661 !! html/parsoid
17662 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17663 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17664 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv" data-parsoid='{"a":{"namespace":"Media"},"sa":{"namespace":":Media"}}'>Media:Video.ogv</a></p>
17665 !! end
17666
17667 !! test
17668 Media link with text
17669 !! wikitext
17670 [[Media:Foobar.jpg|A neat file to look at]]
17671 !! html/php
17672 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17673 </p>
17674 !! html/parsoid
17675 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17676 !! end
17677
17678 # FIXME: this is still bad HTML tag nesting
17679 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17680 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
17681 !! test
17682 Media link with nasty text
17683 !! wikitext
17684 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17685 !! html/php
17686 <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>
17687
17688 !! html/php+tidy
17689 <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>
17690 !! html/parsoid
17691 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg" data-parsoid='{"autoInsertedEnd":true}'>Safe Link</a></p><div style="display:none" data-parsoid='{"stx":"html"}'><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg" data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'>" onmouseover="alert(document.cookie)" onfoo="</a></div>
17692
17693 !! end
17694
17695 !! test
17696 Media link to nonexistent file (T3702)
17697 !! wikitext
17698 [[Media:No such.jpg]]
17699 [[Media:No_such file.jpg]]
17700 !! html/php
17701 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17702 <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>
17703 </p>
17704 !! html/parsoid
17705 <p><a rel="mw:MediaLink" href="./Special:FilePath/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":{"fileName":"No_such.jpg"},"sa":{"fileName":"No such.jpg"}}'>Media:No such.jpg</a>
17706 <a rel="mw:MediaLink" href="./Special:FilePath/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":{"fileName":"No_such_file.jpg"},"sa":{"fileName":"No_such file.jpg"}}'>Media:No_such file.jpg</a></p>
17707 !! end
17708
17709 !! test
17710 Image link to nonexistent file (T3850 - good)
17711 !! wikitext
17712 [[File:No_such.jpg]]
17713 !! html/php
17714 <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>
17715 </p>
17716 !! html/parsoid
17717 <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>
17718 !! end
17719
17720 !! test
17721 :Image link to nonexistent file (T3850 - bad)
17722 !! wikitext
17723 [[:Image:No such.jpg]]
17724 !! html/php
17725 <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>
17726 </p>
17727 !! html/parsoid
17728 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17729 !! end
17730
17731 !! test
17732 Character reference normalization in link text (T3938)
17733 !! wikitext
17734 [[Main Page|this&that]]
17735 !! html
17736 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17737 </p>
17738 !!end
17739
17740 !! article
17741 אַ
17742 !! text
17743 Test for unicode normalization
17744
17745 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17746 !! endarticle
17747
17748 !! test
17749 (T21451) Links should refer to the normalized form.
17750 !! wikitext
17751 [[&#xFB2E;]]
17752 [[&#x5d0;&#x5b7;]]
17753 [[&#x5d0;ַ]]
17754 [[א&#x5b7;]]
17755 [[אַ]]
17756 !! html
17757 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17758 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17759 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17760 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17761 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17762 </p>
17763 !! end
17764
17765 !! test
17766 Empty attribute crash test (T4067)
17767 !! wikitext
17768 <font color="">foo</font>
17769 !! html
17770 <p><font color="">foo</font>
17771 </p>
17772 !! end
17773
17774 !! test
17775 Empty attribute crash test single-quotes (T4067)
17776 !! wikitext
17777 <font color=''>foo</font>
17778 !! html
17779 <p><font color="">foo</font>
17780 </p>
17781 !! end
17782
17783 !! test
17784 Attribute test: equals, then nothing
17785 !! options
17786 parsoid=wt2html,html2html
17787 !! wikitext
17788 <font color=>foo</font>
17789 !! html/php
17790 <p><font color="">foo</font>
17791 </p>
17792 !! html/parsoid
17793 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17794 !! end
17795
17796 !! test
17797 Attribute test: unquoted value
17798 !! options
17799 parsoid=wt2html,html2html
17800 !! wikitext
17801 <font color=x>foo</font>
17802 !! html/php
17803 <p><font color="x">foo</font>
17804 </p>
17805 !! html/parsoid
17806 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17807 !! end
17808
17809 !! test
17810 Attribute test: unquoted but illegal value (hash)
17811 !! wikitext
17812 <font color=#x>foo</font>
17813 !! html
17814 <p><font color="#x">foo</font>
17815 </p>
17816 !! end
17817
17818 # Parsoid does not serialize to empty attribute syntax,
17819 # so wt2wt and html2wt cases are skipped
17820 !! test
17821 Attribute test: no value (T54330)
17822 !! options
17823 parsoid=wt2html,html2html
17824 !! wikitext
17825 <font color>foo</font>
17826 !! html/php
17827 <p><font color="">foo</font>
17828 </p>
17829 !! html/parsoid
17830 <p><font color="">foo</font></p>
17831 !! end
17832
17833 !! test
17834 T4095: link with three closing brackets
17835 !! wikitext
17836 [[Main Page]]]
17837 !! html/php
17838 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17839 </p>
17840 !! html/parsoid
17841 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17842 !! end
17843
17844 !! test
17845 T4095: link with pipe and three closing brackets
17846 !! wikitext
17847 [[Main Page|link]]]
17848 !! html/php
17849 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17850 </p>
17851 !! html/parsoid
17852 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17853 !! end
17854
17855 !! test
17856 T4095: link with pipe and three closing brackets, version 2
17857 !! wikitext
17858 [[Main Page|[http://example.com/]]]
17859 !! html/php
17860 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17861 </p>
17862 !! html/parsoid
17863 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17864 !! end
17865
17866
17867 ###
17868 ### Safety
17869 ###
17870
17871 !! article
17872 Template:Dangerous attribute
17873 !! text
17874 " onmouseover="alert(document.cookie)
17875 !! endarticle
17876
17877 !! article
17878 Template:Dangerous style attribute
17879 !! text
17880 border-size: expression(alert(document.cookie))
17881 !! endarticle
17882
17883 !! article
17884 Template:Div style
17885 !! text
17886 <div style="float: right; {{{1}}}">Magic div</div>
17887 !! endarticle
17888
17889 !! test
17890 T4304: HTML attribute safety (safe template; regression T4309)
17891 !! wikitext
17892 <div title="{{test}}"></div>
17893 !! html/php
17894 <div title="This is a test template"></div>
17895
17896 !! html/parsoid
17897 <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>
17898 !! end
17899
17900 # Parsoid has enough context to handle this case
17901 !! test
17902 T4304: HTML attribute safety (dangerous template; 2309)
17903 !! wikitext
17904 <div title="{{dangerous attribute}}"></div>
17905 !! html/php
17906 <div title=""></div>
17907
17908 !! html/parsoid
17909 <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>
17910 !! end
17911
17912 !! test
17913 T4304: HTML attribute safety (dangerous style template; 2309)
17914 !! wikitext
17915 <div style="{{dangerous style attribute}}"></div>
17916 !! html/php
17917 <div style="/* insecure input */"></div>
17918
17919 !! html/parsoid
17920 <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>
17921 !! end
17922
17923 !! test
17924 T4304: HTML attribute safety (safe parameter; 2309)
17925 !! wikitext
17926 {{div style|width: 200px}}
17927 !! html/php
17928 <div style="float: right; width: 200px">Magic div</div>
17929
17930 !! html/parsoid
17931 <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>
17932 !! end
17933
17934 !! test
17935 T4304: HTML attribute safety (unsafe parameter; 2309)
17936 !! wikitext
17937 {{div style|width: expression(alert(document.cookie))}}
17938 !! html/php
17939 <div style="/* insecure input */">Magic div</div>
17940
17941 !! html/parsoid
17942 <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>
17943 !! end
17944
17945 ## Parsoid output here differs; needs investigation.
17946 !! test
17947 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17948 !! wikitext
17949 {{div style|"><script>alert(document.cookie)</script>}}
17950 !! html
17951 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17952
17953 !! end
17954
17955 ## Parsoid output here differs; needs investigation.
17956 !! test
17957 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17958 !! wikitext
17959 {{div style|" ><script>alert(document.cookie)</script>}}
17960 !! html
17961 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17962
17963 !! end
17964
17965 !! test
17966 T4304: HTML attribute safety (link)
17967 !! wikitext
17968 <div title="[[Main Page]]"></div>
17969 !! html/php
17970 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
17971
17972 !! html/parsoid
17973 <div title="[[Main Page]]"></div>
17974 !! end
17975
17976 !! test
17977 T4304: HTML attribute safety (italics)
17978 !! wikitext
17979 <div title="''foobar''"></div>
17980 !! html
17981 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17982
17983 !! end
17984
17985 !! test
17986 T4304: HTML attribute safety (bold)
17987 !! wikitext
17988 <div title="'''foobar'''"></div>
17989 !! html
17990 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17991
17992 !! end
17993
17994 !! test
17995 T4304: HTML attribute safety (ISBN)
17996 !! wikitext
17997 <div title="ISBN 1234567890"></div>
17998 !! html
17999 <div title="&#73;SBN 1234567890"></div>
18000
18001 !! end
18002
18003 !! test
18004 T4304: HTML attribute safety (RFC)
18005 !! wikitext
18006 <div title="RFC 1234"></div>
18007 !! html
18008 <div title="&#82;FC 1234"></div>
18009
18010 !! end
18011
18012 !! test
18013 T4304: HTML attribute safety (PMID)
18014 !! wikitext
18015 <div title="PMID 1234567890"></div>
18016 !! html
18017 <div title="&#80;MID 1234567890"></div>
18018
18019 !! end
18020
18021 !! test
18022 T4304: HTML attribute safety (web link)
18023 !! wikitext
18024 <div title="http://example.com/"></div>
18025 !! html
18026 <div title="http&#58;//example.com/"></div>
18027
18028 !! end
18029
18030 !! test
18031 T4304: HTML attribute safety (named web link)
18032 !! wikitext
18033 <div title="[http://example.com/ link]"></div>
18034 !! html/php
18035 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
18036
18037 !! html/parsoid
18038 <div title="[http://example.com/ link]"></div>
18039 !! end
18040
18041 !! test
18042 T5244: HTML attribute safety (extension; safe)
18043 !! wikitext
18044 <div style="<nowiki>background:blue</nowiki>"></div>
18045 !! html/php
18046 <div style="background:blue"></div>
18047
18048 !! html/parsoid
18049 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
18050 !! end
18051
18052 !! test
18053 T5244: HTML attribute safety (extension; unsafe)
18054 !! wikitext
18055 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
18056 !! html/php
18057 <div style="/* insecure input */"></div>
18058
18059 !! html/parsoid
18060 <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>
18061 !! end
18062
18063 # More MSIE fun discovered by Tom Gilder
18064
18065 !! test
18066 MSIE CSS safety test: spurious slash
18067 !! wikitext
18068 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
18069 !! html/php
18070 <div style="/* insecure input */">evil</div>
18071
18072 !! html/parsoid
18073 <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>
18074 !! end
18075
18076 !! test
18077 MSIE CSS safety test: hex code
18078 !! wikitext
18079 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
18080 !! html/php
18081 <div style="/* insecure input */">evil</div>
18082
18083 !! html/parsoid
18084 <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>
18085 !! end
18086
18087 !! test
18088 MSIE CSS safety test: comment in url
18089 !! wikitext
18090 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
18091 !! html/php
18092 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
18093
18094 !! html/parsoid
18095 <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>
18096 !! end
18097
18098 !! test
18099 MSIE CSS safety test: comment in expression
18100 !! wikitext
18101 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
18102 !! html/php
18103 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
18104
18105 !! html/parsoid
18106 <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>
18107 !! end
18108
18109 !! test
18110 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
18111 !! wikitext
18112 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
18113 !! html/php
18114 <p style="/* invalid control char */">A</p>
18115
18116 !! html/parsoid
18117 <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>
18118 !! end
18119
18120 !! test
18121 MSIE 6 CSS safety test: Fullwidth (T57332)
18122 !! wikitext
18123 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
18124 <div style="top:EXPRESSION(alert())">B</div>
18125 !! html/php
18126 <p style="/* insecure input */">A</p>
18127 <div style="/* insecure input */">B</div>
18128
18129 !! html/parsoid
18130 <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>
18131 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
18132 !! end
18133
18134 !! test
18135 MSIE 6 CSS safety test: IPA extensions (T57332)
18136 !! wikitext
18137 <div style="background-image:uʀʟ(javascript:alert())">A</div>
18138 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
18139 !! html/php
18140 <div style="/* insecure input */">A</div>
18141 <p style="/* insecure input */">B</p>
18142
18143 !! html/parsoid
18144 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
18145 <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>
18146 !! end
18147
18148 !! test
18149 MSIE 6 CSS safety test: sup/sub script (T57332)
18150 !! wikitext
18151 <div style="background-image:url⁽javascript:alert())">A</div>
18152 <div style="background-image:url₍javascript:alert())">B</div>
18153 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
18154 !! html/php
18155 <div style="/* insecure input */">A</div>
18156 <div style="/* insecure input */">B</div>
18157 <p style="/* insecure input */">C</p>
18158
18159 !! html/parsoid
18160 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
18161 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
18162 <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>
18163 !! end
18164
18165 !! test
18166 Opera -o-link CSS
18167 !! options
18168 parsoid=wt2html,html2html
18169 !! wikitext
18170 <div
18171 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;"
18172 style="-o-link:attr(title);-o-link-source:current">X</div>
18173 !! html/php
18174 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
18175
18176 !! html/parsoid
18177 <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>
18178 !! end
18179
18180 !! test
18181 MSIE 6 CSS safety test: Repetition markers (T57332)
18182 !! wikitext
18183 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
18184 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
18185 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
18186 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
18187 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
18188 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
18189 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
18190 !! html/php
18191 <p style="/* insecure input */">A</p>
18192 <p style="/* insecure input */">B</p>
18193 <p style="/* insecure input */">C</p>
18194 <p style="/* insecure input */">D</p>
18195 <p style="/* insecure input */">E</p>
18196 <p style="/* insecure input */">F</p>
18197 <p style="/* insecure input */">G</p>
18198
18199 !! html/parsoid
18200 <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>
18201 <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>
18202 <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>
18203 <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>
18204 <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>
18205 <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>
18206 <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>
18207 !! end
18208
18209 !! test
18210 Table attribute legitimate extension
18211 !! wikitext
18212 {|
18213 !+ style="<nowiki>color:blue</nowiki>"|status
18214 |}
18215 !! html
18216 <table>
18217 <tr>
18218 <th style="color:blue">status
18219 </th></tr></table>
18220
18221 !!end
18222
18223 !! test
18224 Table attribute safety
18225 !! wikitext
18226 {|
18227 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18228 |}
18229 !! html
18230 <table>
18231 <tr>
18232 <th style="/* insecure input */">status
18233 </th></tr></table>
18234
18235 !! end
18236
18237 !! test
18238 CSS line continuation 1
18239 !! wikitext
18240 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18241 !! html
18242 <div style="/* insecure input */"></div>
18243
18244 !! end
18245
18246 !! test
18247 CSS line continuation 2
18248 !! wikitext
18249 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18250 !! html
18251 <div style="/* invalid control char */"></div>
18252
18253 !! end
18254
18255 !! article
18256 Template:Identity
18257 !! text
18258 {{{1}}}
18259 !! endarticle
18260
18261 !! test
18262 Expansion of multi-line templates in attribute values (T8255)
18263 !! wikitext
18264 <div style="background: {{identity|#00FF00}}">-</div>
18265 !! html
18266 <div style="background: #00FF00">-</div>
18267
18268 !! end
18269
18270 !! test
18271 Expansion of multi-line templates in attribute values (T8255 sanity check)
18272 !! wikitext
18273 <div style="background:
18274 #00FF00">-</div>
18275 !! html/php
18276 <div style="background: #00FF00">-</div>
18277
18278 !! html/parsoid
18279 <div style="background:
18280 #00FF00">-</div>
18281 !! end
18282
18283 !! test
18284 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18285 !! wikitext
18286 <div style="background: &#10;#00FF00">-</div>
18287 !! html
18288 <div style="background: &#10;#00FF00">-</div>
18289
18290 !! end
18291
18292 !! test
18293 Tags which are hidden from tidiers cannot pass through the Sanitizer
18294 !! wikitext
18295 <mw:toc><script>alert();</script></mw:toc>
18296 !! html+tidy
18297 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18298 </p>
18299 !! end
18300
18301 ###
18302 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18303 ###
18304
18305 !! test
18306 Parser hook: empty input
18307 !! wikitext
18308 <tag></tag>
18309 !! html/php
18310 <pre>
18311 ''
18312 array (
18313 )
18314 </pre>
18315
18316 !! html/parsoid
18317 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18318 !! end
18319
18320 ## Don't expect parsoid to rt this form.
18321 !! test
18322 Parser hook: empty input using terminated empty elements
18323 !! options
18324 parsoid=wt2html,html2html
18325 !! wikitext
18326 <tag/>
18327 !! html/php
18328 <pre>
18329 NULL
18330 array (
18331 )
18332 </pre>
18333
18334 !! html/parsoid
18335 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18336 !! end
18337
18338 !! test
18339 Parser hook: empty input using terminated empty elements (space before)
18340 !! wikitext
18341 <tag />
18342 !! html/php
18343 <pre>
18344 NULL
18345 array (
18346 )
18347 </pre>
18348
18349 !! html/parsoid
18350 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18351 !! end
18352
18353 !! test
18354 Parser hook: basic input
18355 !! wikitext
18356 <tag>input</tag>
18357 !! html/php
18358 <pre>
18359 'input'
18360 array (
18361 )
18362 </pre>
18363
18364 !! html/parsoid
18365 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18366 !! end
18367
18368 ## Don't expect parsoid to rt this form.
18369 !! test
18370 Parser hook: case insensitive
18371 !! options
18372 parsoid=wt2html,html2html
18373 !! wikitext
18374 <TAG>input</TAG>
18375 !! html/php
18376 <pre>
18377 'input'
18378 array (
18379 )
18380 </pre>
18381
18382 !! html/parsoid
18383 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18384 !! end
18385
18386 ## Don't expect parsoid to rt this form.
18387 !! test
18388 Parser hook: case insensitive, redux
18389 !! options
18390 parsoid=wt2html,html2html
18391 !! wikitext
18392 <TaG>input</TAg>
18393 !! html/php
18394 <pre>
18395 'input'
18396 array (
18397 )
18398 </pre>
18399
18400 !! html/parsoid
18401 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18402 !! end
18403
18404 !! test
18405 Parser hook: nested tags
18406 !! wikitext
18407 <tag><tag></tag></tag>
18408 !! html/php
18409 <pre>
18410 '<tag>'
18411 array (
18412 )
18413 </pre>&lt;/tag&gt;
18414
18415 !! html/parsoid
18416 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
18417 !! end
18418
18419 !! test
18420 Parser hook: basic arguments
18421 !! wikitext
18422 <tag width="200" height="100" depth="50" square=""></tag>
18423 !! html/php
18424 <pre>
18425 ''
18426 array (
18427 'width' => '200',
18428 'height' => '100',
18429 'depth' => '50',
18430 'square' => '',
18431 )
18432 </pre>
18433
18434 !! html/parsoid
18435 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18436 !! end
18437
18438 ## Don't expect parsoid to rt this form.
18439 !! test
18440 Parser hook: basic arguments, variations
18441 !! options
18442 parsoid=wt2html,html2html
18443 !! wikitext
18444 <tag width=200 height = "100" depth = '50' square></tag>
18445 !! html/php
18446 <pre>
18447 ''
18448 array (
18449 'width' => '200',
18450 'height' => '100',
18451 'depth' => '50',
18452 'square' => '',
18453 )
18454 </pre>
18455
18456 !! html/parsoid
18457 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18458 !! end
18459
18460 !! test
18461 Parser hook: argument containing a forward slash (T7344)
18462 !! wikitext
18463 <tag filename="/tmp/bla"></tag>
18464 !! html/php
18465 <pre>
18466 ''
18467 array (
18468 'filename' => '/tmp/bla',
18469 )
18470 </pre>
18471
18472 !! html/parsoid
18473 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18474 !! end
18475
18476 ## Don't expect parsoid to rt this form.
18477 !! test
18478 Parser hook: empty input using terminated empty elements (T4374)
18479 !! options
18480 parsoid=wt2html,html2html
18481 !! wikitext
18482 <tag foo=bar/>text
18483 !! html/php
18484 <pre>
18485 NULL
18486 array (
18487 'foo' => 'bar',
18488 )
18489 </pre>text
18490
18491 !! html/parsoid
18492 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
18493 !! end
18494
18495 ## </tag> should be output literally since there is no matching tag that begins it
18496 ## Don't expect parsoid to rt this form.
18497 !! test
18498 Parser hook: basic arguments using terminated empty elements (T4374)
18499 !! options
18500 parsoid=wt2html
18501 !! wikitext
18502 <tag width=200 height = "100" depth = '50' square/>
18503 other stuff
18504 </tag>
18505 !! html/php
18506 <pre>
18507 NULL
18508 array (
18509 'width' => '200',
18510 'height' => '100',
18511 'depth' => '50',
18512 'square' => '',
18513 )
18514 </pre>
18515 <p>other stuff
18516 &lt;/tag&gt;
18517 </p>
18518 !! html/parsoid
18519 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":null}' about="#mwt2"></pre><p>other stuff
18520 &lt;/tag></p>
18521 !! end
18522
18523 ## Don't expect parsoid to rt this form.
18524 !! test
18525 Parser hook: Don't allow unclosed extension tags
18526 !! options
18527 parsoid=wt2html
18528 !! wikitext
18529 test <tag>123
18530
18531 this is a '''test'''
18532 !! html/php
18533 <p>test &lt;tag&gt;123
18534 </p><p>this is a <b>test</b>
18535 </p>
18536 !! html/parsoid
18537 <p>test &lt;tag>123</p>
18538
18539 <p>this is a <b>test</b></p>
18540 !! end
18541
18542 !! test
18543 Parser hook: horizontal rule inside extension tag that outputs <pre>
18544 !! wikitext
18545 <tag>
18546 Hello
18547 <hr/>
18548 Goodbye
18549 </tag>
18550 !! html/php
18551 <pre>
18552 '
18553 Hello
18554 <hr/>
18555 Goodbye
18556 '
18557 array (
18558 )
18559 </pre>
18560
18561 !! end
18562
18563 ###
18564 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18565 ###
18566
18567 !! test
18568 Parser hook: static parser hook not inside a comment
18569 !! wikitext
18570 <statictag>hello, world</statictag>
18571
18572 <statictag action="flush" />
18573 !! html/php
18574 <p><br />
18575 hello, world
18576 </p>
18577 !! html/parsoid
18578 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18579 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18580 !! end
18581
18582 !! test
18583 Parser hook: static parser hook inside a comment
18584 !! wikitext
18585 <!-- <statictag>hello, world</statictag> -->
18586 <statictag action="flush" />
18587 !! html/php
18588 <p><br />
18589 </p>
18590 !! html/parsoid
18591 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18592 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18593 !! end
18594
18595 # Nested template calls; this case was broken by Parser.php rev 1.506,
18596 # since reverted.
18597
18598 !! article
18599 Template:One-parameter
18600 !! text
18601 (My parameter is: {{{1}}})
18602 !! endarticle
18603
18604 !! article
18605 Template:Map-one-parameter
18606 !! text
18607 {{{{{1}}}|{{{2}}}}}
18608 !! endarticle
18609
18610 !! test
18611 Nested template calls
18612 !! wikitext
18613 {{Map-one-parameter|One-parameter|param}}
18614 !! html
18615 <p>(My parameter is: param)
18616 </p>
18617 !! end
18618
18619
18620 ###
18621 ### Sanitizer
18622 ###
18623
18624 # Remex wraps empty tag runs with p-tags.
18625 # Parsoid strips them out during p-wrapping.
18626 !! test
18627 Sanitizer: Closing of open tags
18628 !! wikitext
18629 <s></s><table></table>
18630 !! html/php+tidy
18631 <p><s></s></p><table></table>
18632 !! html/parsoid
18633 <s></s><table></table>
18634 !! end
18635
18636 !! test
18637 Sanitizer: Closing of open but not closed tags
18638 !! wikitext
18639 <s>foo
18640 !! html
18641 <p><s>foo</s>
18642 </p>
18643 !! end
18644
18645 !! test
18646 Sanitizer: Closing of closed but not open tags
18647 !! options
18648 parsoid=wt2html
18649 !! wikitext
18650 </s>
18651 !! html/php+tidy
18652 <p class="mw-empty-elt">
18653 </p>
18654 !! html/parsoid
18655 !! end
18656
18657 !! test
18658 Sanitizer: Closing of closed but not open table tags
18659 !! options
18660 parsoid=wt2html
18661 !! wikitext
18662 Table not started</td></tr></table>
18663 !! html+tidy
18664 <p>Table not started
18665 </p>
18666 !! end
18667
18668 !! test
18669 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18670 !! config
18671 wgFragmentMode=[ 'html5', 'legacy' ]
18672 !! wikitext
18673 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18674 !! html/php
18675 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18676 </p>
18677 !! html/parsoid
18678 <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>
18679 !! end
18680
18681 !! test
18682 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18683 !! config
18684 wgFragmentMode=[ 'legacy' ]
18685 !! wikitext
18686 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18687 !! html/php
18688 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18689 </p>
18690 !! end
18691
18692 # In HTML5, the restrictions are that id must contain at least one character,
18693 # and must not contain any space characters.
18694 !! test
18695 Sanitizer: Validating the contents of the id attribute (T6515)
18696 !! options
18697 disabled
18698 !! wikitext
18699 <br id="" /><br id="a space" />
18700 !! html
18701 Something ...
18702 !! end
18703
18704 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18705 !! test
18706 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18707 !! options
18708 disabled
18709 !! wikitext
18710 <br id="foo" /><br id="foo" />
18711 !! html
18712 Something need to be done. foo-2 ?
18713 !! end
18714
18715 !! test
18716 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18717 !! wikitext
18718 <div itemscope>
18719 <meta itemprop="hello" content="world">
18720 <meta http-equiv="refresh" content="5">
18721 <meta itemprop="hello" http-equiv="refresh" content="5">
18722 <link itemprop="hello" href="{{SERVER}}">
18723 <link rel="stylesheet" href="{{SERVER}}">
18724 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18725 </div>
18726 !! html
18727 <div itemscope="">
18728 <p> <meta itemprop="hello" content="world" />
18729 &lt;meta http-equiv="refresh" content="5"&gt;
18730 <meta itemprop="hello" content="5" />
18731 <link itemprop="hello" href="http&#58;//example.org" />
18732 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18733 <link itemprop="hello" href="http&#58;//example.org" />
18734 </p>
18735 </div>
18736
18737 !! end
18738
18739 !! test
18740 Sanitizer: Strip comments from CSS attributes
18741 !! options
18742 parsoid=wt2html,wt2wt
18743 !! wikitext
18744 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18745 !! html/php
18746 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18747 </p>
18748 !! html/parsoid
18749 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18750 !! end
18751
18752 !! test
18753 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18754 !! wikitext
18755 [[meatball:Soft"Security]]
18756 !! html/php
18757 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18758 </p>
18759 !! html/parsoid
18760 <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>
18761 !! end
18762
18763 !! test
18764 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18765 !! wikitext
18766 [[meatball:Foo<Bar]]
18767 [[meatball:Foo>Bar]]
18768 [[meatball:Foo&lt;bar]]
18769 [[meatball:Foo&gt;bar]]
18770 !! html/php
18771 <p>[[meatball:Foo&lt;Bar]]
18772 [[meatball:Foo&gt;Bar]]
18773 [[meatball:Foo&lt;bar]]
18774 [[meatball:Foo&gt;bar]]
18775 </p>
18776 !! html/parsoid
18777 <p>[[meatball:Foo&lt;Bar]]
18778 [[meatball:Foo>Bar]]
18779 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
18780 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
18781 !! end
18782
18783 !! test
18784 Language converter: output gets cut off unexpectedly (T7757)
18785 !! options
18786 language=zh
18787 !! wikitext
18788 this bit is safe: }-
18789
18790 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18791
18792 then we get cut off here: }-
18793
18794 all additional text is vanished
18795 !! html/php
18796 <p>this bit is safe: }-
18797 </p><p>but if we add a conversion instance: xxx
18798 </p><p>then we get cut off here: }-
18799 </p><p>all additional text is vanished
18800 </p>
18801 !! html/parsoid
18802 <p>this bit is safe: }-</p>
18803 <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>
18804 <p>then we get cut off here: }-</p>
18805 <p>all additional text is vanished</p>
18806 !! end
18807
18808 !! test
18809 Language converter glossary rules inside attributes (T119158)
18810 !! options
18811 language=sr variant=sr-el
18812 !! wikitext
18813 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
18814
18815 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
18816 !! html/php
18817 <p>
18818 </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>
18819 </p>
18820 !! html/parsoid
18821 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
18822
18823 <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>
18824 !! end
18825
18826 !! test
18827 Self closed html pairs (T7487)
18828 !! wikitext
18829 <center><font id="bug" />Centered text</center>
18830 <div><font id="bug2" />In div text</div>
18831 !! html+tidy
18832 <center><font id="bug"></font>Centered text</center>
18833 <div><font id="bug2"></font>In div text</div>
18834 !! end
18835
18836 !! test
18837 Punctuation: nbsp before exclamation
18838 !! wikitext
18839 C'est grave !
18840 !! html
18841 <p>C'est grave&#160;!
18842 </p>
18843 !! end
18844
18845 !! test
18846 Punctuation: CSS !important (T13874)
18847 !! wikitext
18848 <div style="width:50% !important">important</div>
18849 !! html
18850 <div style="width:50%&#32;!important">important</div>
18851
18852 !!end
18853
18854 !! test
18855 Punctuation: CSS ! important (T13874; with space after)
18856 !! wikitext
18857 <div style="width:50% ! important">important</div>
18858 !! html
18859 <div style="width:50%&#32;! important">important</div>
18860
18861 !!end
18862
18863 !! test
18864 HTML bullet list, closed tags (T7497)
18865 !! wikitext
18866 <ul>
18867 <li>One</li>
18868 <li>Two</li>
18869 </ul>
18870 !! html/php
18871 <ul>
18872 <li>One</li>
18873 <li>Two</li>
18874 </ul>
18875
18876 !! html/parsoid
18877 <ul data-parsoid='{"stx":"html"}'>
18878 <li data-parsoid='{"stx":"html"}'>One</li>
18879 <li data-parsoid='{"stx":"html"}'>Two</li>
18880 </ul>
18881
18882 !! end
18883
18884 !! test
18885 HTML bullet list, unclosed tags (T7497)
18886 !! wikitext
18887 <ul>
18888 <li>One
18889 <li>Two
18890 </ul>
18891 !! html/php+tidy
18892 <ul>
18893 <li>One
18894 </li><li>Two
18895 </li></ul>
18896 !! html/parsoid
18897 <ul data-parsoid='{"stx":"html"}'>
18898 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18899 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18900 </ul>
18901
18902 !! end
18903
18904 !! test
18905 HTML ordered list, closed tags (T7497)
18906 !! wikitext
18907 <ol>
18908 <li>One</li>
18909 <li>Two</li>
18910 </ol>
18911 !! html/php
18912 <ol>
18913 <li>One</li>
18914 <li>Two</li>
18915 </ol>
18916
18917 !! html/parsoid
18918 <ol data-parsoid='{"stx":"html"}'>
18919 <li data-parsoid='{"stx":"html"}'>One</li>
18920 <li data-parsoid='{"stx":"html"}'>Two</li>
18921 </ol>
18922
18923 !! end
18924
18925 !! test
18926 HTML ordered list, unclosed tags (T7497)
18927 !! options
18928 !! wikitext
18929 <ol>
18930 <li>One
18931 <li>Two
18932 </ol>
18933 !! html/php+tidy
18934 <ol>
18935 <li>One
18936 </li><li>Two
18937 </li></ol>
18938 !! html/parsoid
18939 <ol data-parsoid='{"stx":"html"}'>
18940 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18941 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18942 </ol>
18943
18944 !! end
18945
18946 !! test
18947 HTML nested bullet list, closed tags (T7497)
18948 !! wikitext
18949 <ul>
18950 <li>One</li>
18951 <li>Two:
18952 <ul>
18953 <li>Sub-one</li>
18954 <li>Sub-two</li>
18955 </ul>
18956 </li>
18957 </ul>
18958 !! html/php
18959 <ul>
18960 <li>One</li>
18961 <li>Two:
18962 <ul>
18963 <li>Sub-one</li>
18964 <li>Sub-two</li>
18965 </ul>
18966 </li>
18967 </ul>
18968
18969 !! html/parsoid
18970 <ul data-parsoid='{"stx":"html"}'>
18971 <li data-parsoid='{"stx":"html"}'>One</li>
18972 <li data-parsoid='{"stx":"html"}'>Two:
18973 <ul data-parsoid='{"stx":"html"}'>
18974 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18975 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18976 </ul>
18977 </li>
18978 </ul>
18979 !! end
18980
18981 !! test
18982 HTML nested bullet list, open tags (T7497)
18983 !! wikitext
18984 <ul>
18985 <li>One
18986 <li>Two:
18987 <ul>
18988 <li>Sub-one
18989 <li>Sub-two
18990 </ul>
18991 </ul>
18992 !! html+tidy
18993 <ul>
18994 <li>One
18995 </li><li>Two:
18996 <ul>
18997 <li>Sub-one
18998 </li><li>Sub-two
18999 </li></ul>
19000 </li></ul>
19001 !! end
19002
19003 !! test
19004 HTML nested ordered list, closed tags (T7497)
19005 !! wikitext
19006 <ol>
19007 <li>One</li>
19008 <li>Two:
19009 <ol>
19010 <li>Sub-one</li>
19011 <li>Sub-two</li>
19012 </ol>
19013 </li>
19014 </ol>
19015 !! html
19016 <ol>
19017 <li>One</li>
19018 <li>Two:
19019 <ol>
19020 <li>Sub-one</li>
19021 <li>Sub-two</li>
19022 </ol>
19023 </li>
19024 </ol>
19025
19026 !! end
19027
19028 !! test
19029 HTML nested ordered list, open tags (T7497)
19030 !! wikitext
19031 <ol>
19032 <li>One
19033 <li>Two:
19034 <ol>
19035 <li>Sub-one
19036 <li>Sub-two
19037 </ol>
19038 </ol>
19039 !! html/php
19040 <ol>
19041 <li>One
19042 <li>Two:
19043 <ol>
19044 <li>Sub-one
19045 <li>Sub-two
19046 </ol>
19047 </ol>
19048
19049 !! html/parsoid
19050 <ol>
19051 <li>One
19052 </li>
19053 <li>Two:
19054 <ol>
19055 <li>Sub-one
19056 </li>
19057 <li>Sub-two
19058 </li>
19059 </ol>
19060 </li>
19061 </ol>
19062
19063 !! end
19064
19065 !! test
19066 HTML ordered list item with parameters oddity
19067 !! wikitext
19068 <ol><li id="fragment">One</li>
19069 </ol>
19070 !! html
19071 <ol><li id="fragment">One</li>
19072 </ol>
19073
19074 !! end
19075
19076 # parsoid doesn't explicitly mark autonumbered links, see T55505
19077 !!test
19078 T7918: autonumbering
19079 !! wikitext
19080 [http://first/] [http://second] [ftp://ftp]
19081
19082 ftp://inlineftp
19083
19084 [mailto:enclosed@mail.tld With target]
19085
19086 [mailto:enclosed@mail.tld]
19087
19088 mailto:inline@mail.tld
19089 !! html/php
19090 <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>
19091 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
19092 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
19093 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
19094 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
19095 </p>
19096 !! html/parsoid
19097 <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>
19098 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
19099 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
19100 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
19101 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
19102 !! end
19103
19104
19105 #
19106 # Security and HTML correctness
19107 # From Nick Jenkins' fuzz testing
19108 #
19109
19110 !! test
19111 Fuzz testing: Parser13
19112 !! wikitext
19113 {|
19114 | http://a|
19115 !! html
19116 <table>
19117 <tr>
19118 <td>
19119 </td>
19120 </tr>
19121 </table>
19122
19123 !! end
19124
19125 # Note that Parsoid output differs from the PHP parser here: the PHP
19126 # parser breaks the URL for the magic word, while in Parsoid the URL
19127 # production takes precedence.
19128 !! test
19129 Fuzz testing: Parser14
19130 !! wikitext
19131 ==onmouseover===
19132 http://__TOC__
19133 !! html/php
19134 <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>
19135 http://<div id="toc" class="toc"><input type="checkbox" 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>
19136 <ul>
19137 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19138 </ul>
19139 </div>
19140
19141
19142 !! html/php+tidy
19143 <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>
19144 http://</p><div id="toc" class="toc"><input type="checkbox" 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>
19145 <ul>
19146 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19147 </ul>
19148 </div>
19149 !! html/parsoid
19150 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
19151 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
19152 !! end
19153
19154 !! test
19155 Fuzz testing: Parser14-table
19156 !! options
19157 parsoid=wt2html,html2html
19158 !! wikitext
19159 ==a==
19160 {| STYLE=__TOC__
19161 !! html
19162 <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>
19163 <table style="&#95;_TOC&#95;_">
19164 <tr><td></td></tr>
19165 </table>
19166
19167 !! html+tidy
19168 <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>
19169 <table style="__TOC__">
19170 <tr>
19171 <td></td>
19172 </tr>
19173 </table>
19174 !! html/parsoid
19175 <h2 id="a">a</h2>
19176 <table style="__TOC__"></table>
19177 !! end
19178
19179 # Known to produce bogus xml (extra </td>)
19180 # Don't add the html/php section since it generates broken HTML
19181 !! test
19182 Fuzz testing: Parser16
19183 !! wikitext
19184 {|
19185 !https://||||||
19186 !! html+tidy
19187 <table>
19188 <tbody><tr>
19189 <th>https://</th>
19190 <th></th>
19191 <th></th>
19192 <th>
19193
19194 </th></tr>
19195 </tbody></table>
19196 !! end
19197
19198 !! test
19199 Fuzz testing: Parser21
19200 !! wikitext
19201 {|
19202 !irc://{{ftp://a" onmouseover="alert('hello world');"
19203 |
19204 !! html
19205 <table>
19206 <tr>
19207 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
19208 </th>
19209 <td>
19210 </td>
19211 </tr>
19212 </table>
19213
19214 !! end
19215
19216 !! test
19217 Fuzz testing: Parser22
19218 !! wikitext
19219 http://===r:::https://b
19220
19221 {|
19222 !! html
19223 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
19224 </p>
19225 <table>
19226 <tr><td></td></tr>
19227 </table>
19228
19229 !! end
19230
19231 # Known to produce bad XML for now
19232 !! test
19233 Fuzz testing: Parser24
19234 !! options
19235 parsoid=wt2html
19236 !! wikitext
19237 {|
19238 {{{|
19239 <u CLASS=
19240 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19241 <br style="onmouseover='alert(document.cookie);' " />
19242
19243 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19244 |
19245 !! html/php
19246 <table>
19247 {{{|
19248 <u class="&#124;">}}}} &gt;
19249 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19250
19251 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19252 <tr>
19253 <td></u>
19254 </td>
19255 </tr>
19256 </table>
19257
19258 !! html/parsoid
19259 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
19260 <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>"}'/>}}}} >
19261 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/></u></p><p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><u class="|" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":""},"autoInsertedEnd":true,"autoInsertedStart":true}'>MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p><table data-parsoid='{"autoInsertedEnd":true}'>
19262
19263
19264
19265 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
19266 !! end
19267
19268 # Note: the current result listed for this is not what the original one was,
19269 # but the original bug was JavaScript injection, which is fixed in any case.
19270 # It's not clear that the original result listed was any more correct than the
19271 # current one. Original result:
19272 # <p>{{{|
19273 # </p>
19274 # <li class="&#124;&#124;">
19275 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19276 !!test
19277 Fuzz testing: Parser25 (T8055)
19278 !! wikitext
19279 {{{
19280 |
19281 <LI CLASS=||
19282 >
19283 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19284 !! html/php
19285 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19286 </p>
19287 !! html/parsoid
19288 <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"]}'>
19289 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19290 !! end
19291
19292 !!test
19293 Fuzz testing: URL adjacent extension (with space, clean)
19294 !! wikitext
19295 http://example.com <nowiki>junk</nowiki>
19296 !! html/php
19297 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19298 </p>
19299 !! html/parsoid
19300 <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>
19301 !! end
19302
19303 !!test
19304 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19305 !! wikitext
19306 http://example.com<nowiki>junk</nowiki>
19307 !! html/php
19308 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19309 </p>
19310 !! html/parsoid
19311 <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>
19312 !! end
19313
19314 !! test
19315 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19316 !! wikitext
19317 http://example.com<pre>junk</pre>
19318 !! html/php
19319 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19320
19321 !! html/php+tidy
19322 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19323 !! html/parsoid
19324 <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>
19325 !! end
19326
19327 !! test
19328 Fuzz testing: image with bogus manual thumbnail
19329 !! wikitext
19330 [[Image:foobar.jpg|thumbnail= ]]
19331 !! html/php
19332 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19333
19334 !! html/parsoid
19335 <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>
19336 !! end
19337
19338 # Parsoid will emit the newline literally in wt2wt; see next test case.
19339 !! test
19340 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19341 !! options
19342 parsoid=wt2html
19343 !! wikitext
19344 <pre dir="&#10;"></pre>
19345 !! html/php
19346 <pre dir="&#10;"></pre>
19347
19348 !! html/parsoid
19349 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19350 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19351 !! end
19352
19353 !! test
19354 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19355 !! options
19356 parsoid=html2wt
19357 !! html/parsoid
19358 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19359 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19360 !! wikitext
19361 <pre dir="
19362 "></pre>
19363 !! html/php
19364 <pre dir=""></pre>
19365
19366 !! end
19367
19368 !! test
19369 Templates in extension attributes are not expanded
19370 !! wikitext
19371 <pre dir="{{echo|ltr}}"></pre>
19372 !! html/php
19373 <pre dir="{{echo|ltr}}"></pre>
19374
19375 !! html/parsoid
19376 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19377 !! end
19378
19379 !! test
19380 Parsing optional HTML elements (T8171)
19381 !! options
19382 !! wikitext
19383 <table>
19384 <tr>
19385 <td> Some tabular data</td>
19386 <td> More tabular data ...
19387 <td> And yet som tabular data</td>
19388 </tr>
19389 </table>
19390 !! html
19391 <table>
19392 <tr>
19393 <td> Some tabular data</td>
19394 <td> More tabular data ...
19395 </td><td> And yet som tabular data</td>
19396 </tr>
19397 </table>
19398
19399 !! end
19400
19401 !! test
19402 Correct handling of <td>, <tr> (T8171)
19403 !! options
19404 !! wikitext
19405 <table>
19406 <tr>
19407 <td> Some tabular data</td>
19408 <td> More tabular data ...</td>
19409 <td> And yet som tabular data</td>
19410 </tr>
19411 </table>
19412 !! html
19413 <table>
19414 <tr>
19415 <td> Some tabular data</td>
19416 <td> More tabular data ...</td>
19417 <td> And yet som tabular data</td>
19418 </tr>
19419 </table>
19420
19421 !! end
19422
19423
19424 !! test
19425 Parsing crashing regression (fr:JavaScript)
19426 !! wikitext
19427 </body></x>
19428 !! html
19429 <p>&lt;/body&gt;&lt;/x&gt;
19430 </p>
19431 !! end
19432
19433 !! test
19434 Inline wiki vs wiki block nesting
19435 !! wikitext
19436 '''Bold paragraph
19437
19438 New wiki paragraph
19439 !! html
19440 <p><b>Bold paragraph</b>
19441 </p><p>New wiki paragraph
19442 </p>
19443 !! end
19444
19445 # FIXME: The current php output is documented
19446 # and desired output is the parsoid target.
19447 !! test
19448 Inline HTML vs wiki block nesting
19449 !! wikitext
19450 <b>Bold paragraph
19451
19452 New wiki paragraph
19453 !! html/php
19454 <p><b>Bold paragraph
19455 </p><p>New wiki paragraph</b>
19456 </p>
19457 !! html/parsoid
19458 <p><b>Bold paragraph</b>
19459 </p><p>New wiki paragraph
19460 </p>
19461 !! end
19462
19463 # Original result was this:
19464 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19465 # </p>
19466 # While that might be marginally more intuitive, maybe, the six-apostrophe
19467 # construct is clearly pathological and the result stated here (which is what
19468 # the parser actually does) is about as reasonable as anything.
19469 !!test
19470 Mixing markup for italics and bold
19471 !! options
19472 !! wikitext
19473 '''bold''''''bold''bolditalics'''''
19474 !! html
19475 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19476 </p>
19477 !! end
19478
19479
19480 !! article
19481 Xyzzyx
19482 !! text
19483 Article for special page transclusion test
19484 !! endarticle
19485
19486 !! test
19487 Special page transclusion
19488 !! options
19489 !! wikitext
19490 {{Special:Prefixindex/Xyzzyx}}
19491 !! html
19492 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19493 </ul>
19494
19495 !! end
19496
19497 !! test
19498 Special page transclusion twice (T7021)
19499 !! options
19500 !! wikitext
19501 {{Special:Prefixindex/Xyzzyx}}
19502 {{Special:Prefixindex/Xyzzyx}}
19503 !! html
19504 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19505 </ul>
19506 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19507 </ul>
19508
19509 !! end
19510
19511 !! test
19512 Transclusion of default MediaWiki message
19513 !! wikitext
19514 {{MediaWiki:Mainpage}}
19515 !! html
19516 <p>Main Page
19517 </p>
19518 !! end
19519
19520 !! test
19521 Transclusion of nonexistent MediaWiki message
19522 !! wikitext
19523 {{MediaWiki:Mainpagexxx}}
19524 !! html
19525 <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>
19526 </p>
19527 !! end
19528
19529 !! test
19530 Transclusion of MediaWiki message with underscore
19531 !! wikitext
19532 {{MediaWiki:history_short}}
19533 !! html
19534 <p>History
19535 </p>
19536 !! end
19537
19538 !! test
19539 Transclusion of MediaWiki message with space
19540 !! wikitext
19541 {{MediaWiki:history short}}
19542 !! html
19543 <p>History
19544 </p>
19545 !! end
19546
19547 !! test
19548 Invalid header with following text
19549 !! wikitext
19550 = x = y
19551 !! html
19552 <p>= x = y
19553 </p>
19554 !! end
19555
19556
19557 !! test
19558 Section extraction test (section 0)
19559 !! options
19560 section=0
19561 !! wikitext
19562 start
19563 ==a==
19564 ===aa===
19565 ====aaa====
19566 ==b==
19567 ===ba===
19568 ===bb===
19569 ====bba====
19570 ===bc===
19571 ==c==
19572 ===ca===
19573 !! html/php
19574 start
19575 !! end
19576
19577 !! test
19578 Section extraction test (section 1)
19579 !! options
19580 section=1
19581 !! wikitext
19582 start
19583 ==a==
19584 ===aa===
19585 ====aaa====
19586 ==b==
19587 ===ba===
19588 ===bb===
19589 ====bba====
19590 ===bc===
19591 ==c==
19592 ===ca===
19593 !! html/php
19594 ==a==
19595 ===aa===
19596 ====aaa====
19597 !! end
19598
19599 !! test
19600 Section extraction test (section 2)
19601 !! options
19602 section=2
19603 !! wikitext
19604 start
19605 ==a==
19606 ===aa===
19607 ====aaa====
19608 ==b==
19609 ===ba===
19610 ===bb===
19611 ====bba====
19612 ===bc===
19613 ==c==
19614 ===ca===
19615 !! html/php
19616 ===aa===
19617 ====aaa====
19618 !! end
19619
19620 !! test
19621 Section extraction test (section 3)
19622 !! options
19623 section=3
19624 !! wikitext
19625 start
19626 ==a==
19627 ===aa===
19628 ====aaa====
19629 ==b==
19630 ===ba===
19631 ===bb===
19632 ====bba====
19633 ===bc===
19634 ==c==
19635 ===ca===
19636 !! html/php
19637 ====aaa====
19638 !! end
19639
19640 !! test
19641 Section extraction test (section 4)
19642 !! options
19643 section=4
19644 !! wikitext
19645 start
19646 ==a==
19647 ===aa===
19648 ====aaa====
19649 ==b==
19650 ===ba===
19651 ===bb===
19652 ====bba====
19653 ===bc===
19654 ==c==
19655 ===ca===
19656 !! html/php
19657 ==b==
19658 ===ba===
19659 ===bb===
19660 ====bba====
19661 ===bc===
19662 !! end
19663
19664 !! test
19665 Section extraction test (section 5)
19666 !! options
19667 section=5
19668 !! wikitext
19669 start
19670 ==a==
19671 ===aa===
19672 ====aaa====
19673 ==b==
19674 ===ba===
19675 ===bb===
19676 ====bba====
19677 ===bc===
19678 ==c==
19679 ===ca===
19680 !! html/php
19681 ===ba===
19682 !! end
19683
19684 !! test
19685 Section extraction test (section 6)
19686 !! options
19687 section=6
19688 !! wikitext
19689 start
19690 ==a==
19691 ===aa===
19692 ====aaa====
19693 ==b==
19694 ===ba===
19695 ===bb===
19696 ====bba====
19697 ===bc===
19698 ==c==
19699 ===ca===
19700 !! html/php
19701 ===bb===
19702 ====bba====
19703 !! end
19704
19705 !! test
19706 Section extraction test (section 7)
19707 !! options
19708 section=7
19709 !! wikitext
19710 start
19711 ==a==
19712 ===aa===
19713 ====aaa====
19714 ==b==
19715 ===ba===
19716 ===bb===
19717 ====bba====
19718 ===bc===
19719 ==c==
19720 ===ca===
19721 !! html/php
19722 ====bba====
19723 !! end
19724
19725 !! test
19726 Section extraction test (section 8)
19727 !! options
19728 section=8
19729 !! wikitext
19730 start
19731 ==a==
19732 ===aa===
19733 ====aaa====
19734 ==b==
19735 ===ba===
19736 ===bb===
19737 ====bba====
19738 ===bc===
19739 ==c==
19740 ===ca===
19741 !! html/php
19742 ===bc===
19743 !! end
19744
19745 !! test
19746 Section extraction test (section 9)
19747 !! options
19748 section=9
19749 !! wikitext
19750 start
19751 ==a==
19752 ===aa===
19753 ====aaa====
19754 ==b==
19755 ===ba===
19756 ===bb===
19757 ====bba====
19758 ===bc===
19759 ==c==
19760 ===ca===
19761 !! html/php
19762 ==c==
19763 ===ca===
19764 !! end
19765
19766 !! test
19767 Section extraction test (section 10)
19768 !! options
19769 section=10
19770 !! wikitext
19771 start
19772 ==a==
19773 ===aa===
19774 ====aaa====
19775 ==b==
19776 ===ba===
19777 ===bb===
19778 ====bba====
19779 ===bc===
19780 ==c==
19781 ===ca===
19782 !! html/php
19783 ===ca===
19784 !! end
19785
19786 !! test
19787 Section extraction test (nonexistent section 11)
19788 !! options
19789 section=11
19790 !! wikitext
19791 start
19792 ==a==
19793 ===aa===
19794 ====aaa====
19795 ==b==
19796 ===ba===
19797 ===bb===
19798 ====bba====
19799 ===bc===
19800 ==c==
19801 ===ca===
19802 !! html/php
19803 !! end
19804
19805 !! test
19806 Section extraction test with bogus heading (section 1)
19807 !! options
19808 section=1
19809 !! wikitext
19810 ==a==
19811 ==bogus== not a legal section
19812 ==b==
19813 !! html/php
19814 ==a==
19815 ==bogus== not a legal section
19816 !! end
19817
19818 !! test
19819 Section extraction test with bogus heading (section 2)
19820 !! options
19821 section=2
19822 !! wikitext
19823 ==a==
19824 ==bogus== not a legal section
19825 ==b==
19826 !! html/php
19827 ==b==
19828 !! end
19829
19830 !! test
19831 Section extraction test with comment after heading (section 1)
19832 !! options
19833 section=1
19834 !! wikitext
19835 ==a==
19836 ==b== <!-- -->
19837 ==c==
19838 !! html/php
19839 ==a==
19840 !! end
19841
19842 !! test
19843 Section extraction test with comment after heading (section 2)
19844 !! options
19845 section=2
19846 !! wikitext
19847 ==a==
19848 ==b== <!-- -->
19849 ==c==
19850 !! html/php
19851 ==b== <!-- -->
19852 !! end
19853
19854 !! test
19855 Section extraction test with bogus <nowiki> heading (section 1)
19856 !! options
19857 section=1
19858 !! wikitext
19859 ==a==
19860 ==bogus== <nowiki>not a legal section</nowiki>
19861 ==b==
19862 !! html/php
19863 ==a==
19864 ==bogus== <nowiki>not a legal section</nowiki>
19865 !! end
19866
19867 !! test
19868 Section extraction test with bogus <nowiki> heading (section 2)
19869 !! options
19870 section=2
19871 !! wikitext
19872 ==a==
19873 ==bogus== <nowiki>not a legal section</nowiki>
19874 ==b==
19875 !! html/php
19876 ==b==
19877 !! end
19878
19879 # Formerly testing for T4587, now resolved by the use of unmarked sections
19880 # instead of respecting commented sections
19881 !! test
19882 Section extraction prefixed by comment (section 1)
19883 !! options
19884 section=1
19885 !! wikitext
19886 <!-- -->==sec1==
19887 ==sec2==
19888 !! html/php
19889 ==sec2==
19890 !!end
19891
19892 !! test
19893 Section extraction prefixed by comment (section 2)
19894 !! options
19895 section=2
19896 !! wikitext
19897 <!-- -->==sec1==
19898 ==sec2==
19899 !! html/php
19900
19901 !!end
19902
19903 # Formerly testing for T4607, now resolved by the use of unmarked sections
19904 # instead of respecting HTML-style headings
19905 !! test
19906 Section extraction, mixed wiki and html (section 1)
19907 !! options
19908 section=1
19909 !! wikitext
19910 <h2>unmarked</h2>
19911 unmarked
19912 ==1==
19913 one
19914 ==2==
19915 two
19916 !! html/php
19917 ==1==
19918 one
19919 !! end
19920
19921 !! test
19922 Section extraction, mixed wiki and html (section 2)
19923 !! options
19924 section=2
19925 !! wikitext
19926 <h2>unmarked</h2>
19927 unmarked
19928 ==1==
19929 one
19930 ==2==
19931 two
19932 !! html/php
19933 ==2==
19934 two
19935 !! end
19936
19937
19938 # Formerly testing for T5342
19939 !! test
19940 Section extraction, heading surrounded by <noinclude>
19941 !! options
19942 section=1
19943 !! wikitext
19944 <noinclude>==unmarked==</noinclude>
19945 ==marked==
19946 !! html/php
19947 ==marked==
19948 !!end
19949
19950 # Test behavior of T21910
19951 !! test
19952 Sectiion with all-equals
19953 !! options
19954 section=2
19955 !! wikitext
19956 ===
19957 The line above must have a trailing space
19958 === <!--
19959 --> <!-- -->
19960 But just in case it doesn't...
19961 !! html/php
19962 === <!--
19963 --> <!-- -->
19964 But just in case it doesn't...
19965 !! end
19966
19967 !! test
19968 Section replacement test (section 0)
19969 !! options
19970 replace=0,"xxx"
19971 !! wikitext
19972 start
19973 ==a==
19974 ===aa===
19975 ====aaa====
19976 ==b==
19977 ===ba===
19978 ===bb===
19979 ====bba====
19980 ===bc===
19981 ==c==
19982 ===ca===
19983 !! html/php
19984 xxx
19985
19986 ==a==
19987 ===aa===
19988 ====aaa====
19989 ==b==
19990 ===ba===
19991 ===bb===
19992 ====bba====
19993 ===bc===
19994 ==c==
19995 ===ca===
19996 !! end
19997
19998 !! test
19999 Section replacement test (section 1)
20000 !! options
20001 replace=1,"xxx"
20002 !! wikitext
20003 start
20004 ==a==
20005 ===aa===
20006 ====aaa====
20007 ==b==
20008 ===ba===
20009 ===bb===
20010 ====bba====
20011 ===bc===
20012 ==c==
20013 ===ca===
20014 !! html/php
20015 start
20016 xxx
20017
20018 ==b==
20019 ===ba===
20020 ===bb===
20021 ====bba====
20022 ===bc===
20023 ==c==
20024 ===ca===
20025 !! end
20026
20027 !! test
20028 Section replacement test (section 2)
20029 !! options
20030 replace=2,"xxx"
20031 !! wikitext
20032 start
20033 ==a==
20034 ===aa===
20035 ====aaa====
20036 ==b==
20037 ===ba===
20038 ===bb===
20039 ====bba====
20040 ===bc===
20041 ==c==
20042 ===ca===
20043 !! html/php
20044 start
20045 ==a==
20046 xxx
20047
20048 ==b==
20049 ===ba===
20050 ===bb===
20051 ====bba====
20052 ===bc===
20053 ==c==
20054 ===ca===
20055 !! end
20056
20057 !! test
20058 Section replacement test (section 3)
20059 !! options
20060 replace=3,"xxx"
20061 !! wikitext
20062 start
20063 ==a==
20064 ===aa===
20065 ====aaa====
20066 ==b==
20067 ===ba===
20068 ===bb===
20069 ====bba====
20070 ===bc===
20071 ==c==
20072 ===ca===
20073 !! html/php
20074 start
20075 ==a==
20076 ===aa===
20077 xxx
20078
20079 ==b==
20080 ===ba===
20081 ===bb===
20082 ====bba====
20083 ===bc===
20084 ==c==
20085 ===ca===
20086 !! end
20087
20088 !! test
20089 Section replacement test (section 4)
20090 !! options
20091 replace=4,"xxx"
20092 !! wikitext
20093 start
20094 ==a==
20095 ===aa===
20096 ====aaa====
20097 ==b==
20098 ===ba===
20099 ===bb===
20100 ====bba====
20101 ===bc===
20102 ==c==
20103 ===ca===
20104 !! html/php
20105 start
20106 ==a==
20107 ===aa===
20108 ====aaa====
20109 xxx
20110
20111 ==c==
20112 ===ca===
20113 !! end
20114
20115 !! test
20116 Section replacement test (section 5)
20117 !! options
20118 replace=5,"xxx"
20119 !! wikitext
20120 start
20121 ==a==
20122 ===aa===
20123 ====aaa====
20124 ==b==
20125 ===ba===
20126 ===bb===
20127 ====bba====
20128 ===bc===
20129 ==c==
20130 ===ca===
20131 !! html/php
20132 start
20133 ==a==
20134 ===aa===
20135 ====aaa====
20136 ==b==
20137 xxx
20138
20139 ===bb===
20140 ====bba====
20141 ===bc===
20142 ==c==
20143 ===ca===
20144 !! end
20145
20146 !! test
20147 Section replacement test (section 6)
20148 !! options
20149 replace=6,"xxx"
20150 !! wikitext
20151 start
20152 ==a==
20153 ===aa===
20154 ====aaa====
20155 ==b==
20156 ===ba===
20157 ===bb===
20158 ====bba====
20159 ===bc===
20160 ==c==
20161 ===ca===
20162 !! html/php
20163 start
20164 ==a==
20165 ===aa===
20166 ====aaa====
20167 ==b==
20168 ===ba===
20169 xxx
20170
20171 ===bc===
20172 ==c==
20173 ===ca===
20174 !! end
20175
20176 !! test
20177 Section replacement test (section 7)
20178 !! options
20179 replace=7,"xxx"
20180 !! wikitext
20181 start
20182 ==a==
20183 ===aa===
20184 ====aaa====
20185 ==b==
20186 ===ba===
20187 ===bb===
20188 ====bba====
20189 ===bc===
20190 ==c==
20191 ===ca===
20192 !! html/php
20193 start
20194 ==a==
20195 ===aa===
20196 ====aaa====
20197 ==b==
20198 ===ba===
20199 ===bb===
20200 xxx
20201
20202 ===bc===
20203 ==c==
20204 ===ca===
20205 !! end
20206
20207 !! test
20208 Section replacement test (section 8)
20209 !! options
20210 replace=8,"xxx"
20211 !! wikitext
20212 start
20213 ==a==
20214 ===aa===
20215 ====aaa====
20216 ==b==
20217 ===ba===
20218 ===bb===
20219 ====bba====
20220 ===bc===
20221 ==c==
20222 ===ca===
20223 !! html/php
20224 start
20225 ==a==
20226 ===aa===
20227 ====aaa====
20228 ==b==
20229 ===ba===
20230 ===bb===
20231 ====bba====
20232 xxx
20233
20234 ==c==
20235 ===ca===
20236 !!end
20237
20238 !! test
20239 Section replacement test (section 9)
20240 !! options
20241 replace=9,"xxx"
20242 !! wikitext
20243 start
20244 ==a==
20245 ===aa===
20246 ====aaa====
20247 ==b==
20248 ===ba===
20249 ===bb===
20250 ====bba====
20251 ===bc===
20252 ==c==
20253 ===ca===
20254 !! html/php
20255 start
20256 ==a==
20257 ===aa===
20258 ====aaa====
20259 ==b==
20260 ===ba===
20261 ===bb===
20262 ====bba====
20263 ===bc===
20264 xxx
20265 !! end
20266
20267 !! test
20268 Section replacement test (section 10)
20269 !! options
20270 replace=10,"xxx"
20271 !! wikitext
20272 start
20273 ==a==
20274 ===aa===
20275 ====aaa====
20276 ==b==
20277 ===ba===
20278 ===bb===
20279 ====bba====
20280 ===bc===
20281 ==c==
20282 ===ca===
20283 !! html/php
20284 start
20285 ==a==
20286 ===aa===
20287 ====aaa====
20288 ==b==
20289 ===ba===
20290 ===bb===
20291 ====bba====
20292 ===bc===
20293 ==c==
20294 xxx
20295 !! end
20296
20297 !! test
20298 Section replacement test with initial whitespace (T15728)
20299 !! options
20300 replace=2,"xxx"
20301 !! wikitext
20302 Preformatted initial line
20303 ==a==
20304 ===a===
20305 !! html/php
20306 Preformatted initial line
20307 ==a==
20308 xxx
20309 !! end
20310
20311
20312 !! test
20313 Section extraction, heading followed by pre with 20 spaces (T8398)
20314 !! options
20315 section=1
20316 !! wikitext
20317 ==a==
20318 a
20319 !! html/php
20320 ==a==
20321 a
20322 !! end
20323
20324 !! test
20325 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20326 !! options
20327 section=1
20328 !! wikitext
20329 ==a==
20330 a
20331 !! html/php
20332 ==a==
20333 a
20334 !! end
20335
20336
20337 !! test
20338 Section extraction, <pre> around bogus header (T12309)
20339 !! options
20340 section=2
20341 !! wikitext
20342 == Section One ==
20343 <pre>
20344 =======
20345 </pre>
20346
20347 == Section Two ==
20348 stuff
20349 !! html/php
20350 == Section Two ==
20351 stuff
20352 !! end
20353
20354 !! test
20355 Section replacement, <pre> around bogus header (T12309)
20356 !! options
20357 replace=2,"xxx"
20358 !! wikitext
20359 == Section One ==
20360 <pre>
20361 =======
20362 </pre>
20363
20364 == Section Two ==
20365 stuff
20366 !! html/php
20367 == Section One ==
20368 <pre>
20369 =======
20370 </pre>
20371
20372 xxx
20373 !! end
20374
20375 !! test
20376 Handling of &#x0A; in URLs
20377 !! wikitext
20378 *irc://&#x0A;a
20379 !! html/php
20380 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20381
20382 !! html/parsoid
20383 <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>
20384 !! end
20385
20386 !! test
20387 Handling of %0A in URLs
20388 !! wikitext
20389 *irc://%0Aa
20390 !! html/php
20391 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20392
20393 !! html/parsoid
20394 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20395 !! end
20396
20397 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20398 !! test
20399 5 quotes, code coverage +1 line
20400 !! options
20401 parsoid=wt2html
20402 !! wikitext
20403 '''''
20404 !! html/php
20405 !! html/parsoid
20406 <b><i></i></b>
20407 !! end
20408
20409 # same html as previous, but wikitext adjusted to match parsoid html2wt
20410 # note that wt2html and html2html will put the <i> before the <b>
20411 !! test
20412 5 quotes, code coverage +1 line w/ nowiki (1)
20413 !! options
20414 parsoid=wt2wt,html2wt
20415 !! wikitext
20416 '''''<nowiki/>'''''
20417 !! html/php
20418 <p><i></i>
20419 </p>
20420 !! html/parsoid
20421 <p><b><i></i></b></p>
20422 !! end
20423
20424 # same as previous, just swapping the <i> and <b>
20425 !! test
20426 5 quotes, code coverage +1 line w/ nowiki (2)
20427 !! wikitext
20428 '''''<nowiki/>'''''
20429 !! html/php
20430 <p><i></i>
20431 </p>
20432 !! html/parsoid
20433 <p><i><b></b></i></p>
20434 !! end
20435
20436 !! test
20437 Special:Search page linking.
20438 !! wikitext
20439 {{Special:search}}
20440 !! html
20441 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20442 </p>
20443 !! end
20444
20445 !! test
20446 {{!}} is a magic word
20447 !! wikitext
20448 {{!}} is a magic word there and {{!}} is still a magic word here
20449 | is not a magic word here but {{!}} is still a magic word here
20450 !! html/php
20451 <p>| is a magic word there and | is still a magic word here
20452 | is not a magic word here but | is still a magic word here
20453 </p>
20454 !! html/parsoid
20455 <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
20456 | 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>
20457 !! end
20458
20459 !! test
20460 Say the magic word
20461 !! options
20462 title=[[Parser test]]
20463 !! wikitext
20464 *{{PAGENAME}}
20465 *{{PAGENAMEE}}
20466 *{{FULLPAGENAME}}
20467 *{{FULLPAGENAMEE}}
20468 *{{BASEPAGENAME}}
20469 *{{BASEPAGENAMEE}}
20470 *{{SUBPAGENAME}}
20471 *{{SUBPAGENAMEE}}
20472 *{{ROOTPAGENAME}}
20473 *{{ROOTPAGENAMEE}}
20474 *{{TALKPAGENAME}}
20475 *{{TALKPAGENAMEE}}
20476 *{{SUBJECTPAGENAME}}
20477 *{{SUBJECTPAGENAMEE}}
20478 *{{NAMESPACEE}}
20479 *{{NAMESPACE}}
20480 *{{NAMESPACENUMBER}}
20481 *{{TALKSPACE}}
20482 *{{TALKSPACEE}}
20483 *{{SUBJECTSPACE}}
20484 *{{SUBJECTSPACEE}}
20485 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20486 !! html
20487 <ul><li>Parser test</li>
20488 <li>Parser_test</li>
20489 <li>Parser test</li>
20490 <li>Parser_test</li>
20491 <li>Parser test</li>
20492 <li>Parser_test</li>
20493 <li>Parser test</li>
20494 <li>Parser_test</li>
20495 <li>Parser test</li>
20496 <li>Parser_test</li>
20497 <li>Talk:Parser test</li>
20498 <li>Talk:Parser_test</li>
20499 <li>Parser test</li>
20500 <li>Parser_test</li>
20501 <li></li>
20502 <li></li>
20503 <li>0</li>
20504 <li>Talk</li>
20505 <li>Talk</li>
20506 <li></li>
20507 <li></li>
20508 <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>
20509
20510 !! end
20511 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20512
20513 !! test
20514 Gallery with valid attributes
20515 !! wikitext
20516 <gallery type="123" summary="345">
20517 File:File:Foobar.jpg
20518 </gallery>
20519 !! html/php
20520 <ul class="gallery mw-gallery-traditional" type="123">
20521 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20522 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20523 <div class="gallerytext">
20524 </div>
20525 </div></li>
20526 </ul>
20527
20528 !! html/parsoid
20529 <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"}}'>
20530 <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>
20531 </ul>
20532 !! end
20533
20534 ## Parsoid thinks the "centre" here is a property, not a caption.
20535 !! test
20536 Gallery
20537 !! options
20538 parsoid={
20539 "modes": ["wt2html"],
20540 "nativeGallery": true
20541 }
20542 !! wikitext
20543 <gallery>
20544 image1.png |
20545 image2.gif|||||
20546
20547 image3|
20548 image4 |300px| centre
20549 image5.svg| http://///////
20550 [[x|xx]]]]
20551 * image6
20552 </gallery>
20553 !! html/php
20554 <ul class="gallery mw-gallery-traditional">
20555 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20556 <div class="thumb" style="height: 150px;">Image1.png</div>
20557 <div class="gallerytext">
20558 </div>
20559 </div></li>
20560 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20561 <div class="thumb" style="height: 150px;">Image2.gif</div>
20562 <div class="gallerytext">
20563 </div>
20564 </div></li>
20565 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20566 <div class="thumb" style="height: 150px;">Image3</div>
20567 <div class="gallerytext">
20568 </div>
20569 </div></li>
20570 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20571 <div class="thumb" style="height: 150px;">Image4</div>
20572 <div class="gallerytext">
20573 <pre>centre
20574 </pre>
20575 </div>
20576 </div></li>
20577 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20578 <div class="thumb" style="height: 150px;">Image5.svg</div>
20579 <div class="gallerytext">
20580 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20581 </p>
20582 </div>
20583 </div></li>
20584 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20585 <div class="thumb" style="height: 150px;">* image6</div>
20586 <div class="gallerytext">
20587 </div>
20588 </div></li>
20589 </ul>
20590
20591 !! html/parsoid
20592 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20593 <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>
20594 <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>
20595 <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>
20596 <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>
20597 <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>
20598 <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>
20599 </ul>
20600 !! end
20601
20602 !! test
20603 Gallery (with options, html)
20604 !! options
20605 parsoid={
20606 "modes": ["wt2html", "html2html"],
20607 "nativeGallery": true
20608 }
20609 !! wikitext
20610 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20611 File:Nonexistent.jpg|caption
20612 File:Nonexistent.jpg
20613 image:foobar.jpg|some '''caption''' [[Main Page]]
20614 image:foobar.jpg
20615 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20616 </gallery>
20617 !! html/php
20618 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20619 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20620 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20621 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20622 <div class="gallerytext">
20623 <p>caption
20624 </p>
20625 </div>
20626 </div></li>
20627 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20628 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20629 <div class="gallerytext">
20630 </div>
20631 </div></li>
20632 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20633 <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>
20634 <div class="gallerytext">
20635 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20636 </p>
20637 </div>
20638 </div></li>
20639 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20640 <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>
20641 <div class="gallerytext">
20642 </div>
20643 </div></li>
20644 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20645 <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>
20646 <div class="gallerytext">
20647 <p>blabla.
20648 </p>
20649 </div>
20650 </div></li>
20651 </ul>
20652
20653 !! html/parsoid
20654 <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":{}}'>
20655 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20656 <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>
20657 <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>
20658 <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>
20659 <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>
20660 <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>
20661 </ul>
20662 !! end
20663
20664 !! test
20665 Gallery (with options, extsrc)
20666 !! options
20667 parsoid={
20668 "nativeGallery": false
20669 }
20670 !! wikitext
20671 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20672 File:Nonexistent.jpg|caption
20673 File:Nonexistent.jpg
20674 image:foobar.jpg|some '''caption''' [[Main Page]]
20675 image:foobar.jpg
20676 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20677 </gallery>
20678 !! html/php
20679 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20680 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20681 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20682 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20683 <div class="gallerytext">
20684 <p>caption
20685 </p>
20686 </div>
20687 </div></li>
20688 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20689 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20690 <div class="gallerytext">
20691 </div>
20692 </div></li>
20693 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20694 <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>
20695 <div class="gallerytext">
20696 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20697 </p>
20698 </div>
20699 </div></li>
20700 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20701 <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>
20702 <div class="gallerytext">
20703 </div>
20704 </div></li>
20705 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20706 <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>
20707 <div class="gallerytext">
20708 <p>blabla.
20709 </p>
20710 </div>
20711 </div></li>
20712 </ul>
20713
20714 !! html/parsoid
20715 <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"}}'>
20716 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20717 <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>
20718 <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>
20719 <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>
20720 <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>
20721 <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>
20722 </ul>
20723 !! end
20724
20725 !! test
20726 Gallery (without px units)
20727 !! wikitext
20728 <gallery widths="70" heights="40">
20729 File:Foobar.jpg
20730 </gallery>
20731 !! html/php
20732 <ul class="gallery mw-gallery-traditional">
20733 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20734 <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>
20735 <div class="gallerytext">
20736 </div>
20737 </div></li>
20738 </ul>
20739
20740 !! html/parsoid
20741 <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"}}'>
20742 <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>
20743 </ul>
20744 !! end
20745
20746 !! test
20747 Gallery (with invalid units)
20748 !! wikitext
20749 <gallery widths="70em" heights="40em">
20750 File:Foobar.jpg
20751 </gallery>
20752 !! html/php
20753 <ul class="gallery mw-gallery-traditional">
20754 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20755 <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>
20756 <div class="gallerytext">
20757 </div>
20758 </div></li>
20759 </ul>
20760
20761 !! html/parsoid
20762 <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"}}'>
20763 <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>
20764 </ul>
20765 !! end
20766
20767 !! test
20768 Gallery with link that has fragment
20769 !! options
20770 parsoid={
20771 "modes": ["wt2html", "html2html"],
20772 "nativeGallery": true
20773 }
20774 !! wikitext
20775 <gallery>
20776 image:foobar.jpg|link=Main_Page
20777 image:foobar.jpg|link=Main_Page#section
20778 image:foobar.jpg|link=Main Page#section|caption
20779 </gallery>
20780 !! html/php
20781 <ul class="gallery mw-gallery-traditional">
20782 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20783 <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>
20784 <div class="gallerytext">
20785 </div>
20786 </div></li>
20787 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20788 <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>
20789 <div class="gallerytext">
20790 </div>
20791 </div></li>
20792 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20793 <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>
20794 <div class="gallerytext">
20795 <p>caption
20796 </p>
20797 </div>
20798 </div></li>
20799 </ul>
20800
20801 !! html/parsoid
20802 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20803 <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>
20804 <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>
20805 <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>
20806 </ul>
20807 !! end
20808
20809 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20810 !! test
20811 Gallery with template inside caption
20812 !! options
20813 parsoid={
20814 "nativeGallery": true
20815 }
20816 !! wikitext
20817 <gallery caption="{{echo|hi}}">
20818 File:Foobar.jpg|{{echo|ho}}
20819 </gallery>
20820 !! html/php
20821 <ul class="gallery mw-gallery-traditional">
20822 <li class='gallerycaption'>{{echo|hi}}</li>
20823 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20824 <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>
20825 <div class="gallerytext">
20826 <p>ho
20827 </p>
20828 </div>
20829 </div></li>
20830 </ul>
20831
20832 !! html/parsoid
20833 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20834 <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>
20835 <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>
20836 </ul>
20837 !! end
20838
20839 !! test
20840 Gallery with wikitext inside caption
20841 !! options
20842 parsoid={
20843 "nativeGallery": true
20844 }
20845 !! wikitext
20846 <gallery>
20847 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20848 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20849 </gallery>
20850 !! html/php
20851 <ul class="gallery mw-gallery-traditional">
20852 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20853 <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>
20854 <div class="gallerytext">
20855 <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>
20856 </p>
20857 </div>
20858 </div></li>
20859 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20860 <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>
20861 <div class="gallerytext">
20862 <p>This is a test template
20863 </p>
20864 </div>
20865 </div></li>
20866 </ul>
20867
20868 !! html/parsoid
20869 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20870 <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>
20871 <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>
20872 </ul>
20873 !! end
20874
20875 !! test
20876 Gallery (with showfilename option)
20877 !! options
20878 parsoid={
20879 "nativeGallery": true
20880 }
20881 !! wikitext
20882 <gallery showfilename="">
20883 File:Nonexistent.jpg|caption
20884 File:Nonexistent.jpg
20885 File:Foobar.jpg|some '''caption''' [[Main Page]]
20886 File:Foobar.jpg
20887 </gallery>
20888 !! html/php
20889 <ul class="gallery mw-gallery-traditional">
20890 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20891 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20892 <div class="gallerytext">
20893 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20894 caption
20895 </p>
20896 </div>
20897 </div></li>
20898 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20899 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20900 <div class="gallerytext">
20901 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20902 </p>
20903 </div>
20904 </div></li>
20905 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20906 <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>
20907 <div class="gallerytext">
20908 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20909 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20910 </p>
20911 </div>
20912 </div></li>
20913 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20914 <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>
20915 <div class="gallerytext">
20916 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20917 </p>
20918 </div>
20919 </div></li>
20920 </ul>
20921
20922 !! html/parsoid
20923 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20924 <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>
20925 <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>
20926 <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>
20927 <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>
20928 </ul>
20929 !! end
20930
20931 ## Should Parsoid be preserving these variations? See T151367
20932 !! test
20933 Gallery (with namespace-less filenames)
20934 !! options
20935 parsoid={
20936 "modes": ["wt2html", "html2html"],
20937 "nativeGallery": true
20938 }
20939 !! wikitext
20940 <gallery>
20941 File:Nonexistent.jpg
20942 Nonexistent.jpg
20943 image:foobar.jpg
20944 foobar.jpg
20945 </gallery>
20946 !! html/php
20947 <ul class="gallery mw-gallery-traditional">
20948 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20949 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20950 <div class="gallerytext">
20951 </div>
20952 </div></li>
20953 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20954 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20955 <div class="gallerytext">
20956 </div>
20957 </div></li>
20958 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20959 <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>
20960 <div class="gallerytext">
20961 </div>
20962 </div></li>
20963 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20964 <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>
20965 <div class="gallerytext">
20966 </div>
20967 </div></li>
20968 </ul>
20969
20970 !! html/parsoid
20971 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20972 <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>
20973 <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>
20974 <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>
20975 <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>
20976 </ul>
20977 !! end
20978
20979 !! test
20980 Gallery override link with wikilink (T36852)
20981 !! options
20982 parsoid={
20983 "nativeGallery": true
20984 }
20985 !! wikitext
20986 <gallery>
20987 File:Foobar.jpg|alt=galleryalt|link=Wikilink
20988 </gallery>
20989 !! html/php
20990 <ul class="gallery mw-gallery-traditional">
20991 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20992 <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>
20993 <div class="gallerytext">
20994 </div>
20995 </div></li>
20996 </ul>
20997
20998 !! html/parsoid
20999 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21000 <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>
21001 </ul>
21002 !! end
21003
21004 !! test
21005 Gallery override link with absolute external link (T36852)
21006 !! options
21007 parsoid={
21008 "nativeGallery": true
21009 }
21010 !! wikitext
21011 <gallery>
21012 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
21013 </gallery>
21014 !! html/php
21015 <ul class="gallery mw-gallery-traditional">
21016 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21017 <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>
21018 <div class="gallerytext">
21019 </div>
21020 </div></li>
21021 </ul>
21022
21023 !! html/parsoid
21024 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21025 <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>
21026 </ul>
21027 !! end
21028
21029 !! test
21030 Gallery override link with absolute external link with LanguageConverter
21031 !! options
21032 language=zh
21033 !! wikitext
21034 <gallery>
21035 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21036 </gallery>
21037 !! html/php
21038 <ul class="gallery mw-gallery-traditional">
21039 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21040 <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>
21041 <div class="gallerytext">
21042 <p>caption
21043 </p>
21044 </div>
21045 </div></li>
21046 </ul>
21047
21048 !! html/parsoid
21049 <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"}}'>
21050 <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>
21051 </ul>
21052 !! end
21053
21054 !! test
21055 Gallery override link with malicious javascript (T36852)
21056 !! options
21057 parsoid={
21058 "modes": ["wt2html", "html2html"],
21059 "nativeGallery": true
21060 }
21061 !! wikitext
21062 <gallery>
21063 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21064 </gallery>
21065 !! html/php
21066 <ul class="gallery mw-gallery-traditional">
21067 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21068 <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>
21069 <div class="gallerytext">
21070 </div>
21071 </div></li>
21072 </ul>
21073
21074 !! html/parsoid
21075 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21076 <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>
21077 </ul>
21078 !! end
21079
21080 # Note that parsoid uses the invalid link as a caption, PHP does not.
21081 !! test
21082 Gallery with invalid title as link (T45964)
21083 !! options
21084 parsoid={
21085 "modes": ["wt2html", "html2html"],
21086 "nativeGallery": true
21087 }
21088 !! wikitext
21089 <gallery>
21090 File:Foobar.jpg|link=<
21091 </gallery>
21092 !! html/php
21093 <ul class="gallery mw-gallery-traditional">
21094 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21095 <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>
21096 <div class="gallerytext">
21097 </div>
21098 </div></li>
21099 </ul>
21100
21101 !! html/parsoid
21102 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21103 <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>
21104 </ul>
21105 !! end
21106
21107 !! test
21108 Serialize gallery without attrs in data-mw
21109 !! options
21110 parsoid={
21111 "modes": ["html2wt"],
21112 "nativeGallery": true
21113 }
21114 !! html/parsoid
21115 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
21116 <li class="gallerycaption">123</li>
21117 <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>
21118 </ul>
21119 !! wikitext
21120 <gallery caption="123">
21121 File:Test.png
21122 </gallery>
21123 !! end
21124
21125 !! test
21126 Gallery with class and style attributes
21127 !! options
21128 parsoid={
21129 "nativeGallery": true
21130 }
21131 !! wikitext
21132 <gallery class="center" style="text-align: center;">
21133 File:Foobar.jpg
21134 </gallery>
21135 !! html/php
21136 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
21137 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21138 <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>
21139 <div class="gallerytext">
21140 </div>
21141 </div></li>
21142 </ul>
21143
21144 !! html/parsoid
21145 <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":{}}'>
21146 <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>
21147 </ul>
21148 !! end
21149
21150 !! test
21151 Gallery in slideshow mode
21152 !! options
21153 parsoid={
21154 "nativeGallery": true
21155 }
21156 !! wikitext
21157 <gallery mode="slideshow" showthumbnails="">
21158 File:Foobar.jpg
21159 </gallery>
21160 !! html/php
21161 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
21162 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21163 <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>
21164 <div class="gallerytext">
21165 </div>
21166 </div></li>
21167 </ul>
21168
21169 !! html/parsoid
21170 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
21171 <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>
21172 </ul>
21173 !! end
21174
21175 !! test
21176 Serialize gallery image captions on a line
21177 !! options
21178 parsoid={
21179 "modes": ["html2wt"],
21180 "nativeGallery": true
21181 }
21182 !! html/parsoid
21183 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21184 <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>
21185 <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>
21186 </ul>
21187 !! wikitext
21188 <gallery>
21189 File:Foobar.jpg| hi ho
21190 File:Foobar.jpg|hi<br />ho
21191 </gallery>
21192 !! end
21193
21194 !! test
21195 HTML Hex character encoding (spells the word "JavaScript")
21196 !! options
21197 parsoid=wt2html,wt2wt,html2html
21198 !! wikitext
21199 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
21200 !! html/php
21201 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
21202 </p>
21203 !! html/parsoid
21204 <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>
21205 !! end
21206
21207 !! test
21208 HTML Hex character encoding bogus encoding (T28437 regression check)
21209 !! wikitext
21210 &#xsee;&#XSEE;
21211 !! html
21212 <p>&amp;#xsee;&amp;#XSEE;
21213 </p>
21214 !! end
21215
21216 !! test
21217 HTML Hex character encoding mixed case
21218 !! options
21219 parsoid=wt2html,wt2wt,html2html
21220 !! wikitext
21221 &#xEE;&#Xee;
21222 !! html/php
21223 <p>&#xee;&#xee;
21224 </p>
21225 !! html/parsoid
21226 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
21227 !! end
21228
21229 # See: https://www.w3.org/TR/html5/syntax.html#character-references
21230 # Note that U+000C (form feed) is not a valid XML character, so
21231 # it is banned even though allowed in HTML5.
21232 !! test
21233 Illegal character references (T106578)
21234 !! wikitext
21235 ; Null: &#00;
21236 ; FF: &#xC;
21237 ; CR: &#xD;
21238 ; Control (low): &#8;
21239 ; Control (high): &#x7F; &#x9F;
21240 ; Surrogate: &#xD83D;&#xDCA9;
21241 ; This is an okay astral character: &#x1F4A9;
21242 !! html+tidy
21243 <dl><dt>Null</dt>
21244 <dd>&amp;#00;</dd>
21245 <dt>FF</dt>
21246 <dd>&amp;#xC;</dd>
21247 <dt>CR</dt>
21248 <dd>&amp;#xD;</dd>
21249 <dt>Control (low)</dt>
21250 <dd>&amp;#8;</dd>
21251 <dt>Control (high)</dt>
21252 <dd>&amp;#x7F; &amp;#x9F;</dd>
21253 <dt>Surrogate</dt>
21254 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
21255 <dt>This is an okay astral character</dt>
21256 <dd>&#x1f4a9;</dd></dl>
21257 !! end
21258
21259 !! test
21260 __FORCETOC__ override
21261 !! wikitext
21262 __NEWSECTIONLINK__
21263 __FORCETOC__
21264 !! html/php
21265 <p><br />
21266 </p>
21267 !! end
21268
21269 !! test
21270 ISBN code coverage
21271 !! wikitext
21272 ISBN 978-0-1234-56&#x20;789
21273 !! html/php
21274 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21275 </p>
21276 !! html/parsoid
21277 <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>
21278 !! end
21279
21280 !! test
21281 ISBN followed by 5 spaces
21282 !! wikitext
21283 ISBN
21284 !! html
21285 <p>ISBN
21286 </p>
21287 !! end
21288
21289 !! test
21290 Double ISBN
21291 !! wikitext
21292 ISBN ISBN 1234567890
21293 !! html/php
21294 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21295 </p>
21296 !! html/parsoid
21297 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21298 !! end
21299
21300 # Uppercase X and lowercase x as well
21301 !! test
21302 ISBN with an X
21303 !! wikitext
21304 ISBN 3-462-04561-X
21305 ISBN 3-462-04561-x
21306 ISBN 080442957X
21307 ISBN 080442957x
21308 ISBN 978080442957X
21309 ISBN 978080442957x
21310 !! html/php
21311 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21312 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21313 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21314 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21315 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21316 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21317 </p>
21318 !! html/parsoid
21319 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21320 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21321 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21322 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21323 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21324 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21325 !! end
21326
21327 !! test
21328 ISBN with empty prefix (parsoid test)
21329 !! wikitext
21330 ISBN 1234567890
21331 !! html/php
21332 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21333 </p>
21334 !! html/parsoid
21335 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21336 !! end
21337
21338 !! test
21339 T24905: <abbr> followed by ISBN followed by </a>
21340 !! wikitext
21341 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21342 !! html/php
21343 <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>
21344 </p>
21345 !! html/parsoid
21346 <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>
21347 !! end
21348
21349 !! test
21350 Double RFC
21351 !! wikitext
21352 RFC RFC 1234
21353 !! html/php
21354 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21355 </p>
21356 !! html/parsoid
21357 <p>RFC <a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
21358 !! end
21359
21360 !! test
21361 Double RFC with a wiki link
21362 !! wikitext
21363 RFC [[RFC 1234]]
21364 !! html/php
21365 <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>
21366 </p>
21367 !! html/parsoid
21368 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234" title="RFC 1234">RFC 1234</a></p>
21369 !! end
21370
21371 !! test
21372 RFC code coverage
21373 !! wikitext
21374 RFC 983&#x20;987
21375 !! html/php
21376 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21377 </p>
21378 !! html/parsoid
21379 <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>
21380 !! end
21381
21382 !! test
21383 Centre-aligned image
21384 !! wikitext
21385 [[Image:foobar.jpg|centre]]
21386 !! html/php
21387 <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>
21388
21389 !! html/parsoid
21390 <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>
21391 !! end
21392
21393 !! test
21394 None-aligned image
21395 !! wikitext
21396 [[Image:foobar.jpg|none]]
21397 !! html/php
21398 <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>
21399
21400 !! html/parsoid
21401 <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>
21402 !! end
21403
21404 !! test
21405 Width + Height sized image (using px) (height is ignored)
21406 !! wikitext
21407 [[Image:foobar.jpg|640x480px]]
21408 !! html/php
21409 <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>
21410 </p>
21411 !! html/parsoid
21412 <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>
21413 !! end
21414
21415 !! test
21416 Width-sized image (using px, no following whitespace)
21417 !! wikitext
21418 [[Image:foobar.jpg|640px]]
21419 !! html/php
21420 <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>
21421 </p>
21422 !! html/parsoid
21423 <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>
21424 !! end
21425
21426 !! test
21427 Width-sized image (using px, with following whitespace - test regression from r39467)
21428 !! wikitext
21429 [[Image:foobar.jpg|640px ]]
21430 !! html/php
21431 <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>
21432 </p>
21433 !! html/parsoid
21434 <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>
21435 !!end
21436
21437 !! test
21438 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21439 !! wikitext
21440 [[Image:foobar.jpg| 640px]]
21441 !! html/php
21442 <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>
21443 </p>
21444 !! html/parsoid
21445 <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>
21446 !! end
21447
21448 !! test
21449 Image with page parameter
21450 !! options
21451 djvu
21452 !! wikitext
21453 [[File:LoremIpsum.djvu|page=2]]
21454 !! html/php
21455 <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>
21456 </p>
21457 !! html/parsoid
21458 <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>
21459 !! end
21460
21461 !! test
21462 Another italics / bold test
21463 !! wikitext
21464 ''' ''x'
21465 !! html
21466 <pre>'<i> </i>x'
21467 </pre>
21468 !!end
21469
21470 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21471 !! test
21472 dt/dd/dl test
21473 !! wikitext
21474 :;;;::
21475 !! html/php
21476 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21477
21478 !! html/parsoid
21479 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21480
21481 !!end
21482
21483 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21484 !! test
21485 Images with the "|" character in the comment
21486 !! wikitext
21487 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21488 !! html/php
21489 <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>
21490
21491 !! html/parsoid
21492 <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>
21493 !! end
21494
21495 !! test
21496 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21497 !! wikitext
21498 <html><script>alert(1);</script></html>
21499 !! html
21500 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21501 </p>
21502 !! end
21503
21504 !! test
21505 HTML with raw HTML ($wgRawHtml==true)
21506 !! options
21507 wgRawHtml=1
21508 !! wikitext
21509 <html><script>alert(1);</script></html>
21510 !! html/php
21511 <p><script>alert(1);</script>
21512 </p>
21513 !! end
21514
21515 !! test
21516 Parents of subpages, one level up
21517 !! options
21518 subpage title=[[Subpage test/L1/L2/L3]]
21519 !! wikitext
21520 [[../|L2]]
21521 !! html
21522 <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>
21523 </p>
21524 !! end
21525
21526
21527 !! test
21528 Parents of subpages, one level up, not named
21529 !! options
21530 subpage title=[[Subpage test/L1/L2/L3]]
21531 !! wikitext
21532 [[../]]
21533 !! html
21534 <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>
21535 </p>
21536 !! end
21537
21538
21539
21540 !! test
21541 Parents of subpages, two levels up
21542 !! options
21543 subpage title=[[Subpage test/L1/L2/L3]]
21544 !! wikitext
21545 [[../../|L1]]2
21546
21547 [[../../|L1]]l
21548 !! html
21549 <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
21550 </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>
21551 </p>
21552 !! end
21553
21554 !! test
21555 Parents of subpages, two levels up, without trailing slash or name.
21556 !! options
21557 subpage title=[[Subpage test/L1/L2/L3]]
21558 !! wikitext
21559 [[../..]]
21560 !! html
21561 <p>[[../..]]
21562 </p>
21563 !! end
21564
21565 !! test
21566 Parents of subpages, two levels up, with lots of extra trailing slashes.
21567 !! options
21568 subpage title=[[Subpage test/L1/L2/L3]]
21569 !! wikitext
21570 [[../../////]]
21571 !! html
21572 <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>
21573 </p>
21574 !! end
21575
21576 !! article
21577 Subpage test/L1/L2/L3Sibling
21578 !! text
21579 Sibling article
21580 !! endarticle
21581
21582 !! test
21583 Transclusion of a sibling page (one level up)
21584 !! options
21585 subpage title=[[Subpage test/L1/L2/L3]]
21586 !! wikitext
21587 {{../L3Sibling}}
21588 !! html
21589 <p>Sibling article
21590 </p>
21591 !! end
21592
21593 !! test
21594 Transclusion of a child page
21595 !! options
21596 subpage title=[[Subpage test/L1/L2]]
21597 !! wikitext
21598 {{/L3Sibling}}
21599 !! html
21600 <p>Sibling article
21601 </p>
21602 !! end
21603
21604 # This is wt2html only in Parsoid because we add <nowiki>
21605 # because of {{..}} and we don't expect to fix that to
21606 # eliminate the nowikis selective for {{..}} markup.
21607 !! test
21608 Non-transclusion because of too many up levels
21609 !! options
21610 subpage title=[[Subpage test/L1/L2/L3]]
21611 parsoid=wt2html
21612 !! wikitext
21613 {{../../../../More than parent}}
21614 !! html/php
21615 <p>{{../../../../More than parent}}
21616 </p>
21617 !! html/parsoid
21618 <p>{{../../../../More than parent}}</p>
21619 !! end
21620
21621 !! test
21622 Definition list code coverage
21623 !! wikitext
21624 ;title :def
21625 ;title :def
21626 ;title:def
21627 !! html/php
21628 <dl><dt>title &#160;</dt>
21629 <dd>def</dd>
21630 <dt>title&#160;</dt>
21631 <dd>def</dd>
21632 <dt>title</dt>
21633 <dd>def</dd></dl>
21634
21635 !! html/parsoid
21636 <dl><dt>title <span typeof="mw:Placeholder"> </span></dt><dd>def</dd>
21637 <dt>title<span typeof="mw:Placeholder"> </span></dt><dd>def</dd>
21638 <dt>title</dt><dd>def</dd></dl>
21639 !! end
21640
21641 !! test
21642 Don't fall for the self-closing div
21643 !! wikitext
21644 <div>hello world</div/>
21645 !! html
21646 <div>hello world</div>
21647
21648 !! end
21649
21650 !! test
21651 MSGNW magic word
21652 !! wikitext
21653 {{MSGNW:msg}}
21654 !! html/php
21655 <p>&#91;&#91;:Template:Msg&#93;&#93;
21656 </p>
21657 !! end
21658
21659 !! test
21660 RAW magic word
21661 !! wikitext
21662 {{RAW:QUERTY}}
21663 !! html
21664 <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>
21665 </p>
21666 !! end
21667
21668 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21669 !! test
21670 Always escape literal '>' in output, not just after '<'
21671 !! wikitext
21672 ><>
21673 !! html
21674 <p>&gt;&lt;&gt;
21675 </p>
21676 !! end
21677
21678 !! test
21679 Template caching
21680 !! wikitext
21681 {{Test}}
21682 {{Test}}
21683 !! html
21684 <p>This is a test template
21685 This is a test template
21686 </p>
21687 !! end
21688
21689
21690 !! article
21691 MediaWiki:Fake
21692 !! text
21693 ==header==
21694 !! endarticle
21695
21696 !! test
21697 Inclusion of !userCanEdit() content
21698 !! wikitext
21699 {{MediaWiki:Fake}}
21700 !! html
21701 <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>
21702
21703 !! end
21704
21705
21706 !! test
21707 Out-of-order TOC heading levels
21708 !! wikitext
21709 ==2==
21710 ======6======
21711 ===3===
21712 =1=
21713 =====5=====
21714 ==2==
21715 !! html
21716 <div id="toc" class="toc"><input type="checkbox" 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>
21717 <ul>
21718 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21719 <ul>
21720 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21721 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21722 </ul>
21723 </li>
21724 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21725 <ul>
21726 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21727 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21728 </ul>
21729 </li>
21730 </ul>
21731 </div>
21732
21733 <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>
21734 <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>
21735 <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>
21736 <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>
21737 <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>
21738 <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>
21739
21740 !! end
21741
21742
21743 !! test
21744 ISBN with a dummy number
21745 !! wikitext
21746 ISBN ---
21747 !! html
21748 <p>ISBN ---
21749 </p>
21750 !! end
21751
21752
21753 !! test
21754 ISBN with space-delimited number
21755 !! wikitext
21756 ISBN 92 9017 032 8
21757 !! html/php
21758 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21759 </p>
21760 !! html/parsoid
21761 <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>
21762 !! end
21763
21764
21765 !! test
21766 ISBN with multiple spaces, no number
21767 !! wikitext
21768 ISBN foo
21769 !! html
21770 <p>ISBN foo
21771 </p>
21772 !! end
21773
21774
21775 !! test
21776 ISBN length
21777 !! wikitext
21778 ISBN 123456789
21779
21780 ISBN 1234567890
21781
21782 ISBN 12345678901
21783 !! html/php
21784 <p>ISBN 123456789
21785 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21786 </p><p>ISBN 12345678901
21787 </p>
21788 !! html/parsoid
21789 <p>ISBN 123456789</p>
21790
21791 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21792
21793 <p>ISBN 12345678901</p>
21794 !! end
21795
21796
21797 !! test
21798 ISBN with trailing year (T9110)
21799 !! wikitext
21800 ISBN 1-234-56789-0 - 2006
21801
21802 ISBN 1 234 56789 0 - 2006
21803 !! html/php
21804 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21805 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21806 </p>
21807 !! html/parsoid
21808 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21809
21810 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21811 !! end
21812
21813
21814 !! test
21815 anchorencode
21816 !! config
21817 wgFragmentMode=[ 'html5', 'legacy' ]
21818 !! wikitext
21819 {{anchorencode:foo bar©#%n}}
21820 !! html/php
21821 <p>foo_bar©#%n
21822 </p>
21823 !! html/parsoid
21824 <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>
21825 !! end
21826
21827 !! test
21828 anchorencode (legacy)
21829 !! config
21830 wgFragmentMode=[ 'legacy' ]
21831 !! wikitext
21832 {{anchorencode:foo bar©#%n}}
21833 !! html/php
21834 <p>foo_bar.C2.A9.23.25n
21835 </p>
21836 !! end
21837
21838 !! test
21839 anchorencode trims spaces
21840 !! config
21841 wgFragmentMode=[ 'html5', 'legacy' ]
21842 !! wikitext
21843 {{anchorencode: __pretty__please__}}
21844 !! html/php
21845 <p>pretty_please
21846 </p>
21847 !! html/parsoid
21848 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
21849 !! end
21850
21851 !! test
21852 anchorencode deals with links
21853 !! config
21854 wgFragmentMode=[ 'html5', 'legacy' ]
21855 !! wikitext
21856 {{anchorencode: [[hello|world]] [[hi]]}}
21857 !! html/php
21858 <p>world_hi
21859 </p>
21860 !! html/parsoid
21861 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
21862 !! end
21863
21864 !! test
21865 anchorencode deals with templates
21866 !! config
21867 wgFragmentMode=[ 'html5', 'legacy' ]
21868 !! wikitext
21869 {{anchorencode: {{Foo}} x}}
21870 !! html/php
21871 <p>FOO_x
21872 </p>
21873 !! html/parsoid
21874 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
21875 !! end
21876
21877 !! test
21878 anchorencode encodes like the TOC generator: (T20431)
21879 !! config
21880 wgFragmentMode=[ 'html5', 'legacy' ]
21881 !! wikitext
21882 ===_ +:.3A%3A _ &&amp;]] x===
21883 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
21884 __NOEDITSECTION__
21885 !! html/php
21886 <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>
21887 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
21888 </p>
21889 !! html/parsoid
21890 <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>
21891 <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>
21892 <meta property="mw:PageProp/noeditsection"/>
21893 !! end
21894
21895 !! test
21896 anchorencode encodes like the TOC generator: (T20431) (legacy)
21897 !! config
21898 wgFragmentMode=[ 'legacy' ]
21899 !! wikitext
21900 ===_ +:.3A%3A&&amp;]]===
21901 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21902 __NOEDITSECTION__
21903 !! html/php
21904 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21905 <p>.2B:.3A.253A.26.26.5D.5D
21906 </p>
21907 !! end
21908
21909 !! test
21910 T8200: blockquotes and paragraph formatting
21911 !! wikitext
21912 <blockquote>
21913 foo
21914 </blockquote>
21915
21916 bar
21917
21918 baz
21919 !! html
21920 <blockquote>
21921 <p>foo
21922 </p>
21923 </blockquote>
21924 <p>bar
21925 </p>
21926 <pre>baz
21927 </pre>
21928 !! end
21929
21930 !! test
21931 T10293: Use of center tag ruins paragraph formatting
21932 !! wikitext
21933 <center>
21934 foo
21935 </center>
21936
21937 bar
21938
21939 baz
21940 !! html
21941 <center>
21942 <p>foo
21943 </p>
21944 </center>
21945 <p>bar
21946 </p>
21947 <pre>baz
21948 </pre>
21949 !! end
21950
21951 !!test
21952 Parsing of overlapping (improperly nested) inline html tags
21953 !! wikitext
21954 <span><s>x</span></s>
21955 !! html/php
21956 <p><span><s>x&lt;/span&gt;</s></span>
21957 </p>
21958 !! html/parsoid
21959 <p><span><s>x</s></span>
21960 </p>
21961 !!end
21962
21963 ###
21964 ### Language variants related tests
21965 ###
21966
21967 # Parsoid does not mark self-links.
21968 # Parsoid does not convert links; PHP will do any necessary redirects.
21969
21970 !! test
21971 Self-link in language variants
21972 !! options
21973 title=[[Dunav]] language=sr
21974 !! wikitext
21975 Both [[Dunav]] and [[Дунав]] are names for this river.
21976 !! html/php
21977 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21978 </p>
21979 !! html/parsoid
21980 <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>
21981 !! end
21982
21983 !! article
21984 Дуна
21985 !! text
21986 content
21987 !! endarticle
21988
21989 !! test
21990 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21991 !! options
21992 title=[[Duna]] language=sr
21993 !! wikitext
21994 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21995 !! html/php
21996 <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.
21997 </p>
21998 !! html/parsoid
21999 <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>
22000 !! end
22001
22002 !! test
22003 Link to a section of a variant of this title shouldn't be parsed as self-link
22004 !! options
22005 title=[[Duna]] language=sr
22006 !! wikitext
22007 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
22008 !! html/php
22009 <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.
22010 </p>
22011 !! html/parsoid
22012 <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>
22013 !! end
22014
22015 !! test
22016 Link to pages in language variants
22017 !! options
22018 language=sr
22019 !! wikitext
22020 Main Page can be written as [[Маин Паге]]
22021 !! html/php
22022 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
22023 </p>
22024 !! html/parsoid
22025 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
22026 !! end
22027
22028
22029 !! test
22030 Multiple links to pages in language variants
22031 !! options
22032 language=sr
22033 !! wikitext
22034 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
22035 !! html/php
22036 <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>.
22037 </p>
22038 !! html/parsoid
22039 <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>
22040 !! end
22041
22042
22043 !! test
22044 Simple template in language variants
22045 !! options
22046 language=sr
22047 !! wikitext
22048 {{тест}}
22049 !! html/php
22050 <p>This is a test template
22051 </p>
22052 !! end
22053
22054
22055 !! test
22056 Template with explicit namespace in language variants
22057 !! options
22058 language=sr
22059 !! wikitext
22060 {{Template:тест}}
22061 !! html/php
22062 <p>This is a test template
22063 </p>
22064 !! end
22065
22066
22067 !! test
22068 Basic test for template parameter in language variants
22069 !! options
22070 language=sr
22071 !! wikitext
22072 {{парамтест|param=foo}}
22073 !! html/php
22074 <p>This is a test template with parameter foo
22075 </p>
22076 !! end
22077
22078 !! test
22079 Simple category in language variants
22080 !! options
22081 language=sr cat
22082 !! wikitext
22083 [[Category:МедиаWики Усер'с Гуиде]]
22084 !! html/php
22085 cat=МедиаWики_Усер'с_Гуиде sort=
22086 !! html/parsoid
22087 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
22088 !! end
22089
22090 !! article
22091 Category:分类
22092 !! text
22093 blah
22094 !! endarticle
22095
22096 !! article
22097 Category:分類
22098 !! text
22099 blah
22100 !! endarticle
22101
22102 ## We used to, but no longer wt2wt this test since the default serializer
22103 ## will normalize all categories to serialize on their own line.
22104 ## This wikitext usage is going to be fairly uncommon in production and
22105 ## selser will take care of preserving formatting in those scenarios.
22106 !! test
22107 Don't convert blue categorylinks to another variant (T35210)
22108 !! options
22109 cat
22110 language=zh
22111 parsoid=wt2html
22112 !! wikitext
22113 [[A]][[Category:分类]]
22114 !! html/php
22115 cat=分类 sort=
22116 !! html/parsoid
22117 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
22118 <link rel="mw:PageProp/Category" href="./Category:分类"/>
22119 !! end
22120
22121 !! test
22122 Stripping -{}- tags (language variants)
22123 !! options
22124 language=sr
22125 !! wikitext
22126 Latin proverb: -{Ne nuntium necare}-
22127 !! html/php
22128 <p>Latin proverb: Ne nuntium necare
22129 </p>
22130 !! html/parsoid
22131 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22132 !! end
22133
22134
22135 !! test
22136 Prevent conversion with -{}- tags (language variants)
22137 !! options
22138 language=sr variant=sr-ec
22139 !! wikitext
22140 Latinski: -{Ne nuntium necare}-
22141 !! html/php
22142 <p>Латински: Ne nuntium necare
22143 </p>
22144 !! html/parsoid
22145 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22146 !! end
22147
22148
22149 !! test
22150 Prevent conversion of text with -{}- tags (language variants)
22151 !! options
22152 language=sr variant=sr-ec
22153 !! wikitext
22154 Latinski: -{Ne nuntium necare}-
22155 !! html/php
22156 <p>Латински: Ne nuntium necare
22157 </p>
22158 !! html/parsoid
22159 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22160 !! end
22161
22162
22163 !! test
22164 Prevent conversion of links with -{}- tags (language variants)
22165 !! options
22166 language=sr variant=sr-ec
22167 !! wikitext
22168 -{[[Main Page]]}-
22169 !! html/php
22170 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22171 </p>
22172 !! html/parsoid
22173 <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>
22174 !! end
22175
22176
22177 !! test
22178 -{}- tags within headlines (within html for parserConvert())
22179 !! config
22180 wgFragmentMode=[ 'html5', 'legacy' ]
22181 !! options
22182 language=sr variant=sr-ec
22183 !! wikitext
22184 ==-{Naslov}-==
22185
22186 Note that even an unprotected headline ID is not affected by language
22187 conversion:
22188
22189 ==Latinski==
22190 !! html/php
22191 <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>
22192 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
22193 цонверсион:
22194 </p>
22195 <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>
22196
22197 !! html/parsoid
22198 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
22199
22200 <p>Note that even an unprotected headline ID is not affected by language
22201 conversion:</p>
22202
22203 <h2 id="Latinski">Latinski</h2>
22204 !! end
22205
22206 !! test
22207 Explicit definition of language variant alternatives
22208 !! options
22209 language=zh variant=zh-tw
22210 !! wikitext
22211 -{zh:China;zh-tw:Taiwan}-, not China
22212 !! html/php
22213 <p>Taiwan, not China
22214 </p>
22215 !! html/parsoid
22216 <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>
22217 !! end
22218
22219 !! test
22220 Filter syntax for language variants
22221 !! options
22222 language=zh variant=zh-tw
22223 !! wikitext
22224 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
22225 !! html/php
22226 <p>fooblog, WEBJOURNAL, WEBLOGquux
22227 </p>
22228 !! html/parsoid
22229 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
22230 !! end
22231
22232 # Note that Parsoid post-processing for language variants needs to
22233 # update the `title` attribute here, based on the mw:ExpandedAttrs property
22234 !! test
22235 Conversion around HTML tags
22236 !! options
22237 language=sr variant=sr-ec
22238 !! wikitext
22239 -{H|span=>sr-ec:script;title=>sr-ec:src}-
22240 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
22241 !! html/php
22242 <p>
22243 <span title="ЛаCтин">ски</span>
22244 </p>
22245 !! html/parsoid
22246 <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"}]}'/>
22247 <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>
22248 !! end
22249
22250 !! test
22251 Explicit session-wise two-way language variant mapping (A flag and - flag)
22252 !! options
22253 language=zh variant=zh-tw
22254 !! wikitext
22255 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
22256
22257 Taiwan is not China.
22258
22259 But -{A|zh:China; zh-tw:Taiwan}- is China,
22260
22261 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
22262
22263 and -{China}- is China.
22264 !! html/php
22265 <p>This is Taiwan, but we'll forget that now.
22266 </p><p>Taiwan is not China.
22267 </p><p>But Taiwan is Taiwan,
22268 </p><p>(This should be stripped!)
22269 </p><p>and China is China.
22270 </p>
22271 !! html/parsoid
22272 <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>
22273 <p>Taiwan is not China.</p>
22274 <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>
22275 <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>
22276 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22277 !! end
22278
22279 !! test
22280 Explicit session-wise one-way language variant mapping (A flag and - flag)
22281 !! options
22282 language=zh variant=zh-tw
22283 !! wikitext
22284 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
22285
22286 COUNTRY is China or Taiwan.
22287
22288 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
22289
22290 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22291
22292 and -{COUNTRY}- is COUNTRY.
22293 !! html/php
22294 <p>This is Taiwan, but we'll forget that now.
22295 </p><p>COUNTRY is China or Taiwan.
22296 </p><p>But Taiwan is Taiwan,
22297 </p><p>(This should be stripped!)
22298 </p><p>and COUNTRY is COUNTRY.
22299 </p>
22300 !! html/parsoid
22301 <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>
22302 <p>COUNTRY is China or Taiwan.</p>
22303 <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>
22304 <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>
22305 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22306 !! end
22307
22308 !! test
22309 Explicit session-wise two-way language variant mapping (H flag for hide)
22310 !! options
22311 language=zh variant=zh-tw
22312 !! wikitext
22313 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22314
22315 Taiwan is China.
22316 !! html/php
22317 <p>(This should be stripped!)
22318 </p><p>Taiwan is Taiwan.
22319 </p>
22320 !! html/parsoid
22321 <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>
22322 <p>Taiwan is China.</p>
22323 !! end
22324
22325 !! test
22326 Explicit session-wise one-way language variant mapping (H flag for hide)
22327 !! options
22328 language=zh variant=zh-tw
22329 !! wikitext
22330 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22331
22332 COUNTRY is Taiwan or China.
22333 !! html/php
22334 <p>(This should be stripped!)
22335 </p><p>Taiwan is Taiwan or China.
22336 </p>
22337 !! html/parsoid
22338 <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>
22339 <p>COUNTRY is Taiwan or China.</p>
22340 !! end
22341
22342 ## Note that parsoid test runner does not support 'showtitle' option.
22343 !! test
22344 Adding explicit conversion rule for title (T flag)
22345 !! options
22346 language=zh variant=zh-tw showtitle
22347 !! wikitext
22348 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22349
22350 Taiwan is China.
22351 !! html/php
22352 Taiwan
22353 <p>Should be stripped!
22354 </p><p>Taiwan is China.
22355 </p>
22356 !! html/parsoid
22357 <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>
22358 <p>Taiwan is China.</p>
22359 !! end
22360
22361 !! test
22362 Code coverage: T combined with H flag
22363 !! options
22364 language=zh variant=zh-tw showtitle
22365 !! wikitext
22366 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22367
22368 Taiwan is China.
22369 !! html/php
22370 Taiwan
22371 <p>Should be stripped!
22372 </p><p>Taiwan is Taiwan.
22373 </p>
22374 !! html/parsoid
22375 <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>
22376 <p>Taiwan is China.</p>
22377 !! end
22378
22379 !! test
22380 Code coverage: T with no variants
22381 !! options
22382 language=zh variant=zh-tw showtitle
22383 !! wikitext
22384 -{H|zh:China; zh-tw:Taiwan}-
22385 Taiwan is China.-{T|Taiwan is China}-
22386 !! html/php
22387 Taiwan is China
22388 <p>
22389 Taiwan is Taiwan.
22390 </p>
22391 !! html/parsoid
22392 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22393 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22394 !! end
22395
22396 !! test
22397 Code coverage: rules with no variants
22398 !! options
22399 language=zh variant=zh-tw
22400 !! wikitext
22401 -{H|zh:China; zh-tw:Taiwan}-
22402 Taiwan is China.
22403 -{H|China}-
22404 Taiwan is China.
22405 !! html/php
22406 <p>
22407 Taiwan is Taiwan.
22408
22409 Taiwan is China.
22410 </p>
22411 !! html/parsoid
22412 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22413 Taiwan is China.
22414 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22415 Taiwan is China.</p>
22416 !! end
22417
22418
22419 !! test
22420 Code coverage: D flag for conversion rule
22421 !! options
22422 language=zh variant=zh-tw
22423 !! wikitext
22424 -{D|zh-cn:XA; zh-tw:YA}-
22425 -{A;D|zh-cn:XB; zh-tw:YB}-
22426 -{D;H|zh-cn:XC; zh-tw:YC}-
22427
22428 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22429
22430 -{D|0=>zh-tw:1}-
22431 -{A;D|2=>zh-tw:3}-
22432 -{D;H|4=>zh-tw:5}-
22433
22434 XA XB XC YA YB YC FOO BAR BAT 012345
22435 !! html/php
22436 <p>大陆:XA;台灣:YA;
22437
22438 大陆:XC;台灣:YC;
22439 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22440 </p><p>0⇒台灣:1;
22441
22442 4⇒台灣:5;
22443 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22444 </p>
22445 !! html/parsoid
22446 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22447 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22448 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22449 <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>
22450 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22451 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22452 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22453 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22454 !! end
22455
22456 !! test
22457 Code coverage: N flag for conversion rule
22458 !! options
22459 language=zh variant=zh-cn
22460 !! wikitext
22461 -{N|zh-cn}-
22462
22463 -{N|zh-tw}-
22464
22465 -{N|sr-ec}-
22466 !! html/php
22467 <p>大陆
22468 </p><p>台灣
22469 </p><p>српски (ћирилица)‎
22470 </p>
22471 !! html/parsoid
22472 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22473 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22474 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22475 !! end
22476
22477 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22478 !! test
22479 Code coverage: N flag for conversion rule (wt2html only)
22480 !! options
22481 language=zh variant=zh-cn
22482 parsoid=wt2html,html2html
22483 !! wikitext
22484 -{D;N|en}-
22485 !! html/php
22486 <p>English
22487 </p>
22488 !! html/parsoid
22489 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22490 !! end
22491
22492 !! test
22493 Testing that changing the language variant here in the tests actually works
22494 !! options
22495 language=zh variant=zh showtitle
22496 !! wikitext
22497 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22498 !! html/php
22499 China
22500 <p>Should be stripped!
22501 </p>
22502 !! html/parsoid
22503 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22504 !! end
22505
22506 !! test
22507 Recursive conversion of alt and title attrs shouldn't clear converter state
22508 !! options
22509 language=zh variant=zh-cn
22510 showtitle
22511 !! wikitext
22512 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22513 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22514 !! html/php
22515 China
22516 <p>
22517 Should be stripped<span title="Exclamation">!</span>
22518 </p>
22519 !! html/parsoid
22520 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22521 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>
22522 !! end
22523
22524 !! test
22525 T26072: more test on conversion rule for title
22526 !! options
22527 language=zh variant=zh-tw showtitle
22528 !! wikitext
22529 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22530
22531 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22532 !! html/php
22533 Taiwan
22534 <p>This should be stripped!
22535 </p><p>This won't take interferes with the title rule.
22536 </p>
22537 !! html/parsoid
22538 <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>
22539 <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>
22540 !! end
22541
22542 !! test
22543 Partly disable title conversion if variant == main language code
22544 !! options
22545 language=zh variant=zh title=[[ZH]] showtitle
22546 !! wikitext
22547 -{T|zh-cn:CN;zh-tw:TW}-
22548 !! html/php
22549 ZH
22550 <p>
22551 </p>
22552 !! html/parsoid
22553 <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>
22554 !! end
22555
22556 !! test
22557 Partly disable title conversion if variant == main language code, more
22558 !! options
22559 language=zh variant=zh title=[[ZH]] showtitle
22560 !! wikitext
22561 -{T|TW}-
22562 !! html/php
22563 ZH
22564 <p>
22565 </p>
22566 !! html/parsoid
22567 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22568 !! end
22569
22570 !! test
22571 Raw output of variant escape tags (R flag)
22572 !! options
22573 language=zh variant=zh-tw
22574 !! wikitext
22575 Raw: -{R|zh:China;zh-tw:Taiwan}-
22576 !! html/php
22577 <p>Raw: zh:China;zh-tw:Taiwan
22578 </p>
22579 !! html/parsoid
22580 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22581 !! end
22582
22583 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22584 !! test
22585 Raw output of variant escape tags (R flag) (wt2html only)
22586 !! options
22587 language=zh variant=zh-tw
22588 parsoid=wt2html,html2html
22589 !! wikitext
22590 -{Variant}- -{D|syntax}- -{D;R|options}-
22591 !! html/php
22592 <p>Variant syntax options
22593 </p>
22594 !! html/parsoid
22595 <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>
22596 !! end
22597
22598 !! test
22599 Nested markup inside raw output of variant escape tags (R flag)
22600 !! options
22601 language=zh variant=zh-tw
22602 !! wikitext
22603 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22604 !! html/php
22605 <p>Nested raw: nested Taiwan nested
22606 </p>
22607 !! html/parsoid
22608 <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>
22609 !! end
22610
22611 !! test
22612 Nested markup and spaces inside raw output of variant escape tags (R flag)
22613 !! options
22614 language=zh variant=zh-tw
22615 !! wikitext
22616 X-{ outer -{ inner }- outer }-X
22617 !! html/php
22618 <p>X outer inner outer X
22619 </p>
22620 !! html/parsoid
22621 <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>
22622 !! end
22623
22624 !! test
22625 Templates inside raw output of variant escape tags (R flag)
22626 !! options
22627 language=zh variant=zh-tw
22628 !! wikitext
22629 Nested raw: -{R|nested {{echo|hi}} templates}-
22630 !! html/php
22631 <p>Nested raw: nested hi templates
22632 </p>
22633 !! html/parsoid
22634 <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>
22635 !! end
22636
22637 !! test
22638 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22639 !! options
22640 language=zh variant=zh-cn
22641 !! wikitext
22642 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22643 !! html/php
22644 <p>0
22645 </p>
22646 !! html/parsoid
22647 <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>
22648 !! end
22649
22650 !! test
22651 Conversion rules from [numeric-only string] to [something else] (T48634)
22652 !! options
22653 language=zh variant=zh-cn
22654 !! wikitext
22655 -{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
22656 !! html/php
22657 <p>D12345EE12345
22658 </p>
22659 !! html/parsoid
22660 <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>
22661 !! end
22662
22663 !! test
22664 Two-way converter rule entries with an empty value should be ignored (T53551)
22665 !! options
22666 language=zh variant=zh-cn
22667 !! wikitext
22668 -{H|zh-cn:foo;zh-tw:;}-foobar
22669 !! html/php
22670 <p>foobar
22671 </p>
22672 !! html/parsoid
22673 <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>
22674 !! end
22675
22676 !! test
22677 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22678 !! options
22679 language=zh variant=zh-cn
22680 !! wikitext
22681 -{H|=>zh-cn:foo;}-foobar
22682 !! html/php
22683 <p>foobar
22684 </p>
22685 !! html/parsoid
22686 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22687 !! end
22688
22689 !! test
22690 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22691 !! options
22692 language=zh variant=zh-cn
22693 !! wikitext
22694 -{H|}-foobar
22695 !! html/php
22696 <p>foobar
22697 </p>
22698 !! html/parsoid
22699 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22700 !! end
22701
22702 !! test
22703 Nested using of manual convert syntax
22704 !! options
22705 language=zh variant=zh-hk
22706 !! wikitext
22707 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22708 !! html/php
22709 <p>Nested: Hello Hong Kong!
22710 </p>
22711 !! html/parsoid
22712 <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>
22713 !! end
22714
22715 !! test
22716 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22717 !! options
22718 language=zh variant=zh-cn
22719 !! wikitext
22720 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22721 !! html/php
22722 <p><span title="X">A</span>
22723 </p>
22724 !! html/parsoid
22725 <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>
22726 !! end
22727
22728 !! test
22729 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22730 !! options
22731 language=zh variant=zh-cn
22732 !! wikitext
22733 -{<span title="-{X}-">A</span>}-
22734 !! html/php+disabled
22735 <p><span title="X">A</span>
22736 </p>
22737 !! html/parsoid
22738 <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>
22739 !! end
22740
22741 # Parsoid and PHP disagree on how to parse this example: Parsoid
22742 # insists that the content of a language converter element be a valid
22743 # DOM fragment or attribute string
22744 !! test
22745 Language converter markup with block content
22746 !! options
22747 language=zh variant=zh-cn
22748 !! wikitext
22749 <span>a-{b<div>c}-d
22750
22751 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22752
22753 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22754 !! html/php+tidy
22755 <span>ab<div>cd
22756 <span>ab<div>cd
22757 <span>ad
22758 </span></div></span></div></span>
22759 !! html/parsoid
22760 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</span></p><div typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"b&lt;div data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[10,16,5,0]}&#39;>c&lt;/div>"}}'></div><p>d</p>
22761
22762 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</span></p><div typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"b&lt;div data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[50,56,5,0]}&#39;>c&lt;/div>"}}'></div><p>d</p>
22763
22764 <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=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[82,89,6,0]}&#39;>y&lt;/span>"},{"f":"0","l":"zh-tw","t":"b&lt;div data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[100,106,5,0]}&#39;>c&lt;/div>"}]}'/>d</span></p>
22765 !! end
22766
22767 !! test
22768 LanguageConverter selser (1)
22769 !! options
22770 language=zh variant=zh-cn
22771 parsoid={
22772 "modes": ["wt2wt", "selser"],
22773 "changes": [
22774 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22775 ]
22776 }
22777 !! wikitext
22778 -{raw}-
22779 !! wikitext/edited
22780 -{edited}-
22781 !! end
22782
22783 !! test
22784 LanguageConverter selser (2)
22785 !! options
22786 language=zh variant=zh-cn
22787 parsoid={
22788 "modes": ["wt2wt", "selser"],
22789 "changes": [
22790 ["span[class='x']", "contents", "text", "-{foo}-"],
22791 ["a", "contents", "text", "-{"],
22792 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22793 ]
22794 }
22795 !! wikitext
22796 <span class="x">TEXT1</span>
22797 [http://example.com TEXT2]
22798 [[Foo|TEXT3]]
22799 {{echo|TEXT4}}
22800 !! wikitext/edited
22801 <span class="x"><nowiki>-{foo}-</nowiki></span>
22802 [http://example.com -{]
22803 [[Foo|<nowiki>-{</nowiki>]]
22804 {{1x|<nowiki>-{</nowiki>}}
22805 !! end
22806
22807 # Tests LanguageVariantText in ConstrainedText
22808 !! test
22809 LanguageConverter selser (3)
22810 !! options
22811 language=zh variant=zh-cn
22812 parsoid={
22813 "modes": ["wt2wt", "selser"],
22814 "changes": [
22815 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22816 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22817 ]
22818 }
22819 !! wikitext
22820 {|
22821 |-
22822 |<span>Foo</span>
22823 |}
22824 !! wikitext/edited
22825 {|
22826 |-
22827 |<nowiki/>-{edited}-
22828 |}
22829 !! end
22830
22831 # Tests LanguageVariantText._fromSelSer
22832 !! test
22833 LanguageConverter selser (4)
22834 !! options
22835 language=zh variant=zh-cn
22836 parsoid={
22837 "modes": ["wt2wt", "selser"],
22838 "changes": [
22839 ["td > span.x", "remove"]
22840 ]
22841 }
22842 !! wikitext
22843 {|
22844 |-
22845 |<span class="x">Foo</span>-{Bar}-
22846 ||<span class="x">Foo</span>-{Bar}-
22847 |}
22848 !! wikitext/edited
22849 {|
22850 |-
22851 |<nowiki/>-{Bar}-
22852 ||-{Bar}-
22853 |}
22854 !! end
22855
22856 # Since Parsoid is starting to emit canonical wikitext for links,
22857 # [http://example.com http://example.com] will not RT back to that
22858 # form anymore.
22859 # Parsoid does not language-convert links (it is done in a
22860 # post-processing step)
22861 !! test
22862 Proper conversion of text in external links
22863 !! options
22864 language=sr variant=sr-ec
22865 parsoid=wt2html
22866 !! wikitext
22867 http://www.google.com
22868 gopher://www.google.com
22869 [http://www.google.com http://www.google.com]
22870 [gopher://www.google.com gopher://www.google.com]
22871 [https://www.google.com irc://www.google.com]
22872 [ftp://www.google.com www.google.com/ftp://dir]
22873 [//www.google.com www.google.com]
22874 !! html/php
22875 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22876 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22877 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
22878 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22879 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22880 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22881 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22882 </p>
22883 !! html/parsoid
22884 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22885 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22886 <a rel="mw:ExtLink" class="external text" href="http://www.google.com">http://www.google.com</a>
22887 <a rel="mw:ExtLink" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22888 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
22889 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22890 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
22891 !! end
22892
22893 !! test
22894 Do not convert roman numbers to language variants
22895 !! options
22896 language=sr variant=sr-ec
22897 !! wikitext
22898 Fridrih IV je car.
22899 !! html/php
22900 <p>Фридрих IV је цар.
22901 </p>
22902 !! html/parsoid
22903 <p>Fridrih IV je car.</p>
22904 !! end
22905
22906 !! test
22907 Unclosed language converter markup "-{"
22908 !! options
22909 language=sr
22910 !! wikitext
22911 -{T|hello
22912 !! html
22913 <p>-{T|hello
22914 </p>
22915 !! end
22916
22917 !! test
22918 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22919 !! options
22920 language=sr
22921 !! wikitext
22922 -{R|=&gt;}-
22923 !! html/php
22924 <p>=&gt;
22925 </p>
22926 !! html/parsoid
22927 <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>
22928 !!end
22929
22930 !! test
22931 Don't break link parsing if language converter markup is in the caption.
22932 !! options
22933 language=sr variant=sr-ec
22934 !! wikitext
22935 [[Main Page|-{R|main page}-]]
22936 !! html/php
22937 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22938 </p>
22939 !! html/parsoid
22940 <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>
22941 !! end
22942
22943 !! test
22944 T146304: Don't break template parsing if language converter markup is in the parameter.
22945 !! options
22946 language=sr variant=sr-ec
22947 !! wikitext
22948 {{echo|-{R|foo}-}}
22949 !! html/php
22950 <p>foo
22951 </p>
22952 !! html/parsoid
22953 <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>
22954 !! end
22955
22956 !! test
22957 T146305: Don't break image parsing if language converter markup is in the caption.
22958 !! options
22959 language=sr
22960 !! wikitext
22961 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
22962 !! html/php
22963 <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>
22964
22965 !! html/parsoid
22966 <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>
22967 !! end
22968
22969 !! test
22970 T146305: Don't break image parsing if nested language converter markup is in the caption.
22971 !! options
22972 language=zh variant=zh-cn
22973 !! wikitext
22974 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
22975 !! html/php
22976 <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>
22977
22978 !! html/parsoid
22979 <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>
22980 !! end
22981
22982 # XXX html2wt disabled because rich markup in alt is not preserved.
22983 !! test
22984 Don't break gallery if language converter markup is inside.
22985 !! options
22986 language=zh
22987 !! wikitext
22988 <gallery>
22989 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
22990 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
22991 </gallery>
22992 !! html/php
22993 <ul class="gallery mw-gallery-traditional">
22994 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22995 <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>
22996 <div class="gallerytext">
22997 <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>
22998 </p>
22999 </div>
23000 </div></li>
23001 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23002 <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>
23003 <div class="gallerytext">
23004 <p>This is a test template
23005 </p>
23006 </div>
23007 </div></li>
23008 </ul>
23009
23010 !! html/parsoid
23011 <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"}}'>
23012 <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>
23013 <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>
23014 </ul>
23015 !! end
23016
23017 !! test
23018 T153135: Don't break list handling if language converter markup is in the item.
23019 !! options
23020 language=zh variant=zh-cn
23021 !! wikitext
23022 ;-{zh-cn:AAA;zh-tw:BBB}-
23023 ;-{R|foo:bar}-
23024 !! html/php
23025 <dl><dt>AAA</dt>
23026 <dt>foo:bar</dt></dl>
23027
23028 !! html/parsoid
23029 <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>
23030 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
23031 </dl>
23032 !! end
23033
23034 // Note that parsoid does not protect colons unless language converter
23035 // markup is properly nested, because it is a backtracking parser.
23036 !! test
23037 T153135: Unclosed markup in definition list (code coverage)
23038 !! options
23039 language=zh variant=zh-cn
23040 !! wikitext
23041 ;<b>foo:bar
23042 ;-{zh-cn:AAA
23043 !! html/php+tidy
23044 <dl><dt><b>foo:bar</b></dt><b>
23045 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
23046 </b></p>
23047 !! html/parsoid
23048 <dl><dt data-parsoid='{"dsr":[0,11,1,0]}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
23049 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
23050 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
23051 </b></dl>
23052 !! end
23053
23054 !! test
23055 T153135: Nested language converter markup in definition list (code coverage)
23056 !! options
23057 language=zh variant=zh-cn
23058 !! wikitext
23059 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
23060 !! html/php
23061 <dl><dt>AAA foo:bar bat:baz</dt>
23062 <dd>def</dd></dl>
23063
23064 !! html/parsoid
23065 <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>
23066 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
23067 </dl>
23068 !! end
23069
23070 # html2wt mode disabled due to <nowiki> insertion.
23071 !! test
23072 T153140: Don't break table handling if language converter markup is in the cell.
23073 !! options
23074 language=sr variant=sr-ec
23075 parsoid=wt2html,wt2wt,html2html
23076 !! wikitext
23077 {|
23078 |-
23079 | -{R|B}-
23080 |}
23081 !! html/php
23082 <table>
23083
23084 <tr>
23085 <td>B
23086 </td></tr></table>
23087
23088 !! html/parsoid
23089 <table>
23090 <tbody>
23091 <tr>
23092 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
23093 </tr>
23094 </tbody>
23095 </table>
23096 !! end
23097
23098 !! test
23099 Language converter tricky html2wt cases (1)
23100 !! options
23101 language=sr
23102 parsoid=html2wt,wt2wt
23103 !! html/parsoid
23104 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
23105 !! wikitext
23106 -{<nowiki>}-</nowiki>}-
23107 !! html/php
23108 <p>&#125;-
23109 </p>
23110 !! end
23111
23112 !! test
23113 Language converter tricky html2wt cases (2)
23114 !! options
23115 language=sr
23116 parsoid=html2wt,wt2wt
23117 !! html/parsoid
23118 <p>-{foo}-</p>
23119 !! wikitext
23120 <nowiki>-{foo}-</nowiki>
23121 !! html/php
23122 <p>-&#123;foo&#125;-
23123 </p>
23124 !! end
23125
23126 !! test
23127 Language converter tricky html2wt cases (3)
23128 !! options
23129 language=sr
23130 parsoid=html2wt,wt2wt
23131 !! html/parsoid
23132 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
23133 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
23134 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
23135 !! wikitext
23136 -{R||}-
23137
23138 -{R|R|raw}-
23139
23140 -{<nowiki>-{foo}-</nowiki>}-
23141 !! html/php
23142 <p>|
23143 </p><p>R|raw
23144 </p><p>-&#123;foo&#125;-
23145 </p>
23146 !! end
23147
23148 !! test
23149 Language converter tricky html2wt cases (4)
23150 !! options
23151 language=sr
23152 parsoid=html2wt,wt2wt
23153 !! html/parsoid
23154 <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>
23155 !! wikitext
23156 -{R|{{echo|hey}}}-
23157 !! html/php
23158 <p>hey
23159 </p>
23160 !! end
23161
23162 # Note that the <nowiki> escaping added by parsoid for source text,
23163 # destination text, and language names only works on the PHP side
23164 # for *destination text*. (HTML entity escaping wouldn't work
23165 # any better.) This is probably a bug, at least for source texts.
23166 # (For language names PHP uses a precise regexp based on the languages
23167 # it currently knows have variants, which is fragile since this set
23168 # can grow/shrink over time.)
23169 !! test
23170 Language converter tricky html2wt cases (5)
23171 !! options
23172 language=zh variant=zh-cn
23173 !! html/parsoid
23174 <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>
23175 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
23176 <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>
23177 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
23178 <p>a:b=>c xyz</p>
23179 !! wikitext
23180 -{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
23181
23182 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
23183
23184 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
23185
23186 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
23187
23188 a:b=>c xyz
23189 !! html/php+disabled
23190 <p>foobat;xyz=&gt;zh-cn:abc
23191 </p><p>A
23192 </p><p>0;zh-tw:bar
23193 </p><p>abc
23194 </p><p>a:b=&gt;c 0;zh-tw:bar
23195 </p>
23196 !! end
23197
23198 !! test
23199 T179579: Nowiki and lc interaction
23200 !! options
23201 parsoid=wt2html
23202 language=sr
23203 !! wikitext
23204 -{</nowiki>123}-
23205
23206 -{123<nowiki>|</nowiki>456}-
23207 !! html/parsoid
23208 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
23209
23210 <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>
23211 !! end
23212
23213 !! test
23214 T2529: Uncovered bullet
23215 !! wikitext
23216 *Foo {{bullet}}
23217 !! html
23218 <ul><li>Foo</li>
23219 <li>Bar</li></ul>
23220
23221 !! end
23222
23223 !! test
23224 T2529: Uncovered bullet in a deeply nested list
23225 !! wikitext
23226 *******Foo {{bullet}}
23227 !! html
23228 <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>
23229 <li>Bar</li></ul>
23230
23231 !! end
23232
23233 !! test
23234 T2529: Uncovered table already at line-start
23235 !! wikitext
23236 x
23237
23238 {{table}}
23239 y
23240 !! html
23241 <p>x
23242 </p>
23243 <table>
23244 <tr>
23245 <td>1</td>
23246 <td>2
23247 </td></tr>
23248 <tr>
23249 <td>3</td>
23250 <td>4
23251 </td></tr></table>
23252 <p>y
23253 </p>
23254 !! end
23255
23256 !! test
23257 T2529: Uncovered bullet in parser function result
23258 !! wikitext
23259 *Foo {{lc:{{bullet}} }}
23260 !! html
23261 <ul><li>Foo</li>
23262 <li>bar</li></ul>
23263
23264 !! end
23265
23266 !! test
23267 T7678: Double-parsed template argument
23268 !! wikitext
23269 {{lc:{{{1}}}|hello}}
23270 !! html
23271 <p>{{{1}}}
23272 </p>
23273 !! end
23274
23275 !! test
23276 T7678: Double-parsed template invocation
23277 !! wikitext
23278 {{lc:{{paramtest {{!}} param = hello }} }}
23279 !! html
23280 <p>{{paramtest | param = hello }}
23281 </p>
23282 !! end
23283
23284 !! test
23285 Case insensitivity of parser functions for non-ASCII characters (T10143)
23286 !! options
23287 language=cs
23288 title=[[Main Page]]
23289 !! wikitext
23290 {{PRVNÍVELKÉ:ěščř}}
23291 {{prvnívelké:ěščř}}
23292 {{PRVNÍMALÉ:ěščř}}
23293 {{prvnímalé:ěščř}}
23294 {{MALÁ:ěščř}}
23295 {{malá:ěščř}}
23296 {{VELKÁ:ěščř}}
23297 {{velká:ěščř}}
23298 !! html
23299 <p>Ěščř
23300 Ěščř
23301 ěščř
23302 ěščř
23303 ěščř
23304 ěščř
23305 ĚŠČŘ
23306 ĚŠČŘ
23307 </p>
23308 !! end
23309
23310 !! test
23311 Morwen/13: Unclosed link followed by heading
23312 !! wikitext
23313 [[link
23314 ==heading==
23315 !! html
23316 <p>[[link
23317 </p>
23318 <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>
23319
23320 !! end
23321
23322 !! test
23323 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23324 !! wikitext
23325 {{foo|
23326 =heading=
23327 !! html
23328 <p>{{foo|
23329 </p>
23330 <h1><span class="mw-headline" id="heading">heading</span></h1>
23331
23332 !! end
23333
23334 !! test
23335 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23336 !! wikitext
23337 {{foo|
23338 ==heading==
23339 !! html
23340 <p>{{foo|
23341 </p>
23342 <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>
23343
23344 !! end
23345
23346 !! test
23347 Tildes in comments
23348 !! options
23349 pst
23350 !! wikitext
23351 <!-- ~~~~ -->
23352 !! html/php
23353 <!-- ~~~~ -->
23354 !! end
23355
23356 !! test
23357 Paragraphs inside divs (no extra line breaks)
23358 !! wikitext
23359 <div>Line one
23360
23361 Line two</div>
23362 !! html
23363 <div>Line one
23364 Line two</div>
23365
23366 !! end
23367
23368 !! test
23369 Paragraphs inside divs (extra line break on open)
23370 !! wikitext
23371 <div>
23372 Line one
23373
23374 Line two</div>
23375 !! html
23376 <div>
23377 <p>Line one
23378 </p>
23379 Line two</div>
23380
23381 !! end
23382
23383 !! test
23384 Paragraphs inside divs (extra line break on close)
23385 !! wikitext
23386 <div>Line one
23387
23388 Line two
23389 </div>
23390 !! html
23391 <div>Line one
23392 <p>Line two
23393 </p>
23394 </div>
23395
23396 !! end
23397
23398 !! test
23399 Paragraphs inside divs (extra line break on open and close)
23400 !! wikitext
23401 <div>
23402 Line one
23403
23404 Line two
23405 </div>
23406 !! html
23407 <div>
23408 <p>Line one
23409 </p><p>Line two
23410 </p>
23411 </div>
23412
23413 !! end
23414
23415 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23416 # Parsoid seems to do a better job here since its p-wrapper is probably smarter.
23417 !! test
23418 Nesting tags, paragraphs on lines which begin with <div>
23419 !! wikitext
23420 <div></div><strong>A
23421 B</strong>
23422 !! html/php+tidy
23423 <div></div><p><strong>A
23424 </strong></p><strong></strong><p><strong>B</strong>
23425 </p>
23426 !! html/parsoid
23427 <div></div>
23428 <p><strong>A
23429 B</strong>
23430 </p>
23431 !! end
23432
23433 # T8200: <blockquote> should behave like <div> with respect to line breaks
23434 !! test
23435 T8200: paragraphs inside blockquotes (no extra line breaks)
23436 !! wikitext
23437 <blockquote>Line one
23438
23439 Line two</blockquote>
23440 !! html
23441 <blockquote>Line one
23442 Line two</blockquote>
23443
23444 !! html+tidy
23445 <blockquote><p>Line one
23446 Line two</p></blockquote>
23447 !! end
23448
23449 !! test
23450 T8200: paragraphs inside blockquotes (extra line break on open)
23451 !! wikitext
23452 <blockquote>
23453 Line one
23454
23455 Line two</blockquote>
23456 !! html
23457 <blockquote>
23458 <p>Line one
23459 </p>
23460 Line two</blockquote>
23461
23462 !! html+tidy
23463 <blockquote>
23464 <p>Line one
23465 </p><p>
23466 Line two</p></blockquote>
23467 !! end
23468
23469 # Parsoid's output is broken on this because of Tidy-compatibility cruft
23470 !! test
23471 T8200: paragraphs inside blockquotes (extra line break on close)
23472 !! wikitext
23473 <blockquote>Line one
23474
23475 Line two
23476 </blockquote>
23477 !! html
23478 <blockquote>Line one
23479 <p>Line two
23480 </p>
23481 </blockquote>
23482
23483 !! html+tidy
23484 <blockquote><p>Line one
23485 </p><p>Line two
23486 </p>
23487 </blockquote>
23488 !! end
23489
23490 !! test
23491 T8200: paragraphs inside blockquotes (extra line break on open and close)
23492 !! wikitext
23493 <blockquote>
23494 Line one
23495
23496 Line two
23497 </blockquote>
23498 !! html
23499 <blockquote>
23500 <p>Line one
23501 </p><p>Line two
23502 </p>
23503 </blockquote>
23504
23505 !! end
23506
23507 ## This is a corner case interaction between the paragraph wrapping in the
23508 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
23509 ## some tags which close paragraphs (and thus prevent wrapping on their line),
23510 ## of which "div" is one, but do p-wrapping inside them. These are referred
23511 ## to as "never suppressing". Remex, for its part, doesn't traverse into
23512 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
23513 !! test
23514 Paragraphs inside blockquotes/divs (no extra line breaks)
23515 !! wikitext
23516 <blockquote><div>Line one
23517
23518 Line two</div></blockquote>
23519 !! html
23520 <blockquote><div>Line one
23521 Line two</div></blockquote>
23522
23523 !! end
23524
23525 !! test
23526 Paragraphs inside blockquotes/divs (extra line break on open)
23527 !! wikitext
23528 <blockquote><div>
23529 Line one
23530
23531 Line two</div></blockquote>
23532 !! html
23533 <blockquote><div>
23534 <p>Line one
23535 </p>
23536 Line two</div></blockquote>
23537
23538 !! end
23539
23540 !! test
23541 Paragraphs inside blockquotes/divs (extra line break on close)
23542 !! wikitext
23543 <blockquote><div>Line one
23544
23545 Line two
23546 </div></blockquote>
23547 !! html
23548 <blockquote><div>Line one
23549 <p>Line two
23550 </p>
23551 </div></blockquote>
23552
23553 !! end
23554
23555 !! test
23556 Paragraphs inside blockquotes/divs (extra line break on open and close)
23557 !! wikitext
23558 <blockquote><div>
23559 Line one
23560
23561 Line two
23562 </div></blockquote>
23563 !! html
23564 <blockquote><div>
23565 <p>Line one
23566 </p><p>Line two
23567 </p>
23568 </div></blockquote>
23569
23570 !! end
23571
23572 !! test
23573 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23574 !! options
23575 wgLinkHolderBatchSize=0
23576 !! wikitext
23577 [[meatball:1]]
23578 [[meatball:2]]
23579 [[meatball:3]]
23580 !! html
23581 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23582 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23583 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23584 </p>
23585 !! end
23586
23587 !! test
23588 Free external link invading image caption
23589 !! wikitext
23590 [[Image:Foobar.jpg|thumb|http://x|hello]]
23591 !! html/php
23592 <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>
23593
23594 !! html/parsoid
23595 <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>
23596 !! end
23597
23598 !! test
23599 T17196: localised external link numbers
23600 !! options
23601 language=fa
23602 !! wikitext
23603 [http://en.wikipedia.org/]
23604 !! html/php
23605 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23606 </p>
23607 !! html/parsoid
23608 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23609 !! end
23610
23611 !! test
23612 Multibyte character in padleft
23613 !! wikitext
23614 {{padleft:-Hello|7|Æ}}
23615 !! html/php
23616 <p>Æ-Hello
23617 </p>
23618 !! html/parsoid
23619 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23620 !! end
23621
23622 !! test
23623 Multibyte character in padright
23624 !! wikitext
23625 {{padright:Hello-|7|Æ}}
23626 !! html/php
23627 <p>Hello-Æ
23628 </p>
23629 !! html/parsoid
23630 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23631 !! end
23632
23633 !!test
23634 formatdate parser function
23635 !! wikitext
23636 {{#formatdate:2009-03-24}}
23637 !! html
23638 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23639 </p>
23640 !! end
23641
23642 !!test
23643 formatdate parser function, with default format
23644 !! wikitext
23645 {{#formatdate:2009-03-24|mdy}}
23646 !! html
23647 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23648 </p>
23649 !! end
23650
23651 !! test
23652 Spacing of numbers in formatted dates
23653 !! wikitext
23654 {{#formatdate:January 15}}
23655 !! html
23656 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23657 </p>
23658 !! end
23659
23660 !! test
23661 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
23662 !! options
23663 language=nl title=[[MediaWiki:Common.css]]
23664 !! wikitext
23665 {{#formatdate:2009-03-24|dmy}}
23666 !! html
23667 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23668 </p>
23669 !! end
23670
23671 #
23672 #
23673 #
23674
23675 #
23676 # Edit comments
23677 #
23678
23679 !! test
23680 Edit comment with link
23681 !! options
23682 comment
23683 !! wikitext
23684 I like the [[Main Page]] a lot
23685 !! html/php
23686 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23687 !!end
23688
23689 !! test
23690 Edit comment with link and link text
23691 !! options
23692 comment
23693 !! wikitext
23694 I like the [[Main Page|best pages]] a lot
23695 !! html/php
23696 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23697 !!end
23698
23699 !! test
23700 Edit comment with link and link text with suffix
23701 !! options
23702 comment
23703 !! wikitext
23704 I like the [[Main Page|best page]]s a lot
23705 !! html/php
23706 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23707 !!end
23708
23709 !! test
23710 Edit comment with section link (non-local, eg in history list)
23711 !! options
23712 comment title=[[Main Page]]
23713 !! wikitext
23714 /* External links */ removed bogus entries
23715 !! html/php
23716 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23717 !!end
23718
23719 !! test
23720 Edit comment with section link and text before it (non-local, eg in history list)
23721 !! options
23722 comment title=[[Main Page]]
23723 !! wikitext
23724 pre-comment text /* External links */ removed bogus entries
23725 !! html/php
23726 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>
23727 !!end
23728
23729 !! test
23730 Edit comment with section link (local, eg in diff view)
23731 !! options
23732 comment local title=[[Main Page]]
23733 !! wikitext
23734 /* External links */ removed bogus entries
23735 !! html/php
23736 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23737 !!end
23738
23739 !! test
23740 Edit comment with subpage link (T16080)
23741 !! options
23742 comment
23743 subpage
23744 title=[[Subpage test]]
23745 !! wikitext
23746 Poked at a [[/subpage]] here...
23747 !! html/php
23748 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23749 !!end
23750
23751 !! test
23752 Edit comment with subpage link and link text (T16080)
23753 !! options
23754 comment
23755 subpage
23756 title=[[Subpage test]]
23757 !! wikitext
23758 Poked at a [[/subpage|neat little page]] here...
23759 !! html/php
23760 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23761 !!end
23762
23763 !! test
23764 Edit comment with bogus subpage link in non-subpage NS (T16080)
23765 !! options
23766 comment
23767 title=[[Subpage test]]
23768 !! wikitext
23769 Poked at a [[/subpage]] here...
23770 !! html/php
23771 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...
23772 !!end
23773
23774 !! test
23775 Edit comment with bare anchor link (local, as on diff)
23776 !! options
23777 comment
23778 local
23779 title=[[Main Page]]
23780 !! wikitext
23781 [[#section]]
23782 !! html/php
23783 <a href="#section">#section</a>
23784 !! end
23785
23786 !! test
23787 Edit comment with bare anchor link (non-local, as on history)
23788 !! options
23789 comment
23790 title=[[Main Page]]
23791 !! wikitext
23792 [[#section]]
23793 !! html/php
23794 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23795 !! end
23796
23797 !! test
23798 Anchor starting with underscore
23799 !! options
23800 title=[[Foo]]
23801 !! wikitext
23802 [[#_ref|One]]
23803 !! html/php
23804 <p><a href="#_ref">One</a>
23805 </p>
23806 !! html/parsoid
23807 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23808 !! end
23809
23810 !! test
23811 Id starting with underscore
23812 !! wikitext
23813 <div id="_ref"></div>
23814 !! html/*
23815 <div id="_ref"></div>
23816
23817 !! end
23818
23819 !! test
23820 Edit comment with link with more than one pipe (T99346)
23821 !! options
23822 comment
23823 !! wikitext
23824 [[Main Page|Many|pipes]]
23825 !! html/php
23826 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23827 !! end
23828
23829 !! test
23830 Complex edit comment with link with more than one pipe (T99346)
23831 !! options
23832 comment
23833 !! wikitext
23834 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23835 !! html/php
23836 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;
23837 !! end
23838
23839 !! test
23840 Space normalisation on autocomment (T24784)
23841 !! options
23842 comment
23843 title=[[Main Page]]
23844 !! wikitext
23845 /* __hello__world__ */
23846 !! html/php
23847 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23848 !! end
23849
23850 !! test
23851 percent-encoding and + signs in comments (T28410)
23852 !! options
23853 comment
23854 !! wikitext
23855 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23856 !! html/php
23857 <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>
23858 !! end
23859
23860 # Parsoid doesn't support this yet: see T75581
23861 # but it *should* omit the 'src' attribute if the image is bad.
23862 # PHP side of tests was disabled in
23863 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23864 # because of issues in the PHP parserTests infrastructure
23865 # (but the output below is indeed what the PHP side emits)
23866 !! test
23867 Bad images - basic functionality
23868 !! wikitext
23869 [[File:Bad.jpg]]
23870 !! html/php+disabled
23871 !! html/parsoid
23872 <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>
23873 !! end
23874
23875 !! test
23876 Bad images - T18039: text after bad image disappears
23877 !! wikitext
23878 Foo bar
23879 [[File:Bad.jpg]]
23880 Bar foo
23881 !! html/php+disabled
23882 <p>Foo bar
23883 </p><p>Bar foo
23884 </p>
23885 !! html/parsoid
23886 <p>Foo bar
23887 <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>
23888 Bar foo</p>
23889 !! end
23890
23891 !! test
23892 Verify that displaytitle works (T24501) no displaytitle
23893 !! options
23894 showtitle
23895 !! config
23896 wgAllowDisplayTitle=true
23897 wgRestrictDisplayTitle=false
23898 !! wikitext
23899 this is not the the title
23900 !! html/php
23901 Parser test
23902 <p>this is not the the title
23903 </p>
23904 !! end
23905
23906 !! test
23907 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23908 !! options
23909 showtitle
23910 title=[[Screen]]
23911 !! config
23912 wgAllowDisplayTitle=true
23913 wgRestrictDisplayTitle=false
23914 !! wikitext
23915 this is not the the title
23916 {{DISPLAYTITLE:whatever}}
23917 !! html/php
23918 whatever
23919 <p>this is not the the title
23920 </p>
23921 !! end
23922
23923 !! test
23924 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23925 !! options
23926 showtitle
23927 title=[[Screen]]
23928 !! config
23929 wgAllowDisplayTitle=true
23930 wgRestrictDisplayTitle=true
23931 !! wikitext
23932 this is not the the title
23933 {{DISPLAYTITLE:whatever}}
23934 !! html/php
23935 Screen
23936 <p>this is not the the title
23937 </p>
23938 !! end
23939
23940 !! test
23941 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23942 !! options
23943 showtitle
23944 title=[[Screen]]
23945 !! config
23946 wgAllowDisplayTitle=true
23947 wgRestrictDisplayTitle=true
23948 !! wikitext
23949 this is not the the title
23950 {{DISPLAYTITLE:screen}}
23951 !! html/php
23952 screen
23953 <p>this is not the the title
23954 </p>
23955 !! end
23956
23957 !! test
23958 Verify that displaytitle works (T24501) AllowDisplayTitle=false
23959 !! options
23960 showtitle
23961 title=[[Screen]]
23962 !! config
23963 wgAllowDisplayTitle=false
23964 !! wikitext
23965 this is not the the title
23966 {{DISPLAYTITLE:screen}}
23967 !! html/php
23968 Screen
23969 <p>this is not the the title
23970 <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>
23971 </p>
23972 !! end
23973
23974 !! test
23975 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
23976 !! options
23977 showtitle
23978 title=[[Screen]]
23979 !! config
23980 wgAllowDisplayTitle=false
23981 !! wikitext
23982 this is not the the title
23983 !! html/php
23984 Screen
23985 <p>this is not the the title
23986 </p>
23987 !! end
23988
23989 !! test
23990 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
23991 !! options
23992 showtitle
23993 title=[[Screen]]
23994 !! config
23995 wgAllowDisplayTitle=true
23996 wgRestrictDisplayTitle=true
23997 !! wikitext
23998 this is not the the title
23999 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
24000 !! html/php
24001 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
24002 <p>this is not the the title
24003 </p>
24004 !! end
24005
24006 !! test
24007 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
24008 !! options
24009 showtitle
24010 title=[[Screen]]
24011 !! config
24012 wgAllowDisplayTitle=true
24013 wgRestrictDisplayTitle=true
24014 !! wikitext
24015 this is not the the title
24016 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
24017 !! html/php
24018 <span style="color: red;">s</span>creen
24019 <p>this is not the the title
24020 </p>
24021 !! end
24022
24023 !! test
24024 Page status indicators: Empty name is invalid
24025 !! options
24026 showindicators
24027 !! wikitext
24028 <indicator name=" "></indicator>
24029 <indicator></indicator>
24030 !! html/php
24031 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24032 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24033 </p>
24034 !! end
24035
24036 !! test
24037 Page status indicators: Weird syntaxes that are okay
24038 !! options
24039 showindicators
24040 !! wikitext
24041 <indicator name="empty" />
24042 <indicator name="name"></indicator>
24043 !! html/php
24044 empty=
24045 name=
24046 <p><br />
24047 </p>
24048 !! end
24049
24050 !! test
24051 Page status indicators: Torture test
24052 !! options
24053 showindicators
24054 !! wikitext
24055 <indicator name="01">hello world</indicator>
24056 <indicator name="02">[[Main Page]]</indicator>
24057 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
24058 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
24059 <indicator name="05">*foo
24060 *bar</indicator>
24061 <indicator name="06"><nowiki>foo</nowiki></indicator>
24062 <indicator name="07"> Preformatted</indicator>
24063 <indicator name="08"><div>Broken tag</indicator>
24064 <indicator name="09">{| class=wikitable
24065 |cell
24066 |}</indicator>
24067 <indicator name="10">Two
24068
24069 paragraphs</indicator>
24070 !! html/php
24071 01=hello world
24072 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
24073 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" />
24074 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>
24075 05=<ul><li>foo</li>
24076 <li>bar</li></ul>
24077
24078 06=foo
24079 07=<pre>Preformatted
24080 </pre>
24081 08=<div>Broken tag</div>
24082
24083 09=<table class="wikitable">
24084 <tr>
24085 <td>cell
24086 </td></tr></table>
24087
24088 10=<p>Two
24089 </p><p>paragraphs
24090 </p>
24091 <p><br />
24092 </p><p><br />
24093 </p><p><br />
24094 </p><p><br />
24095 </p><p><br />
24096 </p>
24097 !! end
24098
24099 !! test
24100 preload: check <noinclude> and <includeonly>
24101 !! options
24102 preload
24103 !! wikitext
24104 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
24105 !! html/php
24106 Hello kind world.
24107 !! end
24108
24109 !! test
24110 preload: check <onlyinclude>
24111 !! options
24112 preload
24113 !! wikitext
24114 Goodbye <onlyinclude>Hello world</onlyinclude>
24115 !! html/php
24116 Hello world
24117 !! end
24118
24119 !! test
24120 preload: can pass tags through if we want to
24121 !! options
24122 preload
24123 !! wikitext
24124 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
24125 !! html/php
24126 <includeonly>Hello world</includeonly>
24127 !! end
24128
24129 !! test
24130 preload: check that it doesn't try to do tricks
24131 !! options
24132 preload
24133 !! wikitext
24134 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24135 !! html/php
24136 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24137 !! end
24138
24139 !! test
24140 Play a bit with r67090 and T5158
24141 !! wikitext
24142 <div style="width:50% !important">&nbsp;</div>
24143 <div style="width:50%&nbsp;!important">&nbsp;</div>
24144 <div style="width:50%&#160;!important">&nbsp;</div>
24145 <div style="border : solid;">&nbsp;</div>
24146 !! html/php
24147 <div style="width:50%&#32;!important">&#160;</div>
24148 <div style="width:50% !important">&#160;</div>
24149 <div style="width:50% !important">&#160;</div>
24150 <div style="border&#32;: solid;">&#160;</div>
24151
24152 !! html/parsoid
24153 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24154 <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>
24155 <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>
24156 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24157
24158 !! end
24159
24160 !! test
24161 T5158: Test for French spaces in attributes
24162 !! wikitext
24163 <br style=" clear : both ; " />
24164 !! html/php
24165 <p><br style="clear&#32;: both&#32;;" />
24166 </p>
24167 !! end
24168
24169 !! test
24170 HTML5 data attributes
24171 !! wikitext
24172 <span data-foo="bar">Baz</span>
24173 <p data-abc-def_hij="">Quuz</p>
24174 !! html/php
24175 <p><span data-foo="bar">Baz</span>
24176 </p>
24177 <p data-abc-def_hij="">Quuz</p>
24178
24179 !! html/parsoid
24180 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
24181 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
24182 !! end
24183
24184 !! test
24185 Strip reserved data attributes
24186 !! wikitext
24187 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
24188 !! html/php
24189 <div data-ok="fred">d</div>
24190
24191 !! html/parsoid
24192 <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>
24193 !! end
24194
24195 !! test
24196 percent-encoding and + signs in internal links (T28410)
24197 !! wikitext
24198 [[User:+%]] [[Page+title%]]
24199 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
24200 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
24201 [[%33%45]] [[%33%45+]]
24202 !! html/php
24203 <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>
24204 <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>
24205 <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>
24206 <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>
24207 </p>
24208 !! html/parsoid
24209 <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>
24210 <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>
24211 <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>
24212 <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>
24213 !! end
24214
24215 !! test
24216 Special characters in embedded file links (T29679)
24217 !! wikitext
24218 [[File:Contains & ampersand.jpg]]
24219 [[File:Does not exist.jpg|Title with & ampersand]]
24220 !! html/php
24221 <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>
24222 <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>
24223 </p>
24224 !! html/parsoid
24225 <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>
24226 <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>
24227 !! end
24228
24229 !! test
24230 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
24231 !! wikitext
24232 Text&apos;s been normalized?
24233 !! html
24234 <p>Text&#39;s been normalized?
24235 </p>
24236 !! end
24237
24238 !! test
24239 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
24240 !! wikitext
24241 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
24242 !! html
24243 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
24244 </p>
24245 !! end
24246
24247 !! test
24248 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
24249 !! wikitext
24250 [http://www.example.org/ ideograms]
24251 !! html
24252 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
24253 </p>
24254 !! end
24255
24256 !! test
24257 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
24258 !! wikitext
24259 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
24260 !! html
24261 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
24262 </p>
24263 !! end
24264
24265 !! article
24266 Mediawiki:loop1
24267 !! text
24268 {{Identical|A}}
24269 !! endarticle
24270
24271 !! article
24272 Mediawiki:loop2
24273 !! text
24274 {{Identical|B}}
24275 !! endarticle
24276
24277 !! article
24278 Template:Identical
24279 !! text
24280 {{int:loop1}}
24281 {{int:loop2}}
24282 !! endarticle
24283
24284 !! test
24285 T33098 Template which includes system messages which includes the template
24286 !! wikitext
24287 {{Identical}}
24288 !! html
24289 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24290 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24291 </p>
24292 !! end
24293
24294 !! test
24295 T33490 Turkish: ucfirst 'blah'
24296 !! options
24297 language=tr
24298 !! wikitext
24299 {{ucfirst:blah}}
24300 !! html
24301 <p>Blah
24302 </p>
24303 !! end
24304
24305 !! test
24306 T33490 Turkish: ucfirst 'ix'
24307 !! options
24308 language=tr
24309 !! wikitext
24310 {{ucfirst:ix}}
24311 !! html
24312 <p>İx
24313 </p>
24314 !! end
24315
24316 !! test
24317 T33490 Turkish: lcfirst 'BLAH'
24318 !! options
24319 language=tr
24320 !! wikitext
24321 {{lcfirst:BLAH}}
24322 !! html
24323 <p>bLAH
24324 </p>
24325 !! end
24326
24327 !! test
24328 T33490 Turkish: ucfırst (with a dotless i)
24329 !! options
24330 language=tr
24331 !! wikitext
24332 {{ucfırst:blah}}
24333 !! html
24334 <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>
24335 </p>
24336 !! end
24337
24338 !! test
24339 T33490 ucfırst (with a dotless i) with English language
24340 !! options
24341 language=en
24342 !! wikitext
24343 {{ucfırst:blah}}
24344 !! html
24345 <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>
24346 </p>
24347 !! end
24348
24349 # Note that Parsoid doesn't emit an explicit TOC.
24350 # Note also that the html2wt direction tends to emit an extra newline
24351 # between the __TOC__ magicword and the first heading unless *both*
24352 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24353 # it's "{}").
24354
24355 !! test
24356 T28375: TOC with italics
24357 !! options
24358 title=[[Main Page]]
24359 !! wikitext
24360 __TOC__
24361 ==''Lost'' episodes==
24362 !! html/php
24363 <div id="toc" class="toc"><input type="checkbox" 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>
24364 <ul>
24365 <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>
24366 </ul>
24367 </div>
24368
24369 <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>
24370
24371 !! html/parsoid
24372 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24373 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24374 !! end
24375
24376 !! test
24377 T28375: TOC with bold
24378 !! options
24379 title=[[Main Page]]
24380 !! wikitext
24381 __TOC__
24382 =='''should be bold''' then normal text==
24383 !! html/php
24384 <div id="toc" class="toc"><input type="checkbox" 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>
24385 <ul>
24386 <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>
24387 </ul>
24388 </div>
24389
24390 <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>
24391
24392 !! html/parsoid
24393 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24394 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24395 !! end
24396
24397 !! test
24398 T35845: Headings become cursive in TOC when they contain an image
24399 !! options
24400 title=[[Main Page]]
24401 !! wikitext
24402 __TOC__
24403 ==Image [[Image:foobar.jpg]]==
24404 !! html/php
24405 <div id="toc" class="toc"><input type="checkbox" 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>
24406 <ul>
24407 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24408 </ul>
24409 </div>
24410
24411 <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>
24412
24413 !! html/parsoid
24414 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24415 <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>
24416 !! end
24417
24418 !! test
24419 T35845 (2): Headings become bold in TOC when they contain a blockquote
24420 !! options
24421 title=[[Main Page]]
24422 !! wikitext
24423 __TOC__
24424 ==<blockquote>Quote</blockquote>==
24425 !! html/php
24426 <div id="toc" class="toc"><input type="checkbox" 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>
24427 <ul>
24428 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24429 </ul>
24430 </div>
24431
24432 <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>
24433
24434 !! html/php+tidy
24435 <div id="toc" class="toc"><input type="checkbox" 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>
24436 <ul>
24437 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24438 </ul>
24439 </div>
24440
24441 <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>
24442 !! html/parsoid
24443 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24444 <h2 id="Quote" data-parsoid='{}'><blockquote>Quote</blockquote></h2>
24445 !! end
24446
24447 !! test
24448 Unclosed tags in TOC
24449 !! config
24450 wgFragmentMode=[ 'html5', 'legacy' ]
24451 !! options
24452 title=[[Main Page]]
24453 !! wikitext
24454 __TOC__
24455 ==Proof: 2 < 3==
24456 <small>Hanc marginis exiguitas non caperet.</small>
24457 QED
24458 !! html/php
24459 <div id="toc" class="toc"><input type="checkbox" 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>
24460 <ul>
24461 <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>
24462 </ul>
24463 </div>
24464
24465 <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>
24466 <p><small>Hanc marginis exiguitas non caperet.</small>
24467 QED
24468 </p>
24469 !! html/parsoid
24470 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24471 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24472 <p><small>Hanc marginis exiguitas non caperet.</small>
24473 QED</p>
24474 !! end
24475
24476 !! test
24477 Multiple tags in TOC
24478 !! wikitext
24479 __TOC__
24480 ==<i>Foo</i> <b>Bar</b>==
24481
24482 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24483 !! html/php
24484 <div id="toc" class="toc"><input type="checkbox" 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>
24485 <ul>
24486 <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>
24487 <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>
24488 </ul>
24489 </div>
24490
24491 <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>
24492 <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>
24493
24494 !! html/php+tidy
24495 <div id="toc" class="toc"><input type="checkbox" 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>
24496 <ul>
24497 <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>
24498 <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>
24499 </ul>
24500 </div>
24501
24502 <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>
24503 <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>
24504 !! html/parsoid
24505 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24506 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
24507
24508 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote></h2>
24509 !! end
24510
24511 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24512 # html5 tag parsing.
24513 !! test
24514 Tags with parameters in TOC
24515 !! options
24516 parsoid=wt2html
24517 !! wikitext
24518 __TOC__
24519 ==<sup class="in-h2">Hello</sup>==
24520
24521 ==<sup class="a > b">Evilbye</sup>==
24522 !! html/php
24523 <div id="toc" class="toc"><input type="checkbox" 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>
24524 <ul>
24525 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24526 <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>
24527 </ul>
24528 </div>
24529
24530 <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>
24531 <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>
24532
24533 !! html/parsoid
24534 <meta property="mw:PageProp/toc" />
24535 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
24536
24537 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
24538 !! end
24539
24540 !! test
24541 span tags with directionality in TOC
24542 !! wikitext
24543 __TOC__
24544 ==<span dir="ltr">C++</span>==
24545
24546 ==<span dir="rtl">זבנג!</span>==
24547
24548 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
24549
24550 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
24551
24552 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
24553 !! html/php
24554 <div id="toc" class="toc"><input type="checkbox" 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>
24555 <ul>
24556 <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>
24557 <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>
24558 <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>
24559 <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>
24560 <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>
24561 </ul>
24562 </div>
24563
24564 <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>
24565 <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>
24566 <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>
24567 <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>
24568 <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>
24569
24570 !! html/parsoid
24571 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24572 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
24573 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
24574 <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>
24575 <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>
24576 <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>
24577 !! end
24578
24579 !! test
24580 T74884: bdi element in ToC
24581 !! wikitext
24582 __TOC__
24583 ==<bdi>test</bdi>==
24584 !! html/php
24585 <div id="toc" class="toc"><input type="checkbox" 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>
24586 <ul>
24587 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24588 </ul>
24589 </div>
24590
24591 <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>
24592
24593 !! html/parsoid
24594 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24595 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
24596 !! end
24597
24598 !! test
24599 T35715: s/strike element in ToC
24600 !! wikitext
24601 __TOC__
24602 ==<s>test</s> test <strike>test</strike>==
24603 !! html/php
24604 <div id="toc" class="toc"><input type="checkbox" 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>
24605 <ul>
24606 <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>
24607 </ul>
24608 </div>
24609
24610 <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>
24611
24612 !! html/parsoid
24613 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24614 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
24615 !! end
24616
24617 !! test
24618 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24619 !! wikitext
24620 __TOC__
24621 ==x==
24622 !! html/php
24623 <div id="toc" class="toc"><input type="checkbox" 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>
24624 <ul>
24625 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24626 </ul>
24627 </div>
24628
24629 <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>
24630
24631 !! html/parsoid
24632 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24633 <h2 id="x" data-parsoid='{}'>x</h2>
24634 !! end
24635
24636 !! article
24637 MediaWiki:T34057
24638 !! text
24639 == {{int:headline_sample}} ==
24640 !! endarticle
24641
24642 !! test
24643 T34057: Title needed when expanding <h> nodes.
24644 !! options
24645 title=[[Main Page]]
24646 !! wikitext
24647 {{int:T34057}}
24648 !! html
24649 <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>
24650
24651 !! end
24652
24653 !! test
24654 Strip marker in urlencode
24655 !! wikitext
24656 {{urlencode:x<nowiki/>y}}
24657 {{urlencode:x<nowiki/>y|wiki}}
24658 {{urlencode:x<nowiki/>y|path}}
24659 {{urlencode:x<pre id="one">two</pre>y}}
24660 !! html/php
24661 <p>xy
24662 xy
24663 xy
24664 xy
24665 </p>
24666 !! end
24667
24668 !! test
24669 Strip marker in lc
24670 !! wikitext
24671 {{lc:x<nowiki/>y}}
24672 !! html
24673 <p>xy
24674 </p>
24675 !! end
24676
24677 !! test
24678 Strip marker in uc
24679 !! wikitext
24680 {{uc:x<nowiki/>y}}
24681 !! html
24682 <p>XY
24683 </p>
24684 !! end
24685
24686 !! test
24687 Strip marker in formatNum
24688 !! wikitext
24689 {{formatnum:1<nowiki/>2}}
24690 {{formatnum:1<nowiki/>2|R}}
24691 !! html
24692 <p>12
24693 12
24694 </p>
24695 !! end
24696
24697 !! test
24698 Check noCommafy in formatNum
24699 !! options
24700 language=be-tarask
24701 !! wikitext
24702 {{formatnum:123456.78}}
24703 {{formatnum:123456.78|NOSEP}}
24704 !! html
24705 <p>123 456,78
24706 123456.78
24707 </p>
24708 !! end
24709
24710 !! test
24711 Wrong option for formatNum (T58199)
24712 !! wikitext
24713 {{formatnum:1,234.56|Random}}
24714 {{formatnum:1,234.56|EVERYTHING}}
24715 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24716 !! html
24717 <p>1,234.56
24718 1,234.56
24719 1,234.56
24720 </p>
24721 !! end
24722
24723 !! test
24724 Strip marker in grammar
24725 !! options
24726 language=fi
24727 !! wikitext
24728 {{grammar:elative|foo<nowiki/>bar}}
24729 !! html
24730 <p>foobarista
24731 </p>
24732 !! end
24733
24734 !! test
24735 Strip marker in padleft
24736 !! wikitext
24737 {{padleft:|2|x<nowiki/>y}}
24738 !! html
24739 <p>xy
24740 </p>
24741 !! end
24742
24743 !! test
24744 Strip marker in padright
24745 !! wikitext
24746 {{padright:|2|x<nowiki/>y}}
24747 !! html
24748 <p>xy
24749 </p>
24750 !! end
24751
24752 !! test
24753 Strip marker in anchorencode
24754 !! wikitext
24755 {{anchorencode:x<nowiki/>y}}
24756 !! html/php
24757 <p>xy
24758 </p>
24759 !! html/parsoid
24760 <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>
24761 !! end
24762
24763 !! test
24764 nowiki inside link inside heading (T20295)
24765 !! wikitext
24766 ==[[foo|x<nowiki>y</nowiki>z]]==
24767 !! html
24768 <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>
24769
24770 !! end
24771
24772 !! test
24773 new support for bdi element (T33817)
24774 !! wikitext
24775 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24776 !! html
24777 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24778
24779 !!end
24780
24781 !! test
24782 Ignore pipe between table row attributes
24783 !! wikitext
24784 {|
24785 |quux
24786 |- id=foo | style='color: red'
24787 |bar
24788 |}
24789 !! html
24790 <table>
24791 <tr>
24792 <td>quux
24793 </td></tr>
24794 <tr id="foo" style="color: red">
24795 <td>bar
24796 </td></tr></table>
24797
24798 !! end
24799
24800 !!test
24801 Language parser function
24802 !! wikitext
24803 {{#language:ar}}
24804 !! html
24805 <p>العربية
24806 </p>
24807 !! end
24808
24809 !!test
24810 Padleft and padright (default 0-padding)
24811 !! wikitext
24812 {{padleft:xyz|5}}
24813 {{padright:xyz|5}}
24814 !! html/php
24815 <p>00xyz
24816 xyz00
24817 </p>
24818 !! html/parsoid
24819 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
24820 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
24821 !! end
24822
24823 !!test
24824 Padleft and padright (partial fill)
24825 !! wikitext
24826 {{padleft:xyz|6|ab}}
24827 {{padright:xyz|6|ab}}
24828 !! html/php
24829 <p>abaxyz
24830 xyzaba
24831 </p>
24832 !! html/parsoid
24833 <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>
24834 <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>
24835 !! end
24836
24837 !!test
24838 Padleft and padright as substr
24839 !! wikitext
24840 {{padleft:|3|abcde}}
24841 {{padright:|3|abcde}}
24842 !! html/php
24843 <p>abc
24844 abc
24845 </p>
24846 !! html/parsoid
24847 <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>
24848 <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>
24849 !! end
24850
24851 !! test
24852 Padleft and padright with non-numerical length (T180403)
24853 !! wikitext
24854 {{padleft:abcdef|junk}}
24855 {{padright:abcdef|junk}}
24856 !! html/php
24857 <p>abcdef
24858 abcdef
24859 </p>
24860 !! end
24861
24862 !!test
24863 Special parser function
24864 !! wikitext
24865 {{#special:RandomPage}}
24866 {{#special:BaDtItLe}}
24867 {{#special:Foobar}}
24868 !! html
24869 <p>Special:Random
24870 Special:Badtitle
24871 Special:Foobar
24872 </p>
24873 !! end
24874
24875 !!test
24876 T36939 - Case insensitive link parsing ([HttP://])
24877 !! wikitext
24878 [HttP://MediaWiki.Org/]
24879 !! html/php
24880 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24881 </p>
24882 !! html/parsoid
24883 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
24884 !! end
24885
24886 !!test
24887 T36939 - Case insensitive link parsing ([HttP:// title])
24888 !! wikitext
24889 [HttP://MediaWiki.Org/ MediaWiki]
24890 !! html
24891 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24892 </p>
24893 !! end
24894
24895 !!test
24896 T36939 - Case insensitive link parsing (HttP://)
24897 !! wikitext
24898 HttP://MediaWiki.Org/
24899 !! html/php
24900 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24901 </p>
24902 !! html/parsoid
24903 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24904 !! end
24905
24906 !!test
24907 Disable TOC
24908 !! options
24909 notoc
24910 !! wikitext
24911 Lead
24912 ==Section 1==
24913 ==Section 2==
24914 ==Section 3==
24915 ==Section 4==
24916 ==Section 5==
24917 !! html
24918 <p>Lead
24919 </p>
24920
24921 <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>
24922 <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>
24923 <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>
24924 <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>
24925 <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>
24926
24927 !! end
24928
24929
24930 ###
24931 ### Parsoid-specific tests
24932 ### Parsoid-PHP parser incompatibilities
24933 ###
24934 !!test
24935 1. SOL-sensitive wikitext tokens as template-args
24936 !!options
24937 parsoid=wt2html,wt2wt
24938 !! wikitext
24939 {{echo|*a}}
24940 {{echo|#a}}
24941 {{echo|:a}}
24942 !! html
24943 <span about="#mwt1" typeof="mw:Transclusion">
24944 </span><ul about="#mwt1"><li>a</li>
24945 </ul>
24946 <span about="#mwt2" typeof="mw:Transclusion">
24947 </span><ol about="#mwt2"><li>a</li>
24948 </ol>
24949 <span about="#mwt3" typeof="mw:Transclusion">
24950 </span><dl about="#mwt3"><dd>a</dd>
24951 </dl>
24952 !!end
24953
24954 #### -----------------------------------------------------------------
24955 #### Parsoid-specific functionality tests
24956 #### -----------------------------------------------------------------
24957
24958 # T65642/T68749: Formatting elt fixup around images is cleaned up.
24959 # We know wt2wt will fail, but we expect selser to pass.
24960 # Due to the nature of our testing, wt2wt and selser tests will enter the
24961 # blacklist and we'll catch selser regressions based on changes to the
24962 # blacklist entries for selser tests.
24963 !! test
24964 1. Bad treebuilder fixup of formatting elt is cleaned up
24965 !! options
24966 parsoid=wt2html,wt2wt
24967 !! wikitext
24968 {|
24969 |
24970 <small>
24971 [[Image:Foobar.jpg|right|Test]]
24972 </small>
24973 |}
24974 !! html/parsoid
24975 <table>
24976 <tbody><tr><td>
24977 <small>
24978 <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>
24979 </small>
24980 </td></tr>
24981 </tbody></table>
24982 !! end
24983
24984 !! test
24985 2. Bad treebuilder fixup of formatting elt is cleaned up
24986 !! options
24987 parsoid=wt2html,wt2wt
24988 !! wikitext
24989 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
24990
24991 <small>[[Image:Foobar.jpg|right|300px]]</small>
24992 !! html/parsoid
24993
24994 <p><b>foo</b></p>
24995 <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><b>caption</b></figcaption></figure>
24996 <p><b>bar</b></p>
24997 <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>
24998 !! end
24999
25000 !! test
25001 3. Bad treebuilder fixup of formatting elt is cleaned up
25002 !! options
25003 parsoid=wt2html,wt2wt
25004 !! wikitext
25005 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
25006 !! html/parsoid
25007 <p><small><b>foo</b></small></p>
25008 <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><small><b>caption</b></small></figcaption></figure>
25009 <p><small><b>bar</b></small></p>
25010 !! end
25011
25012 !! test
25013 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
25014 !! options
25015 parsoid=wt2html,wt2wt
25016 !! wikitext
25017 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
25018 !! html/parsoid
25019 <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>
25020 !! end
25021
25022 #### ----------------------------------------------------------------
25023 #### Parsoid-only testing of Parsoid's impl of LST
25024 #### Not implemented yet, see
25025 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
25026 #### ----------------------------------------------------------------
25027
25028 ## We still need to support serializing the older format while content is stored.
25029 !! test
25030 LST Sections: Backwards compatibility
25031 !! options
25032 parsoid={
25033 "suppressErrors": true,
25034 "modes": ["html2wt"]
25035 }
25036 !! wikitext
25037 <section begin="2011-05-16" />
25038 <section end="2014-04-10 (MW 1.23wmf22)" />
25039 !! html/parsoid
25040 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
25041 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
25042 !! end
25043
25044 !! test
25045 LST Sections: Newfangled approach
25046 !! wikitext
25047 <section begin="2011-05-16" />
25048 <section end="2014-04-10 (MW 1.23wmf22)" />
25049 !! html/parsoid
25050 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
25051 </span>
25052 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
25053 </span></p>
25054 !! end
25055
25056 #--------- Test stripping of empty nodes in template content ----------
25057
25058 !! test
25059 Empty LI and TR nodes should be stripped from template content
25060 !! wikitext
25061 {{EmptyLITest}}
25062 {{EmptyTRTest}}
25063 !! html/parsoid
25064 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
25065 <li>a</li>
25066 <li>b</li>
25067 </ul>
25068 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
25069 <tbody>
25070 <tr>
25071 <td>foo</td>
25072 </tr>
25073 <tr>
25074 <td>bar</td>
25075 </tr>
25076 </tbody>
25077 </table>
25078 !! end
25079
25080 !! test
25081 Empty LI and TR nodes should not be stripped from top-level content
25082 !! wikitext
25083 *a
25084 *
25085 *b
25086
25087 {|
25088 |-
25089 |-
25090 |foo
25091 |}
25092 !! html/parsoid
25093 <ul>
25094 <li>a</li>
25095 <li class='mw-empty-elt'></li>
25096 <li>b</li>
25097 </ul>
25098 <table>
25099 <tbody>
25100 <tr class='mw-empty-elt'></tr>
25101 <tr>
25102 <td>foo</td>
25103 </tr>
25104 </tbody>
25105 </table>
25106 !! end
25107
25108 !! test
25109 Empty TR nodes should not be stripped if they have any attributes set
25110 !! wikitext
25111 {{EmptyTRWithHTMLAttrTest}}
25112 !! html/parsoid
25113 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
25114 <tr align='center'></tr>
25115 <tr><td>foo</td></tr>
25116 <tr align='center'></tr>
25117 <tr><td>bar</td></tr>
25118 </table>
25119 !! end
25120
25121 #### ----------------------------------------------------------------
25122 #### The following section of tests are primarily to test
25123 #### wikitext escaping capabilities of Parsoid. Given that
25124 #### escaping can be done any number of ways, the wikitext (input)
25125 #### is always adjusted to reflect how Parsoid adds nowiki
25126 #### escape tags.
25127 ####
25128 #### We are marking several tests as parsoid-only since the
25129 #### HTML in the result section is different from what the
25130 #### PHP parser generates for it.
25131 #### ----------------------------------------------------------------
25132
25133
25134 #### --------------- Headings ---------------
25135 #### 0. Unnested
25136 #### 1. Nested inside html <h1>=foo=</h1>
25137 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
25138 #### 3. Nested inside html with wikitext split by html tags
25139 #### 4. No escape needed
25140 #### 5. Empty headings <h1></h1>
25141 #### 6. Heading chars in SOL context
25142 #### ----------------------------------------
25143 !! test
25144 Headings: 0. Unnested
25145 !! options
25146 parsoid=html2wt
25147 !! html/parsoid
25148 <p>=foo=</p>
25149
25150 <p> =foo=
25151 <!--cmt-->
25152 =foo=</p>
25153
25154 <p>=foo<i>a</i>=</p>
25155 !! wikitext
25156 <nowiki>=foo=</nowiki>
25157
25158 <nowiki> </nowiki>=foo=
25159 <!--cmt-->
25160 <nowiki>=foo=</nowiki>
25161
25162 =foo''a''<nowiki>=</nowiki>
25163 !!end
25164
25165 # New headings and existing headings are handled differently
25166 !! test
25167 Headings: 1. Nested inside html
25168 !! options
25169 parsoid=html2wt
25170 !! html/parsoid
25171 <h1>=foo=</h1>
25172 <h2>=foo=</h2>
25173 <h3>=foo=</h3>
25174
25175 <h1 data-parsoid=''>=foo=</h1>
25176 <h2 data-parsoid=''>=foo=</h2>
25177 <h3 data-parsoid=''>=foo=</h3>
25178 <h4 data-parsoid=''>=foo=</h4>
25179 <h5 data-parsoid=''>=foo=</h5>
25180 <h6 data-parsoid=''>=foo=</h6>
25181 !! wikitext
25182 = =foo= =
25183
25184 == =foo= ==
25185
25186 === =foo= ===
25187
25188 =<nowiki>=foo=</nowiki>=
25189 ==<nowiki>=foo=</nowiki>==
25190 ===<nowiki>=foo=</nowiki>===
25191 ====<nowiki>=foo=</nowiki>====
25192 =====<nowiki>=foo=</nowiki>=====
25193 ======<nowiki>=foo=</nowiki>======
25194
25195 !!end
25196
25197 !! test
25198 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
25199 !! options
25200 parsoid=html2wt
25201 !! html/parsoid
25202 <h1>foo</h1>*bar
25203 <h1>foo</h1>=bar
25204 <h1>foo</h1>=bar=
25205 !! wikitext
25206 = foo =
25207 <nowiki>*</nowiki>bar
25208
25209 = foo =
25210 =bar
25211
25212 = foo =
25213 <nowiki>=bar=</nowiki>
25214 !!end
25215
25216 !! test
25217 Headings: 3. Nested inside html with wikitext split by html tags
25218 !! options
25219 parsoid=html2wt
25220 !! html/parsoid
25221 <h1>=<b>bold</b>foo=</h1>
25222 !! wikitext
25223 = ='''bold'''foo= =
25224 !!end
25225
25226 !! test
25227 Headings: 4a. No escaping needed (testing just h1 and h2)
25228 !! options
25229 parsoid=html2wt
25230 !! html/parsoid
25231 <h1>=foo</h1>
25232 <h1>foo=</h1>
25233 <h1> =foo= </h1>
25234 <h1>=foo= bar</h1>
25235 <h2>=foo</h2>
25236 <h2>foo=</h2>
25237 <h1>=</h1>
25238 <h1><i>=</i>foo=</h1>
25239 !! wikitext
25240 = =foo =
25241
25242 = foo= =
25243
25244 = =foo= =
25245
25246 = =foo= bar =
25247
25248 == =foo ==
25249
25250 == foo= ==
25251
25252 = = =
25253
25254 = ''=''foo= =
25255 !!end
25256
25257 !! test
25258 Headings: 4b. No escaping needed (inside p-tags)
25259 !! options
25260 parsoid=html2wt
25261 !! html/parsoid
25262 <p>=foo= x
25263 =foo= <s></s>
25264 </p>
25265 !! wikitext
25266 =foo= x
25267 =foo= <s></s>
25268 !! html/php
25269 <p>=foo= x
25270 =foo= <s></s>
25271 </p>
25272 !!end
25273
25274 !! test
25275 Headings: 4c. Short headings (1)
25276 !! options
25277 parsoid=html2wt
25278 !! html/parsoid
25279 <p>===
25280 </p>
25281 !! wikitext
25282 <nowiki>===</nowiki>
25283 !! html/php
25284 <p>===
25285 </p>
25286 !! end
25287
25288 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
25289 !! test
25290 Headings: 4d. Short headings (2)
25291 !! options
25292 parsoid=wt2html,html2html
25293 !! wikitext
25294 =
25295 ==
25296 ===
25297 ====
25298 =====
25299 !! html/php
25300 <p>=
25301 ==
25302 </p>
25303 <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>
25304 <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>
25305 <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>
25306
25307 !! html/parsoid
25308 <p>=
25309 ==</p>
25310 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
25311 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
25312 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
25313 !! end
25314
25315 !! test
25316 Headings: 5. Empty headings
25317 !! options
25318 parsoid=html2wt
25319 !! html/parsoid
25320 <h1 data-parsoid='{}'></h1>
25321
25322 <h2 data-parsoid='{}'></h2>
25323
25324 <h3 data-parsoid='{}'></h3>
25325
25326 <h4 data-parsoid='{}'></h4>
25327
25328 <h5 data-parsoid='{}'></h5>
25329
25330 <h6 data-parsoid='{}'></h6>
25331 !! wikitext
25332 =<nowiki/>=
25333
25334 ==<nowiki/>==
25335
25336 ===<nowiki/>===
25337
25338 ====<nowiki/>====
25339
25340 =====<nowiki/>=====
25341
25342 ======<nowiki/>======
25343 !!end
25344
25345 !! test
25346 Headings: 6a. Heading chars in SOL context (with trailing spaces)
25347 !! options
25348 parsoid=html2wt
25349 !! html/parsoid
25350 <p>=a=</p>
25351
25352 <p>=a=</p>
25353
25354 <p>=a=</p>
25355 !! wikitext
25356 <nowiki>=a=</nowiki>
25357
25358 <nowiki>=a=</nowiki>
25359
25360 <nowiki>=a=</nowiki>
25361 !!end
25362
25363 !! test
25364 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25365 !! options
25366 parsoid=html2wt
25367 !! html/parsoid
25368 <p>=a=
25369 b</p>
25370
25371 <p>=a=
25372 b</p>
25373
25374 <p>=a=
25375 b</p>
25376 !! wikitext
25377 <nowiki>=a=</nowiki>
25378 b
25379
25380 <nowiki>=a=</nowiki>
25381 b
25382
25383 <nowiki>=a=</nowiki>
25384 b
25385 !!end
25386
25387 !! test
25388 Headings: 6c. Heading chars in SOL context (leading newline break)
25389 !! options
25390 parsoid=html2wt
25391 !! html/parsoid
25392 <p>a
25393 =b=</p>
25394 !! wikitext
25395 a
25396 <nowiki>=b=</nowiki>
25397 !!end
25398
25399 !! test
25400 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25401 !! options
25402 parsoid=html2wt
25403 !! html/parsoid
25404 <!--c0--><p>=a=</p>
25405
25406 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25407 !! wikitext
25408 <!--c0--><nowiki>=a=</nowiki>
25409
25410 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25411 !!end
25412
25413 !! test
25414 Headings: 6d. Heading chars in SOL context (No escaping needed)
25415 !! options
25416 parsoid=html2wt
25417 !! html/parsoid
25418 =a=<div>b</div>
25419 !! wikitext
25420 =a=<div>b</div>
25421 !!end
25422
25423 !! test
25424 Headings: 7. Insert a newline between new content and headings
25425 !! options
25426 parsoid=html2wt
25427 !! html/parsoid
25428 <h2>NEW</h2>
25429 <p>new</p>
25430 <h2 data-parsoid='{}'>A</h2>
25431 <p data-parsoid='{}'>a</p>
25432 !! wikitext
25433 == NEW ==
25434 new
25435
25436 ==A==
25437 a
25438
25439 !! end
25440
25441 !! test
25442 Headings: Used as horizontal rule
25443 !! config
25444 wgFragmentMode=[ 'html5', 'legacy' ]
25445 !! options
25446 parsoid=wt2html
25447 !! wikitext
25448 ===============
25449 !! html/php
25450 <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>
25451
25452 !! html/parsoid
25453 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25454 !! end
25455
25456 #### --------------- Lists ---------------
25457 #### 0. Outside nests (*foo, etc.)
25458 #### 1. Nested inside html <ul><li>*foo</li></ul>
25459 #### 2. Inside definition lists
25460 #### 3. Only bullets at start should be escaped
25461 #### 4. No escapes needed
25462 #### 5. No unnecessary escapes
25463 #### 6. Escape bullets in SOL position
25464 #### 7. Escape bullets in a multi-line context
25465 #### ----------------------------------------
25466
25467 !! test
25468 Lists: 0. Outside nests
25469 !! options
25470 parsoid=html2wt
25471 !! html/parsoid
25472 <p>*foo</p>
25473
25474 <p>#foo</p>
25475
25476 <p>;Foo:bar</p>
25477 !! wikitext
25478 <nowiki>*</nowiki>foo
25479
25480 <nowiki>#</nowiki>foo
25481
25482 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25483 !!end
25484
25485 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25486 ## to test wikitext escaping, and insignificant whitespace diffs
25487 ## cause PHP parser tests to barf
25488 !! test
25489 Lists: 1. Nested inside html (No unnecessary escapes)
25490 !! options
25491 parsoid=html2wt
25492 !! html/parsoid
25493 <ul>
25494 <li>*foo</li>
25495 <li>#foo</li>
25496 <li>:foo</li>
25497 <li>;foo</li>
25498 <li data-parsoid='{}'>*foo</li>
25499 <li data-parsoid='{}'>#foo</li>
25500 <li data-parsoid='{}'>:foo</li>
25501 <li data-parsoid='{}'>;foo</li>
25502 </ul>
25503
25504 <ol>
25505 <li>*foo</li>
25506 <li>#foo</li>
25507 <li>:foo</li>
25508 <li>;foo</li>
25509 <li data-parsoid='{}'>*foo</li>
25510 <li data-parsoid='{}'>#foo</li>
25511 <li data-parsoid='{}'>:foo</li>
25512 <li data-parsoid='{}'>;foo</li>
25513 </ol>
25514 !! wikitext
25515 * *foo
25516 * #foo
25517 * :foo
25518 * ;foo
25519 *<nowiki>*foo</nowiki>
25520 *<nowiki>#foo</nowiki>
25521 *<nowiki>:foo</nowiki>
25522 *<nowiki>;foo</nowiki>
25523
25524 # *foo
25525 # #foo
25526 # :foo
25527 # ;foo
25528 #<nowiki>*foo</nowiki>
25529 #<nowiki>#foo</nowiki>
25530 #<nowiki>:foo</nowiki>
25531 #<nowiki>;foo</nowiki>
25532 !!end
25533
25534 !! test
25535 Lists: 2. Inside definition lists
25536 !! options
25537 parsoid=html2wt
25538 !! html/parsoid
25539 <dl><dt>;foo</dt></dl>
25540 <dl><dt>:foo</dt></dl>
25541 <dl><dt>:foo</dt>
25542 <dd>bar</dd></dl>
25543 <dl><dd>:foo</dd></dl>
25544 !! wikitext
25545 ; ;foo
25546
25547 ; <nowiki>:foo</nowiki>
25548
25549 ; <nowiki>:foo</nowiki>
25550 : bar
25551
25552 : :foo
25553 !!end
25554
25555 !! test
25556 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25557 !! options
25558 parsoid=html2wt
25559 !! html/parsoid
25560 <ul>
25561 <li>*foo*bar</li>
25562 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25563 </ul>
25564 !! wikitext
25565 * *foo*bar
25566 *<nowiki>*foo</nowiki>''it''*bar
25567 !!end
25568
25569 !! test
25570 Lists: 4. No escapes needed
25571 !! options
25572 parsoid=html2wt
25573 !! html/parsoid
25574 <ul>
25575 <li>foo*bar
25576 </li>
25577 </ul>
25578 <ul>
25579 <li><i>foo</i>*bar
25580 </li>
25581 </ul>
25582 <ul>
25583 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25584 </li>
25585 </ul>
25586 <ul>
25587 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25588 </li>
25589 </ul>
25590 !! wikitext
25591 *foo*bar
25592
25593 *''foo''*bar
25594
25595 *[[Foo]]: bar
25596
25597 *[[Foo]]*bar
25598 !!end
25599
25600 !! test
25601 Lists: 5. No unnecessary escapes
25602 !! options
25603 parsoid=html2wt
25604 !! html/parsoid
25605 <ul><li> bar <span>[[foo]]</span></li></ul>
25606 <ul><li> =bar <span>[[foo]]</span></li></ul>
25607 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25608 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25609 <ul><li> =bar <span>foo]]</span>=</li></ul>
25610 <ul><li> <s></s>: a</li></ul>
25611 <ul><li> <i>* foo</i></li></ul>
25612
25613 !! wikitext
25614 * bar <span><nowiki>[[foo]]</nowiki></span>
25615
25616 * =bar <span><nowiki>[[foo]]</nowiki></span>
25617
25618 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25619
25620 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25621
25622 * =bar <span>foo]]</span>=
25623
25624 * <s></s>: a
25625
25626 * ''* foo''
25627 !!end
25628
25629 !! test
25630 Lists: 6. Escape bullets in SOL position
25631 !! options
25632 parsoid=html2wt
25633 !! html/parsoid
25634 <p><!--cmt-->*foo</p>
25635 !! wikitext
25636 <!--cmt--><nowiki>*</nowiki>foo
25637 !!end
25638
25639 !! test
25640 Lists: 7. Escape bullets in a multi-line context
25641 !! options
25642 parsoid=html2wt
25643 !! html/parsoid
25644 <p>a
25645 *b
25646 </p>
25647 !! wikitext
25648 a
25649 <nowiki>*</nowiki>b
25650 !!end
25651
25652 !! test
25653 Lists: 8. Escape colons only if not present in tags
25654 !! options
25655 parsoid=html2wt
25656 !! html/parsoid
25657 <dl><dt>a:b<i>c:d</i></dt></dl>
25658 !! wikitext
25659 ; <nowiki>a:b</nowiki>''c:d''
25660 !! end
25661
25662 #### --------------- HRs ---------------
25663 #### 1. Single line
25664 #### -----------------------------------
25665
25666 !! test
25667 HRs: 1. Single line
25668 !! options
25669 parsoid=html2wt
25670 !! html/parsoid
25671 <hr />----
25672 <hr />=foo=
25673 <hr />*foo
25674 !! wikitext
25675 ----<nowiki>----</nowiki>
25676 ----=foo=
25677 ----*foo
25678 !! end
25679
25680 #### --------------- Tables ---------------
25681 #### 1a. Simple example
25682 #### 1b. No escaping needed (!foo)
25683 #### 1c. No escaping needed (|foo)
25684 #### 1d. No escaping needed (|}foo)
25685 ####
25686 #### 2a. Nested in td (<td>foo|bar</td>)
25687 #### 2b. Nested in td (<td>foo||bar</td>)
25688 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25689 ####
25690 #### 3a. Nested in th (<th>foo!bar</th>)
25691 #### 3b. Nested in th (<th>foo!!bar</th>)
25692 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25693 ####
25694 #### 4a. Escape -
25695 #### 4b. Escape +
25696 #### 4c. No escaping needed
25697 #### --------------------------------------
25698
25699 !! test
25700 Tables: 1a. Simple example
25701 !! options
25702 parsoid=html2wt
25703 !! html/parsoid
25704 <p>{|
25705 |}
25706 </p>
25707 !! wikitext
25708 <nowiki>{|</nowiki>
25709 |}
25710 !! end
25711
25712 !! test
25713 Tables: 1b. No escaping needed
25714 !! options
25715 parsoid=html2wt
25716 !! html/parsoid
25717 <p>!foo
25718 </p>
25719 !! wikitext
25720 !foo
25721 !! end
25722
25723 !! test
25724 Tables: 1c. No escaping needed
25725 !! options
25726 parsoid=html2wt
25727 !! html/parsoid
25728 <p>|foo
25729 </p>
25730 !! wikitext
25731 |foo
25732 !! end
25733
25734 !! test
25735 Tables: 1d. No escaping needed
25736 !! options
25737 parsoid=html2wt
25738 !! html/parsoid
25739 <p>|}foo
25740 </p>
25741 !! wikitext
25742 |}foo
25743 !! end
25744
25745 !! test
25746 Tables: 2a. Nested in td
25747 !! options
25748 parsoid=html2wt
25749 !! html/parsoid
25750 <table><tbody><tr>
25751 <td>foo|bar</td></tr>
25752 <tr><td>x<div>a|b</div></td>
25753 </tbody></table>
25754 !! wikitext
25755 {|
25756 |<nowiki>foo|bar</nowiki>
25757 |-
25758 |x<div><nowiki>a|b</nowiki></div>
25759 |}
25760 !! html/php+tidy
25761 <table>
25762 <tbody><tr>
25763 <td>foo|bar
25764 </td></tr>
25765 <tr>
25766 <td>x<div>a|b</div>
25767 </td></tr></tbody></table>
25768 !! end
25769
25770 !! test
25771 Tables: 2b. Nested in td
25772 !! options
25773 parsoid=html2wt
25774 !! html/parsoid
25775 <table><tbody><tr>
25776 <td>foo||bar</td>
25777 <td>a<i>b||c</i></td>
25778 <td>a<i><div>b||c</div></i></td>
25779 </tr></tbody></table>
25780 !! wikitext
25781 {|
25782 |<nowiki>foo||bar</nowiki>
25783 |a''<nowiki>b||c</nowiki>''
25784 |a''<div><nowiki>b||c</nowiki></div>''
25785 |}
25786 !! html/php
25787 <table>
25788 <tr>
25789 <td>foo||bar
25790 </td>
25791 <td>a<i>b||c</i>
25792 </td>
25793 <td>a<i><div>b||c</div></i>
25794 </td></tr></table>
25795
25796 !! end
25797
25798 !! test
25799 Tables: 2c. Nested in td -- no escaping needed
25800 !! options
25801 parsoid=html2wt
25802 !! html/*
25803 <table>
25804 <tr>
25805 <td>foo!!bar
25806 </td></tr></table>
25807
25808 !! wikitext
25809 {|
25810 |foo!!bar
25811 |}
25812 !! end
25813
25814 !! test
25815 Tables: 3a. Nested in th
25816 !! options
25817 parsoid=html2wt
25818 !! html/*
25819 <table>
25820 <tr>
25821 <th>foo!bar
25822 </th></tr></table>
25823
25824 !! wikitext
25825 {|
25826 !foo!bar
25827 |}
25828 !! end
25829
25830 !! test
25831 Tables: 3b. Nested in th
25832 !! options
25833 parsoid=html2wt
25834 !! html/parsoid
25835 <table><tbody>
25836 <tr><th>foo!!bar</th>
25837 <th><i>foo|bar</i></th>
25838 <th><i>foo!!bar</i></th>
25839 <th><i><span>foo!!bar</span></i></th>
25840 </tr></tbody></table>
25841 !! wikitext
25842 {|
25843 !<nowiki>foo!!bar</nowiki>
25844 !''<nowiki>foo|bar</nowiki>''
25845 !''<nowiki>foo!!bar</nowiki>''
25846 !''<span><nowiki>foo!!bar</nowiki></span>''
25847 |}
25848 !! html/php
25849 <table>
25850 <tr>
25851 <th>foo!!bar
25852 </th>
25853 <th><i>foo|bar</i>
25854 </th>
25855 <th><i>foo!!bar</i>
25856 </th>
25857 <th><i><span>foo!!bar</span></i>
25858 </th></tr></table>
25859
25860 !! end
25861
25862 !! test
25863 Tables: 3c. Nested in th
25864 !! options
25865 parsoid=html2wt
25866 !! html/parsoid
25867 <table><tbody>
25868 <tr><th>foo||bar</th>
25869 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25870 </tr></tbody></table>
25871 !! wikitext
25872 {|
25873 !<nowiki>foo||bar</nowiki>
25874 !<nowiki>foo||bar</nowiki>
25875 |}
25876 !! html/php
25877 <table>
25878 <tr>
25879 <th>foo||bar
25880 </th>
25881 <th>foo||bar
25882 </th></tr></table>
25883
25884 !! end
25885
25886 !! test
25887 Tables: 4a. Escape -
25888 !! options
25889 parsoid=html2wt
25890 !! html/*
25891 <table>
25892 <tr>
25893 <th>-bar
25894 </th></tr>
25895 <tr>
25896 <td>-bar
25897 </td></tr></table>
25898
25899 !! wikitext
25900 {|
25901 !-bar
25902 |-
25903 |<nowiki>-bar</nowiki>
25904 |}
25905 !! end
25906
25907 !! test
25908 Tables: 4b. Escape +
25909 !! options
25910 parsoid=html2wt
25911 !! html/*
25912 <table>
25913 <tr>
25914 <th>+bar
25915 </th></tr>
25916 <tr>
25917 <td>+bar
25918 </td></tr></table>
25919
25920 !! wikitext
25921 {|
25922 !+bar
25923 |-
25924 |<nowiki>+bar</nowiki>
25925 |}
25926 !! end
25927
25928 !! test
25929 Tables: 4c. No escaping needed
25930 !! options
25931 parsoid=html2wt
25932 !! html/parsoid
25933 <table><tbody>
25934 <tr><td>foo-bar</td><td>foo+bar</td></tr>
25935 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
25936 <tr><td>foo
25937 <p>bar|baz
25938 +bar
25939 -bar</p></td></tr>
25940 <tr><td>x
25941 <div>a|b</div></td>
25942 </tbody></table>
25943 !! wikitext
25944 {|
25945 |foo-bar
25946 |foo+bar
25947 |-
25948 |''foo''-bar
25949 |''foo''+bar
25950 |-
25951 |foo
25952 bar|baz
25953 +bar
25954 -bar
25955 |-
25956 |x
25957 <div>a|b</div>
25958 |}
25959 !! html/php
25960 <table>
25961 <tr>
25962 <td>foo-bar
25963 </td>
25964 <td>foo+bar
25965 </td></tr>
25966 <tr>
25967 <td><i>foo</i>-bar
25968 </td>
25969 <td><i>foo</i>+bar
25970 </td></tr>
25971 <tr>
25972 <td>foo
25973 <p>bar|baz
25974 +bar
25975 -bar
25976 </p>
25977 </td></tr>
25978 <tr>
25979 <td>x
25980 <div>a|b</div>
25981 </td></tr></table>
25982
25983 !! end
25984
25985 !! test
25986 Tables: 4d. No escaping needed
25987 !! options
25988 parsoid=html2wt
25989 !! html/parsoid
25990 <table>
25991 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
25992 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
25993 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
25994 </tbody></table>
25995 !! wikitext
25996 {|
25997 |[[Foo]]-bar
25998 ||+1
25999 ||-2
26000 |}
26001 !! html/php
26002 <table>
26003 <tr>
26004 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
26005 </td>
26006 <td>+1
26007 </td>
26008 <td>-2
26009 </td></tr></table>
26010
26011 !! end
26012
26013 !! test
26014 Tables: 5. Empty table cells should get whitespace to avoid need for nowikis
26015 !! options
26016 parsoid=html2wt
26017 !! html/parsoid
26018 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26019
26020 <table><tr><td></td><td align="center"></td><td></td></tr></table>
26021
26022 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26023
26024 <table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table>
26025 !! wikitext
26026 {|
26027 | || align="center" | ||
26028 |}
26029
26030 {|
26031 |
26032 | align="center" |
26033 |
26034 |}
26035
26036 {|
26037 | {{!}}{{!}} align="center" | ||
26038 |}
26039
26040 {|
26041 ! !! align="center" | !!
26042 |}
26043 !! html/php+tidy
26044 <table>
26045 <tbody><tr>
26046 <td></td>
26047 <td align="center"></td>
26048 <td>
26049 </td></tr></tbody></table>
26050 <table>
26051 <tbody><tr>
26052 <td>
26053 </td>
26054 <td align="center">
26055 </td>
26056 <td>
26057 </td></tr></tbody></table>
26058 <table>
26059 <tbody><tr>
26060 <td></td>
26061 <td align="center"></td>
26062 <td>
26063 </td></tr></tbody></table>
26064 <table>
26065 <tbody><tr>
26066 <th></th>
26067 <th align="center"></th>
26068 <th>
26069 </th></tr></tbody></table>
26070 !! end
26071
26072 !! test
26073 T97430: Don't emit empty nowiki pairs around marker meta tags
26074 !! options
26075 parsoid=html2wt
26076 !! html/parsoid
26077 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26078 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
26079 !! wikitext
26080 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26081 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
26082 !! end
26083
26084 !! test
26085 Unclosed xmlish element in table line shouldn't eat end delimiters
26086 !! options
26087 parsoid=html2wt
26088 !! html/parsoid
26089 <table>
26090 <tbody><tr><td> &lt;foo</td>
26091 <td> bar></td></tr>
26092 </tbody></table>
26093 !! wikitext
26094 {|
26095 | <foo
26096 | bar>
26097 |}
26098 !! html/php
26099 <table>
26100 <tr>
26101 <td>&lt;foo
26102 </td>
26103 <td>bar&gt;
26104 </td></tr></table>
26105
26106 !! end
26107
26108 #### --------------- Links ----------------
26109 #### 1. Quote marks in link text
26110 #### 2. Wikilinks: Escapes needed
26111 #### 3. Wikilinks: No escapes needed
26112 #### 4. Extlinks: Escapes needed
26113 #### 5. Extlinks: No escapes needed
26114 #### --------------------------------------
26115 !! test
26116 Links 1. WikiLinks: No escapes needed
26117 !! options
26118 parsoid=html2wt
26119 !! html/parsoid
26120 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
26121 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
26122 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
26123 !! wikitext
26124 [[Foo|Foo''boo'']]
26125 [[Foo|[Foobar]]]
26126 [[Foo|x [Foobar] x]]
26127 !! html/php
26128 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
26129 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
26130 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
26131 </p>
26132 !! end
26133
26134 !! test
26135 Links 2. WikiLinks: Escapes needed
26136 !! options
26137 parsoid=html2wt
26138 !! html/parsoid
26139 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
26140 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
26141 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
26142 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
26143 <a href="Foo" rel="mw:WikiLink">|Bar</a>
26144 <a href="Foo" rel="mw:WikiLink">]]bar</a>
26145 <a href="Foo" rel="mw:WikiLink">[[bar</a>
26146 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
26147 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
26148 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
26149 !! wikitext
26150 [[Foo|<nowiki>Foobar]</nowiki>]]
26151 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
26152 [[Foo|<nowiki>[[Bar]]</nowiki>]]
26153 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
26154 [[Foo|<nowiki>|Bar</nowiki>]]
26155 [[Foo|<nowiki>]]bar</nowiki>]]
26156 [[Foo|<nowiki>[[bar</nowiki>]]
26157 [[Foo|<nowiki>x [[ y</nowiki>]]
26158 [[Foo|<nowiki>x ]] y</nowiki>]]
26159 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
26160 !! html/php
26161 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
26162 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
26163 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
26164 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
26165 <a href="/wiki/Foo" title="Foo">|Bar</a>
26166 <a href="/wiki/Foo" title="Foo">]]bar</a>
26167 <a href="/wiki/Foo" title="Foo">[[bar</a>
26168 <a href="/wiki/Foo" title="Foo">x [[ y</a>
26169 <a href="/wiki/Foo" title="Foo">x ]] y</a>
26170 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
26171 </p>
26172 !! end
26173
26174 !! test
26175 Links 3. WikiLinks: No escapes needed
26176 !! options
26177 parsoid=html2wt
26178 !! html/parsoid
26179 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
26180 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
26181 !! wikitext
26182 [[Foo|[Foobar]]
26183 [[Foo|foo|bar]]
26184 !! html/php
26185 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
26186 <a href="/wiki/Foo" title="Foo">foo|bar</a>
26187 </p>
26188 !! end
26189
26190 !! test
26191 Links 4. ExtLinks: Escapes needed
26192 !! options
26193 parsoid=html2wt
26194 !! html/parsoid
26195 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
26196 <a rel="mw:ExtLink" href="http://google.com">google]</a>
26197 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
26198 <p>[http://google.com]</p>
26199 <p>[http://google.com google]</p>
26200 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
26201 <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>
26202 !! wikitext
26203 [http://google.com <nowiki>[google]</nowiki>]
26204 [http://google.com <nowiki>google]</nowiki>]
26205 [http://google.com <nowiki>goog] le</nowiki>]
26206
26207 <nowiki>[http://google.com]</nowiki>
26208
26209 <nowiki>[http://google.com google]</nowiki>
26210
26211 [http://google.com<nowiki>]</nowiki>
26212
26213 [{{echo|http://google.com}}<nowiki>]</nowiki>
26214 !! html/php
26215 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
26216 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
26217 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
26218 </p><p>[http://google.com]
26219 </p><p>[http://google.com google]
26220 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26221 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26222 </p>
26223 !! end
26224
26225 !! test
26226 Links 5. ExtLinks: No escapes needed
26227 !! options
26228 parsoid=html2wt
26229 !! html/parsoid
26230 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
26231 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
26232 !! wikitext
26233 [http://google.com [google]
26234
26235 [[http://google.com]]
26236 !! html/php
26237 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
26238 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
26239 </p>
26240 !! end
26241
26242 !! test
26243 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
26244 !! options
26245 parsoid=html2wt
26246 !! html/parsoid
26247 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
26248 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
26249 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
26250 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
26251 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
26252 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
26253 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26254 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
26255 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26256 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
26257 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
26258 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
26259 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
26260 </p>
26261 !! wikitext
26262 x<nowiki/>http://example.com<nowiki/>y
26263 http://example.com<nowiki/>?x
26264 http://example.com<nowiki/>&x
26265 http://example.com<nowiki/>'x
26266 http://example.com<nowiki/>,x
26267 http://example.com<nowiki/>.x
26268 http://example.com<nowiki/>;x
26269 http://example.com<nowiki/>:x
26270 http://example.com<nowiki/>;x
26271 http://example.com<nowiki/>!x
26272 http://example.com<nowiki/>=x
26273 http://example.com<nowiki/>(x)
26274 http://example.com(x<nowiki/>)
26275 !! end
26276
26277 !! test
26278 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26279 !! options
26280 parsoid=html2wt
26281 !! html/parsoid
26282 <p>x
26283 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
26284 y
26285 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
26286 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
26287 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
26288 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
26289 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
26290 </p>
26291 !! wikitext
26292 x
26293 http://example.com
26294 y
26295 "http://example.com"
26296 (http://example.com)
26297 (http://example.com) foo
26298 http://example.com,
26299 http://example.com, foo
26300 !! html/php
26301 <p>x
26302 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
26303 y
26304 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
26305 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
26306 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
26307 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
26308 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
26309 </p>
26310 !! end
26311
26312 !! test
26313 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26314 !! options
26315 parsoid=html2wt
26316 !! html/parsoid
26317 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
26318 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
26319 !! wikitext
26320 http://example.com.,;:!?\
26321 -http://example.com:
26322 !! html/php
26323 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
26324 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
26325 </p>
26326 !! end
26327
26328 !! test
26329 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
26330 !! options
26331 parsoid=html2wt
26332 !! html/parsoid
26333 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
26334 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
26335 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
26336 !! wikitext
26337 RFC 123<nowiki/>4
26338 RFC 123<nowiki/>y
26339 X<nowiki/>RFC 123<nowiki/>y
26340 !! end
26341
26342 !! test
26343 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
26344 !! options
26345 parsoid=html2wt
26346 !! html/parsoid
26347 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
26348 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
26349 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
26350 </p>
26351 !! wikitext
26352 RFC 123?foo
26353 RFC 123&foo
26354 -RFC 123-
26355 !! html/php
26356 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
26357 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
26358 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
26359 </p>
26360 !! end
26361
26362 !! test
26363 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
26364 !! options
26365 parsoid=html2wt
26366 !! html/parsoid
26367 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
26368 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26369 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26370 !! wikitext
26371 PMID 123<nowiki/>4
26372 PMID 123<nowiki/>y
26373 X<nowiki/>PMID 123<nowiki/>y
26374 !! end
26375
26376 !! test
26377 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
26378 !! options
26379 parsoid=html2wt
26380 !! html/parsoid
26381 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
26382 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
26383 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
26384 </p>
26385 !! wikitext
26386 PMID 123?foo
26387 PMID 123&foo
26388 -PMID 123-
26389 !! html/php
26390 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
26391 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
26392 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
26393 </p>
26394 !! end
26395
26396 !! test
26397 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
26398 !! options
26399 parsoid=html2wt
26400 !! html/parsoid
26401 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
26402 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
26403 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
26404 </p>
26405 !! wikitext
26406 ISBN 1234567890<nowiki/>1
26407 ISBN 1234567890<nowiki/>x
26408 a<nowiki/>ISBN 1234567890<nowiki/>b
26409 !! end
26410
26411 !! test
26412 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
26413 !! options
26414 parsoid=html2wt
26415 !! html/parsoid
26416 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26417 !! wikitext
26418 -ISBN 1234567890's
26419 !! html/php
26420 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26421 </p>
26422 !! end
26423
26424 !! test
26425 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26426 !! options
26427 parsoid=html2wt
26428 !! html/*
26429 <p>this is not a link: http://example.com
26430 </p>
26431 !! wikitext
26432 this is not a link: <nowiki>http://example.com</nowiki>
26433 !! end
26434
26435 !! test
26436 Links 15. Link trails can't become link prefixes.
26437 !! options
26438 language=is
26439 parsoid=html2wt
26440 !! html/parsoid
26441 <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>
26442 !! wikitext
26443 [[Söfnuður]]-[[00]]
26444 !! html/php
26445 <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>
26446 </p>
26447 !! end
26448
26449 #### --------------- Quotes ---------------
26450 #### 1. Quotes inside <b> and <i>
26451 #### 2. Link fragments separated by <i> and <b> tags
26452 #### 3. Link fragments inside <i> and <b>
26453 #### 4. No escaping needed
26454 #### --------------------------------------
26455 !! test
26456 1a. Quotes inside <b> and <i>
26457 !! options
26458 parsoid=html2wt
26459 !! html/*
26460 <p><i>'foo'</i>
26461 <i>''foo''</i>
26462 <i>'''foo'''</i>
26463 <i>foo</i>'s
26464 <b>'foo'</b>
26465 <b>''foo''</b>
26466 <b>'''foo'''</b>
26467 <b>foo'<i>bar'</i>baz</b>
26468 <b>foo</b>'s
26469 '<i>foo</i>
26470 <i>foo</i>'
26471 <i>foo'</i>'
26472 '<i>foo</i>'
26473 '<b>foo</b>
26474 <b>foo</b>'
26475 '<b>foo</b>'
26476 <i>fools'<span> errand</span></i>
26477 <i><span>fool</span>'s errand</i>
26478 '<i>foo</i> bar '<i>baz</i>
26479 a|!*#-:;+-~[]{}b'<i>x</i>
26480 </p>
26481 !! wikitext
26482 ''<nowiki/>'foo'''
26483 ''<nowiki>''foo''</nowiki>''
26484 ''<nowiki>'''foo'''</nowiki>''
26485 ''foo''<nowiki/>'s
26486 '''<nowiki/>'foo''''
26487 '''<nowiki>''foo''</nowiki>'''
26488 '''<nowiki>'''foo'''</nowiki>'''
26489 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26490 '''foo'''<nowiki/>'s
26491 '''foo''
26492 ''foo''<nowiki/>'
26493 ''foo'''<nowiki/>'
26494 '''foo''<nowiki/>'
26495 ''''foo'''
26496 '''foo'''<nowiki/>'
26497 ''''foo'''<nowiki/>'
26498 ''fools'<span> errand</span>''
26499 ''<span>fool</span>'s errand''
26500 '<nowiki/>''foo'' bar '''baz''
26501 a|!*#-:;+-~[]{}b'''x''
26502 !! end
26503
26504 !! test
26505 1b. Quotes inside <b> and <i> with other tags on same line
26506 !! options
26507 parsoid=html2wt
26508 !! html/parsoid
26509 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26510 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26511 <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>
26512 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26513 '<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>
26514 '<i>foo</i> <div title="name">test</div>
26515 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26516 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26517 <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>
26518 </ol>
26519 !! wikitext
26520 '''a'' foo ''[[bar]]''
26521 ''a''' foo ''[[bar]]''
26522 ''a''' foo '''{{echo|[[bar]]}}'''
26523 [[foo]] x'''[[bar]]''
26524 '''foo'' <ref>test</ref>
26525 '''foo'' <div title="name">test</div>
26526 '''foo'' and <br> bar
26527 <references />
26528 !! end
26529
26530 !! test
26531 2. Link fragments separated by <i> and <b> tags
26532 !! options
26533 parsoid=html2wt
26534 !! html/parsoid
26535 <p>[[<i>foo</i>hello]]</p>
26536 <p>[[<b>foo</b>hello]]</p>
26537 !! wikitext
26538 [[''foo''<nowiki>hello]]</nowiki>
26539
26540 [['''foo'''<nowiki>hello]]</nowiki>
26541 !! end
26542
26543 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26544 # this is one of the shortcomings of this format
26545 !! test
26546 3. Link fragments inside <i> and <b>
26547 !! options
26548 parsoid=html2wt
26549 !! html/parsoid
26550 <p><i>[[foo</i>]]</p>
26551 <p><b>[[foo</b>]]</p>
26552 !! wikitext
26553 ''[[foo''<nowiki>]]</nowiki>
26554
26555 '''[[foo'''<nowiki>]]</nowiki>
26556 !! end
26557
26558 !! test
26559 4. No escaping needed
26560 !! options
26561 parsoid=html2wt
26562 !! html/parsoid
26563 <p>'<span><i>bar</i></span>'
26564 '<span><b>bar</b></span>'
26565 'a:b'foo
26566 </p>
26567 !! wikitext
26568 '<span>''bar''</span>'
26569 '<span>'''bar'''</span>'
26570 'a:b'foo
26571 !! end
26572
26573 #### ----------- Paragraphs ---------------
26574 #### 1. No unnecessary escapes
26575 #### --------------------------------------
26576
26577 !! test
26578 1. No unnecessary escapes
26579 !! options
26580 parsoid=html2wt
26581 !! html/parsoid
26582 <p>bar <span>[[foo]]</span>
26583 </p><p>=bar <span>[[foo]]</span>
26584 </p><p>[[bar <span>[[foo]]</span>
26585 </p><p>]]bar <span>[[foo]]</span>
26586 </p><p>=bar <span>foo]]</span>=
26587 </p>
26588 !! wikitext
26589 bar <span><nowiki>[[foo]]</nowiki></span>
26590
26591 =bar <span><nowiki>[[foo]]</nowiki></span>
26592
26593 [[bar <span><nowiki>[[foo]]</nowiki></span>
26594
26595 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26596
26597 =bar <span>foo]]</span><nowiki>=</nowiki>
26598 !!end
26599
26600 #### ----------------------- PRE --------------------------
26601 !! test
26602 1. Leading whitespace in SOL context should be escaped
26603 !! options
26604 parsoid=html2wt
26605 !! html/parsoid
26606 <p> a</p>
26607
26608 <p> a</p>
26609
26610 <p> a(tab)</p>
26611
26612 <p> a
26613 <!--cmt-->
26614 a</p>
26615
26616 <p>a
26617 b</p>
26618
26619 <p>a
26620 b</p>
26621
26622 <p>a
26623 b</p>
26624 !! wikitext
26625 <nowiki> </nowiki>a
26626
26627 <nowiki> </nowiki> a
26628
26629 a(tab)
26630
26631 <nowiki> </nowiki> a
26632 <!--cmt-->
26633 <nowiki> </nowiki>a
26634
26635 a
26636 <nowiki> </nowiki>b
26637
26638 a
26639 b
26640
26641 a
26642 b
26643 !! html/php
26644 <p> a
26645 </p><p> a
26646 </p><p> a(tab)
26647 </p><p> a
26648 a
26649 </p><p>a
26650 b
26651 </p><p>a
26652 b
26653 </p><p>a
26654 b
26655 </p>
26656 !! end
26657
26658 !! test
26659 2. Leading whitespace in non-indent-pre contexts should not be escaped
26660 !! options
26661 parsoid=html2wt
26662 !! html/parsoid
26663 <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>
26664 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26665 <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>
26666 b</span></li>
26667 </ol>
26668 !! wikitext
26669 foo <ref>''a''
26670 b</ref>
26671 <references />
26672 !! end
26673
26674 !! test
26675 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26676 !! options
26677 parsoid=html2wt
26678 !! html/parsoid
26679 <blockquote>
26680 <p>
26681 a
26682 <span>b</span>
26683 c</p>
26684 </blockquote>
26685 !! wikitext
26686 <blockquote>
26687 a
26688 <span>b</span>
26689 c
26690 </blockquote>
26691 !! end
26692
26693 !! test
26694 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26695 !! options
26696 parsoid=html2wt
26697 !! html/parsoid
26698 <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>
26699 !! wikitext
26700 [[File:Foobar.jpg|thumb|caption]]
26701 !! end
26702
26703 !! test
26704 5. Nowiki escaping should account for indent-pres
26705 !! options
26706 parsoid=html2wt
26707 !! html/parsoid
26708 <pre>==foo==</pre>
26709 !! wikitext
26710 ==foo==
26711 !! end
26712
26713 !! test
26714 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26715 !! options
26716 parsoid=html2wt
26717 !! html/parsoid
26718 <pre>
26719 * foo
26720 * bar
26721 </pre>
26722 !! wikitext
26723 * foo
26724 * bar
26725 !! end
26726
26727 !! test
26728 Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup
26729 !! options
26730 parsoid = {
26731 "modes": ["html2wt"],
26732 "scrubWikitext": true
26733 }
26734 !! html/parsoid
26735 <p> foo</p>
26736 <p> %foo</p>
26737 <p> *foo</p>
26738 <p> #foo</p>
26739 <p> =foo=</p>
26740 <p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p>
26741 <p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p>
26742 <p> <!--boo-->*foo</p>
26743 <p><!--boo--> *foo</p>
26744 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p>
26745 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p>
26746 !! wikitext
26747 foo
26748
26749 %foo
26750
26751 <nowiki/>*foo
26752
26753 <nowiki/>#foo
26754
26755 <nowiki/>=foo=
26756
26757 [[Category:Foo]]
26758 <nowiki/>*foo
26759
26760 [[Category:Foo]]
26761 <nowiki>*</nowiki>foo
26762
26763 <nowiki/><!--boo-->*foo
26764
26765 <!--boo--><nowiki/>*foo
26766
26767 <!--a--><!--b--><!--c--><!--d--><!--e-->foo
26768
26769 <!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo
26770 !! end
26771
26772 #### --------------- Behavior Switches --------------------
26773
26774 !! test
26775 1. Valid behavior switches should be escaped
26776 !! options
26777 parsoid=html2wt
26778 !! html/parsoid
26779 __TOC__
26780 <i>__TOC__</i>
26781 !! wikitext
26782 <nowiki>__TOC__</nowiki>
26783 ''<nowiki>__TOC__</nowiki>''
26784 !! end
26785
26786 !! test
26787 2. Invalid behavior switches should not be escaped
26788 !! options
26789 parsoid=html2wt
26790 !! html/parsoid
26791 __TOO__
26792 __|__
26793 !! wikitext
26794 __TOO__
26795 __|__
26796 !! end
26797
26798 # We use indent-pre as an indirect way to test for sol-transparent behavior.
26799 !! test
26800 Behavior switches should be SOL-transparent
26801 !! options
26802 parsoid=html2wt
26803 !! html/parsoid
26804 <meta property="mw:PageProp/toc" />
26805
26806 <!-- this one's bogus -->
26807 <pre>__TOO__</pre>
26808
26809 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26810
26811 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26812 !! wikitext
26813 __TOC__
26814
26815 <!-- this one's bogus -->
26816 __TOO__
26817
26818 __TOC__ foo
26819
26820 __TOC__
26821 bar
26822 !! end
26823
26824 #### --------------- HTML tags ---------------
26825 #### 1. a tags
26826 #### 2. other tags
26827 #### 3. multi-line html tag
26828 #### 4. extension tags
26829 #### -----------------------------------------
26830 !! test
26831 1. a tags
26832 !! options
26833 parsoid=html2wt
26834 !! html/parsoid
26835 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26836 !! wikitext
26837 <a href="http://google.com">google</a>
26838 !! end
26839
26840 !! test
26841 2. other tags
26842 !! options
26843 parsoid=html2wt
26844 !! html/parsoid
26845 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26846 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26847 <li> &lt;td&gt;</li></ul>
26848
26849 !! wikitext
26850 * <nowiki><div>foo</div></nowiki>
26851 * <nowiki><div style="color:red">foo</div></nowiki>
26852 * <nowiki><td></nowiki>
26853 !! end
26854
26855 !! test
26856 3. multi-line html tag
26857 !! options
26858 parsoid=html2wt
26859 !! html/parsoid
26860 <p>&lt;div
26861 &gt;foo&lt;/div
26862 &gt;
26863 </p>
26864 !! wikitext
26865 <nowiki><div
26866 >foo</div
26867 ></nowiki>
26868 !! end
26869
26870 !! test
26871 4. extension tags
26872 !! options
26873 parsoid=html2wt
26874 !! html/parsoid
26875 <p>&lt;ref&gt;foo&lt;/ref&gt;
26876 </p><p>&lt;ref&gt;bar
26877 </p><p>baz&lt;/ref&gt;
26878 </p>
26879 !! wikitext
26880 <nowiki><ref>foo</ref></nowiki>
26881
26882 <nowiki><ref>bar</nowiki>
26883
26884 baz<nowiki></ref></nowiki>
26885 !! end
26886
26887 !! test
26888 Parsoid: newline inducing block nodes don't suppress <nowiki>
26889 !! options
26890 parsoid=html2wt
26891 !! html/parsoid
26892 a<h1>foo</h1>
26893 !! wikitext
26894 <nowiki> </nowiki>a
26895
26896 = foo =
26897 !! end
26898
26899 #### --------------- Others ---------------
26900 !! test
26901 Escaping nowikis
26902 !! options
26903 parsoid=html2wt
26904 !! html/parsoid
26905 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26906 </p>
26907 !! wikitext
26908 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26909 !! end
26910
26911 ## The quote-char in the input is necessary for triggering the bug
26912 !! test
26913 (T54035) Nowiki-escaping should not get tripped by " :" in text
26914 !! options
26915 parsoid=html2wt
26916 !! html/parsoid
26917 <p>foo's bar :</p>
26918 !! wikitext
26919 foo's bar :
26920 !! end
26921
26922 #----------- End of wikitext escaping tests --------------
26923
26924 !! test
26925
26926 Tag-like HTML structures are passed through as text
26927 !! wikitext
26928 <x y>
26929
26930 <x.y>
26931
26932 <x-y>
26933
26934 1>2
26935
26936 x<y
26937
26938 a>b
26939
26940 1<d e>f
26941 !! html
26942 <p>&lt;x y&gt;
26943 </p><p>&lt;x.y&gt;
26944 </p><p>&lt;x-y&gt;
26945 </p><p>1&gt;2
26946 </p><p>x&lt;y
26947 </p><p>a&gt;b
26948 </p><p>1&lt;d e&gt;f
26949 </p>
26950 !! end
26951
26952 !! test
26953 HTML tag with necessary entities in attributes
26954 !! wikitext
26955 <span title="&amp;amp;">foo</span>
26956 !! html
26957 <p><span title="&amp;amp;">foo</span>
26958 </p>
26959 !! end
26960
26961 !! test
26962 HTML tag with 'unnecessary' entity encoding in attributes
26963 !! wikitext
26964 <span title="&amp;">foo</span>
26965 !! html
26966 <p><span title="&amp;">foo</span>
26967 </p>
26968 !! end
26969
26970 !! test
26971 HTML tag with broken attribute value quoting
26972 !! options
26973 parsoid=wt2html,html2html
26974 !! wikitext
26975 <span title="Hello world>Foo</span>
26976 !! html/php
26977 <p><span title="Hello world">Foo</span>
26978 </p>
26979 !! html/parsoid
26980 <p><span title="Hello world">Foo</span></p>
26981 !! end
26982
26983 !! test
26984 Self-closed tag with broken attribute value quoting
26985 !! options
26986 parsoid=wt2html,html2html
26987 !! wikitext
26988 <div title="Hello world />Foo
26989 !! html/php+tidy
26990 <div title="Hello world"></div><p>Foo
26991 </p>
26992 !! html/parsoid
26993 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
26994 !! end
26995
26996 !! test
26997 Table with broken attribute value quoting
26998 !! options
26999 parsoid=wt2html,html2html
27000 !! wikitext
27001 {|
27002 | title="Hello world|Foo
27003 |}
27004 !! html/php
27005 <table>
27006 <tr>
27007 <td title="Hello world">Foo
27008 </td></tr></table>
27009
27010 !! html/parsoid
27011 <table>
27012 <tr>
27013 <td title="Hello world">Foo
27014 </td></tr></table>
27015
27016 !! end
27017
27018 !! test
27019 Table with broken attribute value quoting on consecutive lines
27020 !! options
27021 parsoid=wt2html,html2html
27022 !! wikitext
27023 {|
27024 | title="Hello world|Foo
27025 | style="color:red|Bar
27026 |}
27027 !! html/php
27028 <table>
27029 <tr>
27030 <td title="Hello world">Foo
27031 </td>
27032 <td style="color:red">Bar
27033 </td></tr></table>
27034
27035 !! html/parsoid
27036 <table><tbody>
27037 <tr>
27038 <td title="Hello world">Foo
27039 </td><td style="color: red">Bar
27040 </td></tr></tbody></table>
27041
27042 !! end
27043
27044 !!test
27045 Accept empty td cell attribute
27046 !! wikitext
27047 {|
27048 | align="center" |foo|| |
27049 |}
27050 !! html
27051 <table>
27052 <tr>
27053 <td align="center">foo</td>
27054 <td>
27055 </td></tr></table>
27056
27057 !!end
27058
27059 !!test
27060 Non-empty attributes in th-cells
27061 !! wikitext
27062 {|
27063 !Foo!! style="color: red" |Bar
27064 |}
27065 !! html
27066 <table>
27067 <tr>
27068 <th>Foo</th>
27069 <th style="color: red">Bar
27070 </th></tr></table>
27071
27072 !!end
27073
27074 !!test
27075 Accept empty attributes in th-cells
27076 !! wikitext
27077 {|
27078 !|foo!!|bar
27079 |}
27080 !! html
27081 <table>
27082 <tr>
27083 <th>foo</th>
27084 <th>bar
27085 </th></tr></table>
27086
27087 !!end
27088
27089 !!test
27090 Empty table rows go away
27091 !! wikitext
27092 {|
27093 |Hello
27094 |there
27095 |- class="foo"
27096 |-
27097 |}
27098 !! html
27099 <table>
27100 <tr>
27101 <td>Hello
27102 </td>
27103 <td>there
27104 </td></tr>
27105
27106 </table>
27107
27108 !! end
27109
27110 ###
27111 ### Parsoid-centric tests for testing RTing of inter-element separators
27112 ### Edge cases not tested by existing parser tests and specific to
27113 ### Parsoid-specific serialization strategies.
27114 ###
27115
27116 !!test
27117 RT-ed inter-element separators should be valid separators
27118 !! wikitext
27119 {|
27120 |- [[foo]]
27121 |}
27122 !! html/php
27123 <table>
27124
27125 </table>
27126
27127 !! html/parsoid
27128 <table>
27129 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
27130 </tbody></table>
27131 !!end
27132
27133 # Parsoid-only test of a DOM pass
27134 !!test
27135 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
27136 !! wikitext
27137 {|
27138 |<small>foo
27139 bar
27140 |}
27141
27142 {|
27143 |<small>foo<small>
27144 |}
27145 !! html/parsoid
27146 <table>
27147 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
27148 <p>bar</p></small></td></tr>
27149 </tbody></table>
27150
27151 <table>
27152 <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>
27153 </tbody></table>
27154 !!end
27155
27156 # Note that the "style" attribute is really a template parameter here.
27157 # The = would have to be {{=}} if you wanted the literal.
27158 !!test
27159 Empty TD followed by TD with tpl-generated attribute
27160 !! wikitext
27161 {|
27162 |-
27163 |
27164 |{{echo|style='color:red'}}|foo
27165 |}
27166 !! html
27167 <table>
27168
27169 <tr>
27170 <td>
27171 </td>
27172 <td>foo
27173 </td></tr></table>
27174
27175 !!end
27176
27177 !!test
27178 Indented table with an empty td
27179 !! wikitext
27180 {|
27181 |-
27182 |
27183 |foo
27184 |}
27185 !! html
27186 <table>
27187
27188 <tr>
27189 <td>
27190 </td>
27191 <td>foo
27192 </td></tr></table>
27193
27194 !!end
27195
27196 ## We have some newline diffs RT-ing this edge case
27197 ## and it is not important enough -- we seem to be emitting
27198 ## at most 2 newlines after a </tr> and this is unrelated to
27199 ## the issue from T85627 that this is testing.
27200 !!test
27201 Indented table with blank lines in between (T85627)
27202 !! options
27203 parsoid=wt2html
27204 !! wikitext
27205 {|
27206 |foo
27207
27208
27209 |}
27210 !! html
27211 <table>
27212
27213 <tr>
27214 <td>foo
27215 </td></tr></table>
27216
27217 !!end
27218
27219 !!test
27220 Indented block & table
27221 !! wikitext
27222 <div>foo</div>
27223 {|
27224 |foo
27225 |}
27226 !! html/php
27227 <div>foo</div>
27228 <table>
27229 <tr>
27230 <td>foo
27231 </td></tr></table>
27232
27233 !! html/parsoid
27234 <div data-parsoid='{"stx":"html"}'>foo</div>
27235 <table><tbody>
27236 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
27237 </tbody></table>
27238 !!end
27239
27240 !! test
27241 Indent and comment before table row
27242 !! wikitext
27243 {|
27244 <!--hi-->|-
27245 |there
27246 |}
27247 !! html/php
27248 <table>
27249
27250 <tr>
27251 <td>there
27252 </td></tr></table>
27253
27254 !! html/parsoid
27255 <table>
27256 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
27257 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
27258 </tbody></table>
27259 !! end
27260
27261 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
27262 !!test
27263 Empty TR followed by a template-generated TR
27264 !!options
27265 parsoid
27266 !! wikitext
27267 {|
27268 |-
27269 {{echo|<tr><td>foo</td></tr>}}
27270 |}
27271 !! html
27272 <table>
27273 <tbody>
27274 <tr class='mw-empty-elt'></tr>
27275 <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}}]}'>
27276 <td>foo</td></tr>
27277 </tbody></table>
27278 !!end
27279
27280 ## PHP and parsoid output differ for this, and since this is primarily
27281 ## for testing Parsoid's serializer, marking this Parsoid only
27282 !!test
27283 Empty TR followed by mixed-ws-comment line should RT correctly
27284 !!options
27285 parsoid
27286 !! wikitext
27287 {|
27288 |-
27289 <!--c-->
27290 |-
27291 <!--c--> <!--d-->
27292 |}
27293 !! html
27294 <table>
27295 <tbody>
27296 <tr class='mw-empty-elt'></tr>
27297 <!--c-->
27298 <tr>
27299 <!--c--> </tr><!--d-->
27300 </tbody></table>
27301
27302 !!end
27303
27304 !!test
27305 Multi-line image caption generated by templates with/without trailing newlines
27306 !! wikitext
27307 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
27308 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
27309 !! html/parsoid
27310 <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>
27311 <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>
27312 !!end
27313
27314 !! test
27315 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
27316 !! options
27317 parsoid=html2wt
27318 !! html/parsoid
27319 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>foo&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><p>new para</p>
27320
27321 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
27322 !! wikitext
27323 <includeonly>foo</includeonly>
27324 new para
27325
27326 [[Category:Foo]]
27327
27328 = new heading =
27329 !! end
27330
27331 ## PHP emits broken html for this, and since this is primarily
27332 ## a Parsoid serializer test, marking this Parsoid only
27333 !!test
27334 Improperly nested inline or quotes tags with whitespace in between
27335 !! wikitext
27336 <span> <s>x</span> </s>
27337 ''' ''x''' ''
27338 !! html/parsoid
27339 <p><span> <s>x</s></span><s> </s>
27340 <b> <i>x</i></b><i> </i>
27341 </p>
27342 !!end
27343
27344 !!test
27345 Encapsulate protected attributes from wt
27346 !! wikitext
27347 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
27348
27349 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
27350 |ok
27351 |}
27352 !! html/parsoid
27353 <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>
27354
27355 <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">
27356 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'>ok</td></tr>
27357 </tbody></table>
27358 !!end
27359
27360 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
27361 ## Having nested or stray pre tags results in the attempt to add duplicates,
27362 ## causing an assertion fail. This test tries to prevent that situation.
27363 !!test
27364 Ensure ParagraphWrapper can deal with stray closing pre tags
27365 !!options
27366 parsoid=wt2html
27367 !! wikitext
27368 plain text</pre>
27369 !! html/parsoid
27370 plain text
27371 !!end
27372
27373 !! test
27374 1. Ensure fostered text content is wrapped in element nodes
27375 !! options
27376 parsoid=wt2html
27377 !! wikitext
27378 <table>hi</table><table>ho</table>
27379 !! html/php+tidy
27380 hi<table></table>ho<table></table>
27381 !! html/parsoid
27382 <span data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>hi</span><table data-parsoid='{"stx":"html"}'></table><span data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>ho</span><table data-parsoid='{"stx":"html"}'></table>
27383 !! end
27384
27385 !! test
27386 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
27387 !! options
27388 parsoid=wt2html,wt2wt
27389 !! wikitext
27390 <table>
27391 <tr> || ||
27392 <td> a
27393 </table>
27394 !! html/php+tidy
27395 || ||
27396 <table>
27397 <tbody><tr><td> a
27398 </td></tr></tbody></table>
27399 !! html/parsoid
27400 <span data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||
27401 </span><table data-parsoid='{"stx":"html"}'>
27402 <tbody><tr data-parsoid='{"stx":"html","autoInsertedEnd":true}'><td data-parsoid='{"stx":"html","autoInsertedEnd":true}'> a
27403 </td></tr></tbody></table>
27404 !! end
27405
27406 !! test
27407 Encapsulation properly handles null DSR information from foster box
27408 !! options
27409 parsoid=wt2html,wt2wt
27410 !! wikitext
27411 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
27412 !! html/parsoid
27413 <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;<table>foo<tr><td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span><table><tbody><tr><td>bar</td></tr></tbody></table>
27414 !! end
27415
27416 !! test
27417 1. Encapsulate foster-parented transclusion content
27418 !! options
27419 parsoid=wt2wt,wt2html
27420 !! wikitext
27421 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
27422 !! html/php+tidy
27423 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
27424 !! html/parsoid
27425 <span 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</span><table about="#mwt2" data-parsoid='{"stx":"html}'><tbody><tr><td>bar</td></tr></tbody></table>
27426 !! end
27427
27428 !! test
27429 2. Encapsulate foster-parented transclusion content
27430 !! options
27431 parsoid=wt2wt,wt2html
27432 !! wikitext
27433 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
27434 !! html/parsoid
27435 <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>
27436 <table>
27437 <tbody>
27438 <tr>
27439 <td>bar</td>
27440 </tr>
27441 </tbody>
27442 </table>
27443 !! end
27444
27445 !! test
27446 3. Encapsulate foster-parented transclusion content
27447 !! options
27448 parsoid=wt2wt,wt2html
27449 !! wikitext
27450 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27451 !! html/parsoid
27452 <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;]}">
27453 <p>foo</p>
27454 </div>
27455 <table>
27456 <tbody>
27457 <tr>
27458 <td>bar</td>
27459 </tr>
27460 </tbody>
27461 </table>
27462 !! end
27463
27464 !! test
27465 4. Encapsulate foster-parented transclusion content
27466 !! options
27467 parsoid=wt2wt,wt2html
27468 !! wikitext
27469 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27470 !! html/parsoid
27471 <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;]}">
27472 <p>foo</p>
27473 </div>
27474 <table>
27475 <tbody>
27476 <tr>
27477 <td>bar</td>
27478 </tr>
27479 </tbody>
27480 </table>
27481 !! end
27482
27483 !! test
27484 5. Encapsulate foster-parented transclusion content
27485 !!options
27486 parsoid=wt2wt,wt2html
27487 !! wikitext
27488 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27489 !! html/php+tidy
27490 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
27491 !! html/parsoid
27492 <span 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</span><table about="#mwt2" data-parsoid='{"stx":"html"}'><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
27493 !! end
27494
27495 !! test
27496 6. Encapsulate foster-parented transclusion content
27497 !! options
27498 parsoid=wt2wt,wt2html
27499 !! wikitext
27500 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27501 !! html/php+tidy
27502 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
27503 !! html/parsoid
27504 <span 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</span><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>
27505 !! end
27506
27507 !! test
27508 7. Encapsulate foster-parented transclusion content
27509 !!options
27510 parsoid=wt2wt,wt2html
27511 !! wikitext
27512 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27513 !! html/parsoid
27514 <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>
27515 <table>
27516 <tbody>
27517 <tr>
27518 <td>bar</td>
27519 </tr>
27520 </tbody>
27521 </table>
27522 !! end
27523
27524 # Note that the wt is broken on purpose: the = should be {{=}} if you
27525 # don't want it to be a template parameter key.
27526 !! test
27527 8. Encapsulate foster-parented transclusion content
27528 !! options
27529 parsoid=wt2wt,wt2html
27530 !! wikitext
27531 {{echo|a
27532 }}{|{{echo|style='color:red'}}
27533 |-
27534 |b
27535 |}
27536 !! html/php+tidy
27537 <p>a
27538 </p>
27539 <table>
27540
27541 <tbody><tr>
27542 <td>b
27543 </td></tr></tbody></table>
27544 !! html/parsoid
27545 <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">
27546 </span><span 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}}}</span><table about="#mwt3">
27547 <tbody><tr>
27548 <td>b
27549 </td></tr></tbody></table>
27550 !! end
27551
27552 !! test
27553 9. Encapsulate foster-parented transclusion content
27554 !!options
27555 parsoid=wt2wt,wt2html
27556 !! wikitext
27557 <table>{{echo|hi</table>hello}}
27558 !! html/php+tidy
27559 hi<table></table><p>hello
27560 </p>
27561 !! html/parsoid
27562 <span 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</span><table about="#mwt2"></table><p about="#mwt2">hello</p>
27563 !! end
27564
27565 !! test
27566 Table in fosterable position
27567 !!options
27568 parsoid=wt2html
27569 !! wikitext
27570 {{OpenTable}}
27571 <div>
27572 {|
27573 |}
27574 </div>
27575 |}
27576 !! html/parsoid
27577 <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">
27578 </span>
27579 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27580
27581 <table>
27582 </table>
27583 !! end
27584
27585 # Parsoid only for T66747
27586 !! test
27587 Properly encapsulate empty-content transclusions in fosterable positions
27588 !! wikitext
27589 <table>
27590 {{#if:|
27591 <td>foo</td>
27592 }}
27593 </table>
27594 !! html/parsoid
27595 <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"}]]}'>
27596
27597 </table>
27598 !! end
27599
27600 !! test
27601 Always encapsulate foster box when template range is expanded to table
27602 !! options
27603 parsoid=wt2wt
27604 !! wikitext
27605 {|
27606 hello
27607 {{OpenTable}}
27608 |}
27609 !! html/parsoid
27610
27611 !! end
27612
27613 !! test
27614 T115289: Unclosed table
27615 !! wikitext
27616 {{echo|<table>}}<!--c-->[[Category:Two]]
27617 !! html/parsoid
27618 <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>
27619 !! end
27620
27621 !! test
27622 T115289: Don't migrate newlines out of tables with fostered content
27623 !! wikitext
27624 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27625 !! html/parsoid
27626 <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>
27627 !! end
27628
27629 !! test
27630 T73074: More fostering fun
27631 !! wikitext
27632 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27633 !! html/parsoid
27634 <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>
27635 !! end
27636
27637 !!test
27638 Support <object> element with .data attribute
27639 !!options
27640 parsoid=html2wt
27641 !! html/parsoid
27642 <object data="test.swf"></object>
27643 !! wikitext
27644 <object data="test.swf"></object>
27645 !!end
27646
27647 !! test
27648 Don't block XML namespace declaration
27649 !! wikitext
27650 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27651 !! html/php
27652 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27653 </p>
27654 !! html/parsoid
27655 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27656 !! end
27657
27658 # -----------------------------------------------------------------
27659 # The following section of tests are primarily to spec requirements
27660 # around Parsoid's serialization (old, new, edited content)
27661 #
27662 # All these tests are marked Parsoid html2wt and html2html only
27663 # ----------------------------------------------------------------
27664
27665 !! test
27666 Ignore rel attribute in a-tags during serialization to url-links
27667 !! options
27668 parsoid=html2wt
27669 !! html/parsoid
27670 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27671 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27672 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27673 !! wikitext
27674 http://en.wikipedia.org/wiki/Foobar
27675 http://en.wikipedia.org/wiki/Foobar
27676 http://en.wikipedia.org/wiki/Foobar
27677 !! end
27678
27679 # 'mi' is a localinterwiki prefix as well as a language
27680 !! test
27681 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27682 !! options
27683 parsoid=html2wt
27684 !! html/parsoid
27685 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27686 !! wikitext
27687 [[Foo]]
27688 !! end
27689
27690 !! test
27691 Parsoid should accept interwiki shortcuts
27692 !! options
27693 parsoid=html2wt
27694 !! html/parsoid
27695 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27696 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27697 <a href='./fr:Foo'>Foo</a></p>
27698 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27699 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27700 <a href='fr%3AFoo'>Foo</a></p>
27701 <p><a href='FR%3AFoo'>Foo</a>
27702 <a href='./FR:Foo'>Foo</a></p>
27703 !! wikitext
27704 [[:fr:Foo|Foo]]
27705 [[:fr:Foo|Foo]]
27706 [[:fr:Foo|Foo]]
27707
27708 [[:fr:Foo|Foo]]
27709 [[:fr:Foo|Foo]]
27710 [[:fr:Foo|Foo]]
27711
27712 [[:fr:Foo|Foo]]
27713 [[:fr:Foo|Foo]]
27714 !! end
27715
27716 !! test
27717 Parsoid should not accept invalid interwiki shortcuts
27718 !! options
27719 parsoid=html2wt
27720 !! html/parsoid
27721 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
27722 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
27723 <a href='news:Foo'>Foo</a></p>
27724 !! wikitext
27725 [news:Foo Foo]
27726 [news:Foo Foo]
27727 [news:Foo Foo]
27728 !! end
27729
27730 # See T93839
27731 !! test
27732 New wikilinks should be serialized properly
27733 !! options
27734 parsoid=html2wt
27735 !! html/parsoid
27736 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
27737 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
27738 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
27739 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
27740 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
27741 !! wikitext
27742 [[Foo]]
27743 [[Foo]]
27744 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
27745 http://en.wikipedia.org/wiki/Foo
27746 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
27747 !! end
27748
27749 !! test
27750 New wiki links (href variations)
27751 !! options
27752 parsoid=html2wt
27753 !! html/parsoid
27754 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27755 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
27756 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
27757 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
27758 !! wikitext
27759 [[Foo_bar]]
27760 [[Foo_bar]]
27761 [[Foo_bar]]
27762 [[Toxine bactérienne]]
27763 !! end
27764
27765 !! test
27766 New wiki links (content string variations)
27767 !! options
27768 parsoid=html2wt
27769 !! html/parsoid
27770 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27771 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
27772 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
27773 !! wikitext
27774 [[Foo_bar]]
27775 [[Foo bar]]
27776 [[Foo_bar|./Foo_bar]]
27777 !! end
27778
27779 !! test
27780 New category links (href variations)
27781 !! options
27782 parsoid=html2wt
27783 !! html/parsoid
27784 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
27785 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
27786 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
27787 !! wikitext
27788 [[Category:Toxine bactérienne]]
27789 [[Category:Toxine bactérienne]]
27790 [[Category:Toxine bactérienne]]
27791 !! end
27792
27793 !! test
27794 New sol transparent links don't need indent-pre nowiki protection
27795 !! options
27796 parsoid=html2wt
27797 language=de
27798 !! html/parsoid
27799 <link rel="mw:PageProp/redirect" href="./Main_Page">
27800 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27801 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27802 !! wikitext
27803 #WEITERLEITUNG [[Main Page]]
27804 <!-- this is good --> [[Category:Good]]
27805 <!-- this is great --> [[Kategorie:Great]]
27806 !! end
27807
27808 !! test
27809 New interlanguage links (href variations)
27810 !! options
27811 parsoid=html2wt
27812 !! html/parsoid
27813 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
27814 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
27815 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
27816 !! wikitext
27817 [[es:Toxine bactérienne]]
27818 [[es:Toxine_bactérienne]]
27819 [[es:Toxine_bactérienne]]
27820 !! end
27821
27822 !! test
27823 Image: Modifying size of an image (1)
27824 !! options
27825 parsoid={
27826 "modes": ["wt2wt"],
27827 "changes": [
27828 ["img[height]", "attr", "height", "22"],
27829 ["img[width]", "attr", "width", "200"]
27830 ]
27831 }
27832 !! wikitext
27833 [[Image:Foobar.jpg|230x230px]]
27834 !! wikitext/edited
27835 [[Image:Foobar.jpg|200x200px]]
27836 !!end
27837
27838 !! test
27839 Image: Modifying size of an image (2)
27840 !! options
27841 parsoid={
27842 "modes": ["wt2wt"],
27843 "changes": [
27844 ["img[height]", "attr", "height", "100"],
27845 ["img[width]", "attr", "width", "500"]
27846 ]
27847 }
27848 !! wikitext
27849 [[Image:Foobar.jpg|230x230px]]
27850 !! wikitext/edited
27851 [[Image:Foobar.jpg|500x500px]]
27852 !!end
27853
27854 # Change in size is ignored so long as class='mw-default-size'
27855 !! test
27856 Image: Modifying size of an image (3)
27857 !! options
27858 parsoid={
27859 "modes": ["wt2wt"],
27860 "changes": [
27861 ["figure[class]", "removeClass", "mw-default-size"],
27862 ["figure img", "attr", "height", "19"],
27863 ["figure img", "attr", "width", "170"]
27864 ]
27865 }
27866 !! wikitext
27867 [[Image:Foobar.jpg|thumb]]
27868 !! wikitext/edited
27869 [[Image:Foobar.jpg|thumb|170x170px]]
27870 !!end
27871
27872 !! test
27873 Image: Modifying alignment of an image (T50665)
27874 !! options
27875 parsoid={
27876 "modes": ["wt2wt"],
27877 "changes": [
27878 ["figure[class]", "removeClass", "mw-halign-right"],
27879 ["figure[class]", "addClass", "mw-halign-left"]
27880 ]
27881 }
27882 !! wikitext
27883 [[Image:Foobar.jpg|thumb|caption|right]]
27884 !! wikitext/edited
27885 [[Image:Foobar.jpg|thumb|caption|left]]
27886 !! end
27887
27888 !! test
27889 Image: Modifying mw-default-size of an frameless image (T64805)
27890 !! options
27891 parsoid={
27892 "modes": ["wt2wt"],
27893 "changes": [
27894 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27895 ]
27896 }
27897 !! wikitext
27898 [[Image:Foobar.jpg|frameless|right]]
27899 !! wikitext/edited
27900 [[Image:Foobar.jpg|frameless|right|220x220px]]
27901 !! end
27902
27903 !! test
27904 Image: Modifying valign of an image (T51221)
27905 !! options
27906 parsoid={
27907 "modes": ["wt2wt"],
27908 "changes": [
27909 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27910 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27911 ]
27912 }
27913 !! wikitext
27914 [[File:Foobar.jpg|20px|middle]]
27915 !! wikitext/edited
27916 [[File:Foobar.jpg|20px|text-top]]
27917 !! end
27918
27919 !! test
27920 Image: Modifying alt attribute of an image (T58400)
27921 !! options
27922 parsoid={
27923 "modes": ["wt2wt"],
27924 "changes": [
27925 ["img[alt]", "attr", "alt", "some alternate edited text"]
27926 ]
27927 }
27928 !! wikitext
27929 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
27930 !! wikitext/edited
27931 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
27932 !!end
27933
27934 !! test
27935 Image: Modifying caption of an image
27936 !! options
27937 parsoid={
27938 "modes": ["wt2wt"],
27939 "changes": [
27940 ["figcaption", "text", "new caption"]
27941 ]
27942 }
27943 !! wikitext
27944 [[Image:Foobar.jpg|thumb|original caption]]
27945 !! wikitext/edited
27946 [[Image:Foobar.jpg|thumb|new caption]]
27947 !!end
27948
27949 !! test
27950 Image: empty alt attribute (T50924)
27951 !! options
27952 parsoid
27953 !! wikitext
27954 [[File:Foobar.jpg|thumb|alt=|bar]]
27955 !! html
27956 <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>
27957 !! end
27958
27959 !! test
27960 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
27961 !! options
27962 parsoid=html2wt
27963 language=ar
27964 disabled
27965 !! html/parsoid
27966 <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>
27967 !! wikitext
27968 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
27969 !! end
27970
27971 !! test
27972 Image: Block level image should have \n before and after
27973 !! wikitext
27974 123
27975 [[File:Foobar.jpg|right|thumb|150x150px]]
27976 456
27977 !! html/parsoid
27978 <p>123</p>
27979 <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>
27980 <p>456</p>
27981 !! end
27982
27983 !! test
27984 Image: New block level image should have \n before and after (existing content)
27985 !! wikitext
27986 123
27987 [[File:Foobar.jpg|right|thumb|150x150px]]
27988 456
27989 !! html/parsoid
27990 <p>123</p>
27991 <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>
27992 <p>456</p>
27993 !! end
27994
27995 !! test
27996 Image: upright option (parsoid)
27997 !! wikitext
27998 [[File:Foobar.jpg|thumb|upright|caption]]
27999 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
28000 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
28001 !! html/parsoid
28002 <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>
28003 <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>
28004 <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>
28005 !! end
28006
28007 !! test
28008 Image: upright option is ignored on inline and frame images (parsoid)
28009 !! wikitext
28010 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
28011 !! html/parsoid
28012 <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>
28013 !! end
28014
28015 !! test
28016 Image: in template parameter with empty parameter
28017 !! wikitext
28018 {{echo|[[File:Foobar.jpg|link=]]}}
28019 !! html/parsoid
28020 <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>
28021 !! end
28022
28023 !! test
28024 Image: from basic HTML (1)
28025 !! options
28026 parsoid=html2wt
28027 !! html/parsoid
28028 <span typeof="mw:Image">
28029 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28030 </span>
28031 !! wikitext
28032 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28033 !! end
28034
28035 !! test
28036 Image: from basic HTML (2)
28037 !! options
28038 parsoid=html2wt
28039 !! html/parsoid
28040 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28041 !! wikitext
28042 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28043 !! end
28044
28045 !! test
28046 Image: from basic HTML (3)
28047 !! options
28048 parsoid=html2wt
28049 !! html/parsoid
28050 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
28051 !! wikitext
28052 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
28053 !! end
28054
28055 !! test
28056 Image: from basic HTML (4)
28057 !! options
28058 parsoid=html2wt
28059 !! html/parsoid
28060 <img src="./File:Foobar.jpg">
28061 !! wikitext
28062 [[File:Foobar.jpg|link=]]
28063 !! end
28064
28065 !! test
28066 Image: Invalid title as link
28067 !! wikitext
28068 [[File:Foobar.jpg|link=<]]
28069 !! html/php
28070 <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>
28071 </p>
28072 !! html/parsoid
28073 <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>
28074 !! end
28075
28076 !! test
28077 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
28078 !! options
28079 parsoid=html2wt
28080 !! html/parsoid
28081 <ul>
28082 <li><p>foo</p></li>
28083 </ul>
28084 !! wikitext
28085 * foo
28086 !! end
28087
28088 !! test
28089 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
28090 !! options
28091 parsoid=html2wt
28092 !! html/parsoid
28093 <ul> <li>foo</li></ul>
28094 !! wikitext
28095 * foo
28096 !! end
28097
28098 !! test
28099 Don't strip leading whitespace when handling indent-pre suppressing tags
28100 !! options
28101 parsoid=html2wt
28102 !! html/parsoid
28103 <table>
28104 <tr><td> indented row</td></tr>
28105 </table>
28106 <blockquote><p>
28107 <b>This is very bold of you!</b>
28108 </p>
28109 <table><tr><td>
28110 indented cell (no pre-wrapping!)
28111 </td></tr></table>
28112 </blockquote>
28113 <p>foo</p>
28114 <div>bar</div>
28115 !! wikitext
28116 {|
28117 | indented row
28118 |}
28119 <blockquote>
28120 '''This is very bold of you!'''
28121
28122 {|
28123 |
28124 indented cell (no pre-wrapping!)
28125 |}
28126 </blockquote>
28127 foo
28128 <div>bar</div>
28129 !! end
28130
28131 !! test
28132 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
28133 !! options
28134 parsoid=html2wt
28135 !! html/parsoid
28136 <p>foo</p>
28137 <span>bar</span>
28138
28139 <span>foo2
28140 </span>bar2
28141
28142 <div>foo</div>
28143 <span>bar</span>
28144
28145 <div>
28146 <span>foo</span>
28147 </div>
28148 !! wikitext
28149 foo
28150
28151 <span>bar</span>
28152
28153 <span>foo2
28154 <nowiki> </nowiki></span>bar2
28155
28156 <div>foo</div>
28157 <nowiki> </nowiki><span>bar</span>
28158
28159 <div>
28160 <nowiki> </nowiki><span>foo</span>
28161 </div>
28162 !! end
28163
28164 !! test
28165 Lists: Dont insert newlines in a serialized list item.
28166 !! options
28167 parsoid=html2wt
28168 !! html/parsoid
28169 <ul><li>a<br>b</li><li>c</li></ul>
28170 !! wikitext
28171 * a<br />b
28172 * c
28173 !! end
28174
28175 !! test
28176 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
28177 !! options
28178 parsoid={
28179 "modes": ["html2wt"],
28180 "scrubWikitext": false
28181 }
28182 !! html/parsoid
28183 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28184 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28185
28186 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28187 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28188
28189 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
28190
28191 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28192 !! wikitext
28193 == hello there [[Category:A1]] ==
28194
28195 == [[Category:A2]] hi pal ==
28196
28197 == <!--foo--> [[Category:A3]] how goes it ==
28198
28199 == it goes well [[Category:A4]] <!--bar--> ==
28200
28201 ==howdy [[Category:A5]]==
28202
28203 == __TOC__ ok ==
28204 !! end
28205
28206 !! test
28207 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
28208 !! options
28209 parsoid={
28210 "modes": ["html2wt"],
28211 "scrubWikitext": true
28212 }
28213 !! html/parsoid
28214 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28215 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28216
28217 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28218 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28219
28220 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28221 !! wikitext
28222 == hello there ==
28223 [[Category:A1]]
28224 [[Category:A2]]
28225
28226 == hi pal ==
28227
28228 <!--foo-->[[Category:A3]]
28229
28230 == how goes it ==
28231
28232 == it goes well ==
28233 [[Category:A4]] <!--bar-->
28234
28235 __TOC__
28236
28237 == ok ==
28238 !! end
28239
28240 !! test
28241 Headings: Don't hoist metas that come from templates
28242 !! options
28243 parsoid={
28244 "modes": ["html2wt"],
28245 "scrubWikitext": true
28246 }
28247 !! html/parsoid
28248 <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>
28249 !! wikitext
28250 == {{echo|foo [[Category:Foo]]}} ==
28251 !! end
28252
28253 !! test
28254 Headings: Category in ref isn't hoisted
28255 !! options
28256 parsoid={
28257 "modes": ["html2wt"],
28258 "scrubWikitext": true
28259 }
28260 !! html/parsoid
28261 <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>
28262
28263 <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>
28264 !! wikitext
28265 == foo <ref>bar
28266 [[Category:Baz]] </ref> ==
28267
28268 <references />
28269 !! end
28270
28271 !! test
28272 Parsoid: Serialize positional parameters with = in them as named parameter
28273 !! options
28274 parsoid=html2wt
28275 !! html/parsoid
28276 <p about="#mwt1" typeof="mw:Transclusion"
28277 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
28278
28279 <p about="#mwt1" typeof="mw:Transclusion"
28280 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
28281
28282 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28283 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28284 <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>
28285 !! wikitext
28286 {{echo|1=f=oo}}
28287
28288 {{echo|1=f=oo|2=bar}}
28289
28290 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28291 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28292 {{echo|<nowiki>f=oo</nowiki>|bar}}
28293 !! end
28294
28295 !! test
28296 Parsoid: Serialize positional parameters with = in extlink as named parameter
28297 !! options
28298 parsoid=html2wt
28299 !! html/parsoid
28300 <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>
28301 !! wikitext
28302 {{echo|1=http://stuff?is=ok}}
28303 !! end
28304
28305 !! test
28306 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
28307 !! options
28308 parsoid=html2wt
28309 !! html/parsoid
28310 <div>a<p>b</p></div>
28311 <div>a
28312 <p>b</p></div>
28313 <div>
28314 a
28315 <p>b</p></div>
28316 !! wikitext
28317 <div>a
28318 b
28319 </div>
28320 <div>a
28321 b
28322 </div>
28323 <div>
28324 a
28325
28326 b
28327 </div>
28328 !! end
28329
28330 !! test
28331 Substrings resembling wikitext in hrefs should not get nowiki escapes
28332 !! options
28333 parsoid=html2wt
28334 !! html/parsoid
28335 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
28336 !! wikitext
28337 [[Foo''bar''baz]]
28338 !! end
28339
28340 !! test
28341 Enforce single-line context in the serializer
28342 !! options
28343 parsoid=html2wt
28344 !! html/parsoid
28345 <h2>testing
28346 123</h2>
28347
28348 <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">
28349 </span><span about="#mwt1">you</span> </h2>
28350
28351 <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>
28352
28353 <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
28354 there</span></li></ol>
28355
28356 <ul><li>asd
28357 sdf</li></ul>
28358
28359 <ul><li>foo
28360 bar
28361 baz</li>
28362 <li>foo <b>bar</b>
28363 baz</li></ul>
28364
28365 <dl><dt>hi
28366 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
28367 ho</dd></dl>
28368
28369 <dl><dd> <table>
28370 <tbody><tr><td> ha
28371 ha
28372 ha</td></tr>
28373 </tbody></table></dd></dl>
28374 !! wikitext
28375 == testing 123 ==
28376
28377 == hi {{bogus|there
28378 you}} ==
28379
28380 == foo <ref>hello
28381 there</ref> ==
28382
28383 <references />
28384
28385 * asd sdf
28386
28387 * foo bar baz
28388 * foo '''bar''' baz
28389
28390 ; hi ho : hi ho
28391
28392 : {|
28393 | ha
28394 ha
28395 ha
28396 |}
28397 !! end
28398
28399 !! test
28400 Serialize new placeholder space without spans
28401 !! options
28402 parsoid=html2wt
28403 !! html/parsoid
28404 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
28405
28406 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
28407
28408 <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>
28409 !! wikitext
28410 foo : bar
28411
28412 foo : bar
28413
28414 <ref>foo : bar</ref>ok
28415 !! end
28416
28417
28418 #-----------------------
28419 # Tag minimization tests
28420 #-----------------------
28421
28422 !! test
28423 1. I/B quote minimization: wikitext-only tags should be combined
28424 !! options
28425 parsoid=html2wt
28426 !! html/parsoid
28427 <p><i>A</i><i>B</i></p>
28428 <p><b>A</b><b>B</b></p>
28429 <p><i>A</i><b><i>B</i></b></p>
28430 <p><b>A</b><i><b>B</b></i></p>
28431 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
28432 <p><i><b>A</b></i><i><b>B</b></i></p>
28433 <p><i><b>A</b></i><b><i>B</i></b></p>
28434 <p><b><i>A</i></b><i><b>B</b></i></p>
28435 !! wikitext
28436 ''AB''
28437
28438 '''AB'''
28439
28440 ''A'''B'''''
28441
28442 '''A''B'''''
28443
28444 '''A''BC''D'''
28445
28446 '''''AB'''''
28447
28448 '''''AB'''''
28449
28450 '''''AB'''''
28451 !! end
28452
28453 !! test
28454 2. I/B quote minimization: wikitext and html tags should not be combined
28455 !! options
28456 parsoid=html2wt
28457 !! html/parsoid
28458 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
28459 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
28460 !! wikitext
28461 ''A''<i>B</i>
28462
28463 ''A''<nowiki/>'''<i>B</i>'''
28464 !! end
28465
28466 !! test
28467 3. I/B quote minimization: templated content stops minimization
28468 !! options
28469 parsoid=html2wt
28470 !! html/parsoid
28471 <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>
28472 <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>
28473 !! wikitext
28474 ''A''{{echo|''B''}}
28475
28476 ''A''{{echo|'''''B'''''}}
28477 !! end
28478
28479 !! test
28480 4. I/B quote minimization: new content should be mimimized with adjacent old content
28481 !! options
28482 parsoid=html2wt
28483 !! html/parsoid
28484 <p><i>A</i><i>B</i></p>
28485 <p><b>A</b><b>B</b></p>
28486 <p><i>A</i><b><i>B</i></b></p>
28487 !! wikitext
28488 ''AB''
28489
28490 '''AB'''
28491
28492 ''A'''B'''''
28493 !! end
28494
28495 !! test
28496 5a. Merge adjacent quote nodes if they've been edited
28497 !! options
28498 parsoid={
28499 "modes": ["wt2wt", "selser"],
28500 "changes": [
28501 ["p", "contents", "remove", ":contains('b')"]
28502 ]
28503 }
28504 !! wikitext
28505 ''a''b''c''
28506 !! wikitext/edited
28507 ''ac''
28508 !! end
28509
28510 !! test
28511 5b. Merge adjacent quote nodes if they've been edited
28512 !! options
28513 parsoid={
28514 "modes": ["wt2wt", "selser"],
28515 "changes": [
28516 ["#x", "remove"]
28517 ]
28518 }
28519 !! wikitext
28520 ''a''<span id="x">b</span>''c''
28521 !! wikitext/edited
28522 ''ac''
28523 !! end
28524
28525 !! test
28526 1. Merge adjacent link nodes as long as at least one element is new
28527 !! options
28528 parsoid={
28529 "modes": ["html2wt"],
28530 "scrubWikitext": true
28531 }
28532 !! html/parsoid
28533 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28534 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28535 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28536 !! wikitext
28537 [[Football]]
28538 [[Football]]
28539 [[Football|Foot]][[Football|ball]]
28540 !! end
28541
28542 !! test
28543 2. Merge adjacent link nodes and enable additional normalizations
28544 !! options
28545 parsoid={
28546 "modes": ["html2wt"],
28547 "scrubWikitext": true
28548 }
28549 !! html/parsoid
28550 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28551 !! wikitext
28552 ''[[Football]]''
28553 !! end
28554
28555 !! test
28556 3. Don't merge adjacent link nodes if scrubWikitext is false
28557 !! options
28558 parsoid={
28559 "modes": ["html2wt"],
28560 "scrubWikitext": false
28561 }
28562 !! html/parsoid
28563 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28564 !! wikitext
28565 [[Football|Foot]][[Football|ball]]
28566 !! end
28567
28568 !! test
28569 1. Move format tags outside of WikiLink
28570 !! options
28571 parsoid={
28572 "modes": ["html2wt"],
28573 "scrubWikitext": true
28574 }
28575 !! html/parsoid
28576 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
28577 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
28578 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
28579 !! wikitext
28580 ''[[Football]]''
28581 '''''[[Football]]'''''
28582 <u>'''''[[Football]]'''''</u>
28583 !! end
28584
28585 !! test
28586 2. Move format tags outside of WikiLink with mergable A tags
28587 !! options
28588 parsoid={
28589 "modes": ["html2wt"],
28590 "scrubWikitext": true
28591 }
28592 !! html/parsoid
28593 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
28594 !! wikitext
28595 '''''[[Football]]'''''
28596 !! end
28597
28598 !! test
28599 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
28600 !! options
28601 parsoid={
28602 "modes": ["html2wt"],
28603 "scrubWikitext": true
28604 }
28605 !! html/parsoid
28606 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
28607 !! wikitext
28608 <font color="red"><u>'''[[Foo]]'''</u></font>
28609 !! end
28610
28611 !! test
28612 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
28613 !! options
28614 parsoid={
28615 "modes": ["html2wt"],
28616 "scrubWikitext": true
28617 }
28618 !! html/parsoid
28619 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
28620 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
28621 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
28622 !! wikitext
28623 [[Foo|<font color="red">Foo</font>]]
28624 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
28625 [[Foo|<span class="Bar">Foo</span>]]
28626 !! end
28627
28628 !! test
28629 5. T194083 Regression test: Manual edit test that also enables scrubWikitext to move format tags outside wikilinks
28630 !! options
28631 parsoid={
28632 "modes": ["selser"],
28633 "scrubWikitext": true,
28634 "changes": [
28635 ["a", "html", "<i>Foo</i>"]
28636 ]
28637 }
28638 !! wikitext
28639 [[Foo]]
28640 !! wikitext/edited
28641 ''[[Foo]]''
28642 !! end
28643
28644 !! test
28645 6. Regression test: Manual edit test to ensure diff markers are not lost
28646 !! options
28647 parsoid={
28648 "modes": ["selser"],
28649 "scrubWikitext": true,
28650 "changes": [
28651 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
28652 ]
28653 }
28654 !! wikitext
28655 ''Foo''
28656 !! wikitext/edited
28657 ''[[Foo]]''
28658 !! end
28659
28660 #------------------------------
28661 # End of tag minimization tests
28662 #------------------------------
28663
28664 !!test
28665 T56262: New entities
28666 !! options
28667 parsoid=html2wt
28668 !! html/parsoid
28669 <span typeof="mw:Entity">&nbsp;</span>
28670 !! wikitext
28671 &nbsp;
28672 !! end
28673
28674 ## Note that there is no wikitext output for 'unknownproperty' ##
28675 ## Unknown magic words are silently dropped ##
28676
28677 !! test
28678 Magic words
28679 !! options
28680 parsoid=html2wt
28681 !! html/parsoid
28682 <meta property='mw:PageProp/toc' />
28683 <meta property='mw:PageProp/notoc' />
28684 <meta property='mw:PageProp/forcetoc' />
28685 <meta property='mw:PageProp/index' />
28686 <meta property='mw:PageProp/noindex' />
28687 <meta property='mw:PageProp/nogallery' />
28688 <meta property='mw:PageProp/noeditsection' />
28689 <meta property='mw:PageProp/notitleconvert' />
28690 <meta property='mw:PageProp/nocontentconvert' />
28691 <meta property='mw:PageProp/unknownproperty' />
28692 !! wikitext
28693 __TOC__
28694 __NOTOC__
28695 __FORCETOC__
28696 __INDEX__
28697 __NOINDEX__
28698 __NOGALLERY__
28699 __NOEDITSECTION__
28700 __NOTITLECONVERT__
28701 __NOCONTENTCONVERT__
28702 !! end
28703
28704 !! test
28705 Consecutive <pre>s should not get merged
28706 !! options
28707 parsoid=html2wt,html2html
28708 !! html/parsoid
28709 <pre>a</pre><pre>b</pre>
28710
28711 <pre>c
28712 </pre><pre>
28713 d</pre>
28714
28715 <pre>e
28716
28717 </pre><pre>
28718
28719 f</pre>
28720 !! wikitext
28721 a
28722
28723 b
28724
28725 c
28726
28727 d
28728
28729 e
28730
28731
28732
28733 f
28734 !! end
28735
28736 !! test
28737 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
28738 !! options
28739 parsoid=html2wt
28740 !! html/parsoid
28741 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
28742 !! wikitext
28743 [[Special:BookSources/1234567890|ISBN 1234567895]]
28744 !! end
28745
28746 !! test
28747 Edited RFC links not serializable as RFC links should serialize as extlinks
28748 !! options
28749 parsoid=html2wt
28750 !! html/parsoid
28751 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
28752 !! wikitext
28753 [https://tools.ietf.org/html/rfc123 New RFC]
28754 !! end
28755
28756 !! test
28757 Edited PMID links not serializable as PMID links should serialize as extlinks
28758 !! options
28759 parsoid=html2wt
28760 !! html/parsoid
28761 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
28762 !! wikitext
28763 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
28764 !! end
28765
28766 !! test
28767 WTS of autolinks with trailing/surrounding context
28768 !! options
28769 parsoid=html2wt
28770 !! html/parsoid
28771 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
28772 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
28773 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
28774 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
28775 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
28776 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
28777 !! wikitext
28778 http://cscott.net'''foo'''
28779
28780 http://cscott.net<b>foo</b>
28781
28782 '''http://cscott.net'''
28783
28784 '''http://cscott.net '''
28785
28786 '''http://cscott.net<nowiki/>x'''
28787
28788 http://cscott.net<nowiki/>x
28789 !! end
28790
28791 !! test
28792 WTS of autolinks with nowikis (round-trip)
28793 !! wikitext
28794 x<nowiki/>http://cscott.net<nowiki/>x
28795 !! html/parsoid
28796 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
28797 !! end
28798
28799 # this is the "easy" test because it leaves in place all the
28800 # data-parsoid information indicating this is an autolink
28801 !! test
28802 WTS of autolinks with escapes (editing)
28803 !! options
28804 parsoid={
28805 "modes": ["wt2wt"],
28806 "changes": [
28807 [ "span", "remove" ]
28808 ]
28809 }
28810 !! wikitext
28811 x<nowiki/>http://cscott.net<nowiki/>x
28812 !! wikitext/edited
28813 x<nowiki/>http://cscott.net<nowiki/>x
28814 !! end
28815
28816 !! test
28817 WTS of edited autolink-like text (T103364)
28818 !! options
28819 parsoid={
28820 "modes": ["wt2wt"],
28821 "changes": [
28822 [ "span[typeof]", "removeAttr", "typeof" ]
28823 ]
28824 }
28825 !! wikitext
28826 Not a link: <nowiki>http://example.com</nowiki>.
28827 !! wikitext/edited
28828 Not a link: <span><nowiki>http://example.com</nowiki></span>.
28829 !! end
28830
28831 !! test
28832 WTS of newly-authored autolink-like text (T103364)
28833 !! options
28834 parsoid=html2wt
28835 !! html/parsoid
28836 <p>http://example.com is not a link.</p>
28837 !! wikitext
28838 <nowiki>http://example.com</nowiki> is not a link.
28839 !! end
28840
28841 !! test
28842 WTS of autolink-like text after an autolink (T108563)
28843 !! options
28844 parsoid=html2wt
28845 !! html/parsoid
28846 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
28847 !! wikitext
28848 http://example.com <nowiki>http://example.com</nowiki> is not a link.
28849 !! end
28850
28851 !! test
28852 Magic links inside links (not autolinked)
28853 !! wikitext
28854 [[Foo|http://example.com]]
28855 [[Foo|RFC 1234]]
28856 [[Foo|PMID 1234]]
28857 [[Foo|ISBN 123456789x]]
28858
28859 [http://foo.com http://example.com]
28860 [http://foo.com RFC 1234]
28861 [http://foo.com PMID 1234]
28862 [http://foo.com ISBN 123456789x]
28863 !! html+tidy
28864 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
28865 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
28866 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
28867 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
28868 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
28869 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
28870 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
28871 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
28872 </p>
28873 !! html/parsoid
28874 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
28875 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
28876 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
28877 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
28878
28879 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
28880 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
28881 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
28882 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
28883 !! end
28884
28885 !! test
28886 Magic links inside image captions (autolinked)
28887 !! wikitext
28888 [[File:Foobar.jpg|thumb|http://example.com]]
28889 [[File:Foobar.jpg|thumb|RFC 1234]]
28890 [[File:Foobar.jpg|thumb|PMID 1234]]
28891 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
28892 !! html+tidy
28893 <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>
28894 <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>
28895 <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>
28896 <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>
28897 !! html/parsoid
28898 <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>
28899 <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>
28900 <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>
28901 <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>
28902 !! end
28903
28904 !! test
28905 WTS of magic word text (T109371)
28906 !! options
28907 parsoid=html2wt
28908 !! html/parsoid
28909 <p>RFC 1234</p>
28910 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
28911 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28912 !! wikitext
28913 <nowiki>RFC 1234</nowiki>
28914
28915 [http://foo.com RFC 1234]
28916
28917 [[Foo|RFC 1234]]
28918 !! end
28919
28920 !! test
28921 Edited Redirect link should emit a non-piped wikitext link
28922 !! options
28923 parsoid=html2wt
28924 !! html/parsoid
28925 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28926 !! wikitext
28927 #REDIRECT [[Bar]]
28928 !! end
28929
28930 !! test
28931 T75121: Infer extension name from typeOf if data-mw is not present
28932 !! options
28933 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28934 !! html/parsoid
28935 <div typeOf="mw:Extension/foo"></div>
28936 !! wikitext
28937 <foo />
28938 !! end
28939
28940 # Note that the <p> wrapping isn't present in PHP parser output
28941 # The important thing for this test is that P-wrapping doesn't
28942 # interfere with the <nowiki> protection for leading - in <td>
28943 # (which isn't necessary for <th>).
28944 !! test
28945 T88318: p-wrapped dash in table.
28946 !! options
28947 parsoid=html2wt,wt2wt
28948 !! html/parsoid
28949 <table><tbody>
28950 <tr><th><p>-</p></th><th><p>- </p></th></tr>
28951 <tr><td><p>-</p></td><td><p>- </p></td></tr>
28952 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
28953 </tbody></table>
28954 !! wikitext
28955 {|
28956 !-
28957 !-
28958 |-
28959 |<nowiki>-</nowiki>
28960 |<nowiki>- </nowiki>
28961 |-
28962 |<small>-</small>
28963 |<br />
28964 -
28965 |<br />-
28966 |}
28967 !! html/php+tidy
28968 <table>
28969 <tbody><tr>
28970 <th>-
28971 </th>
28972 <th>-
28973 </th></tr>
28974 <tr>
28975 <td>-
28976 </td>
28977 <td>-
28978 </td></tr>
28979 <tr>
28980 <td><small>-</small>
28981 </td>
28982 <td><br />
28983 <p>-
28984 </p>
28985 </td>
28986 <td><br />-
28987 </td></tr></tbody></table>
28988 !! end
28989
28990 !! test
28991 T149209: WTS: Handle newlines in table cells properly
28992 !! options
28993 parsoid=html2wt
28994 !! html/parsoid
28995 <table>
28996 <tbody>
28997 <tr><td>a
28998 b
28999 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
29000 <tr><td><p>x</p>
29001 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
29002 </tbody></table>
29003 <table>
29004 <tbody>
29005 <tr><th>a
29006 b
29007 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
29008 <tr><th><p>x</h>
29009 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
29010 </tbody></table>
29011 !! wikitext
29012 {|
29013 |a
29014 b
29015 |c
29016 |-
29017 |x
29018 {{!}}y
29019 |}
29020 {|
29021 !a
29022 b
29023 !c
29024 |-
29025 !x
29026 !y
29027 |}
29028 !! end
29029
29030 !! test
29031 T149209: Selser: Handle newlines in table cells properly
29032 !! options
29033 parsoid={
29034 "modes": ["selser"],
29035 "changes": [
29036 [ "#h1", "html", "a\nb\n" ],
29037 [ "#h2", "html", "a\nb\n" ],
29038 [ "#c1", "html", "a\nb\n" ],
29039 [ "#c2", "html", "<p>a</p>" ],
29040 [ "#c3", "html", "<p>a</p>" ],
29041 [ "#c4", "html", "edit-me<p>a</p>" ]
29042 ]
29043 }
29044 !! wikitext
29045 {|
29046 ! id="h1" |edit-me!!1
29047 |-
29048 ! id="h2" |edit-me||2
29049 |-
29050 | id="c1" |edit-me||3
29051 |-
29052 | id="c2" |edit-me||4
29053 |-
29054 | id="c3" |edit-me||p||q||r
29055 |-
29056 | id="c4" |edit-me||p||q||r
29057 |}
29058 !! wikitext/edited
29059 {|
29060 ! id="h1" |a
29061 b
29062 !1
29063 |-
29064 ! id="h2" |a
29065 b
29066 !2
29067 |-
29068 | id="c1" |a
29069 b
29070 |3
29071 |-
29072 | id="c2" |a
29073 |4
29074 |-
29075 | id="c3" |a
29076 |p||q||r
29077 |-
29078 | id="c4" |edit-me
29079 a
29080 |p||q||r
29081 |}
29082 !! end
29083
29084 !! test
29085 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
29086 !! options
29087 parsoid=html2wt
29088 !! html/parsoid
29089 <table id='mwAb'>
29090 <td id='mwAc'>foo</td>
29091 <td id='serialize-this'>bar</td>
29092 </table>
29093 !! wikitext
29094 {|
29095 |foo
29096 | id="serialize-this" |bar
29097 |}
29098 !! end
29099
29100 !! test
29101 Parsoid-like element ids should not be serialized to wikitext unless shadowed
29102 !! options
29103 parsoid=html2wt
29104 !! html/parsoid
29105 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
29106 !! wikitext
29107 <div id="hello">ok</div>
29108 !! end
29109
29110 !! test
29111 Testing serialization after deletion in references
29112 !! options
29113 parsoid={
29114 "modes": ["wt2wt"],
29115 "changes": [
29116 ["#x", "remove"]
29117 ]
29118 }
29119 !! wikitext
29120 hi <ref><div id="x">ho</div></ref>
29121
29122 <references />
29123 !! wikitext/edited
29124 hi <ref></ref>
29125
29126 <references />
29127 !! end
29128
29129 !!test
29130 Testing serialization after deletion of table cells
29131 !!options
29132 parsoid={
29133 "modes": ["wt2wt", "selser"],
29134 "changes": [
29135 ["#x", "remove"]
29136 ]
29137 }
29138 !!wikitext
29139 {|
29140 !h1 !!h2 !!h3
29141 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
29142 |}
29143 !! wikitext/edited
29144 {|
29145 !h1!!h2!!h3
29146 |c2|||c3
29147 |}
29148 !!end
29149
29150 !! test
29151 Testing selser after addition of new row before first row (T125419)
29152 !! options
29153 parsoid={
29154 "modes": ["wt2wt", "selser"],
29155 "changes": [
29156 [ "tr", "before", "<tr><td>X</td></tr>" ]
29157 ]
29158 }
29159 !! wikitext
29160 {|
29161 |a
29162 |}
29163 !! wikitext/edited
29164 {|
29165 |X
29166 |-
29167 |a
29168 |}
29169 !! end
29170
29171 !! test
29172 Serialize new table rows in a HTML table using HTML tags
29173 !! options
29174 parsoid={
29175 "modes": ["wt2wt", "selser"],
29176 "changes": [
29177 [ "tr", "before", "<tr><td>X</td></tr>" ]
29178 ]
29179 }
29180 !! wikitext
29181 <table><tr><td>a</td></tr></table>
29182 !! wikitext/edited
29183 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
29184 !! end
29185
29186 !! test
29187 Serialize new table cells in a HTML row using HTML tags
29188 !! options
29189 parsoid={
29190 "modes": ["wt2wt", "selser"],
29191 "changes": [
29192 [ "td", "before", "<td>X</td>" ]
29193 ]
29194 }
29195 !! wikitext
29196 <table><tr><td>a</td></tr></table>
29197 !! wikitext/edited
29198 <table><tr><td>X</td><td>a</td></tr></table>
29199 !! end
29200
29201 !! test
29202 Serialize wikitext list items as HTML list items when embedded in a HTML list
29203 !! options
29204 parsoid=html2wt
29205 !! html
29206 <ul data-parsoid='{"stx": "html"}'>
29207 <li data-parsoid='{}'>a</li>
29208 <li>b</li>
29209 </ul>
29210 !! wikitext
29211 <ul>
29212 <li>a</li>
29213 <li>b</li>
29214 </ul>
29215 !! end
29216
29217 # SSS FIXME: Is this actually a good thing given the
29218 # odd nested list output that is generated by MW?
29219 # <ul><li>foo<ul>..</ul></li></ul> instead of
29220 # <ul><li>foo</li><ul>..</ul></ul>
29221 !! test
29222 Wikitext lists can be nested inside HTML lists
29223 !! options
29224 parsoid=html2wt
29225 !! html
29226 <ul data-parsoid='{"stx": "html"}'>
29227 <li data-parsoid='{"stx": "html"}'>a
29228 <ul><li>b</li></ul>
29229 </li>
29230 </ul>
29231
29232 <ul data-parsoid='{"stx": "html"}'>
29233 <li>x
29234 <ul><li>y</li></ul>
29235 </li>
29236 </ul>
29237 !! wikitext
29238 <ul>
29239 <li>a
29240 * b
29241 </li>
29242 </ul>
29243
29244 <ul>
29245 <li>x
29246 * y
29247 </li>
29248 </ul>
29249 !! end
29250
29251 !! test
29252 WTS change modes
29253 !! options
29254 parsoid={
29255 "modes": ["wt2wt"],
29256 "changes": [
29257 [ "#xyz", "before", "<b>before</b> stuff " ],
29258 [ "#xyz", "after", " stuff <i>after</i>" ],
29259 [ "#xyz", "html", "x <b>y</b> z" ]
29260 ]
29261 }
29262 !! wikitext
29263 <span id="xyz">hello</span>
29264 !! wikitext/edited
29265 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
29266 !! end
29267
29268 !! test
29269 Never serialize a-tag as html, regardless of what data-parsoid has to say
29270 !! options
29271 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29272 !! html/parsoid
29273 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
29274 !! wikitext
29275 [[Foo]]
29276 !! end
29277
29278 ## SSS FIXME: This is broken output nevertheless.
29279 ## What might be a reasonable non-broken output for this?
29280 ## This is an edge case unlikely to be seen in production
29281 ## that I am not wasting more time on this right now.
29282 !! test
29283 Never serialize a-tag as html, no matter what attributes it has
29284 !! options
29285 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29286 !! html/parsoid
29287 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
29288 !! wikitext
29289 [http://boo.org http://boohoo.org]
29290 !! end
29291
29292 # Misnested is an indication that selser can reuse the source but these have
29293 # shown to sneak through on occasion. See T101768.
29294 # The original wikitext here is: [http://test.com [[one]] two three]
29295 !! test
29296 Strip span tags added to mark misnested links
29297 !! options
29298 parsoid=html2wt
29299 !! html/parsoid
29300 <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>
29301 !! wikitext
29302 [http://test.com][[one]] two three
29303 !! end
29304
29305 !! test
29306 Catch regression when unpacking misnested links
29307 !! options
29308 parsoid=wt2html
29309 !! wikitext
29310 {{echo|hi}}[http://example.com [[ho]]]
29311 !! html/parsoid
29312 <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>
29313 !! end
29314
29315 !! test
29316 Catch regression when unpacking with trailing content
29317 !! wikitext
29318 {{echo|Foo <references/> bar}}
29319 !! html/parsoid
29320 <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>
29321 !! end
29322
29323 !! test
29324 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
29325 !! options
29326 parsoid=html2wt
29327 !! html/parsoid
29328 <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|}"]}'>
29329 <tbody><tr><td>d
29330 </td></tr>
29331 </tbody></table>
29332 !! wikitext
29333 {{echo|a}}
29334 {|{{echo|c
29335 {{!}}d
29336 }}
29337 |}
29338 !! end
29339
29340 ## This test verifies the presence and computation of this attribute indirectly
29341 ## by making an edit and ensuring that the serialization is correct (which it would be
29342 ## only if firstWikitextNode is properly set).
29343 !! test
29344 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
29345 !! options
29346 parsoid= {
29347 "modes": ["wt2wt"],
29348 "changes": [
29349 [ "div#x", "remove" ],
29350 [ "div", "before", "<div>new</div>" ]
29351 ]
29352 }
29353 !! wikitext
29354 <div id="x">foo</div>
29355 {|
29356 {{echo|<div>boo</div>
29357 {{!}}b}}
29358 |c
29359 |}
29360 !! wikitext/edited
29361
29362 <div>new</div>
29363 {|
29364 {{echo|<div>boo</div>
29365 {{!}}b}}
29366 |c
29367 |}
29368 !! end
29369
29370 # --------------------------------------------
29371 # Tests spec'ing wikitext serialization norms |
29372 # --------------------------------------------
29373
29374 !! test
29375 Serialize multi-line indent-pre starting with wikitext syntax
29376 !! options
29377 parsoid=html2wt
29378 !! html/parsoid
29379 <pre>* 1
29380 ** 2
29381 * 3</pre>
29382 !! wikitext
29383 * 1
29384 ** 2
29385 * 3
29386 !! end
29387
29388 !! test
29389 1. Categories should always be serialized on their own line
29390 !! options
29391 parsoid=html2wt
29392 !! html/parsoid
29393 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
29394 !! wikitext
29395 foo
29396 [[Category:Foo]]
29397 bar
29398 !! end
29399
29400 !! test
29401 2. Categories that are part of templates should not introduce a line break
29402 !! wikitext
29403 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
29404 !! html/parsoid
29405 <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>
29406 !! end
29407
29408 # Careful while editing these next 2 tests. There are \u200f characters
29409 # before and after the <link> tags in the HTML and following some
29410 # of the categories in wikitext
29411 # Do not remove these characters in edits.
29412 #
29413 # As part of the serialization, these bidi characters will get stripped.
29414 !! test
29415 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
29416 !! options
29417 parsoid={
29418 "modes": ["html2wt"],
29419 "scrubWikitext": true
29420 }
29421 !! html/parsoid
29422 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
29423 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
29424 !! wikitext
29425 [[קטגוריה:טקסים]]
29426 [[קטגוריה: שיטות משפט]]
29427 !! end
29428
29429 !! test
29430 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
29431 !! options
29432 parsoid={
29433 "modes": ["html2wt"],
29434 "scrubWikitext": true
29435 }
29436 !! html/parsoid
29437 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
29438 !! wikitext
29439 [[קטגוריה:טקסים]]
29440 ‏y
29441 !! end
29442
29443 !! test
29444 Lists: Add space after bullets
29445 !! options
29446 parsoid=html2wt
29447 !! html/parsoid
29448 <ul>
29449 <li>foo</li>
29450 <li> bar</li>
29451 <li><span> baz</span></li>
29452 </ul>
29453 !! wikitext
29454 * foo
29455 * bar
29456 * <span> baz</span>
29457 !! end
29458
29459 !! test
29460 1. Headings: Add space before/after == (T53744)
29461 !! options
29462 parsoid=html2wt
29463 !! html/parsoid
29464 <h2>foo</h2>
29465 <h2> bar</h2>
29466 <h2>baz </h2>
29467 <h2><span> baz</span></h2>
29468 !! wikitext
29469 == foo ==
29470
29471 == bar ==
29472
29473 == baz ==
29474
29475 == <span> baz</span> ==
29476 !! end
29477
29478 !! test
29479 2. Headings: Add space before/after == even after hoisted content
29480 !! options
29481 parsoid={
29482 "modes": ["html2wt"],
29483 "scrubWikitext": true
29484 }
29485 !! html/parsoid
29486 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
29487 !! wikitext
29488 [[Category:A2]]
29489
29490 == ok ==
29491 !! end
29492
29493 !! test
29494 1. Headings: suppress newly created empty headings
29495 !! options
29496 parsoid={
29497 "modes": ["html2wt"],
29498 "scrubWikitext": true
29499 }
29500 !! html/parsoid
29501 <h2></h2>
29502 !! wikitext
29503 !! end
29504
29505 !! test
29506 2. Headings: don't suppress empty headings if scrubWikitext is false
29507 !! options
29508 parsoid=html2wt
29509 !! html/parsoid
29510 <h2></h2>
29511 !! wikitext
29512 ==<nowiki/>==
29513 !! end
29514
29515 !! test
29516 3. Headings: suppress empty headings on edits
29517 !! options
29518 parsoid={
29519 "modes": ["selser"],
29520 "scrubWikitext": true,
29521 "changes": [
29522 [ "#x", "remove"]
29523 ]
29524 }
29525 !! wikitext
29526 ==<span id="x">foo</span>==
29527 !! wikitext/edited
29528 !! end
29529
29530 !! test
29531 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
29532 !! options
29533 parsoid={
29534 "modes": ["html2wt"],
29535 "scrubWikitext": true
29536 }
29537 !! html/parsoid
29538 <h2>foo<br/>bar</h2>
29539 <h2>foo <span><br/>bar</span> baz</h2>
29540 !! wikitext
29541 == foo bar ==
29542
29543 == foo <span> bar</span> baz ==
29544 !! end
29545
29546 !! test
29547 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
29548 !! options
29549 parsoid={
29550 "modes": ["html2wt"],
29551 "scrubWikitext": false
29552 }
29553 !! html/parsoid
29554 <h2>foo<br/>bar</h2>
29555 !! wikitext
29556 == foo<br />bar ==
29557 !! end
29558
29559 !! test
29560 1. WT Quote Tags: suppress newly created empty style tags
29561 !! options
29562 parsoid={
29563 "modes": ["html2wt"],
29564 "scrubWikitext": true
29565 }
29566 !! html/parsoid
29567 <i></i><b></b>
29568 !! wikitext
29569 !! end
29570
29571 !! test
29572 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
29573 !! options
29574 parsoid=html2wt
29575 !! html/parsoid
29576 <i></i><b></b>
29577 !! wikitext
29578 ''<nowiki/>'''''<nowiki/>'''
29579 !! end
29580
29581 !! test
29582 3. WT Quote Tags: suppress empty style tags on edits
29583 !! options
29584 parsoid={
29585 "modes": ["selser"],
29586 "scrubWikitext": true,
29587 "changes": [
29588 [ "#x", "remove"]
29589 ]
29590 }
29591 !! wikitext
29592 '''<span id="x">foo</span>'''
29593 !! wikitext/edited
29594 !! end
29595
29596 !! test
29597 1. Anchors: suppress newly created empty anchors
29598 !! options
29599 parsoid={
29600 "modes": ["html2wt"],
29601 "scrubWikitext": true
29602 }
29603 !! html/parsoid
29604 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29605 !! wikitext
29606 !! end
29607
29608 !! test
29609 2. Anchors: don't suppress empty anchors if scrubWikitext is false
29610 !! options
29611 parsoid={
29612 "modes": ["html2wt"],
29613 "scrubWikitext": false
29614 }
29615 !! html/parsoid
29616 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29617 !! wikitext
29618 [[Test|<nowiki/>]]
29619 !! end
29620
29621 !! test
29622 3. Anchors: suppress empty anchors on edits
29623 !! options
29624 parsoid={
29625 "modes": ["selser"],
29626 "scrubWikitext": true,
29627 "changes": [
29628 [ "#x", "remove"]
29629 ]
29630 }
29631 !! wikitext
29632 [[Test|<span id="x">foo</span>]]
29633 !! wikitext/edited
29634 !! end
29635
29636 !! test
29637 3a. Anchors: do not suppress numbered extlinks
29638 !! options
29639 parsoid={
29640 "modes": ["wt2wt"],
29641 "scrubWikitext": true
29642 }
29643 !! wikitext
29644 [http://foo.com]
29645 !! html/parsoid
29646 <a rel="mw:ExtLink" href="http://foo.com"></a>
29647 !! end
29648
29649 !! test
29650 3b. Anchors: do not suppress numbered extlinks
29651 !! options
29652 parsoid={
29653 "modes": ["wt2wt"],
29654 "scrubWikitext": true,
29655 "changes": [
29656 [ "#x", "remove"]
29657 ]
29658 }
29659 !! wikitext
29660 [http://foo.com <span id="x">foo</span>]
29661 !! wikitext/edited
29662 [http://foo.com]
29663 !! end
29664
29665 !!test
29666 Normalizations should be restricted to edited content
29667 !!options
29668 parsoid={
29669 "modes": ["selser"],
29670 "scrubWikitext": true,
29671 "changes": [
29672 [ "h1", "before", "<i></i>"]
29673 ]
29674 }
29675 !!wikitext
29676 a
29677 = =
29678 b
29679 !!wikitext/edited
29680 a
29681 = =
29682 b
29683 !!end
29684
29685 !! test
29686 1. Multiple normalizations (html2wt)
29687 !! options
29688 parsoid={
29689 "modes": ["html2wt"],
29690 "scrubWikitext": true
29691 }
29692 !! html
29693 <h2><i></i></h2>
29694 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
29695 </a><b><i></i></b>x</p>
29696 !! wikitext
29697
29698 [[foo]]
29699 x
29700
29701 !! end
29702
29703 !! test
29704 2. Multiple normalizations (selser)
29705 !! options
29706 parsoid={
29707 "modes": ["selser"],
29708 "scrubWikitext": true,
29709 "changes": [
29710 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
29711 ]
29712 }
29713 !! wikitext
29714 <span id="x">foo</span>
29715 !! wikitext/edited
29716 <span id="x">foo</span>
29717
29718 x
29719 !! end
29720
29721 !! test
29722 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
29723 !! options
29724 parsoid={
29725 "modes": ["html2wt"],
29726 "scrubWikitext": true
29727 }
29728 !! html/parsoid
29729 <p> hi</p>
29730 <p> hello</p>
29731 !! wikitext
29732 hi
29733
29734 hello
29735 !! end
29736
29737 !! test
29738 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
29739 !! options
29740 parsoid=html2wt
29741 !! html/parsoid
29742 <p> hi</p>
29743 <p> hello</p>
29744 !! wikitext
29745 <nowiki> </nowiki>hi
29746
29747 <nowiki> </nowiki> hello
29748 !! end
29749
29750 !! test
29751 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
29752 !! options
29753 parsoid={
29754 "modes": ["html2wt"],
29755 "scrubWikitext": true
29756 }
29757 !! html/parsoid
29758 <p>Foo
29759 bar
29760 baz</p>
29761
29762 <table><tr><td>Foo
29763 bar
29764 baz bang</td></tr></table>
29765
29766 <p><!--boo--> foo
29767 bar</p>
29768
29769 <p> foo
29770 bar<span>boo</span></p>
29771 !! wikitext
29772 Foo
29773 bar
29774 baz
29775
29776 {|
29777 |Foo
29778 bar
29779 baz bang
29780 |}
29781
29782 <!--boo-->foo
29783 bar
29784
29785 foo
29786 bar<span>boo</span>
29787 !! end
29788
29789 !! test
29790 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
29791 !! options
29792 parsoid={
29793 "modes": ["selser"],
29794 "scrubWikitext": true,
29795 "changes": [
29796 [ "p", "html", " a\n b" ]
29797 ]
29798 }
29799 !! wikitext
29800 xyz
29801 !! wikitext/edited
29802 a
29803 b
29804 !! end
29805
29806 !! test
29807 1. New links that end in spaces
29808 !! options
29809 parsoid={
29810 "modes": ["html2wt"],
29811 "scrubWikitext": false
29812 }
29813 !! html/parsoid
29814 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29815 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29816 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29817 !! wikitext
29818 [[Berlin ]]<nowiki/>is the capital of Germany.
29819
29820 [[Foo ]]'''bar'''
29821
29822 [[Boston ]] is a city.
29823 !! end
29824
29825 !! test
29826 2. New links that end in spaces
29827 !! options
29828 parsoid={
29829 "modes": ["html2wt"],
29830 "scrubWikitext": true
29831 }
29832 !! html/parsoid
29833 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29834 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29835 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29836 !! wikitext
29837 [[Berlin]] is the capital of Germany.
29838
29839 [[Foo]] '''bar'''
29840
29841 [[Boston]] is a city.
29842 !! end
29843
29844 !! test
29845 1. Table cells with escapable prefixes
29846 !! options
29847 parsoid={
29848 "modes": ["html2wt"],
29849 "scrubWikitext": false
29850 }
29851 !! html
29852 <table>
29853 <tr><td>a</td></tr>
29854 <tr><td>-</td></tr>
29855 <tr><td>+</td></tr>
29856 </table>
29857 !! wikitext
29858 {|
29859 |a
29860 |-
29861 |<nowiki>-</nowiki>
29862 |-
29863 |<nowiki>+</nowiki>
29864 |}
29865 !! end
29866
29867 !! test
29868 2. Table cells with escapable prefixes
29869 !! options
29870 parsoid={
29871 "modes": ["html2wt"],
29872 "scrubWikitext": true
29873 }
29874 !! html
29875 <table>
29876 <tr><td>a</td></tr>
29877 <tr><td>-</td></tr>
29878 <tr><td>+</td></tr>
29879 </table>
29880 !! wikitext
29881 {|
29882 |a
29883 |-
29884 | -
29885 |-
29886 | +
29887 |}
29888 !! end
29889
29890 !! test
29891 3a. Table cells with escapable prefixes after edits
29892 !! options
29893 parsoid={
29894 "modes": ["selser"],
29895 "scrubWikitext": true,
29896 "changes": [
29897 [ "table tbody tr:first-child td:first-child", "remove"]
29898 ]
29899 }
29900 !! wikitext
29901 {|
29902 |a||-
29903 |}
29904 !! wikitext/edited
29905 {|
29906 | -
29907 |}
29908 !! end
29909
29910 !! test
29911 3b. Table cells with escapable prefixes after edits
29912 !! options
29913 parsoid={
29914 "modes": ["selser"],
29915 "scrubWikitext": true,
29916 "changes": [
29917 [ "table tbody tr:first-child td:first-child", "html", "-" ],
29918 [ "#x", "remove" ]
29919 ]
29920 }
29921 !! wikitext
29922 {|
29923 |pqr
29924 |<span id="x">foo</span>+
29925 |}
29926 !! wikitext/edited
29927 {|
29928 | -
29929 | +
29930 |}
29931 !! end
29932
29933 # FIXME: This test will fail because
29934 # normalization doesn't realize that the id attribute
29935 # will eliminate the escapable scenario
29936 !! test
29937 4a. Table cells without escapable prefixes after edits
29938 !! options
29939 parsoid={
29940 "modes": ["selser"],
29941 "scrubWikitext": true,
29942 "changes": [
29943 [ "#x", "html", "-" ]
29944 ]
29945 }
29946 !! wikitext
29947 {|
29948 | id="x" |abcd
29949 |}
29950 !! wikitext/edited
29951 {|
29952 | id="x" |-
29953 |}
29954 !! end
29955
29956 ## This tests normalizer's ability to discriminate between
29957 ## cells having identical content.
29958 !! test
29959 4b. Table cells without escapable prefixes after edits
29960 !! options
29961 parsoid={
29962 "modes": ["selser"],
29963 "scrubWikitext": true,
29964 "changes": [
29965 [ "td", "html", "-" ]
29966 ]
29967 }
29968 !! wikitext
29969 {|
29970 |a||b
29971 |}
29972 !! wikitext/edited
29973 {|
29974 | -||-
29975 |}
29976 !! end
29977
29978 ## This tests normalizer's ability to not be tripped by
29979 ## comments (and whitespace)
29980 !! test
29981 4c. Table cells without escapable prefixes after edits
29982 !! options
29983 parsoid={
29984 "modes": ["selser"],
29985 "scrubWikitext": true,
29986 "changes": [
29987 [ "table tbody tr td:first-child", "remove" ]
29988 ]
29989 }
29990 !! wikitext
29991 {|
29992 |-
29993 <!--foo--> |a||-
29994 |}
29995 !! wikitext/edited
29996 {|
29997 |-
29998 <!--foo--> | -
29999 |}
30000 !! end
30001
30002 ## This tests normalizer's ability to handle HTML cells
30003 !! test
30004 4d. Table cells without escapable prefixes after edits
30005 !! options
30006 parsoid={
30007 "modes": ["selser"],
30008 "scrubWikitext": true,
30009 "changes": [
30010 [ "td", "html", "-" ]
30011 ]
30012 }
30013 !! wikitext
30014 <table>
30015 <tr><td>a</td></tr>
30016 </table>
30017 !! wikitext/edited
30018 <table>
30019 <tr><td>-</td></tr>
30020 </table>
30021 !! end
30022
30023 ## T111151 Remove font elements without attributes
30024 !! test
30025 5a. font tags without attributes should be dropped in scrubWikitext mode
30026 !! options
30027 parsoid={
30028 "modes": ["html2wt"],
30029 "scrubWikitext": true
30030 }
30031 !! html
30032 <font>foo</font>
30033 <font><font>bar</font></font>
30034 <font class="x">boo</font>
30035 !! wikitext
30036 foo
30037 bar
30038 <font class="x">boo</font>
30039 !! end
30040
30041 !! test
30042 5b. font tags should not be dropped without scrubWikitext being enabled
30043 !! options
30044 parsoid={
30045 "modes": ["html2wt"],
30046 "scrubWikitext": false
30047 }
30048 !! html
30049 <font>foo</font>
30050 !! wikitext
30051 <font>foo</font>
30052 !! end
30053
30054 !! test
30055 Escape nowiki DOM elements
30056 !! options
30057 parsoid=html2wt
30058 !! html/parsoid
30059 <nowiki><i>foo</i></nowiki>
30060 !! wikitext
30061 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
30062 !! end
30063
30064 # This is meant to be an interim fix while we go about figuring out
30065 # how to not introduce these trailing <nowiki/>s in the first place.
30066 !! test
30067 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
30068 !! options
30069 parsoid=html2wt
30070 !! html/parsoid
30071 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
30072 y</p>
30073 <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>
30074 <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>
30075 !! wikitext
30076 x
30077 y
30078
30079 {{echo|
30080 1 = <nowiki/>}}
30081
30082 {{echo|
30083 1 = <nowiki/>
30084 }}
30085 !! end
30086
30087 !! test
30088 New list is serialized on newlines
30089 !! options
30090 parsoid=html2wt
30091 !! html/parsoid
30092 <p>The quick brown fox jumps over the lazy dog.</p><ul>
30093 <li>Yesterday</li>
30094 <li>Today</li>
30095 <li>Tomorrow</li>
30096 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
30097 !! wikitext
30098 The quick brown fox jumps over the lazy dog.
30099
30100 * Yesterday
30101 * Today
30102 * Tomorrow
30103
30104 The quick onyx goblin jumps over the lazy dwarf.
30105 !! end
30106
30107 !! test
30108 New lists in formatting elements serialized w/o newlines
30109 !! options
30110 parsoid=html2wt
30111 !! html/parsoid
30112 <small>
30113
30114 <ul>
30115 <li>123</li>
30116 </ul>
30117
30118 </small>
30119
30120 <small><ul><li>hi</li></ul></small>
30121 !! wikitext
30122 <small>
30123 * 123
30124 </small>
30125
30126 <small>
30127 * hi
30128 </small>
30129 !! end
30130
30131 !! test
30132 New list in table doesn't need newlines
30133 !! options
30134 parsoid=html2wt
30135 !! html/parsoid
30136 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
30137 !! wikitext
30138 {|
30139 |
30140 * test
30141 * 123
30142 |}
30143 !! end
30144
30145 # ---------------------------------------------------
30146 # End of tests spec'ing wikitext serialization norms |
30147 # ---------------------------------------------------
30148
30149 # T104032
30150 !! test
30151 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
30152 !! options
30153 parsoid=html2wt
30154 !! html/parsoid
30155 a<p>b</p>
30156 <b>c</b><p>d</p>
30157 <table><tr>
30158 <td>a<p>b</p></td>
30159 <td><b>c</b><p>d</p></td>
30160 </tr></table>
30161 !! wikitext
30162 a
30163
30164 b
30165
30166 '''c'''
30167
30168 d
30169 {|
30170 |a
30171 b
30172 |'''c'''
30173 d
30174 |}
30175 !! end
30176
30177 !! test
30178 Anchor without href scenarios
30179 !! options
30180 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30181 !! html/parsoid
30182 <a class="bc"></a>
30183 <a class="no">dice</a>
30184 <a name="foo"></a>
30185 !! wikitext
30186
30187 dice
30188 <span name="foo"></span>
30189 !! end
30190
30191 !! test
30192 New transclusion added after a list should be serialized after the list
30193 !! options
30194 parsoid=html2wt
30195 !! html/parsoid
30196 <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>
30197 !! wikitext
30198 * a
30199 {{echo|foo}}
30200 !! end
30201
30202 # -----------------------------------------------------------------
30203 # End of section for Parsoid-only html2wt tests for serialization
30204 # of new content
30205 # -----------------------------------------------------------------
30206
30207 # -----------------------------------------------------------------
30208 # The following section of tests are primarily to spec behavior of
30209 # the selective serializer. All these tests have manual selser
30210 # changes. The automated selser changes for all tests handle the
30211 # wide variation of changes, but these tests here capture specs
30212 # deterministically.
30213 # ----------------------------------------------------------------
30214
30215 ## T90517
30216 !! test
30217 Selser: New comments should not be lost
30218 !! options
30219 parsoid={
30220 "modes": ["selser"],
30221 "changes": [
30222 [ "#a", "after", "<!--c1-->" ],
30223 [ "#b", "before", "<!--c2-->" ]
30224 ]
30225 }
30226 !! wikitext
30227 <span id="a">a</span>
30228
30229 <span id="b">b</span>
30230 !! wikitext/edited
30231 <span id="a">a</span><!--c1-->
30232
30233 <!--c2--><span id="b">b</span>
30234 !! end
30235
30236 ## T89383
30237 !! test
30238 Selser: Check for validity of DSR before using it
30239 !! options
30240 parsoid={
30241 "modes": ["selser"],
30242 "changes": [
30243 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
30244 ]
30245 }
30246 !! wikitext
30247 <span id="a">a</span>
30248 !! wikitext/edited
30249 {{DISPLAYTITLE:foo}}
30250 <span id="a">a</span>
30251 !! end
30252
30253 !! test
30254 1. DOMDiff: Changes to <ref> content should be looked up using id
30255 !! options
30256 parsoid={
30257 "modes": ["selser"],
30258 "changes": [
30259 ["#X", "after", "bar"],
30260 ["#Y", "after", "baz"]
30261 ]
30262 }
30263 !! wikitext
30264 X <ref><span id="X">foo</span></ref>
30265 Y <ref name="a" />
30266 <references>
30267 <ref name="a"><span id="Y">foo</span></ref>
30268 </references>
30269 !! wikitext/edited
30270 X <ref><span id="X">foo</span>bar</ref>
30271 Y <ref name="a" />
30272 <references>
30273 <ref name="a"><span id="Y">foo</span>baz</ref>
30274 </references>
30275 !! end
30276
30277 !! test
30278 2. DOMDiff: Changes to <ref> content should be looked up using id
30279 !! options
30280 parsoid={
30281 "modes": ["selser"],
30282 "changes": [
30283 ["#Z", "after", "bar"]
30284 ]
30285 }
30286 !! wikitext
30287 A <ref>foo bar for a</ref>
30288 B <ref group="X" name="b" />
30289
30290 <references />
30291
30292 <references group="X">
30293 <ref name="b"><span id="Z">foo</span></ref>
30294 </references>
30295 !! wikitext/edited
30296 A <ref>foo bar for a</ref>
30297 B <ref group="X" name="b" />
30298
30299 <references />
30300
30301 <references group="X">
30302 <ref name="b"><span id="Z">foo</span>bar</ref>
30303 </references>
30304 !! end
30305
30306 !! test
30307 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
30308 !! options
30309 parsoid={
30310 "modes": ["selser"],
30311 "changes": [
30312 [ "div:first-child", "text", "bar" ]
30313 ]
30314 }
30315 !! wikitext
30316 <div style="{{1x|color:red;}}%">foo</div>
30317 !! wikitext/edited
30318 <div style="{{1x|color:red;}}%">bar</div>
30319 !! end
30320
30321 !! test
30322 Empty LI (T49673)
30323 !! wikitext
30324 *a
30325 *
30326 *
30327 *b
30328 !! html+tidy
30329 <ul><li>a</li>
30330 <li class="mw-empty-elt"></li>
30331 <li class="mw-empty-elt"></li>
30332 <li>b</li></ul>
30333 !! end
30334
30335 !! test
30336 Thumbnail output
30337 !! wikitext
30338 [[File:Thumb.png|thumb]]
30339 !! html/php+tidy
30340 <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>
30341 !! html/parsoid
30342 <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>
30343 !! end
30344
30345 !! test
30346 unclosed internal link XSS (T137264)
30347 !! wikitext
30348 [[#%3Cscript%3Ealert(1)%3C/script%3E|
30349 !! html/php
30350 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
30351 </p>
30352 !! html/parsoid
30353 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
30354 !! end
30355
30356 !! test
30357 Validating that <style> isn't eaten by tidy (T167349)
30358 !! options
30359 styletag=1
30360 !! wikitext
30361 <div class="foo">
30362 <style>.foo::before { content: "<foo>"; }</style>
30363 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
30364 </div>
30365 !! html/php+tidy
30366 <div class="foo">
30367 <style>.foo::before { content: "<foo>"; }</style>
30368 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
30369 </div>
30370 !! end
30371
30372 !! test
30373 Validating that <style> isn't wrapped in a paragraph (T186965)
30374 !! options
30375 styletag=1
30376 !! wikitext
30377 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30378
30379 <style>.foo::before { content: "<foo>"; }</style>
30380
30381 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
30382
30383 But if it's on a line with other content, let it be wrapped.
30384
30385 <style>.foo::before { content: "<foo>"; }</style> bar
30386
30387 foo <style>.foo::before { content: "<foo>"; }</style>
30388
30389 foo <style>.foo::before { content: "<foo>"; }</style> bar
30390
30391 And the same if we have non-paragraph-breaking whitespace
30392
30393 foo
30394 <style>.foo::before { content: "<foo>"; }</style>
30395 bar
30396 !! html/php
30397 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30398 </p>
30399 <style>.foo::before { content: "<foo>"; }</style>
30400 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
30401 <p>But if it's on a line with other content, let it be wrapped.
30402 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
30403 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
30404 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
30405 </p><p>And the same if we have non-paragraph-breaking whitespace
30406 </p><p>foo
30407 <style>.foo::before { content: "<foo>"; }</style>
30408 bar
30409 </p>
30410 !! end
30411
30412 !! test
30413 Validating that <link> isn't wrapped in a paragraph (T186965)
30414 !! options
30415 styletag=1
30416 !! wikitext
30417 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30418
30419 <link rel="foo" href="bar"/>
30420
30421 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
30422
30423 But if it's on a line with other content, let it be wrapped.
30424
30425 <link rel="foo" href="bar"/> bar
30426
30427 foo <link rel="foo" href="bar"/>
30428
30429 foo <link rel="foo" href="bar"/> bar
30430
30431 And the same if we have non-paragraph-breaking whitespace
30432
30433 foo
30434 <link rel="foo" href="bar"/>
30435 bar
30436 !! html/php
30437 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30438 </p>
30439 <link rel="foo" href="bar"/>
30440 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
30441 <p>But if it's on a line with other content, let it be wrapped.
30442 </p><p><link rel="foo" href="bar"/> bar
30443 </p><p>foo <link rel="foo" href="bar"/>
30444 </p><p>foo <link rel="foo" href="bar"/> bar
30445 </p><p>And the same if we have non-paragraph-breaking whitespace
30446 </p><p>foo
30447 <link rel="foo" href="bar"/>
30448 bar
30449 </p>
30450 !! end
30451
30452 !! test
30453 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
30454 !! config
30455 wgFragmentMode=[ 'html5', 'legacy' ]
30456 !! wikitext
30457 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
30458 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
30459 !! html/php
30460 <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>
30461 <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>
30462 </p>
30463 !! html/parsoid
30464 <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>
30465 <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>
30466 !! end
30467
30468 !! test
30469 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
30470 !! config
30471 wgFragmentMode=[ 'legacy' ]
30472 !! wikitext
30473 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
30474 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
30475 !! html/php
30476 <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>
30477 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
30478 </p>
30479 !! end
30480
30481 !! test
30482 Decoding of HTML entities in embedded HTML tags
30483 !! wikitext
30484 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
30485 !! html/php
30486 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
30487
30488 !! html/parsoid
30489 <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>
30490 !! end
30491
30492 !! test
30493 Decoding of HTML entities in indicator names for IDs (T104196)
30494 !! options
30495 parsoid=wt2html,html2html
30496 showindicators
30497 !! wikitext
30498 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
30499 !! html/php
30500 1&2&3&amp;4&amp;amp;5=Indicator
30501
30502 !! html/parsoid
30503 <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>
30504 !! end
30505
30506 # this version of the test strips out the ambiguity so Parsoid rts cleanly
30507 !! test
30508 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
30509 !! options
30510 showindicators
30511 !! wikitext
30512 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
30513 !! html/php
30514 1&2&3&amp;4&amp;amp;5=Indicator
30515
30516 !! html/parsoid
30517 <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>
30518 !! end
30519
30520 # This fragment mode is what Parsoid supports.
30521 !! test
30522 HTML5 ids: fallback to legacy
30523 !! config
30524 wgFragmentMode=[ 'html5', 'legacy' ]
30525 !! wikitext
30526 ==Foo bar==
30527
30528 ==foo Bar==
30529
30530 ==Тест==
30531
30532 ==Тест==
30533
30534 ==тест==
30535
30536 ==Hey < # " > % : '==
30537 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30538
30539 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30540
30541 <!-- These two links should produce identical HTML -->
30542 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30543
30544 !! html/php
30545 <div id="toc" class="toc"><input type="checkbox" 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>
30546 <ul>
30547 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30548 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30549 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30550 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30551 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30552 <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>
30553 </ul>
30554 </div>
30555
30556 <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>
30557 <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>
30558 <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>
30559 <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>
30560 <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>
30561 <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>
30562 <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>
30563 </p><p>💩 <span id="💩"></span>
30564 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30565 </p>
30566 !! html/parsoid
30567 <h2 id="Foo_bar">Foo bar</h2>
30568
30569 <h2 id="foo_Bar_2">foo Bar</h2>
30570
30571 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
30572
30573 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
30574
30575 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
30576
30577 <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>
30578 <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>
30579
30580 <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>
30581
30582 <!-- These two links should produce identical HTML -->
30583 <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>
30584 !! end
30585
30586 # Parsoid doesn't support this mode
30587 !! test
30588 HTML5 ids: legacy with a fallback to modern
30589 !! config
30590 wgFragmentMode=[ 'legacy', 'html5' ]
30591 !! wikitext
30592 ==Foo bar==
30593
30594 ==foo Bar==
30595
30596 ==Тест==
30597
30598 ==Тест==
30599
30600 ==тест==
30601
30602 ==Hey < # " > % : '==
30603 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30604
30605 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30606
30607 <!-- These two links should produce identical HTML -->
30608 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30609
30610 !! html/php
30611 <div id="toc" class="toc"><input type="checkbox" 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>
30612 <ul>
30613 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30614 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30615 <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>
30616 <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>
30617 <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>
30618 <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>
30619 </ul>
30620 </div>
30621
30622 <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>
30623 <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>
30624 <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>
30625 <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>
30626 <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>
30627 <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>
30628 <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>
30629 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
30630 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
30631 </p>
30632 !! end
30633
30634 # Parsoid doesn't support this mode.
30635 !! test
30636 HTML5 ids: no legacy
30637 !! config
30638 wgFragmentMode=[ 'html5' ]
30639 !! wikitext
30640 ==Foo bar==
30641
30642 ==foo Bar==
30643
30644 ==Тест==
30645
30646 ==Тест==
30647
30648 ==тест==
30649
30650 ==Hey < # " > % : '==
30651 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30652
30653 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30654
30655 <!-- These two links should produce identical HTML -->
30656 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30657
30658 !! html/php
30659 <div id="toc" class="toc"><input type="checkbox" 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>
30660 <ul>
30661 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30662 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30663 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30664 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30665 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30666 <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>
30667 </ul>
30668 </div>
30669
30670 <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>
30671 <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>
30672 <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>
30673 <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>
30674 <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>
30675 <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>
30676 <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>
30677 </p><p>💩 <span id="💩"></span>
30678 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30679 </p>
30680 !! end
30681
30682 !! test
30683 T90902: Normalize weird characters in section IDs
30684 !! config
30685 wgFragmentMode=[ 'html5', 'legacy' ]
30686 !! wikitext
30687 ==Foo&nbsp;bar==
30688 [[#Foo&nbsp;bar]]
30689
30690 !! html/php
30691 <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>
30692 <p><a href="#Foo_bar">#Foo&#160;bar</a>
30693 </p>
30694 !! html/parsoid
30695 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
30696 <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>
30697 !! end
30698
30699 !! test
30700 T51672: Test for brackets in attributes of elements in external link texts
30701 !! wikitext
30702 [http://example.com/ link <span title="title with [brackets]">span</span>]
30703 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
30704
30705 !! html/php
30706 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
30707 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
30708 </p>
30709 !! html/parsoid
30710 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
30711 <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>
30712 !! end
30713
30714 !! test
30715 T72875: Test for brackets in attributes of elements in internal link texts
30716 !! wikitext
30717 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
30718 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
30719
30720 !! html/php
30721 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30722 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30723 </p>
30724 !! html/parsoid
30725 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
30726 <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>
30727 !! end
30728
30729 !! test
30730 T179544: {{anchorencode:}} output should be always usable in links
30731 !! config
30732 wgFragmentMode=[ 'html5' ]
30733 !! wikitext
30734 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
30735 !! html/php
30736 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
30737 </p>
30738 !! html/parsoid
30739 <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>
30740 !! end
30741
30742 ## ------------------------------
30743 ## Parsoid section-wrapping tests
30744 ## ------------------------------
30745 !! test
30746 Section wrapping for well-nested sections (no leading content)
30747 !! options
30748 parsoid={
30749 "wrapSections": true
30750 }
30751 !! wikitext
30752 =1=
30753 a
30754
30755 =2=
30756 b
30757
30758 ==2.1==
30759 c
30760
30761 ==2.2==
30762 d
30763
30764 ===2.2.1===
30765 e
30766
30767 =3=
30768 f
30769 !! html/parsoid
30770 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30771 <p>a</p>
30772
30773 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30774 <p>b</p>
30775
30776 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30777 <p>c</p>
30778
30779 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
30780 <p>d</p>
30781
30782 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
30783 <p>e</p>
30784
30785 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
30786 <p>f</p>
30787
30788 </section>
30789 !! end
30790
30791 !! test
30792 Section wrapping for well-nested sections (with leading content)
30793 !! options
30794 parsoid={
30795 "wrapSections": true
30796 }
30797 !! wikitext
30798 Para 1.
30799
30800 Para 2 with a <div>nested in it</div>
30801
30802 Para 3.
30803
30804 =1=
30805 a
30806
30807 =2=
30808 b
30809
30810 ==2.1==
30811 c
30812 !! html/parsoid
30813 <section data-mw-section-id="0"><p>Para 1.</p>
30814
30815 <p>Para 2 with a </p><div>nested in it</div>
30816
30817 <p>Para 3.</p>
30818
30819 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30820 <p>a</p>
30821
30822 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30823 <p>b</p>
30824
30825 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30826 <p>c</p>
30827
30828 </section></section>
30829 !! end
30830
30831 !! test
30832 Section wrapping with template-generated sections (good nesting 1)
30833 !! options
30834 parsoid={
30835 "wrapSections": true
30836 }
30837 !! wikitext
30838 =1=
30839 a
30840
30841 {{echo|1=
30842 ==1.1==
30843 b
30844 }}
30845
30846 ==1.2==
30847 c
30848
30849 =2=
30850 d
30851 !! html/parsoid
30852 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30853 <p>a</p>
30854
30855 <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">
30856 </span><p about="#mwt1">b</p>
30857 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
30858 <p>c</p>
30859
30860 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
30861 <p>d</p></section>
30862 !! end
30863
30864 # In this example, the template scope is mildly expanded to incorporate the
30865 # trailing newline after the transclusion since that is part of section 1.1.1
30866 !! test
30867 Section wrapping with template-generated sections (good nesting 2)
30868 !! options
30869 parsoid={
30870 "wrapSections": true,
30871 "modes": ["wt2html", "wt2wt"]
30872 }
30873 !! wikitext
30874 =1=
30875 a
30876
30877 {{echo|1=
30878 ==1.1==
30879 b
30880 ===1.1.1===
30881 d
30882 }}
30883 =2=
30884 e
30885 !! html/parsoid
30886 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30887 <p>a</p>
30888
30889 <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">
30890 </span><p about="#mwt1">b</p><span about="#mwt1">
30891 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
30892 </span><p about="#mwt1">d</p><span about="#mwt1">
30893 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
30894 <p>e</p></section>
30895 !! end
30896
30897 # In this example, the template scope is mildly expanded to incorporate the
30898 # trailing newline after the transclusion since that is part of section 1.2.1
30899 !! test
30900 Section wrapping with template-generated sections (good nesting 3)
30901 !! options
30902 parsoid={
30903 "wrapSections": true,
30904 "modes": ["wt2html", "wt2wt"]
30905 }
30906 !! wikitext
30907 =1=
30908 a
30909
30910 {{echo|1=
30911 x
30912 ==1.1==
30913 b
30914 ==1.2==
30915 c
30916 ===1.2.1===
30917 d
30918 }}
30919 =2=
30920 e
30921 !! html/parsoid
30922 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
30923 <p>a</p>
30924
30925 <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">
30926 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
30927 </span><p about="#mwt1">b</p><span about="#mwt1">
30928 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
30929 </span><p about="#mwt1">c</p><span about="#mwt1">
30930 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
30931 </span><p about="#mwt1">d</p><span about="#mwt1">
30932 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
30933 <p>e</p></section>
30934 !! end
30935
30936 # Because of section-wrapping and template-wrapping interactions,
30937 # the scope of the template is expanded so that the template markup
30938 # is valid in the presence of <section> tags.
30939 # This exercises the s1 is null scenario in the wrapSections code
30940 !! test
30941 Section wrapping with template-generated sections (bad nesting 1)
30942 !! options
30943 parsoid={
30944 "wrapSections": true
30945 }
30946 !! wikitext
30947 <div>
30948 a
30949
30950 {{echo|
30951 =1=
30952 b
30953 }}
30954
30955 c
30956 </div>
30957 !! html/parsoid
30958 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
30959 <p>a</p>
30960
30961 <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"]}'>
30962 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
30963 </span><p about="#mwt1">b
30964 </p><span about="#mwt1">
30965
30966 </span><p about="#mwt1">c</p><span about="#mwt1">
30967 </span></section></div></section>
30968 !! end
30969
30970 # Because of section-wrapping and template-wrapping interactions,
30971 # the scope of the template is expanded so that the template markup
30972 # is valid in the presence of <section> tags.
30973 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
30974 !! test
30975 Section wrapping with template-generated sections (bad nesting 2)
30976 !! options
30977 parsoid={
30978 "wrapSections": true
30979 }
30980 !! wikitext
30981 =1=
30982 a
30983
30984 {{echo|1=
30985 =2=
30986 b
30987 ==2.1==
30988 c
30989 }}
30990
30991 d
30992
30993 =3=
30994 e
30995 !! html/parsoid
30996 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30997 <p>a</p>
30998
30999 </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">
31000 </span><p about="#mwt1">b</p><span about="#mwt1">
31001 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
31002 </span><p about="#mwt1">c</p><span about="#mwt1">
31003
31004 </span><p about="#mwt1">d</p><span about="#mwt1">
31005
31006 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
31007 <p>e</p></section>
31008 !! end
31009
31010 # Because of section-wrapping and template-wrapping interactions,
31011 # additional template wrappers are added to <section> tags
31012 # so that template wrapping semantics are valid whether section
31013 # tags are retained or stripped. But, the template scope can expand
31014 # greatly when accounting for section tags.
31015 # This exercises the s1 and s2 are in different subtrees scenario
31016 !! test
31017 Section wrapping with template-generated sections (bad nesting 3)
31018 !! options
31019 parsoid={
31020 "wrapSections": true,
31021 "modes": ["wt2html", "wt2wt"]
31022 }
31023 !! wikitext
31024 =1=
31025 a
31026
31027 {{echo|1=
31028 ==1.2==
31029 b
31030 =2=
31031 c
31032 }}
31033
31034 d
31035
31036 =3=
31037 e
31038 !! html/parsoid
31039 <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>
31040 <p>a</p>
31041
31042 <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">
31043 </span><p about="#mwt1">b</p><span about="#mwt1">
31044 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
31045 </span><p about="#mwt1">c</p>
31046
31047 <p>d</p>
31048 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
31049 <p>e</p></section>
31050 !! end
31051
31052 !! test
31053 Section wrapping with uneditable lead section + div wrapping multiple sections
31054 !! options
31055 parsoid={
31056 "wrapSections": true
31057 }
31058 !! wikitext
31059 foo
31060
31061 <div style="border:1px solid red;">
31062 =1=
31063 a
31064
31065 ==1.1==
31066 b
31067
31068 =2=
31069 c
31070 </div>
31071
31072 =3=
31073 d
31074
31075 ==3.1==
31076 e
31077 !! html/parsoid
31078 <section data-mw-section-id="-1"><p>foo</p>
31079
31080 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31081 <section data-mw-section-id="1"><h1 id="1">1</h1>
31082 <p>a</p>
31083
31084 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31085 <p>b</p>
31086
31087 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31088 <p>c</p>
31089 </section></div>
31090
31091 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31092 <p>d</p>
31093
31094 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31095 <p>e</p>
31096 </section></section>
31097 !! end
31098
31099 !! test
31100 Section wrapping with editable lead section + div overlapping multiple sections
31101 !! options
31102 parsoid={
31103 "wrapSections": true
31104 }
31105 !! wikitext
31106 foo
31107
31108 =1=
31109 a
31110 <div style="border:1px solid red;">
31111 b
31112
31113 ==1.1==
31114 c
31115
31116 =2=
31117 d
31118 </div>
31119 e
31120
31121 =3=
31122 f
31123
31124 ==3.1==
31125 g
31126 !! html/parsoid
31127 <section data-mw-section-id="0"><p>foo</p>
31128
31129 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
31130 <p>a</p>
31131 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31132 <p>b</p>
31133
31134 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31135 <p>c</p>
31136
31137 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31138 <p>d</p>
31139 </section></div>
31140 <p>e</p>
31141
31142 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31143 <p>f</p>
31144
31145 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31146 <p>g</p>
31147 </section></section>
31148 !! end
31149
31150 !! test
31151 HTML header tags should not be wrapped in section tags
31152 !! options
31153 parsoid={
31154 "wrapSections": true
31155 }
31156 !! wikitext
31157 foo
31158
31159 <h1>a</h1>
31160
31161 =b=
31162
31163 <h1>c</h1>
31164
31165 =d=
31166 !! html/parsoid
31167 <section data-mw-section-id="0"><p>foo</p>
31168
31169 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
31170
31171 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
31172
31173 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
31174
31175 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
31176 !! end
31177
31178 !! test
31179 Lead section containing only whitespace and comments.
31180 !! options
31181 parsoid={
31182 "wrapSections": true
31183 }
31184 !! wikitext
31185
31186 <!-- this is a comment, presumably significant to editors -->
31187 =1=
31188 a
31189
31190 =2=
31191 b
31192 !! html/parsoid
31193 <section data-mw-section-id="0" data-parsoid="{}">
31194 <!-- this is a comment, presumably significant to editors -->
31195 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
31196 <p>a</p>
31197
31198 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31199 <p>b</p></section>
31200 !! end
31201
31202 !! test
31203 Pseudo-sections emitted by templates should have id -2
31204 !! options
31205 parsoid={
31206 "wrapSections": true
31207 }
31208 !! wikitext
31209 foo
31210 {{echo|<div>
31211 ==a==
31212 ==b==
31213 </div>
31214 }}
31215 !! html/parsoid
31216 <section data-mw-section-id="-1"><p>foo</p>
31217 </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}}]}'>
31218 <section data-mw-section-id="-1"><h2 id="a">a</h2>
31219 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
31220 </section></div><span about="#mwt1">
31221 </span></section>
31222 !! end
31223
31224 ##########################################################################
31225 Tests demonstrating white-space insensitivity in input wikitext
31226 for wikitext headings, wikitext list items, and wikitext table captions,
31227 headings, and cells. HTML versions of the same should preserve whitespace.
31228 ##########################################################################
31229 !! test
31230 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
31231 !! options
31232 parsoid={
31233 "modes": ["wt2html"],
31234 "preserveIEW": true
31235 }
31236 !! wikitext
31237 __NOTOC__
31238 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
31239 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
31240 == <!--Headings with fallback ids--> Личная жизнь ==
31241 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
31242 ; <!--term to define--> term : <!--term's definition--> definition
31243 {|
31244 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
31245 |-
31246 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
31247 |-
31248 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31249 |-
31250 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
31251 |-
31252 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
31253 |}
31254 : {|
31255 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31256 |} foo <!--c1-->
31257 !! html/php+tidy
31258 <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>
31259 <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>
31260 <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>
31261 <ul><li>List item</li></ul>
31262 <dl><dt>term&#160;</dt>
31263 <dd>definition</dd></dl>
31264 <table>
31265 <caption>Table Caption
31266 </caption>
31267 <tbody><tr>
31268 <th>Table Heading 1</th>
31269 <th>Table Heading 2
31270 </th></tr>
31271 <tr>
31272 <td>Table Cell 1</td>
31273 <td>Table Cell 2
31274 </td></tr>
31275 <tr>
31276 <td>class="foo"</td>
31277 <td>Table Cell 3
31278 </td></tr>
31279 <tr>
31280 <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
31281 </td></tr></tbody></table>
31282 <dl><dd><table>
31283 <tbody><tr>
31284 <td>Table Cell 1</td>
31285 <td>Table Cell 2
31286 </td></tr></tbody></table> foo</dd></dl>
31287 !! html/parsoid
31288 <meta property="mw:PageProp/notoc">
31289 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
31290 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
31291 <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>
31292 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
31293 <dl><dt><!--term to define-->term&nbsp;</dt><dd><!--term's definition-->definition</dd></dl>
31294 <table>
31295 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
31296 <tbody><tr>
31297 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th>Table Heading 2<!--c5--></th></tr>
31298 <tr>
31299 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31300 <tr>
31301 <td>class="foo"</td><td><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
31302 <tr>
31303 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One">two</a> <!--c2--> | <!--c3--> some content</td></tr>
31304 </tbody></table>
31305 <dl><dd><table>
31306 <tbody><tr><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31307 </tbody></table><p> foo </p><!--c1--></dd></dl>
31308 !! end
31309
31310 # Looks like <caption> is not accepted in HTML
31311 !! test
31312 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
31313 !! options
31314 parsoid={
31315 "modes": ["wt2html"],
31316 "preserveIEW": true
31317 }
31318 !! wikitext
31319 __NOTOC__
31320 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
31321 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
31322 <table>
31323 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
31324 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
31325 </table>
31326 !! html/php+tidy
31327 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
31328 <ul><li> List item </li></ul>
31329 <table>
31330 <tbody><tr><th> Table Heading </th><th></th></tr>
31331 <tr><td> Table Cell </td><th></th></tr>
31332 </tbody></table>
31333 !! html/parsoid
31334 <meta property="mw:PageProp/notoc"/>
31335 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
31336 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
31337 <table>
31338 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
31339 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
31340 </tbody></table>
31341 !! end
31342
31343 !! test
31344 Do not trim whitespace in links and quotes
31345 !! options
31346 parsoid={
31347 "modes": ["wt2html"],
31348 "preserveIEW": true
31349 }
31350 !! wikitext
31351 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
31352 [[Foo| some text ]]
31353 !! html/php+tidy
31354 <p>foo <i> italic </i> and <b> bold </b>
31355 <a href="/wiki/Foo" title="Foo"> some text </a>
31356 </p>
31357 !! html/parsoid
31358 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
31359 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
31360 !! end
31361
31362 !! test
31363 Remove p tags surrounding a single element in a figcaption
31364 !! options
31365 parsoid=html2wt
31366 !! wikitext
31367 [[File:Foobar.jpg|right|200x200px|Caption]]
31368 !! html/parsoid
31369 <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>
31370 !! end
31371
31372 !! test
31373 Selser preserves lack of newline before list and allows newline after the list
31374 !! options
31375 parsoid={
31376 "modes": ["selser"],
31377 "scrubWikitext": true,
31378 "changes": [
31379 [ "ul", "after", "<p>footer</p>" ]
31380 ]
31381 }
31382 !! wikitext
31383 header
31384 *foo
31385 *bar
31386 !! wikitext/edited
31387 header
31388 *foo
31389 *bar
31390
31391 footer
31392 !! end
31393
31394
31395 !! test
31396 Selser does not introduce newlines between unedited paragraph preceding the list
31397 !! options
31398 parsoid={
31399 "modes": ["selser"],
31400 "changes": [
31401 [ "table tbody tr td p:last-child", "empty" ]
31402 ]
31403 }
31404 !! wikitext
31405 {|
31406 |
31407 header
31408 *foo
31409 *bar
31410 footer
31411 |}
31412 !! wikitext/edited
31413 {|
31414 |
31415 header
31416 *foo
31417 *bar
31418
31419 |}
31420 !! end
31421
31422 !! test
31423 Selser does not introduce newlines between unedited paragraph following the list
31424 !! options
31425 parsoid={
31426 "modes": ["selser"],
31427 "changes": [
31428 [ "table tbody tr td p:first-child", "empty" ]
31429 ]
31430 }
31431 !! wikitext
31432 {|
31433 |
31434 header
31435 *foo
31436 *bar
31437 footer
31438 |}
31439 !! wikitext/edited
31440 {|
31441 |
31442
31443 *foo
31444 *bar
31445 footer
31446 |}
31447 !! end
31448
31449 !! test
31450 Remove a list item but do not insert newline above list
31451 !! options
31452 parsoid={
31453 "modes": ["selser"],
31454 "changes": [
31455 [ "ul li:last-child", "remove" ]
31456 ]
31457 }
31458 !! wikitext
31459 header
31460 *foo
31461 *bar
31462 footer
31463 !! wikitext/edited
31464 header
31465 *foo
31466 footer
31467 !! end