Merge "Hide TOC with CSS instead of JavaScript"
[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 !! end
2500
2501 !! test
2502 T17491: <ins>/<del> in blockquote (2)
2503 !! wikitext
2504 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2505 </blockquote>
2506 !! html
2507 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2508 </blockquote>
2509
2510 !! html+tidy
2511 <blockquote><p>Foo </p><del>bar</del> <ins>baz</ins><p> quux
2512 </p></blockquote>
2513 !! end
2514
2515 !! test
2516 <pre> with attributes (T5202)
2517 !! wikitext
2518 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2519 !! html
2520 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2521
2522 !! end
2523
2524 !! test
2525 <pre> with width attribute (T5202)
2526 !! wikitext
2527 <pre width="8">Narrow screen goodies</pre>
2528 !! html
2529 <pre width="8">Narrow screen goodies</pre>
2530
2531 !! end
2532
2533 !! test
2534 <pre> with forbidden attribute (T5202)
2535 !! wikitext
2536 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2537 !! html
2538 <pre width="8">Narrow screen goodies</pre>
2539
2540 !! end
2541
2542 !! test
2543 Entities inside <pre>
2544 !! wikitext
2545 <pre>&lt;</pre>
2546 !! html
2547 <pre>&lt;</pre>
2548
2549 !! end
2550
2551 !! test
2552 <pre> with forbidden attribute values (T5202)
2553 !! wikitext
2554 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2555 !! html
2556 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2557
2558 !! end
2559
2560 !! test
2561 <nowiki> inside <pre> (T15238)
2562 !! wikitext
2563 <pre>
2564 <nowiki>
2565 </pre>
2566 <pre>
2567 <nowiki></nowiki>
2568 </pre>
2569 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2570 !! html
2571 <pre>
2572 &lt;nowiki&gt;
2573 </pre>
2574 <pre>
2575
2576 </pre>
2577 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2578
2579 !! end
2580
2581 !! test
2582 <nowiki> inside of #tag:pre
2583 !! wikitext
2584 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2585 !! html/php
2586 <pre>Foo &#8594;bar</pre>
2587
2588 !! html/parsoid
2589 <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>
2590 !! end
2591
2592 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2593 ## aren't enclosed in nowikis.
2594 !! test
2595 <nowiki> and <pre> preference (first one wins)
2596 !! options
2597 parsoid=wt2html
2598 !! wikitext
2599 <pre>
2600 <nowiki>
2601 </pre>
2602 </nowiki>
2603 </pre>
2604
2605 <nowiki>
2606 <pre>
2607 <nowiki>
2608 </pre>
2609 </nowiki>
2610 </pre>
2611
2612 !! html/php
2613 <pre>
2614 &lt;nowiki&gt;
2615 </pre>
2616 <p>&lt;/nowiki&gt;
2617 &lt;/pre&gt;
2618 </p><p>
2619 &lt;pre&gt;
2620 &lt;nowiki&gt;
2621 &lt;/pre&gt;
2622
2623 &lt;/pre&gt;
2624 </p>
2625 !! html/parsoid
2626 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2627 </pre>
2628 <p>&lt;/nowiki></p>
2629
2630
2631 <p><span typeof="mw:Nowiki">
2632 &lt;pre>
2633 &lt;nowiki>
2634 &lt;/pre>
2635 </span></p>
2636 !! end
2637
2638 !! test
2639 </pre> inside nowiki
2640 !! wikitext
2641 <nowiki></pre></nowiki>
2642 !! html
2643 <p>&lt;/pre&gt;
2644 </p>
2645 !! end
2646
2647 !! test
2648 Empty pre; pre inside other HTML tags (T56946)
2649 !! wikitext
2650 a
2651
2652 <div><pre>
2653 foo
2654 </pre></div>
2655 <pre></pre>
2656 !! html/php+tidy
2657 <p>a
2658 </p>
2659 <div><pre>foo
2660 </pre></div>
2661 <pre></pre>
2662 !! html/parsoid
2663 <p>a</p>
2664
2665 <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
2666 </pre></div>
2667 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2668 !! end
2669
2670 !! test
2671 HTML pre followed by indent-pre
2672 !! wikitext
2673 <pre>foo</pre>
2674 bar
2675 !! html
2676 <pre>foo</pre>
2677 <pre>bar
2678 </pre>
2679 !! end
2680
2681 !! test
2682 Block tag pre
2683 !! wikitext
2684 <p><pre>foo</pre></p>
2685 !! html/php+tidy
2686 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2687 !! html/parsoid
2688 <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>
2689 !! end
2690
2691 !!test
2692 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2693 !! wikitext
2694 {{echo|}}
2695 !! html
2696
2697 !!end
2698
2699 !!test
2700 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2701 !! wikitext
2702 {{echo|
2703 foo}}
2704 !! html
2705 <p>foo
2706 </p>
2707 !!end
2708
2709 !! test
2710 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2711 !! wikitext
2712 {{echo|a
2713 b}}
2714 !! html
2715 <pre>a
2716 </pre>
2717 <p>b
2718 </p>
2719 !!end
2720
2721 !! test
2722 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2723 !! wikitext
2724 {{echo|a
2725 b
2726 c
2727 d
2728 e
2729 }}
2730 !! html
2731 <pre>a
2732 </pre>
2733 <p>b
2734 c
2735 </p>
2736 <pre>d
2737 </pre>
2738 <p>e
2739 </p>
2740 !!end
2741
2742 !!test
2743 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2744 !! wikitext
2745 {{echo| foo}}
2746
2747 {{echo| foo}}{{echo| bar}}
2748
2749 {{echo| foo}}
2750 {{echo| bar}}
2751
2752 {{echo|<!--cmt--> foo}}
2753
2754 <!--cmt-->{{echo| foo}}
2755
2756 {{echo|{{echo| }}bar}}
2757 !! html
2758 <pre>foo
2759 </pre>
2760 <pre>foo bar
2761 </pre>
2762 <pre>foo
2763 bar
2764 </pre>
2765 <pre>foo
2766 </pre>
2767 <pre>foo
2768 </pre>
2769 <pre>bar
2770 </pre>
2771 !!end
2772
2773 !! test
2774 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2775 !! wikitext
2776 {{echo| }}a
2777
2778 {{echo|
2779 }}a
2780
2781 {{echo|
2782 b}}
2783
2784 {{echo|a
2785 }}b
2786
2787 {{echo|a
2788 }} b
2789 !! html
2790 <pre>a
2791 </pre>
2792 <p><br />
2793 </p>
2794 <pre>a
2795 </pre>
2796 <p><br />
2797 </p>
2798 <pre>b
2799 </pre>
2800 <p>a
2801 </p>
2802 <pre>b
2803 </pre>
2804 <p>a
2805 </p>
2806 <pre>b
2807 </pre>
2808 !!end
2809
2810 ## Hmm, should Parsoid rt this?
2811 !! test
2812 Pres with newline attributes
2813 !! options
2814 parsoid=wt2html,html2html
2815 !! wikitext
2816 <pre class="one
2817 two">hi</pre>
2818 !! html/php
2819 <pre class="one two">hi</pre>
2820
2821 !! html/parsoid
2822 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2823 !! end
2824
2825 !! test
2826 Things that look like <pre> tags aren't treated as such
2827 !! wikitext
2828 Barack Obama <President> of the United States
2829 <President></President>
2830 !! html
2831 <p>Barack Obama &lt;President&gt; of the United States
2832 &lt;President&gt;&lt;/President&gt;
2833 </p>
2834 !! end
2835
2836 !! test
2837 Handle broken pre-like tags (T66025)
2838 !! options
2839 parsoid=wt2html
2840 !! wikitext
2841 {{echo|<pre <pre>x</pre>}}
2842
2843 <table><pre </table>
2844 !! html/php
2845 <pre>x</pre>
2846 <table>&lt;pre </table>
2847
2848 !! html/php+tidy
2849 <pre>x</pre>
2850 &lt;pre <table></table>
2851 !! html/parsoid
2852 <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>
2853
2854 <span data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>&lt;pre </span><table data-parsoid='{"stx":"html"}'></table>
2855 !! end
2856
2857 !! test
2858 Parsoid: handle pre with space after attribute
2859 !! options
2860 parsoid=wt2html
2861 !! wikitext
2862 <pre style="width:50%;" >{{echo|foo}}</pre>
2863 !! html/php
2864 <pre style="width:50%;">{{echo|foo}}</pre>
2865
2866 !! html/parsoid
2867 <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>
2868 !! end
2869
2870 # TODO / maybe: fix wt2wt for this
2871 !! test
2872 Parsoid: Don't paragraph-wrap fosterable content
2873 !! options
2874 parsoid=wt2html
2875 !! wikitext
2876 {|
2877 <td></td>
2878 <td></td>
2879
2880
2881
2882 |}
2883 !! html
2884 <table>
2885
2886 <tbody>
2887 <tr>
2888 <td></td>
2889
2890 <td></td></tr>
2891
2892
2893
2894 </tbody></table>
2895 !! end
2896
2897 !! test
2898 Self-closed pre
2899 !! wikitext
2900 <pre />
2901 !! html/php
2902 <pre></pre>
2903
2904 !! html/parsoid
2905 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":null}'></pre>
2906 !! end
2907
2908 !! test
2909 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2910 !! options
2911 parsoid=wt2html
2912 !! wikitext
2913 {|
2914 <td>
2915 <td>
2916 </td>
2917
2918
2919
2920 |}
2921 !! html
2922 <table>
2923
2924 <tbody>
2925 <tr>
2926 <td></td>
2927
2928 <td>
2929 </td></tr>
2930
2931
2932
2933 </tbody></table>
2934 !! end
2935
2936
2937 #--------------------------------------------------------------------
2938 # Transclusion parameter whitespace stripping tests
2939 # Behavior is different for positional and named parameters
2940 #--------------------------------------------------------------------
2941 !! test
2942 Templates: Strip leading and trailing whitespace from named-param values
2943 !! wikitext
2944 {{echo|1= a }}
2945
2946 {{echo|1= {{echo|b}} }}
2947
2948 {{echo| 1 =
2949 c }}
2950
2951 {{echo| 1 =
2952 * d
2953 }}
2954 !! html
2955 <p>a
2956 </p><p>b
2957 </p><p>c
2958 </p>
2959 <ul><li>d</li></ul>
2960
2961 !! end
2962
2963 !! test
2964 Templates: Don't strip whitespace from positional-param values
2965 !! wikitext
2966 {{echo|a }}
2967
2968 {{echo|{{echo|b}} }}
2969
2970 {{echo| c
2971 }}
2972
2973 {{echo| {{echo|d}}
2974 }}
2975
2976 {{echo|
2977 e}}
2978
2979 {{echo|
2980 *f}}
2981
2982 {{echo|
2983 }}g
2984 !! html
2985 <p>a
2986 </p><p>b
2987 </p>
2988 <pre>c
2989 </pre>
2990 <p><br />
2991 </p>
2992 <pre>d
2993 </pre>
2994 <p><br />
2995 </p>
2996 <pre>e
2997 </pre>
2998 <p><br />
2999 </p>
3000 <ul><li>f</li></ul>
3001 <p><br />
3002 </p>
3003 <pre>g
3004 </pre>
3005 !! end
3006
3007 !! test
3008 Templates: Don't recognize targets split by newlines
3009 !! options
3010 parsoid=wt2html
3011 !! wikitext
3012 {{ech
3013 o|foo}}
3014 !! html/php
3015 <p>{{ech
3016 o|foo}}
3017 </p>
3018 !! html/parsoid
3019 <p>{{ech
3020 o|foo}}</p>
3021 !! end
3022
3023 !! test
3024 Templates: Recognize targets when newlines and comments don't split the target
3025 !! options
3026 parsoid=wt2html
3027 !! wikitext
3028 {{
3029 <!--X--> ech<!--X-->o<!--X-->
3030 <!--X--> <!--X-->
3031
3032 |foo}}
3033 !! html/php
3034 <p>foo
3035 </p>
3036 !! html/parsoid
3037 <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>
3038 !! end
3039
3040 !! test
3041 Templates: Handle empty comment-and-ws-only lines correctly
3042 !! wikitext
3043 {{echo|foo
3044 <!--should be ignored-->
3045 <!--should be ignored as well-->
3046 bar}}
3047 !! html/php
3048 <p>foo
3049 bar
3050 </p>
3051 !! html/parsoid
3052 <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>
3053 !! end
3054
3055 !! test
3056 Templates: Handle comments in the target
3057 !! wikitext
3058 {{echo
3059 <!-- should be ignored -->
3060 |foo}}
3061
3062 {{echo
3063 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
3064 |foo}}
3065
3066 {{echo<!-- should be ignored -->
3067 |foo}}
3068
3069 {{echo<!-- should be ignored -->|foo}}
3070
3071 {{<!-- should be ignored -->echo|foo}}
3072 !! html/php
3073 <p>foo
3074 </p><p>foo
3075 </p><p>foo
3076 </p><p>foo
3077 </p><p>foo
3078 </p>
3079 !! html/parsoid
3080 <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>
3081
3082 <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>
3083
3084 <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>
3085
3086 <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>
3087
3088 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3089 !! end
3090
3091 !! test
3092 Templates: Handle comments in parameter names (T69657)
3093 !! wikitext
3094 {{echo|1
3095 <!-- should be ignored -->
3096 =foo}}
3097
3098 {{echo|
3099 <!-- should be ignored -->
3100 1 = foo}}
3101
3102 {{echo|1<!-- should be ignored -->=foo}}
3103
3104 {{echo|<!-- should be ignored -->1=foo}}
3105 !! html/php
3106 <p>foo
3107 </p><p>foo
3108 </p><p>foo
3109 </p><p>foo
3110 </p>
3111 !! html/parsoid
3112 <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>
3113
3114 <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>
3115
3116 <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>
3117
3118 <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>
3119 !! end
3120
3121 !! test
3122 Templates: Other wikitext in parameter names (T69657)
3123 !! wikitext
3124 {{echo|''1''=foo}}
3125 !! html/php
3126 <p>{{{1}}}
3127 </p>
3128 !! html/parsoid
3129 <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>
3130 !! end
3131
3132 !! test
3133 Templates: With colons
3134 !! wikitext
3135 {{With: Colon}}
3136 !! html/php
3137 <p>Template with colon
3138 </p>
3139 !! html/parsoid
3140 <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>
3141 !! end
3142
3143 #--------------------------------------------------------------------
3144 # Transclusion parameter escaping tests
3145 #--------------------------------------------------------------------
3146
3147 !! test
3148 Templates: Parsoid parameter escaping test 1
3149 !! wikitext
3150 {{echo|[foo]|{{echo|[bar]}}}}
3151 !! html/php+tidy
3152 <p>[foo]
3153 </p>
3154 !! html/parsoid
3155 <p about="#mwt1" typeof="mw:Transclusion"
3156 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
3157 !! end
3158
3159 !! test
3160 Parsoid: Pipes in external links in template parameter
3161 !! wikitext
3162 {{echo|[{{echo|http://example.com}} link]}}
3163 !! html/php+tidy
3164 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
3165 </p>
3166 !! html/parsoid
3167 <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>
3168 !! end
3169
3170 !! test
3171 Parsoid: pipe in transclusion parameter
3172 !! wikitext
3173 {{echo|http://foo.com/a&#124;b}}
3174 !! html/php+tidy
3175 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
3176 </p>
3177 !! html/parsoid
3178 <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>
3179 !! end
3180
3181 !! test
3182 Parsoid: Pipe in external link target and content in template parameter
3183 !! options
3184 parsoid=html2wt,wt2wt
3185 !! wikitext
3186 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
3187 !! html/php+tidy
3188 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
3189 </p>
3190 !! html/parsoid
3191 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
3192 typeof="mw:Transclusion"
3193 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
3194 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
3195 !! end
3196
3197 !! test
3198 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
3199 !! options
3200 parsoid
3201 !! wikitext
3202 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
3203 !! html
3204 <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>
3205 !! end
3206
3207 !! test
3208 Templates: Don't escape already nowiki-escaped text in template parameters
3209 !! options
3210 parsoid=html2wt,wt2wt
3211 !! wikitext
3212 {{echo|foo<nowiki>|</nowiki>bar}}
3213 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3214 {{echo|<nowiki></nowiki>}}
3215 !! html/php+tidy
3216 <p>foo|bar
3217 &lt;div&gt;
3218
3219 </p>
3220 !! html/parsoid
3221 <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>
3222 <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>
3223 <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>
3224 </p>
3225 !! end
3226
3227 ## T54824
3228 !! test
3229 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3230 !! options
3231 parsoid=html2wt,wt2wt
3232 !! wikitext
3233 {{echo|{{echo|1=bar}}}}
3234 !! html/php+tidy
3235 <p>bar
3236 </p>
3237 !! html/parsoid
3238 <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>
3239 !! end
3240
3241 ## T58733
3242 !! test
3243 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3244 !! wikitext
3245 {{echo|a : b}}
3246 !! html/php+tidy
3247 <p>a&#160;: b
3248 </p>
3249 !! html/parsoid
3250 <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>
3251 !! end
3252
3253 ## T73412
3254 !! test
3255 Templates: Preserve blank parameter names
3256 !! wikitext
3257 {{echo|=foo}}
3258 !! html/php+tidy
3259 <p>{{{1}}}
3260 </p>
3261 !! html/parsoid
3262 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3263 !! end
3264
3265 !! test
3266 Templates: Preserve blank parameter names in other positions
3267 !! wikitext
3268 {{blank_param|bar|=foo}}
3269 !! html/php+tidy
3270 <p>bar
3271 foo
3272 </p>
3273 !! html/parsoid
3274 <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
3275 foo</p>
3276 !! end
3277
3278 ###
3279 ### Parsoid-centric tests for testing RT edge cases for pre
3280 ###
3281
3282 !!test
3283 1a. Indent-Pre and Comments
3284 !! wikitext
3285 a
3286 <!--a-->
3287 c
3288 !! html
3289 <pre>a
3290 </pre>
3291 <p>c
3292 </p>
3293 !!end
3294
3295 !!test
3296 1b. Indent-Pre and Comments
3297 !! wikitext
3298 a
3299 <!--a-->
3300 c
3301 !! html
3302 <pre>a
3303 </pre>
3304 <p>c
3305 </p>
3306 !!end
3307
3308 !!test
3309 1c. Indent-Pre and Comments
3310 !! wikitext
3311 <!--a--> a
3312
3313 <!--a--> a
3314 !! html
3315 <pre> a
3316 </pre>
3317 <pre> a
3318 </pre>
3319 !!end
3320
3321 !!test
3322 1d. Indent-Pre and Comments
3323 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3324 !! wikitext
3325 <!--a--> a
3326
3327 <!--b-->b
3328 !! html
3329 <pre>a
3330 </pre>
3331 <pre>b
3332 </pre>
3333 !!end
3334
3335 !!test
3336 2a. Indent-Pre and tables
3337 !! wikitext
3338 {|
3339 |-
3340 !h1!!h2
3341 |foo||bar
3342 |}
3343 !! html
3344 <table>
3345
3346 <tr>
3347 <th>h1</th>
3348 <th>h2
3349 </th>
3350 <td>foo</td>
3351 <td>bar
3352 </td></tr></table>
3353
3354 !!end
3355
3356 !!test
3357 2b. Indent-Pre and tables
3358 !! wikitext
3359 {|
3360 |-
3361 |foo
3362 |}
3363 !! html
3364 <table>
3365
3366 <tr>
3367 <td>foo
3368 </td></tr></table>
3369
3370 !!end
3371
3372 !!test
3373 2c. Indent-Pre and tables (T44252)
3374 !! wikitext
3375 {|
3376 |+foo
3377 ! |bar
3378 |}
3379 !! html
3380 <table>
3381 <caption>foo
3382 </caption>
3383 <tr>
3384 <th>bar
3385 </th></tr></table>
3386
3387 !!end
3388
3389 !!test
3390 2d. Indent-Pre and tables
3391 !! wikitext
3392 a
3393 {|
3394 |b
3395 |}
3396 !! html/php
3397 <pre>a
3398 </pre>
3399 <table>
3400 <tr>
3401 <td>b
3402 </td></tr></table>
3403
3404 !! html/parsoid
3405 <pre>a</pre>
3406 <table>
3407 <tbody><tr><td> b</td></tr>
3408 </tbody></table>
3409 !!end
3410
3411 !!test
3412 2e. Indent-Pre and table-line syntax
3413 !! wikitext
3414 a
3415 | b
3416 | c
3417 !! html/php
3418 <pre>a
3419 | b
3420 | c
3421 </pre>
3422 !!end
3423
3424 !!test
3425 2f. Indent-pre started by table-line syntax
3426 !! wikitext
3427 a
3428 | b
3429 | c
3430 !! html/php
3431 <p>a
3432 </p>
3433 <pre>| b
3434 | c
3435 </pre>
3436 !! html/parsoid
3437 <p>a</p>
3438 <pre>
3439 | b
3440 | c</pre>
3441 !!end
3442
3443 !! test
3444 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3445 !! wikitext
3446 <table>
3447 <tr>
3448 <td>
3449 Text that should be rendered preformatted
3450 </td>
3451 </tr>
3452 </table>
3453 !! html
3454 <table>
3455 <tr>
3456 <td>
3457 <pre>Text that should be rendered preformatted
3458 </pre>
3459 </td>
3460 </tr>
3461 </table>
3462
3463 !! end
3464
3465 !! test
3466 2h. Indent pre in tables
3467 !! options
3468 parsoid=wt2html,html2html
3469 !! wikitext
3470 {|
3471 !
3472 foo
3473 !
3474 bar
3475 |-
3476 |
3477 baz
3478 {{!}}
3479 bam
3480 |}
3481 !! html/php
3482 <table>
3483 <tr>
3484 <th>
3485 <pre>foo
3486 </pre>
3487 </th>
3488 <th>
3489 <pre>bar
3490 </pre>
3491 </th></tr>
3492 <tr>
3493 <td>
3494 <pre>baz
3495 </pre>
3496 </td>
3497 <td>
3498 <pre>bam
3499 </pre>
3500 </td></tr></table>
3501
3502 !! html/parsoid
3503 <table>
3504 <tbody><tr><th>
3505 <pre>foo</pre>
3506 </th><th>
3507 <pre>bar</pre>
3508 </th></tr><tr>
3509 <td>
3510 <pre>baz</pre>
3511 </td><td data-parsoid='{"startTagSrc":"{{!}}"}'>
3512 <pre>bam</pre>
3513 </td></tr></tbody></table>
3514 !! end
3515
3516 !!test
3517 3a. Indent-Pre and block tags (single-line html)
3518 !! wikitext
3519 a <p> foo </p>
3520 b <div> foo </div>
3521 c <blockquote> foo </blockquote>
3522 <span> foo </span>
3523 !! html
3524 a <p> foo </p>
3525 b <div> foo </div>
3526 c <blockquote> foo </blockquote>
3527 <pre><span> foo </span>
3528 </pre>
3529 !! html/parsoid
3530 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3531 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3532 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3533 <pre><span> foo </span>
3534 </pre>
3535 !! html/php+tidy
3536 <p> a </p><p> foo </p><p>
3537 b </p><div> foo </div><p>
3538 c </p><blockquote><p> foo </p></blockquote>
3539 <pre><span> foo </span>
3540 </pre>
3541 !! end
3542
3543 !! test
3544 3b. Indent-Pre and block tags (multi-line html)
3545 !! wikitext
3546 a <span>foo</span>
3547 <!-- comment --> b <div> foo </div>
3548 !! html/php
3549 <pre>a <span>foo</span>
3550 </pre>
3551 b <div> foo </div>
3552
3553 !! html/parsoid
3554 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3555 <!-- comment --> <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3556 !! html/php+tidy
3557 <pre>a <span>foo</span>
3558 </pre><p>
3559 b </p><div> foo </div>
3560 !! end
3561
3562 !!test
3563 3c. Indent-Pre and block tags (pre-content on separate line)
3564 !! wikitext
3565 <p>
3566 foo
3567 </p>
3568
3569 <div>
3570 foo
3571 </div>
3572
3573 <center>
3574 foo
3575 </center>
3576
3577 <blockquote>
3578 foo
3579 </blockquote>
3580
3581 <blockquote>
3582 <pre>
3583 foo
3584 </pre>
3585 </blockquote>
3586
3587 <table><tr><td>
3588 foo
3589 </td></tr></table>
3590
3591 <ul><li>
3592 foo
3593 </li></ul>
3594
3595 !! html
3596 <p>
3597 foo
3598 </p>
3599 <div>
3600 <pre>foo
3601 </pre>
3602 </div>
3603 <center>
3604 <pre>foo
3605 </pre>
3606 </center>
3607 <blockquote>
3608 <p> foo
3609 </p>
3610 </blockquote>
3611 <blockquote>
3612 <pre>
3613 foo
3614 </pre>
3615 </blockquote>
3616 <table><tr><td>
3617 <pre>foo
3618 </pre>
3619 </td></tr></table>
3620 <ul><li>
3621 foo
3622 </li></ul>
3623
3624 !!end
3625
3626 !! test
3627 4. Indent-Pre and extension tags
3628 !! wikitext
3629 a <tag />
3630 !! html/php
3631 a <pre>
3632 NULL
3633 array (
3634 )
3635 </pre>
3636
3637 !! html/parsoid
3638 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3639 !! end
3640
3641 !! test
3642 5. Indent-Pre and html pre
3643 !! wikitext
3644 <pre class="123">hi</pre>
3645 !! html/php
3646 <pre class="123">hi</pre>
3647
3648 !! html/parsoid
3649 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3650 !! end
3651
3652 !!test
3653 Render paragraphs when indent-pre is suppressed in blocklevels
3654 !! wikitext
3655 <blockquote>
3656 foo
3657
3658 bar
3659 </blockquote>
3660 !! html
3661 <blockquote>
3662 <p> foo
3663 </p><p> bar
3664 </p>
3665 </blockquote>
3666
3667 !!end
3668
3669 !!test
3670 4. Multiple spaces at start-of-line
3671 !! wikitext
3672 <p> foo </p>
3673 foo
3674 {|
3675 |foo
3676 |}
3677 !! html
3678 <p> foo </p>
3679 <pre> foo
3680 </pre>
3681 <table>
3682 <tr>
3683 <td>foo
3684 </td></tr></table>
3685
3686 !!end
3687
3688 ## NOTE: the leading white-space chars on empty line are significant
3689 !! test
3690 5a. White-space in indent-pre
3691 !! wikitext
3692 a<br />
3693
3694 b
3695 !! html
3696 <pre>a<br />
3697
3698 b
3699 </pre>
3700 !! end
3701
3702 ## NOTE: the leading white-space chars on empty line are significant
3703 !! test
3704 5b. White-space in indent-pre
3705 !! wikitext
3706 a
3707
3708 b
3709
3710
3711 c
3712 !! html
3713 <pre>a
3714
3715 b
3716
3717
3718 c
3719 </pre>
3720 !! end
3721
3722 !! test
3723 5c. White-space in indent-pre
3724 !! wikitext
3725 ''a''
3726 ''b''
3727 ''c''
3728 !! html
3729 <pre><i>a</i>
3730 <i>b</i>
3731 <i>c</i>
3732 </pre>
3733 !! end
3734
3735 !! test
3736 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3737 !! wikitext
3738 a
3739
3740 <!-- continue -->
3741 b
3742
3743 c
3744
3745 d
3746 !! html
3747 <pre>a
3748
3749 b
3750 </pre>
3751 <pre>c
3752
3753 </pre>
3754 <p>d
3755 </p>
3756 !! end
3757
3758 !! test
3759 7a. Indent-pre and category links
3760 !! options
3761 parsoid=wt2html,wt2wt
3762 !! wikitext
3763 [[Category:foo]] <!-- No pre-wrapping -->
3764 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3765 !! html/php+tidy
3766 !! html/parsoid
3767 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3768 <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 -->
3769 !! end
3770
3771 ## We used to, but no longer wt2wt this test since the default serializer
3772 ## will normalize all categories to serialize on their own line.
3773 ## This wikitext usage is going to be fairly uncommon in production and
3774 ## selser will take care of preserving formatting in those scenarios.
3775 !! test
3776 7b. Indent-pre and category links
3777 !! options
3778 parsoid=wt2html
3779 !! wikitext
3780 [[Category:foo]] a
3781 [[Category:foo]] {{echo|b}}
3782 !! html/parsoid
3783 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3784 <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>
3785 !! end
3786
3787 !! test
3788 Indent-Pre: Newlines in comments shouldn't affect sol state
3789 !! wikitext
3790 a <!--
3791 foo
3792 --> b
3793 !! html/php+tidy
3794 <p>a b
3795 </p>
3796 !! html/parsoid
3797 <p>a <!--
3798 foo
3799 --> b</p>
3800 !! end
3801
3802 ###
3803 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3804 ###
3805
3806 !!test
3807 HTML-pre: 1. embedded newlines
3808 !! wikitext
3809 <pre>foo</pre>
3810
3811 <pre>
3812 foo
3813 </pre>
3814
3815 <pre>
3816
3817 foo
3818 </pre>
3819
3820 <pre>
3821
3822
3823 foo
3824 </pre>
3825 !! html/php+tidy
3826 <pre>foo</pre>
3827 <pre>foo
3828 </pre>
3829 <pre>
3830
3831 foo
3832 </pre>
3833 <pre>
3834
3835
3836 foo
3837 </pre>
3838 !! html/parsoid
3839 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3840
3841 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3842 </pre>
3843
3844 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3845
3846 foo
3847 </pre>
3848
3849 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3850
3851
3852 foo
3853 </pre>
3854 !!end
3855
3856 !! test
3857 HTML-pre: big spaces
3858 !! wikitext
3859 <pre>
3860
3861
3862
3863
3864 haha
3865
3866
3867
3868
3869 haha
3870
3871
3872
3873
3874 </pre>
3875 !! html/php+tidy
3876 <pre>
3877
3878
3879
3880
3881 haha
3882
3883
3884
3885
3886 haha
3887
3888
3889
3890
3891 </pre>
3892 !! html/parsoid
3893 <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"}}'>
3894
3895
3896
3897
3898 haha
3899
3900
3901
3902
3903 haha
3904
3905
3906
3907
3908 </pre>
3909 !! end
3910
3911 !!test
3912 HTML-pre: 2: indented text
3913 !! wikitext
3914 <pre>
3915 foo
3916 </pre>
3917 !! html
3918 <pre>
3919 foo
3920 </pre>
3921
3922 !!end
3923
3924 !!test
3925 HTML-pre: 3: other wikitext
3926 !! wikitext
3927 <pre>
3928 * foo
3929 # bar
3930 = no-h =
3931 '' no-italic ''
3932 [[ NoLink ]]
3933 </pre>
3934 !! html/php
3935 <pre>
3936 * foo
3937 # bar
3938 = no-h =
3939 '' no-italic ''
3940 [[ NoLink ]]
3941 </pre>
3942
3943 !! html/parsoid
3944 <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
3945 # bar
3946 = no-h =
3947 '' no-italic ''
3948 [[ NoLink ]]
3949 </pre>
3950 !!end
3951
3952 ###
3953 ### Definition lists
3954 ###
3955 !! test
3956 Simple definition
3957 !! wikitext
3958 ;name :Definition
3959 !! html
3960 <dl><dt>name&#160;</dt>
3961 <dd>Definition</dd></dl>
3962
3963 !! end
3964
3965 !! test
3966 Definition list for indentation only
3967 !! wikitext
3968 :Indented text
3969 !! html
3970 <dl><dd>Indented text</dd></dl>
3971
3972 !! end
3973
3974 !! test
3975 Definition list with no space
3976 !! wikitext
3977 ;name:Definition
3978 !! html
3979 <dl><dt>name</dt>
3980 <dd>Definition</dd></dl>
3981
3982 !!end
3983
3984 !! test
3985 Definition list with URL link
3986 !! wikitext
3987 ;http://example.com/ :definition
3988 !! html
3989 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3990 <dd>definition</dd></dl>
3991
3992 !! end
3993
3994 !! test
3995 Definition list with bracketed URL link
3996 !! wikitext
3997 ;[http://www.example.com/ Example]:Something about it
3998 !! html
3999 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
4000 <dd>Something about it</dd></dl>
4001
4002 !! end
4003
4004 !! test
4005 Definition list with wikilink containing colon
4006 !! wikitext
4007 ;[[Help:FAQ]]:The least-read page on Wikipedia
4008 !! html
4009 <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>
4010 <dd>The least-read page on Wikipedia</dd></dl>
4011
4012 !! end
4013
4014 # At Brion's and JeLuF's insistence... :)
4015 !! test
4016 Definition list with news link containing colon
4017 !! wikitext
4018 ;news:alt.wikipedia.rox :This isn't even a real newsgroup!
4019 !! html/php
4020 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a>&#160;</dt>
4021 <dd>This isn't even a real newsgroup!</dd></dl>
4022
4023 !! html/parsoid
4024 <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>
4025 !! end
4026
4027 !! test
4028 Malformed definition list with colon
4029 !! wikitext
4030 ;news:alt.wikipedia.rox -- don't crash or enter an infinite loop
4031 !! html
4032 <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>
4033
4034 !! end
4035
4036 !! test
4037 Definition lists: colon in external link text
4038 !! wikitext
4039 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
4040 !! html
4041 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;:The Next Generation</a>&#160;</dt>
4042 <dd>OK, I made that up</dd></dl>
4043
4044 !! end
4045
4046 !! test
4047 Definition lists: colon in HTML attribute
4048 !! wikitext
4049 ;<b style="display: inline">bold</b>
4050 !! html
4051 <dl><dt><b style="display: inline">bold</b></dt></dl>
4052
4053 !! end
4054
4055 !! test
4056 Definition lists: self-closed tag
4057 !! wikitext
4058 ;one<br/>two :two-line fun
4059 !! html
4060 <dl><dt>one<br />two&#160;</dt>
4061 <dd>two-line fun</dd></dl>
4062
4063 !! end
4064
4065 !! test
4066 Definition lists: ignore colons inside tags
4067 !! wikitext
4068 ;one <b>two : tag <i>fun:</i>:</b>:def
4069 !! html
4070 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
4071 <dd>def</dd></dl>
4072
4073 !! end
4074
4075 !! test
4076 Definition lists: excess closed tags
4077 !! wikitext
4078 ;one</b>two :bad tag fun
4079 !! html/php+tidy
4080 <dl><dt>onetwo&#160;</dt>
4081 <dd>bad tag fun</dd></dl>
4082 !! html/parsoid
4083 <dl>
4084 <dt>onetwo</dt>
4085 <dd>bad tag fun</dd>
4086 </dl>
4087 !! end
4088
4089 !! test
4090 T13748: Literal closing tags
4091 !! wikitext
4092 <dl>
4093 <dt>test 1</dt>
4094 <dd>test test test test test</dd>
4095 <dt>test 2</dt>
4096 <dd>test test test test test</dd>
4097 </dl>
4098 !! html
4099 <dl>
4100 <dt>test 1</dt>
4101 <dd>test test test test test</dd>
4102 <dt>test 2</dt>
4103 <dd>test test test test test</dd>
4104 </dl>
4105
4106 !! end
4107
4108 !! test
4109 Definition and unordered list using wiki syntax nested in unordered list using html tags.
4110 !! wikitext
4111 <ul><li>
4112 ;term :description
4113 *unordered
4114 </li></ul>
4115 !! html
4116 <ul><li>
4117 <dl><dt>term&#160;</dt>
4118 <dd>description</dd></dl>
4119 <ul><li>unordered</li></ul>
4120 </li></ul>
4121
4122 !! end
4123
4124 !! test
4125 Definition list with empty definition and following paragraph
4126 !! wikitext
4127 ;term:
4128
4129 Paragraph text
4130 !! html
4131 <dl><dt>term</dt>
4132 <dd></dd></dl>
4133 <p>Paragraph text
4134 </p>
4135 !! end
4136
4137 !! test
4138 Nested definition lists using html syntax
4139 !! wikitext
4140 <dl><dt>x</dt>
4141 <dd>a</dd>
4142 <dd>b</dd></dl>
4143 !! html
4144 <dl><dt>x</dt>
4145 <dd>a</dd>
4146 <dd>b</dd></dl>
4147
4148 !! end
4149
4150 !! test
4151 Definition Lists: No nesting: Multiple dd's
4152 !! wikitext
4153 ;x
4154 :a
4155 :b
4156 !! html
4157 <dl><dt>x</dt>
4158 <dd>a</dd>
4159 <dd>b</dd></dl>
4160
4161 !! end
4162
4163 !! test
4164 Definition Lists: Indentation: Regular
4165 !! wikitext
4166 :i1
4167 ::i2
4168 :::i3
4169 !! html
4170 <dl><dd>i1
4171 <dl><dd>i2
4172 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4173
4174 !! end
4175
4176 !! test
4177 Definition Lists: Indentation: Missing 1st level
4178 !! wikitext
4179 ::i2
4180 :::i3
4181 !! html
4182 <dl><dd><dl><dd>i2
4183 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4184
4185 !! end
4186
4187 !! test
4188 Definition Lists: Indentation: Multi-level indent
4189 !! wikitext
4190 :::i3
4191 !! html
4192 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
4193
4194 !! end
4195
4196 !! test
4197 Definition Lists: Hacky use to indent tables
4198 !! wikitext
4199 ::{|
4200 |foo
4201 |bar
4202 |}
4203 this text
4204 should be left alone
4205 !! html
4206 <dl><dd><dl><dd><table>
4207 <tr>
4208 <td>foo
4209 </td>
4210 <td>bar
4211 </td></tr></table></dd></dl></dd></dl>
4212 <p>this text
4213 should be left alone
4214 </p>
4215 !! end
4216
4217 !! test
4218 Definition Lists: Hacky use to indent tables (with content following table)
4219 !! wikitext
4220 :{|
4221 |foo
4222 |bar
4223 |} <!--c1--> this text should be part of the dl
4224 !! html/php+tidy
4225 <dl><dd><table>
4226 <tbody><tr>
4227 <td>foo
4228 </td>
4229 <td>bar
4230 </td></tr></tbody></table> this text should be part of the dl</dd></dl>
4231 !! html/parsoid
4232 <dl><dd><table>
4233 <tbody><tr>
4234 <td>foo
4235 </td>
4236 <td>bar
4237 </td></tr></tbody></table> <!--c1--> this text should be part of the dl</dd></dl>
4238 !! end
4239
4240 !! test
4241 Definition Lists: Hacky use to indent tables, with comments (T65979)
4242 !! wikitext
4243 <!-- foo -->
4244 ::{|
4245 |foo
4246 |bar
4247 |}<!-- bar -->
4248 this text
4249 should be left alone
4250 !! html/parsoid
4251 <!-- foo -->
4252 <dl><dd><dl><dd><table><tr>
4253 <td>foo</td>
4254 <td>bar</td>
4255 </tr></table><!-- bar --></dd></dl></dd></dl>
4256 <p>this text
4257 should be left alone</p>
4258 !! end
4259
4260 !! test
4261 Definition Lists: Hacky use to indent tables, with comment before table
4262 !!options
4263 parsoid=wt2html
4264 !! wikitext
4265 ::<!-- foo -->{|
4266 |foo
4267 |}
4268 !! html/parsoid
4269 <dl><dd><dl><dd><!-- foo --><table><tr>
4270 <td>foo</td>
4271 </tr></table></dd></dl></dd></dl>
4272 !! end
4273
4274 # The trailing whitespace in this test is to catch a regression in
4275 # Parsoid after T54473.
4276 !! test
4277 Definition Lists: Hacky use to indent tables (WS-insensitive)
4278 !! wikitext
4279 :{|
4280 |a
4281 |}
4282 !! html/php
4283 <dl><dd><table>
4284 <tr>
4285 <td>a
4286 </td></tr></table></dd></dl>
4287
4288 !! html/parsoid
4289 <dl><dd><table>
4290 <tbody><tr><td>a</td></tr>
4291 </tbody></table></dd></dl>
4292 !! end
4293
4294 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4295 ## as an empty dt item. It also ignores all but the last ";" when followed
4296 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4297 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4298 ## ";"s.
4299 ##
4300 ## Ex: ";;t2 ::d2" is transformed into:
4301 ##
4302 ## <dl>
4303 ## <dt>t2 </dt>
4304 ## <dd>
4305 ## <dl>
4306 ## <dt></dt>
4307 ## <dd>d2</dd>
4308 ## </dl>
4309 ## </dd>
4310 ## </dl>
4311 ##
4312 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4313 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4314 ##
4315 ## <dl>
4316 ## <dt>
4317 ## <dl>
4318 ## <dt>t2 </dt>
4319 ## <dd>:d2</dd>
4320 ## </dl>
4321 ## </dt>
4322 ## </dl>
4323 ##
4324 ## All Parsoid only definition list tests have this difference.
4325 ##
4326 ## See also: https://phabricator.wikimedia.org/T8569
4327 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4328
4329 !! test
4330 Table / list interaction: indented table with lists in table contents
4331 !! wikitext
4332 :{|
4333 |-
4334 |a
4335
4336 *b
4337 |-
4338 |c
4339
4340 *d
4341 |}
4342 !! html
4343 <dl><dd><table>
4344
4345 <tr>
4346 <td>a
4347 <ul><li>b</li></ul>
4348 </td></tr>
4349 <tr>
4350 <td>c
4351 <ul><li>d</li></ul>
4352 </td></tr></table></dd></dl>
4353
4354 !! end
4355
4356 !!test
4357 Table / list interaction: lists nested in tables nested in indented lists
4358 !! wikitext
4359 :{|
4360 |
4361 :a
4362 :b
4363 |
4364 *c
4365 *d
4366 |}
4367
4368 *e
4369 *f
4370 !! html
4371 <dl><dd><table>
4372 <tr>
4373 <td>
4374 <dl><dd>a</dd>
4375 <dd>b</dd></dl>
4376 </td>
4377 <td>
4378 <ul><li>c</li>
4379 <li>d</li></ul>
4380 </td></tr></table></dd></dl>
4381 <ul><li>e</li>
4382 <li>f</li></ul>
4383
4384 !!end
4385
4386 !! test
4387 Definition Lists: Nesting: Multi-level (Parsoid only)
4388 !! wikitext
4389 ;t1 :d1
4390 ;;t2 ::d2
4391 ;;;t3 :::d3
4392 !! html/parsoid
4393 <dl>
4394 <dt>t1 </dt>
4395 <dd>d1</dd>
4396 <dt>
4397 <dl>
4398 <dt>t2 </dt>
4399 <dd>:d2</dd>
4400 <dt>
4401 <dl>
4402 <dt>t3 </dt>
4403 <dd>::d3</dd>
4404 </dl>
4405 </dt>
4406 </dl>
4407 </dt>
4408 </dl>
4409
4410
4411 !! end
4412
4413
4414 !! test
4415 Definition Lists: Nesting: Test 2
4416 !! wikitext
4417 ;t1
4418 ::d2
4419 !! html+tidy
4420 <dl><dt>t1</dt>
4421 <dd>
4422 <dl><dd>d2</dd></dl></dd></dl>
4423 !! end
4424
4425
4426 !! test
4427 Definition Lists: Nesting: Test 3
4428 !! wikitext
4429 :;t1
4430 ::::d2
4431 !! html+tidy
4432 <dl><dd><dl><dt>t1</dt>
4433 <dd>
4434 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4435 !! end
4436
4437
4438 !! test
4439 Definition Lists: Nesting: Test 4
4440 !! wikitext
4441 ::;t3
4442 :::d3
4443 !! html
4444 <dl><dd><dl><dd><dl><dt>t3</dt>
4445 <dd>d3</dd></dl></dd></dl></dd></dl>
4446
4447 !! end
4448
4449
4450 ## The Parsoid team believes the following three test exposes a
4451 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4452 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4453 ## It also exposes a "misfeature" in tidy, which doesn't like
4454 ## <dl> tags with a single <dt> child; it converts the <dt> into
4455 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4456 !! test
4457 Definition Lists: Mixed Lists: Test 1
4458 !! wikitext
4459 :;*foo
4460 ::*bar
4461 :;baz
4462 !! html/php
4463 <dl><dd><dl><dt><ul><li>foo</li>
4464 <li>bar</li></ul></dt></dl>
4465 <dl><dt>baz</dt></dl></dd></dl>
4466
4467 !! html/php+tidy
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 !! html/parsoid
4472 <dl>
4473 <dd><dl>
4474 <dt><ul>
4475 <li>foo
4476 </li>
4477 </ul></dt>
4478 <dd><ul>
4479 <li>bar
4480 </li>
4481 </ul></dd>
4482 <dt>baz</dt>
4483 </dl></dd>
4484 </dl>
4485 !! end
4486
4487 !! test
4488 Definition Lists: Mixed Lists: Test 2
4489 !! wikitext
4490 *:d1
4491 *:d2
4492 !! html
4493 <ul><li><dl><dd>d1</dd>
4494 <dd>d2</dd></dl></li></ul>
4495
4496 !! end
4497
4498
4499 !! test
4500 Definition Lists: Mixed Lists: Test 3
4501 !! wikitext
4502 *:::d1
4503 *:::d2
4504 !! html
4505 <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
4506 <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
4507
4508 !! end
4509
4510
4511 !! test
4512 Definition Lists: Mixed Lists: Test 4
4513 !! wikitext
4514 *;d1 :d2
4515 *;d3 :d4
4516 !! html
4517 <ul><li><dl><dt>d1&#160;</dt>
4518 <dd>d2</dd>
4519 <dt>d3&#160;</dt>
4520 <dd>d4</dd></dl></li></ul>
4521
4522 !! end
4523
4524
4525 !! test
4526 Definition Lists: Mixed Lists: Test 5
4527 !! wikitext
4528 *:d1
4529 *::d2
4530 !! html
4531 <ul><li><dl><dd>d1
4532 <dl><dd>d2</dd></dl></dd></dl></li></ul>
4533
4534 !! end
4535
4536
4537 !! test
4538 Definition Lists: Mixed Lists: Test 6
4539 !! wikitext
4540 #*:d1
4541 #*:::d3
4542 !! html
4543 <ol><li><ul><li><dl><dd>d1
4544 <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4545
4546 !! end
4547
4548
4549 !! test
4550 Definition Lists: Mixed Lists: Test 7
4551 !! wikitext
4552 :*d1
4553 :*d2
4554 !! html
4555 <dl><dd><ul><li>d1</li>
4556 <li>d2</li></ul></dd></dl>
4557
4558 !! end
4559
4560
4561 !! test
4562 Definition Lists: Mixed Lists: Test 8
4563 !! wikitext
4564 :*d1
4565 ::*d2
4566 !! html
4567 <dl><dd><ul><li>d1</li></ul>
4568 <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
4569
4570 !! end
4571
4572
4573 !! test
4574 Definition Lists: Mixed Lists: Test 9
4575 !! wikitext
4576 *;foo :bar
4577 !! html
4578 <ul><li><dl><dt>foo&#160;</dt>
4579 <dd>bar</dd></dl></li></ul>
4580
4581 !! end
4582
4583
4584 !! test
4585 Definition Lists: Mixed Lists: Test 10
4586 !! wikitext
4587 *#;foo :bar
4588 !! html
4589 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4590 <dd>bar</dd></dl></li></ol></li></ul>
4591
4592 !! end
4593
4594 # The Parsoid team disagrees with the PHP parser's seemingly-random
4595 # rules regarding dd/dt on the next few tests. Parsoid is more
4596 # consistent, and recognizes the shared nesting and keeps the
4597 # still-open tags around until the nesting is complete.
4598
4599 # This is a regression test for T175099
4600 !! test
4601 Definition Lists: Mixed Lists: Test 11
4602 !! wikitext
4603 ;a
4604 :*b
4605 !! html/php
4606 <dl><dt>a</dt>
4607 <dd>
4608 <ul><li>b</li></ul></dd></dl>
4609
4610 !! html/parsoid
4611 <dl><dt>a
4612 <dd><ul><li>b</li></ul></dd></dl>
4613 !! end
4614
4615 # FIXME: Maybe get rid of this test?
4616 !! test
4617 Definition Lists: Mixed Lists: Test 12
4618 !! wikitext
4619 *#*#;*;;foo :bar
4620 *#*#;boo :baz
4621 !! html/php
4622 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4623 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4624 <dl><dt>boo&#160;</dt>
4625 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4626
4627 !! html/php+tidy
4628 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4629 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4630 <dl><dt>boo&#160;</dt>
4631 <dd>baz</dd></dl></li></ol></li></ul>
4632 !! html/parsoid
4633 <ul>
4634 <li>
4635 <ol>
4636 <li>
4637 <ul>
4638 <li>
4639 <ol>
4640 <li>
4641 <dl>
4642 <dt>
4643 <ul>
4644 <li>
4645 <dl>
4646 <dt>
4647 <dl>
4648 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4649 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4650 </dl></dt>
4651 </dl></li>
4652 </ul></dt>
4653 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4654 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4655 </dl></li>
4656 </ol></li>
4657 </ul></li>
4658 </ol></li>
4659 </ul>
4660 !! end
4661
4662 # FIXME: Maybe get rid of this test?
4663 # From whitelist:
4664 # * The test is wrong, there are two colons where there should be :;
4665 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4666 !! test
4667 Definition Lists: Weird Ones: Test 1
4668 !! wikitext
4669 *#;*::;;foo :bar (who uses this?)
4670 !! html/php+tidy
4671 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4672 <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>
4673 !! html/parsoid
4674 <ul>
4675 <li>
4676 <ol>
4677 <li>
4678 <dl>
4679 <dt>
4680 <ul>
4681 <li>
4682 <dl>
4683 <dd>
4684 <dl>
4685 <dd>
4686 <dl>
4687 <dt>
4688 <dl>
4689 <dt>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4690 <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
4691 </dl></dt>
4692 </dl></dd>
4693 </dl></dd>
4694 </dl></li>
4695 </ul></dt>
4696 </dl></li>
4697 </ol></li>
4698 </ul>
4699 !! end
4700
4701 !! test
4702 Definition Lists: colons occurring in tags
4703 !! wikitext
4704 ;a:b
4705 ;'''a:b'''
4706 ;<i>a:b</i>
4707 ;<span>a:b</span>
4708 ;<div>a:b</div>
4709 ;<div>a
4710 :b</div>
4711 ;{{echo|a:b}}
4712 ;{{echo|''a:b''}}
4713 ;;;''a:b''
4714 !! html+tidy
4715 <dl><dt>a</dt>
4716 <dd>b</dd>
4717 <dt><b>a:b</b></dt>
4718 <dt><i>a:b</i></dt>
4719 <dt><span>a:b</span></dt>
4720 <dt><div>a:b</div></dt>
4721 <dt><div>a</div></dt>
4722 <dd>b</dd>
4723 <dt>a</dt>
4724 <dd>b</dd>
4725 <dt><i>a:b</i></dt></dl>
4726 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4727 !! html/parsoid
4728 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4729 <dt><b>a:b</b></dt>
4730 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4731 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4732 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4733 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4734 <dd>b</dd>
4735 <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>
4736 <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>
4737 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4738 !! end
4739
4740 # Parsoid's output differs here again because it shares
4741 # nesting between the two lists unlike the PHP parser.
4742 # Unsure which is more desirable.
4743 !! test
4744 Definition Lists: colons and tables 1
4745 !! wikitext
4746 :{|
4747 |x
4748 |}
4749 :{|
4750 |y
4751 |}
4752 !! html/php
4753 <dl><dd><table>
4754 <tr>
4755 <td>x
4756 </td></tr></table></dd></dl>
4757 <dl><dd><table>
4758 <tr>
4759 <td>y
4760 </td></tr></table></dd></dl>
4761
4762 !! html/parsoid
4763 <dl><dd><table>
4764 <tr>
4765 <td>x
4766 </td></tr></table></dd>
4767 <dd><table>
4768 <tr>
4769 <td>y
4770 </td></tr></table></dd></dl>
4771 !! end
4772
4773 # FIXME: Does this need a html/php section?
4774 !! test
4775 Definition Lists: template interaction
4776 !! wikitext
4777 ::{{definition_list}}
4778
4779 :one
4780 ::{{definition_list}}
4781 :::two
4782 :::three
4783 ::four
4784 !! html/parsoid
4785 <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">
4786 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4787
4788 <dl><dd data-parsoid='{}'>one
4789 <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">
4790 </span><dd about="#mwt2">two
4791 <dl><dd>two</dd>
4792 <dd>three</dd></dl></dd>
4793 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4794 !! end
4795
4796
4797 ###
4798 ### External links
4799 ###
4800 !! test
4801 External links: non-bracketed
4802 !! wikitext
4803 Non-bracketed: http://example.com
4804 !! html
4805 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4806 </p>
4807 !! end
4808
4809 # parsoid doesn't explicitly mark autonumbered links, see T55505
4810 !! test
4811 External links: numbered
4812 !! wikitext
4813 Numbered: [http://example.com]
4814 Numbered: [http://example.net]
4815 Numbered: [http://example.com]
4816 !! html/php
4817 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4818 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4819 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4820 </p>
4821 !! html/parsoid
4822 <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
4823 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4824 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
4825 !!end
4826
4827 !! test
4828 External links: specified text
4829 !! wikitext
4830 Specified text: [http://example.com link]
4831 !! html
4832 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4833 </p>
4834 !!end
4835
4836 !! test
4837 External links: trail
4838 !! wikitext
4839 Linktrails should not work for external links: [http://example.com link]s
4840 !! html
4841 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4842 </p>
4843 !! end
4844
4845 !! test
4846 External links: dollar sign in URL
4847 !! wikitext
4848 http://example.com/1$2345
4849 !! html
4850 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4851 </p>
4852 !! end
4853
4854 # parsoid doesn't explicitly mark autonumbered links, see T55505
4855 !! test
4856 External links: dollar sign in URL (autonumber)
4857 !! wikitext
4858 [http://example.com/1$2345]
4859 !! html/php
4860 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4861 </p>
4862 !! html/parsoid
4863 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
4864 !!end
4865
4866 !! test
4867 External links: open square bracket forbidden in URL (T6377)
4868 !! options
4869 parsoid=wt2html,wt2wt,html2html
4870 !! wikitext
4871 http://example.com/1[2345
4872 !! html/php
4873 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4874 </p>
4875 !! html/parsoid
4876 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
4877 !! end
4878
4879 !! test
4880 External links: open square bracket forbidden in URL (named) (T6377)
4881 !! options
4882 parsoid=wt2html,html2html
4883 !! wikitext
4884 [http://example.com/1[2345]
4885 !! html/php
4886 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4887 </p>
4888 !! html/parsoid
4889 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
4890 !!end
4891
4892 # parsoid adds a space before the link name
4893 !! test
4894 External links: open square bracket forbidden in URL (named) (T6377)
4895 Parsoid variant.
4896 !! wikitext
4897 [http://example.com/1 [2345]
4898 !! html
4899 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4900 </p>
4901 !!end
4902
4903 !! test
4904 External links: nowiki in URL link text (T8230)
4905 !! wikitext
4906 [http://example.com/ <nowiki>''example site''</nowiki>]
4907 !! html
4908 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4909 </p>
4910 !! end
4911
4912 !! test
4913 External links: newline forbidden in text (T8230 regression check)
4914 !! wikitext
4915 [http://example.com/ first
4916 second]
4917 !! html
4918 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4919 second]
4920 </p>
4921 !!end
4922
4923 !! test
4924 External links: Pipe char between url and text
4925 !! wikitext
4926 [http://example.com | link]
4927 !! html
4928 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4929 </p>
4930 !!end
4931
4932 !! test
4933 External links: protocol-relative URL in brackets
4934 !! wikitext
4935 [//example.com/ Test]
4936 !! html
4937 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4938 </p>
4939 !! end
4940
4941 # parsoid doesn't explicitly mark autonumbered links, see T55505
4942 !! test
4943 External links: protocol-relative URL in brackets without text
4944 !! wikitext
4945 [//example.com]
4946 !! html/php
4947 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4948 </p>
4949 !! html/parsoid
4950 <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
4951 !! end
4952
4953 !! test
4954 External links: protocol-relative URL in free text is left alone
4955 !! wikitext
4956 //example.com/Foo
4957 !! html
4958 <p>//example.com/Foo
4959 </p>
4960 !!end
4961
4962 !! test
4963 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4964 !! wikitext
4965 foo//example.com/Foo
4966 !! html
4967 <p>foo//example.com/Foo
4968 </p>
4969 !! end
4970
4971 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
4972 !! test
4973 External links: with no contents
4974 !! options
4975 parsoid=wt2html,wt2wt
4976 !! wikitext
4977 [http://en.wikipedia.org/wiki/Foo]
4978
4979 [[wikipedia:Foo|Bar]]
4980
4981 [[wikipedia:Foo|<span>Bar</span>]]
4982 !! html/php
4983 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4984 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4985 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4986 </p>
4987 !! html/parsoid
4988 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4989 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4990 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4991 !! end
4992
4993 !! test
4994 External links: Free with trailing punctuation
4995 !! wikitext
4996 http://example.com,
4997 http://example.com;
4998 http://example.com\
4999 http://example.com.
5000 http://example.com:
5001 http://example.com!
5002 http://example.com?
5003 http://example.com)
5004 http://example.com/url_with_(brackets)
5005 (http://example.com/url_without_brackets)
5006 http://example.com/url_with_entity&amp;
5007 http://example.com/url_with_entity&#x26;
5008 http://example.com/url_with_entity&#038;
5009 http://example.com/url_with_entity&nbsp;
5010 http://example.com/url_with_entity&#xA0;
5011 http://example.com/url_with_entity&#160;
5012 http://example.com/url_with_entity&lt;
5013 http://example.com/url_with_entity&#x3C;
5014 http://example.com/url_with_entity&#60;
5015 !! html/php
5016 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
5017 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
5018 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
5019 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
5020 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
5021 <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/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5025 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5026 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5027 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5028 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5029 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5030 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
5031 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5032 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
5033 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
5034 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
5035 </p>
5036 !! html/parsoid
5037 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
5038 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
5039 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
5040 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
5041 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
5042 <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/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5046 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5047 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5048 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5049 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5050 <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>
5051 <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>
5052 <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>
5053 <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>
5054 <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>
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;#60;","srcContent":"&lt;"}'>&lt;</span></p>
5056 !! end
5057
5058 !! test
5059 External links: tricky Parsoid html2html case
5060 !! options
5061 parsoid=wt2html,wt2wt,html2html
5062 !! wikitext
5063 http://example.com/url_with_entity&amp;amp;
5064 !! html/php
5065 <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>;
5066 </p>
5067 !! html/parsoid
5068 <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>
5069 !! end
5070
5071 !! test
5072 External links: Free with trailing quotes (T113666)
5073 !! wikitext
5074 '''News:''' Stuff here
5075
5076 news:'a'b''c''d e
5077 !! html/php
5078 <p><b>News:</b> Stuff here
5079 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
5080 </p>
5081 !! html/parsoid
5082 <p><b>News:</b> Stuff here</p>
5083 <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
5084 !! end
5085
5086 !! test
5087 External links: with entity
5088 !! wikitext
5089 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
5090 !! html/php
5091 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
5092 </p>
5093 !! html/parsoid
5094 <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>
5095 !! end
5096
5097 !! test
5098 External links: Lone protocols are never linked (T105697)
5099 !! wikitext
5100 http://
5101 http://;
5102 (http://)
5103 bitcoin:
5104 bitcoin:;
5105 (bitcoin:)
5106 !! html
5107 <p>http://
5108 http://;
5109 (http://)
5110 bitcoin:
5111 bitcoin:;
5112 (bitcoin:)
5113 </p>
5114 !! end
5115
5116 !! test
5117 External links: No preceding word characters allowed (T67278)
5118 !! wikitext
5119 NOPEhttp://example.com
5120 N0http://example.com
5121 ok:http://example.com
5122 ok-http://example.com
5123 !! html
5124 <p>NOPEhttp://example.com
5125 N0http://example.com
5126 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5127 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5128 </p>
5129 !! end
5130
5131 !! test
5132 External links: nofollow domain exception
5133 !! wikitext
5134 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
5135 !! html
5136 <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>.
5137 </p>
5138 !!end
5139
5140 !! test
5141 External image
5142 !! wikitext
5143 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5144 !! html
5145 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5146 </p>
5147 !! end
5148
5149 !! test
5150 External image from https
5151 !! wikitext
5152 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5153 !! html
5154 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5155 </p>
5156 !! end
5157
5158 !! test
5159 External image (when not allowed)
5160 !! options
5161 wgAllowExternalImages=0
5162 !! wikitext
5163 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5164 !! html
5165 <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>
5166 </p>
5167 !! end
5168
5169 !! test
5170 Link to non-http image, no img tag
5171 !! wikitext
5172 Link to non-http image, no img tag: ftp://example.com/test.jpg
5173 !! html
5174 <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>
5175 </p>
5176 !! end
5177
5178 !! test
5179 External links: terminating separator
5180 !! wikitext
5181 Terminating separator: http://example.com/thing,
5182 !! html
5183 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
5184 </p>
5185 !! end
5186
5187 !! test
5188 External links: intervening separator
5189 !! wikitext
5190 Intervening separator: http://example.com/1,2,3
5191 !! html
5192 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
5193 </p>
5194 !! end
5195
5196 !! test
5197 External links: old bug with URL in query
5198 !! wikitext
5199 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
5200 !! html
5201 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
5202 </p>
5203 !! end
5204
5205 !! test
5206 External links: old URL-in-URL bug, mixed protocols
5207 !! wikitext
5208 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
5209 !! html
5210 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
5211 </p>
5212 !!end
5213
5214 # Since Parsoid is starting to emit canonical wikitext for links,
5215 # [http://example.com http://example.com] will not RT back to that
5216 # form anymore.
5217 !! test
5218 External links: URL in text
5219 !! options
5220 parsoid=wt2html
5221 !! wikitext
5222 URL in text: [http://example.com http://example.com]
5223 !! html/php
5224 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
5225 </p>
5226 !! html/parsoid
5227 <p>URL in text: <a rel="mw:ExtLink" class="external text" href="http://example.com">http://example.com</a></p>
5228 !! end
5229
5230 !! test
5231 External links: Clickable images
5232 !! wikitext
5233 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5234 !! html/php
5235 <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>
5236 </p>
5237 !! html/parsoid
5238 <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>
5239 !! end
5240
5241 !! test
5242 External links: raw ampersand
5243 !! wikitext
5244 Old &amp; use: http://x&y
5245 !! html
5246 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5247 </p>
5248 !! end
5249
5250 !! test
5251 External links: encoded ampersand
5252 !! wikitext
5253 Old &amp; use: http://x&amp;y
5254 !! html/php
5255 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5256 </p>
5257 !! html/parsoid
5258 <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>
5259 !! end
5260
5261 !! test
5262 External links: encoded equals (T8102)
5263 !! wikitext
5264 http://example.com/?foo&#61;bar
5265 !! html/php
5266 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5267 </p>
5268 !! html/parsoid
5269 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5270 !! end
5271
5272 ##
5273 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5274 ## does it number them. As discussed in T55505, we can identify
5275 ## autonumbered links via CSS.
5276 ##
5277
5278 !! test
5279 External links: [raw ampersand]
5280 !! wikitext
5281 Old &amp; use: [http://x&y]
5282 !! html/php
5283 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5284 </p>
5285 !! html/parsoid
5286 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5287 !! end
5288
5289 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5290 # mode will return the [raw ampersand] wikitext
5291 !! test
5292 External links: [encoded ampersand]
5293 !! options
5294 parsoid=wt2html,wt2wt,html2html
5295 !! wikitext
5296 Old &amp; use: [http://x&amp;y]
5297 !! html/php
5298 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5299 </p>
5300 !! html/parsoid
5301 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5302 !! end
5303
5304 !! test
5305 External links: [raw equals]
5306 !! wikitext
5307 [http://example.com/?foo=bar]
5308 !! html/php
5309 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5310 </p>
5311 !! html/parsoid
5312 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5313 !! end
5314
5315 # note that parsoid html is identical to [raw equals] case; so html2wt
5316 # mode will return the [raw equals] wikitext
5317 !! test
5318 External links: [encoded equals] (T8102)
5319 !! options
5320 parsoid=wt2html,wt2wt,html2html
5321 !! wikitext
5322 [http://example.com/?foo&#61;bar]
5323 !! html/php
5324 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5325 </p>
5326 !! html/parsoid
5327 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5328 !! end
5329
5330 # xxx parsoid strips the IDN character, so the round-trip tests will
5331 # obviously fail and are disabled. --cscott
5332 !! test
5333 External links: [IDN ignored character reference in hostname; strip it right off]
5334 !! options
5335 parsoid=wt2html,wt2wt,html2html
5336 !! wikitext
5337 [http://e&zwnj;xample.com/]
5338 !! html/php
5339 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5340 </p>
5341 !! html/parsoid
5342 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
5343 !! end
5344
5345 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5346 # Where an external link could easily circumvent the sanitization of the text of
5347 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5348 # test demands a higher standard. That's a bit strange.
5349 #
5350 # Example:
5351 #
5352 # http://e‌xample.com -> [http://example.com|http://example.com]
5353 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5354 #
5355 # The first example is sanitized, but the second is not. Any security benefits
5356 # from this production are trivial to circumvent. Either remove this test and
5357 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5358 # the test accordingly.
5359 #
5360 # All our love,
5361 # The Parsoid team.
5362 # xxx parsoid strips the IDN character, so the round-trip tests will
5363 # obviously fail and are disabled. --cscott
5364 !! test
5365 External links: IDN ignored character reference in hostname; strip it right off
5366 !! options
5367 parsoid=wt2html,html2html
5368 !! wikitext
5369 http://e&zwnj;xample.com/
5370 !! html/php
5371 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5372 </p>
5373 !! html/parsoid
5374 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
5375 !! end
5376
5377 !! test
5378 External links: www.jpeg.org (T2554)
5379 !! wikitext
5380 http://www.jpeg.org
5381 !! html
5382 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5383 </p>
5384 !! end
5385
5386 # parsoid doesn't explicitly mark autonumbered links, see T55505
5387 !! test
5388 External links: URL within URL (T2002)
5389 !! wikitext
5390 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5391 !! html/php
5392 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5393 </p>
5394 !! html/parsoid
5395 <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>
5396 !! end
5397
5398 !! test
5399 T2361: URL inside bracketed URL
5400 !! wikitext
5401 [http://www.example.com/foo http://www.example.com/bar]
5402 !! html
5403 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5404 </p>
5405 !! end
5406
5407 !! test
5408 T2361: URL within URL, not bracketed
5409 !! wikitext
5410 http://www.example.com/foo?=http://www.example.com/bar
5411 !! html
5412 <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>
5413 </p>
5414 !! end
5415
5416 !! test
5417 T2289: ">"-token in URL-tail
5418 !! wikitext
5419 http://www.example.com/<hello>
5420 !! html
5421 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5422 </p>
5423 !!end
5424
5425 !! test
5426 T2289: literal ">"-token in URL-tail
5427 !! wikitext
5428 http://www.example.com/<b>html</b>
5429 !! html/php
5430 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5431 </p>
5432 !! html/parsoid
5433 <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>
5434 !! end
5435
5436 !! test
5437 T2289: ">"-token in bracketed URL
5438 !! wikitext
5439 [http://www.example.com/<hello> stuff]
5440 !! html
5441 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5442 </p>
5443 !!end
5444
5445 !! test
5446 T2289: literal ">"-token in bracketed URL
5447 !! wikitext
5448 [http://www.example.com/<b>html</b> stuff]
5449 !! html
5450 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5451 </p>
5452 !!end
5453
5454 !! test
5455 T2289: literal double quote at end of URL
5456 !! wikitext
5457 http://www.example.com/"hello"
5458 !! html
5459 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5460 </p>
5461 !!end
5462
5463 !! test
5464 T2289: literal double quote in bracketed URL
5465 !! wikitext
5466 [http://www.example.com/"hello" stuff]
5467 !! html
5468 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5469 </p>
5470 !!end
5471
5472 !! test
5473 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5474 !! wikitext
5475 [http://www.example.com test]
5476 !! html
5477 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5478 </p>
5479 !! end
5480
5481 !! test
5482 External links: link text with spaces
5483 !! wikitext
5484 [http://www.example.com a b c]
5485 [http://www.example.com ''a'' ''b'']
5486 !! html
5487 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5488 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5489 </p>
5490 !! end
5491
5492 # Note edge case difference between PHP and Parsoid here.
5493 !! test
5494 External links: wiki links within external link (T5695)
5495 !! options
5496 parsoid=wt2html,html2html
5497 !! wikitext
5498 [http://example.com [[wikilink]] embedded in ext link]
5499
5500 [http://example.com test [[wikilink]] embedded in ext link]
5501 !! html/php
5502 <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>
5503 </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>
5504 </p>
5505 !! html/parsoid
5506 <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>
5507 <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>
5508 !! end
5509
5510 !! test
5511 T2787: Links with one slash after the url protocol are invalid
5512 !! wikitext
5513 http:/example.com
5514
5515 [http:/example.com title]
5516 !! html
5517 <p>http:/example.com
5518 </p><p>[http:/example.com title]
5519 </p>
5520 !! end
5521
5522 !! test
5523 Bracketed external links with template-generated invalid target
5524 !! wikitext
5525 [{{echo|http:/example.com}} title]
5526 !! html
5527 <p>[http:/example.com title]
5528 </p>
5529 !! end
5530
5531 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5532 !! test
5533 Broken wikilinks (but not external links) prevent templates from closing
5534 !! options
5535 parsoid=wt2html
5536 !! wikitext
5537 [http://example.com x
5538
5539 {{echo|[http://example.com x}}
5540
5541 [[Foo
5542
5543 {{echo|[[Foo}}
5544 !! html/php
5545 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5546 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5547 </p><p>[[Foo
5548 </p><p>{{echo|[[Foo}}
5549 </p>
5550 !! html/parsoid
5551 <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5552 <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>
5553 <p>[[Foo</p>
5554 <p>{{echo|[[Foo}}</p>
5555 !! end
5556
5557 !! test
5558 Wikilinks with embedded newlines are not broken
5559 !! wikitext
5560 {{echo|[[ Foo
5561 B
5562 C]]}}
5563 !! html/php
5564 <p>[[ Foo
5565 B
5566 C]]
5567 </p>
5568 !! html/parsoid
5569 <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>
5570 !! end
5571
5572 !! test
5573 Broken templates
5574 !! options
5575 parsoid=wt2html
5576 !! wikitext
5577 {{echo|[[Foo|}}]]
5578
5579 [[Foo|{{echo|]]}}
5580 !! html/php
5581 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5582 </p><p>[[Foo|]]
5583 </p>
5584 !! html/parsoid
5585 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5586 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5587 !! end
5588
5589 !! test
5590 T4702: Mismatched <i>, <b> and <a> tags are invalid
5591 !! wikitext
5592 ''[http://example.com text'']
5593 [http://example.com '''text]'''
5594 ''Something [http://example.com in italic'']
5595 ''Something [http://example.com mixed''''', even bold]'''
5596 '''''Now [http://example.com both''''']
5597 !! html
5598 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5599 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5600 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5601 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5602 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5603 </p>
5604 !! end
5605
5606
5607 !! test
5608 T6781: %26 in URL
5609 !! wikitext
5610 http://www.example.com/?title=AT%26T
5611 !! html/php
5612 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5613 </p>
5614 !! html/parsoid
5615 <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>
5616 !! end
5617
5618 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5619 # % is actually legal in HTML5. Any change in output would need testing though.
5620 !! test
5621 T6781, T7267: %25 in URL
5622 !! wikitext
5623 http://www.example.com/?title=100%25_Bran
5624 !! html/php
5625 <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>
5626 </p>
5627 !! html/parsoid
5628 <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>
5629 !! end
5630
5631 !! test
5632 T6781, T7267: %28, %29 in URL
5633 !! wikitext
5634 http://www.example.com/?title=Ben-Hur_%281959_film%29
5635 !! html/php
5636 <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>
5637 </p>
5638 !! html/parsoid
5639 <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>
5640 !! end
5641
5642
5643 !! test
5644 T6781: %26 in autonumber URL
5645 !! wikitext
5646 [http://www.example.com/?title=AT%26T]
5647 !! html/php
5648 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5649 </p>
5650 !! html/parsoid
5651 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5652 !! end
5653
5654 !! test
5655 T6781, T7267: %26 in autonumber URL
5656 !! wikitext
5657 [http://www.example.com/?title=100%25_Bran]
5658 !! html/php
5659 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5660 </p>
5661 !! html/parsoid
5662 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5663 !! end
5664
5665 !! test
5666 T6781, T7267: %28, %29 in autonumber URL
5667 !! wikitext
5668 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5669 !! html/php
5670 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5671 </p>
5672 !! html/parsoid
5673 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5674 !! end
5675
5676
5677 !! test
5678 T6781: %26 in bracketed URL
5679 !! wikitext
5680 [http://www.example.com/?title=AT%26T link]
5681 !! html/php
5682 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5683 </p>
5684 !! html/parsoid
5685 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5686 !! end
5687
5688 !! test
5689 T6781, T7267: %25 in bracketed URL
5690 !! wikitext
5691 [http://www.example.com/?title=100%25_Bran link]
5692 !! html
5693 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5694 </p>
5695 !! end
5696
5697 !! test
5698 T6781, T7267: %28, %29 in bracketed URL
5699 !! wikitext
5700 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5701 !! html/php
5702 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5703 </p>
5704 !! html/parsoid
5705 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5706 !! end
5707
5708 !! test
5709 External link containing a period in the anchor. (T65947)
5710 !! wikitext
5711 [//foo.org/bar#baz. bang]
5712
5713 [//foo.org/bar. bang]
5714 !! html/php
5715 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5716 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5717 </p>
5718 !! html/parsoid
5719 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5720 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5721 !! end
5722
5723 !! test
5724 External link containing a single quote. (T65947)
5725 !! wikitext
5726 [//foo.org/bar'baz]
5727
5728 [//foo.org/bar'baz bang]
5729 !! html/php
5730 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5731 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5732 </p>
5733 !! html/parsoid
5734 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5735 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5736 !! end
5737
5738 !! test
5739 External link containing double-single-quotes in text '' (T6598 sanity check)
5740 !! wikitext
5741 Some [http://example.com/ pretty ''italics'' and stuff]!
5742 !! html
5743 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5744 </p>
5745 !! end
5746
5747 !! test
5748 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5749 !! wikitext
5750 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5751 !! html
5752 <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>
5753 </p>
5754 !! end
5755
5756 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5757 !! test
5758 External link containing double-single-quotes with no space separating the url from text in italics
5759 !! wikitext
5760 [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]].]
5761 !! html/php+tidy
5762 <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>.
5763 </p>
5764 !! html/parsoid
5765 <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>
5766 !! end
5767
5768 !! test
5769 External link with comments in link text
5770 !! wikitext
5771 [http://www.google.com Google <!-- comment -->]
5772 !! html/php
5773 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5774 </p>
5775 !! html/parsoid
5776 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5777 !! end
5778
5779 !! test
5780 External link to bare IPv4 address
5781 !! wikitext
5782 [http://192.168.0.1 Link]
5783 !! html/php
5784 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5785 </p>
5786 !! html/parsoid
5787 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5788 !! end
5789
5790 !! test
5791 URL-encoding in URL functions (single parameter)
5792 !! wikitext
5793 {{localurl:Some page|amp=&}}
5794 !! html
5795 <p>/index.php?title=Some_page&amp;amp=&amp;
5796 </p>
5797 !! end
5798
5799 !! test
5800 URL-encoding in URL functions (multiple parameters)
5801 !! wikitext
5802 {{localurl:Some page|q=?&amp=&}}
5803 !! html
5804 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5805 </p>
5806 !! end
5807
5808 !! test
5809 Brackets in urls
5810 !! wikitext
5811 http://example.com/index.php?foozoid%5B%5D=bar
5812
5813 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5814 !! html/php
5815 <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>
5816 </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>
5817 </p>
5818 !! html/parsoid
5819 <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>
5820
5821 <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>
5822 !! end
5823
5824 !! test
5825 IPv6 urls, autolink format (T23261)
5826 !! wikitext
5827 http://[2404:130:0:1000::187:2]/index.php
5828
5829 Examples from RFC 2373, section 2.2:
5830
5831 *http://[1080::8:800:200C:417A]/unicast
5832 *http://[FF01::101]/multicast
5833 *http://[::1]/loopback
5834 *http://[::]/unspecified
5835 *http://[::13.1.68.3]/ipv4compat
5836 *http://[::FFFF:129.144.52.38]/ipv4compat
5837
5838 Examples from RFC 2732, section 2:
5839
5840 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5841 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5842 *http://[3ffe:2a00:100:7031::1]
5843 *http://[1080::8:800:200C:417A]/foo
5844 *http://[::192.9.5.5]/ipng
5845 *http://[::FFFF:129.144.52.38]:80/index.html
5846 *http://[2010:836B:4179::836B:4179]
5847 !! html/php
5848 <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>
5849 </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:
5850 </p>
5851 <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>
5852 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5853 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5854 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5855 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5856 <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>
5857 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5858 </p>
5859 <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>
5860 <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>
5861 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5862 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5863 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5864 <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>
5865 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5866
5867 !! html/parsoid
5868 <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>
5869
5870 <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>
5871 <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>
5872 <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5873 <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5874 <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5875 <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5876 <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>
5877
5878 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5879 <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>
5880 <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>
5881 <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5882 <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>
5883 <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5884 <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>
5885 <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5886 !! end
5887
5888 !! test
5889 IPv6 urls, bracketed format (T23261)
5890 !! wikitext
5891 [http://[2404:130:0:1000::187:2]/index.php test]
5892
5893 Examples from RFC 2373, section 2.2:
5894
5895 *[http://[1080::8:800:200C:417A] unicast]
5896 *[http://[FF01::101] multicast]
5897 *[http://[::1]/ loopback]
5898 *[http://[::] unspecified]
5899 *[http://[::13.1.68.3] ipv4compat]
5900 *[http://[::FFFF:129.144.52.38] ipv4compat]
5901
5902 Examples from RFC 2732, section 2:
5903
5904 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5905 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5906 *[http://[3ffe:2a00:100:7031::1] 3]
5907 *[http://[1080::8:800:200C:417A]/foo 4]
5908 *[http://[::192.9.5.5]/ipng 5]
5909 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5910 *[http://[2010:836B:4179::836B:4179] 7]
5911 !! html/php
5912 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5913 </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:
5914 </p>
5915 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5916 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5917 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5918 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5919 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5920 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5921 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5922 </p>
5923 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5924 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5925 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5926 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5927 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5928 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5929 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5930
5931 !! html/parsoid
5932 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5933
5934 <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>
5935 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5936 <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5937 <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5938 <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5939 <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5940 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5941
5942 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5943 <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>
5944 <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5945 <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5946 <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5947 <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5948 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5949 <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5950 !! end
5951
5952 !! test
5953 Non-extlinks in brackets
5954 !! wikitext
5955 [foo]
5956 [foo bar]
5957 [foo ''bar'']
5958 [fool's] errand
5959 [fool's errand]
5960 [{{echo|foo}}]
5961 [{{echo|foo}} bar]
5962 [{{echo|foo}} ''bar'']
5963 [{{echo|foo}}l's] errand
5964 [{{echo|foo}}l's errand]
5965 [url={{echo|foo}}]
5966 [url=http://example.com]
5967 [http:// bare protocols don't count]
5968 !! html/php
5969 <p>[foo]
5970 [foo bar]
5971 [foo <i>bar</i>]
5972 [fool's] errand
5973 [fool's errand]
5974 [foo]
5975 [foo bar]
5976 [foo <i>bar</i>]
5977 [fool's] errand
5978 [fool's errand]
5979 [url=foo]
5980 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5981 [http:// bare protocols don't count]
5982 </p>
5983 !! html/parsoid
5984 <p>[foo]
5985 [foo bar]
5986 [foo <i>bar</i>]
5987 [fool's] errand
5988 [fool's errand]
5989 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
5990 [<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]
5991 [<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>]
5992 [<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
5993 [<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]
5994 [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>]
5995 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
5996 [http:// bare protocols don't count]</p>
5997 !! end
5998
5999 !! test
6000 Percent encoding in external links
6001 !! wikitext
6002 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
6003 !! html/php
6004 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
6005 </p>
6006 !! html/parsoid
6007 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
6008 !! end
6009
6010 !! test
6011 Use url link syntax for links where the content is equal the link target
6012 !! wikitext
6013 http://example.com
6014 !! html/php
6015 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
6016 </p>
6017 !! html/parsoid
6018 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
6019 !! end
6020
6021 !! test
6022 Parenthesis in external links, especially URL links
6023 !! wikitext
6024 http://example.com)
6025
6026 http://example.com/test)
6027
6028 http://example.com/(test)
6029
6030 http://example.com/((test)
6031
6032 (http://example.com/(test))
6033
6034 (http://example.com/(test)))))
6035
6036 http://example.com/a)b
6037
6038 [http://example.com) foo]
6039 !! html/php
6040 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6041 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
6042 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
6043 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
6044 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
6045 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
6046 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
6047 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
6048 </p>
6049 !! html/parsoid
6050 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
6051 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
6052 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
6053 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
6054 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
6055 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
6056 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
6057 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
6058 !! end
6059
6060 !! test
6061 Parenthesis in external links, w/ transclusion or comment
6062 !! wikitext
6063 (http://example.com/{{echo|hi}})
6064
6065 (http://example.com<!-- hi -->)
6066 !! html/php
6067 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
6068 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6069 </p>
6070 !! html/parsoid
6071 <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>
6072
6073 <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>
6074 !! end
6075
6076 !! test
6077 Serialize <a> tags with invalid link targets as plain text
6078 !! options
6079 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
6080 !! html/parsoid
6081 <a rel="mw:WikiLink" href="[[foo]]">text</a>
6082 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
6083 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
6084 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
6085 !! wikitext
6086 text
6087 <nowiki>*</nowiki>text
6088 <nowiki>[[foo]]</nowiki>
6089 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
6090 !! end
6091
6092 !! test
6093 mw:ExtLink -vs- mw:WikiLink (T94723)
6094 !! options
6095 parsoid=html2wt
6096 !! html/parsoid
6097 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
6098 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
6099 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6100 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6101 <p>
6102 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6103 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6104 </p>
6105 !! wikitext
6106 [[Foo|Bar]]
6107 [[Foo|Bar]]
6108 [[:en:Foo|Bar]]
6109 [[:en:Foo|Bar]]
6110
6111 [[:en:European_Robin|European Robin]]
6112 [[:en:European_Robin|European Robin]]
6113 !! end
6114
6115 !! test
6116 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
6117 !! options
6118 parsoid=wt2wt
6119 !! wikitext
6120 [http://en.wikipedia.org/wiki/European_Robin European Robin]
6121 !! html/parsoid
6122 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
6123 !! end
6124
6125
6126 ###
6127 ### Quotes
6128 ###
6129
6130 !! test
6131 Quotes
6132 !! wikitext
6133 Normal text. '''Bold text.''' Normal text. ''Italic text.''
6134
6135 Normal text. '''''Bold italic text.''''' Normal text.
6136 !! html
6137 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
6138 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
6139 </p>
6140 !! end
6141
6142
6143 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
6144 # parser strips. The wikitext contains just the first half of the bold
6145 # quote pair.
6146 !! test
6147 Unclosed and unmatched quotes
6148 !! wikitext
6149 '''''Bold italic text '''with bold deactivated''' in between.'''''
6150
6151 '''''Bold italic text ''with italic deactivated'' in between.'''''
6152
6153 '''Bold text..
6154
6155 ..spanning two paragraphs (should not work).'''
6156
6157 '''Bold tag left open
6158
6159 ''Italic tag left open
6160
6161 Normal text.
6162
6163 <!-- Unmatching number of opening, closing tags: -->
6164 '''This year''''s election ''should'' beat '''last year''''s.
6165
6166 ''Tom'''s car is bigger than ''Susan'''s.
6167
6168 Plain ''italic'''s plain
6169 !! html/php
6170 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6171 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6172 </p><p><b>Bold text..</b>
6173 </p><p>..spanning two paragraphs (should not work).
6174 </p><p><b>Bold tag left open</b>
6175 </p><p><i>Italic tag left open</i>
6176 </p><p>Normal text.
6177 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6178 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6179 </p><p>Plain <i>italic'</i>s plain
6180 </p>
6181 !! html/parsoid
6182 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6183 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6184 </p><p><b>Bold text..</b>
6185 </p><p>..spanning two paragraphs (should not work).<b></b>
6186 </p><p><b>Bold tag left open</b>
6187 </p><p><i>Italic tag left open</i>
6188 </p><p>Normal text.
6189 </p>
6190 <!-- Unmatching number of opening, closing tags: -->
6191 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6192 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6193 </p><p>Plain <i>italic'</i>s plain
6194 </p>
6195 !! end
6196
6197 ###
6198 ### Tables
6199 ###
6200 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
6201 ###
6202
6203 # This should not produce <table></table> as <table><tr><td></td></tr></table>
6204 # is the bare minimum required by the spec, see:
6205 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
6206 # Parsoid team replies: empty table tags are legal in HTML5
6207 !! test
6208 A table with no data.
6209 !! options
6210 parsoid=wt2html
6211 !! wikitext
6212 {||}
6213 !! html/php
6214
6215 !! html/parsoid
6216 <table></table>
6217
6218 !! end
6219
6220 !! test
6221 A table with stray table end tags on start tag line (wt2html)
6222 !! options
6223 parsoid=wt2html
6224 !! wikitext
6225 {|style="color: red;"|}
6226
6227 {|style="color: red;" |}
6228 |foo
6229 |}
6230
6231 {|style="color: red;"|} id="foo"
6232 |foo
6233 |}
6234
6235 {|style="color: red;" |} id="foo"
6236 |foo
6237 |}
6238 !! html
6239 <table style="color: red;"></table>
6240
6241 <table style="color: red;">
6242 <tbody><tr>
6243 <td>foo</td>
6244 </tr></tbody>
6245 </table>
6246
6247 <table style="color: red;" id="foo">
6248 <tbody><tr>
6249 <td>foo</td>
6250 </tr></tbody>
6251 </table>
6252
6253 <table style="color: red;" id="foo">
6254 <tbody><tr>
6255 <td>foo</td>
6256 </tr></tbody>
6257 </table>
6258
6259 !! end
6260
6261 !! test
6262 A table with no data (take 2)
6263 !! wikitext
6264 {|
6265 |}
6266 !! html/parsoid
6267 <table></table>
6268 !! end
6269
6270 # A table with nothing but a caption is invalid XHTML, we might want to render
6271 # this as <p>caption</p>
6272 # Parsoid team replies: table with only a caption is legal in HTML5
6273 !! test
6274 A table with nothing but a caption
6275 !! wikitext
6276 {|
6277 |+caption
6278 |}
6279 !! html/php
6280 <table>
6281 <caption>caption
6282 </caption><tr><td></td></tr></table>
6283
6284 !! html/parsoid
6285 <table><caption>caption</caption></table>
6286 !! end
6287
6288 !! test
6289 A table with caption with default-spaced attributes and a table row
6290 !! wikitext
6291 {|
6292 |+ style="color: red;" |caption1
6293 |-
6294 |foo
6295 |}
6296 !! html
6297 <table>
6298 <caption style="color: red;">caption1
6299 </caption>
6300 <tr>
6301 <td>foo
6302 </td></tr></table>
6303
6304 !! end
6305
6306 !! test
6307 A table with captions with non-default spaced attributes and a table row
6308 !! wikitext
6309 {|
6310 |+style="color: red;"|caption2
6311 |+ style="color: red;"|caption3
6312 |-
6313 |foo
6314 |}
6315 !! html
6316 <table>
6317 <caption style="color: red;">caption2
6318 </caption>
6319 <caption style="color: red;">caption3
6320 </caption>
6321 <tr>
6322 <td>foo
6323 </td></tr></table>
6324
6325 !! end
6326
6327 !! test
6328 Table td-cell syntax variations
6329 !! wikitext
6330 {|
6331 |foo bar foo|baz
6332 |foo bar foo||baz
6333 |style='color:red;'|baz
6334 |style='color:red;'||baz
6335 |}
6336 !! html
6337 <table>
6338 <tr>
6339 <td>baz
6340 </td>
6341 <td>foo bar foo</td>
6342 <td>baz
6343 </td>
6344 <td style="color:red;">baz
6345 </td>
6346 <td>style='color:red;'</td>
6347 <td>baz
6348 </td></tr></table>
6349
6350 !! end
6351
6352 !! test
6353 Simple table
6354 !! wikitext
6355 {|
6356 |1||2
6357 |-
6358 |3||4
6359 |}
6360 !! html
6361 <table>
6362 <tr>
6363 <td>1</td>
6364 <td>2
6365 </td></tr>
6366 <tr>
6367 <td>3</td>
6368 <td>4
6369 </td></tr></table>
6370
6371 !! end
6372
6373 !! test
6374 Simple table but with multiple dashes for row wikitext
6375 !! wikitext
6376 {|
6377 |foo
6378 |-----
6379 |bar
6380 |}
6381 !! html
6382 <table>
6383 <tr>
6384 <td>foo
6385 </td></tr>
6386 <tr>
6387 <td>bar
6388 </td></tr></table>
6389
6390 !! end
6391
6392 !! test
6393 Multiplication table
6394 !! wikitext
6395 {| border="1" cellpadding="2"
6396 |+Multiplication table
6397 |-
6398 !&times;!!1!!2!!3
6399 |-
6400 !1
6401 |1||2||3
6402 |-
6403 !2
6404 |2||4||6
6405 |-
6406 !3
6407 |3||6||9
6408 |-
6409 !4
6410 |4||8||12
6411 |-
6412 !5
6413 |5||10||15
6414 |}
6415 !! html
6416 <table border="1" cellpadding="2">
6417 <caption>Multiplication table
6418 </caption>
6419 <tr>
6420 <th>&#215;</th>
6421 <th>1</th>
6422 <th>2</th>
6423 <th>3
6424 </th></tr>
6425 <tr>
6426 <th>1
6427 </th>
6428 <td>1</td>
6429 <td>2</td>
6430 <td>3
6431 </td></tr>
6432 <tr>
6433 <th>2
6434 </th>
6435 <td>2</td>
6436 <td>4</td>
6437 <td>6
6438 </td></tr>
6439 <tr>
6440 <th>3
6441 </th>
6442 <td>3</td>
6443 <td>6</td>
6444 <td>9
6445 </td></tr>
6446 <tr>
6447 <th>4
6448 </th>
6449 <td>4</td>
6450 <td>8</td>
6451 <td>12
6452 </td></tr>
6453 <tr>
6454 <th>5
6455 </th>
6456 <td>5</td>
6457 <td>10</td>
6458 <td>15
6459 </td></tr></table>
6460
6461 !! end
6462
6463 !! test
6464 Accept "||" in table headings
6465 !! wikitext
6466 {|
6467 !h1||h2
6468 |}
6469 !! html
6470 <table>
6471 <tr>
6472 <th>h1</th>
6473 <th>h2
6474 </th></tr></table>
6475
6476 !! end
6477
6478 !! test
6479 Accept "!!" in table data
6480 !! wikitext
6481 {|
6482 |Foo!!||
6483 |}
6484 !! html
6485 <table>
6486 <tr>
6487 <td>Foo!!</td>
6488 <td>
6489 </td></tr></table>
6490
6491 !! html/parsoid
6492 <table>
6493 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6494 </tbody></table>
6495 !! end
6496
6497 !! test
6498 Accept "||" in indented table headings
6499 !! wikitext
6500 :{|
6501 !h1||h2
6502 |}
6503 !! html
6504 <dl><dd><table>
6505 <tr>
6506 <th>h1</th>
6507 <th>h2
6508 </th></tr></table></dd></dl>
6509
6510 !! end
6511
6512 !! test
6513 Accept "!!" in templates
6514 !! wikitext
6515 {|
6516 !a {{echo|b!!c}}
6517 |}
6518 !! html/php
6519 <table>
6520 <tr>
6521 <th>a b</th>
6522 <th>c
6523 </th></tr></table>
6524
6525 !! html/parsoid
6526 <table>
6527 <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>
6528 !! end
6529
6530 !! test
6531 Accept "!!" in table headings after newline
6532 !! wikitext
6533 {|
6534 !a
6535 b!!c
6536 |}
6537 !! html/php
6538 <table>
6539 <tr>
6540 <th>a
6541 <p>b!!c
6542 </p>
6543 </th></tr></table>
6544
6545 !! html/parsoid
6546 <table>
6547 <tbody><tr><th>a
6548 <p>b!!c</p></th></tr>
6549 </tbody></table>
6550 !! end
6551
6552 !! test
6553 Accept "!!" in table data of mixed wikitext / html syntax
6554 !! wikitext
6555 {|
6556 !a
6557 <tr><td>b!!c</td></tr>
6558 |}
6559 !! html/php+tidy
6560 <table>
6561 <tbody><tr>
6562 <th>a
6563 </th></tr><tr><td>b!!c</td></tr>
6564 </tbody></table>
6565 !! html/parsoid
6566 <table>
6567 <tbody><tr><th>a</th></tr>
6568 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6569 </tbody></table>
6570 !! end
6571
6572 !! test
6573 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6574 !! wikitext
6575 {|
6576 !|h1
6577 ||a
6578 |}
6579 !! html
6580 <table>
6581 <tr>
6582 <th>h1
6583 </th>
6584 <td>a
6585 </td></tr></table>
6586
6587 !! end
6588
6589 !!test
6590 Accept "| !" at start of line in tables (ignore !-attribute)
6591 !! wikitext
6592 {|
6593 |-
6594 |!style="color:red"|bar
6595 |}
6596 !! html
6597 <table>
6598
6599 <tr>
6600 <td>bar
6601 </td></tr></table>
6602
6603 !!end
6604
6605 !!test
6606 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 +/-
6607 !! wikitext
6608 {|
6609 |-
6610 |style='color:red;'|+1
6611 |style='color:blue;'|-1
6612 |-
6613 |1||2||3
6614 |1||+2||-3
6615 |-
6616 | +1
6617 | -1
6618 |}
6619 !! html
6620 <table>
6621
6622 <tr>
6623 <td style="color:red;">+1
6624 </td>
6625 <td style="color:blue;">-1
6626 </td></tr>
6627 <tr>
6628 <td>1</td>
6629 <td>2</td>
6630 <td>3
6631 </td>
6632 <td>1</td>
6633 <td>+2</td>
6634 <td>-3
6635 </td></tr>
6636 <tr>
6637 <td>+1
6638 </td>
6639 <td>-1
6640 </td></tr></table>
6641
6642 !!end
6643
6644 !! test
6645 Table rowspan
6646 !! wikitext
6647 {| border=1
6648 |Cell 1, row 1
6649 |rowspan=2|Cell 2, row 1 (and 2)
6650 |Cell 3, row 1
6651 |-
6652 |Cell 1, row 2
6653 |Cell 3, row 2
6654 |}
6655 !! html
6656 <table border="1">
6657 <tr>
6658 <td>Cell 1, row 1
6659 </td>
6660 <td rowspan="2">Cell 2, row 1 (and 2)
6661 </td>
6662 <td>Cell 3, row 1
6663 </td></tr>
6664 <tr>
6665 <td>Cell 1, row 2
6666 </td>
6667 <td>Cell 3, row 2
6668 </td></tr></table>
6669
6670 !! end
6671
6672 !! test
6673 Nested table
6674 !! wikitext
6675 {| border=1
6676 | &alpha;
6677 |
6678 {| bgcolor=#ABCDEF border=2
6679 |nested
6680 |-
6681 |table
6682 |}
6683 |the original table again
6684 |}
6685 !! html
6686 <table border="1">
6687 <tr>
6688 <td>&#945;
6689 </td>
6690 <td>
6691 <table bgcolor="#ABCDEF" border="2">
6692 <tr>
6693 <td>nested
6694 </td></tr>
6695 <tr>
6696 <td>table
6697 </td></tr></table>
6698 </td>
6699 <td>the original table again
6700 </td></tr></table>
6701
6702 !! end
6703
6704 !! test
6705 Invalid attributes in table cell (T3830)
6706 !! wikitext
6707 {|
6708 |Cell:|broken
6709 |}
6710 !! html
6711 <table>
6712 <tr>
6713 <td>broken
6714 </td></tr></table>
6715
6716 !! end
6717
6718 !! test
6719 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6720 !! wikitext
6721 {|
6722 |title="foo" |bar
6723 |title="foo<nowiki>|</nowiki>" |bar
6724 |title="foo<nowiki>|</nowiki>" bar
6725 |}
6726 !! html/php
6727 <table>
6728 <tr>
6729 <td title="foo">bar
6730 </td>
6731 <td title="foo&#124;">bar
6732 </td>
6733 <td>title="foo|" bar
6734 </td></tr></table>
6735
6736 !! html/parsoid
6737 <table>
6738 <tbody><tr><td title="foo">bar</td>
6739 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6740 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6741 </tbody></table>
6742 !! end
6743
6744 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6745 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6746 # *2wt modes will fail.
6747 !! test
6748 Table security: embedded pipes
6749 !! options
6750 parsoid=wt2html,html2html
6751 !! wikitext
6752 {|
6753 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6754 !! html/php
6755 <table>
6756 <tr>
6757 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6758 <td>]" onmouseover="alert(document.cookie)"&gt;test
6759 </td>
6760 </tr>
6761 </table>
6762
6763 !! html/parsoid
6764 <table><tbody>
6765 <tr>
6766 <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>
6767 !! end
6768
6769 !! test
6770 Element attributes with double ! should not be broken up by <th>
6771 !! wikitext
6772 {|
6773 !hi <div class="!!">ha</div> ho
6774 |}
6775 !! html/php
6776 <table>
6777 <tr>
6778 <th>hi <div class="!!">ha</div> ho
6779 </th></tr></table>
6780
6781 !! html/parsoid
6782 <table>
6783 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6784 </tbody></table>
6785 !! end
6786
6787 !! test
6788 ! and || in element attributes should not be parsed as <th>/<td>
6789 !! wikitext
6790 {|
6791 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6792 |}
6793 !! html/php
6794 <table>
6795 <tr>
6796 <td><div style="color: red&#32;!important;" data-contrived="put this here &#124;&#124;">hi</div>
6797 </td></tr></table>
6798
6799 !! html/parsoid
6800 <table>
6801 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6802 </tbody></table>
6803 !! end
6804
6805 # FIXME: The output seems broken. Filed as T110268.
6806 !! test
6807 ! and || in td attributes should not be parsed as <th>/<td>
6808 !! options
6809 parsoid=wt2html
6810 !! wikitext
6811 {|
6812 |style="color: red !important;" data-contrived="put this here ||"|foo
6813 |}
6814 !! html/php
6815 <table>
6816 <tr>
6817 <td>style="color: red&#160;!important;" data-contrived="put this here</td>
6818 <td>foo
6819 </td></tr></table>
6820
6821 !! html/parsoid
6822 <table>
6823 <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>
6824 </tbody></table>
6825 !! end
6826
6827 !! test
6828 Break on | in element attribute in template
6829 !! options
6830 parsoid=wt2html,html2html
6831 !! wikitext
6832 {{echo|1=<div class="hi|ho">ha</div>}}
6833 !! html/php
6834 <p>ho"&gt;ha&lt;/div&gt;
6835 </p>
6836 !! html/parsoid
6837 <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>
6838 !! end
6839
6840 !! test
6841 Break on | in element attribute name in template
6842 !! wikitext
6843 {{echo|<div cla|ss="hiho">ha</div>}}
6844 !! html/parsoid
6845 <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>
6846 !! end
6847
6848 !! test
6849 Don't break on | in extension attribute in template
6850 !! wikitext
6851 {{echo|<ref name="hi|ho">ha</ref>}}
6852
6853 <references />
6854 !! html/parsoid
6855 <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>
6856
6857 <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>
6858 !! end
6859
6860 ## We don't support roundtripping of these attributes in Parsoid.
6861 ## Selective serialization takes care of preventing dirty diffs.
6862 ## But, on edits, we dirty-diff the invalid attribute text.
6863 !! test
6864 Invalid text in table attributes should be discarded
6865 !! options
6866 parsoid=wt2html
6867 !! wikitext
6868 {| <span>boo</span> style='border:1px solid black'
6869 | <span>boo</span> style='color:blue' |1
6870 |<span>boo</span> style='color:blue'|2
6871 |}
6872 !! html/php
6873 <table style="border:1px solid black">
6874 <tr>
6875 <td style="color:blue">1
6876 </td>
6877 <td style="color:blue">2
6878 </td></tr></table>
6879
6880 !! html/parsoid
6881 <table style="border:1px solid black">
6882 <tr>
6883 <td style="color:blue">1</td>
6884 <td style="color:blue">2</td>
6885 </tr>
6886 </table>
6887 !! end
6888
6889 !! test
6890 Invalid text in table attributes should be preserved by selective serializer
6891 !! options
6892 parsoid={
6893 "modes": ["selser"],
6894 "changes": [
6895 ["td:first-child", "text", "abc"],
6896 ["td + td", "text", "xyz"]
6897 ]
6898 }
6899 !! wikitext
6900 {| <span>boo</span> style='border:1px solid black'
6901 | <span>boo</span> style='color:blue' | 1
6902 |<span>boo</span> style='color:blue'| 2
6903 |}
6904 !! wikitext/edited
6905 {| <span>boo</span> style='border:1px solid black'
6906 | <span>boo</span> style='color:blue' | abc
6907 |<span>boo</span> style='color:blue'| xyz
6908 |}
6909 !! end
6910
6911 !! test
6912 1. Template-generated table cell attributes and cell content
6913 !! wikitext
6914 {|
6915 |{{table_attribs}}
6916 | {{table_attribs}}
6917 || {{table_attribs_5}}
6918 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6919 |align=center {{table_attribs}}
6920 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6921 |}
6922 !! html
6923 <table>
6924 <tr>
6925 <td style="color:red;">Foo
6926 </td>
6927 <td style="color:red;">Foo
6928 </td>
6929 <td>style="color:red;"</td>
6930 <td>Bar
6931 </td>
6932 <td style="color:red;">Foo
6933 </td>
6934 <td align="center" style="color:red;">Foo
6935 </td>
6936 <td align="center" style="color:red;">Foo
6937 </td></tr></table>
6938
6939 !! end
6940
6941 !! test
6942 2. Template-generated table cell attributes and cell content
6943 !! wikitext
6944 {|
6945 |{{table_attribs_2}}
6946 |}
6947 !! html/php
6948 <table>
6949 <tr>
6950 <td style="color:red;">Foo
6951 </td>
6952 <td>Bar</td>
6953 <td>Baz
6954 </td></tr></table>
6955
6956 !! html/parsoid
6957 <table>
6958 <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>
6959 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6960 </tbody></table>
6961 !! end
6962
6963 !! test
6964 3. Template-generated table cell attributes and cell content
6965 !! wikitext
6966 {|
6967 !align=center {{table_header_cells}}
6968 |-
6969 |align=center {{table_cells}}
6970 |}
6971 !! html/php
6972 <table>
6973 <tr>
6974 <th align="center" style="color:red;">Foo</th>
6975 <th style="color:red;"><i>Bar</i></th>
6976 <th style="color:brown;"><i>Foo</i> and Baz
6977 </th></tr>
6978 <tr>
6979 <td align="center" style="color:red;">Foo</td>
6980 <td style="color:red;"><i>Bar</i></td>
6981 <td style="color:brown;"><i>Foo</i> and Baz
6982 </td></tr></table>
6983
6984 !! html/parsoid
6985 <table>
6986 <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>
6987 <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>
6988 </tbody></table>
6989 !! end
6990
6991 !! test
6992 4. Template-generated table cell attributes and cell content inside a templated table
6993 !! wikitext
6994 {{tbl-start}}
6995 !align=center {{table_header_cells}}
6996 |-
6997 |align=center {{table_cells}}
6998 {{tbl-end}}
6999 !! html/php
7000 <table>
7001 <tr>
7002 <th align="center" style="color:red;">Foo</th>
7003 <th style="color:red;"><i>Bar</i></th>
7004 <th style="color:brown;"><i>Foo</i> and Baz
7005 </th></tr>
7006 <tr>
7007 <td align="center" style="color:red;">Foo</td>
7008 <td style="color:red;"><i>Bar</i></td>
7009 <td style="color:brown;"><i>Foo</i> and Baz
7010 </td></tr></table>
7011
7012 !! html/parsoid
7013 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
7014 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
7015 <tr>
7016 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
7017 </tbody></table>
7018 !! end
7019
7020 ## Edge case fix to prevent future regressions
7021 !! test
7022 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
7023 !! wikitext
7024 {|
7025 |{{table_attribs_7}}
7026 |}
7027 <references />
7028 !! html/parsoid
7029 <table>
7030 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<sup class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","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>
7031 </tbody></table>
7032 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./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>
7033 !! end
7034
7035 !! test
7036 Table with row followed by newlines and table heading
7037 !! options
7038 parsoid=wt2html,html2html
7039 !! wikitext
7040 {|
7041 |-
7042
7043 !foo
7044 |}
7045 !! html/*
7046 <table>
7047
7048
7049 <tr>
7050 <th>foo
7051 </th></tr></table>
7052
7053 !! end
7054
7055 !! test
7056 Table with empty line following the start tag
7057 !! options
7058 parsoid=wt2html,html2html
7059 !! wikitext
7060 {|
7061
7062 |-
7063 |foo
7064 |}
7065 !! html/*
7066 <table>
7067
7068
7069 <tr>
7070 <td>foo
7071 </td></tr></table>
7072
7073 !! end
7074
7075 !! test
7076 Table attributes with empty value
7077 !! options
7078 parsoid=wt2html,html2html
7079 !! wikitext
7080 {|
7081 | style=|hello
7082 |}
7083 !! html/php
7084 <table>
7085 <tr>
7086 <td style="">hello
7087 </td></tr></table>
7088
7089 !! html/parsoid
7090 <table>
7091 <tbody><tr><td style="">hello</td></tr>
7092 </tbody></table>
7093 !! end
7094
7095 !! test
7096 Wikitext table with a lot of comments
7097 !! wikitext
7098 {|
7099 <!-- c0 -->
7100 |foo
7101 <!-- c1 -->
7102 |-<!-- c2 -->
7103 <!-- c3 -->
7104 |<!-- c4 -->
7105 <!-- c5 -->
7106 |}
7107 !! html
7108 <table>
7109 <tr>
7110 <td>foo
7111 </td></tr>
7112 <tr>
7113 <td>
7114 </td></tr></table>
7115
7116 !! end
7117
7118 !! test
7119 Wikitext table comments represented in parsoid dom
7120 !! wikitext
7121 {|<!--c1--><!--c2-->
7122 |-<!--c3-->
7123 |x
7124 |}
7125 !! html/php+tidy
7126 <table>
7127
7128 <tbody><tr>
7129 <td>x
7130 </td></tr></tbody></table>
7131 !! html/parsoid
7132 <table><!--c1--><!--c2-->
7133 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
7134 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
7135 </tbody></table>
7136 !! end
7137
7138 !! test
7139 Wikitext table with double-line table cell
7140 !! wikitext
7141 {|
7142 |a
7143 b
7144 |}
7145 !! html
7146 <table>
7147 <tr>
7148 <td>a
7149 <p>b
7150 </p>
7151 </td></tr></table>
7152
7153 !! end
7154
7155 !! test
7156 Table cell with a single comment
7157 !! wikitext
7158 {|
7159 |<!-- c1 -->
7160 |a
7161 |}
7162 !! html
7163 <table>
7164 <tr>
7165 <td>
7166 </td>
7167 <td>a
7168 </td></tr></table>
7169
7170 !! end
7171
7172 !! test
7173 Table-cell after a comment-only-empty-line
7174 !! wikitext
7175 {|
7176 |a
7177 <!--c1-->
7178 <!--c2-->|b
7179 |}
7180 !! html
7181 <table>
7182 <tr>
7183 <td>a
7184 </td>
7185 <td>b
7186 </td></tr></table>
7187
7188 !! html/parsoid
7189 <table>
7190 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7191 <!--c1-->
7192 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
7193 </tbody></table>
7194
7195 !! end
7196
7197 !! test
7198 Build table with {{!}}
7199 !! wikitext
7200 {{{!}} class="wikitable"
7201 !header
7202 !second header
7203 {{!}}- style="color:red;"
7204 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
7205 {{!}}}
7206 !! html
7207 <table class="wikitable">
7208 <tr>
7209 <th>header
7210 </th>
7211 <th>second header
7212 </th></tr>
7213 <tr style="color:red;">
7214 <td>data</td>
7215 <td style="color:red;">second data
7216 </td></tr></table>
7217
7218 !! end
7219
7220 !! test
7221 Build table with pipe as data
7222 !! wikitext
7223 {| class="wikitable"
7224 !header
7225 !second header
7226 |- style="color:red;"
7227 |data|| style="color:red;" |second data
7228 |-
7229 | style="color:red;" |data with | || style="color:red;" | second data with |
7230 |-
7231 ||data with | |||second data with |
7232 |}
7233 !! html
7234 <table class="wikitable">
7235 <tr>
7236 <th>header
7237 </th>
7238 <th>second header
7239 </th></tr>
7240 <tr style="color:red;">
7241 <td>data</td>
7242 <td style="color:red;">second data
7243 </td></tr>
7244 <tr>
7245 <td style="color:red;">data with |</td>
7246 <td style="color:red;">second data with |
7247 </td></tr>
7248 <tr>
7249 <td>data with |</td>
7250 <td>second data with |
7251 </td></tr></table>
7252
7253 !! end
7254
7255 !! test
7256 Build table with wikilink
7257 !! wikitext
7258 {| class="wikitable"
7259 !header||second header
7260 |- style="color:red;"
7261 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
7262 |-
7263 |data||second data [[Main Page|link|text with pipe]]
7264 |}
7265 !! html
7266 <table class="wikitable">
7267 <tr>
7268 <th>header</th>
7269 <th>second header
7270 </th></tr>
7271 <tr style="color:red;">
7272 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
7273 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7274 </td></tr>
7275 <tr>
7276 <td>data</td>
7277 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7278 </td></tr></table>
7279
7280 !! end
7281
7282 # The expected HTML structure in this test is debatable. The PHP parser does
7283 # not parse this kind of table at all. The main focus for Parsoid is on
7284 # round-tripping, so this output is ok for now. TODO: revisit!
7285 !! test
7286 Wikitext table with html-syntax row
7287 !! wikitext
7288 {|
7289 |-
7290 <td>foo</td>
7291 |}
7292 !! html/parsoid
7293 <table>
7294 <tbody>
7295 <tr>
7296 <td>foo</td></tr></tbody></table>
7297 !! end
7298
7299 !! test
7300 Fostered content in tables: Plain text
7301 !! options
7302 parsoid=wt2html,html2html
7303 !! wikitext
7304 {|
7305 |-
7306 a
7307 |}
7308 !! html/php
7309 <table>
7310
7311 a
7312 </table>
7313
7314 !! html/php+tidy
7315
7316
7317 a
7318 <table></table>
7319 !! html/parsoid
7320 <span data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
7321 a
7322 </span><table>
7323 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr></tbody></table>
7324 !! end
7325
7326 !! test
7327 Fostered content in tables: Lists
7328 !! options
7329 parsoid=wt2html,html2html
7330 !! wikitext
7331 {|
7332 |-
7333 *a
7334 |}
7335 !! html/php
7336 <table>
7337
7338 <ul><li>a</li></ul>
7339 </table>
7340
7341 !! html/php+tidy
7342 <ul><li>a</li></ul><table>
7343
7344
7345 </table>
7346 !! html/parsoid
7347 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7348 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7349
7350 </tr></tbody></table>
7351 !! end
7352
7353 !! test
7354 Template generated table cell with attributes
7355 !! wikitext
7356 {|
7357 |-
7358 {{table_attribs_4}} ||a||b
7359 |}
7360 !! html/php+tidy
7361 <table>
7362
7363 <tbody><tr>
7364 <td style="background-color:#DC241f;" width="10px"></td>
7365 <td>a</td>
7366 <td>b
7367 </td></tr></tbody></table>
7368 !! html/parsoid
7369 <table>
7370 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7371 <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>
7372 !! end
7373
7374 !! test
7375 Parsoid: Round-trip tables directly followed by content (T53219)
7376 !! options
7377 parsoid=wt2html,wt2wt
7378 !! wikitext
7379 {|
7380 |foo
7381 |} bar
7382
7383 {|
7384 |baz
7385 |}<b>quux</b>
7386 !! html+tidy
7387 <table>
7388 <tbody><tr>
7389 <td>foo
7390 </td></tr></tbody></table><p> bar
7391 </p><table>
7392 <tbody><tr>
7393 <td>baz
7394 </td></tr></tbody></table><p><b>quux</b>
7395 </p>
7396 !! end
7397
7398 !! test
7399 Parsoid: Default to a newline after tables in new content (T53219)
7400 !! options
7401 parsoid=html2wt
7402 !! html/parsoid
7403 <table><tbody>
7404 <tr><td>foo</td></tr></tbody></table> bar
7405 <table><tbody>
7406 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7407 !! wikitext
7408 {|
7409 |foo
7410 |}
7411 <nowiki> </nowiki>bar
7412 {|
7413 |baz
7414 |}
7415 '''quux'''
7416 !! end
7417
7418 !! test
7419 Parsoid: Row-syntax table headings followed by comment & table cells
7420 !! options
7421 parsoid=wt2html,wt2wt
7422 !! wikitext
7423 {|
7424 !foo||bar
7425 <!-- foo --> ||baz||quux
7426 |}
7427 !! html/php
7428 <table>
7429 <tr>
7430 <th>foo</th>
7431 <th>bar
7432 </th>
7433 <td>baz</td>
7434 <td>quux
7435 </td></tr></table>
7436
7437 !! html/parsoid
7438 <table>
7439 <tbody><tr><th>foo</th><th>bar
7440 <!-- foo --></th><td> baz </td><td>quux</td></tr>
7441 </tbody></table>
7442 !! end
7443
7444 !!test
7445 Parsoid: Recover better from broken table attributes
7446 !!options
7447 parsoid=wt2html
7448 !!wikitext
7449 {| class="foo
7450 | class="bar" |
7451 foo
7452 |}
7453 !!html/php+tidy
7454 <table class="foo">
7455 <tbody><tr>
7456 <td class="bar">
7457 <p>foo
7458 </p>
7459 </td></tr></tbody></table>
7460 !!html/parsoid
7461 <table class="foo">
7462 <tr>
7463 <td class="bar">
7464 <p>foo</p></td></tr>
7465 </tbody></table>
7466 !!end
7467
7468 !! test
7469 Tables: Digest broken attributes on table and tr tag
7470 !! options
7471 parsoid=wt2html
7472 !! wikitext
7473 {| || |} ++
7474 |- || || ++ --
7475 |- > [
7476 |}
7477 !! html
7478 <table>
7479 <tbody>
7480 <tr class='mw-empty-elt'></tr>
7481 <tr class='mw-empty-elt'></tr>
7482 </tbody></table>
7483 !! end
7484
7485 !! test
7486 Table with missing opening <tr> tag
7487 !! options
7488 parsoid=wt2html,wt2wt
7489 !! wikitext
7490 <table>
7491 <td>foo</td>
7492 </tr>
7493 </table>
7494 !! html+tidy
7495 <table>
7496 <tbody><tr><td>foo</td>
7497 </tr>
7498 </tbody></table>
7499 !! end
7500
7501 # T137406: Whitespace in the HTML
7502 !! test
7503 1. Generate correct wikitext for tables with thead/tbody/tfoot
7504 !! options
7505 parsoid=html2wt
7506 !! html/parsoid
7507 <table>
7508 <caption>Test</caption>
7509 <thead>
7510 <tr>
7511 <th>Month</th>
7512 <th>Savings</th>
7513 </tr>
7514 </thead>
7515 <tbody>
7516 <tr>
7517 <td>January</td>
7518 <td>$100</td>
7519 </tr>
7520 <tr>
7521 <td>February</td>
7522 <td>$80</td>
7523 </tr>
7524 </tbody>
7525 <tfoot>
7526 <tr>
7527 <td>Sum</td>
7528 <td>$180</td>
7529 </tr>
7530 </tfoot>
7531 </table>
7532 !! wikitext
7533 {|
7534 |+Test
7535 !Month
7536 !Savings
7537 |-
7538 |January
7539 |$100
7540 |-
7541 |February
7542 |$80
7543 |-
7544 |Sum
7545 |$180
7546 |}
7547 !! html/php+tidy
7548 <table>
7549 <caption>Test
7550 </caption>
7551 <tbody><tr>
7552 <th>Month
7553 </th>
7554 <th>Savings
7555 </th></tr>
7556 <tr>
7557 <td>January
7558 </td>
7559 <td>$100
7560 </td></tr>
7561 <tr>
7562 <td>February
7563 </td>
7564 <td>$80
7565 </td></tr>
7566 <tr>
7567 <td>Sum
7568 </td>
7569 <td>$180
7570 </td></tr></tbody></table>
7571 !! end
7572
7573 # T137406: No whitespace in the HTML
7574 !! test
7575 2. Generate correct wikitext for tables with thead/tbody/tfoot
7576 !! options
7577 parsoid=html2wt
7578 !! html/parsoid
7579 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7580 !! wikitext
7581 {|
7582 !heading
7583 |-
7584 |foo
7585 |}
7586 !! end
7587
7588 !! test
7589 Wikitext tables can be nested inside HTML tables
7590 !! options
7591 parsoid=html2wt
7592 !! html
7593 <table data-parsoid='{"stx":"html"}'>
7594 <tr><td>
7595 <table>
7596 <tr><td>foo</td></tr>
7597 </table>
7598 </td></tr>
7599 </table>
7600 !! wikitext
7601 <table>
7602 <tr><td>
7603 {|
7604 |foo
7605 |}
7606 </td></tr>
7607 </table>
7608 !! end
7609
7610 ###
7611 ### Internal links
7612 ###
7613 !! test
7614 Plain link, capitalized
7615 !! wikitext
7616 [[Main Page]]
7617 !! html
7618 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7619 </p>
7620 !! end
7621
7622 !! test
7623 Plain link, uncapitalized
7624 !! wikitext
7625 [[main Page]]
7626 !! html
7627 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7628 </p>
7629 !! end
7630
7631 !! test
7632 Piped link
7633 !! wikitext
7634 [[Main Page|The Main Page]]
7635 !! html
7636 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7637 </p>
7638 !! end
7639
7640 !! test
7641 Piped link with comment in link text
7642 !! wikitext
7643 [[Main Page|The Main<!--front--> Page]]
7644 !! html
7645 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7646 </p>
7647 !! end
7648
7649 !! test
7650 Piped link with multiple pipe characters in link text
7651 !! wikitext
7652 [[Main Page||The|Main|Page|]]
7653 !! html/php
7654 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7655 </p>
7656 !! html/parsoid
7657 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7658 !! end
7659
7660 !! test
7661 Piped link with no link text
7662 !! wikitext
7663 [[Thomas Bek (bishop of St David's)|]]
7664 !! html/php
7665 <p>[[Thomas Bek (bishop of St David's)|]]
7666 </p>
7667 !! html/parsoid
7668 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7669 !! end
7670
7671 !! test
7672 Piped link with empty link text
7673 !! wikitext
7674 [[Main Page|<nowiki/>]] - empty nowiki
7675 [[Main Page| ]] - empty space
7676 [[Main Page|&nbsp;]] - empty non breaking space
7677 !! html/php
7678 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7679 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7680 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7681 </p>
7682 !! html/parsoid
7683 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7684 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7685 <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>
7686 !! end
7687
7688 !! test
7689 Broken link
7690 !! wikitext
7691 [[Zigzagzogzagzig]]
7692 !! html
7693 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7694 </p>
7695 !! end
7696
7697 !! test
7698 Broken link with fragment
7699 !! wikitext
7700 [[Zigzagzogzagzig#zug]]
7701 !! html
7702 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7703 </p>
7704 !! end
7705
7706 !! test
7707 Special page link with fragment
7708 !! wikitext
7709 [[Special:Version#anchor]]
7710 !! html
7711 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7712 </p>
7713 !! end
7714
7715 !! test
7716 Nonexistent special page link with fragment
7717 !! wikitext
7718 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7719 !! html
7720 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7721 </p>
7722 !! end
7723
7724 !! test
7725 Link with prefix
7726 !! wikitext
7727 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7728 !! html
7729 <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>
7730 </p>
7731 !! end
7732
7733 !! test
7734 Link with suffix
7735 !! wikitext
7736 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7737 !! html
7738 <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>!!!
7739 </p>
7740 !! end
7741
7742 !! article
7743 prefixed article
7744 !! text
7745 Some text
7746 !! endarticle
7747
7748 !! test
7749 T45661: Piped links with identical prefixes
7750 !! wikitext
7751 [[prefixed article|prefixed articles with spaces]]
7752
7753 [[prefixed article|prefixed articlesaoeu]]
7754
7755 [[Main Page|Main Page test]]
7756 !! html
7757 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7758 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7759 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7760 </p>
7761 !! end
7762
7763
7764 !! test
7765 Link with HTML entity in suffix / tail
7766 !! wikitext
7767 [[Main Page]]&quot;, [[Main Page]]&#97;
7768 !! html/php
7769 <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;
7770 </p>
7771 !! html/parsoid
7772 <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>
7773 !! end
7774
7775 !! test
7776 Link with 3 brackets
7777 !! wikitext
7778 [[[Main Page]]]
7779 Foo [[[Main Page]]]
7780 !! html
7781 <p>[[[Main Page]]]
7782 Foo [[[Main Page]]]
7783 </p>
7784 !! end
7785
7786 !! test
7787 Link with 4 brackets
7788 !! wikitext
7789 [[[[Main Page]]]]
7790 !! html
7791 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7792 </p>
7793 !! end
7794
7795 !! test
7796 Piped link with 3 brackets
7797 !! wikitext
7798 [[[main page|the main page]]]
7799 !! html
7800 <p>[[[main page|the main page]]]
7801 </p>
7802 !! end
7803
7804 !! test
7805 Piped link with extlink-like text
7806 !! wikitext
7807 [[Main Page|[bar]]]
7808 [[Main Page|This is a [bar]]]
7809 [[Main Page|[bar]]
7810 !! html/php
7811 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7812 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7813 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7814 </p>
7815 !! html/parsoid
7816 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7817 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7818 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7819 !! end
7820
7821 !! test
7822 Link with multiple pipes
7823 !! wikitext
7824 [[Main Page|The|Main|Page]]
7825 !! html
7826 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7827 </p>
7828 !! end
7829
7830 !! test
7831 Anchor containing a #. (T65430)
7832 !! config
7833 wgFragmentMode=[ 'html5', 'legacy' ]
7834 !! wikitext
7835 [[Main Page#And#Link]]
7836 !! html/php
7837 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7838 </p>
7839 !! html/parsoid
7840 <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>
7841 !! end
7842
7843 !! test
7844 Link to namespaces
7845 !! wikitext
7846 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7847 !! html
7848 <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>
7849 </p>
7850 !! end
7851
7852 !! test
7853 Link with space in namespace
7854 !! wikitext
7855 [[User talk:Foo bar]]
7856 !! html
7857 <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>
7858 </p>
7859 !! end
7860
7861 !! article
7862 MemoryAlpha:AlphaTest
7863 !! text
7864 This is an article in the MemoryAlpha namespace
7865 (which shadows the memoryalpha interwiki link).
7866 !! endarticle
7867
7868 !! test
7869 Namespace takes precedence over interwiki link (T53680)
7870 !! wikitext
7871 [[MemoryAlpha:AlphaTest]]
7872 !! html
7873 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7874 </p>
7875 !! end
7876
7877 # The previous test doesn't work correctly in html2*, due to not recognizing the
7878 # link as an internal one. This one checks for the correct behavior.
7879 !! test
7880 Link to namespace preferred over interwiki with correct rel attribute
7881 !! options
7882 parsoid=html2wt,html2html
7883 !! html/parsoid
7884 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7885 !! wikitext
7886 [[MemoryAlpha:AlphaTest]]
7887 !! end
7888
7889 !! test
7890 Piped link to namespace
7891 !! wikitext
7892 [[Meta:Disclaimers|The disclaimers]]
7893 !! html
7894 <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>
7895 </p>
7896 !! end
7897
7898 !! test
7899 Link containing }
7900 !! wikitext
7901 [[Usually caused by a typo (oops}]]
7902 !! html
7903 <p>[[Usually caused by a typo (oops}]]
7904 </p>
7905 !! end
7906
7907 !! article
7908 7% Solution
7909 !! text
7910 Just a test of an article title containing a percent.
7911 !! endarticle
7912
7913 !! test
7914 Link containing % (not as a hex sequence)
7915 !! wikitext
7916 [[7% Solution]]
7917 [[7% Solution|7%25 Solution]]
7918 !! html/php
7919 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7920 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7921 </p>
7922 !! html/parsoid
7923 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7924 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7925 !! end
7926
7927 # note that the parsoid HTML is identical to the previous test output,
7928 # so the previous test ensures that the html2wt mode will generate the
7929 # "not as a hex sequence" wikitext.
7930 !! test
7931 Link containing % as a single hex sequence interpreted to char
7932 !! options
7933 parsoid=wt2wt,wt2html,html2html
7934 !! wikitext
7935 [[7%25 Solution]]
7936 [[7%25 Solution|7%25 Solution]]
7937 !! html/php
7938 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7939 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7940 </p>
7941 !! html/parsoid
7942 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7943 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7944 !!end
7945
7946 !! test
7947 Link containing % as a double hex sequence interpreted to hex sequence
7948 !! wikitext
7949 [[7%2525 Solution]]
7950 !! html
7951 <p>[[7%2525 Solution]]
7952 </p>
7953 !!end
7954
7955 ## Example for such a section: == < ==
7956 !! test
7957 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7958 !! config
7959 wgFragmentMode=[ 'html5', 'legacy' ]
7960 !! wikitext
7961 [[%23%3c]][[%23%3e]]
7962 !! html/php
7963 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
7964 </p>
7965 !! html/parsoid
7966 <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>
7967 !! end
7968
7969 ## Example for such a section: == < ==
7970 !! test
7971 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
7972 !! config
7973 wgFragmentMode=[ 'legacy' ]
7974 !! wikitext
7975 [[%23%3c]][[%23%3e]]
7976 !! html/php
7977 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7978 </p>
7979 !! end
7980
7981 !! test
7982 Link containing "<#" and ">#" as a hex sequences
7983 !! wikitext
7984 [[%3c%23]][[%3e%23]]
7985 !! html
7986 <p>[[%3c%23]][[%3e%23]]
7987 </p>
7988 !! end
7989
7990 !! test
7991 Link containing an equals sign
7992 !! wikitext
7993 [[Special:BookSources/isbn=4-00-026157-6]]
7994 !! html/php
7995 <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>
7996 </p>
7997 !! html/parsoid
7998 <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>
7999 !! end
8000
8001 !! article
8002 Foo~bar
8003 !! text
8004 Just a test of an article title containing a tilde.
8005 !! endarticle
8006
8007 # note that links containing signatures, like [[Foo~~~~]], are
8008 # massaged by the pre-save transform (PST) and so the tildes are never
8009 # seen by the parser.
8010 !! test
8011 Link containing a tilde
8012 !! wikitext
8013 [[Foo~bar]]
8014 !! html/php
8015 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
8016 </p>
8017 !! html/parsoid
8018 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
8019 !! end
8020
8021 !! test
8022 Link containing double-single-quotes '' (T6598)
8023 !! wikitext
8024 [[Lista d''e paise d''o munno]]
8025 !! html/php
8026 <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>
8027 </p>
8028 !! html/parsoid
8029 <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>
8030 !! end
8031
8032 !! test
8033 Link containing double quotes and spaces
8034 !! wikitext
8035 [[Cool "Gator"]]
8036 !! html/php
8037 <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>
8038 </p>
8039 !! html/parsoid
8040 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
8041 !! end
8042
8043 !! test
8044 File containing double quotes and spaces
8045 !! wikitext
8046 [[File:Cool "Gator".png]]
8047 !! html/parsoid
8048 <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>
8049 !! end
8050
8051 !! test
8052 Redirect containing double quotes and spaces
8053 !! wikitext
8054 #REDIRECT [[Cool "Gator"]]
8055 !! html/parsoid
8056 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
8057 !! end
8058
8059 !! test
8060 Link containing double-single-quotes '' in text (T6598 sanity check)
8061 !! wikitext
8062 Some [[Link|pretty ''italics'' and stuff]]!
8063 !! html/php
8064 <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>!
8065 </p>
8066 !! html/parsoid
8067 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8068 !! end
8069
8070 !! test
8071 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8072 !! wikitext
8073 ''Some [[Link|pretty ''italics'' and stuff]]!''
8074 !! html
8075 <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>
8076 </p>
8077 !! end
8078
8079 !! test
8080 Link with double quotes in title part (literal) and alternate part (interpreted)
8081 !! wikitext
8082 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8083
8084 [[''Pentecoste'']]
8085
8086 [[''Pentecoste''|Pentecoste]]
8087
8088 [[''Pentecoste''|''Pentecoste'']]
8089 !! html/php
8090 <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>
8091 </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>
8092 </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>
8093 </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>
8094 </p>
8095 !! html/parsoid
8096 <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>
8097 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8098 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8099 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8100 !! end
8101
8102 !! test
8103 Broken image links with HTML captions (T41700)
8104 !! wikitext
8105 [[File:Nonexistent|<script></script>]]
8106 [[File:Nonexistent|100x100px|<script></script>]]
8107 [[File:Nonexistent|&lt;]]
8108 [[File:Nonexistent|a<i>b</i>c]]
8109 !! html/php
8110 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8111 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8112 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8113 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8114 </p>
8115 !! html/parsoid
8116 <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>
8117 <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>
8118 <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>
8119 <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>
8120 !! end
8121
8122 !! test
8123 Plain link to URL
8124 !! wikitext
8125 [[http://www.example.com]]
8126 !! html/php
8127 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8128 </p>
8129 !! html/parsoid
8130 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
8131 !! end
8132
8133 !! test
8134 Plain link to URL with link text
8135 !! wikitext
8136 [[http://www.example.com Link text]]
8137 !! html
8138 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8139 </p>
8140 !! end
8141
8142 !! test
8143 Plain link to protocol-relative URL
8144 !! wikitext
8145 [[//www.example.com]]
8146 !! html/php
8147 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8148 </p>
8149 !! html/parsoid
8150 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8151 !! end
8152
8153 !! test
8154 Plain link to protocol-relative URL with link text
8155 !! wikitext
8156 [[//www.example.com Link text]]
8157 !! html
8158 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8159 </p>
8160 !! end
8161
8162 !! test
8163 Plain link to page with question mark in title
8164 !! wikitext
8165 [[A?b]]
8166
8167 [[A?b|Baz]]
8168 !! html
8169 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8170 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8171 </p>
8172 !! end
8173
8174 # I'm fairly sure the expected result here is wrong.
8175 # We want these to be URL links, not pseudo-pages with URLs for titles....
8176 # However the current output is also pretty screwy.
8177 #
8178 # ----
8179 # I'm changing it to match the current output--it arguably makes more
8180 # sense in the light of the test above. Old expected result was:
8181 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8182 #</p>
8183 # But I think this test is bordering on "garbage in, garbage out" anyway.
8184 # -- wtm
8185 !! test
8186 Piped link to URL
8187 !! wikitext
8188 Piped link to URL: [[http://www.example.com|an example URL]]
8189 !! html/php
8190 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8191 </p>
8192 !! html/parsoid
8193 <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>
8194 !! end
8195
8196 !! test
8197 Plain link in template argument
8198 !! options
8199 parsoid=wt2html
8200 !! wikitext
8201 {{echo|[http://www.example.com |123]}}
8202
8203 {{echo|[[http://www.example.com |123]]}}
8204
8205 {{echo|[[http://www.example.com |123]}}
8206
8207 {{echo|[http://www.example.com |123]]}}
8208 !! html/php
8209 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8210 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8211 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8212 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8213 </p>
8214 !! html/parsoid
8215 <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>
8216
8217 <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>
8218
8219 <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>
8220
8221 <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>
8222 !! end
8223
8224 !! test
8225 T2002: [[page|http://url/]] should link to page, not http://url/
8226 !! wikitext
8227 [[Main Page|http://url/]]
8228 !! html/php
8229 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8230 </p>
8231 !! html/parsoid
8232 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8233 !! end
8234
8235 # Parsoid does not mark self-links, by design.
8236 !! test
8237 T2337: Escaped self-links should be bold
8238 !! options
8239 title=[[Bug462]]
8240 !! wikitext
8241 [[Bu&#103;462]] [[Bug462]]
8242 !! html/php+tidy
8243 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8244 </p>
8245 !! html/parsoid
8246 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8247 !! end
8248
8249 !! test
8250 Self-link to section should not be bold
8251 !! options
8252 title=[[Main Page]]
8253 !! wikitext
8254 [[Main Page#section]]
8255 !! html
8256 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8257 </p>
8258 !! end
8259
8260 !! article
8261 00
8262 !! text
8263 This is 00.
8264 !! endarticle
8265
8266 !!test
8267 Self-link to numeric title
8268 !!options
8269 title=[[0]]
8270 !! wikitext
8271 [[0]]
8272 !! html
8273 <p><a class="mw-selflink selflink">0</a>
8274 </p>
8275 !!end
8276
8277 !!test
8278 Link to numeric-equivalent title
8279 !!options
8280 title=[[0]]
8281 !! wikitext
8282 [[00]]
8283 !! html
8284 <p><a href="/wiki/00" title="00">00</a>
8285 </p>
8286 !!end
8287
8288 !! test
8289 <nowiki> inside a link
8290 !! wikitext
8291 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8292 !! html
8293 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8294 </p>
8295 !! end
8296
8297 !! test
8298 Non-breaking spaces in title
8299 !! wikitext
8300 [[&nbsp; Main &nbsp; Page &nbsp;]]
8301 !! html
8302 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8303 </p>
8304 !!end
8305
8306 # Add new article for the test below so that it doesn't red-link
8307 !! article
8308 Foo bar baz
8309 !! text
8310 boo
8311 !! endarticle
8312
8313 !! test
8314 Multiple spaces in titles should normalize to a single underscore
8315 !! options
8316 parsoid=wt2html,wt2wt
8317 !! wikitext
8318 [[Foo bar baz|x]]
8319 [[Foo bar baz|x]]
8320 [[Foo bar baz|x]]
8321 !! html/php
8322 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8323 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8324 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8325 </p>
8326 !! html/parsoid
8327 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8328 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8329 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8330 </p>
8331 !! end
8332
8333 !! test
8334 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8335 !! options
8336 language=ca
8337 !! wikitext
8338 '''[[Main Page]]'''
8339 !! html
8340 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8341 </p>
8342 !! end
8343
8344 !! test
8345 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8346 !! options
8347 language=ca
8348 !! wikitext
8349 ''[[Main Page]]''
8350 !! html
8351 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8352 </p>
8353 !! end
8354
8355 !! test
8356 Internal link with en linktrail: no apostrophes (T29473)
8357 !! options
8358 language=en
8359 !! wikitext
8360 [[Something]]'nice
8361 !! html
8362 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8363 </p>
8364 !! end
8365
8366 !! test
8367 Internal link with ca linktrail with apostrophes (T29473)
8368 !! options
8369 language=ca
8370 !! wikitext
8371 [[Something]]'nice
8372 !! html
8373 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8374 </p>
8375 !! end
8376
8377 !! test
8378 Internal link with kaa linktrail with apostrophes (T29473)
8379 !! options
8380 language=kaa
8381 !! wikitext
8382 [[Something]]'nice
8383 !! html
8384 <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>
8385 </p>
8386 !! end
8387
8388 !! test
8389 Link with multiple ":" in a subpage-supporting namespace (T65636)
8390 !! wikitext
8391 [[User:Foo/Test/63636:Bar|Test]]
8392 !! html/php
8393 <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>
8394 </p>
8395 !! html/parsoid
8396 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8397 !! end
8398
8399 ## Mainly a sanity check for Parsoid
8400 !! test
8401 Handle title parsing for subpages
8402 !! options
8403 title=[[/123123]]
8404 subpage
8405 !! wikitext
8406 123
8407 !! html/php
8408 <p>123
8409 </p>
8410 !! html/parsoid
8411 <p>123</p>
8412 !! end
8413
8414 !! article
8415 User:Test/123
8416 !! text
8417 test 123
8418 !! endarticle
8419
8420 !! test
8421 Link to a subpage from a namespace other than main
8422 !! options
8423 title=[[User:Test]]
8424 subpage
8425 !! wikitext
8426 [[/123]]
8427 !! html/php
8428 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8429 </p>
8430 !! html/parsoid
8431 <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>
8432 !! end
8433
8434 !! test
8435 Ensure that transclusion titles are not url-decoded
8436 !! options
8437 subpage title=[[Test]]
8438 parsoid=wt2html
8439 !! wikitext
8440 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8441 !! html/php
8442 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8443 </p>
8444 !! html/parsoid
8445 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8446 !! end
8447
8448 !! test
8449 Purely hash wikilink
8450 !! options
8451 title=[[User:Test/123]]
8452 subpage
8453 !! wikitext
8454 [[#a|b]]
8455 !! html/php
8456 <p><a href="#a">b</a>
8457 </p>
8458 !! html/parsoid
8459 <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>
8460 !! end
8461
8462 !! test
8463 Serialization of purely hash wikilink
8464 !! options
8465 title=[[User:Test/123]]
8466 subpage
8467 parsoid=html2wt
8468 !! html/parsoid
8469 <p><a href="#a">[[</a></p>
8470 !! wikitext
8471 [[#a|<nowiki>[[</nowiki>]]
8472 !! html/php
8473 <p><a href="#a">[[</a>
8474 </p>
8475 !! end
8476
8477 !! test
8478 1. Interaction of linktrail and template encapsulation
8479 !! wikitext
8480 {{echo|[[Foo]]}}l
8481 !! html/parsoid
8482 <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>
8483 !! end
8484
8485 !! test
8486 2. Interaction of linktrail and template encapsulation
8487 !! options
8488 parsoid
8489 !! wikitext
8490 {{echo|Some [[Fool]]}}s
8491 !! html
8492 <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>
8493 !! end
8494
8495 !! test
8496 3. Interaction of linktrail and template encapsulation
8497 !! options
8498 parsoid
8499 !! wikitext
8500 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8501 !! html
8502 <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>
8503 !! end
8504
8505 !! article
8506 Söfnuður
8507 !! text
8508 Test.
8509 !! endarticle
8510
8511 !! test
8512 Internal link with is link prefix
8513 !! options
8514 language=is
8515 !! wikitext
8516 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8517 !! html
8518 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8519 </p>
8520 !! end
8521
8522 !! article
8523 Mótmælendatrú
8524 !! text
8525 Test.
8526 !! endarticle
8527
8528 !! test
8529 Internal link with is link trail and link prefix
8530 !! options
8531 language=is
8532 !! wikitext
8533 [[mótmælendatrú|xxx]]ar
8534 [[mótmælendatrú]]ar
8535 mótmælenda[[söfnuður]]
8536 mótmælenda[[söfnuður|söfnuðir]]
8537 mótmælenda[[söfnuður|söfnuðir]]xxx
8538 !! html
8539 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8540 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8541 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8542 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8543 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8544 </p>
8545 !! end
8546
8547 !! test
8548 Parsoid link trail escaping
8549 !! options
8550 parsoid=html2wt,html2html
8551 !! html/parsoid
8552 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8553 !! wikitext
8554 [[apple]]<nowiki/>s
8555 !! end
8556
8557 !! test
8558 Parsoid link prefix escaping
8559 !! options
8560 language=is
8561 parsoid=html2wt,html2html
8562 !! html/parsoid
8563 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8564 !! wikitext
8565 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8566 !! end
8567
8568 !! test
8569 Parsoid link bracket escaping
8570 !! options
8571 parsoid=html2wt,html2html
8572 !! html/parsoid
8573 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8574 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8575 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8576 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8577 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8578 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8579 !! wikitext
8580 [[Test]]
8581
8582 [<nowiki/>[[Test]]]
8583
8584 [[[[Test]]]]
8585
8586 [[[<nowiki/>[[Test]]]]]
8587
8588 [[[[[[Test]]]]]]
8589
8590 [[[[[<nowiki/>[[Test]]]]]]]
8591 !! end
8592
8593 !! test
8594 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8595 !! wikitext
8596 [[Foo| bar]]
8597
8598 [[Foo| ''bar'']]
8599
8600 [http://wp.org foo]
8601
8602 [http://wp.org ''foo'']
8603 !! html
8604 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8605 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8606 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8607 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8608 </p>
8609 !! end
8610
8611 !! test
8612 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8613 !! wikitext
8614 [[Foo|{{echo|a}} b {{echo|c}}]]
8615 !! html/parsoid
8616 <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>
8617 !! end
8618
8619 !! test
8620 Link with angle bracket after anchor
8621 !! config
8622 wgFragmentMode=[ 'html5', 'legacy' ]
8623 !! wikitext
8624 [[Foo#<bar>]]
8625 !! html/php
8626 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8627 </p>
8628 !! html/parsoid
8629 <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>
8630 !! end
8631
8632 !! test
8633 Link with angle bracket after anchor (legacy)
8634 !! config
8635 wgFragmentMode=[ 'legacy' ]
8636 !! wikitext
8637 [[Foo#<bar>]]
8638 !! html/php
8639 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8640 </p>
8641 !! end
8642
8643 ###
8644 ### Interwiki links (see maintenance/interwiki.sql)
8645 ###
8646
8647 !! test
8648 Inline interwiki link
8649 !! options
8650 parsoid=wt2html,wt2wt,html2html
8651 !! wikitext
8652 [[MeatBall:SoftSecurity]]
8653 !! html/php
8654 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8655 </p>
8656 !! html/parsoid
8657 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8658 !! end
8659
8660 !! test
8661 Inline interwiki link with empty title (T4372)
8662 !! options
8663 parsoid=wt2html,wt2wt,html2html
8664 !! wikitext
8665 [[MeatBall:]]
8666 !! html/php
8667 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8668 </p>
8669 !! html/parsoid
8670 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8671 !! end
8672
8673 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8674 !! test
8675 Interwiki link encoding conversion (T3636)
8676 !! options
8677 parsoid=wt2html,wt2wt
8678 !! wikitext
8679 *[[Wikipedia:ro:Olteni&#0355;a]]
8680 *[[Wikipedia:ro:Olteni&#355;a]]
8681 !! html
8682 <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>
8683 <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>
8684
8685 !! html/php+tidy
8686 <ul>
8687 <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>
8688 <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>
8689 </ul>
8690 !! html/parsoid
8691 <ul>
8692 <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>
8693 <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>
8694 </ul>
8695 !! end
8696
8697 !! test
8698 Interwiki link with fragment (T4130)
8699 !! wikitext
8700 [[MeatBall:SoftSecurity#foo]]
8701 !! html
8702 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8703 </p>
8704 !! end
8705
8706 !! test
8707 Link scenarios with escaped fragments
8708 !! config
8709 wgFragmentMode=[ 'html5', 'legacy' ]
8710 !! wikitext
8711 [[#Is this great?]]
8712 [[Foo#Is this great?]]
8713 [[meatball:Foo#Is this great?]]
8714 !! html/php
8715 <p><a href="#Is_this_great?">#Is this great?</a>
8716 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8717 <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>
8718 </p>
8719 !! html/parsoid
8720 <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>
8721 <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>
8722 <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>
8723 !! end
8724
8725 !! test
8726 Link scenarios with escaped fragments (legacy)
8727 !! config
8728 wgFragmentMode=[ 'legacy' ]
8729 !! wikitext
8730 [[#Is this great?]]
8731 [[Foo#Is this great?]]
8732 [[meatball:Foo#Is this great?]]
8733 !! html/php
8734 <p><a href="#Is_this_great.3F">#Is this great?</a>
8735 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8736 <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>
8737 </p>
8738 !! end
8739
8740 # Ideally the wikipedia: prefix here should be proto-relative too
8741 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8742 # define the 'en' prefix, and originally the test used 'wikipedia',
8743 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8744 # article.
8745 !! test
8746 Different interwiki prefixes mapping to the same URL
8747 !! wikitext
8748 [[:en:Foo]]
8749
8750 [[:en:Foo|Foo]]
8751
8752 [[wikipedia:Foo]]
8753
8754 [[:wikipedia:Foo|Foo]]
8755
8756 [[wikipedia:en:Foo]]
8757
8758 [[:wikipedia:en:Foo]]
8759
8760 [[ wikiPEdia :Foo]]
8761 !! html/parsoid
8762 <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>
8763
8764 <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>
8765
8766 <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>
8767
8768 <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>
8769
8770 <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>
8771
8772 <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>
8773
8774 <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>
8775 !! end
8776
8777 !! test
8778 Interwiki links that cannot be represented in wiki syntax
8779 !! wikitext
8780 [[meatball:ok]]
8781 [[meatball:ok#foo|ok with fragment]]
8782 [[meatball:ok_as_well?|ok ending with ? mark]]
8783 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8784 [http://de.wikipedia.org/wiki/#foo is just fragment]
8785
8786 !! html/php
8787 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8788 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8789 <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>
8790 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8791 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8792 </p>
8793 !! html/parsoid
8794 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8795 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8796 <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>
8797 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8798 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8799 !! end
8800
8801 !! test
8802 Interwiki links: trail
8803 !! wikitext
8804 [[wikipedia:Foo|Ba]]r
8805 !! html/php
8806 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8807 </p>
8808 !! html/parsoid
8809 <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>
8810 !! end
8811
8812 !! test
8813 Local interwiki link
8814 !! options
8815 parsoid=wt2html,wt2wt,html2html
8816 !! wikitext
8817 [[local:Template:Foo]]
8818 !! html/php
8819 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8820 </p>
8821 !! html/parsoid
8822 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8823 !! end
8824
8825 # Parsoid does not mark self-links, by design.
8826 !! test
8827 Local interwiki link: self-link to current page
8828 !! options
8829 title=[[Main Page]]
8830 parsoid=wt2html,wt2wt,html2html
8831 !! wikitext
8832 [[local:Main Page]]
8833 !! html/php
8834 <p><a class="mw-selflink selflink">local:Main Page</a>
8835 </p>
8836 !! html/parsoid
8837 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8838 !! end
8839
8840 !! test
8841 Local interwiki link: prefix only (T66167)
8842 !! options
8843 parsoid=wt2html,wt2wt,html2html
8844 !! wikitext
8845 [[local:]]
8846 !! html/php
8847 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8848 </p>
8849 !! html/parsoid
8850 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8851 !! end
8852
8853 !! test
8854 Local interwiki link: with additional interwiki prefix (T63357)
8855 !! options
8856 parsoid=wt2html,wt2wt,html2html
8857 !! wikitext
8858 [[local:meatball:Hello]]
8859 !! html/php
8860 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8861 </p>
8862 !! html/parsoid
8863 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8864 !! end
8865
8866 !! test
8867 Multiple local interwiki link prefixes
8868 !! wikitext
8869 [[local:local:local:local:mi:local:Foo]]
8870 !! options
8871 parsoid=wt2html,wt2wt,html2html
8872 !! html/php
8873 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8874 </p>
8875 !! html/parsoid
8876 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8877 !! end
8878
8879 ###
8880 ### Interlanguage links
8881 ### Language links (so that searching for '### language' matches..)
8882 ###
8883
8884 !! test
8885 Interlanguage link
8886 !! wikitext
8887 Blah blah blah
8888 [[zh:Chinese]]
8889 !! html/php
8890 <p>Blah blah blah
8891 </p>
8892 !! html/parsoid
8893 <p>Blah blah blah</p>
8894 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8895 !! end
8896
8897 ## parsoid html2wt will lose the space variations
8898 !! test
8899 Interlanguage link with spacing
8900 !! options
8901 parsoid=wt2html,wt2wt,html2html
8902 !! wikitext
8903 Blah blah blah
8904 [[ zh : Chinese ]]
8905 !! html/php
8906 <p>Blah blah blah
8907 </p>
8908 !! html/parsoid
8909 <p>Blah blah blah</p>
8910 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8911 !! end
8912
8913 !! test
8914 Double interlanguage link
8915 !! wikitext
8916 Blah blah blah
8917 [[es:Spanish]]
8918 [[zh:Chinese]]
8919 !! html/php
8920 <p>Blah blah blah
8921 </p>
8922 !! html/parsoid
8923 <p>Blah blah blah</p>
8924 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8925 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8926 !! end
8927
8928 ## parsoid html2wt will lose the space variations
8929 !! test
8930 Interlanguage link variations
8931 !! options
8932 parsoid=wt2html,wt2wt,html2html
8933 !! wikitext
8934 Blah blah blah
8935 [[ es :Spanish]]
8936 [[ ZH :Chinese]]
8937 [[es:Foo_bar]]
8938 !! html/php
8939 <p>Blah blah blah
8940 </p>
8941 !! html/parsoid
8942 <p>Blah blah blah</p>
8943 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8944 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8945 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8946 !! end
8947
8948 !! test
8949 Escaping of interlanguage links (T129218, T156308)
8950 !! wikitext
8951 Blah blah blah
8952 [[:es:Spanish]]
8953 [[ : zh : Chinese ]]
8954 !! html/php
8955 <p>Blah blah blah
8956 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8957 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8958 </p>
8959 !! html/parsoid
8960 <p>Blah blah blah
8961 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8962 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8963 !! end
8964
8965 !! test
8966 Multiple colons escaping interlanguage links
8967 !! options
8968 parsoid=wt2html
8969 !! wikitext
8970 [[:es:Spanish]]
8971 [[::es:Spanish]]
8972 [[:::es:Spanish]]
8973 !! html/php
8974 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8975 [[::es:Spanish]]
8976 [[:::es:Spanish]]
8977 </p>
8978 !! html/parsoid
8979 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8980 [[::es:Spanish]]
8981 [[:::es:Spanish]]</p>
8982 !! end
8983
8984 ## parsoid html2wt will normalize the space to _
8985 !! test
8986 Space and question mark encoding in interlanguage links (T95473)
8987 !! options
8988 parsoid=wt2html,wt2wt,html2html
8989 !! wikitext
8990 Blah blah blah
8991 [[es:Foo bar?]]
8992 !! html/php
8993 <p>Blah blah blah
8994 </p>
8995 !! html/parsoid
8996 <p>Blah blah blah</p>
8997 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8998 !! end
8999
9000 !! test
9001 Interlanguage link, with prefix links
9002 !! options
9003 language=ln
9004 !! wikitext
9005 Blah blah blah
9006 [[zh:Chinese]]
9007 !! html/php
9008 <p>Blah blah blah
9009 </p>
9010 !! html/parsoid
9011 <p>Blah blah blah</p>
9012 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9013 !! end
9014
9015 !! test
9016 Double interlanguage link, with prefix links (T10897)
9017 !! options
9018 language=ln
9019 !! wikitext
9020 Blah blah blah
9021 [[es:Spanish]]
9022 [[zh:Chinese]]
9023 !! html/php
9024 <p>Blah blah blah
9025 </p>
9026 !! html/parsoid
9027 <p>Blah blah blah</p>
9028 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9029 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9030 !! end
9031
9032 !! test
9033 "Extra" interlanguage links (T34189 / gerrit 111390)
9034 !! wikitext
9035 Blah blah blah
9036 [[mul:Article]]
9037 !! html/php
9038 <p>Blah blah blah
9039 </p>
9040 !! html/parsoid
9041 <p>Blah blah blah</p>
9042 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
9043 !! end
9044
9045 ## PHP parser tests script needs an update
9046 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9047 !! test
9048 Language links render as inline links if $wgInterwikiMagic=false
9049 !! options
9050 wgInterwikiMagic=false
9051 parsoid=wt2html,wt2wt,html2html
9052 !! wikitext
9053 Blah blah blah
9054 [[zh:Chinese]]
9055 !! html/parsoid
9056 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9057 !! end
9058
9059 ## PHP parser tests script needs an update
9060 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9061 !! test
9062 Language links render as inline links in the Talk namespace
9063 !! options
9064 title=Talk:Foo
9065 parsoid=wt2html,wt2wt,html2html
9066 !! wikitext
9067 Blah blah blah
9068 [[zh:Chinese]]
9069 !! html/parsoid
9070 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9071 !! end
9072
9073 !! test
9074 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
9075 !! options
9076 language=ln
9077 !! wikitext
9078 [[WW&nbsp;II]]
9079 !! html
9080 <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>
9081 </p>
9082 !! end
9083
9084 !! test
9085 Parsoid T55221: Wikilinks should be properly entity-escaped
9086 !! options
9087 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
9088 !! html/parsoid
9089 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9090 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9091 !! wikitext
9092 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
9093
9094 He&amp;nbsp;llo He&amp;nbsp;llo
9095 !! html/php
9096 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
9097 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
9098 </p>
9099 !! end
9100
9101 # html2wt will fail because of title normalization without data-parsoid
9102 !! test
9103 Parsoid: handle constructor well
9104 !! options
9105 parsoid=wt2html,wt2wt
9106 !! wikitext
9107 [[constructor]]
9108
9109 [[constructor:foo]]
9110 !! html/php
9111 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9112 </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>
9113 </p>
9114 !! html/parsoid
9115 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9116
9117 <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>
9118 !! end
9119
9120 !! test
9121 Template parameter named "constructor"
9122 !! wikitext
9123 {{echo| constructor = |hi}}
9124 !! html/parsoid
9125 <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>
9126 !! end
9127
9128 !! article
9129 ko:
9130 !! text
9131 Test.
9132 !! endarticle
9133
9134 # Note that `ko` isn't a known interlanguage prefix
9135 !! test
9136 Parsoid: recognize interlanguage links without a target page
9137 !! options
9138 ill
9139 !! wikitext
9140 [[es:]]
9141
9142 [[ko:]]
9143 !! html/php
9144 es:
9145 !! html/parsoid
9146 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9147
9148 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9149 !! end
9150
9151 # Note that `ko` isn't a known interwiki prefix
9152 !! test
9153 Parsoid: recognize interwiki links without a target page
9154 !! options
9155 parsoid=wt2html,wt2wt,html2html
9156 !! wikitext
9157 [[:es:]]
9158
9159 [[:ko:]]
9160 !! html/php
9161 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9162 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9163 </p>
9164 !! html/parsoid
9165 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9166 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9167 !! end
9168
9169 !! test
9170 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9171 !! wikitext
9172 [[mi:Foo]]
9173 !! html/php
9174 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9175 </p>
9176 !! html/parsoid
9177 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9178 !! end
9179
9180 !! test
9181 Interlanguage link with preceding local interwiki link (T70085)
9182 !! options
9183 parsoid=wt2html,wt2wt,html2html
9184 !! wikitext
9185 Blah blah blah
9186 [[local:es:Spanish]]
9187 !! html/php
9188 <p>Blah blah blah
9189 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9190 </p>
9191 !! html/parsoid
9192 <p>Blah blah blah
9193 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9194 !! end
9195
9196 !! test
9197 Looks like an interlanguage link, but is actually a local interwiki
9198 !! options
9199 parsoid=wt2html,wt2wt,html2html
9200 !! wikitext
9201 Blah blah blah
9202 [[mi:Template:Foo]]
9203 !! html/php
9204 <p>Blah blah blah
9205 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9206 </p>
9207 !! html/parsoid
9208 <p>Blah blah blah
9209 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9210 !! end
9211
9212 ###
9213 ### Redirects, Parsoid-only
9214 ###
9215
9216 !! test
9217 1. Simple redirect to page
9218 !! wikitext
9219 #REDIRECT [[Main Page]]
9220 !! html/parsoid
9221 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9222 !! end
9223
9224 !! test
9225 2. Other redirect variants
9226 !! wikitext
9227 #REDIRECT [[Main_Page]]
9228 !! html/parsoid
9229 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9230 !! end
9231
9232 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9233 # This tests the Parsoid bail-out code.
9234 !! test
9235 3. Other redirect variants
9236 !! options
9237 parsoid=wt2html
9238 !! wikitext
9239 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9240 !! html/parsoid
9241 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9242 !! end
9243
9244 !! test
9245 4. Redirect to a templated destination
9246 !! wikitext
9247 #REDIRECT [[{{echo|Foo}}bar]]
9248 !! html/parsoid
9249 <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"}]]}'/>
9250 !! end
9251
9252 !! test
9253 Empty redirect
9254 !! options
9255 parsoid=wt2html,wt2wt
9256 !! wikitext
9257 #REDIRECT [[]]
9258 !! html/parsoid
9259 <ol>
9260 <li>REDIRECT [[]]</li></ol>
9261 !! end
9262
9263 !! test
9264 Optional colon in #REDIRECT
9265 !! options
9266 # the colon is archaic syntax. we support it for wt2html, but we
9267 # don't care that it roundtrips back to the modern syntax.
9268 parsoid=wt2html,html2html
9269 !! wikitext
9270 #REDIRECT:[[Main Page]]
9271 !! html/parsoid
9272 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9273 !! end
9274
9275 !! test
9276 Whitespace in #REDIRECT with optional colon
9277 !! options
9278 # the colon and gratuitous whitespace is archaic syntax. we support
9279 # it for wt2html, but we don't care that it roundtrips back to the
9280 # modern syntax (without extra whitespace)
9281 parsoid=wt2html,html2html
9282 !! wikitext
9283
9284 #REDIRECT
9285 :
9286 [[Main Page]]
9287 !! html/parsoid
9288 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9289 !! end
9290
9291 !! test
9292 Piped link in #REDIRECT
9293 !! options
9294 # content after piped link is ignored. we support this syntax,
9295 # but don't care that the piped link is lost when we roundtrip this.
9296 parsoid=wt2html
9297 !! wikitext
9298 #REDIRECT [[Main Page|bar]]
9299 !! html/parsoid
9300 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9301 !! end
9302
9303 !! test
9304 Redirect to category (T104502)
9305 !! options
9306 parsoid=wt2html,wt2wt
9307 !! wikitext
9308 #REDIRECT [[Category:Foo]]
9309 !! html/parsoid
9310 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9311 !! end
9312
9313 !! test
9314 Redirect to category with URL encoding (T104502)
9315 !! options
9316 parsoid=wt2html
9317 !! wikitext
9318 #REDIRECT [[Category%3AFoo]]
9319 !! html/parsoid
9320 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9321 !! end
9322
9323 !! test
9324 Redirect to category page
9325 !! wikitext
9326 #REDIRECT [[:Category:Foo]]
9327 !! html/parsoid
9328 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9329 !! end
9330
9331 !! test
9332 Redirect to image page (1)
9333 !! wikitext
9334 #REDIRECT [[File:Wiki.png]]
9335 !! html/parsoid
9336 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9337 !! end
9338
9339 !! test
9340 Redirect to image page (2)
9341 !! wikitext
9342 #REDIRECT [[Image:Wiki.png]]
9343 !! html/parsoid
9344 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9345 !! end
9346
9347 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9348 # Next test confirms this.
9349 !! test
9350 Redirect to language (1) (T104918)
9351 !! options
9352 parsoid=wt2html,wt2wt,html2html
9353 !! wikitext
9354 #REDIRECT [[en:File:Wiki.png]]
9355 !! html/parsoid
9356 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9357 !! end
9358
9359 !! test
9360 Redirect to language (2) (T104918)
9361 !! wikitext
9362 #REDIRECT [[:en:File:Wiki.png]]
9363 !! html/parsoid
9364 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9365 !! end
9366
9367 !! test
9368 Redirect to interwiki (T104918)
9369 !! wikitext
9370 #REDIRECT [[meatball:File:Wiki.png]]
9371 !! html/parsoid
9372 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9373 !! end
9374
9375 !! test
9376 Non-English #REDIRECT
9377 !! options
9378 language=is
9379 !! wikitext
9380 #TILVÍSUN [[Main Page]]
9381 !! html/parsoid
9382 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9383 !! end
9384
9385 !! test
9386 Redirect syntax under text isn't considered a redirect
9387 !! wikitext
9388 some text
9389
9390 #redirect [[Main Page]]
9391 !! html/parsoid
9392 <p>some text</p>
9393 <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>
9394 !! end
9395
9396 !! test
9397 New redirect
9398 !! options
9399 parsoid=html2wt
9400 !! html/parsoid
9401 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9402 !! wikitext
9403 #REDIRECT [[Foo]]
9404 Foo
9405 !! end
9406
9407 !! test
9408 Redirect followed by block on the same line
9409 !! options
9410 parsoid=wt2html
9411 !! wikitext
9412 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9413 !! html/parsoid
9414 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9415 !! end
9416
9417 !! test
9418 Redirect followed by a newline
9419 !! wikitext
9420 #REDIRECT [[Main Page]]
9421 A newline
9422 !! html/parsoid
9423 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9424 <p>A newline</p>
9425 !! end
9426
9427 !! test
9428 Redirect followed by multiple newlines
9429 !! wikitext
9430 #REDIRECT [[Main Page]]
9431
9432
9433 A newline
9434 !! html/parsoid
9435 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9436
9437 <p><br/>
9438 A newline</p>
9439 !! end
9440
9441 !! test
9442 Drop duplicate redirects
9443 !! options
9444 parsoid=html2wt
9445 !! html/parsoid
9446 <link rel="mw:PageProp/redirect" href="./Foo"/>
9447 <link rel="mw:PageProp/redirect" href="./Bar"/>
9448 <link rel="mw:PageProp/redirect" href="./Baz"/>
9449 !! wikitext
9450 #REDIRECT [[Foo]]
9451 !! end
9452
9453 ##
9454 ## XHTML tidiness
9455 ###
9456
9457 !! test
9458 <br> to <br />
9459 !! wikitext
9460 1<br>2<br />3
9461 !! html
9462 <p>1<br />2<br />3
9463 </p>
9464 !! end
9465
9466 !! test
9467 Broken br tag sanitization
9468 !! wikitext
9469 </br>
9470 !! html/php
9471 <p>&lt;/br&gt;
9472 </p>
9473 !! end
9474
9475 # TODO: Fix html2html mode (T53055)!
9476 !! test
9477 Parsoid: Broken br tag recognition
9478 !! options
9479 parsoid=wt2html
9480 !! wikitext
9481 </br>
9482
9483 <br/ >
9484 !! html+tidy
9485 <p><br />
9486 </p><p><br />
9487 </p>
9488 !! end
9489
9490 !! test
9491 Incorrecly removing closing slashes from correctly formed XHTML
9492 !! wikitext
9493 <br style="clear:both;" />
9494 !! html
9495 <p><br style="clear:both;" />
9496 </p>
9497 !! end
9498
9499 !! test
9500 Failing to transform badly formed HTML into correct XHTML
9501 !! wikitext
9502 <br style="clear: left;">
9503 <br style="clear: right;">
9504 <br style="clear: both;">
9505 !! html
9506 <p><br style="clear: left;" />
9507 <br style="clear: right;" />
9508 <br style="clear: both;" />
9509 </p>
9510 !!end
9511
9512 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9513 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9514 !! test
9515 Handling html with a div self-closing tag
9516 !! wikitext
9517 <div title />
9518 <div title/>
9519 <div title/ >
9520 <div title=bar />
9521 <div title=bar/>
9522 <div title=bar/ >
9523 !! html/php
9524 <p>&lt;div title /&gt;
9525 &lt;div title/&gt;
9526 </p>
9527 <div>
9528 <p>&lt;div title=bar /&gt;
9529 &lt;div title=bar/&gt;
9530 </p>
9531 <div title="bar/"></div>
9532 </div>
9533
9534 !! html/parsoid
9535 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9536 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9537 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9538 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9539 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9540 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9541 !! end
9542
9543 !! test
9544 Handling html with a br self-closing tag
9545 !! wikitext
9546 <br title />
9547 <br title/>
9548 <br title/ >
9549 <br title=bar />
9550 <br title=bar/>
9551 <br title=bar/ >
9552 !! html/php
9553 <p><br title="" />
9554 <br title="" />
9555 <br />
9556 <br title="bar" />
9557 <br title="bar" />
9558 <br title="bar/" />
9559 </p>
9560 !! html/parsoid
9561 <p><br title="" />
9562 <br title="" />
9563 <br title="" />
9564 <br title="bar" />
9565 <br title="bar" />
9566 <br title="bar/" />
9567 </p>
9568 !! end
9569
9570 !! test
9571 Horizontal ruler (should it add that extra space?)
9572 !! wikitext
9573 <hr>
9574 <hr >
9575 foo <hr
9576 > bar
9577 !! html+tidy
9578 <hr />
9579 <hr /><p>
9580 foo </p><hr /><p> bar
9581 </p>
9582 !! end
9583
9584 !! test
9585 Horizontal ruler -- 4+ dashes render hr
9586 !! wikitext
9587 ----
9588 !! html
9589 <hr />
9590
9591 !! end
9592
9593 !! test
9594 Horizontal ruler -- eats additional dashes on the same line
9595 !! wikitext
9596 ---------
9597 !! html
9598 <hr />
9599
9600 !! end
9601
9602 !! test
9603 Horizontal ruler -- does not collapse dashes on consecutive lines
9604 !! wikitext
9605 ----
9606 ----
9607 !! html
9608 <hr />
9609 <hr />
9610
9611 !! end
9612
9613 !! test
9614 Horizontal ruler -- <4 dashes render as plain text
9615 !! wikitext
9616 ---
9617 !! html
9618 <p>---
9619 </p>
9620 !! end
9621
9622 !! test
9623 Horizontal ruler -- Supports content following dashes on same line
9624 !! wikitext
9625 ---- Foo
9626 !! html
9627 <hr /> Foo
9628
9629 !! html+tidy
9630 <hr /><p> Foo
9631 </p>
9632 !! end
9633
9634 ###
9635 ### Block-level elements
9636 ###
9637 !! test
9638 Common list
9639 !! wikitext
9640 *Common list
9641 *item 2
9642 *item 3
9643 !! html
9644 <ul><li>Common list</li>
9645 <li>item 2</li>
9646 <li>item 3</li></ul>
9647
9648 !! end
9649
9650 !! test
9651 Numbered list
9652 !! wikitext
9653 #Numbered list
9654 #item 2
9655 #item 3
9656 !! html
9657 <ol><li>Numbered list</li>
9658 <li>item 2</li>
9659 <li>item 3</li></ol>
9660
9661 !! end
9662
9663 # the switch from level 3 to ordered should not introduce a newline between
9664 !! test
9665 Mixed list
9666 !! wikitext
9667 *Mixed list
9668 *#with numbers
9669 **and bullets
9670 *#and numbers
9671 *bullets again
9672 **bullet level 2
9673 ***bullet level 3
9674 ***#Number on level 4
9675 **bullet level 2
9676 **#Number on level 3
9677 **#Number on level 3
9678 *#number level 2
9679 *Level 1
9680 ***Level 3
9681 #**Level 3, but ordered
9682 !! html
9683 <ul><li>Mixed list
9684 <ol><li>with numbers</li></ol>
9685 <ul><li>and bullets</li></ul>
9686 <ol><li>and numbers</li></ol></li>
9687 <li>bullets again
9688 <ul><li>bullet level 2
9689 <ul><li>bullet level 3
9690 <ol><li>Number on level 4</li></ol></li></ul></li>
9691 <li>bullet level 2
9692 <ol><li>Number on level 3</li>
9693 <li>Number on level 3</li></ol></li></ul>
9694 <ol><li>number level 2</li></ol></li>
9695 <li>Level 1
9696 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9697 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9698
9699 !! end
9700
9701 !! test
9702 1. Nested mixed wikitext and html list
9703 !! wikitext
9704 *hi
9705 *<ul><li>ho</li></ul>
9706 *hi
9707 **ho
9708 !! html/php
9709 <ul><li>hi</li>
9710 <li><ul><li>ho</li></ul></li>
9711 <li>hi
9712 <ul><li>ho</li></ul></li></ul>
9713
9714 !! html/parsoid
9715 <ul><li>hi</li>
9716 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9717 <li>hi
9718 <ul><li>ho</li></ul></li></ul>
9719 !! end
9720
9721 !! test
9722 2. Nested mixed wikitext and html list (incompatible)
9723 !! wikitext
9724 ;hi
9725 :{{echo|<li>ho</li>}}
9726 !! html/php
9727 <dl><dt>hi</dt>
9728 <dd><li>ho</li></dd></dl>
9729
9730 !! html/parsoid
9731 <dl><dt>hi</dt>
9732 <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>
9733 !! end
9734
9735 !! test
9736 Nested lists 1
9737 !! wikitext
9738 *foo
9739 **bar
9740 !! html
9741 <ul><li>foo
9742 <ul><li>bar</li></ul></li></ul>
9743
9744 !! end
9745
9746 !! test
9747 Nested lists 2
9748 !! wikitext
9749 **foo
9750 *bar
9751 !! html
9752 <ul><li><ul><li>foo</li></ul></li>
9753 <li>bar</li></ul>
9754
9755 !! end
9756
9757 !! test
9758 Nested lists 3 (first element empty)
9759 !! wikitext
9760 *
9761 **bar
9762 !! html
9763 <ul><li>
9764 <ul><li>bar</li></ul></li></ul>
9765
9766 !! end
9767
9768 !! test
9769 Nested lists 4 (first element empty)
9770 !! wikitext
9771 **
9772 *bar
9773 !! html
9774 <ul><li><ul><li></li></ul></li>
9775 <li>bar</li></ul>
9776
9777 !! end
9778
9779 !! test
9780 Nested lists 5 (both elements empty)
9781 !! wikitext
9782 **
9783 *
9784 !! html
9785 <ul><li><ul><li></li></ul></li>
9786 <li></li></ul>
9787
9788 !! end
9789
9790 !! test
9791 Nested lists 6 (both elements empty)
9792 !! wikitext
9793 *
9794 **
9795 !! html
9796 <ul><li>
9797 <ul><li></li></ul></li></ul>
9798
9799 !! end
9800
9801 !! test
9802 Nested lists 7 (skip initial nesting levels)
9803 !! wikitext
9804 ***foo
9805 !! html
9806 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9807
9808 !! end
9809
9810 !! test
9811 Nested lists 8 (multiple nesting transitions)
9812 !! wikitext
9813 *foo
9814 ***bar
9815 **baz
9816 *boo
9817 !! html
9818 <ul><li>foo
9819 <ul><li><ul><li>bar</li></ul></li>
9820 <li>baz</li></ul></li>
9821 <li>boo</li></ul>
9822
9823 !! end
9824
9825 !! test
9826 Nested lists 9 (extension interaction)
9827 !! options
9828 parsoid
9829 !! wikitext
9830 *<references />
9831 !! html/parsoid
9832 <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>
9833 !! end
9834
9835 !! test
9836 1. Lists with start-of-line-transparent tokens before bullets: Comments
9837 !! wikitext
9838 *foo
9839 *<!--cmt-->bar
9840 <!--cmt-->*baz
9841 !! html
9842 <ul><li>foo</li>
9843 <li>bar</li>
9844 <li>baz</li></ul>
9845
9846 !! end
9847
9848 !! test
9849 Nested lists 10 (list and span siblings: wt2wt regression)
9850 !! wikitext
9851 *a <span>x</span>
9852 **b <span>y</span>
9853 !! html/parsoid
9854 <ul><li>a <span>x</span>
9855 <ul><li>b <span>y</span></li></ul></li></ul>
9856 !! end
9857
9858 !! test
9859 2. Lists with start-of-line-transparent tokens before bullets: Template close
9860 !! wikitext
9861 *foo {{echo|bar
9862 }}*baz
9863 !! html
9864 <ul><li>foo bar</li>
9865 <li>baz</li></ul>
9866
9867 !! end
9868
9869 !! test
9870 List items are not parsed correctly following a <pre> block (T2785)
9871 !! wikitext
9872 *<pre>foo</pre>
9873 *<pre>bar</pre>
9874 *zar
9875 !! html/php
9876 <ul><li><pre>foo</pre></li>
9877 <li><pre>bar</pre></li>
9878 <li>zar</li></ul>
9879
9880 !! html/parsoid
9881 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9882 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9883 <li>zar</li></ul>
9884 !! end
9885
9886 # FIXME: Might benefit from a html/parsoid since this has a template
9887 !! test
9888 List items from template
9889 !! wikitext
9890
9891 {{inner list}}
9892 *item 2
9893
9894 *item 0
9895 {{inner list}}
9896 *item 2
9897
9898 *item 0
9899 *notSOL{{inner list}}
9900 *item 2
9901 !! html
9902 <ul><li>item 1</li>
9903 <li>item 2</li></ul>
9904 <ul><li>item 0</li>
9905 <li>item 1</li>
9906 <li>item 2</li></ul>
9907 <ul><li>item 0</li>
9908 <li>notSOL</li>
9909 <li>item 1</li>
9910 <li>item 2</li></ul>
9911
9912 !! end
9913
9914 !! test
9915 List interrupted by empty line or heading
9916 !! wikitext
9917 *foo
9918
9919 **bar
9920 ==A heading==
9921 *Another list item
9922 !! html
9923 <ul><li>foo</li></ul>
9924 <ul><li><ul><li>bar</li></ul></li></ul>
9925 <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>
9926 <ul><li>Another list item</li></ul>
9927
9928 !!end
9929
9930 !!test
9931 Multiple list tags generated by templates
9932 !! wikitext
9933 {{echo|<li>}}a
9934 {{echo|<li>}}b
9935 {{echo|<li>}}c
9936 !! html
9937 <li>a
9938 <li>b
9939 <li>c</li>
9940 </li>
9941 </li>
9942
9943 !! html+tidy
9944 <li>a
9945 </li><li>b
9946 </li><li>c
9947 </li>
9948 !! html/parsoid
9949 <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
9950 </li><li about="#mwt1">b
9951 </li><li about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[null,44,null,0]}'>c</li>
9952 !!end
9953
9954 !!test
9955 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9956 !! wikitext
9957 *a
9958 <!--This line will NOT split the list-->
9959 *b
9960 <!--This line will NOT split the list either-->
9961 *c
9962 <!--foo--> <!----> <!--This line NOT split the list either-->
9963 *d
9964 !! html
9965 <ul><li>a</li>
9966 <li>b</li>
9967 <li>c</li>
9968 <li>d</li></ul>
9969
9970 !!end
9971
9972 !!test
9973 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9974 !! wikitext
9975 *a
9976 <!--This line will NOT split the list-->
9977 *b
9978 <!--This line will NOT split the list either-->
9979 *c
9980 <!--foo--> <!----> <!--This line NOT split the list
9981 either-->
9982 *d
9983 !! html
9984 <ul><li>a</li>
9985 <li>b</li>
9986 <li>c</li>
9987 <li>d</li></ul>
9988
9989 !!end
9990
9991 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
9992 # That pass could possibly be removed.
9993 !!test
9994 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
9995 !!options
9996 parsoid=wt2html,wt2wt
9997 !! wikitext
9998 *foo
9999 *<li>li-hack
10000 *{{echo|<li>templated li-hack}}
10001 *<!--foo--><li> unsupported li-hack with preceding comments
10002
10003 <ul>
10004 <li><li>not a li-hack
10005 </li>
10006 </ul>
10007 !! html+tidy
10008 <ul><li>foo</li>
10009 <li class="mw-empty-elt"></li><li>li-hack</li>
10010 <li class="mw-empty-elt"></li><li>templated li-hack</li>
10011 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
10012 <ul>
10013 <li class="mw-empty-elt"></li><li>not a li-hack
10014 </li>
10015 </ul>
10016 !! html/parsoid
10017 <ul><li> foo</li>
10018 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
10019 <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>
10020 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
10021
10022 <ul data-parsoid='{"stx":"html"}'>
10023 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
10024 </li>
10025 </ul>
10026
10027 !!end
10028
10029 !! test
10030 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
10031 !! options
10032 parsoid
10033 !! wikitext
10034 #foo
10035 ##bar
10036
10037 *foo
10038 **bar
10039
10040 :foo
10041 ::bar
10042 !! html
10043 <ol>
10044 <li>foo<ol>
10045 <li>bar</li>
10046 </ol></li>
10047 </ol><ul>
10048 <li>foo<ul>
10049 <li>bar</li>
10050 </ul></li>
10051 </ul><dl>
10052 <dd>foo<dl>
10053 <dd>bar</dd>
10054 </dl></dd>
10055 </dl>
10056 !! end
10057
10058 !! test
10059 Parsoid: Test of whitespace serialization with Templated bullets
10060 !! options
10061 parsoid=wt2html
10062 !! wikitext
10063 * {{bullet}}
10064 !! html/parsoid
10065 <ul>
10066 <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>
10067 </ul>
10068 !! end
10069
10070 # ------------------------------------------------------------------------
10071 # The next set of tests are about Parsoid's ability to handle badly nested
10072 # tags (parse, minimize scope of fixup, and roundtrip back)
10073 # ------------------------------------------------------------------------
10074
10075 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
10076 # Parsoid's list handling is more aware of block structure.
10077 !! test
10078 Unbalanced closing block tags break a list
10079 !! wikitext
10080 <div>
10081 *a</div><div>
10082 *b</div>
10083 !! html+tidy
10084 <div>
10085 <ul><li>a</li></ul></div><div>
10086 <li>b</li></div>
10087 !! html/parsoid
10088 <div><ul>
10089 <li>a</li>
10090 </ul></div>
10091 <div><ul>
10092 <li>b</li>
10093 </ul></div>
10094 !! end
10095
10096 !! test
10097 Unbalanced closing non-block tags don't break a list
10098 !! wikitext
10099 <span>
10100 *a</span><span>
10101 *b</span>
10102 !! html/php+tidy
10103 <p><span>
10104 </span></p>
10105 <ul><li>a<span></span></li>
10106 <li>b</li></ul>
10107 !! html/parsoid
10108 <span>
10109 <ul>
10110 <li>a<span></span></li>
10111 <li>b</li>
10112 </ul>
10113 </span>
10114 !! end
10115
10116 # Parsoid does some post-dom-building cleanup
10117 # which is why its output differs from Remex.
10118 !! test
10119 Unclosed formatting tags that straddle lists are closed and reopened
10120 !! options
10121 parsoid=wt2html,wt2wt,html2html
10122 !! wikitext
10123 #<s> a
10124 #b </s>
10125 !! html/php+tidy
10126 <ol><li><s> a</s></li><s>
10127 </s><li><s>b </s></li></ol>
10128 !! html/parsoid
10129 <ol><li><s> a</s></li>
10130 <li><s>b </s></li></ol>
10131 !! end
10132
10133 # Output is ugly because of all the misnested tag fixups.
10134 # Remex is wrapping p-tags around empty elements.
10135 # Parsoid has special-case handling of this pattern of
10136 # wrapping lists in formatting tags.
10137 # FIXME: Should we remove this code from Parsoid? Or add
10138 # special support in Remex? If the latter, maybe just wait
10139 # for Parsoid to become the default parser.
10140 # See T70395.
10141 !!test
10142 1. List embedded in a formatting tag
10143 !! wikitext
10144 <small>
10145 *foo
10146 </small>
10147 !! html/php+tidy
10148 <p><small>
10149 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10150 </p>
10151 !! html/parsoid
10152 <small>
10153 <ul>
10154 <li>foo</li>
10155 </ul>
10156 </small>
10157 !!end
10158
10159 # Output is ugly because of all the misnested tag fixups
10160 # Remex is wrapping p-tags around empty elements.
10161 # Parsoid has code that strips useless p-tags.
10162 !!test
10163 2. List embedded in a formatting tag in a misnested way
10164 !! wikitext
10165 <small>
10166 *a
10167 *b</small>
10168 !! html/php+tidy
10169 <p><small>
10170 </small></p><small></small><ul><small><li>a</li>
10171 </small><li><small>b</small></li></ul>
10172 !! html/parsoid
10173 <small></small>
10174 <ul><small>
10175 <li>a</li>
10176 </small>
10177 <li><small>b</small></li>
10178 </ul>
10179 !!end
10180
10181 ###
10182 ### Magic Words
10183 ###
10184
10185 # Note that the current date is hard-coded as
10186 # 1970-01-01T00:02:03Z (a Thursday)
10187 # when running parser tests. The timezone is also fixed to GMT, so
10188 # local date will be identical to current date.
10189
10190 !! test
10191 Magic Word: {{CURRENTDAY}}
10192 !! wikitext
10193 {{CURRENTDAY}}
10194 !! html
10195 <p>1
10196 </p>
10197 !! end
10198
10199 !! test
10200 Magic Word: {{CURRENTDAY2}}
10201 !! wikitext
10202 {{CURRENTDAY2}}
10203 !! html
10204 <p>01
10205 </p>
10206 !! end
10207
10208 !! test
10209 Magic Word: {{CURRENTDAYNAME}}
10210 !! wikitext
10211 {{CURRENTDAYNAME}}
10212 !! html
10213 <p>Thursday
10214 </p>
10215 !! end
10216
10217 !! test
10218 Magic Word: {{CURRENTDOW}}
10219 !! wikitext
10220 {{CURRENTDOW}}
10221 !! html
10222 <p>4
10223 </p>
10224 !! end
10225
10226 !! test
10227 Magic Word: {{CURRENTMONTH}}
10228 !! wikitext
10229 {{CURRENTMONTH}}
10230 !! html
10231 <p>01
10232 </p>
10233 !! end
10234
10235 !! test
10236 Magic Word: {{CURRENTMONTH1}}
10237 !! wikitext
10238 {{CURRENTMONTH1}}
10239 !! html
10240 <p>1
10241 </p>
10242 !! end
10243
10244 !! test
10245 Magic Word: {{CURRENTMONTHABBREV}}
10246 !! wikitext
10247 {{CURRENTMONTHABBREV}}
10248 !! html
10249 <p>Jan
10250 </p>
10251 !! end
10252
10253 !! test
10254 Magic Word: {{CURRENTMONTHNAME}}
10255 !! wikitext
10256 {{CURRENTMONTHNAME}}
10257 !! html
10258 <p>January
10259 </p>
10260 !! end
10261
10262 !! test
10263 Magic Word: {{CURRENTMONTHNAMEGEN}}
10264 !! wikitext
10265 {{CURRENTMONTHNAMEGEN}}
10266 !! html
10267 <p>January
10268 </p>
10269 !! end
10270
10271 !! test
10272 Magic Word: {{CURRENTTIME}}
10273 !! wikitext
10274 {{CURRENTTIME}}
10275 !! html
10276 <p>00:02
10277 </p>
10278 !! end
10279
10280 !! test
10281 Magic Word: {{CURRENTHOUR}}
10282 !! wikitext
10283 {{CURRENTHOUR}}
10284 !! html
10285 <p>00
10286 </p>
10287 !! end
10288
10289 !! test
10290 Magic Word: {{CURRENTWEEK}} (T6594)
10291 !! wikitext
10292 {{CURRENTWEEK}}
10293 !! html
10294 <p>1
10295 </p>
10296 !! end
10297
10298 !! test
10299 Magic Word: {{CURRENTYEAR}}
10300 !! wikitext
10301 {{CURRENTYEAR}}
10302 !! html
10303 <p>1970
10304 </p>
10305 !! end
10306
10307 !! test
10308 Magic Word: {{CURRENTTIMESTAMP}}
10309 !! wikitext
10310 {{CURRENTTIMESTAMP}}
10311 !! html
10312 <p>19700101000203
10313 </p>
10314 !! end
10315
10316 !! test
10317 Magic Words LOCAL (UTC)
10318 !! wikitext
10319 *{{LOCALMONTH}}
10320 *{{LOCALMONTH1}}
10321 *{{LOCALMONTHNAME}}
10322 *{{LOCALMONTHNAMEGEN}}
10323 *{{LOCALMONTHABBREV}}
10324 *{{LOCALDAY}}
10325 *{{LOCALDAY2}}
10326 *{{LOCALDAYNAME}}
10327 *{{LOCALYEAR}}
10328 *{{LOCALTIME}}
10329 *{{LOCALHOUR}}
10330 *{{LOCALWEEK}}
10331 *{{LOCALDOW}}
10332 *{{LOCALTIMESTAMP}}
10333 !! html
10334 <ul><li>01</li>
10335 <li>1</li>
10336 <li>January</li>
10337 <li>January</li>
10338 <li>Jan</li>
10339 <li>1</li>
10340 <li>01</li>
10341 <li>Thursday</li>
10342 <li>1970</li>
10343 <li>00:02</li>
10344 <li>00</li>
10345 <li>1</li>
10346 <li>4</li>
10347 <li>19700101000203</li></ul>
10348
10349 !! end
10350
10351 !! test
10352 Magic Word: {{FULLPAGENAME}}
10353 !! options
10354 title=[[User:Ævar Arnfjörð Bjarmason]]
10355 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10356 !! wikitext
10357 {{FULLPAGENAME}}
10358 !! html/*
10359 <p>User:Ævar Arnfjörð Bjarmason
10360 </p>
10361 !! end
10362
10363 !! test
10364 Magic Word: {{FULLPAGENAMEE}}
10365 !! options
10366 title=[[User:Ævar Arnfjörð Bjarmason]]
10367 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10368 !! wikitext
10369 {{FULLPAGENAMEE}}
10370 !! html/*
10371 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10372 </p>
10373 !! end
10374
10375 !! test
10376 Magic Word: {{TALKSPACE}}
10377 !! options
10378 title=[[User:Ævar Arnfjörð Bjarmason]]
10379 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10380 !! wikitext
10381 {{TALKSPACE}}
10382 !! html/*
10383 <p>User talk
10384 </p>
10385 !! end
10386
10387 !! test
10388 Magic Word: {{TALKSPACE}}, same namespace
10389 !! options
10390 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10391 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10392 !! wikitext
10393 {{TALKSPACE}}
10394 !! html/*
10395 <p>User talk
10396 </p>
10397 !! end
10398
10399 !! test
10400 Magic Word: {{TALKSPACE}}, main namespace
10401 !! options
10402 title=[[Parser Test]]
10403 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10404 !! wikitext
10405 {{TALKSPACE}}
10406 !! html/*
10407 <p>Talk
10408 </p>
10409 !! end
10410
10411 !! test
10412 Magic Word: {{TALKSPACEE}}
10413 !! options
10414 title=[[User:Ævar Arnfjörð Bjarmason]]
10415 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10416 !! wikitext
10417 {{TALKSPACEE}}
10418 !! html/*
10419 <p>User_talk
10420 </p>
10421 !! end
10422
10423 !! test
10424 Magic Word: {{SUBJECTSPACE}}
10425 !! options
10426 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10427 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10428 !! wikitext
10429 {{SUBJECTSPACE}}
10430 !! html/*
10431 <p>User
10432 </p>
10433 !! end
10434
10435 !! test
10436 Magic Word: {{SUBJECTSPACE}}, same namespace
10437 !! options
10438 title=[[User:Ævar Arnfjörð Bjarmason]]
10439 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10440 !! wikitext
10441 {{SUBJECTSPACE}}
10442 !! html/*
10443 <p>User
10444 </p>
10445 !! end
10446
10447 !! test
10448 Magic Word: {{SUBJECTSPACE}}, main namespace
10449 !! options
10450 title=[[Parser Test]]
10451 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10452 !! wikitext
10453 {{SUBJECTSPACE}}
10454 !! html/*
10455
10456 !! end
10457
10458 !! test
10459 Magic Word: {{SUBJECTSPACEE}}
10460 !! options
10461 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10462 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10463 !! wikitext
10464 {{SUBJECTSPACEE}}
10465 !! html/*
10466 <p>User
10467 </p>
10468 !! end
10469
10470 !! test
10471 Magic Word: {{NAMESPACE}}
10472 !! options
10473 title=[[User:Ævar Arnfjörð Bjarmason]]
10474 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10475 !! wikitext
10476 {{NAMESPACE}}
10477 !! html/*
10478 <p>User
10479 </p>
10480 !! end
10481
10482 !! test
10483 Magic Word: {{NAMESPACEE}}
10484 !! options
10485 title=[[User:Ævar Arnfjörð Bjarmason]]
10486 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10487 !! wikitext
10488 {{NAMESPACEE}}
10489 !! html/*
10490 <p>User
10491 </p>
10492 !! end
10493
10494 !! test
10495 Magic Word: {{NAMESPACENUMBER}}
10496 !! options
10497 title=[[User:Ævar Arnfjörð Bjarmason]]
10498 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10499 !! wikitext
10500 {{NAMESPACENUMBER}}
10501 !! html/*
10502 <p>2
10503 </p>
10504 !! end
10505
10506 !! test
10507 Magic Word: {{SUBPAGENAME}}
10508 !! options
10509 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10510 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10511 !! wikitext
10512 {{SUBPAGENAME}}
10513 !! html/*
10514 <p>sub ö
10515 </p>
10516 !! end
10517
10518 !! test
10519 Magic Word: {{SUBPAGENAMEE}}
10520 !! options
10521 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10522 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10523 !! wikitext
10524 {{SUBPAGENAMEE}}
10525 !! html/*
10526 <p>sub_%C3%B6
10527 </p>
10528 !! end
10529
10530 !! test
10531 Magic Word: {{ROOTPAGENAME}}
10532 !! options
10533 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10534 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10535 !! wikitext
10536 {{ROOTPAGENAME}}
10537 !! html/*
10538 <p>Ævar Arnfjörð Bjarmason
10539 </p>
10540 !! end
10541
10542 !! test
10543 Magic Word: {{ROOTPAGENAMEE}}
10544 !! options
10545 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10546 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10547 !! wikitext
10548 {{ROOTPAGENAMEE}}
10549 !! html/*
10550 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10551 </p>
10552 !! end
10553
10554 !! test
10555 Magic Word: {{BASEPAGENAME}}
10556 !! options
10557 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10558 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10559 !! wikitext
10560 {{BASEPAGENAME}}
10561 !! html/*
10562 <p>Ævar Arnfjörð Bjarmason
10563 </p>
10564 !! end
10565
10566 !! test
10567 Magic Word: {{BASEPAGENAMEE}}
10568 !! options
10569 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10570 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10571 !! wikitext
10572 {{BASEPAGENAMEE}}
10573 !! html/*
10574 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10575 </p>
10576 !! end
10577
10578 !! test
10579 Magic Word: {{TALKPAGENAME}}
10580 !! options
10581 title=[[User:Ævar Arnfjörð Bjarmason]]
10582 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10583 !! wikitext
10584 {{TALKPAGENAME}}
10585 !! html/*
10586 <p>User talk:Ævar Arnfjörð Bjarmason
10587 </p>
10588 !! end
10589
10590 !! test
10591 Magic Word: {{TALKPAGENAMEE}}
10592 !! options
10593 title=[[User:Ævar Arnfjörð Bjarmason]]
10594 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10595 !! wikitext
10596 {{TALKPAGENAMEE}}
10597 !! html/*
10598 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10599 </p>
10600 !! end
10601
10602 !! test
10603 Magic Word: {{SUBJECTPAGENAME}}
10604 !! options
10605 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10606 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10607 !! wikitext
10608 {{SUBJECTPAGENAME}}
10609 !! html/*
10610 <p>User:Ævar Arnfjörð Bjarmason
10611 </p>
10612 !! end
10613
10614 !! test
10615 Magic Word: {{SUBJECTPAGENAMEE}}
10616 !! options
10617 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10618 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10619 !! wikitext
10620 {{SUBJECTPAGENAMEE}}
10621 !! html/*
10622 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10623 </p>
10624 !! end
10625
10626 !! test
10627 Magic Word: {{NUMBEROFFILES}}
10628 !! options
10629 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10630 !! wikitext
10631 {{NUMBEROFFILES}}
10632 !! html/*
10633 <p>7
10634 </p>
10635 !! end
10636
10637 !! test
10638 Magic Word: {{PAGENAME}}
10639 !! options
10640 title=[[User:Ævar Arnfjörð Bjarmason]]
10641 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10642 !! wikitext
10643 {{PAGENAME}}
10644 !! html/*
10645 <p>Ævar Arnfjörð Bjarmason
10646 </p>
10647 !! end
10648
10649 !! test
10650 Magic Word: {{PAGENAME}} with metacharacters
10651 !! options
10652 title=[['foo & bar = baz']]
10653 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10654 !! wikitext
10655 ''{{PAGENAME}}''
10656 !! html+tidy
10657 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10658 </p>
10659 !! end
10660
10661 !! test
10662 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10663 !! options
10664 title=[[*RFC 1234 http://example.com/]]
10665 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10666 !! wikitext
10667 {{PAGENAME}}
10668 !! html+tidy
10669 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10670 </p>
10671 !! end
10672
10673 !! test
10674 Magic Word: {{PAGENAMEE}}
10675 !! options
10676 title=[[User:Ævar Arnfjörð Bjarmason]]
10677 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10678 !! wikitext
10679 {{PAGENAMEE}}
10680 !! html/*
10681 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10682 </p>
10683 !! end
10684
10685 !! test
10686 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10687 !! options
10688 title=[[*RFC 1234 http://example.com/]]
10689 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10690 !! wikitext
10691 {{PAGENAMEE}}
10692 !! html+tidy
10693 <p>&#42;RFC_1234_http&#58;//example.com/
10694 </p>
10695 !! end
10696
10697 !! test
10698 Magic Word: {{REVISIONID}}
10699 !! options
10700 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10701 showflags
10702 !! wikitext
10703 {{REVISIONID}}
10704 !! html/*
10705 <p>1337
10706 </p>
10707 flags=vary-revision-id
10708 !! end
10709
10710 !! test
10711 Magic Word: {{SCRIPTPATH}}
10712 !! options
10713 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10714 !! wikitext
10715 {{SCRIPTPATH}}
10716 !! html/*
10717
10718 !! end
10719
10720 !! test
10721 Magic Word: {{STYLEPATH}}
10722 !! options
10723 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10724 !! wikitext
10725 {{STYLEPATH}}
10726 !! html/*
10727 <p>/skins
10728 </p>
10729 !! end
10730
10731 !! test
10732 Magic Word: {{SERVER}}
10733 !! options
10734 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10735 !! wikitext
10736 {{SERVER}}
10737 !! html/*
10738 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10739 </p>
10740 !! end
10741
10742 !! test
10743 Magic Word: {{SERVERNAME}}
10744 !! options
10745 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10746 !! wikitext
10747 {{SERVERNAME}}
10748 !! html/*
10749 <p>example.org
10750 </p>
10751 !! end
10752
10753 !! test
10754 Magic Word: {{SITENAME}}
10755 !! options
10756 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10757 !! wikitext
10758 {{SITENAME}}
10759 !! html/*
10760 <p>MediaWiki
10761 </p>
10762 !! end
10763
10764 !! test
10765 Magic Word: {{PAGELANGUAGE}}
10766 !! options
10767 language=fr
10768 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10769 !! wikitext
10770 {{PAGELANGUAGE}}
10771 !! html/*
10772 <p>fr
10773 </p>
10774 !! end
10775
10776 !! test
10777 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10778 !! options
10779 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10780 !! wikitext
10781 {{PAGELANGUAGE}}
10782 !! html/*
10783 <p>en
10784 </p>
10785 !! end
10786
10787 !! test
10788 Case-sensitive magic words, when cased differently, should just be template transclusions
10789 !! wikitext
10790 {{CurrentMonth}}
10791 {{currentday}}
10792 {{cURreNTweEK}}
10793 {{currentHour}}
10794 !! html
10795 <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>
10796 <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>
10797 <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>
10798 <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>
10799 </p>
10800 !! end
10801
10802 !! test
10803 Case-insensitive magic words should still work with weird casing.
10804 !! wikitext
10805 {{sErVeRNaMe}}
10806 {{LCFirst:AOEU}}
10807 {{ucFIRST:aoeu}}
10808 {{SERver}}
10809 !! html
10810 <p>example.org
10811 aOEU
10812 Aoeu
10813 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10814 </p>
10815 !! end
10816
10817 # From plwiki:PLOS_ONE
10818 !! test
10819 Parsoid: Page property magic word with magic word contents
10820 !! wikitext
10821 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10822 !! html/parsoid
10823 <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>"}]]}'/>
10824 !! end
10825
10826 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10827 # But, this is a limitation of our representation and is documented in
10828 # TemplateHandler.js in processSpecialMagicWord
10829 !! test
10830 Parsoid: Template-generated DISPLAYTITLE
10831 !! wikitext
10832 {{{{echo|DISPLAYTITLE}}:Foo}}
10833 !! options
10834 showtitle
10835 !! config
10836 wgAllowDisplayTitle=true
10837 wgRestrictDisplayTitle=false
10838 !! html/php
10839 Foo
10840
10841 !! html/parsoid
10842 <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"}]]}'/>
10843 !! end
10844
10845 !! test
10846 Namespace 1 {{ns:1}}
10847 !! wikitext
10848 {{ns:1}}
10849 !! html
10850 <p>Talk
10851 </p>
10852 !! end
10853
10854 !! test
10855 Namespace 1 {{ns:01}}
10856 !! wikitext
10857 {{ns:01}}
10858 !! html
10859 <p>Talk
10860 </p>
10861 !! end
10862
10863 !! test
10864 Namespace 0 {{ns:0}} (T6783)
10865 !! wikitext
10866 {{ns:0}}
10867 !! html
10868
10869 !! end
10870
10871 !! test
10872 Namespace 0 {{ns:00}} (T6783)
10873 !! wikitext
10874 {{ns:00}}
10875 !! html
10876
10877 !! end
10878
10879 !! test
10880 Namespace -1 {{ns:-1}}
10881 !! wikitext
10882 {{ns:-1}}
10883 !! html
10884 <p>Special
10885 </p>
10886 !! end
10887
10888 !! test
10889 Namespace User {{ns:User}}
10890 !! wikitext
10891 {{ns:User}}
10892 !! html
10893 <p>User
10894 </p>
10895 !! end
10896
10897 !! test
10898 Namespace User talk {{ns:User_talk}}
10899 !! wikitext
10900 {{ns:User_talk}}
10901 !! html
10902 <p>User talk
10903 </p>
10904 !! end
10905
10906 !! test
10907 Namespace User talk {{ns:uSeR tAlK}}
10908 !! wikitext
10909 {{ns:uSeR tAlK}}
10910 !! html
10911 <p>User talk
10912 </p>
10913 !! end
10914
10915 !! test
10916 Namespace File {{ns:File}}
10917 !! wikitext
10918 {{ns:File}}
10919 !! html
10920 <p>File
10921 </p>
10922 !! end
10923
10924 !! test
10925 Namespace File {{ns:Image}}
10926 !! wikitext
10927 {{ns:Image}}
10928 !! html
10929 <p>File
10930 </p>
10931 !! end
10932
10933 !! test
10934 Namespace (lang=de) Benutzer {{ns:User}}
10935 !! options
10936 language=de
10937 !! wikitext
10938 {{ns:User}}
10939 !! html
10940 <p>Benutzer
10941 </p>
10942 !! end
10943
10944 !! test
10945 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10946 !! options
10947 language=de
10948 !! wikitext
10949 {{ns:3}}
10950 !! html
10951 <p>Benutzer Diskussion
10952 </p>
10953 !! end
10954
10955 !! test
10956 Urlencode
10957 !! wikitext
10958 {{urlencode:hi world?!}}
10959 {{urlencode:hi world?!|WIKI}}
10960 {{urlencode:hi world?!|PATH}}
10961 {{urlencode:hi world?!|QUERY}}
10962 !! html/php
10963 <p>hi+world%3F%21
10964 hi_world%3F!
10965 hi%20world%3F%21
10966 hi+world%3F%21
10967 </p>
10968 !! end
10969
10970 !! test
10971 Magic Word: prioritize type info over data-parsoid
10972 !! options
10973 parsoid=html2wt
10974 !! html/parsoid
10975 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10976 !! wikitext
10977 __FORCETOC__
10978 !! end
10979
10980 !! test
10981 Magic Word: serialize on separate line (parsoid)
10982 !! options
10983 parsoid=wt2wt,html2wt
10984 !! wikitext
10985 foo
10986 __NOTOC__
10987 bar
10988 !! html/parsoid
10989 foo<meta property="mw:PageProp/notoc"/>bar
10990 !! end
10991
10992 !! test
10993 Magic Word: rt non-english wikis
10994 !! options
10995 parsoid=wt2wt
10996 language=de
10997 !! wikitext
10998 __NOEDITSECTION__
10999 !! html/parsoid
11000 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
11001 !! end
11002
11003 !!test
11004 __proto__ is treated as normal wikitext (T105997)
11005 !!wikitext
11006 __proto__
11007 !!html
11008 <p>__proto__
11009 </p>
11010 !!end
11011
11012 ###
11013 ### Magic links
11014 ###
11015 !! test
11016 Magic links: internal link to RFC (T2479)
11017 !! wikitext
11018 [[RFC 123]]
11019 !! html/php
11020 <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>
11021 </p>
11022 !! html/parsoid
11023 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
11024 !! end
11025
11026 !! test
11027 Magic links: RFC (T2479)
11028 !! wikitext
11029 RFC 822
11030 !! html/php
11031 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11032 </p>
11033 !! html/parsoid
11034 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
11035 !! end
11036
11037 !! test
11038 Magic links: RFC (T67278)
11039 !! wikitext
11040 This is RFC 822 but thisRFC 822 is not RFC 822linked.
11041 !! html/php
11042 <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.
11043 </p>
11044 !! html/parsoid
11045 <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>
11046 !! end
11047
11048 !! test
11049 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
11050 !! wikitext
11051 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
11052 RFC
11053 822
11054 !! html/php
11055 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11056 RFC
11057 822
11058 </p>
11059 !! html/parsoid
11060 <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>
11061 RFC
11062 822</p>
11063 !! end
11064
11065 !! test
11066 Magic links: ISBN (T3937)
11067 !! wikitext
11068 ISBN 0-306-40615-2
11069 !! html/php
11070 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
11071 </p>
11072 !! html/parsoid
11073 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
11074 !! end
11075
11076 !! test
11077 Magic links: ISBN (T67278)
11078 !! wikitext
11079 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11080 !! html/php
11081 <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.
11082 </p>
11083 !! html/parsoid
11084 <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>
11085 !! end
11086
11087 !! test
11088 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
11089 !! wikitext
11090 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
11091 ISBN
11092 9780316098113
11093 ISBN 978
11094 0316098113
11095 !! html/php
11096 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11097 ISBN
11098 9780316098113
11099 ISBN 978
11100 0316098113
11101 </p>
11102 !! html/parsoid
11103 <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>
11104 ISBN
11105 9780316098113
11106 ISBN 978
11107 0316098113</p>
11108 !! end
11109
11110 !! test
11111 Magic links: PMID incorrectly converts space to underscore
11112 !! wikitext
11113 PMID 1234
11114 !! html/php
11115 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11116 </p>
11117 !! html/parsoid
11118 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
11119 !! end
11120
11121 !! test
11122 Magic links: PMID (T67278)
11123 !! wikitext
11124 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11125 !! html/php
11126 <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.
11127 </p>
11128 !! html/parsoid
11129 <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>
11130 !! end
11131
11132 !! test
11133 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11134 !! wikitext
11135 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11136 PMID
11137 1234
11138 !! html/php
11139 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11140 PMID
11141 1234
11142 </p>
11143 !! html/parsoid
11144 <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>
11145 PMID
11146 1234</p>
11147 !! end
11148
11149 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11150 # since these are ExtLinkText, not MagicLinkText
11151 !! test
11152 Magic links: use appropriate serialization for "almost" magic links.
11153 !! wikitext
11154 X[[Special:BookSources/0978739256|foo]]
11155
11156 X[https://tools.ietf.org/html/rfc1234 foo]
11157 !! html/php
11158 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11159 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11160 </p>
11161 !! html/parsoid
11162 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11163 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11164 !! end
11165
11166 !! test
11167 Magic links: All disabled (T47942)
11168 !! options
11169 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11170 !! wikitext
11171 ISBN 0-306-40615-2
11172 PMID 1234
11173 RFC 4321
11174 !! html/php
11175 <p>ISBN 0-306-40615-2
11176 PMID 1234
11177 RFC 4321
11178 </p>
11179 !! end
11180
11181 ###
11182 ### Templates
11183 ####
11184
11185 !! test
11186 Nonexistent template
11187 !! wikitext
11188 {{thistemplatedoesnotexist}}
11189 !! html
11190 <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>
11191 </p>
11192 !! end
11193
11194 !! test
11195 Template with invalid target containing tags
11196 !! wikitext
11197 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11198 !! html
11199 <p>{{a<b>b</b>|foo|a=b|a = b}}
11200 </p>
11201 !! end
11202
11203 !! test
11204 Template with invalid target containing unclosed tag
11205 !! wikitext
11206 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11207 !! html
11208 <p>{{a<b>|foo|a=b|a = b}}</b>
11209 </p>
11210 !! end
11211
11212 !! test
11213 Template with invalid target containing wikilink
11214 !! wikitext
11215 {{[[Main Page]]}}
11216 !! html/php
11217 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11218 </p>
11219 !! html/parsoid
11220 <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>
11221 !! end
11222
11223 !! test
11224 Template with just whitespace in it, T70421
11225 !! wikitext
11226 {{echo|{{ }}}}
11227 !! html/parsoid
11228 <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>
11229 !! end
11230
11231 !! article
11232 Template:test
11233 !! text
11234 This is a test template
11235 !! endarticle
11236
11237 !! test
11238 Simple template
11239 !! wikitext
11240 {{test}}
11241 !! html
11242 <p>This is a test template
11243 </p>
11244 !! end
11245
11246 !! test
11247 Template with explicit namespace
11248 !! wikitext
11249 {{Template:test}}
11250 !! html
11251 <p>This is a test template
11252 </p>
11253 !! end
11254
11255
11256 !! article
11257 Template:paramtest
11258 !! text
11259 This is a test template with parameter {{{param}}}
11260 !! endarticle
11261
11262 !! test
11263 Template parameter
11264 !! wikitext
11265 {{paramtest|param=foo}}
11266 !! html
11267 <p>This is a test template with parameter foo
11268 </p>
11269 !! end
11270
11271 !! article
11272 Template:paramtestnum
11273 !! text
11274 [[{{{1}}}|{{{2}}}]]
11275 !! endarticle
11276
11277 !! test
11278 Template unnamed parameter
11279 !! wikitext
11280 {{paramtestnum|Main Page|the main page}}
11281 !! html
11282 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11283 </p>
11284 !! end
11285
11286 !! article
11287 Template:templatesimple
11288 !! text
11289 (test)
11290 !! endarticle
11291
11292 !! article
11293 Template:templateredirect
11294 !! text
11295 #redirect [[Template:templatesimple]]
11296 !! endarticle
11297
11298 !! article
11299 Template:templateasargtestnum
11300 !! text
11301 {{{{{1}}}}}
11302 !! endarticle
11303
11304 !! article
11305 Template:templateasargtest
11306 !! text
11307 {{template{{{templ}}}}}
11308 !! endarticle
11309
11310 !! article
11311 Template:templateasargtest2
11312 !! text
11313 {{{{{templ}}}}}
11314 !! endarticle
11315
11316 !! test
11317 Template with template name as unnamed argument
11318 !! wikitext
11319 {{templateasargtestnum|templatesimple}}
11320 !! html
11321 <p>(test)
11322 </p>
11323 !! end
11324
11325 !! test
11326 Template with template name as argument
11327 !! wikitext
11328 {{templateasargtest|templ=simple}}
11329 !! html
11330 <p>(test)
11331 </p>
11332 !! end
11333
11334 !! test
11335 Template with template name as argument (2)
11336 !! wikitext
11337 {{templateasargtest2|templ=templatesimple}}
11338 !! html
11339 <p>(test)
11340 </p>
11341 !! end
11342
11343 !! article
11344 Template:templateasargtestdefault
11345 !! text
11346 {{{{{templ|templatesimple}}}}}
11347 !! endarticle
11348
11349 !! article
11350 Template:templa
11351 !! text
11352 '''templ'''
11353 !! endarticle
11354
11355 !! test
11356 Template with default value
11357 !! wikitext
11358 {{templateasargtestdefault}}
11359 !! html
11360 <p>(test)
11361 </p>
11362 !! end
11363
11364 !! test
11365 Template with default value (value set)
11366 !! wikitext
11367 {{templateasargtestdefault|templ=templa}}
11368 !! html
11369 <p><b>templ</b>
11370 </p>
11371 !! end
11372
11373 !! test
11374 Template redirect
11375 !! wikitext
11376 {{templateredirect}}
11377 !! html/php
11378 <p>(test)
11379 </p>
11380 !! html/parsoid
11381 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11382 !! end
11383
11384 !! test
11385 Template with argument in separate line
11386 !! wikitext
11387 {{ templateasargtest |
11388 templ = simple }}
11389 !! html
11390 <p>(test)
11391 </p>
11392 !! end
11393
11394 !! test
11395 Template with complex template as argument
11396 !! wikitext
11397 {{paramtest|
11398 param ={{ templateasargtest |
11399 templ = simple }}}}
11400 !! html
11401 <p>This is a test template with parameter (test)
11402 </p>
11403 !! end
11404
11405 !! test
11406 Templates with templated name
11407 !! wikitext
11408 {{{{echo|echo}}|foo}}
11409 {{{{echo|inner list}} }}
11410 !! html
11411 <p>foo
11412 </p>
11413 <ul><li>item 1</li></ul>
11414
11415 !! html/parsoid
11416 <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>
11417 <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>
11418 !! end
11419
11420 ## Regression test; the output here isn't really that interesting.
11421 !! test
11422 Templates with templated name and top level template args
11423 !! wikitext
11424 {{1{{2{{{3}}}|4=5}}}}
11425 !! html/parsoid
11426 <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>
11427 !! end
11428
11429 # Parsoid markup is deliberate "broken". This is an edge case.
11430 # See long comment in TemplateHandler.js:convertAttribsToString.
11431 !! test
11432 Templates with invalid templated targets
11433 !! wikitext
11434 {{echo
11435 {{echo|foo}}
11436 }}
11437 !! html/php
11438 <p>{{echo
11439 foo
11440 }}
11441 </p>
11442 !! html/parsoid
11443 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11444 foo }}</p>
11445 !! end
11446
11447 !! test
11448 Template with thumb image (with link in description)
11449 !! wikitext
11450 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11451 !! html/php
11452 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>
11453
11454 !! html+tidy
11455 <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>
11456 !! html/parsoid
11457 <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>
11458 !! end
11459
11460 !! article
11461 Template:complextemplate
11462 !! text
11463 {{{1}}} {{paramtest|
11464 param ={{{param}}}}}
11465 !! endarticle
11466
11467 !! test
11468 Template with complex arguments
11469 !! wikitext
11470 {{complextemplate|
11471 param ={{ templateasargtest |
11472 templ = simple }}|[[Template:complextemplate|link]]}}
11473 !! html
11474 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11475 </p>
11476 !! end
11477
11478 !! test
11479 T2553: link with two variables in a piped link
11480 !! wikitext
11481 {|
11482 |[[{{{1}}}|{{{2}}}]]
11483 |}
11484 !! html/php
11485 <table>
11486 <tr>
11487 <td>[[{{{1}}}|{{{2}}}]]
11488 </td></tr></table>
11489
11490 !! html/parsoid
11491 <table>
11492 <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>
11493 </tbody></table>
11494 !! end
11495
11496 # See: T2553
11497 !! test
11498 Abort table cell attribute parsing on wikilink
11499 !! wikitext
11500 {|
11501 |testing [[one|two]] |three||four
11502 |testing one two |three||four
11503 |testing="[[one|two]]" |three||four
11504 |}
11505 !! html/php
11506 <table>
11507 <tr>
11508 <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>
11509 <td>four
11510 </td>
11511 <td>three</td>
11512 <td>four
11513 </td>
11514 <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>
11515 <td>four
11516 </td></tr></table>
11517
11518 !! html/parsoid
11519 <table>
11520 <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>
11521 <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>
11522 <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>
11523 </tbody></table>
11524 !! end
11525
11526 !! test
11527 Don't abort table cell attribute parsing if wikilink is found in template arg
11528 !! wikitext
11529 {|
11530 |Test {{#tag:ref|One two "[[three]]" four}}
11531 |}
11532 !! html/parsoid
11533 <table>
11534 <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>
11535 </tbody></table>
11536 !! end
11537
11538 !! test
11539 Magic variable as template parameter
11540 !! wikitext
11541 {{paramtest|param={{SITENAME}}}}
11542 !! html
11543 <p>This is a test template with parameter MediaWiki
11544 </p>
11545 !! end
11546
11547 !! article
11548 Template:linktest
11549 !! text
11550 [[{{{param}}}|link]]
11551 !! endarticle
11552
11553 !! test
11554 Template parameter as link source
11555 !! wikitext
11556 {{linktest|param=Main Page}}
11557 !! html
11558 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11559 </p>
11560 !! end
11561
11562 !!article
11563 Template:paramtest2
11564 !! text
11565 including another template, {{paramtest|param={{{arg}}}}}
11566 !! endarticle
11567
11568 !! test
11569 Template passing argument to another template
11570 !! wikitext
11571 {{paramtest2|arg='hmm'}}
11572 !! html
11573 <p>including another template, This is a test template with parameter 'hmm'
11574 </p>
11575 !! end
11576
11577 !! article
11578 Template:Linktest2
11579 !! text
11580 Main Page
11581 !! endarticle
11582
11583 !! test
11584 Template as link source
11585 !! wikitext
11586 [[{{linktest2}}]]
11587
11588 [[{{linktest2}}|Main Page]]
11589
11590 [[{{linktest2}}]]Page
11591 !! html
11592 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11593 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11594 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11595 </p>
11596 !! end
11597
11598
11599 !! article
11600 Template:loop1
11601 !! text
11602 {{loop2}}
11603 !! endarticle
11604
11605 !! article
11606 Template:loop2
11607 !! text
11608 {{loop1}}
11609 !! endarticle
11610
11611 !! test
11612 Template infinite loop
11613 !! wikitext
11614 {{loop1}}
11615 !! html
11616 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11617 </p>
11618 !! end
11619
11620 !! test
11621 Template from main namespace
11622 !! wikitext
11623 {{:Main Page}}
11624 !! html
11625 <p>blah blah
11626 </p>
11627 !! end
11628
11629 !! test
11630 Template from non-includable namespace
11631 !! options
11632 wgNonincludableNamespaces=10
11633 !! wikitext
11634 {{echo|uh oh!}}
11635 !! html
11636 <p><a href="/wiki/Template:Echo" title="Template:Echo">Template:Echo</a>
11637 </p>
11638 !! end
11639
11640 !! article
11641 Template:table
11642 !! text
11643 {|
11644 | 1 || 2
11645 |-
11646 | 3 || 4
11647 |}
11648 !! endarticle
11649
11650 !! test
11651 T2529: Template with table, not included at beginning of line
11652 !! wikitext
11653 foo {{table}}
11654 !! html
11655 <p>foo
11656 </p>
11657 <table>
11658 <tr>
11659 <td>1</td>
11660 <td>2
11661 </td></tr>
11662 <tr>
11663 <td>3</td>
11664 <td>4
11665 </td></tr></table>
11666
11667 !! end
11668
11669 !! test
11670 T2523: Template shouldn't eat newline (or add an extra one before table)
11671 !! wikitext
11672 foo
11673 {{table}}
11674 !! html
11675 <p>foo
11676 </p>
11677 <table>
11678 <tr>
11679 <td>1</td>
11680 <td>2
11681 </td></tr>
11682 <tr>
11683 <td>3</td>
11684 <td>4
11685 </td></tr></table>
11686
11687 !! end
11688
11689 !! test
11690 T2041: Template parameters shown as broken links
11691 !! wikitext
11692 {{{parameter}}}
11693 !! html
11694 <p>{{{parameter}}}
11695 </p>
11696 !! end
11697
11698 !! test
11699 Template with targets containing wikilinks
11700 !! options
11701 parsoid=wt2html
11702 !! wikitext
11703 {{[[foo]]}}
11704
11705 {{[[{{echo|foo}}]]}}
11706
11707 {{{{echo|[[foo}}]]}}
11708 !! html/php
11709 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11710 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11711 </p><p>{{[[foo}}]]
11712 </p>
11713 !! html/parsoid
11714 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11715 <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>
11716 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11717 !! end
11718
11719 !! article
11720 Template:''
11721 !! text
11722 bar
11723 !! endarticle
11724
11725 !! test
11726 Templates: Double quotes as template target
11727 !! wikitext
11728 foo {{''}} baz
11729 !! html/php
11730 <p>foo bar baz
11731 </p>
11732 !! html/parsoid
11733 <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
11734 </p>
11735 !! end
11736
11737 ## This test is about making sure Parsoid's data-mw is well formed in the
11738 ## face of multiple templates with intersecting and overlapping ranges. The
11739 ## wikitext itself is wretched.
11740 !! test
11741 Templates with intersecting and overlapping ranges
11742 !! wikitext
11743 {|{{echo|
11744 <p>ha</p>}}
11745 {|{{echo|
11746 <p>ho</p>}}
11747 {{echo|{{!}}hi}}
11748 |}
11749 !! html/php+tidy
11750 <p>ha</p><table>
11751
11752 </table><p>ho</p><table>
11753
11754 <tbody><tr>
11755 <td>hi
11756 </td></tr></tbody></table>
11757 !! html/parsoid
11758 <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":""}]]}'>
11759
11760 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11761
11762 <tbody><tr><td>hi</td></tr>
11763 </tbody></table>
11764 !! end
11765
11766 !! article
11767 Template:MSGNW test
11768 !! text
11769 ''None'' of '''this''' should be
11770 * interpreted
11771 but rather passed unmodified
11772 {{test}}
11773 <gallery>
11774 File:Foobar.jpg
11775 </gallery>
11776 <!-- comment -->
11777 !! endarticle
11778
11779 # hmm, fix this or just deprecate msgnw and document its behavior?
11780 !! test
11781 msgnw keyword
11782 !! wikitext
11783 {{msgnw:MSGNW test}}
11784 !! html/php
11785 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11786 &#42; interpreted
11787 &#32;but rather passed unmodified
11788 &#123;&#123;test&#125;&#125;
11789 &#60;gallery&#62;
11790 File:Foobar.jpg
11791 &#60;/gallery&#62;
11792 &#60;!-- comment --&#62;
11793 </p>
11794 !! end
11795
11796 !! test
11797 int keyword
11798 !! wikitext
11799 {{int:youhavenewmessages|lots of money|not!}}
11800 !! html
11801 <p>You have lots of money (not!).
11802 </p>
11803 !! end
11804
11805 !! test
11806 int keyword - non-existing message
11807 !! wikitext
11808 {{int:var}}
11809 !! html
11810 <p>⧼var⧽
11811 </p>
11812 !! end
11813
11814 !! article
11815 Template:Includes
11816 !! text
11817 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11818 !! endarticle
11819
11820 !! test
11821 <includeonly> and <noinclude> being included
11822 !! wikitext
11823 {{Includes}}
11824 !! html
11825 <p>Foobar
11826 </p>
11827 !! end
11828
11829 !! article
11830 Template:Includes2
11831 !! text
11832 <onlyinclude>Foo</onlyinclude>bar
11833 !! endarticle
11834
11835 !! test
11836 <onlyinclude> being included
11837 !! wikitext
11838 {{Includes2}}
11839 !! html
11840 <p>Foo
11841 </p>
11842 !! end
11843
11844
11845 !! article
11846 Template:Includes3
11847 !! text
11848 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11849 !! endarticle
11850
11851 !! test
11852 <onlyinclude> and <includeonly> being included
11853 !! wikitext
11854 {{Includes3}}
11855 !! html
11856 <p>Foo
11857 </p>
11858 !! end
11859
11860 !! test
11861 <includeonly> and <noinclude> on a page
11862 !! wikitext
11863 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11864 !! html
11865 <p>Foozar
11866 </p>
11867 !! end
11868
11869 !! test
11870 Un-closed <noinclude>
11871 !! wikitext
11872 <noinclude>
11873 !! html
11874 !! end
11875
11876 !! test
11877 <onlyinclude> on a page
11878 !! wikitext
11879 <onlyinclude>Foo</onlyinclude>bar
11880 !! html
11881 <p>Foobar
11882 </p>
11883 !! end
11884
11885 !! test
11886 Un-closed <onlyinclude>
11887 !! wikitext
11888 <onlyinclude>
11889 !! html
11890 !! end
11891
11892 !!test
11893 Self-closed noinclude, includeonly, onlyinclude tags
11894 !! wikitext
11895 <noinclude />
11896 <includeonly />
11897 <onlyinclude />
11898 !! html
11899 <p><br />
11900 </p>
11901 !!end
11902
11903 !!test
11904 Unbalanced includeonly and noinclude tags
11905 !! wikitext
11906 {|
11907 |a</noinclude>
11908 |b</noinclude></noinclude>
11909 |c</noinclude></includeonly>
11910 |d</includeonly></includeonly>
11911 |}
11912 !! html
11913 <table>
11914 <tr>
11915 <td>a
11916 </td>
11917 <td>b
11918 </td>
11919 <td>c&lt;/includeonly&gt;
11920 </td>
11921 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11922 </td></tr></table>
11923
11924 !!end
11925
11926 !! article
11927 Template:Includeonly section
11928 !! text
11929 <includeonly>
11930 ==Includeonly section==
11931 </includeonly>
11932 ==Section T-1==
11933 !!endarticle
11934
11935 !! test
11936 T8563: Edit link generation for section shown by <includeonly>
11937 !! wikitext
11938 {{includeonly section}}
11939 !! html
11940 <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>
11941 <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>
11942
11943 !! end
11944
11945 # Uses same input as the contents of [[Template:Includeonly section]]
11946 !! test
11947 T8563: Section extraction for section shown by <includeonly>
11948 !! options
11949 section=T-2
11950 !! wikitext
11951 <includeonly>
11952 ==Includeonly section==
11953 </includeonly>
11954 ==Section T-2==
11955 !! html
11956 ==Section T-2==
11957 !! end
11958
11959 !! test
11960 T8563: Edit link generation for section suppressed by <includeonly>
11961 !! wikitext
11962 <includeonly>
11963 ==Includeonly section==
11964 </includeonly>
11965 ==Section 1==
11966 !! html
11967 <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>
11968
11969 !! end
11970
11971 !! test
11972 T8563: Section extraction for section suppressed by <includeonly>
11973 !! options
11974 section=1
11975 !! wikitext
11976 <includeonly>
11977 ==Includeonly section==
11978 </includeonly>
11979 ==Section 1==
11980 !! html
11981 ==Section 1==
11982 !! end
11983
11984 !! test
11985 Un-closed <includeonly>
11986 !! wikitext
11987 <includeonly>
11988 !! html/php
11989 !! html/parsoid
11990 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11991 !! end
11992
11993 ## We used to, but no longer wt2wt this test since the default serializer
11994 ## will normalize the include directives to serialize on their own line.
11995 ## Selser will take care of preserving formatting in scenarios where they
11996 ## intermingled with other wikitext.
11997 !! test
11998 Includes and comments at SOL
11999 !! options
12000 parsoid=wt2html,html2html
12001 !! wikitext
12002 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
12003
12004 <noinclude>
12005 some
12006 </noinclude>*stuff
12007 *here
12008
12009 <includeonly>can have stuff</includeonly>===here===
12010
12011 !! html/php
12012 <h2><span class="mw-headline" id="hu">hu</span></h2>
12013 <p>some
12014 </p>
12015 <ul><li>stuff</li>
12016 <li>here</li></ul>
12017 <h3><span class="mw-headline" id="here">here</span></h3>
12018
12019 !! html/parsoid
12020 <!-- 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>
12021
12022 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12023 <p>some</p>
12024 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
12025 <li>here</li></ul>
12026
12027 <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>
12028
12029 !! end
12030
12031 # TODO: test with DOM fragment reuse!
12032 !! test
12033 Parsoid: DOM fragment reuse
12034 !! options
12035 parsoid=wt2wt,wt2html
12036 !! wikitext
12037 a{{echo|b<table></table>c}}d
12038
12039 a{{echo|b
12040 <table></table>
12041 c}}d
12042
12043 {{echo|a
12044
12045 <table></table>
12046
12047 b}}
12048 !! html
12049 <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>
12050
12051 <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">
12052 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
12053 </span><p about="#mwt2">cd</p>
12054
12055 <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">
12056
12057 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
12058
12059 </span><p about="#mwt3">b</p>
12060 !! end
12061
12062 !! test
12063 Parsoid: Merge double tds (T52603)
12064 !! options
12065 parsoid
12066 !! wikitext
12067 {|
12068 |{{echo|{{!}} foo}}
12069 |}
12070 !! html
12071 <table><tbody>
12072 <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>
12073 </tbody></table>
12074 !! end
12075
12076 !! test
12077 Parsoid: Merge double tds in nested transclusion content (T52603)
12078 !! options
12079 parsoid
12080 !! wikitext
12081 {{echo|<div>}}
12082 {|
12083 |{{echo|{{!}} foo}}
12084 |}
12085 {{echo|</div>}}
12086 !! html
12087 <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}}]}'>
12088 <table><tbody>
12089 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
12090 </tbody></table>
12091 </div>
12092 !! end
12093
12094 ###
12095 ### <includeonly> and <noinclude> in attributes
12096 ###
12097 !!test
12098 0. includeonly around the entire attribute
12099 !! wikitext
12100 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12101 !! html
12102 <p><span id="v2">bar</span>
12103 </p>
12104 !!end
12105
12106 !!test
12107 1. includeonly in html attr key
12108 !! wikitext
12109 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12110 !! html
12111 <p><span id="foo">bar</span>
12112 </p>
12113 !!end
12114
12115 !!test
12116 2. includeonly in html attr value
12117 !! wikitext
12118 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12119 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12120 !! html
12121 <p><span id="v1">bar</span>
12122 <span id="v1">bar</span>
12123 </p>
12124 !!end
12125
12126 !!test
12127 3. includeonly in part of an attr value
12128 !! wikitext
12129 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12130 !! html
12131 <p><span style="color:red;">bar</span>
12132 </p>
12133 !!end
12134
12135 !!test
12136 4. includeonly in table attributes
12137 !! wikitext
12138 {|
12139 |- <noinclude>
12140 |-
12141 |a
12142 </noinclude>
12143 |- <includeonly>
12144 |-
12145 |b
12146 </includeonly>
12147 |}
12148 !! html
12149 <table>
12150
12151
12152 <tr>
12153 <td>a
12154 </td></tr>
12155 </table>
12156
12157 !!end
12158
12159 ###
12160 ### Preprocessor precedence tests
12161 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12162 ###
12163 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12164 !! test
12165 Preprocessor precedence 1: link is rightmost opening
12166 !! options
12167 parsoid=wt2html
12168 !! wikitext
12169 {{[[Foo|bar}}]]
12170
12171 But close-brace is not a valid character in a link title:
12172 {{[[Foo}}|bar]]
12173
12174 However, we can still tell this was handled as a link in the preprocessor:
12175 {{echo|[[Foo}}|bar]]|bat}}
12176 !! html/php
12177 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12178 </p><p>But close-brace is not a valid character in a link title:
12179 {{[[Foo}}|bar]]
12180 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12181 [[Foo}}|bar]]
12182 </p>
12183 !! html/parsoid
12184 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12185 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12186 <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>
12187 !! end
12188
12189 !! test
12190 Preprocessor precedence 2: template is rightmost opening
12191 !! options
12192 language=zh
12193 !! wikitext
12194 -{{echo|foo}-}}-
12195 !! html/php
12196 <p>-foo}--
12197 </p>
12198 !! html/parsoid
12199 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12200 !! end
12201
12202 !! test
12203 Preprocessor precedence 3: language converter is rightmost opening
12204 !! options
12205 language=zh
12206 parsoid=wt2html
12207 !! wikitext
12208 {{echo|hi}}
12209
12210 {{-{R|echo|hi}}}-
12211
12212 [[-{R|raw]]}-
12213 !! html/php
12214 <p>hi
12215 </p><p>{{echo|hi}}
12216 </p><p>[[raw]]
12217 </p>
12218 !! html/parsoid
12219 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12220 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12221 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12222 !! end
12223
12224 !! test
12225 Preprocessor precedence 4: left-most angle bracket
12226 !! options
12227 language=zh
12228 !! wikitext
12229 <!--{raw}-->
12230 !! html/php
12231 !! html/parsoid
12232 <!--{raw}-->
12233 !! end
12234
12235 !! article
12236 Template:Precedence5
12237 !! text
12238 {{{{{1}}}}}
12239 !! endarticle
12240
12241 !! test
12242 Preprocessor precedence 5: tplarg takes precedence over template
12243 !! wikitext
12244 {{Precedence5|Bullet}}
12245 !! html/php
12246 <ul><li>Bar</li></ul>
12247
12248 !! html/parsoid
12249 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12250 !! end
12251
12252 !! test
12253 Preprocessor precedence 6: broken link is rightmost opening
12254 !! options
12255 parsoid=wt2html
12256 !! wikitext
12257 {{echo|[[Foo}}
12258
12259 {{echo|[[Foo|bar|bat=baz}}
12260 !! html/php
12261 <p>{{echo|[[Foo}}
12262 </p><p>{{echo|[[Foo|bar|bat=baz}}
12263 </p>
12264 !! html/parsoid
12265 <p>{{echo|[[Foo}}</p>
12266 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12267 !! end
12268
12269 # This next test exposes a difference between PHP and Parsoid:
12270 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12271 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12272 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12273 # outer `[[Foo` extends until the `y]]`
12274 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12275 # intermediate result (after template expansion), and link processing
12276 # happens on this intermediate result, which moves the wikilink
12277 # boundary leftward to `[[Foo|Bar]]`
12278 # 2b) Parsoid works in a single step, so it's going to keep the
12279 # wikilink as extending to the `y]]`
12280 # 3a) Then PHP does linktrail processing which slurps up the trailing
12281 # `xy` inside the link.
12282 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12283 # `z` inside the link.
12284 # This is "correct" behavior. Parsoid's basic worldview is that the
12285 # `]]` inside the template shouldn't be allowed to leak out to affect
12286 # the surrounding wikilink. PHP may match Parsoid (in the future)
12287 # if you use {{#balance}} (T114445).
12288
12289 !! test
12290 Preprocessor precedence 7: broken template is rightmost opening
12291 !! options
12292 parsoid=wt2html
12293 !! wikitext
12294 [[Foo|{{echo|Bar]]
12295
12296 [[Foo|{{echo|Bar]]-x}}-y]]-z
12297
12298 Careful: linktrails can move the end of the wikilink:
12299 [[Foo|{{echo|y']]a}}l]]l
12300 !! html/php
12301 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12302 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12303 </p><p>Careful: linktrails can move the end of the wikilink:
12304 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12305 </p>
12306 !! html/parsoid
12307 <p>[[Foo|{{echo|Bar]]</p>
12308 <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>
12309 <p>Careful: linktrails can move the end of the wikilink:
12310 <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>
12311 !! end
12312
12313 !! test
12314 Preprocessor precedence 8: broken language converter is rightmost opening
12315 !! options
12316 language=zh
12317 !! wikitext
12318 [[Foo-{R|raw]]
12319 !! html
12320 <p>[[Foo-{R|raw]]
12321 </p>
12322 !! end
12323
12324 !! article
12325 Template:Preprocessor_precedence_9
12326 !! text
12327 ;4: {{{{1}}}}
12328 ;5: {{{{{2}}}}}
12329 ;6: {{{{{{3}}}}}}
12330 ;7: {{{{{{{4}}}}}}}
12331 !! endarticle
12332
12333 !! test
12334 Preprocessor precedence 9: groups of braces
12335 !! wikitext
12336 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12337 !! html/php
12338 <dl><dt>4</dt>
12339 <dd>{Four}</dd>
12340 <dt>5</dt>
12341 <dd></dd></dl>
12342 <ul><li>Bar</li></ul>
12343 <dl><dt>6</dt>
12344 <dd>Four</dd>
12345 <dt>7</dt>
12346 <dd>{Bullet}</dd></dl>
12347
12348 !! html/parsoid
12349 <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}}]}'>
12350 <dt>4</dt>
12351 <dd>{Four}</dd>
12352 <dt>5</dt>
12353 <dd></dd>
12354 </dl><ul about="#mwt1">
12355 <li>Bar</li>
12356 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12357 <dt>6</dt>
12358 <dd>Four</dd>
12359 <dt>7</dt>
12360 <dd>{Bullet}</dd>
12361 </dl>
12362 !! end
12363
12364 !! article
12365 Template:Preprocessor_precedence_10
12366 !! text
12367 ;1: -{R|raw}-
12368 ;2: -{{Bullet}}-
12369 ;3: -{{{1}}}-
12370 ;4: -{{{{2}}}}-
12371 ;5: -{{{{{3}}}}}-
12372 ;6: -{{{{{{4}}}}}}-
12373 ;7: -{{{{{{{5}}}}}}}-
12374 !! endarticle
12375
12376 !! test
12377 Preprocessor precedence 10: groups of braces with leading dash
12378 !! options
12379 language=zh
12380 !! wikitext
12381 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12382 !! html/php
12383 <dl><dt>1</dt>
12384 <dd>raw</dd>
12385 <dt>2</dt>
12386 <dd>-</dd></dl>
12387 <ul><li>Bar-</li></ul>
12388 <dl><dt>3</dt>
12389 <dd>-Three-</dd>
12390 <dt>4</dt>
12391 <dd>raw2</dd>
12392 <dt>5</dt>
12393 <dd>-</dd></dl>
12394 <ul><li>Bar-</li></ul>
12395 <dl><dt>6</dt>
12396 <dd>-Three-</dd>
12397 <dt>7</dt>
12398 <dd>raw2</dd></dl>
12399
12400 !! html/parsoid
12401 <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}}]}'>
12402 <dt>1</dt>
12403 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12404 <dt>2</dt>
12405 <dd>-</dd>
12406 </dl><ul about="#mwt1">
12407 <li>Bar-</li>
12408 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12409 <dt>3</dt>
12410 <dd>-Three-</dd>
12411 <dt>4</dt>
12412 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12413 <dt>5</dt>
12414 <dd>-</dd>
12415 </dl><ul about="#mwt1">
12416 <li>Bar-</li>
12417 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12418 <dt>6</dt>
12419 <dd>-Three-</dd>
12420 <dt>7</dt>
12421 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12422 </dl>
12423 !! end
12424
12425 !! test
12426 Preprocessor precedence 11: found during visual diff testing
12427 !! wikitext
12428 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12429
12430 {{echo|-{{echo|-{{echo|x}}}}}}
12431
12432 {{echo|-{{echo|x}}}}
12433 !! html/php
12434 <p><span>-<span>-x</span></span>
12435 </p><p>--x
12436 </p><p>-x
12437 </p>
12438 !! html/parsoid
12439 <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>
12440
12441 <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>
12442
12443 <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>
12444 !! end
12445
12446 !! test
12447 Preprocessor precedence 12: broken language converter closed by brace.
12448 !! options
12449 parsoid=wt2html
12450 !! wikitext
12451 This form breaks the template, which is unfortunate:
12452 *{{echo|foo-{bar}bat}}
12453
12454 But if the broken language converter markup is inside an extension
12455 tag, nothing bad happens:
12456 *<nowiki>foo-{bar}bat</nowiki>
12457 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12458 *<pre>foo-{bar}bat</pre>
12459 *{{echo|<pre>foo-{bar}bat</pre>}}
12460
12461 <tag>foo-{bar}bat</tag>
12462 {{echo|<tag>foo-{bar}bat</tag>}}
12463
12464 !! html/php+tidy
12465 <p>This form breaks the template, which is unfortunate:
12466 </p>
12467 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12468 <p>But if the broken language converter markup is inside an extension
12469 tag, nothing bad happens:
12470 </p>
12471 <ul><li>foo-&#123;bar}bat</li>
12472 <li>foo-&#123;bar}bat</li>
12473 <li><pre>foo-{bar}bat</pre></li>
12474 <li><pre>foo-{bar}bat</pre></li></ul>
12475 <pre>'foo-{bar}bat'
12476 array (
12477 )
12478 </pre>
12479 <pre>'foo-{bar}bat'
12480 array (
12481 )
12482 </pre>
12483 !! html/parsoid
12484 <p>This form breaks the template, which is unfortunate:</p>
12485 <ul>
12486 <li>{{echo|foo-{bar}bat}}</li>
12487 </ul>
12488 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12489 <ul>
12490 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12491 <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>
12492 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12493 <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>
12494 </ul>
12495 <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>
12496 !! end
12497
12498 !! test
12499 Preprocessor precedence 13: broken language converter in external link
12500 !! options
12501 parsoid=wt2html
12502 !! wikitext
12503 *[http://example.com/-{foo Example in URL]
12504 *[http://example.com Example in -{link} description]
12505 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12506 !! html/php+tidy
12507 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12508 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12509 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12510 !! html/parsoid
12511 <ul>
12512 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12513 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12514 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12515 </ul>
12516 !! end
12517
12518 !! test
12519 Preprocessor precedence 14: broken language converter in comment
12520 !! wikitext
12521 *<!--{{foo}}-->...should be ok
12522 *<!---{{foo}}-->...extra dashes
12523 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12524 !! html/php+tidy
12525 <ul><li>...should be ok</li>
12526 <li>...extra dashes</li>
12527 <li>foobat...should be ok</li></ul>
12528 !! html/parsoid
12529 <ul>
12530 <li><!--{{foo}}-->...should be ok</li>
12531 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12532 <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>
12533 </ul>
12534 !! end
12535
12536 !! test
12537 Preprocessor precedence 15: broken brace markup in headings
12538 !! config
12539 wgFragmentMode=[ 'html5', 'legacy' ]
12540 !! options
12541 parsoid=wt2html
12542 !! wikitext
12543 __NOTOC__ __NOEDITSECTION__
12544 ===1 foo[bar 1===
12545 1
12546 ===2 foo[[bar 2===
12547 2
12548 ===3 foo{bar 3===
12549 3
12550 ===4 foo{{bar 4===
12551 4
12552 ===5 foo{{{bar 5===
12553 5
12554 ===6 foo-{bar 6===
12555 6
12556 !! html/php+tidy
12557 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12558 <p>1
12559 </p>
12560 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12561 <p>2
12562 </p>
12563 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12564 <p>3
12565 </p>
12566 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12567 <p>4
12568 </p>
12569 <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>
12570 <p>5
12571 </p>
12572 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12573 <p>6
12574 </p>
12575 !! html/parsoid
12576 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12577 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12578 <p>1</p>
12579 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12580 <p>2</p>
12581 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12582 <p>3</p>
12583 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12584 <p>4</p>
12585 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12586 <p>5</p>
12587 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12588 <p>6</p>
12589 !! end
12590
12591 !! test
12592 Preprocessor precedence 16: matching closing braces to opening braces
12593 !! options
12594 language=zh
12595 parsoid=wt2html
12596 !! wikitext
12597 -{{{echo|foo}}bar}-
12598 !! html/php
12599 <p>foobar
12600 </p>
12601 !! html/parsoid
12602 <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>
12603 !! end
12604
12605 !! test
12606 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12607 !! options
12608 parsoid=wt2html
12609 !! wikitext
12610 {{echo|hi {{}}}}
12611 !! html/php
12612 <p>hi {{}}
12613 </p>
12614 !! html/parsoid
12615 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12616 !! end
12617
12618 !! test
12619 Preprocessor precedence 18: another rightmost wins scenario
12620 !! options
12621 parsoid=wt2html
12622 !! wikitext
12623 {{ -{{{{1|tplarg}}} }} }-
12624 !! html/php
12625 <p>{{ -{tplarg }} }-
12626 </p>
12627 !! html/parsoid
12628 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12629 !! end
12630
12631 !! test
12632 Preprocessor precedence 19: break syntax
12633 !! options
12634 parsoid=wt2html
12635 !! wikitext
12636 -{{
12637 !! html/php
12638 <p>-{{
12639 </p>
12640 !! html/parsoid
12641 <p>-{{</p>
12642 !! end
12643
12644 ###
12645 ### Token Stream Patcher tests
12646 ###
12647 ### These tests won't always pass wt2wt and other modes because
12648 ### on serialization, the table will be output on a new line.
12649 ### For now, we are blacklisting them, and using this to test selser.
12650 ###
12651
12652 !!test
12653 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12654 !!options
12655 parsoid=wt2html,wt2wt
12656 !!wikitext
12657 {{echo|}}{| width = '100%'
12658 |foo
12659 |}
12660 !!html/parsoid
12661 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12662 <tbody><tr><td>foo</td></tr>
12663 </tbody></table>
12664 !!end
12665
12666 ## We used to, but no longer wt2wt this test since the default serializer
12667 ## will normalize the include directives to serialize on their own line.
12668 ## Selser will take care of preserving formatting in scenarios where they
12669 ## intermingled with other wikitext.
12670 !!test
12671 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12672 !!options
12673 parsoid=wt2html
12674 !!wikitext
12675 <includeonly>a</includeonly>{| {{{b}}}
12676 |c
12677 |}
12678 !!html/parsoid
12679 <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":""}]]}'>
12680 <tbody><tr><td>c</td></tr>
12681 </tbody></table>
12682 !!end
12683
12684 !! test
12685 Table wikitext syntax outside wiki-tables
12686 !! wikitext
12687 a
12688 |+ not a caption
12689 ! not a table heading
12690 |- not a table row
12691 | not a table cell
12692 | class="foo bar" | baz
12693 b
12694 |}
12695 |-
12696 c
12697 !! html
12698 <p>a
12699 |+ not a caption
12700 ! not a table heading
12701 |- not a table row
12702 | not a table cell
12703 | class="foo bar" | baz
12704 b
12705 |}
12706 |-
12707 c
12708 </p>
12709 !! end
12710
12711 ###
12712 ### Testing parsing of templates where a template arg
12713 ### has the same name as the template itself.
12714 ###
12715
12716 !! article
12717 Template:quote
12718 !! text
12719 {{{quote|{{{1}}}}}}
12720 !! endarticle
12721
12722 !!test
12723 Templates: Template Name/Arg clash: 1. Use of positional param
12724 !! wikitext
12725 {{quote|foo}}
12726 !! html
12727 <p>foo
12728 </p>
12729 !!end
12730
12731 !!test
12732 Templates: Template Name/Arg clash: 2. Use of named param
12733 !! wikitext
12734 {{quote|quote=foo}}
12735 !! html
12736 <p>foo
12737 </p>
12738 !!end
12739
12740 !!test
12741 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12742 !! wikitext
12743 {{quote|quote}}
12744 !! html
12745 <p>quote
12746 </p>
12747 !!end
12748
12749 ###
12750 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12751 ###
12752
12753 !!test
12754 Templates: 1. Simple use
12755 !! wikitext
12756 {{echo|Foo}}
12757 !! html
12758 <p>Foo
12759 </p>
12760 !!end
12761
12762 !!test
12763 Templates: 2. Inside a block tag
12764 !! wikitext
12765 <div>{{echo|Foo}}</div>
12766 <blockquote>{{echo|Foo}}</blockquote>
12767 !! html
12768 <div>Foo</div>
12769 <blockquote>Foo</blockquote>
12770
12771 !! html+tidy
12772 <div>Foo</div>
12773 <blockquote><p>Foo</p></blockquote>
12774 !!end
12775
12776 !!test
12777 Templates: P-wrapping: 1a. Templates on consecutive lines
12778 !! wikitext
12779 {{echo|Foo}}
12780 {{echo|bar}}
12781 !! html
12782 <p>Foo
12783 bar
12784 </p>
12785 !!end
12786
12787 !!test
12788 Templates: P-wrapping: 1b. Templates on consecutive lines
12789 !! wikitext
12790 Foo
12791
12792 {{echo|bar}}
12793 {{echo|baz}}
12794 !! html
12795 <p>Foo
12796 </p><p>bar
12797 baz
12798 </p>
12799 !!end
12800
12801 !!test
12802 Templates: P-wrapping: 1c. Templates on consecutive lines
12803 !! wikitext
12804 {{echo|Foo}}
12805 {{echo|bar}} <div>baz</div>
12806 !! html
12807 <p>Foo
12808 </p>
12809 bar <div>baz</div>
12810
12811 !! html+tidy
12812 <p>Foo
12813 </p><p>
12814 bar </p><div>baz</div>
12815 !! end
12816
12817 !!test
12818 Templates: P-wrapping: 1d. Template preceded by comment-only line
12819 !!options
12820 parsoid
12821 !! wikitext
12822 <!-- foo -->
12823 {{echo|Bar}}
12824 !! html
12825 <!-- foo -->
12826
12827 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12828 !!end
12829
12830 !!test
12831 Templates: Inline Text: 1. Multiple template uses
12832 !! wikitext
12833 {{echo|Foo}}bar{{echo|baz}}
12834 !! html
12835 <p>Foobarbaz
12836 </p>
12837 !!end
12838
12839 !!test
12840 Templates: Inline Text: 2. Back-to-back template uses
12841 !! wikitext
12842 {{echo|Foo}}{{echo|bar}}
12843 !! html
12844 <p>Foobar
12845 </p>
12846 !!end
12847
12848 !!test
12849 Templates: Block Tags: 1. Multiple template uses
12850 !! wikitext
12851 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12852 !! html
12853 <div>Foo</div><div>bar</div><div>baz</div>
12854
12855 !!end
12856
12857 !!test
12858 Templates: Block Tags: 2. Back-to-back template uses
12859 !! wikitext
12860 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12861 !! html
12862 <div>Foo</div><div>bar</div>
12863
12864 !!end
12865
12866 ## This is an edge case relating to paragraph wrapping.
12867 ## Note that Parsoid fails to match Remex because it's using the closing tag
12868 ## as a heuristic to determine if it's in a block, rather than SAX based events.
12869 !! test
12870 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12871 !! wikitext
12872 {{echo|a
12873 b</p>}}
12874 !! html/php+tidy
12875 <p>a
12876 </p><p>
12877 b</p><p class="mw-empty-elt"></p>
12878 !! html/parsoid
12879 <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">
12880 </span><span about="#mwt1">b</span><p about="#mwt1" data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
12881 !! end
12882
12883 !!test
12884 Templates: Links: 1. Simple example
12885 !! wikitext
12886 {{echo|[[Foo|bar]]}}
12887 !! html
12888 <p><a href="/wiki/Foo" title="Foo">bar</a>
12889 </p>
12890 !!end
12891
12892 !!test
12893 Templates: Links: 2. Generation of link href
12894 !! wikitext
12895 [[{{echo|Foo}}|bar]]
12896 !! html
12897 <p><a href="/wiki/Foo" title="Foo">bar</a>
12898 </p>
12899 !!end
12900
12901 !!test
12902 Templates: Links: 3. Generation of part of a link href
12903 !! wikitext
12904 [[Fo{{echo|o}}|bar]]
12905
12906 [[Foo{{echo|bar}}]]
12907
12908 [[Foo{{echo|bar}}baz]]
12909
12910 [[Foo{{echo|bar}}|bar]]
12911
12912 [[:Foo{{echo|bar}}]]
12913
12914 [[:Foo{{echo|bar}}|bar]]
12915 !! html
12916 <p><a href="/wiki/Foo" title="Foo">bar</a>
12917 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12918 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12919 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12920 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12921 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12922 </p>
12923 !!end
12924
12925 !!test
12926 Templates: Links: 4. Multiple templates generating link href
12927 !! wikitext
12928 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12929 !! html
12930 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12931 </p>
12932 !!end
12933
12934 !!test
12935 Templates: Links: 5. Generation of link text
12936 !! wikitext
12937 [[Foo|{{echo|bar}}]]
12938 !! html
12939 <p><a href="/wiki/Foo" title="Foo">bar</a>
12940 </p>
12941 !!end
12942
12943 !!test
12944 Templates: Links: 5. Nested templates (only outermost template should be marked)
12945 !! wikitext
12946 {{echo|[[{{echo|Foo}}|bar]]}}
12947 !! html
12948 <p><a href="/wiki/Foo" title="Foo">bar</a>
12949 </p>
12950 !!end
12951
12952 !!test
12953 Templates: HTML Tag: 1. Generation of HTML attr. key
12954 !! wikitext
12955 <div {{echo|style}}="color:red;">foo</div>
12956 !! html
12957 <div style="color:red;">foo</div>
12958
12959 !!end
12960
12961 !!test
12962 Templates: HTML Tag: 2. Generation of HTML attr. value
12963 !! wikitext
12964 <div style={{echo|'color:red;'}}>foo</div>
12965 !! html
12966 <div style="color:red;">foo</div>
12967
12968 !!end
12969
12970 !!test
12971 Templates: HTML Tag: 3. Generation of HTML attr key and value
12972 !! wikitext
12973 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12974 !! html
12975 <div style="color:red;">foo</div>
12976
12977 !!end
12978
12979 !!test
12980 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12981 !! wikitext
12982 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12983 !! html
12984 <div title="This is a long title with just one piece templated">foo</div>
12985
12986 !!end
12987
12988 !!test
12989 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12990 !! wikitext
12991 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12992 !! html
12993 <div title="This is a long title with just one piece templated">foo</div>
12994
12995 !!end
12996
12997 !!test
12998 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12999 !! wikitext
13000 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
13001 !! html
13002 <div title="This is a long title with just one piece templated">foo</div>
13003
13004 !!end
13005
13006 # SSS FIXME: While it is great we added support for all this,
13007 # do we want to make this part of the spec? Maybe we want to
13008 # deprecate this kind of usage in the future?
13009 !!test
13010 Templates: HTML Tag: 7. Generation of partial attribute key string
13011 !! wikitext
13012 <div st{{echo|yle}}="color:red;">foo</div>
13013 !! html
13014 <div style="color:red;">foo</div>
13015
13016 !!end
13017
13018 !! test
13019 Templates: HTML Tag: 8. Template-generated attribute (k=v)
13020 !! wikitext
13021 <div {{echo|1=id="v1"}}>bar</div>
13022 !! html
13023 <div id="v1">bar</div>
13024
13025 !!end
13026
13027 !! test
13028 Templates: HTML Tag: 9. Multiple template-generated attributes
13029 !! wikitext
13030 <div {{echo|1=id="v1" title="foo"}}>bar</div>
13031 !! html
13032 <div id="v1" title="foo">bar</div>
13033
13034 !!end
13035
13036 !! test
13037 Templates: Support for templates generating attributes and content
13038 !! wikitext
13039 {| {{mixed_attr_content_template}}
13040 |-
13041 |bar
13042 |}
13043 !! html/php
13044 <table style="color:red;" title="T48811">
13045
13046 <tr>
13047 <td>foo
13048 </td></tr>
13049 <tr>
13050 <td>bar
13051 </td></tr></table>
13052
13053 !! html/parsoid
13054 <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|}"]}'>
13055 <tbody><tr>
13056 <td>foo</td></tr>
13057 <tr>
13058 <td>bar</td></tr>
13059 </tbody></table>
13060 !!end
13061
13062 !! article
13063 Template:attribute_from_template
13064 !! text
13065 class="123"
13066 !! endarticle
13067
13068 !! test
13069 Table cell with attribute before expanded attribute
13070 !! wikitext
13071 {|
13072 | align="center" {{attribute_from_template}} |456
13073 |}
13074 !! html/parsoid
13075 <table>
13076 <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>
13077 </tbody></table>
13078 !! end
13079
13080 !! test
13081 1. Entities and nowikis inside templated attributes should be handled correctly
13082 !! wikitext
13083 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
13084 !! html/php
13085 <div style="background:#f9f9f9;">foo</div>
13086
13087 !! html/parsoid
13088 <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>
13089 !! end
13090
13091 !! test
13092 2. Entities and nowikis inside templated attributes should be handled correctly
13093 !! wikitext
13094 {|
13095 |{{table_attribs_3}}
13096 |}
13097 !! html/php
13098 <table>
13099 <tr>
13100 <td style="background:#f9f9f9;">Foo
13101 </td></tr></table>
13102
13103 !! html/parsoid
13104 <table>
13105 <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>
13106 </tbody></table>
13107 !! end
13108
13109 !! test
13110 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13111 !! wikitext
13112 {{tbl-start}}
13113 |{{table_attribs_3}}
13114 {{tbl-end}}
13115 !! html/php
13116 <table>
13117 <tr>
13118 <td style="background:#f9f9f9;">Foo
13119 </td></tr></table>
13120
13121 !! html/parsoid
13122 <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}}]}'>
13123 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
13124 </tbody></table>
13125 !! end
13126
13127 # T107622
13128 !! test
13129 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13130 !! wikitext
13131 {|
13132 |{{table_attribs_6}} hi
13133 |}
13134 !! html/php
13135 <table>
13136 <tr>
13137 <td style="background: red;">hi
13138 </td></tr></table>
13139
13140 !! html/parsoid
13141 <table>
13142 <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>
13143 </tbody></table>
13144 !! end
13145
13146 !!test
13147 Templates: HTML Tables: 1. Generating start of a HTML table
13148 !! wikitext
13149 {{echo|<table><tr><td>foo</td>}}</tr></table>
13150 !! html
13151 <table><tr><td>foo</td></tr></table>
13152
13153 !!end
13154
13155 !!test
13156 Templates: HTML Tables: 2a. Generating middle of a HTML table
13157 !! wikitext
13158 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13159 !! html
13160 <table><tr><td>foo</td></tr></table>
13161
13162 !!end
13163
13164 !!test
13165 Templates: HTML Tables: 2b. Generating middle of a HTML table
13166 !! wikitext
13167 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13168 !! html
13169 <table><tr><td>foo</td></tr></table>
13170
13171 !!end
13172
13173 !!test
13174 Templates: HTML Tables: 3. Generating end of a HTML table
13175 !! wikitext
13176 <table><tr>{{echo|<td>foo</td></tr></table>}}
13177 !! html
13178 <table><tr><td>foo</td></tr></table>
13179
13180 !!end
13181
13182 !!test
13183 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13184 !! wikitext
13185 {{echo|<table>}}<tr><td>foo</td></tr></table>
13186 !! html
13187 <table><tr><td>foo</td></tr></table>
13188
13189 !!end
13190
13191 !!test
13192 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13193 !! wikitext
13194 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13195 !! html
13196 <table><tr><td>foo</td></tr></table>
13197
13198 !!end
13199
13200 !!test
13201 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13202 !! wikitext
13203 <table><tr>{{echo|<td>}}foo</td></tr></table>
13204 !! html
13205 <table><tr><td>foo</td></tr></table>
13206
13207 !!end
13208
13209 !!test
13210 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13211 !! wikitext
13212 <table><tr><td>foo{{echo|</td>}}</tr></table>
13213 !! html
13214 <table><tr><td>foo</td></tr></table>
13215
13216 !!end
13217
13218 !!test
13219 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13220 !! wikitext
13221 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13222 !! html
13223 <table><tr><td>foo</td></tr></table>
13224
13225 !!end
13226
13227 !!test
13228 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13229 !! wikitext
13230 <table><tr><td>foo</td></tr>{{echo|</table>}}
13231 !! html
13232 <table><tr><td>foo</td></tr></table>
13233
13234 !!end
13235
13236 !!test
13237 Templates: HTML Tables: 5. Proper fostering of categories from inside
13238 !!options
13239 parsoid=wt2html,wt2wt
13240 !! wikitext
13241 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13242 <!--Two categories (T52330)-->
13243 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13244 !! html
13245 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13246 <!--Two categories (T52330)-->
13247 <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>
13248 !!end
13249
13250 !! test
13251 Templates: Wiki Tables: 1a. Fostering of entire template content
13252 !! wikitext
13253 {|
13254 {{echo|a}}
13255 |}
13256 !! html/php
13257 <table>
13258 a
13259 <tr><td></td></tr></table>
13260
13261 !! html/php+tidy
13262
13263 a
13264 <table><tbody><tr><td></td></tr></tbody></table>
13265 !! html/parsoid
13266 <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">
13267
13268 </table>
13269 !! end
13270
13271 !!test
13272 Templates: Wiki Tables: 1b. Fostering of entire template content
13273 !! wikitext
13274 {|
13275 {{echo|<div>}}
13276 foo
13277 {{echo|</div>}}
13278 |}
13279 !! html
13280 <table>
13281 <div>
13282 <p>foo
13283 </p>
13284 </div>
13285 <tr><td></td></tr></table>
13286
13287 !! html/php+tidy
13288 <div>
13289 <p>foo
13290 </p>
13291 </div><table>
13292
13293 <tbody><tr><td></td></tr></tbody></table>
13294 !! html/parsoid
13295 <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|}"]}'>
13296 <p>foo</p>
13297 </div><table about="#mwt3">
13298
13299 </table>
13300 !! end
13301
13302 !! test
13303 Templates: Wiki Tables: 2. Fostering of partial template content
13304 !! wikitext
13305 {|
13306 {{echo|a
13307 <div>b</div>}}
13308 |}
13309 !! html/php
13310 <table>
13311 a
13312 <div>b</div>
13313 <tr><td></td></tr></table>
13314
13315 !! html/php+tidy
13316
13317 a
13318 <div>b</div><table>
13319 <tbody><tr><td></td></tr></tbody></table>
13320 !! html/parsoid
13321 <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">
13322
13323
13324 </table>
13325 !! end
13326
13327 !!test
13328 Templates: Wiki Tables: 3. td-content via multiple templates
13329 !! wikitext
13330 {|
13331 {{echo|{{pipe}}a}}{{echo|b}}
13332 |}
13333 !! html
13334 <table>
13335 <tr>
13336 <td>ab
13337 </td></tr></table>
13338
13339 !!end
13340
13341 !!test
13342 Templates: Wiki Tables: 4. Templated tags, no content
13343 !! wikitext
13344 {{tbl-start}}
13345 {{tbl-end}}
13346 !! html
13347 <table>
13348 <tr><td></td></tr></table>
13349
13350 !!end
13351
13352 !!test
13353 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13354 !! wikitext
13355 {{tbl-start}}
13356 |foo
13357 {{tbl-end}}
13358 !! html
13359 <table>
13360 <tr>
13361 <td>foo
13362 </td></tr></table>
13363
13364 !!end
13365
13366 !!test
13367 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13368 !! wikitext
13369 {{tbl-start}}
13370 {{!}}foo
13371 {{tbl-end}}
13372 !! html
13373 <table>
13374 <tr>
13375 <td>foo
13376 </td></tr></table>
13377
13378 !!end
13379
13380 ## This test case is very specific to Parsoid's internals
13381 ## and is hence only tested for Parsoid's code. Parsoid uses
13382 ## a <meta> marker tag for <ref> tags and they are expanded
13383 ## much later. We are verifying that this <meta> tag usage
13384 ## doesn't prevent foster parenting.
13385 !!test
13386 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13387 !!wikitext
13388 {{PartialTable}}<ref>foo</ref>
13389 |}
13390
13391 <references />
13392 !!html/parsoid
13393 <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">
13394 <tbody>
13395 </tbody></table>
13396
13397 <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>
13398 !!end
13399
13400 !! test
13401 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13402 !! wikitext
13403 {{echo|
13404 {{{!}}
13405 {{!}}-}}
13406 <onlyinclude>
13407 |foo
13408 </onlyinclude>
13409 {{!}}}
13410 !! html/parsoid
13411 <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{{!}}}"]}'>
13412 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13413 <tbody><tr>
13414
13415 <td>foo
13416 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13417 </tbody></table>
13418 !! end
13419
13420 !!test
13421 Templates: Lists: Multi-line list-items via templates
13422 !! wikitext
13423 *{{echo|a {{nonexistent|
13424 unused}}}}
13425 *{{echo|b {{nonexistent|
13426 unused}}}}
13427 !! html
13428 <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>
13429 <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>
13430
13431 !!end
13432
13433 !!test
13434 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13435 !! wikitext
13436 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13437 !! html
13438 <p><i>ab</i>c<i>d</i>e
13439 </p>
13440 !!end
13441
13442 !!test
13443 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13444 (PHP parser generates misnested html)
13445 !! wikitext
13446 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13447 !! html/parsoid
13448 <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>
13449 !!end
13450
13451 !!test
13452 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13453 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13454 !! options
13455 parsoid=wt2html,wt2wt
13456 !! wikitext
13457 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13458 !! html
13459 <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>
13460 <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>
13461 <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>
13462 !!end
13463
13464 !!test
13465 Templates: Ugly nesting: 4. Divs opened/closed across templates
13466 !! wikitext
13467 a<div>b{{echo|c</div>d}}e
13468 !! html
13469 a<div>bc</div>de
13470
13471 !! html+tidy
13472 <p>a</p><div>bc</div><p>de
13473 </p>
13474 !! end
13475
13476 !! test
13477 Templates: Ugly templates: 3. newline-only template parameter
13478 !! wikitext
13479 foo {{echo|
13480 }}
13481 !! html
13482 <p>foo
13483 </p>
13484 !! end
13485
13486 # This looks like a bug: a single newline triggers p/br for some reason.
13487 !! test
13488 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13489 !! wikitext
13490 {{echo|
13491 }}
13492 !! html
13493 <p><br />
13494 </p>
13495 !! end
13496
13497 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13498 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13499 !! test
13500 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13501 !! wikitext
13502 {{echo|<table>}}
13503 {{echo|<div>foo}}
13504 {{echo|</table>}}
13505 !! html/parsoid
13506 <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
13507 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13508 </table>
13509 !! end
13510
13511 # T66017 -- ugly wikitext with fostered content generates two template ranges
13512 # that are "identical" and generate nesting cycles in the algorithm
13513 !! test
13514 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13515 !! wikitext
13516 {{echo|<table><tr><td><table>}}
13517 {{echo|<div>}}
13518 {{echo|</div>}}
13519 !! html/parsoid
13520 <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"}'>
13521 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13522 </table></td></tr></tbody></table>
13523 !! end
13524
13525 !! test
13526 Templates: Parameters substituted at the top-level
13527 !! wikitext
13528 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13529
13530 {{{foo|bar|baz}}}
13531 !! html/php
13532 <p><i>who</i> me? <b>never!</b>
13533 </p><p>bar
13534 </p>
13535 !! html/parsoid
13536 <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>
13537
13538 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13539 !! end
13540
13541 !! test
13542 Templates: Param with empty arg in the final position
13543 !! wikitext
13544 {{{hi|}}}
13545 !! html/parsoid
13546 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13547 !! end
13548
13549 !!test
13550 Parser Functions: 1. Simple example
13551 !! wikitext
13552 {{uc:foo}}
13553 !! html
13554 <p>FOO
13555 </p>
13556 !!end
13557
13558 !!test
13559 Parser Functions: 2. Nested use (only outermost should be marked up)
13560 !! wikitext
13561 {{uc:{{lc:FOO}}}}
13562 !! html
13563 <p>FOO
13564 </p>
13565 !!end
13566
13567 ## Note that the templates inside the references are not wrapped
13568 !! test
13569 Template nested in extension tag in template
13570 !! wikitext
13571 {{echo|hi<ref>[[ho|{{echo|hi}}]]</ref>}}
13572 {{echo|hi<ref>[http://test.com?q={{echo|ho}}]</ref>}}
13573 <references />
13574 !! html/parsoid
13575 <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>
13576 <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>
13577 <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>
13578 !! end
13579
13580 ###
13581 ### Pre-save transform tests
13582 ###
13583 !! test
13584 pre-save transform: subst:
13585 !! options
13586 pst
13587 !! wikitext
13588 {{subst:test}}
13589 !! html/php
13590 This is a test template
13591 !! end
13592
13593 !! test
13594 pre-save transform: normal template
13595 !! options
13596 pst
13597 !! wikitext
13598 {{test}}
13599 !! html/php
13600 {{test}}
13601 !! end
13602
13603 !! test
13604 pre-save transform: nonexistent template
13605 !! options
13606 pst
13607 !! wikitext
13608 {{thistemplatedoesnotexist}}
13609 !! html/php
13610 {{thistemplatedoesnotexist}}
13611 !! end
13612
13613 !! test
13614 pre-save transform: subst magic variables
13615 !! options
13616 pst
13617 !! wikitext
13618 {{subst:SITENAME}}
13619 !! html/php
13620 MediaWiki
13621 !! end
13622
13623 # This is T2089, which I fixed. -- wtm
13624 !! test
13625 pre-save transform: subst: templates with parameters
13626 !! options
13627 pst
13628 !! wikitext
13629 {{subst:paramtest|param="something else"}}
13630 !! html/php
13631 This is a test template with parameter "something else"
13632 !! end
13633
13634 !! article
13635 Template:nowikitest
13636 !! text
13637 <nowiki>'''not wiki'''</nowiki>
13638 !! endarticle
13639
13640 !! test
13641 pre-save transform: nowiki in subst (T3188)
13642 !! options
13643 pst
13644 !! wikitext
13645 {{subst:nowikitest}}
13646 !! html/php
13647 <nowiki>'''not wiki'''</nowiki>
13648 !! end
13649
13650 !! article
13651 Template:commenttest
13652 !! text
13653 This template has <!-- a comment --> in it.
13654 !! endarticle
13655
13656 !! test
13657 pre-save transform: comment in subst (T3936)
13658 !! options
13659 pst
13660 !! wikitext
13661 {{subst:commenttest}}
13662 !! html/php
13663 This template has <!-- a comment --> in it.
13664 !! end
13665
13666 !! test
13667 pre-save transform: unclosed tag
13668 !! options
13669 pst
13670 !! wikitext
13671 <nowiki>'''not wiki'''
13672 !! html/php
13673 <nowiki>'''not wiki'''
13674 !! end
13675
13676 !! test
13677 pre-save transform: mixed tag case
13678 !! options
13679 pst
13680 !! wikitext
13681 <NOwiki>'''not wiki'''</noWIKI>
13682 !! html/php
13683 <NOwiki>'''not wiki'''</noWIKI>
13684 !! end
13685
13686 !! test
13687 pre-save transform: unclosed comment in <nowiki>
13688 !! options
13689 pst
13690 !! wikitext
13691 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13692 !! html/php
13693 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13694 !!end
13695
13696 # Leading @ in this template definition works around a limitation
13697 # in parsoid's parserTests which otherwise strips the <span> from the
13698 # result (confusing it for a template wrapper)
13699 !! article
13700 Template:dangerous
13701 !!text
13702 @<span onmouseover="alert('crap')">Oh no</span>
13703 !!endarticle
13704
13705 !!test
13706 (confirming safety of fix for subst T3936)
13707 !! wikitext
13708 {{Template:dangerous}}
13709 !! html
13710 <p>@<span>Oh no</span>
13711 </p>
13712 !! end
13713
13714 !! test
13715 pre-save transform: comment containing gallery (T7024)
13716 !! options
13717 pst
13718 !! wikitext
13719 <!-- <gallery>data</gallery> -->
13720 !! html/php
13721 <!-- <gallery>data</gallery> -->
13722 !!end
13723
13724 !! test
13725 pre-save transform: comment containing extension
13726 !! options
13727 pst
13728 !! wikitext
13729 <!-- <tag>data</tag> -->
13730 !! html/php
13731 <!-- <tag>data</tag> -->
13732 !!end
13733
13734 !! test
13735 pre-save transform: comment containing nowiki
13736 !! options
13737 pst
13738 !! wikitext
13739 <!-- <nowiki>data</nowiki> -->
13740 !! html/php
13741 <!-- <nowiki>data</nowiki> -->
13742 !!end
13743
13744 !! test
13745 pre-save transform: <noinclude> in subst (T5298)
13746 !! options
13747 pst
13748 !! wikitext
13749 {{subst:Includes}}
13750 !! html/php
13751 Foobar
13752 !! end
13753
13754 !! test
13755 pre-save transform: <onlyinclude> in subst (T5298)
13756 !! options
13757 pst
13758 !! wikitext
13759 {{subst:Includes2}}
13760 !! html/php
13761 Foo
13762 !! end
13763
13764 !! article
13765 Template:SubstTest
13766 !!text
13767 {{<includeonly>subst:</includeonly>Includes}}
13768 !! endarticle
13769
13770 !! article
13771 Template:SafeSubstTest
13772 !! text
13773 {{<includeonly>safesubst:</includeonly>Includes}}
13774 !! endarticle
13775
13776 !! test
13777 T24297: safesubst: works during PST
13778 !! options
13779 pst
13780 !! wikitext
13781 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13782 !! html/php
13783 FoobarFoobar
13784 !! end
13785
13786 !! test
13787 T24297: safesubst: works during normal parse
13788 !! wikitext
13789 {{SafeSubstTest}}
13790 !! html
13791 <p>Foobar
13792 </p>
13793 !! end
13794
13795 !! test
13796 subst: does not work during normal parse
13797 !! wikitext
13798 {{SubstTest}}
13799 !! html
13800 <p>{{subst:Includes}}
13801 </p>
13802 !! end
13803
13804 !! test
13805 pre-save transform: context links ("pipe trick")
13806 !! options
13807 pst
13808 !! wikitext
13809 [[Article (context)|]]
13810 [[Bar:Article|]]
13811 [[:Bar:Article|]]
13812 [[Bar:Article (context)|]]
13813 [[:Bar:Article (context)|]]
13814 [[|Article]]
13815 [[|Article (context)]]
13816 [[Bar:X (Y) Z|]]
13817 [[:Bar:X (Y) Z|]]
13818 !! html/php
13819 [[Article (context)|Article]]
13820 [[Bar:Article|Article]]
13821 [[:Bar:Article|Article]]
13822 [[Bar:Article (context)|Article]]
13823 [[:Bar:Article (context)|Article]]
13824 [[Article]]
13825 [[Article (context)]]
13826 [[Bar:X (Y) Z|X (Y) Z]]
13827 [[:Bar:X (Y) Z|X (Y) Z]]
13828 !! end
13829
13830 !! test
13831 pre-save transform: context links ("pipe trick") with interwiki prefix
13832 !! options
13833 pst
13834 !! wikitext
13835 [[interwiki:Article|]]
13836 [[:interwiki:Article|]]
13837 [[interwiki:Bar:Article|]]
13838 [[:interwiki:Bar:Article|]]
13839 !! html/php
13840 [[interwiki:Article|Article]]
13841 [[:interwiki:Article|Article]]
13842 [[interwiki:Bar:Article|Bar:Article]]
13843 [[:interwiki:Bar:Article|Bar:Article]]
13844 !! end
13845
13846 !! test
13847 pre-save transform: context links ("pipe trick") with parens in title
13848 !! options
13849 pst title=[[Somearticle (context)]]
13850 !! wikitext
13851 [[|Article]]
13852 !! html/php
13853 [[Article (context)|Article]]
13854 !! end
13855
13856 !! test
13857 pre-save transform: context links ("pipe trick") with comma in title
13858 !! options
13859 pst title=[[Someplace, Somewhere]]
13860 !! wikitext
13861 [[|Otherplace]]
13862 [[Otherplace, Elsewhere|]]
13863 [[Otherplace, Elsewhere, Anywhere|]]
13864 !! html/php
13865 [[Otherplace, Somewhere|Otherplace]]
13866 [[Otherplace, Elsewhere|Otherplace]]
13867 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13868 !! end
13869
13870 !! test
13871 pre-save transform: context links ("pipe trick") with parens and comma
13872 !! options
13873 pst title=[[Someplace (IGNORED), Somewhere]]
13874 !! wikitext
13875 [[|Otherplace]]
13876 [[Otherplace (place), Elsewhere|]]
13877 !! html/php
13878 [[Otherplace, Somewhere|Otherplace]]
13879 [[Otherplace (place), Elsewhere|Otherplace]]
13880 !! end
13881
13882 !! test
13883 pre-save transform: context links ("pipe trick") with comma and parens
13884 !! options
13885 pst title=[[Who, me? (context)]]
13886 !! wikitext
13887 [[|Yes, you.]]
13888 [[Me, Myself, and I (1937 song)|]]
13889 !! html/php
13890 [[Yes, you. (context)|Yes, you.]]
13891 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13892 !! end
13893
13894 !! test
13895 pre-save transform: context links ("pipe trick") with namespace
13896 !! options
13897 pst title=[[Ns:Somearticle]]
13898 !! wikitext
13899 [[|Article]]
13900 !! html/php
13901 [[Ns:Article|Article]]
13902 !! end
13903
13904 !! test
13905 pre-save transform: context links ("pipe trick") with namespace and parens
13906 !! options
13907 pst title=[[Ns:Somearticle (context)]]
13908 !! wikitext
13909 [[|Article]]
13910 !! html/php
13911 [[Ns:Article (context)|Article]]
13912 !! end
13913
13914 !! test
13915 pre-save transform: context links ("pipe trick") with namespace and comma
13916 !! options
13917 pst title=[[Ns:Somearticle, Context, Whatever]]
13918 !! wikitext
13919 [[|Article]]
13920 !! html/php
13921 [[Ns:Article, Context, Whatever|Article]]
13922 !! end
13923
13924 !! test
13925 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13926 !! options
13927 pst title=[[Ns:Somearticle, Context (context)]]
13928 !! wikitext
13929 [[|Article]]
13930 !! html/php
13931 [[Ns:Article (context)|Article]]
13932 !! end
13933
13934 !! test
13935 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13936 !! options
13937 pst title=[[Ns:Somearticle (IGNORED), Context]]
13938 !! wikitext
13939 [[|Article]]
13940 !! html/php
13941 [[Ns:Article, Context|Article]]
13942 !! end
13943
13944 !! test
13945 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13946 !! options
13947 pst
13948 !! wikitext
13949 [[Article(context)|]]
13950 [[Bar:Article(context)|]]
13951 [[:Bar:Article(context)|]]
13952 [[|Article(context)]]
13953 [[Bar:X(Y)Z|]]
13954 [[:Bar:X(Y)Z|]]
13955 !! html/php
13956 [[Article(context)|Article]]
13957 [[Bar:Article(context)|Article]]
13958 [[:Bar:Article(context)|Article]]
13959 [[Article(context)]]
13960 [[Bar:X(Y)Z|X(Y)Z]]
13961 [[:Bar:X(Y)Z|X(Y)Z]]
13962 !! end
13963
13964 !! test
13965 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13966 !! options
13967 pst
13968 !! wikitext
13969 [[Article (context)|]]
13970 [[Bar:Article (context)|]]
13971 [[:Bar:Article (context)|]]
13972 [[|Article (context)]]
13973 [[Bar:X (Y) Z|]]
13974 [[:Bar:X (Y) Z|]]
13975 !! html/php
13976 [[Article (context)|Article]]
13977 [[Bar:Article (context)|Article]]
13978 [[:Bar:Article (context)|Article]]
13979 [[Article (context)]]
13980 [[Bar:X (Y) Z|X (Y) Z]]
13981 [[:Bar:X (Y) Z|X (Y) Z]]
13982 !! end
13983
13984 !! test
13985 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13986 !! options
13987 pst
13988 !! wikitext
13989 [[Article(context)|]]
13990 [[Bar:Article(context)|]]
13991 [[:Bar:Article(context)|]]
13992 [[|Article(context)]]
13993 [[Bar:X(Y)Z|]]
13994 [[:Bar:X(Y)Z|]]
13995 !! html/php
13996 [[Article(context)|Article]]
13997 [[Bar:Article(context)|Article]]
13998 [[:Bar:Article(context)|Article]]
13999 [[Article(context)]]
14000 [[Bar:X(Y)Z|X(Y)Z]]
14001 [[:Bar:X(Y)Z|X(Y)Z]]
14002 !! end
14003
14004 !! test
14005 pre-save transform: context links ("pipe trick") with commas (T23660)
14006 !! options
14007 pst
14008 !! wikitext
14009 [[Article (context), context|]]
14010 [[Article (context),context|]]
14011 [[Bar:Article (context), context|]]
14012 [[Bar:Article (context),context|]]
14013 [[:Bar:Article (context), context|]]
14014 [[:Bar:Article (context),context|]]
14015 !! html/php
14016 [[Article (context), context|Article]]
14017 [[Article (context),context|Article]]
14018 [[Bar:Article (context), context|Article]]
14019 [[Bar:Article (context),context|Article]]
14020 [[:Bar:Article (context), context|Article]]
14021 [[:Bar:Article (context),context|Article]]
14022 !! end
14023
14024 !! test
14025 Parsoid: backwards pipe trick
14026 !! wikitext
14027 [[|'''bar''']]
14028 !! html/php
14029 <p>[[|<b>bar</b>]]
14030 </p>
14031 !! html/parsoid
14032 <p>[[|<b>bar</b>]]</p>
14033 !! end
14034
14035 !! test
14036 pre-save transform: trim trailing empty lines
14037 !! options
14038 pst
14039 !! wikitext
14040 Empty lines are trimmed
14041
14042
14043
14044
14045 !! html/php
14046 Empty lines are trimmed
14047 !! end
14048
14049 !! test
14050 pre-save transform: Signature expansion
14051 !! options
14052 pst
14053 !! wikitext
14054 * ~~~
14055 * ~~~~
14056 * ~~~~~
14057 * <noinclude>~~~</noinclude>
14058 * <includeonly>~~~</includeonly>
14059 * <onlyinclude>~~~</onlyinclude>
14060 !! html/php
14061 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
14062 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14063 * 00:02, 1 January 1970 (UTC)
14064 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
14065 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
14066 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
14067 !! end
14068
14069
14070 !! test
14071 ParserOutput flags from signature expansion (T84843)
14072 !! options
14073 pst
14074 showflags
14075 !! wikitext
14076 ~~~~
14077 !! html/php
14078 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14079 flags=user-signature
14080 !! end
14081
14082
14083 !! test
14084 pre-save transform: Signature expansion in nowiki tags (T2093)
14085 !! options
14086 pst disabled
14087 !! wikitext
14088 Shall not expand:
14089
14090 <nowiki>~~~~</nowiki>
14091
14092 <includeonly><nowiki>~~~~</nowiki></includeonly>
14093
14094 <noinclude><nowiki>~~~~</nowiki></noinclude>
14095
14096 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14097
14098 {{subst:Foo}} shall be converted to FOO
14099
14100 As well as inside noinclude/onlyinclude
14101 <noinclude>{{subst:Foo}}</noinclude>
14102 <onlyinclude>{{subst:Foo}}</onlyinclude>
14103
14104 But not inside includeonly
14105 <includeonly>{{subst:Foo}}</includeonly>
14106 !! html/php
14107 Shall not expand:
14108
14109 <nowiki>~~~~</nowiki>
14110
14111 <includeonly><nowiki>~~~~</nowiki></includeonly>
14112
14113 <noinclude><nowiki>~~~~</nowiki></noinclude>
14114
14115 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14116
14117 FOO shall be converted to FOO
14118
14119 As well as inside noinclude/onlyinclude
14120 <noinclude>FOO</noinclude>
14121 <onlyinclude>FOO</onlyinclude>
14122
14123 But not inside includeonly
14124 <includeonly>{{subst:Foo}}</includeonly>
14125 !! end
14126
14127 !! test
14128 Parsoid: Recognize nowiki with trailing space in tags
14129 !! options
14130 parsoid=wt2html
14131 !! wikitext
14132 <nowiki ><div>[[foo]]</nowiki >
14133
14134 a<nowiki / >b
14135
14136 c<nowiki />d
14137
14138 e<nowiki/ >f
14139 !! html
14140 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14141 <p>ab</p>
14142 <p>cd</p>
14143 <p>ef</p>
14144 !! end
14145
14146 !! test
14147 Parsoid: Recognize nowiki with odd capitalization
14148 !! options
14149 parsoid=wt2html
14150 !! wikitext
14151 <noWikI ><div>[[foo]]</Nowiki >
14152 !! html
14153 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14154 !! end
14155
14156
14157 !! test
14158 Parsoid: Escape nowiki with trailing space in tags
14159 !! options
14160 parsoid=html2wt
14161 !! html/parsoid
14162 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14163 <p>a&lt;nowiki /&gt;b</p>
14164 <p>c&lt;nowiki/ &gt;d</p>
14165 !! wikitext
14166 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14167
14168 a&lt;nowiki /&gt;b
14169
14170 c&lt;nowiki/ &gt;d
14171 !! end
14172
14173 !! test
14174 Parsoid: Escape weird noWikI capitalizations
14175 !! options
14176 parsoid=html2wt
14177 !! html/parsoid
14178 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14179 !! wikitext
14180 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14181 !! end
14182
14183 ###
14184 ### Message transform tests
14185 ###
14186 !! test
14187 message transform: magic variables
14188 !! options
14189 msg
14190 !! wikitext
14191 {{SITENAME}}
14192 !! html
14193 MediaWiki
14194 !! end
14195
14196 !! test
14197 message transform: should not transform wiki markup
14198 !! options
14199 msg
14200 !! wikitext
14201 ''test''
14202 !! html
14203 ''test''
14204 !! end
14205
14206 !! test
14207 message transform: <noinclude> in transcluded template (T6926)
14208 !! options
14209 msg
14210 !! wikitext
14211 {{Includes}}
14212 !! html
14213 Foobar
14214 !! end
14215
14216 !! test
14217 message transform: <onlyinclude> in transcluded template (T6926)
14218 !! options
14219 msg
14220 !! wikitext
14221 {{Includes2}}
14222 !! html
14223 Foo
14224 !! end
14225
14226 !! test
14227 {{#special:}} page name, known
14228 !! options
14229 msg
14230 !! wikitext
14231 {{#special:Recentchanges}}
14232 !! html
14233 Special:RecentChanges
14234 !! end
14235
14236 !! test
14237 {{#special:}} page name with subpage, known
14238 !! options
14239 msg
14240 !! wikitext
14241 {{#special:Recentchanges/param}}
14242 !! html
14243 Special:RecentChanges/param
14244 !! end
14245
14246 !! test
14247 {{#special:}} page name, unknown
14248 !! options
14249 msg
14250 !! wikitext
14251 {{#special:foobar nonexistent}}
14252 !! html
14253 Special:Foobar nonexistent
14254 !! end
14255
14256 !! test
14257 {{#speciale:}} page name, known
14258 !! options
14259 msg
14260 !! wikitext
14261 {{#speciale:Recentchanges}}
14262 !! html
14263 Special:RecentChanges
14264 !! end
14265
14266 !! test
14267 {{#speciale:}} page name with subpage, known
14268 !! options
14269 msg
14270 !! wikitext
14271 {{#speciale:Recentchanges/param}}
14272 !! html
14273 Special:RecentChanges/param
14274 !! end
14275
14276 !! test
14277 {{#speciale:}} page name, unknown
14278 !! options
14279 msg
14280 !! wikitext
14281 {{#speciale:foobar nonexistent}}
14282 !! html
14283 Special:Foobar_nonexistent
14284 !! end
14285
14286 ###
14287 ### Images
14288 ###
14289 ### For Parsoid-specific tests, see
14290 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14291
14292 !! test
14293 Simple image
14294 !! options
14295 parsoid=wt2html,wt2wt,html2html
14296 !! wikitext
14297 [[Image:foobar.jpg]]
14298 !! html/php
14299 <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>
14300 </p>
14301 !! html/parsoid
14302 <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>
14303 !! end
14304
14305 !! test
14306 Serialize simple image with span wrapper
14307 !! options
14308 parsoid=html2wt
14309 !! html/parsoid
14310 <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>
14311 !! wikitext
14312 [[File:Foobar.jpg]]
14313 !! end
14314
14315 !! test
14316 Simple image (using File: namespace, now canonical)
14317 !! wikitext
14318 [[File:Foobar.jpg]]
14319 !! html/php
14320 <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>
14321 </p>
14322 !! html/parsoid
14323 <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>
14324 !! end
14325
14326 !! test
14327 Right-aligned image
14328 !! wikitext
14329 [[File:Foobar.jpg|right]]
14330 !! html/php
14331 <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>
14332
14333 !! html/parsoid
14334 <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>
14335 !! end
14336
14337 !! test
14338 Image with caption
14339 !! wikitext
14340 [[File:Foobar.jpg|right|Caption text]]
14341 !! html/php
14342 <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>
14343
14344 !! html/parsoid
14345 <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>
14346 !! end
14347
14348 !! test
14349 Image with caption, T55312 #1
14350 !! wikitext
14351 [[File:Foobar.jpg|right|Caption page stuff]]
14352 !! html/php
14353 <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>
14354
14355 !! html/parsoid
14356 <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>
14357 !! end
14358
14359 !! test
14360 Image with caption, T55312 #2
14361 !! wikitext
14362 [[File:Foobar.jpg|right|Caption page=]]
14363 !! html/php
14364 <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>
14365
14366 !! html/parsoid
14367 <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>
14368 !! end
14369
14370 !! test
14371 Image with caption, T55312 #3
14372 !! wikitext
14373 [[File:Foobar.jpg|right|Caption page=stuff]]
14374 !! html/php
14375 <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>
14376
14377 !! html/parsoid
14378 <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>
14379 !! end
14380
14381 !! test
14382 Image caption with pipe entity
14383 !! wikitext
14384 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14385 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14386 !! html/php
14387 <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>
14388 <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>
14389
14390 !! html/parsoid
14391 <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>
14392 <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>
14393 !! end
14394
14395 !! test
14396 Allow empty links in image captions (T62753)
14397 !! options
14398 thumbsize=220
14399 !! wikitext
14400 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14401 [[]]
14402 [[Link2]]
14403 ]]
14404 !! html/php
14405 <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>
14406
14407 !! html/parsoid
14408 <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>
14409 [[]]
14410 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14411 </figcaption></figure>
14412 !! end
14413
14414 !! test
14415 Titles in unlinked images (T23454)
14416 !! wikitext
14417 [[File:Foobar.jpg|link=|stuff]]
14418 !! html/php
14419 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14420 </p>
14421 !! html/parsoid
14422 <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>
14423 !! end
14424
14425 !! test
14426 Link with empty target
14427 !! wikitext
14428 [[]]
14429 !! html
14430 <p>[[]]
14431 </p>
14432 !! end
14433
14434 !! test
14435 Image with link trail
14436 !! wikitext
14437 Linktrails should not work for images: [[File:Foobar.jpg]]s
14438 !! html/php
14439 <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
14440 </p>
14441 !! html/parsoid
14442 <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>
14443 !! end
14444
14445 !! test
14446 Image with empty attribute
14447 !! options
14448 parsoid=wt2html,wt2wt,html2html
14449 !! wikitext
14450 [[File:Foobar.jpg|right||Caption text]]
14451 !! html/php
14452 <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>
14453
14454 !! html/parsoid
14455 <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>
14456 !! end
14457
14458 !! test
14459 1. Block image with individual attributes from templates
14460 !! wikitext
14461 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14462 !! html/php
14463 <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>
14464
14465 !! html/parsoid
14466 <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>
14467 !! end
14468
14469 !! test
14470 2. Block Image with individual attributes from templates
14471 !! wikitext
14472 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14473 !! html/php
14474 <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>
14475
14476 !! html/parsoid
14477 <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>
14478 !! end
14479
14480 !! test
14481 3. Inline image with individual attributes from templates
14482 !! wikitext
14483 [[File:Foobar.jpg|{{echo|50px}}]]
14484 !! html/php
14485 <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>
14486 </p>
14487 !! html/parsoid
14488 <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>
14489 !! end
14490
14491 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14492 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14493 !! test
14494 Image with multiple attributes from the same template
14495 !! wikitext
14496 [[File:Foobar.jpg|{{image_attribs}}]]
14497 !! html/php
14498 <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>
14499
14500 !! html/parsoid
14501 <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>
14502 !! end
14503
14504 !! test
14505 Image with link tails
14506 !! options
14507 thumbsize=220
14508 !! wikitext
14509 123[[File:Foobar.jpg]]456
14510 123[[File:Foobar.jpg|right]]456
14511 123[[File:Foobar.jpg|thumb]]456
14512 !! html/php
14513 <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
14514 </p>
14515 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
14516 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
14517
14518 !! html/php+tidy
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><p>
14521 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
14522 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
14523 </p>
14524 !! html/parsoid
14525 <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>
14526 <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>
14527 <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>
14528 !! end
14529
14530 !! test
14531 Image with multiple captions -- only last one is accepted
14532 !! wikitext
14533 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14534 !! html/php
14535 <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>
14536
14537 !! html/parsoid
14538 <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>
14539 !! end
14540
14541 !! test
14542 Image with multiple widths -- use last
14543 !! wikitext
14544 [[File:Foobar.jpg|200px|300px|caption]]
14545 !! html/php
14546 <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>
14547 </p>
14548 !! html/parsoid
14549 <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>
14550 !! end
14551
14552 !! test
14553 Image with multiple alignments -- use first (T50664)
14554 !! options
14555 thumbsize=220
14556 !! wikitext
14557 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14558
14559 [[File:Foobar.jpg|middle|text-top|caption]]
14560 !! html/php
14561 <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>
14562 <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>
14563 </p>
14564 !! html/parsoid
14565 <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>
14566 <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>
14567 !! end
14568
14569 !! test
14570 Image with width attribute at different positions
14571 !! wikitext
14572 [[File:Foobar.jpg|200px|right|Caption]]
14573 [[File:Foobar.jpg|right|200px|Caption]]
14574 [[File:Foobar.jpg|right|Caption|200px]]
14575 !! html/php
14576 <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>
14577 <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>
14578 <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>
14579
14580 !! html/parsoid
14581 <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>
14582 <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>
14583 <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>
14584 !! end
14585
14586 # a sad bit of backward-compatibility
14587 !! test
14588 Image with size specified with pxpx (T15500, T53628)
14589 !! options
14590 parsoid=wt2html,wt2wt,html2html
14591 !! wikitext
14592 [[File:Foobar.jpg|20pxpx]]
14593 [[File:Foobar.jpg|200x20pxpx]]
14594 !! html/php
14595 <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>
14596 <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>
14597 </p>
14598 !! html/parsoid
14599 <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>
14600 !! end
14601
14602 !! test
14603 Image with link parameter, wiki target
14604 !! wikitext
14605 [[File:Foobar.jpg|link=Main Page]]
14606 !! html/php
14607 <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>
14608 </p>
14609 !! html/parsoid
14610 <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>
14611 !! end
14612
14613 # parsoid T51293 (part 1)
14614 !! test
14615 Image with link parameter, URL target
14616 !! wikitext
14617 [[File:Foobar.jpg|link=http://example.com/]]
14618 !! html/php
14619 <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>
14620 </p>
14621 !! html/parsoid
14622 <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>
14623 !! end
14624
14625 # parsoid T51293 (part 2)
14626 !! test
14627 Image with link parameter, protocol-less URL target
14628 !! wikitext
14629 [[File:Foobar.jpg|link=//example.com/]]
14630 !! html/php
14631 <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>
14632 </p>
14633 !! html/parsoid
14634 <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>
14635 !! end
14636
14637 !! test
14638 Escaping non-block captions (T107435)
14639 !! options
14640 parsoid={
14641 "modes": ["wt2wt"],
14642 "changes": [
14643 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14644 ]
14645 }
14646 !! wikitext
14647 [[Image:Foobar.jpg|caption]]
14648 !! wikitext/edited
14649 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14650 !! end
14651
14652 # wgExternalLinkTarget not supported by Parsoid
14653 !! test
14654 Image with link parameter, wgExternalLinkTarget
14655 !! wikitext
14656 [[Image:foobar.jpg|link=http://example.com/]]
14657 !! config
14658 wgExternalLinkTarget='foobar'
14659 !! html/php
14660 <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>
14661 </p>
14662 !! end
14663
14664 !! test
14665 Image with link parameter, wgNoFollowLinks set to false
14666 !! wikitext
14667 [[Image:foobar.jpg|link=http://example.com/]]
14668 !! config
14669 wgNoFollowLinks=false
14670 !! html/php
14671 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14672 </p>
14673 !! end
14674
14675 !! test
14676 Image with link parameter, wgNoFollowDomainExceptions
14677 !! wikitext
14678 [[Image:foobar.jpg|link=http://example.com/]]
14679 !! config
14680 wgNoFollowDomainExceptions='example.com'
14681 !! html/php
14682 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14683 </p>
14684 !! end
14685
14686 # wgExternalLinkTarget not supported by Parsoid
14687 !! test
14688 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14689 !! wikitext
14690 [[Image:foobar.jpg|link=http://example.com/|Title]]
14691 !! config
14692 wgExternalLinkTarget='foobar'
14693 !! html/php
14694 <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>
14695 </p>
14696 !! end
14697
14698 !! test
14699 Image with empty link parameter
14700 !! wikitext
14701 [[File:Foobar.jpg|link=]]
14702 !! html/php
14703 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14704 </p>
14705 !! html/parsoid
14706 <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>
14707 !! end
14708
14709 !! test
14710 Image with link parameter (wiki target) and unnamed parameter
14711 !! wikitext
14712 [[File:Foobar.jpg|link=Main_Page|Title]]
14713 !! html/php
14714 <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>
14715 </p>
14716 !! html/parsoid
14717 <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>
14718 !! end
14719
14720 !! test
14721 Image with link parameter (URL target) and unnamed parameter
14722 !! wikitext
14723 [[File:Foobar.jpg|link=http://example.com/|Title]]
14724 !! html/php
14725 <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>
14726 </p>
14727 !! html/parsoid
14728 <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>
14729 !! end
14730
14731 !! test
14732 Thumbnail image with link parameter
14733 !! options
14734 thumbsize=220
14735 parsoid=wt2html,wt2wt,html2html
14736 !! wikitext
14737 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14738 !! html/php
14739 <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>
14740
14741 !! html/parsoid
14742 <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>
14743 !! end
14744
14745 !! test
14746 Manually-specified thumbnail image
14747 !! options
14748 thumbsize=220
14749 !! wikitext
14750 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14751 !! html/php
14752 <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>
14753
14754 !! html/parsoid
14755 <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>
14756 !! end
14757
14758 !! test
14759 Manually-specified thumbnail image with explicit link to wiki page
14760 !! options
14761 thumbsize=220
14762 parsoid=wt2html,wt2wt,html2html
14763 !! wikitext
14764 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14765 !! html/php
14766 <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>
14767
14768 !! html/parsoid
14769 <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>
14770 !! end
14771
14772 !! test
14773 Manually-specified thumbnail image with explicit link to url
14774 !! options
14775 thumbsize=220
14776 parsoid=wt2html,wt2wt,html2html
14777 !! wikitext
14778 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14779 !! html/php
14780 <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>
14781
14782 !! html/parsoid
14783 <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>
14784 !! end
14785
14786 !! test
14787 Manually-specified thumbnail image with explicit no link
14788 !! options
14789 thumbsize=220
14790 parsoid=wt2html,wt2wt,html2html
14791 !! wikitext
14792 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14793 !! html/php
14794 <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>
14795
14796 !! html/parsoid
14797 <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>
14798 !! end
14799
14800 !! test
14801 Manually-specified thumbnail image with explicit link and alt text
14802 !! options
14803 thumbsize=220
14804 parsoid=wt2html,wt2wt,html2html
14805 !! wikitext
14806 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14807 !! html/php
14808 <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>
14809
14810 !! html/parsoid
14811 <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>
14812 !! end
14813
14814 !! test
14815 Image with frame and link
14816 !! options
14817 parsoid=wt2html,wt2wt,html2html
14818 !! wikitext
14819 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14820 !! html/php
14821 <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>
14822
14823 !! html/parsoid
14824 <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>
14825 !! end
14826
14827 !! test
14828 Image with frame and link and explicit alt
14829 !! options
14830 parsoid=wt2html,wt2wt,html2html
14831 !! wikitext
14832 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14833 !! html/php
14834 <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>
14835
14836 !! html/parsoid
14837 <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>
14838 !! end
14839
14840 !! test
14841 Image with wiki markup in implicit alt
14842 !! wikitext
14843 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14844
14845 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14846 !! html/php
14847 <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>
14848 </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>
14849 </p>
14850 !! html/parsoid
14851 <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>
14852
14853 <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>
14854 !! end
14855
14856 !! test
14857 Alt image option should handle most kinds of wikitext without barfing
14858 !! wikitext
14859 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14860 !! html/php
14861 <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>
14862
14863 !! html/parsoid
14864 <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>
14865 !! end
14866
14867 !! test
14868 Image with table with attributes in caption
14869 !! options
14870 parsoid=wt2html,html2html
14871 !! wikitext
14872 [[File:Foobar.jpg|thumb|
14873 {| class="123" |
14874 |- class="456" |
14875 | ha
14876 |}
14877 ]]
14878 !! html/parsoid
14879 <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>
14880 <table class="123">
14881 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
14882 <td> ha</td></tr>
14883 </tbody></table>
14884 </figcaption></figure>
14885 !! end
14886
14887 !! test
14888 Image with table with rows from templates in caption
14889 !! wikitext
14890 [[File:Foobar.jpg|thumb|
14891 {|
14892 {{echo|{{!}} hi}}
14893 |}
14894 ]]
14895 !! html/parsoid
14896 <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>
14897 <table>
14898 <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>
14899 </tbody></table>
14900 </figcaption></figure>
14901 !! end
14902
14903 !! test
14904 Image with nested tables in caption
14905 !! wikitext
14906 [[File:Foobar.jpg|thumb|Foo<br />
14907 {|
14908 |
14909 {|
14910 |z
14911 |}
14912 |}
14913 ]]
14914 !! html/parsoid
14915 <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}'/>
14916 <table>
14917 <tbody><tr><td>
14918 <table>
14919 <tbody><tr><td>z</td></tr>
14920 </tbody></table></td></tr>
14921 </tbody></table>
14922 </figcaption></figure>
14923 !! end
14924
14925 !! test
14926 Image with heading and horizontal rule in caption
14927 !! wikitext
14928 [[File:Foobar.jpg|thumb|
14929 ===Testing===
14930 123
14931 --------------
14932 ]]
14933 !! html/php
14934 <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>
14935
14936 !! html/parsoid
14937 <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>
14938 <h3 id="Testing">Testing</h3>
14939 123
14940 <hr data-parsoid='{"extra_dashes":10}'/>
14941 </figcaption></figure>
14942 !! end
14943
14944 ###################
14945 # Conflicting image format options.
14946 # First option specified should 'win'.
14947 # All three cases in each test should be identical.
14948
14949 !! test
14950 Image with 'frameless' first.
14951 !! options
14952 parsoid=wt2html,wt2wt,html2html
14953 !! wikitext
14954 [[File:Foobar.jpg|frameless|caption]]
14955
14956 [[File:Foobar.jpg|frameless|frame|caption]]
14957
14958 [[File:Foobar.jpg|frameless|thumb|caption]]
14959 !! html/php
14960 <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>
14961 </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>
14962 </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>
14963 </p>
14964 !! html/parsoid
14965 <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>
14966 <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>
14967 <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>
14968 !! end
14969
14970 !! test
14971 Image with 'frame' first.
14972 !! options
14973 parsoid=wt2html,wt2wt,html2html
14974 !! wikitext
14975 [[File:Foobar.jpg|frame|caption]]
14976 [[File:Foobar.jpg|frame|frameless|caption]]
14977 [[File:Foobar.jpg|frame|thumb|caption]]
14978 !! html/php
14979 <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>
14980 <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>
14981 <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>
14982
14983 !! html/parsoid
14984 <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>
14985 <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>
14986 <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>
14987 !! end
14988
14989 !! test
14990 Image with 'thumb' first.
14991 !! options
14992 parsoid=wt2html,wt2wt,html2html
14993 !! wikitext
14994 [[File:Foobar.jpg|thumb|caption]]
14995 [[File:Foobar.jpg|thumb|frameless|caption]]
14996 [[File:Foobar.jpg|thumb|frame|caption]]
14997 !! html/php
14998 <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>
14999 <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>
15000 <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>
15001
15002 !! html/parsoid
15003 <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>
15004 <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>
15005 <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>
15006 !! end
15007
15008 ###################
15009 # Image sizing.
15010 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
15011 # and https://phabricator.wikimedia.org/T64258
15012 # Foobar has actual size of 1941x220
15013 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
15014 # a scalable format.
15015 # 2. Framed images always ignore size options; always render at default size.
15016 # 3. "Unspecified format" and border are the only types which can be
15017 # enlarged.
15018
15019 !! test
15020 Image: unspecified format and border enlarge
15021 !! options
15022 parsoid=wt2html,wt2wt,html2html
15023 !! wikitext
15024 [[File:Foobar.jpg|2000px]]
15025
15026 [[File:Foobar.jpg|border|2000px]]
15027 !! html/php
15028 <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>
15029 </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>
15030 </p>
15031 !! html/parsoid
15032 <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>
15033 <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>
15034 !! end
15035
15036 !! test
15037 Image: "unspecified format" and border reduce
15038 !! options
15039 parsoid=wt2html,wt2wt,html2html
15040 !! wikitext
15041 [[File:Foobar.jpg|1000px]]
15042
15043 [[File:Foobar.jpg|border|1000px]]
15044 !! html/php
15045 <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>
15046 </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>
15047 </p>
15048 !! html/parsoid
15049 <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>
15050 <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>
15051 !! end
15052
15053 !! test
15054 Image: thumbs reduce
15055 !! options
15056 parsoid=wt2html,wt2wt,html2html
15057 !! wikitext
15058 [[File:Foobar.jpg|thumb|50px]]
15059 !! html/php
15060 <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>
15061
15062 !! html/parsoid
15063 <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>
15064 !! end
15065
15066 !! test
15067 Image: bitmap thumbs can't be enlarged past original size, but vector can.
15068 !! options
15069 parsoid=wt2html,wt2wt,html2html
15070 !! wikitext
15071 [[File:Foobar.jpg|thumb|2000px]]
15072
15073 [[File:Foobar.svg|thumb|2000px]]
15074 !! html/php
15075 <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>
15076 <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>
15077
15078 !! html/parsoid
15079 <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>
15080 <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>
15081 !! end
15082
15083 !! test
15084 Image: frameless can reduce in size
15085 !! options
15086 parsoid=wt2html,wt2wt,html2html
15087 !! wikitext
15088 [[File:Foobar.jpg|frameless|50px]]
15089 !! html/php
15090 <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>
15091 </p>
15092 !! html/parsoid
15093 <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>
15094 !! end
15095
15096 !! test
15097 Image: bitmap frameless can't be enlarged past original size, but vector can
15098 !! options
15099 parsoid=wt2html,wt2wt,html2html
15100 !! wikitext
15101 [[File:Foobar.jpg|frameless|2000px]]
15102
15103 [[File:Foobar.svg|frameless|2000px]]
15104 !! html/php
15105 <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>
15106 </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>
15107 </p>
15108 !! html/parsoid
15109 <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>
15110 <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>
15111 !! end
15112
15113 !! test
15114 Image: framed images are always unscaled.
15115 !! options
15116 parsoid=wt2html,wt2wt,html2html
15117 !! wikitext
15118 [[File:Foobar.jpg|frame]]
15119
15120 [[File:Foobar.jpg|frame|50px]]
15121
15122 [[File:Foobar.jpg|frame|50x50px]]
15123
15124 [[File:Foobar.jpg|frame|2000px]]
15125 !! html/php
15126 <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>
15127 <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>
15128 <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>
15129 <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>
15130
15131 !! html/parsoid
15132 <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>
15133 <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>
15134 <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>
15135 <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>
15136 !! end
15137
15138 ###################
15139
15140 !! test
15141 Link to image page- image page normally doesn't exists, hence edit link
15142 Add test with existing image page
15143 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
15144 !! wikitext
15145 [[:Image:test]]
15146 !! html
15147 <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>
15148 </p>
15149 !! end
15150
15151 !! test
15152 T20784 Link to non-existent image page with caption should use caption as link text
15153 !! wikitext
15154 [[:Image:test|caption]]
15155 !! html
15156 <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>
15157 </p>
15158 !! end
15159
15160 !! test
15161 Frameless image caption with a free URL
15162 !! wikitext
15163 [[File:Foobar.jpg|http://example.com]]
15164 !! html/php
15165 <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>
15166 </p>
15167 !! html/parsoid
15168 <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>
15169 !! end
15170
15171 !! test
15172 Thumbnail image caption with a free URL
15173 !! options
15174 thumbsize=220
15175 !! wikitext
15176 [[File:Foobar.jpg|thumb|http://example.com]]
15177 !! html/php
15178 <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>
15179
15180 !! html/parsoid
15181 <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>
15182 !! end
15183
15184 !! test
15185 Thumbnail image caption with a free URL and explicit alt
15186 !! options
15187 thumbsize=220
15188 parsoid=wt2html,wt2wt,html2html
15189 !! wikitext
15190 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15191 !! html/php
15192 <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>
15193
15194 !! html/parsoid
15195 <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>
15196 !! end
15197
15198 !! test
15199 SVG thumbnails with no language set
15200 !! options
15201 !! wikitext
15202 [[File:Foobar.svg|thumb|caption]]
15203 !! html/php
15204 <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>
15205
15206 !! html/parsoid
15207 <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>
15208 !! end
15209
15210 !! test
15211 SVG thumbnails with language de
15212 !! options
15213 parsoid=wt2html,wt2wt,html2html
15214 !! wikitext
15215 [[File:Foobar.svg|thumb|caption|lang=de]]
15216 !! html/php
15217 <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>
15218
15219 !! html/parsoid
15220 <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>
15221 !! end
15222
15223 !! test
15224 SVG thumbnails with invalid language code
15225 !! options
15226 parsoid=wt2html,wt2wt,html2html
15227 !! wikitext
15228 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15229 !! html/php
15230 <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>
15231
15232 !! html/parsoid
15233 <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>
15234 !! end
15235
15236 !! test
15237 T3887: A ISBN with a thumbnail
15238 !! wikitext
15239 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15240 !! html/php
15241 <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>
15242
15243 !! html/parsoid
15244 <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>
15245 !! end
15246
15247 !! test
15248 T3887: A RFC with a thumbnail
15249 !! wikitext
15250 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15251 !! html/php
15252 <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>
15253
15254 !! html/parsoid
15255 <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>
15256 !! end
15257
15258 !! test
15259 T3887: A mailto link with a thumbnail
15260 !! wikitext
15261 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15262 !! html/php
15263 <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>
15264
15265 !! html/parsoid
15266 <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>
15267 !! end
15268
15269 # Pending resolution to T2368
15270 !! test
15271 T2648: Frameless image caption with a link
15272 !! wikitext
15273 [[File:Foobar.jpg|text with a [[link]] in it]]
15274 !! html/php
15275 <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>
15276 </p>
15277 !! html/parsoid
15278 <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>
15279 !! end
15280
15281 !! test
15282 T2648: Frameless image caption with a link (suffix)
15283 !! wikitext
15284 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15285 !! html/php
15286 <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>
15287 </p>
15288 !! html/parsoid
15289 <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>
15290 !! end
15291
15292 !! test
15293 T2648: Frameless image caption with an interwiki link
15294 !! wikitext
15295 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15296 !! html/php
15297 <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>
15298 </p>
15299 !! html/parsoid
15300 <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>
15301 !! end
15302
15303 !! test
15304 T2648: Frameless image caption with a piped interwiki link
15305 !! wikitext
15306 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15307 !! html/php
15308 <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>
15309 </p>
15310 !! html/parsoid
15311 <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>
15312 !! end
15313
15314 !! test
15315 T107474: Frameless image caption with <nowiki>
15316 !! wikitext
15317 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15318 !! html/parsoid
15319 <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>
15320 !! end
15321
15322 !! test
15323 Escape HTML special chars in image alt text
15324 !! wikitext
15325 [[File:Foobar.jpg|& < > "]]
15326 !! html/php
15327 <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>
15328 </p>
15329 !! html/parsoid
15330 <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>
15331 !! end
15332
15333 !! test
15334 Escape HTML special chars in image alt text with LanguageConverter
15335 !! options
15336 language=zh
15337 !! wikitext
15338 [[File:Foobar.jpg|& < > "]]
15339 !! html/php
15340 <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>
15341 </p>
15342 !! html/parsoid
15343 <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>
15344 !! end
15345
15346 !! test
15347 Entities in file name and attributes
15348 !! wikitext
15349 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15350 !! html/php
15351 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15352 </p>
15353 !! html/parsoid
15354 <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>
15355 !! end
15356
15357 !! test
15358 T2499: Alt text should have &#1234;, not &amp;1234;
15359 !! wikitext
15360 [[File:Foobar.jpg|&#9792;]]
15361 !! html/php
15362 <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>
15363 </p>
15364 !! html/parsoid
15365 <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>
15366 !! end
15367
15368 !! test
15369 Broken image caption with link
15370 !! options
15371 parsoid=wt2html,wt2wt,html2html
15372 !! wikitext
15373 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15374 !! html/php
15375 <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.
15376 </p>
15377 !! html/parsoid
15378 <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>
15379 !! end
15380
15381 !! test
15382 Image caption containing another image
15383 !! wikitext
15384 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15385 !! html/php
15386 <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>
15387
15388 !! html/parsoid
15389 <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>
15390 !! end
15391
15392 !! test
15393 Image: caption containing a newline
15394 !! wikitext
15395 [[File:Foobar.jpg|This
15396 *is some text]]
15397 !! html/php
15398 <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>
15399 </p>
15400 !! html/parsoid
15401 <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>
15402 !!end
15403
15404 !!test
15405 Image: caption containing leading space
15406 (The leading space should not trigger nowiki escaping in wt2wt mode)
15407 !! wikitext
15408 [[File:Foobar.jpg|thumb| bar]]
15409 !! html/php
15410 <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>
15411
15412 !! html/parsoid
15413 <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>
15414 !!end
15415
15416 # html/php output not have newlines after table, td, th, etc. because
15417 # Linker::makeThumbLink2() replaces the newlines with spaces since
15418 # the table is inside a caption.
15419 # FIXME: Verify if that circa 2004 fix is still required.
15420 !! test
15421 Image: caption containing a table
15422 !! options
15423 parsoid=wt2html,wt2wt,html2html
15424 !! wikitext
15425 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15426 {|
15427 !Foo!!Bar
15428 |-
15429 |Foo1||Bar1
15430 |}
15431 and some more text.]]
15432 !! html/php
15433 <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>
15434
15435 !! html/parsoid
15436 <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
15437 <table>
15438 <tbody>
15439 <tr><th>Foo</th><th>Bar</th></tr>
15440 <tr>
15441 <td>Foo1</td>
15442 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15443 !! end
15444
15445 !! test
15446 T5090: External links other than http: in image captions
15447 !! wikitext
15448 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15449 !! html/php
15450 <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>
15451
15452 !! html/parsoid
15453 <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>
15454 !! end
15455
15456 !! test
15457 Custom class
15458 !! options
15459 parsoid=wt2html,wt2wt,html2html
15460 !! wikitext
15461 [[Image:foobar.jpg|a|class=b]]
15462 !! html/php
15463 <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>
15464 </p>
15465 !! html/parsoid
15466 <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>
15467 !! end
15468
15469 !! test
15470 Localized image handling (1).
15471 !! options
15472 parsoid=wt2html,wt2wt,html2html
15473 language=es
15474 !! wikitext
15475 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15476 !! html/php
15477 <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>
15478
15479 !! html/parsoid
15480 <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>
15481 !! end
15482
15483 !! test
15484 Localized image handling (2).
15485 !! options
15486 thumbsize=220
15487 parsoid=wt2html,wt2wt,html2html
15488 language=es
15489 !! wikitext
15490 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15491 !! html/php
15492 <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>
15493
15494 !! html/parsoid
15495 <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>
15496 !! end
15497
15498 !! test
15499 Localized image handling (3).
15500 !! options
15501 language=fa
15502 parsoid=html2wt
15503 !! html/parsoid
15504 <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>
15505 !! wikitext
15506 [[File:Foobar.jpg|بندانگشتی]]
15507 !! end
15508
15509 !! test
15510 "border", "frameless" and "class" attributes on an image.
15511 !! options
15512 thumbsize=220
15513 parsoid=wt2html,wt2wt,html2html
15514 !! wikitext
15515 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15516 !! html/php
15517 <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>
15518 </p>
15519 !! html/parsoid
15520 <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>
15521 !! end
15522
15523 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15524 !! test
15525 Invalid image attributes (T64500)
15526 !! options
15527 thumbsize=220
15528 parsoid=wt2html,wt2wt,html2html
15529 !! wikitext
15530 [[File:Foobar.jpg|thumb|float|left|caption]]
15531
15532 [[File:Foobar.jpg|thumb|righ|caption]]
15533
15534 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15535 !! html/php
15536 <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>
15537 <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>
15538 <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>
15539
15540 !! html/parsoid
15541 <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>
15542 <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>
15543 <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>
15544 !! end
15545
15546 !! article
15547 File:Barfoo.jpg
15548 !! text
15549 #REDIRECT [[File:Barfoo.jpg]]
15550 !! endarticle
15551
15552 # FIXME: Parsoid should run this test -- but we'd need to teach the
15553 # mockAPI about the redirected Barfoo.jpg image.
15554 !! test
15555 Redirected image
15556 !! wikitext
15557 [[Image:Barfoo.jpg]]
15558 !! html/php
15559 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15560 </p>
15561 !! end
15562
15563 !! test
15564 Missing image with uploads disabled
15565 !! options
15566 wgEnableUploads=0
15567 !! wikitext
15568 [[File:Foobaz.jpg]]
15569 !! html/php
15570 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15571 </p>
15572 !! html/parsoid
15573 <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>
15574 !! end
15575
15576 # Parsoid-specific testing for images
15577 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15578 # Currently imperfect due to a flaw in the Parsoid testrunner
15579 # Work in progress
15580 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15581 # image tests.
15582
15583 !! test
15584 Parsoid-specific image handling - simple image with size and middle alignment
15585 !! wikitext
15586 [[File:Foobar.jpg|middle|50px]]
15587 !! html/parsoid
15588 <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>
15589 !! end
15590
15591 !! test
15592 Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
15593 !! options
15594 parsoid=wt2wt,wt2html,html2html
15595 !! wikitext
15596 [[Image:Foobar.jpg|middle|50px]]
15597 !! html/parsoid
15598 <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>
15599 !! end
15600
15601 !! test
15602 Parsoid-specific image handling - simple image with size and middle alignment (existing content)
15603 !! wikitext
15604 [[File:Foobar.jpg|50px|middle]]
15605 !! html/parsoid
15606 <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>
15607 !! end
15608
15609 !! test
15610 Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
15611 !! options
15612 parsoid=wt2html,wt2wt,html2html
15613 !! wikitext
15614 [[Image:Foobar.jpg|50px|middle]]
15615 !! html/parsoid
15616 <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>
15617 !! end
15618
15619 !! test
15620 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15621 !! wikitext
15622 [[File:Foobar.jpg|500x10px|baseline|caption]]
15623 !! html/parsoid
15624 <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>
15625 !! end
15626
15627 !! test
15628 Parsoid-specific image handling - simple image with border and size spec
15629 !! wikitext
15630 [[File:Foobar.jpg|50px|border|caption]]
15631 !! html/parsoid
15632 <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>
15633 !! end
15634
15635 !! test
15636 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15637 !! options
15638 parsoid=wt2html,html2html
15639 !! wikitext
15640 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15641 !! html/parsoid
15642 <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>
15643 !! end
15644
15645 !! test
15646 Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
15647 !! options
15648 parsoid=wt2html,html2html
15649 !! wikitext
15650 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15651 !! html/parsoid
15652 <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>
15653 !! end
15654
15655 !! test
15656 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15657 !! options
15658 parsoid=wt2html,html2html
15659 !! wikitext
15660 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15661 !! html/parsoid
15662 <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>
15663 !! end
15664
15665 !! test
15666 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
15667 !! options
15668 parsoid=wt2html,html2html
15669 !! wikitext
15670 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15671 !! html/parsoid
15672 <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>
15673 !! end
15674
15675 !! test
15676 Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
15677 !! options
15678 parsoid=wt2html,wt2wt,html2html
15679 !! wikitext
15680 [[File:Foobar.jpg|frame|500x50px|caption]]
15681 !! html/parsoid
15682 <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>
15683 !! end
15684
15685 !! test
15686 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
15687 !! options
15688 parsoid=wt2html,html2html
15689 !! wikitext
15690 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15691 !! html/parsoid
15692 <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>
15693 !! end
15694
15695 !! test
15696 Parsoid-specific image handling - frameless image with specific size, border, and caption
15697 !! wikitext
15698 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15699 !! html/parsoid
15700 <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>
15701 !! end
15702
15703 !! test
15704 Parsoid-specific image handling - simple image with a formatted caption
15705 !! wikitext
15706 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15707 !! html/parsoid
15708 <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>
15709 !! end
15710
15711 !! test
15712 Parsoid-specific image handling - caption with a template in it
15713 !! wikitext
15714 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15715 !! html/parsoid
15716 <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>
15717 !! end
15718
15719 !! test
15720 Parsoid-specific image handling - caption with unbalanced tags in it
15721 !! options
15722 parsoid=wt2html,wt2wt,html2html
15723 !! wikitext
15724 foo
15725 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15726 bar
15727 !! html/parsoid
15728 <p>foo</p>
15729 <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>
15730 <p>bar</p>
15731 !! end
15732
15733 !! test
15734 Parsoid-specific image handling - empty caption (1)
15735 !! options
15736 parsoid=wt2html,wt2wt
15737 !! wikitext
15738 [[File:Foobar.jpg|thumb|]]
15739 !! html/parsoid
15740 <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>
15741 !! end
15742
15743 # empty captions don't get serialized unless we're in the "round trip" case
15744 !! test
15745 Parsoid-specific image handling - empty caption (2)
15746 !! options
15747 parsoid=html2wt
15748 !! html/parsoid
15749 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15750 <a href="./File:Foobar.jpg">
15751 <img resource="./File:Foobar.jpg"
15752 src="//example.com/images/3/3a/Foobar.jpg"
15753 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15754 height="25" width="220"/>
15755 </a>
15756 <figcaption></figcaption>
15757 </figure>
15758 !! wikitext
15759 [[File:Foobar.jpg|thumb]]
15760 !! end
15761
15762 !! test
15763 Parsoid-specific image handling - whitespace caption
15764 !! wikitext
15765 [[File:Foobar.jpg|thumb| ]]
15766 !! html/parsoid
15767 <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>
15768 !! end
15769
15770 !! test
15771 Parsoid-specific image handling - lang option
15772 !! wikitext
15773 foo
15774 [[File:Foobar.svg|lang=de|caption]]
15775 bar
15776 !! html/parsoid
15777 <p>foo
15778 <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>
15779 bar</p>
15780 !! end
15781
15782 ## Edge case bugs in Parsoid from T93580
15783 !! test
15784 T93580: 1. Templated <ref> inside block images
15785 !! wikitext
15786 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15787
15788 <references />
15789 !! html/parsoid
15790 <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>
15791
15792 <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>
15793 !! end
15794
15795 !! test
15796 T93580: 2. <ref> inside inline images
15797 !! wikitext
15798 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15799
15800 <references />
15801 !! html/parsoid
15802 <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>
15803
15804 <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>
15805 !! end
15806
15807 !! test
15808 T93580: 3. Templated <ref> inside inline images
15809 !! wikitext
15810 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15811
15812 <references />
15813 !! html/parsoid
15814 <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>
15815
15816 <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>
15817 !! end
15818
15819 ###
15820 ### Subpages
15821 ###
15822 !! article
15823 Subpage test/subpage
15824 !! text
15825 foo
15826 !! endarticle
15827
15828 !! test
15829 Subpage link
15830 !! options
15831 subpage title=[[Subpage test]]
15832 !! wikitext
15833 [[/subpage]]
15834 !! html
15835 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15836 </p>
15837 !! end
15838
15839 !! test
15840 Subpage noslash link
15841 !! options
15842 subpage title=[[Subpage test]]
15843 !! wikitext
15844 [[/subpage/]]
15845 !! html
15846 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15847 </p>
15848 !! end
15849
15850 !! article
15851 Subpage test/1/2/subpage
15852 !! text
15853 blah
15854 !! endarticle
15855
15856 !! test
15857 Relative subpage noslash link
15858 !! options
15859 parsoid=wt2wt,wt2html,html2html
15860 subpage title=[[Subpage test/1/2/3/4]]
15861 !! wikitext
15862 [[../../subpage/]]
15863
15864 [[../../subpage]]
15865 !! html/php
15866 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15867 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15868 </p>
15869 !! html/parsoid
15870 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15871 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15872 !! end
15873
15874 !! test
15875 Parsoid: dot-slash prefixed wikilinks
15876 !! wikitext
15877 [[./foo]]
15878
15879 [[././bar]]
15880
15881 [[././baz/]]
15882 !! html/php
15883 <p>[[./foo]]
15884 </p><p>[[././bar]]
15885 </p><p>[[././baz/]]
15886 </p>
15887 !! html/parsoid
15888 <p>[[./foo]]
15889 </p><p>[[././bar]]
15890 </p><p>[[././baz/]]
15891 </p>
15892 !! end
15893
15894 !! test
15895 Render invalid page names as plain text (T53090)
15896 !! wikitext
15897 [[./../foo|bar]]
15898 [[foo�|bar]]
15899 [[foo/.|bar]]
15900 [[foo/..|bar]]
15901 [[foo~~~bar]]
15902 [[foo>bar]]
15903 [[foo[bar]]
15904 [[.]]
15905 [[..]]
15906 [[foo././bar]]
15907 [[foo[http://example.com]xyz]]
15908
15909 [[{{echo|./../foo}}|bar]]
15910 [[{{echo|foo/.}}|bar]]
15911 [[{{echo|foo/..}}|bar]]
15912 [[{{echo|foo~~~~bar}}]]
15913 [[{{echo|foo>bar}}]]
15914 [[{{echo|foo././bar}}]]
15915 [[{{echo|foo{bar}}]]
15916 [[{{echo|foo}bar}}]]
15917 [[{{echo|foo[bar}}]]
15918 [[{{echo|foo]bar}}]]
15919 [[{{echo|foo<bar}}]]
15920 !!html/php
15921 <p>[[./../foo|bar]]
15922 [[foo�|bar]]
15923 [[foo/.|bar]]
15924 [[foo/..|bar]]
15925 [[foo~~~bar]]
15926 [[foo&gt;bar]]
15927 [[foo[bar]]
15928 [[.]]
15929 [[..]]
15930 [[foo././bar]]
15931 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15932 </p><p>[[./../foo|bar]]
15933 [[foo/.|bar]]
15934 [[foo/..|bar]]
15935 [[foo~~~~bar]]
15936 [[foo&gt;bar]]
15937 [[foo././bar]]
15938 [[foo{bar]]
15939 [[foo}bar]]
15940 [[foo[bar]]
15941 [[foo]bar]]
15942 [[foo&lt;bar]]
15943 </p>
15944 !!html/parsoid
15945 <p>[[./../foo|bar]]
15946 [[foo�|bar]]
15947 [[foo/.|bar]]
15948 [[foo/..|bar]]
15949 [[foo~~~bar]]
15950 [[foo>bar]]
15951 [[foo[bar]]
15952 [[.]]
15953 [[..]]
15954 [[foo././bar]]
15955 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
15956
15957 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15958 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15959 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15960 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15961 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15962 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15963 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15964 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15965 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
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&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
15968 !!end
15969
15970 !! test
15971 Disabled subpages
15972 !! wikitext
15973 [[/subpage]]
15974 !! html
15975 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15976 </p>
15977 !! end
15978
15979 !! test
15980 T2561: {{/Subpage}}
15981 !! options
15982 subpage title=[[Page]]
15983 !! wikitext
15984 {{/Subpage}}
15985 !! html
15986 <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>
15987 </p>
15988 !! end
15989
15990 ###
15991 ### Categories
15992 ###
15993 !! article
15994 Category:MediaWiki User's Guide
15995 !! text
15996 blah
15997 !! endarticle
15998
15999 !! test
16000 Link to category
16001 !! wikitext
16002 [[:Category:MediaWiki User's Guide]]
16003 !! html
16004 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
16005 </p>
16006 !! end
16007
16008 !! test
16009 Simple category
16010 !! options
16011 cat
16012 !! wikitext
16013 [[Category:MediaWiki User's Guide]]
16014 !! html/php
16015 cat=MediaWiki_User's_Guide sort=
16016 !! html/parsoid
16017 <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"}}'/>
16018 !! end
16019
16020 !! test
16021 PAGESINCATEGORY invalid title fatal (r33546 fix)
16022 !! wikitext
16023 {{PAGESINCATEGORY:<bogus>}}
16024 !! html
16025 <p>0
16026 </p>
16027 !! end
16028
16029 !! test
16030 Category with different sort key
16031 !! options
16032 cat
16033 !! wikitext
16034 [[Category:MediaWiki User's Guide|Foo]]
16035 !! html/php
16036 cat=MediaWiki_User's_Guide sort=Foo
16037 !! html/parsoid
16038 <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"}}'/>
16039 !! end
16040
16041 !! test
16042 Category with identical sort key
16043 !! options
16044 cat
16045 !! wikitext
16046 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16047 !! html/php
16048 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
16049 !! html/parsoid
16050 <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"}}'/>
16051 !! end
16052
16053 !! test
16054 Category with empty sort key
16055 !! options
16056 cat
16057 pst
16058 !! wikitext
16059 [[Category:MediaWiki User's Guide|]]
16060 !! html/php
16061 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16062 !! end
16063
16064 !! test
16065 Category with empty sort key and parentheses
16066 !! options
16067 cat
16068 pst
16069 !! wikitext
16070 [[Category:Foo (bar)|]]
16071 !! html/php
16072 [[Category:Foo (bar)|Foo]]
16073 !! end
16074
16075 !! test
16076 Category with link tail
16077 !! options
16078 cat
16079 pst
16080 !! wikitext
16081 123[[Category:Foo]]456
16082 !! html/php
16083 123[[Category:Foo]]456
16084 !! end
16085
16086 !! test
16087 Category with template
16088 !! options
16089 cat
16090 pst
16091 !! wikitext
16092 [[Category:{{echo|Foo}}]]
16093 !! html/php
16094 [[Category:{{echo|Foo}}]]
16095 !! end
16096
16097 !! test
16098 Category with template in sort key
16099 !! options
16100 cat
16101 pst
16102 !! wikitext
16103 [[Category:Foo|{{echo|Bar}}]]
16104 !! html/php
16105 [[Category:Foo|{{echo|Bar}}]]
16106 !! end
16107
16108 !! test
16109 Category with template in sort key and title
16110 !! options
16111 cat
16112 pst
16113 !! wikitext
16114 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16115 !! html/php
16116 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16117 !! end
16118
16119 ## We used to, but no longer wt2wt this test since the default serializer
16120 ## will normalize all categories to serialize on their own line.
16121 ## This wikitext usage is going to be fairly uncommon in production and
16122 ## selser will take care of preserving formatting in those scenarios.
16123 !! test
16124 Category / paragraph interactions
16125 !! options
16126 parsoid=wt2html
16127 !! wikitext
16128 Foo [[Category:Baz]] Bar
16129
16130 Foo [[Category:Baz]]
16131 Bar
16132
16133 Foo
16134 [[Category:Baz]]
16135 Bar
16136
16137 Foo
16138 [[Category:Baz]] Bar
16139
16140 Foo
16141 [[Category:Baz]]
16142 [[Category:Baz]]
16143 [[Category:Baz]]
16144 Bar
16145
16146 [[Category:Baz]]
16147 [[Category:Baz]]
16148 [[Category:Baz]]
16149
16150 [[Category:Baz]]
16151 {{echo|[[Category:Baz]]}}
16152 [[Category:Baz]]
16153 !! html/php
16154 <p>Foo Bar
16155 </p><p>Foo
16156 Bar
16157 </p><p>Foo
16158 Bar
16159 </p><p>Foo Bar
16160 </p><p>Foo
16161 Bar
16162 </p>
16163 !! html/parsoid
16164 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16165 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16166 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16167 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16168 <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>
16169 <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}}]}'/>
16170 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16171 !! end
16172
16173 ## We used to, but no longer wt2wt this test since the default serializer
16174 ## will normalize all categories to serialize on their own line.
16175 ## This wikitext usage is going to be fairly uncommon in production and
16176 ## selser will take care of preserving formatting in those scenarios.
16177 ##
16178 ## The whitespace on the empty line is part of the test. Please do not delete
16179 !! test
16180 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16181 !! options
16182 parsoid=wt2html
16183 !! wikitext
16184 This
16185
16186 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16187
16188 {{echo|[[Category:Foo]] and so should this!}}
16189 !! html/php
16190 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16191 </p>
16192 !! html/parsoid
16193 <p>This
16194
16195 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16196
16197 <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>
16198 !! end
16199
16200 ## Parsoid will not try to wt2wt this while preserving newlines because
16201 ## it suppresses excess newlines within list items -- and we don't want to
16202 ## introduce a special case just for categories, which is, in reality somewhat
16203 ## odd behavior -- categories are unlikely to be used in list items like this
16204 ## in top-level pages and are only likely to show up in template-generated
16205 ## list items where this RT-ing is a non-issue.
16206 ##
16207 ## The whitespace on the empty line is part of the test. Please do not delete
16208 !! test
16209 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16210 !! options
16211 parsoid=wt2html
16212 !! wikitext
16213 * This
16214
16215 [[Category:Foo]] and this should be part of the same list item
16216 * So should this
16217
16218 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16219 !! html
16220 <ul><li>This and this should be part of the same list item</li>
16221 <li>So should this and this should be part of the same list item</li></ul>
16222 !! html/parsoid
16223 <ul>
16224 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16225 <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>
16226 </ul>
16227 !! end
16228
16229 ## Newlines and categories that follow the last item of a list
16230 ## are treated differently because this (list followed by categories)
16231 ## is an extremely common pattern on wikis.
16232 !! test
16233 3. Categories and newlines: newline suppression for last list item should RT properly
16234 !! wikitext
16235 *a
16236 *b
16237
16238 [[Category:Foo]]
16239
16240 [[Category:Bar]]
16241 [[Category:Baz]]
16242
16243 :c
16244
16245 [[Category:C]]
16246
16247 ;d
16248
16249 [[Category:D]]
16250 !! html/parsoid
16251 <ul><li>a</li>
16252 <li>b</li></ul>
16253
16254 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16255
16256 <link rel="mw:PageProp/Category" href="./Category:Bar"/>
16257 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16258
16259 <dl><dd>c</dd></dl>
16260
16261 <link rel="mw:PageProp/Category" href="./Category:C"/>
16262
16263 <dl><dt>d</dt></dl>
16264
16265 <link rel="mw:PageProp/Category" href="./Category:D"/>
16266 !! end
16267
16268 !! test
16269 4. Categories and newlines: newline suppression for last list item should RT properly
16270 !! wikitext
16271 *a
16272 ****b
16273
16274 [[Category:Foo]]
16275 !! html/parsoid
16276 <ul><li>a
16277 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
16278
16279 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16280 !! end
16281
16282 ## only wt2html for this to make sure the algo only applies to the rightmost path
16283 !! test
16284 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16285 !! options
16286 parsoid=wt2html
16287 !! wikitext
16288 *a
16289 **b
16290 [[Category:Foo]]
16291 *c
16292 **d
16293 [[Category:Foo]]
16294 !! html/parsoid
16295 <ul><li>a
16296 <ul><li>b
16297 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16298 <li>c
16299 <ul><li>d</li></ul></li></ul>
16300 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16301 !! end
16302
16303 ## We used to, but no longer wt2wt this test since the default serializer
16304 ## will normalize all categories to serialize on their own line.
16305 ## This wikitext usage is going to be fairly uncommon in production and
16306 ## selser will take care of preserving formatting in those scenarios.
16307 !! test
16308 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16309 !! options
16310 parsoid=wt2html
16311 !! wikitext
16312 *a [[Category:Foo]]
16313 !! html/parsoid
16314 <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>
16315 !! end
16316
16317 # This test also demonstrates because of newline+category tunneling
16318 # through the list hander, template wrapping doesn't expand to the
16319 # containing list when the list item swallows the category.
16320 !! test
16321 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16322 !! wikitext
16323 *{{echo|a
16324 [[Category:Foo]]}}
16325 !! html/parsoid
16326 <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
16327 </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>
16328 !! end
16329
16330 !! test
16331 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16332 !! wikitext
16333 *a
16334
16335 {{echo|[[Category:Foo]]
16336 [[Category:Bar]]}}
16337 [[Category:Baz]]
16338 !! html/parsoid
16339 <ul><li>a</li></ul>
16340
16341 <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">
16342 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16343 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16344 !! end
16345
16346 !! test
16347 Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
16348 !! wikitext
16349 *a
16350
16351 [[Category:Bar]]<!--boo1--> <!--boo2-->
16352 [[Category:Baz]]<!--boo3--> <!--boo4-->
16353 !! html/parsoid
16354 <ul><li>a</li></ul>
16355
16356 <link rel="mw:PageProp/Category" href="./Category:Bar"/><!--boo1--> <!--boo2-->
16357 <link rel="mw:PageProp/Category" href="./Category:Baz"/><!--boo3--> <!--boo4-->
16358 !! end
16359
16360 !! test
16361 Categories and newlines: should behave properly with linkprefix (T87753)
16362 !! options
16363 language=ar
16364 !! wikitext
16365 foo bar
16366 foo bar
16367 [[تصنيف:Foo]]
16368 [[تصنيف:Bar]]
16369 !! html/php
16370 <p>foo bar
16371 foo bar
16372 </p>
16373 !! html/parsoid
16374 <p>foo bar
16375 foo bar</p>
16376 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16377 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16378 !! end
16379
16380 !! test
16381 No regressions on internal links following category (T174639)
16382 !! options
16383 parsoid=wt2html,html2html
16384 !! wikitext
16385 [[Category:Foo]]<div>a
16386
16387 [[Foo]]</div>
16388 !! html/php
16389 <div>a
16390 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16391
16392 !! html/parsoid
16393 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16394
16395 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16396 !! end
16397
16398 # Note that Parsoid differs slightly from PHP due to T175421
16399 !! test
16400 11. Special case where only newlines separate links (T175416)
16401 !! options
16402 parsoid=wt2html,html2html
16403 !! wikitext
16404 [[Category:Foo]]
16405
16406 [[Foo]][[es:Alimento]]
16407
16408 [[Foo]]
16409 !! html/php
16410 <p><br />
16411 <a href="/wiki/Foo" title="Foo">Foo</a>
16412 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16413 </p>
16414 !! html/parsoid
16415 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16416
16417 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16418
16419 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16420 !! end
16421
16422 !! test
16423 Category links with multiple namespaces
16424 !! wikitext
16425 [[Category:Project:Foo]]
16426 !! html/parsoid
16427 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16428 !! end
16429
16430 !! test
16431 Parsoid: Serialize link to category page with colon escape
16432 !! options
16433 parsoid
16434 !! wikitext
16435
16436 [[:Category:Foo]]
16437 [[:Category:Foo|Bar]]
16438 !! html
16439 <p>
16440 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16441 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16442 </p>
16443 !! end
16444
16445 # We used to, but no longer wt2wt this test since the default serializer
16446 # will normalize all categories to serialize on their own line.
16447 # This wikitext usage is going to be fairly uncommon in production and
16448 # selser will take care of preventing whitespace insertion if this
16449 # occurs in an article.
16450 #
16451 # html2html disabled for the same reason (whitespace insertion between
16452 # x and y).
16453 #
16454 # html2wt disabled because it localizes the "Category" namespace.
16455 !! test
16456 Link prefix/suffixes aren't applied to category links
16457 !! options
16458 parsoid=wt2html
16459 language=is
16460 !! wikitext
16461 x[[Category:Foo]]y
16462 !! html/php
16463 <p>xy
16464 </p>
16465 !! html/parsoid
16466 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16467 !! end
16468
16469 !! test
16470 Link prefix/suffixes aren't applied to language links
16471 !! options
16472 parsoid=wt2html
16473 language=is
16474 !! wikitext
16475 x[[es:Foo]]y
16476 !! html/php
16477 <p>xy
16478 </p>
16479 !! html/parsoid
16480 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16481 !! end
16482
16483 !! test
16484 Parsoid: Serialize link to file page with colon escape
16485 !! options
16486 parsoid
16487 !! wikitext
16488
16489 [[:File:Foo.png]]
16490 [[:File:Foo.png|Bar]]
16491 !! html
16492 <p>
16493 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16494 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16495 </p>
16496 !! end
16497
16498 !! test
16499 Parsoid: Serialize a genuine category link without colon escape
16500 !! options
16501 parsoid
16502 !! wikitext
16503 [[Category:Foo]]
16504 [[Category:Foo|Bar]]
16505 !! html
16506 <link rel="mw:PageProp/Category" href="./Category:Foo">
16507 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16508 !! end
16509
16510 !! test
16511 Normalize hrefs properly before testing for invalid link targets (T72894)
16512 !! options
16513 parsoid=html2wt
16514 !! html/parsoid
16515 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16516 !! wikitext
16517 [[Category:Toxine bactérienne]]
16518 !! end
16519
16520 !! test
16521 Parsoid: Defaultsort
16522 !! wikitext
16523 {{DEFAULTSORT:Foo}}
16524 !! html/parsoid
16525 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16526 !! end
16527
16528 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16529 # But, this is a limitation of our representation and is documented in
16530 # TemplateHandler.js in processSpecialMagicWord
16531 !! test
16532 Parsoid: Defaultsort (template-generated)
16533 !! wikitext
16534 {{{{echo|DEFAULTSORT}}:Foo}}
16535 !! html/parsoid
16536 <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"}]]}'/>
16537 !! end
16538
16539 ###
16540 ### Inter-language links
16541 ###
16542 !! test
16543 Interlanguage links
16544 !! options
16545 ill
16546 !! wikitext
16547 [[es:Alimento]]
16548 [[fr:Nourriture]]
16549 [[zh:食品]]
16550 !! html/php
16551 es:Alimento fr:Nourriture zh:食品
16552 !! html/parsoid
16553 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16554 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16555 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16556 !! end
16557
16558 !! test
16559 Duplicate interlanguage links (T26502)
16560 !! options
16561 ill
16562 !! wikitext
16563 [[es:1]]
16564 [[es:2]]
16565 [[fr:1]]
16566 [[fr:2]]
16567 !! html/php
16568 es:1 fr:1
16569 !! html/parsoid
16570 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16571 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16572 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16573 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16574 !! end
16575
16576 ###
16577 ### Sections
16578 ###
16579 !! test
16580 Basic section headings
16581 !! wikitext
16582 ==Headline 1==
16583 Some text
16584
16585 ==Headline 2==
16586 More
16587 ===Smaller headline===
16588 Blah blah
16589 !! html
16590 <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>
16591 <p>Some text
16592 </p>
16593 <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>
16594 <p>More
16595 </p>
16596 <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>
16597 <p>Blah blah
16598 </p>
16599 !! end
16600
16601 !! test
16602 Section headings with TOC
16603 !! wikitext
16604 ==Headline 1==
16605 ===Subheadline 1===
16606 =====Skipping a level=====
16607 ======Skipping a level======
16608
16609 ==Headline 2==
16610 Some text
16611 ===Another headline===
16612 !! html
16613 <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>
16614 <ul>
16615 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16616 <ul>
16617 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16618 <ul>
16619 <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>
16620 <ul>
16621 <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>
16622 </ul>
16623 </li>
16624 </ul>
16625 </li>
16626 </ul>
16627 </li>
16628 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16629 <ul>
16630 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16631 </ul>
16632 </li>
16633 </ul>
16634 </div>
16635
16636 <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>
16637 <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>
16638 <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>
16639 <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>
16640 <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>
16641 <p>Some text
16642 </p>
16643 <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>
16644
16645 !! end
16646
16647 !! test
16648 TOC anchors don't collide
16649 !! wikitext
16650 __FORCETOC__
16651 ==Headline 2==
16652 ==Headline==
16653 ==Headline 2==
16654 ==Headline==
16655 !! html/php
16656 <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>
16657 <ul>
16658 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16659 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16660 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16661 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16662 </ul>
16663 </div>
16664
16665 <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>
16666 <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>
16667 <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>
16668 <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>
16669
16670 !! end
16671
16672 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16673 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
16674 !! test
16675 Handling of sections up to level 6 and beyond
16676 !! options
16677 parsoid=wt2html
16678 !! wikitext
16679 =Level 1 Heading=
16680 ==Level 2 Heading==
16681 ===Level 3 Heading===
16682 ====Level 4 Heading====
16683 =====Level 5 Heading=====
16684 ======Level 6 Heading======
16685 =======Level 7 Heading=======
16686 ========Level 8 Heading========
16687 =========Level 9 Heading=========
16688 ==========Level 10 Heading==========
16689 !! html/php
16690 <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>
16691 <ul>
16692 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16693 <ul>
16694 <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>
16695 <ul>
16696 <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>
16697 <ul>
16698 <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>
16699 <ul>
16700 <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>
16701 <ul>
16702 <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>
16703 <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>
16704 <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>
16705 <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>
16706 <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>
16707 </ul>
16708 </li>
16709 </ul>
16710 </li>
16711 </ul>
16712 </li>
16713 </ul>
16714 </li>
16715 </ul>
16716 </li>
16717 </ul>
16718 </div>
16719
16720 <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>
16721 <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>
16722 <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>
16723 <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>
16724 <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>
16725 <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>
16726 <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>
16727 <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>
16728 <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>
16729 <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>
16730
16731 !! html/parsoid
16732 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
16733 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
16734 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
16735 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
16736 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
16737 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
16738 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
16739 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
16740 <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>
16741 <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>
16742 !! end
16743
16744 !! test
16745 TOC regression (T11764)
16746 !! wikitext
16747 ==title 1==
16748 ===title 1.1===
16749 ====title 1.1.1====
16750 ===title 1.2===
16751 ==title 2==
16752 ===title 2.1===
16753 !! html
16754 <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>
16755 <ul>
16756 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16757 <ul>
16758 <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>
16759 <ul>
16760 <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>
16761 </ul>
16762 </li>
16763 <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>
16764 </ul>
16765 </li>
16766 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16767 <ul>
16768 <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>
16769 </ul>
16770 </li>
16771 </ul>
16772 </div>
16773
16774 <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>
16775 <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>
16776 <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>
16777 <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>
16778 <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>
16779 <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>
16780
16781 !! end
16782
16783 !! test
16784 TOC for heading containing <span id="..."></span> (T96153)
16785 !! wikitext
16786 __FORCETOC__
16787 ==<span id="old-anchor"></span>New title==
16788 !! html/php
16789 <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>
16790 <ul>
16791 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16792 </ul>
16793 </div>
16794
16795 <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>
16796
16797 !! end
16798
16799 !! test
16800 TOC with wgMaxTocLevel=3 (T8204)
16801 !! options
16802 wgMaxTocLevel=3
16803 !! wikitext
16804 ==title 1==
16805 ===title 1.1===
16806 ====title 1.1.1====
16807 ===title 1.2===
16808 ==title 2==
16809 ===title 2.1===
16810 !! html
16811 <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>
16812 <ul>
16813 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16814 <ul>
16815 <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>
16816 <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>
16817 </ul>
16818 </li>
16819 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16820 <ul>
16821 <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>
16822 </ul>
16823 </li>
16824 </ul>
16825 </div>
16826
16827 <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>
16828 <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>
16829 <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>
16830 <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>
16831 <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>
16832 <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>
16833
16834 !! end
16835
16836 !! test
16837 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16838 !! options
16839 wgMaxTocLevel=3
16840 !! wikitext
16841 ==Section 1==
16842 ===Section 1.1===
16843 ====Section 1.1.1====
16844 ====Section 1.1.1.1====
16845 ==Section 2==
16846 !! html
16847 <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>
16848 <ul>
16849 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16850 <ul>
16851 <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>
16852 </ul>
16853 </li>
16854 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16855 </ul>
16856 </div>
16857
16858 <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>
16859 <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>
16860 <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>
16861 <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>
16862 <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>
16863
16864 !! end
16865
16866
16867 !! test
16868 Resolving duplicate section names
16869 !! wikitext
16870 ==Foo bar==
16871 ==Foo bar==
16872 !! html
16873 <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>
16874 <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>
16875
16876 !! end
16877
16878 !! test
16879 Resolving duplicate section names with differing case (T12721)
16880 !! wikitext
16881 ==Foo bar==
16882 ==Foo Bar==
16883 !! html
16884 <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>
16885 <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>
16886
16887 !! end
16888
16889 !! article
16890 Template:sections
16891 !! text
16892 ===Section 1===
16893 ==Section 2==
16894 !! endarticle
16895
16896 !! test
16897 Template with sections, __NOTOC__
16898 !! wikitext
16899 __NOTOC__
16900 ==Section 0==
16901 {{sections}}
16902 ==Section 4==
16903 !! html
16904 <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>
16905 <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>
16906 <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>
16907 <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>
16908
16909 !! end
16910
16911 !! test
16912 __NOEDITSECTION__ keyword
16913 !! wikitext
16914 __NOEDITSECTION__
16915 ==Section 1==
16916 ==Section 2==
16917 !! html
16918 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16919 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16920
16921 !! end
16922
16923 !! test
16924 Link inside a section heading
16925 !! wikitext
16926 ==Section with a [[Main Page|link]] in it==
16927 !! html
16928 <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>
16929
16930 !! end
16931
16932 !! test
16933 TOC regression (T14077)
16934 !! wikitext
16935 __TOC__
16936 ==title 1==
16937 ===title 1.1===
16938 ==title 2==
16939 !! html
16940 <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>
16941 <ul>
16942 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16943 <ul>
16944 <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>
16945 </ul>
16946 </li>
16947 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16948 </ul>
16949 </div>
16950
16951 <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>
16952 <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>
16953 <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>
16954
16955 !! end
16956
16957 !! test
16958 T3219 URL next to image (good)
16959 !! wikitext
16960 http://example.com [[File:Foobar.jpg]]
16961 !! html/php
16962 <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>
16963 </p>
16964 !! html/parsoid
16965 <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>
16966 !!end
16967
16968 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
16969 !! test
16970 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16971 !! options
16972 parsoid=wt2html,html2html
16973 !! wikitext
16974 ===
16975 The line above must have a trailing space!
16976 === <!--
16977 --> <!-- -->
16978 But just in case it doesn't...
16979 !! html/php
16980 <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>
16981 <p>The line above must have a trailing space!
16982 </p>
16983 <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>
16984 <p>But just in case it doesn't...
16985 </p>
16986 !! html/parsoid
16987 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
16988 <p>The line above must have a trailing space!</p>
16989 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
16990 --> <!-- -->
16991 <p>But just in case it doesn't...</p>
16992 !! end
16993
16994 !! test
16995 Header with special characters (T27462)
16996 !! wikitext
16997 The tooltips shall not show entities to the user (ie. be double escaped)
16998
16999 ==text > text==
17000 section 1
17001
17002 ==text < text==
17003 section 2
17004
17005 ==text & text==
17006 section 3
17007
17008 ==text ' text==
17009 section 4
17010
17011 ==text " text==
17012 section 5
17013 !! html/php
17014 <p>The tooltips shall not show entities to the user (ie. be double escaped)
17015 </p>
17016 <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>
17017 <ul>
17018 <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>
17019 <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>
17020 <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>
17021 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
17022 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
17023 </ul>
17024 </div>
17025
17026 <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>
17027 <p>section 1
17028 </p>
17029 <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>
17030 <p>section 2
17031 </p>
17032 <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>
17033 <p>section 3
17034 </p>
17035 <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>
17036 <p>section 4
17037 </p>
17038 <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>
17039 <p>section 5
17040 </p>
17041 !! html/parsoid
17042 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
17043
17044 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
17045 <p>section 1</p>
17046
17047 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
17048 <p>section 2</p>
17049
17050 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
17051 <p>section 3</p>
17052
17053 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
17054 <p>section 4</p>
17055
17056 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
17057 <p>section 5</p>
17058 !! end
17059
17060 !! test
17061 Header with space, plus and underscore as entity
17062 !! wikitext
17063 Id should not contain + for spaces
17064
17065 ==Space between Text==
17066 section 1
17067
17068 ==Space-Entity&#32;between&#32;Text==
17069 section 2
17070
17071 ==Plus+between+Text==
17072 section 3
17073
17074 ==Plus-Entity&#43;between&#43;Text==
17075 section 4
17076
17077 ==Underscore_between_Text==
17078 section 5
17079
17080 ==Underscore-Entity&#95;between&#95;Text==
17081 section 6
17082
17083 [[#Space between Text]]
17084 [[#Space-Entity&#32;between&#32;Text]]
17085 [[#Plus+between+Text]]
17086 [[#Plus-Entity&#43;between&#43;Text]]
17087 [[#Underscore_between_Text]]
17088 [[#Underscore-Entity&#95;between&#95;Text]]
17089 !! html/php
17090 <p>Id should not contain + for spaces
17091 </p>
17092 <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>
17093 <ul>
17094 <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>
17095 <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>
17096 <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>
17097 <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>
17098 <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>
17099 <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>
17100 </ul>
17101 </div>
17102
17103 <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>
17104 <p>section 1
17105 </p>
17106 <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>
17107 <p>section 2
17108 </p>
17109 <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>
17110 <p>section 3
17111 </p>
17112 <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>
17113 <p>section 4
17114 </p>
17115 <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>
17116 <p>section 5
17117 </p>
17118 <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>
17119 <p>section 6
17120 </p><p><a href="#Space_between_Text">#Space between Text</a>
17121 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
17122 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
17123 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
17124 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17125 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17126 </p>
17127 !! html/parsoid
17128 <p>Id should not contain + for spaces</p>
17129
17130 <h2 id="Space_between_Text">Space between Text</h2>
17131 <p>section 1</p>
17132
17133 <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>
17134 <p>section 2</p>
17135
17136 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
17137 <p>section 3</p>
17138
17139 <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>
17140 <p>section 4</p>
17141
17142 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
17143 <p>section 5</p>
17144
17145 <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>
17146 <p>section 6</p>
17147
17148 <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>
17149 <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>
17150 <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>
17151 <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>
17152 <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>
17153 <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>
17154 !! end
17155
17156 # Parsoid html2wt disabled because it adds padding spaces around =
17157 !! test
17158 Headers with excess '=' characters
17159 (Are similar tests necessary beyond the 1st level?)
17160 !! options
17161 parsoid=wt2html,wt2wt,html2html
17162 !! wikitext
17163 =foo==
17164 ==foo=
17165 =''italic'' heading==
17166 ==''italic'' heading=
17167 !! html/php
17168 <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>
17169 <ul>
17170 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17171 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17172 <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>
17173 <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>
17174 </ul>
17175 </div>
17176
17177 <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>
17178 <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>
17179 <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>
17180 <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>
17181
17182 !! html/parsoid
17183 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
17184 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
17185 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
17186 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
17187 !! end
17188
17189 !! test
17190 HTML headers vs TOC (T25393)
17191 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17192 !! wikitext
17193 <h1>Header 1</h1>
17194 ==Header 1.1==
17195 ==Header 1.2==
17196
17197 <h1>Header 2
17198 </h1>
17199 ==Header 2.1==
17200 ==Header 2.2==
17201 __NOEDITSECTION__
17202 !! html/php
17203 <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>
17204 <ul>
17205 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17206 <ul>
17207 <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>
17208 <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>
17209 </ul>
17210 </li>
17211 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
17212 <ul>
17213 <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>
17214 <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>
17215 </ul>
17216 </li>
17217 </ul>
17218 </div>
17219
17220 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17221 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17222 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17223 <h1><span class="mw-headline" id="Header_2">Header 2
17224 </span></h1>
17225 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17226 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17227
17228 !! html/parsoid
17229 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17230 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17231 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17232
17233 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17234 </h1>
17235 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17236 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17237 <meta property="mw:PageProp/noeditsection"/>
17238 !! end
17239
17240 !! test
17241 Single-line or multiline-comments can follow headings
17242 !! options
17243 parsoid=wt2html,wt2wt
17244 !! wikitext
17245 ==foo==<!---->
17246 ==bar==<!--c1-->
17247 ==baz==<!--
17248 c2
17249 c3-->
17250 !! html/php
17251 <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>
17252 <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>
17253 <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>
17254
17255 !! html/parsoid
17256 <h2 id="foo">foo</h2><!---->
17257 <h2 id="bar">bar</h2><!--c1-->
17258 <h2 id="baz">baz</h2><!--
17259 c2
17260 c3-->
17261 !! end
17262
17263 !! test
17264 T3219 URL next to image (broken)
17265 !! wikitext
17266 http://example.com[[File:Foobar.jpg]]
17267 !! html/php
17268 <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>
17269 </p>
17270 !! html/parsoid
17271 <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>
17272 !!end
17273
17274 !! test
17275 T3186 news: in the middle of text
17276 !! wikitext
17277 http://en.wikinews.org/wiki/Wikinews:Workplace
17278 !! html
17279 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17280 </p>
17281 !!end
17282
17283
17284 !! test
17285 Namespaced link must have a title
17286 !! wikitext
17287 [[Project:]]
17288 !! html
17289 <p>[[Project:]]
17290 </p>
17291 !!end
17292
17293 !! test
17294 Namespaced link must have a title (bad fragment version)
17295 !! wikitext
17296 [[Project:#fragment]]
17297 !! html
17298 <p>[[Project:#fragment]]
17299 </p>
17300 !!end
17301
17302
17303 ###
17304 ### HTML tags and HTML attributes
17305 ###
17306
17307 !! test
17308 div with no attributes
17309 !! wikitext
17310 <div>HTML rocks</div>
17311 !! html
17312 <div>HTML rocks</div>
17313
17314 !! end
17315
17316 !! test
17317 div with double-quoted attribute
17318 !! wikitext
17319 <div id="rock">HTML rocks</div>
17320 !! html
17321 <div id="rock">HTML rocks</div>
17322
17323 !! end
17324
17325 !! test
17326 div with single-quoted attribute
17327 !! wikitext
17328 <div id='rock'>HTML rocks</div>
17329 !! html
17330 <div id="rock">HTML rocks</div>
17331
17332 !! end
17333
17334 !! test
17335 div with unquoted attribute
17336 !! wikitext
17337 <div id=rock>HTML rocks</div>
17338 !! html
17339 <div id="rock">HTML rocks</div>
17340
17341 !! end
17342
17343 !! test
17344 div with illegal double attributes
17345 !! wikitext
17346 <div id="a" id="b">HTML rocks</div>
17347 !! html
17348 <div id="b">HTML rocks</div>
17349
17350 !!end
17351
17352 !! test
17353 div with empty attribute value, space before equals
17354 !! options
17355 parsoid=wt2html,html2html
17356 !! wikitext
17357 <div class =>HTML rocks</div>
17358 !! html/php
17359 <div class="">HTML rocks</div>
17360
17361 !! html/parsoid
17362 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17363 !! end
17364
17365 !! test
17366 div with multiple empty attribute values
17367 !! config
17368 wgFragmentMode=[ 'html5', 'legacy' ]
17369 !! options
17370 parsoid=wt2html,html2html
17371 !! wikitext
17372 <div id= title=>HTML rocks</div>
17373 !! html/php
17374 <div id="title=">HTML rocks</div>
17375
17376 !! html/parsoid
17377 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17378 !! end
17379
17380 # FIXME Parsoid doesn't actually match PHP here.
17381 # Probably we should use the synthetic <foo /> or <indicator>
17382 # extensions for this test, which are enabled when running parser tests.
17383 !! test
17384 Extension tag in attribute value
17385 !! wikitext
17386 <span title="<translate>123</translate>">ok</span>
17387 !! html/php+disabled
17388 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17389 </p>
17390 !! html/parsoid
17391 <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>
17392 !! end
17393
17394 !! test
17395 table with multiple empty attribute values
17396 !! options
17397 parsoid=wt2html,html2html
17398 !! wikitext
17399 {| title= id=
17400 |hi
17401 |}
17402 !! html/php
17403 <table title="id=">
17404 <tr>
17405 <td>hi
17406 </td></tr></table>
17407
17408 !! html/parsoid
17409 <table title="id=">
17410 <tbody><tr><td>hi</td></tr>
17411 </tbody></table>
17412 !! end
17413
17414 !! test
17415 div with braces in attribute value
17416 !! wikitext
17417 <div title="{}">Foo</div>
17418 !! html/php
17419 <div title="&#123;&#125;">Foo</div>
17420
17421 !! html/parsoid
17422 <div title="{}">Foo</div>
17423 !! end
17424
17425 !! test
17426 div with empty attribute value, no space before equals
17427 !! options
17428 parsoid=wt2html,html2html
17429 !! wikitext
17430 <div class=>HTML rocks</div>
17431 !! html/php
17432 <div class="">HTML rocks</div>
17433
17434 !! html/parsoid
17435 <div class="">HTML rocks</div>
17436 !! end
17437
17438 !! test
17439 HTML multiple attributes correction
17440 !! wikitext
17441 <p class="error" class="awesome">Awesome!</p>
17442 !! html
17443 <p class="awesome">Awesome!</p>
17444
17445 !!end
17446
17447 !! test
17448 Table multiple attributes correction
17449 !! wikitext
17450 {|
17451 !+ class="error" class="awesome"|status
17452 |}
17453 !! html
17454 <table>
17455 <tr>
17456 <th class="awesome">status
17457 </th></tr></table>
17458
17459 !!end
17460
17461 !! test
17462 DIV IN UPPERCASE
17463 !! wikitext
17464 <DIV ID="x">HTML ROCKS</DIV>
17465 !! html
17466 <div id="x">HTML ROCKS</div>
17467
17468 !!end
17469
17470 !! test
17471 Non-ASCII pseudo-tags are rendered as text
17472 !! wikitext
17473 <khyô>
17474 !! html
17475 <p>&lt;khyô&gt;
17476 </p>
17477 !! end
17478
17479 !! test
17480 Pseudo-tag with URL 'name' renders as url link
17481 !! wikitext
17482 <http://example.com/>
17483 !! html
17484 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17485 </p>
17486 !! end
17487
17488 !! test
17489 text with amp in the middle of nowhere
17490 !! wikitext
17491 Remember AT&T?
17492 !! html
17493 <p>Remember AT&amp;T?
17494 </p>
17495 !! end
17496
17497 !! test
17498 text with character entity: eacute
17499 !! wikitext
17500 I always thought &eacute; was a cute letter.
17501 !! html+tidy
17502 <p>I always thought &#233; was a cute letter.
17503 </p>
17504 !! end
17505
17506 !! test
17507 text with entity-escaped character entity-like string: eacute
17508 !! wikitext
17509 I always thought &amp;eacute; was a cute letter.
17510 !! html
17511 <p>I always thought &amp;eacute; was a cute letter.
17512 </p>
17513 !! end
17514
17515 !! test
17516 text with undefined character entity: xacute
17517 !! wikitext
17518 I always thought &xacute; was a cute letter.
17519 !! html
17520 <p>I always thought &amp;xacute; was a cute letter.
17521 </p>
17522 !! end
17523
17524 !! test
17525 HTML5 tags
17526 !! wikitext
17527 <data value="5">five</data>
17528 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17529 <mark>This highlighted text</mark>
17530 !! html
17531 <p><data value="5">five</data>
17532 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17533 <mark>This highlighted text</mark>
17534 </p>
17535 !! end
17536
17537 !! test
17538 HTML tag with leading space is parsed as text
17539 !! wikitext
17540 < div>foo< /div>
17541 !! html
17542 <p>&lt; div&gt;foo&lt; /div&gt;
17543 </p>
17544 !! end
17545
17546 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17547 ## the HTML5 parsing spec.
17548 !! test
17549 Element with broken attribute syntax
17550 !! options
17551 parsoid=wt2html
17552 !! wikitext
17553 <div style=" style="123">hi</div>
17554 <div =>ho</div>
17555 !! html/php
17556 <div style="123">hi</div>
17557 <div>ho</div>
17558
17559 !! html/parsoid
17560 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17561 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17562 !! end
17563
17564 ###
17565 ### Nesting tests (see T43545, T52604, T53081)
17566 ###
17567
17568 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17569 # Note that html2wt is considerably more difficult if we use <b> in
17570 # the test case, instead of <small>
17571 !! test
17572 Ensure that HTML adoption agency algorithm is properly implemented.
17573 !! wikitext
17574 <small>X<small>Y</small>Z</small>
17575 !! html
17576 <p><small>X<small>Y</small>Z</small>
17577 </p>
17578 !! end
17579
17580 # This was T43545 in the PHP parser.
17581 !! test
17582 Nesting of <kbd>
17583 !! wikitext
17584 <kbd>X<kbd>Y</kbd>Z</kbd>
17585 !! html+tidy
17586 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17587 </p>
17588 !! end
17589
17590 # The following cases were T53081 in the PHP parser.
17591 # Note that there are some other nestable tags (b, i, etc) which are
17592 # not covered; see T53081 for discussion.
17593
17594 !! test
17595 Nesting of <em>
17596 !! wikitext
17597 <em>X<em>Y</em>Z</em>
17598 !! html+tidy
17599 <p><em>X<em>Y</em>Z</em>
17600 </p>
17601 !! end
17602
17603 !! test
17604 Nesting of <strong>
17605 !! wikitext
17606 <strong>X<strong>Y</strong>Z</strong>
17607 !! html+tidy
17608 <p><strong>X<strong>Y</strong>Z</strong>
17609 </p>
17610 !! end
17611
17612 !! test
17613 Nesting of <q>
17614 !! wikitext
17615 <q>X<q>Y</q>Z</q>
17616 !! html+tidy
17617 <p><q>X<q>Y</q>Z</q>
17618 </p>
17619 !! end
17620
17621 !! test
17622 Nesting of <ruby>
17623 !! wikitext
17624 <ruby>X<ruby>Y</ruby>Z</ruby>
17625 !! html
17626 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17627 </p>
17628 !! end
17629
17630 !! test
17631 Nesting of <bdo>
17632 !! wikitext
17633 <bdo>X<bdo>Y</bdo>Z</bdo>
17634 !! html
17635 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17636 </p>
17637 !! end
17638
17639
17640 ###
17641 ### Media links
17642 ###
17643
17644 !! test
17645 Media link
17646 !! wikitext
17647 [[Media:Foobar.jpg]]
17648 [[Media:Video.ogv]]
17649 [[:Media:Video.ogv]]
17650 !! html/php
17651 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17652 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17653 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17654 </p>
17655 !! html/parsoid
17656 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17657 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17658 <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>
17659 !! end
17660
17661 !! test
17662 Media link with text
17663 !! wikitext
17664 [[Media:Foobar.jpg|A neat file to look at]]
17665 !! html/php
17666 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17667 </p>
17668 !! html/parsoid
17669 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17670 !! end
17671
17672 # FIXME: this is still bad HTML tag nesting
17673 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17674 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
17675 !! test
17676 Media link with nasty text
17677 !! wikitext
17678 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17679 !! html/php
17680 <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>
17681
17682 !! html/php+tidy
17683 <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>
17684 !! html/parsoid
17685 <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>
17686
17687 !! end
17688
17689 !! test
17690 Media link to nonexistent file (T3702)
17691 !! wikitext
17692 [[Media:No such.jpg]]
17693 [[Media:No_such file.jpg]]
17694 !! html/php
17695 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17696 <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>
17697 </p>
17698 !! html/parsoid
17699 <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>
17700 <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>
17701 !! end
17702
17703 !! test
17704 Image link to nonexistent file (T3850 - good)
17705 !! wikitext
17706 [[File:No_such.jpg]]
17707 !! html/php
17708 <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>
17709 </p>
17710 !! html/parsoid
17711 <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>
17712 !! end
17713
17714 !! test
17715 :Image link to nonexistent file (T3850 - bad)
17716 !! wikitext
17717 [[:Image:No such.jpg]]
17718 !! html/php
17719 <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>
17720 </p>
17721 !! html/parsoid
17722 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17723 !! end
17724
17725 !! test
17726 Character reference normalization in link text (T3938)
17727 !! wikitext
17728 [[Main Page|this&that]]
17729 !! html
17730 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17731 </p>
17732 !!end
17733
17734 !! article
17735 אַ
17736 !! text
17737 Test for unicode normalization
17738
17739 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17740 !! endarticle
17741
17742 !! test
17743 (T21451) Links should refer to the normalized form.
17744 !! wikitext
17745 [[&#xFB2E;]]
17746 [[&#x5d0;&#x5b7;]]
17747 [[&#x5d0;ַ]]
17748 [[א&#x5b7;]]
17749 [[אַ]]
17750 !! html
17751 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17752 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17753 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17754 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17755 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17756 </p>
17757 !! end
17758
17759 !! test
17760 Empty attribute crash test (T4067)
17761 !! wikitext
17762 <font color="">foo</font>
17763 !! html
17764 <p><font color="">foo</font>
17765 </p>
17766 !! end
17767
17768 !! test
17769 Empty attribute crash test single-quotes (T4067)
17770 !! wikitext
17771 <font color=''>foo</font>
17772 !! html
17773 <p><font color="">foo</font>
17774 </p>
17775 !! end
17776
17777 !! test
17778 Attribute test: equals, then nothing
17779 !! options
17780 parsoid=wt2html,html2html
17781 !! wikitext
17782 <font color=>foo</font>
17783 !! html/php
17784 <p><font color="">foo</font>
17785 </p>
17786 !! html/parsoid
17787 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17788 !! end
17789
17790 !! test
17791 Attribute test: unquoted value
17792 !! options
17793 parsoid=wt2html,html2html
17794 !! wikitext
17795 <font color=x>foo</font>
17796 !! html/php
17797 <p><font color="x">foo</font>
17798 </p>
17799 !! html/parsoid
17800 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17801 !! end
17802
17803 !! test
17804 Attribute test: unquoted but illegal value (hash)
17805 !! wikitext
17806 <font color=#x>foo</font>
17807 !! html
17808 <p><font color="#x">foo</font>
17809 </p>
17810 !! end
17811
17812 # Parsoid does not serialize to empty attribute syntax,
17813 # so wt2wt and html2wt cases are skipped
17814 !! test
17815 Attribute test: no value (T54330)
17816 !! options
17817 parsoid=wt2html,html2html
17818 !! wikitext
17819 <font color>foo</font>
17820 !! html/php
17821 <p><font color="">foo</font>
17822 </p>
17823 !! html/parsoid
17824 <p><font color="">foo</font></p>
17825 !! end
17826
17827 !! test
17828 T4095: link with three closing brackets
17829 !! wikitext
17830 [[Main Page]]]
17831 !! html/php
17832 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17833 </p>
17834 !! html/parsoid
17835 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17836 !! end
17837
17838 !! test
17839 T4095: link with pipe and three closing brackets
17840 !! wikitext
17841 [[Main Page|link]]]
17842 !! html/php
17843 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17844 </p>
17845 !! html/parsoid
17846 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17847 !! end
17848
17849 !! test
17850 T4095: link with pipe and three closing brackets, version 2
17851 !! wikitext
17852 [[Main Page|[http://example.com/]]]
17853 !! html/php
17854 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17855 </p>
17856 !! html/parsoid
17857 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17858 !! end
17859
17860
17861 ###
17862 ### Safety
17863 ###
17864
17865 !! article
17866 Template:Dangerous attribute
17867 !! text
17868 " onmouseover="alert(document.cookie)
17869 !! endarticle
17870
17871 !! article
17872 Template:Dangerous style attribute
17873 !! text
17874 border-size: expression(alert(document.cookie))
17875 !! endarticle
17876
17877 !! article
17878 Template:Div style
17879 !! text
17880 <div style="float: right; {{{1}}}">Magic div</div>
17881 !! endarticle
17882
17883 !! test
17884 T4304: HTML attribute safety (safe template; regression T4309)
17885 !! wikitext
17886 <div title="{{test}}"></div>
17887 !! html/php
17888 <div title="This is a test template"></div>
17889
17890 !! html/parsoid
17891 <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>
17892 !! end
17893
17894 # Parsoid has enough context to handle this case
17895 !! test
17896 T4304: HTML attribute safety (dangerous template; 2309)
17897 !! wikitext
17898 <div title="{{dangerous attribute}}"></div>
17899 !! html/php
17900 <div title=""></div>
17901
17902 !! html/parsoid
17903 <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>
17904 !! end
17905
17906 !! test
17907 T4304: HTML attribute safety (dangerous style template; 2309)
17908 !! wikitext
17909 <div style="{{dangerous style attribute}}"></div>
17910 !! html/php
17911 <div style="/* insecure input */"></div>
17912
17913 !! html/parsoid
17914 <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>
17915 !! end
17916
17917 !! test
17918 T4304: HTML attribute safety (safe parameter; 2309)
17919 !! wikitext
17920 {{div style|width: 200px}}
17921 !! html/php
17922 <div style="float: right; width: 200px">Magic div</div>
17923
17924 !! html/parsoid
17925 <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>
17926 !! end
17927
17928 !! test
17929 T4304: HTML attribute safety (unsafe parameter; 2309)
17930 !! wikitext
17931 {{div style|width: expression(alert(document.cookie))}}
17932 !! html/php
17933 <div style="/* insecure input */">Magic div</div>
17934
17935 !! html/parsoid
17936 <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>
17937 !! end
17938
17939 ## Parsoid output here differs; needs investigation.
17940 !! test
17941 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17942 !! wikitext
17943 {{div style|"><script>alert(document.cookie)</script>}}
17944 !! html
17945 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17946
17947 !! end
17948
17949 ## Parsoid output here differs; needs investigation.
17950 !! test
17951 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17952 !! wikitext
17953 {{div style|" ><script>alert(document.cookie)</script>}}
17954 !! html
17955 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17956
17957 !! end
17958
17959 !! test
17960 T4304: HTML attribute safety (link)
17961 !! wikitext
17962 <div title="[[Main Page]]"></div>
17963 !! html/php
17964 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
17965
17966 !! html/parsoid
17967 <div title="[[Main Page]]"></div>
17968 !! end
17969
17970 !! test
17971 T4304: HTML attribute safety (italics)
17972 !! wikitext
17973 <div title="''foobar''"></div>
17974 !! html
17975 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17976
17977 !! end
17978
17979 !! test
17980 T4304: HTML attribute safety (bold)
17981 !! wikitext
17982 <div title="'''foobar'''"></div>
17983 !! html
17984 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17985
17986 !! end
17987
17988 !! test
17989 T4304: HTML attribute safety (ISBN)
17990 !! wikitext
17991 <div title="ISBN 1234567890"></div>
17992 !! html
17993 <div title="&#73;SBN 1234567890"></div>
17994
17995 !! end
17996
17997 !! test
17998 T4304: HTML attribute safety (RFC)
17999 !! wikitext
18000 <div title="RFC 1234"></div>
18001 !! html
18002 <div title="&#82;FC 1234"></div>
18003
18004 !! end
18005
18006 !! test
18007 T4304: HTML attribute safety (PMID)
18008 !! wikitext
18009 <div title="PMID 1234567890"></div>
18010 !! html
18011 <div title="&#80;MID 1234567890"></div>
18012
18013 !! end
18014
18015 !! test
18016 T4304: HTML attribute safety (web link)
18017 !! wikitext
18018 <div title="http://example.com/"></div>
18019 !! html
18020 <div title="http&#58;//example.com/"></div>
18021
18022 !! end
18023
18024 !! test
18025 T4304: HTML attribute safety (named web link)
18026 !! wikitext
18027 <div title="[http://example.com/ link]"></div>
18028 !! html/php
18029 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
18030
18031 !! html/parsoid
18032 <div title="[http://example.com/ link]"></div>
18033 !! end
18034
18035 !! test
18036 T5244: HTML attribute safety (extension; safe)
18037 !! wikitext
18038 <div style="<nowiki>background:blue</nowiki>"></div>
18039 !! html/php
18040 <div style="background:blue"></div>
18041
18042 !! html/parsoid
18043 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
18044 !! end
18045
18046 !! test
18047 T5244: HTML attribute safety (extension; unsafe)
18048 !! wikitext
18049 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
18050 !! html/php
18051 <div style="/* insecure input */"></div>
18052
18053 !! html/parsoid
18054 <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>
18055 !! end
18056
18057 # More MSIE fun discovered by Tom Gilder
18058
18059 !! test
18060 MSIE CSS safety test: spurious slash
18061 !! wikitext
18062 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
18063 !! html/php
18064 <div style="/* insecure input */">evil</div>
18065
18066 !! html/parsoid
18067 <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>
18068 !! end
18069
18070 !! test
18071 MSIE CSS safety test: hex code
18072 !! wikitext
18073 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
18074 !! html/php
18075 <div style="/* insecure input */">evil</div>
18076
18077 !! html/parsoid
18078 <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>
18079 !! end
18080
18081 !! test
18082 MSIE CSS safety test: comment in url
18083 !! wikitext
18084 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
18085 !! html/php
18086 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
18087
18088 !! html/parsoid
18089 <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>
18090 !! end
18091
18092 !! test
18093 MSIE CSS safety test: comment in expression
18094 !! wikitext
18095 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
18096 !! html/php
18097 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
18098
18099 !! html/parsoid
18100 <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>
18101 !! end
18102
18103 !! test
18104 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
18105 !! wikitext
18106 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
18107 !! html/php
18108 <p style="/* invalid control char */">A</p>
18109
18110 !! html/parsoid
18111 <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>
18112 !! end
18113
18114 !! test
18115 MSIE 6 CSS safety test: Fullwidth (T57332)
18116 !! wikitext
18117 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
18118 <div style="top:EXPRESSION(alert())">B</div>
18119 !! html/php
18120 <p style="/* insecure input */">A</p>
18121 <div style="/* insecure input */">B</div>
18122
18123 !! html/parsoid
18124 <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>
18125 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
18126 !! end
18127
18128 !! test
18129 MSIE 6 CSS safety test: IPA extensions (T57332)
18130 !! wikitext
18131 <div style="background-image:uʀʟ(javascript:alert())">A</div>
18132 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
18133 !! html/php
18134 <div style="/* insecure input */">A</div>
18135 <p style="/* insecure input */">B</p>
18136
18137 !! html/parsoid
18138 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
18139 <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>
18140 !! end
18141
18142 !! test
18143 MSIE 6 CSS safety test: sup/sub script (T57332)
18144 !! wikitext
18145 <div style="background-image:url⁽javascript:alert())">A</div>
18146 <div style="background-image:url₍javascript:alert())">B</div>
18147 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
18148 !! html/php
18149 <div style="/* insecure input */">A</div>
18150 <div style="/* insecure input */">B</div>
18151 <p style="/* insecure input */">C</p>
18152
18153 !! html/parsoid
18154 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
18155 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
18156 <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>
18157 !! end
18158
18159 !! test
18160 Opera -o-link CSS
18161 !! options
18162 parsoid=wt2html,html2html
18163 !! wikitext
18164 <div
18165 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;"
18166 style="-o-link:attr(title);-o-link-source:current">X</div>
18167 !! html/php
18168 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
18169
18170 !! html/parsoid
18171 <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>
18172 !! end
18173
18174 !! test
18175 MSIE 6 CSS safety test: Repetition markers (T57332)
18176 !! wikitext
18177 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
18178 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
18179 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
18180 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
18181 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
18182 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
18183 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
18184 !! html/php
18185 <p style="/* insecure input */">A</p>
18186 <p style="/* insecure input */">B</p>
18187 <p style="/* insecure input */">C</p>
18188 <p style="/* insecure input */">D</p>
18189 <p style="/* insecure input */">E</p>
18190 <p style="/* insecure input */">F</p>
18191 <p style="/* insecure input */">G</p>
18192
18193 !! html/parsoid
18194 <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>
18195 <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>
18196 <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>
18197 <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>
18198 <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>
18199 <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>
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;)"}}'>G</p>
18201 !! end
18202
18203 !! test
18204 Table attribute legitimate extension
18205 !! wikitext
18206 {|
18207 !+ style="<nowiki>color:blue</nowiki>"|status
18208 |}
18209 !! html
18210 <table>
18211 <tr>
18212 <th style="color:blue">status
18213 </th></tr></table>
18214
18215 !!end
18216
18217 !! test
18218 Table attribute safety
18219 !! wikitext
18220 {|
18221 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18222 |}
18223 !! html
18224 <table>
18225 <tr>
18226 <th style="/* insecure input */">status
18227 </th></tr></table>
18228
18229 !! end
18230
18231 !! test
18232 CSS line continuation 1
18233 !! wikitext
18234 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18235 !! html
18236 <div style="/* insecure input */"></div>
18237
18238 !! end
18239
18240 !! test
18241 CSS line continuation 2
18242 !! wikitext
18243 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18244 !! html
18245 <div style="/* invalid control char */"></div>
18246
18247 !! end
18248
18249 !! article
18250 Template:Identity
18251 !! text
18252 {{{1}}}
18253 !! endarticle
18254
18255 !! test
18256 Expansion of multi-line templates in attribute values (T8255)
18257 !! wikitext
18258 <div style="background: {{identity|#00FF00}}">-</div>
18259 !! html
18260 <div style="background: #00FF00">-</div>
18261
18262 !! end
18263
18264 !! test
18265 Expansion of multi-line templates in attribute values (T8255 sanity check)
18266 !! wikitext
18267 <div style="background:
18268 #00FF00">-</div>
18269 !! html/php
18270 <div style="background: #00FF00">-</div>
18271
18272 !! html/parsoid
18273 <div style="background:
18274 #00FF00">-</div>
18275 !! end
18276
18277 !! test
18278 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18279 !! wikitext
18280 <div style="background: &#10;#00FF00">-</div>
18281 !! html
18282 <div style="background: &#10;#00FF00">-</div>
18283
18284 !! end
18285
18286 !! test
18287 Tags which are hidden from tidiers cannot pass through the Sanitizer
18288 !! wikitext
18289 <mw:toc><script>alert();</script></mw:toc>
18290 !! html+tidy
18291 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18292 </p>
18293 !! end
18294
18295 ###
18296 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18297 ###
18298
18299 !! test
18300 Parser hook: empty input
18301 !! wikitext
18302 <tag></tag>
18303 !! html/php
18304 <pre>
18305 ''
18306 array (
18307 )
18308 </pre>
18309
18310 !! html/parsoid
18311 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18312 !! end
18313
18314 ## Don't expect parsoid to rt this form.
18315 !! test
18316 Parser hook: empty input using terminated empty elements
18317 !! options
18318 parsoid=wt2html,html2html
18319 !! wikitext
18320 <tag/>
18321 !! html/php
18322 <pre>
18323 NULL
18324 array (
18325 )
18326 </pre>
18327
18328 !! html/parsoid
18329 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18330 !! end
18331
18332 !! test
18333 Parser hook: empty input using terminated empty elements (space before)
18334 !! wikitext
18335 <tag />
18336 !! html/php
18337 <pre>
18338 NULL
18339 array (
18340 )
18341 </pre>
18342
18343 !! html/parsoid
18344 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18345 !! end
18346
18347 !! test
18348 Parser hook: basic input
18349 !! wikitext
18350 <tag>input</tag>
18351 !! html/php
18352 <pre>
18353 'input'
18354 array (
18355 )
18356 </pre>
18357
18358 !! html/parsoid
18359 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18360 !! end
18361
18362 ## Don't expect parsoid to rt this form.
18363 !! test
18364 Parser hook: case insensitive
18365 !! options
18366 parsoid=wt2html,html2html
18367 !! wikitext
18368 <TAG>input</TAG>
18369 !! html/php
18370 <pre>
18371 'input'
18372 array (
18373 )
18374 </pre>
18375
18376 !! html/parsoid
18377 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18378 !! end
18379
18380 ## Don't expect parsoid to rt this form.
18381 !! test
18382 Parser hook: case insensitive, redux
18383 !! options
18384 parsoid=wt2html,html2html
18385 !! wikitext
18386 <TaG>input</TAg>
18387 !! html/php
18388 <pre>
18389 'input'
18390 array (
18391 )
18392 </pre>
18393
18394 !! html/parsoid
18395 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18396 !! end
18397
18398 !! test
18399 Parser hook: nested tags
18400 !! wikitext
18401 <tag><tag></tag></tag>
18402 !! html/php
18403 <pre>
18404 '<tag>'
18405 array (
18406 )
18407 </pre>&lt;/tag&gt;
18408
18409 !! html/parsoid
18410 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
18411 !! end
18412
18413 !! test
18414 Parser hook: basic arguments
18415 !! wikitext
18416 <tag width="200" height="100" depth="50" square=""></tag>
18417 !! html/php
18418 <pre>
18419 ''
18420 array (
18421 'width' => '200',
18422 'height' => '100',
18423 'depth' => '50',
18424 'square' => '',
18425 )
18426 </pre>
18427
18428 !! html/parsoid
18429 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18430 !! end
18431
18432 ## Don't expect parsoid to rt this form.
18433 !! test
18434 Parser hook: basic arguments, variations
18435 !! options
18436 parsoid=wt2html,html2html
18437 !! wikitext
18438 <tag width=200 height = "100" depth = '50' square></tag>
18439 !! html/php
18440 <pre>
18441 ''
18442 array (
18443 'width' => '200',
18444 'height' => '100',
18445 'depth' => '50',
18446 'square' => '',
18447 )
18448 </pre>
18449
18450 !! html/parsoid
18451 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18452 !! end
18453
18454 !! test
18455 Parser hook: argument containing a forward slash (T7344)
18456 !! wikitext
18457 <tag filename="/tmp/bla"></tag>
18458 !! html/php
18459 <pre>
18460 ''
18461 array (
18462 'filename' => '/tmp/bla',
18463 )
18464 </pre>
18465
18466 !! html/parsoid
18467 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18468 !! end
18469
18470 ## Don't expect parsoid to rt this form.
18471 !! test
18472 Parser hook: empty input using terminated empty elements (T4374)
18473 !! options
18474 parsoid=wt2html,html2html
18475 !! wikitext
18476 <tag foo=bar/>text
18477 !! html/php
18478 <pre>
18479 NULL
18480 array (
18481 'foo' => 'bar',
18482 )
18483 </pre>text
18484
18485 !! html/parsoid
18486 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
18487 !! end
18488
18489 ## </tag> should be output literally since there is no matching tag that begins it
18490 ## Don't expect parsoid to rt this form.
18491 !! test
18492 Parser hook: basic arguments using terminated empty elements (T4374)
18493 !! options
18494 parsoid=wt2html
18495 !! wikitext
18496 <tag width=200 height = "100" depth = '50' square/>
18497 other stuff
18498 </tag>
18499 !! html/php
18500 <pre>
18501 NULL
18502 array (
18503 'width' => '200',
18504 'height' => '100',
18505 'depth' => '50',
18506 'square' => '',
18507 )
18508 </pre>
18509 <p>other stuff
18510 &lt;/tag&gt;
18511 </p>
18512 !! html/parsoid
18513 <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
18514 &lt;/tag></p>
18515 !! end
18516
18517 ## Don't expect parsoid to rt this form.
18518 !! test
18519 Parser hook: Don't allow unclosed extension tags
18520 !! options
18521 parsoid=wt2html
18522 !! wikitext
18523 test <tag>123
18524
18525 this is a '''test'''
18526 !! html/php
18527 <p>test &lt;tag&gt;123
18528 </p><p>this is a <b>test</b>
18529 </p>
18530 !! html/parsoid
18531 <p>test &lt;tag>123</p>
18532
18533 <p>this is a <b>test</b></p>
18534 !! end
18535
18536 !! test
18537 Parser hook: horizontal rule inside extension tag that outputs <pre>
18538 !! wikitext
18539 <tag>
18540 Hello
18541 <hr/>
18542 Goodbye
18543 </tag>
18544 !! html/php
18545 <pre>
18546 '
18547 Hello
18548 <hr/>
18549 Goodbye
18550 '
18551 array (
18552 )
18553 </pre>
18554
18555 !! end
18556
18557 ###
18558 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18559 ###
18560
18561 !! test
18562 Parser hook: static parser hook not inside a comment
18563 !! wikitext
18564 <statictag>hello, world</statictag>
18565
18566 <statictag action="flush" />
18567 !! html/php
18568 <p><br />
18569 hello, world
18570 </p>
18571 !! html/parsoid
18572 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18573 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18574 !! end
18575
18576 !! test
18577 Parser hook: static parser hook inside a comment
18578 !! wikitext
18579 <!-- <statictag>hello, world</statictag> -->
18580 <statictag action="flush" />
18581 !! html/php
18582 <p><br />
18583 </p>
18584 !! html/parsoid
18585 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18586 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18587 !! end
18588
18589 # Nested template calls; this case was broken by Parser.php rev 1.506,
18590 # since reverted.
18591
18592 !! article
18593 Template:One-parameter
18594 !! text
18595 (My parameter is: {{{1}}})
18596 !! endarticle
18597
18598 !! article
18599 Template:Map-one-parameter
18600 !! text
18601 {{{{{1}}}|{{{2}}}}}
18602 !! endarticle
18603
18604 !! test
18605 Nested template calls
18606 !! wikitext
18607 {{Map-one-parameter|One-parameter|param}}
18608 !! html
18609 <p>(My parameter is: param)
18610 </p>
18611 !! end
18612
18613
18614 ###
18615 ### Sanitizer
18616 ###
18617
18618 # Remex wraps empty tag runs with p-tags.
18619 # Parsoid strips them out during p-wrapping.
18620 !! test
18621 Sanitizer: Closing of open tags
18622 !! wikitext
18623 <s></s><table></table>
18624 !! html/php+tidy
18625 <p><s></s></p><table></table>
18626 !! html/parsoid
18627 <s></s><table></table>
18628 !! end
18629
18630 !! test
18631 Sanitizer: Closing of open but not closed tags
18632 !! wikitext
18633 <s>foo
18634 !! html
18635 <p><s>foo</s>
18636 </p>
18637 !! end
18638
18639 !! test
18640 Sanitizer: Closing of closed but not open tags
18641 !! options
18642 parsoid=wt2html
18643 !! wikitext
18644 </s>
18645 !! html/php+tidy
18646 <p class="mw-empty-elt">
18647 </p>
18648 !! html/parsoid
18649 !! end
18650
18651 !! test
18652 Sanitizer: Closing of closed but not open table tags
18653 !! options
18654 parsoid=wt2html
18655 !! wikitext
18656 Table not started</td></tr></table>
18657 !! html+tidy
18658 <p>Table not started
18659 </p>
18660 !! end
18661
18662 !! test
18663 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18664 !! config
18665 wgFragmentMode=[ 'html5', 'legacy' ]
18666 !! wikitext
18667 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18668 !! html/php
18669 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18670 </p>
18671 !! html/parsoid
18672 <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>
18673 !! end
18674
18675 !! test
18676 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18677 !! config
18678 wgFragmentMode=[ 'legacy' ]
18679 !! wikitext
18680 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18681 !! html/php
18682 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18683 </p>
18684 !! end
18685
18686 # In HTML5, the restrictions are that id must contain at least one character,
18687 # and must not contain any space characters.
18688 !! test
18689 Sanitizer: Validating the contents of the id attribute (T6515)
18690 !! options
18691 disabled
18692 !! wikitext
18693 <br id="" /><br id="a space" />
18694 !! html
18695 Something ...
18696 !! end
18697
18698 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18699 !! test
18700 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18701 !! options
18702 disabled
18703 !! wikitext
18704 <br id="foo" /><br id="foo" />
18705 !! html
18706 Something need to be done. foo-2 ?
18707 !! end
18708
18709 !! test
18710 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18711 !! wikitext
18712 <div itemscope>
18713 <meta itemprop="hello" content="world">
18714 <meta http-equiv="refresh" content="5">
18715 <meta itemprop="hello" http-equiv="refresh" content="5">
18716 <link itemprop="hello" href="{{SERVER}}">
18717 <link rel="stylesheet" href="{{SERVER}}">
18718 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18719 </div>
18720 !! html
18721 <div itemscope="">
18722 <p> <meta itemprop="hello" content="world" />
18723 &lt;meta http-equiv="refresh" content="5"&gt;
18724 <meta itemprop="hello" content="5" />
18725 <link itemprop="hello" href="http&#58;//example.org" />
18726 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18727 <link itemprop="hello" href="http&#58;//example.org" />
18728 </p>
18729 </div>
18730
18731 !! end
18732
18733 !! test
18734 Sanitizer: Strip comments from CSS attributes
18735 !! options
18736 parsoid=wt2html,wt2wt
18737 !! wikitext
18738 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18739 !! html/php
18740 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18741 </p>
18742 !! html/parsoid
18743 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18744 !! end
18745
18746 !! test
18747 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18748 !! wikitext
18749 [[meatball:Soft"Security]]
18750 !! html/php
18751 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18752 </p>
18753 !! html/parsoid
18754 <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>
18755 !! end
18756
18757 !! test
18758 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18759 !! wikitext
18760 [[meatball:Foo<Bar]]
18761 [[meatball:Foo>Bar]]
18762 [[meatball:Foo&lt;bar]]
18763 [[meatball:Foo&gt;bar]]
18764 !! html/php
18765 <p>[[meatball:Foo&lt;Bar]]
18766 [[meatball:Foo&gt;Bar]]
18767 [[meatball:Foo&lt;bar]]
18768 [[meatball:Foo&gt;bar]]
18769 </p>
18770 !! html/parsoid
18771 <p>[[meatball:Foo&lt;Bar]]
18772 [[meatball:Foo>Bar]]
18773 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
18774 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
18775 !! end
18776
18777 !! test
18778 Language converter: output gets cut off unexpectedly (T7757)
18779 !! options
18780 language=zh
18781 !! wikitext
18782 this bit is safe: }-
18783
18784 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18785
18786 then we get cut off here: }-
18787
18788 all additional text is vanished
18789 !! html/php
18790 <p>this bit is safe: }-
18791 </p><p>but if we add a conversion instance: xxx
18792 </p><p>then we get cut off here: }-
18793 </p><p>all additional text is vanished
18794 </p>
18795 !! html/parsoid
18796 <p>this bit is safe: }-</p>
18797 <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>
18798 <p>then we get cut off here: }-</p>
18799 <p>all additional text is vanished</p>
18800 !! end
18801
18802 !! test
18803 Language converter glossary rules inside attributes (T119158)
18804 !! options
18805 language=sr variant=sr-el
18806 !! wikitext
18807 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
18808
18809 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
18810 !! html/php
18811 <p>
18812 </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>
18813 </p>
18814 !! html/parsoid
18815 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
18816
18817 <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>
18818 !! end
18819
18820 !! test
18821 Self closed html pairs (T7487)
18822 !! wikitext
18823 <center><font id="bug" />Centered text</center>
18824 <div><font id="bug2" />In div text</div>
18825 !! html+tidy
18826 <center><font id="bug"></font>Centered text</center>
18827 <div><font id="bug2"></font>In div text</div>
18828 !! end
18829
18830 !! test
18831 Punctuation: nbsp before exclamation
18832 !! wikitext
18833 C'est grave !
18834 !! html
18835 <p>C'est grave&#160;!
18836 </p>
18837 !! end
18838
18839 !! test
18840 Punctuation: CSS !important (T13874)
18841 !! wikitext
18842 <div style="width:50% !important">important</div>
18843 !! html
18844 <div style="width:50%&#32;!important">important</div>
18845
18846 !!end
18847
18848 !! test
18849 Punctuation: CSS ! important (T13874; with space after)
18850 !! wikitext
18851 <div style="width:50% ! important">important</div>
18852 !! html
18853 <div style="width:50%&#32;! important">important</div>
18854
18855 !!end
18856
18857 !! test
18858 HTML bullet list, closed tags (T7497)
18859 !! wikitext
18860 <ul>
18861 <li>One</li>
18862 <li>Two</li>
18863 </ul>
18864 !! html/php
18865 <ul>
18866 <li>One</li>
18867 <li>Two</li>
18868 </ul>
18869
18870 !! html/parsoid
18871 <ul data-parsoid='{"stx":"html"}'>
18872 <li data-parsoid='{"stx":"html"}'>One</li>
18873 <li data-parsoid='{"stx":"html"}'>Two</li>
18874 </ul>
18875
18876 !! end
18877
18878 !! test
18879 HTML bullet list, unclosed tags (T7497)
18880 !! wikitext
18881 <ul>
18882 <li>One
18883 <li>Two
18884 </ul>
18885 !! html/php+tidy
18886 <ul>
18887 <li>One
18888 </li><li>Two
18889 </li></ul>
18890 !! html/parsoid
18891 <ul data-parsoid='{"stx":"html"}'>
18892 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18893 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18894 </ul>
18895
18896 !! end
18897
18898 !! test
18899 HTML ordered list, closed tags (T7497)
18900 !! wikitext
18901 <ol>
18902 <li>One</li>
18903 <li>Two</li>
18904 </ol>
18905 !! html/php
18906 <ol>
18907 <li>One</li>
18908 <li>Two</li>
18909 </ol>
18910
18911 !! html/parsoid
18912 <ol data-parsoid='{"stx":"html"}'>
18913 <li data-parsoid='{"stx":"html"}'>One</li>
18914 <li data-parsoid='{"stx":"html"}'>Two</li>
18915 </ol>
18916
18917 !! end
18918
18919 !! test
18920 HTML ordered list, unclosed tags (T7497)
18921 !! options
18922 !! wikitext
18923 <ol>
18924 <li>One
18925 <li>Two
18926 </ol>
18927 !! html/php+tidy
18928 <ol>
18929 <li>One
18930 </li><li>Two
18931 </li></ol>
18932 !! html/parsoid
18933 <ol data-parsoid='{"stx":"html"}'>
18934 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18935 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18936 </ol>
18937
18938 !! end
18939
18940 !! test
18941 HTML nested bullet list, closed tags (T7497)
18942 !! wikitext
18943 <ul>
18944 <li>One</li>
18945 <li>Two:
18946 <ul>
18947 <li>Sub-one</li>
18948 <li>Sub-two</li>
18949 </ul>
18950 </li>
18951 </ul>
18952 !! html/php
18953 <ul>
18954 <li>One</li>
18955 <li>Two:
18956 <ul>
18957 <li>Sub-one</li>
18958 <li>Sub-two</li>
18959 </ul>
18960 </li>
18961 </ul>
18962
18963 !! html/parsoid
18964 <ul data-parsoid='{"stx":"html"}'>
18965 <li data-parsoid='{"stx":"html"}'>One</li>
18966 <li data-parsoid='{"stx":"html"}'>Two:
18967 <ul data-parsoid='{"stx":"html"}'>
18968 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18969 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18970 </ul>
18971 </li>
18972 </ul>
18973 !! end
18974
18975 !! test
18976 HTML nested bullet list, open tags (T7497)
18977 !! wikitext
18978 <ul>
18979 <li>One
18980 <li>Two:
18981 <ul>
18982 <li>Sub-one
18983 <li>Sub-two
18984 </ul>
18985 </ul>
18986 !! html+tidy
18987 <ul>
18988 <li>One
18989 </li><li>Two:
18990 <ul>
18991 <li>Sub-one
18992 </li><li>Sub-two
18993 </li></ul>
18994 </li></ul>
18995 !! end
18996
18997 !! test
18998 HTML nested ordered list, closed tags (T7497)
18999 !! wikitext
19000 <ol>
19001 <li>One</li>
19002 <li>Two:
19003 <ol>
19004 <li>Sub-one</li>
19005 <li>Sub-two</li>
19006 </ol>
19007 </li>
19008 </ol>
19009 !! html
19010 <ol>
19011 <li>One</li>
19012 <li>Two:
19013 <ol>
19014 <li>Sub-one</li>
19015 <li>Sub-two</li>
19016 </ol>
19017 </li>
19018 </ol>
19019
19020 !! end
19021
19022 !! test
19023 HTML nested ordered list, open tags (T7497)
19024 !! wikitext
19025 <ol>
19026 <li>One
19027 <li>Two:
19028 <ol>
19029 <li>Sub-one
19030 <li>Sub-two
19031 </ol>
19032 </ol>
19033 !! html/php
19034 <ol>
19035 <li>One
19036 <li>Two:
19037 <ol>
19038 <li>Sub-one
19039 <li>Sub-two
19040 </ol>
19041 </ol>
19042
19043 !! html/parsoid
19044 <ol>
19045 <li>One
19046 </li>
19047 <li>Two:
19048 <ol>
19049 <li>Sub-one
19050 </li>
19051 <li>Sub-two
19052 </li>
19053 </ol>
19054 </li>
19055 </ol>
19056
19057 !! end
19058
19059 !! test
19060 HTML ordered list item with parameters oddity
19061 !! wikitext
19062 <ol><li id="fragment">One</li>
19063 </ol>
19064 !! html
19065 <ol><li id="fragment">One</li>
19066 </ol>
19067
19068 !! end
19069
19070 # parsoid doesn't explicitly mark autonumbered links, see T55505
19071 !!test
19072 T7918: autonumbering
19073 !! wikitext
19074 [http://first/] [http://second] [ftp://ftp]
19075
19076 ftp://inlineftp
19077
19078 [mailto:enclosed@mail.tld With target]
19079
19080 [mailto:enclosed@mail.tld]
19081
19082 mailto:inline@mail.tld
19083 !! html/php
19084 <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>
19085 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
19086 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
19087 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
19088 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
19089 </p>
19090 !! html/parsoid
19091 <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>
19092 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
19093 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
19094 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
19095 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
19096 !! end
19097
19098
19099 #
19100 # Security and HTML correctness
19101 # From Nick Jenkins' fuzz testing
19102 #
19103
19104 !! test
19105 Fuzz testing: Parser13
19106 !! wikitext
19107 {|
19108 | http://a|
19109 !! html
19110 <table>
19111 <tr>
19112 <td>
19113 </td>
19114 </tr>
19115 </table>
19116
19117 !! end
19118
19119 # Note that Parsoid output differs from the PHP parser here: the PHP
19120 # parser breaks the URL for the magic word, while in Parsoid the URL
19121 # production takes precedence.
19122 !! test
19123 Fuzz testing: Parser14
19124 !! wikitext
19125 ==onmouseover===
19126 http://__TOC__
19127 !! html/php
19128 <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>
19129 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>
19130 <ul>
19131 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19132 </ul>
19133 </div>
19134
19135
19136 !! html/php+tidy
19137 <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>
19138 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>
19139 <ul>
19140 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19141 </ul>
19142 </div>
19143 !! html/parsoid
19144 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
19145 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
19146 !! end
19147
19148 !! test
19149 Fuzz testing: Parser14-table
19150 !! options
19151 parsoid=wt2html,html2html
19152 !! wikitext
19153 ==a==
19154 {| STYLE=__TOC__
19155 !! html
19156 <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>
19157 <table style="&#95;_TOC&#95;_">
19158 <tr><td></td></tr>
19159 </table>
19160
19161 !! html+tidy
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="__TOC__">
19164 <tr>
19165 <td></td>
19166 </tr>
19167 </table>
19168 !! html/parsoid
19169 <h2 id="a">a</h2>
19170 <table style="__TOC__"></table>
19171 !! end
19172
19173 # Known to produce bogus xml (extra </td>)
19174 # Don't add the html/php section since it generates broken HTML
19175 !! test
19176 Fuzz testing: Parser16
19177 !! wikitext
19178 {|
19179 !https://||||||
19180 !! html+tidy
19181 <table>
19182 <tbody><tr>
19183 <th>https://</th>
19184 <th></th>
19185 <th></th>
19186 <th>
19187
19188 </th></tr>
19189 </tbody></table>
19190 !! end
19191
19192 !! test
19193 Fuzz testing: Parser21
19194 !! wikitext
19195 {|
19196 !irc://{{ftp://a" onmouseover="alert('hello world');"
19197 |
19198 !! html
19199 <table>
19200 <tr>
19201 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
19202 </th>
19203 <td>
19204 </td>
19205 </tr>
19206 </table>
19207
19208 !! end
19209
19210 !! test
19211 Fuzz testing: Parser22
19212 !! wikitext
19213 http://===r:::https://b
19214
19215 {|
19216 !! html
19217 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
19218 </p>
19219 <table>
19220 <tr><td></td></tr>
19221 </table>
19222
19223 !! end
19224
19225 # Known to produce bad XML for now
19226 !! test
19227 Fuzz testing: Parser24
19228 !! options
19229 parsoid=wt2html
19230 !! wikitext
19231 {|
19232 {{{|
19233 <u CLASS=
19234 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19235 <br style="onmouseover='alert(document.cookie);' " />
19236
19237 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19238 |
19239 !! html/php
19240 <table>
19241 {{{|
19242 <u class="&#124;">}}}} &gt;
19243 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19244
19245 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19246 <tr>
19247 <td></u>
19248 </td>
19249 </tr>
19250 </table>
19251
19252 !! html/parsoid
19253 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
19254 <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>"}'/>}}}} >
19255 <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}'>
19256
19257
19258
19259 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
19260 !! end
19261
19262 # Note: the current result listed for this is not what the original one was,
19263 # but the original bug was JavaScript injection, which is fixed in any case.
19264 # It's not clear that the original result listed was any more correct than the
19265 # current one. Original result:
19266 # <p>{{{|
19267 # </p>
19268 # <li class="&#124;&#124;">
19269 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19270 !!test
19271 Fuzz testing: Parser25 (T8055)
19272 !! wikitext
19273 {{{
19274 |
19275 <LI CLASS=||
19276 >
19277 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19278 !! html/php
19279 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19280 </p>
19281 !! html/parsoid
19282 <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"]}'>
19283 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19284 !! end
19285
19286 !!test
19287 Fuzz testing: URL adjacent extension (with space, clean)
19288 !! wikitext
19289 http://example.com <nowiki>junk</nowiki>
19290 !! html/php
19291 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19292 </p>
19293 !! html/parsoid
19294 <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>
19295 !! end
19296
19297 !!test
19298 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19299 !! wikitext
19300 http://example.com<nowiki>junk</nowiki>
19301 !! html/php
19302 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19303 </p>
19304 !! html/parsoid
19305 <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>
19306 !! end
19307
19308 !! test
19309 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19310 !! wikitext
19311 http://example.com<pre>junk</pre>
19312 !! html/php
19313 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19314
19315 !! html/php+tidy
19316 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19317 !! html/parsoid
19318 <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>
19319 !! end
19320
19321 !! test
19322 Fuzz testing: image with bogus manual thumbnail
19323 !! wikitext
19324 [[Image:foobar.jpg|thumbnail= ]]
19325 !! html/php
19326 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19327
19328 !! html/parsoid
19329 <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>
19330 !! end
19331
19332 # Parsoid will emit the newline literally in wt2wt; see next test case.
19333 !! test
19334 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19335 !! options
19336 parsoid=wt2html
19337 !! wikitext
19338 <pre dir="&#10;"></pre>
19339 !! html/php
19340 <pre dir="&#10;"></pre>
19341
19342 !! html/parsoid
19343 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19344 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19345 !! end
19346
19347 !! test
19348 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19349 !! options
19350 parsoid=html2wt
19351 !! html/parsoid
19352 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19353 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19354 !! wikitext
19355 <pre dir="
19356 "></pre>
19357 !! html/php
19358 <pre dir=""></pre>
19359
19360 !! end
19361
19362 !! test
19363 Templates in extension attributes are not expanded
19364 !! wikitext
19365 <pre dir="{{echo|ltr}}"></pre>
19366 !! html/php
19367 <pre dir="{{echo|ltr}}"></pre>
19368
19369 !! html/parsoid
19370 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19371 !! end
19372
19373 !! test
19374 Parsing optional HTML elements (T8171)
19375 !! options
19376 !! wikitext
19377 <table>
19378 <tr>
19379 <td> Some tabular data</td>
19380 <td> More tabular data ...
19381 <td> And yet som tabular data</td>
19382 </tr>
19383 </table>
19384 !! html
19385 <table>
19386 <tr>
19387 <td> Some tabular data</td>
19388 <td> More tabular data ...
19389 </td><td> And yet som tabular data</td>
19390 </tr>
19391 </table>
19392
19393 !! end
19394
19395 !! test
19396 Correct handling of <td>, <tr> (T8171)
19397 !! options
19398 !! wikitext
19399 <table>
19400 <tr>
19401 <td> Some tabular data</td>
19402 <td> More tabular data ...</td>
19403 <td> And yet som tabular data</td>
19404 </tr>
19405 </table>
19406 !! html
19407 <table>
19408 <tr>
19409 <td> Some tabular data</td>
19410 <td> More tabular data ...</td>
19411 <td> And yet som tabular data</td>
19412 </tr>
19413 </table>
19414
19415 !! end
19416
19417
19418 !! test
19419 Parsing crashing regression (fr:JavaScript)
19420 !! wikitext
19421 </body></x>
19422 !! html
19423 <p>&lt;/body&gt;&lt;/x&gt;
19424 </p>
19425 !! end
19426
19427 !! test
19428 Inline wiki vs wiki block nesting
19429 !! wikitext
19430 '''Bold paragraph
19431
19432 New wiki paragraph
19433 !! html
19434 <p><b>Bold paragraph</b>
19435 </p><p>New wiki paragraph
19436 </p>
19437 !! end
19438
19439 # FIXME: The current php output is documented
19440 # and desired output is the parsoid target.
19441 !! test
19442 Inline HTML vs wiki block nesting
19443 !! wikitext
19444 <b>Bold paragraph
19445
19446 New wiki paragraph
19447 !! html/php
19448 <p><b>Bold paragraph
19449 </p><p>New wiki paragraph</b>
19450 </p>
19451 !! html/parsoid
19452 <p><b>Bold paragraph</b>
19453 </p><p>New wiki paragraph
19454 </p>
19455 !! end
19456
19457 # Original result was this:
19458 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19459 # </p>
19460 # While that might be marginally more intuitive, maybe, the six-apostrophe
19461 # construct is clearly pathological and the result stated here (which is what
19462 # the parser actually does) is about as reasonable as anything.
19463 !!test
19464 Mixing markup for italics and bold
19465 !! options
19466 !! wikitext
19467 '''bold''''''bold''bolditalics'''''
19468 !! html
19469 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19470 </p>
19471 !! end
19472
19473
19474 !! article
19475 Xyzzyx
19476 !! text
19477 Article for special page transclusion test
19478 !! endarticle
19479
19480 !! test
19481 Special page transclusion
19482 !! options
19483 !! wikitext
19484 {{Special:Prefixindex/Xyzzyx}}
19485 !! html
19486 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19487 </ul>
19488
19489 !! end
19490
19491 !! test
19492 Special page transclusion twice (T7021)
19493 !! options
19494 !! wikitext
19495 {{Special:Prefixindex/Xyzzyx}}
19496 {{Special:Prefixindex/Xyzzyx}}
19497 !! html
19498 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19499 </ul>
19500 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19501 </ul>
19502
19503 !! end
19504
19505 !! test
19506 Transclusion of default MediaWiki message
19507 !! wikitext
19508 {{MediaWiki:Mainpage}}
19509 !! html
19510 <p>Main Page
19511 </p>
19512 !! end
19513
19514 !! test
19515 Transclusion of nonexistent MediaWiki message
19516 !! wikitext
19517 {{MediaWiki:Mainpagexxx}}
19518 !! html
19519 <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>
19520 </p>
19521 !! end
19522
19523 !! test
19524 Transclusion of MediaWiki message with underscore
19525 !! wikitext
19526 {{MediaWiki:history_short}}
19527 !! html
19528 <p>History
19529 </p>
19530 !! end
19531
19532 !! test
19533 Transclusion of MediaWiki message with space
19534 !! wikitext
19535 {{MediaWiki:history short}}
19536 !! html
19537 <p>History
19538 </p>
19539 !! end
19540
19541 !! test
19542 Invalid header with following text
19543 !! wikitext
19544 = x = y
19545 !! html
19546 <p>= x = y
19547 </p>
19548 !! end
19549
19550
19551 !! test
19552 Section extraction test (section 0)
19553 !! options
19554 section=0
19555 !! wikitext
19556 start
19557 ==a==
19558 ===aa===
19559 ====aaa====
19560 ==b==
19561 ===ba===
19562 ===bb===
19563 ====bba====
19564 ===bc===
19565 ==c==
19566 ===ca===
19567 !! html/php
19568 start
19569 !! end
19570
19571 !! test
19572 Section extraction test (section 1)
19573 !! options
19574 section=1
19575 !! wikitext
19576 start
19577 ==a==
19578 ===aa===
19579 ====aaa====
19580 ==b==
19581 ===ba===
19582 ===bb===
19583 ====bba====
19584 ===bc===
19585 ==c==
19586 ===ca===
19587 !! html/php
19588 ==a==
19589 ===aa===
19590 ====aaa====
19591 !! end
19592
19593 !! test
19594 Section extraction test (section 2)
19595 !! options
19596 section=2
19597 !! wikitext
19598 start
19599 ==a==
19600 ===aa===
19601 ====aaa====
19602 ==b==
19603 ===ba===
19604 ===bb===
19605 ====bba====
19606 ===bc===
19607 ==c==
19608 ===ca===
19609 !! html/php
19610 ===aa===
19611 ====aaa====
19612 !! end
19613
19614 !! test
19615 Section extraction test (section 3)
19616 !! options
19617 section=3
19618 !! wikitext
19619 start
19620 ==a==
19621 ===aa===
19622 ====aaa====
19623 ==b==
19624 ===ba===
19625 ===bb===
19626 ====bba====
19627 ===bc===
19628 ==c==
19629 ===ca===
19630 !! html/php
19631 ====aaa====
19632 !! end
19633
19634 !! test
19635 Section extraction test (section 4)
19636 !! options
19637 section=4
19638 !! wikitext
19639 start
19640 ==a==
19641 ===aa===
19642 ====aaa====
19643 ==b==
19644 ===ba===
19645 ===bb===
19646 ====bba====
19647 ===bc===
19648 ==c==
19649 ===ca===
19650 !! html/php
19651 ==b==
19652 ===ba===
19653 ===bb===
19654 ====bba====
19655 ===bc===
19656 !! end
19657
19658 !! test
19659 Section extraction test (section 5)
19660 !! options
19661 section=5
19662 !! wikitext
19663 start
19664 ==a==
19665 ===aa===
19666 ====aaa====
19667 ==b==
19668 ===ba===
19669 ===bb===
19670 ====bba====
19671 ===bc===
19672 ==c==
19673 ===ca===
19674 !! html/php
19675 ===ba===
19676 !! end
19677
19678 !! test
19679 Section extraction test (section 6)
19680 !! options
19681 section=6
19682 !! wikitext
19683 start
19684 ==a==
19685 ===aa===
19686 ====aaa====
19687 ==b==
19688 ===ba===
19689 ===bb===
19690 ====bba====
19691 ===bc===
19692 ==c==
19693 ===ca===
19694 !! html/php
19695 ===bb===
19696 ====bba====
19697 !! end
19698
19699 !! test
19700 Section extraction test (section 7)
19701 !! options
19702 section=7
19703 !! wikitext
19704 start
19705 ==a==
19706 ===aa===
19707 ====aaa====
19708 ==b==
19709 ===ba===
19710 ===bb===
19711 ====bba====
19712 ===bc===
19713 ==c==
19714 ===ca===
19715 !! html/php
19716 ====bba====
19717 !! end
19718
19719 !! test
19720 Section extraction test (section 8)
19721 !! options
19722 section=8
19723 !! wikitext
19724 start
19725 ==a==
19726 ===aa===
19727 ====aaa====
19728 ==b==
19729 ===ba===
19730 ===bb===
19731 ====bba====
19732 ===bc===
19733 ==c==
19734 ===ca===
19735 !! html/php
19736 ===bc===
19737 !! end
19738
19739 !! test
19740 Section extraction test (section 9)
19741 !! options
19742 section=9
19743 !! wikitext
19744 start
19745 ==a==
19746 ===aa===
19747 ====aaa====
19748 ==b==
19749 ===ba===
19750 ===bb===
19751 ====bba====
19752 ===bc===
19753 ==c==
19754 ===ca===
19755 !! html/php
19756 ==c==
19757 ===ca===
19758 !! end
19759
19760 !! test
19761 Section extraction test (section 10)
19762 !! options
19763 section=10
19764 !! wikitext
19765 start
19766 ==a==
19767 ===aa===
19768 ====aaa====
19769 ==b==
19770 ===ba===
19771 ===bb===
19772 ====bba====
19773 ===bc===
19774 ==c==
19775 ===ca===
19776 !! html/php
19777 ===ca===
19778 !! end
19779
19780 !! test
19781 Section extraction test (nonexistent section 11)
19782 !! options
19783 section=11
19784 !! wikitext
19785 start
19786 ==a==
19787 ===aa===
19788 ====aaa====
19789 ==b==
19790 ===ba===
19791 ===bb===
19792 ====bba====
19793 ===bc===
19794 ==c==
19795 ===ca===
19796 !! html/php
19797 !! end
19798
19799 !! test
19800 Section extraction test with bogus heading (section 1)
19801 !! options
19802 section=1
19803 !! wikitext
19804 ==a==
19805 ==bogus== not a legal section
19806 ==b==
19807 !! html/php
19808 ==a==
19809 ==bogus== not a legal section
19810 !! end
19811
19812 !! test
19813 Section extraction test with bogus heading (section 2)
19814 !! options
19815 section=2
19816 !! wikitext
19817 ==a==
19818 ==bogus== not a legal section
19819 ==b==
19820 !! html/php
19821 ==b==
19822 !! end
19823
19824 !! test
19825 Section extraction test with comment after heading (section 1)
19826 !! options
19827 section=1
19828 !! wikitext
19829 ==a==
19830 ==b== <!-- -->
19831 ==c==
19832 !! html/php
19833 ==a==
19834 !! end
19835
19836 !! test
19837 Section extraction test with comment after heading (section 2)
19838 !! options
19839 section=2
19840 !! wikitext
19841 ==a==
19842 ==b== <!-- -->
19843 ==c==
19844 !! html/php
19845 ==b== <!-- -->
19846 !! end
19847
19848 !! test
19849 Section extraction test with bogus <nowiki> heading (section 1)
19850 !! options
19851 section=1
19852 !! wikitext
19853 ==a==
19854 ==bogus== <nowiki>not a legal section</nowiki>
19855 ==b==
19856 !! html/php
19857 ==a==
19858 ==bogus== <nowiki>not a legal section</nowiki>
19859 !! end
19860
19861 !! test
19862 Section extraction test with bogus <nowiki> heading (section 2)
19863 !! options
19864 section=2
19865 !! wikitext
19866 ==a==
19867 ==bogus== <nowiki>not a legal section</nowiki>
19868 ==b==
19869 !! html/php
19870 ==b==
19871 !! end
19872
19873 # Formerly testing for T4587, now resolved by the use of unmarked sections
19874 # instead of respecting commented sections
19875 !! test
19876 Section extraction prefixed by comment (section 1)
19877 !! options
19878 section=1
19879 !! wikitext
19880 <!-- -->==sec1==
19881 ==sec2==
19882 !! html/php
19883 ==sec2==
19884 !!end
19885
19886 !! test
19887 Section extraction prefixed by comment (section 2)
19888 !! options
19889 section=2
19890 !! wikitext
19891 <!-- -->==sec1==
19892 ==sec2==
19893 !! html/php
19894
19895 !!end
19896
19897 # Formerly testing for T4607, now resolved by the use of unmarked sections
19898 # instead of respecting HTML-style headings
19899 !! test
19900 Section extraction, mixed wiki and html (section 1)
19901 !! options
19902 section=1
19903 !! wikitext
19904 <h2>unmarked</h2>
19905 unmarked
19906 ==1==
19907 one
19908 ==2==
19909 two
19910 !! html/php
19911 ==1==
19912 one
19913 !! end
19914
19915 !! test
19916 Section extraction, mixed wiki and html (section 2)
19917 !! options
19918 section=2
19919 !! wikitext
19920 <h2>unmarked</h2>
19921 unmarked
19922 ==1==
19923 one
19924 ==2==
19925 two
19926 !! html/php
19927 ==2==
19928 two
19929 !! end
19930
19931
19932 # Formerly testing for T5342
19933 !! test
19934 Section extraction, heading surrounded by <noinclude>
19935 !! options
19936 section=1
19937 !! wikitext
19938 <noinclude>==unmarked==</noinclude>
19939 ==marked==
19940 !! html/php
19941 ==marked==
19942 !!end
19943
19944 # Test behavior of T21910
19945 !! test
19946 Sectiion with all-equals
19947 !! options
19948 section=2
19949 !! wikitext
19950 ===
19951 The line above must have a trailing space
19952 === <!--
19953 --> <!-- -->
19954 But just in case it doesn't...
19955 !! html/php
19956 === <!--
19957 --> <!-- -->
19958 But just in case it doesn't...
19959 !! end
19960
19961 !! test
19962 Section replacement test (section 0)
19963 !! options
19964 replace=0,"xxx"
19965 !! wikitext
19966 start
19967 ==a==
19968 ===aa===
19969 ====aaa====
19970 ==b==
19971 ===ba===
19972 ===bb===
19973 ====bba====
19974 ===bc===
19975 ==c==
19976 ===ca===
19977 !! html/php
19978 xxx
19979
19980 ==a==
19981 ===aa===
19982 ====aaa====
19983 ==b==
19984 ===ba===
19985 ===bb===
19986 ====bba====
19987 ===bc===
19988 ==c==
19989 ===ca===
19990 !! end
19991
19992 !! test
19993 Section replacement test (section 1)
19994 !! options
19995 replace=1,"xxx"
19996 !! wikitext
19997 start
19998 ==a==
19999 ===aa===
20000 ====aaa====
20001 ==b==
20002 ===ba===
20003 ===bb===
20004 ====bba====
20005 ===bc===
20006 ==c==
20007 ===ca===
20008 !! html/php
20009 start
20010 xxx
20011
20012 ==b==
20013 ===ba===
20014 ===bb===
20015 ====bba====
20016 ===bc===
20017 ==c==
20018 ===ca===
20019 !! end
20020
20021 !! test
20022 Section replacement test (section 2)
20023 !! options
20024 replace=2,"xxx"
20025 !! wikitext
20026 start
20027 ==a==
20028 ===aa===
20029 ====aaa====
20030 ==b==
20031 ===ba===
20032 ===bb===
20033 ====bba====
20034 ===bc===
20035 ==c==
20036 ===ca===
20037 !! html/php
20038 start
20039 ==a==
20040 xxx
20041
20042 ==b==
20043 ===ba===
20044 ===bb===
20045 ====bba====
20046 ===bc===
20047 ==c==
20048 ===ca===
20049 !! end
20050
20051 !! test
20052 Section replacement test (section 3)
20053 !! options
20054 replace=3,"xxx"
20055 !! wikitext
20056 start
20057 ==a==
20058 ===aa===
20059 ====aaa====
20060 ==b==
20061 ===ba===
20062 ===bb===
20063 ====bba====
20064 ===bc===
20065 ==c==
20066 ===ca===
20067 !! html/php
20068 start
20069 ==a==
20070 ===aa===
20071 xxx
20072
20073 ==b==
20074 ===ba===
20075 ===bb===
20076 ====bba====
20077 ===bc===
20078 ==c==
20079 ===ca===
20080 !! end
20081
20082 !! test
20083 Section replacement test (section 4)
20084 !! options
20085 replace=4,"xxx"
20086 !! wikitext
20087 start
20088 ==a==
20089 ===aa===
20090 ====aaa====
20091 ==b==
20092 ===ba===
20093 ===bb===
20094 ====bba====
20095 ===bc===
20096 ==c==
20097 ===ca===
20098 !! html/php
20099 start
20100 ==a==
20101 ===aa===
20102 ====aaa====
20103 xxx
20104
20105 ==c==
20106 ===ca===
20107 !! end
20108
20109 !! test
20110 Section replacement test (section 5)
20111 !! options
20112 replace=5,"xxx"
20113 !! wikitext
20114 start
20115 ==a==
20116 ===aa===
20117 ====aaa====
20118 ==b==
20119 ===ba===
20120 ===bb===
20121 ====bba====
20122 ===bc===
20123 ==c==
20124 ===ca===
20125 !! html/php
20126 start
20127 ==a==
20128 ===aa===
20129 ====aaa====
20130 ==b==
20131 xxx
20132
20133 ===bb===
20134 ====bba====
20135 ===bc===
20136 ==c==
20137 ===ca===
20138 !! end
20139
20140 !! test
20141 Section replacement test (section 6)
20142 !! options
20143 replace=6,"xxx"
20144 !! wikitext
20145 start
20146 ==a==
20147 ===aa===
20148 ====aaa====
20149 ==b==
20150 ===ba===
20151 ===bb===
20152 ====bba====
20153 ===bc===
20154 ==c==
20155 ===ca===
20156 !! html/php
20157 start
20158 ==a==
20159 ===aa===
20160 ====aaa====
20161 ==b==
20162 ===ba===
20163 xxx
20164
20165 ===bc===
20166 ==c==
20167 ===ca===
20168 !! end
20169
20170 !! test
20171 Section replacement test (section 7)
20172 !! options
20173 replace=7,"xxx"
20174 !! wikitext
20175 start
20176 ==a==
20177 ===aa===
20178 ====aaa====
20179 ==b==
20180 ===ba===
20181 ===bb===
20182 ====bba====
20183 ===bc===
20184 ==c==
20185 ===ca===
20186 !! html/php
20187 start
20188 ==a==
20189 ===aa===
20190 ====aaa====
20191 ==b==
20192 ===ba===
20193 ===bb===
20194 xxx
20195
20196 ===bc===
20197 ==c==
20198 ===ca===
20199 !! end
20200
20201 !! test
20202 Section replacement test (section 8)
20203 !! options
20204 replace=8,"xxx"
20205 !! wikitext
20206 start
20207 ==a==
20208 ===aa===
20209 ====aaa====
20210 ==b==
20211 ===ba===
20212 ===bb===
20213 ====bba====
20214 ===bc===
20215 ==c==
20216 ===ca===
20217 !! html/php
20218 start
20219 ==a==
20220 ===aa===
20221 ====aaa====
20222 ==b==
20223 ===ba===
20224 ===bb===
20225 ====bba====
20226 xxx
20227
20228 ==c==
20229 ===ca===
20230 !!end
20231
20232 !! test
20233 Section replacement test (section 9)
20234 !! options
20235 replace=9,"xxx"
20236 !! wikitext
20237 start
20238 ==a==
20239 ===aa===
20240 ====aaa====
20241 ==b==
20242 ===ba===
20243 ===bb===
20244 ====bba====
20245 ===bc===
20246 ==c==
20247 ===ca===
20248 !! html/php
20249 start
20250 ==a==
20251 ===aa===
20252 ====aaa====
20253 ==b==
20254 ===ba===
20255 ===bb===
20256 ====bba====
20257 ===bc===
20258 xxx
20259 !! end
20260
20261 !! test
20262 Section replacement test (section 10)
20263 !! options
20264 replace=10,"xxx"
20265 !! wikitext
20266 start
20267 ==a==
20268 ===aa===
20269 ====aaa====
20270 ==b==
20271 ===ba===
20272 ===bb===
20273 ====bba====
20274 ===bc===
20275 ==c==
20276 ===ca===
20277 !! html/php
20278 start
20279 ==a==
20280 ===aa===
20281 ====aaa====
20282 ==b==
20283 ===ba===
20284 ===bb===
20285 ====bba====
20286 ===bc===
20287 ==c==
20288 xxx
20289 !! end
20290
20291 !! test
20292 Section replacement test with initial whitespace (T15728)
20293 !! options
20294 replace=2,"xxx"
20295 !! wikitext
20296 Preformatted initial line
20297 ==a==
20298 ===a===
20299 !! html/php
20300 Preformatted initial line
20301 ==a==
20302 xxx
20303 !! end
20304
20305
20306 !! test
20307 Section extraction, heading followed by pre with 20 spaces (T8398)
20308 !! options
20309 section=1
20310 !! wikitext
20311 ==a==
20312 a
20313 !! html/php
20314 ==a==
20315 a
20316 !! end
20317
20318 !! test
20319 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20320 !! options
20321 section=1
20322 !! wikitext
20323 ==a==
20324 a
20325 !! html/php
20326 ==a==
20327 a
20328 !! end
20329
20330
20331 !! test
20332 Section extraction, <pre> around bogus header (T12309)
20333 !! options
20334 section=2
20335 !! wikitext
20336 == Section One ==
20337 <pre>
20338 =======
20339 </pre>
20340
20341 == Section Two ==
20342 stuff
20343 !! html/php
20344 == Section Two ==
20345 stuff
20346 !! end
20347
20348 !! test
20349 Section replacement, <pre> around bogus header (T12309)
20350 !! options
20351 replace=2,"xxx"
20352 !! wikitext
20353 == Section One ==
20354 <pre>
20355 =======
20356 </pre>
20357
20358 == Section Two ==
20359 stuff
20360 !! html/php
20361 == Section One ==
20362 <pre>
20363 =======
20364 </pre>
20365
20366 xxx
20367 !! end
20368
20369 !! test
20370 Handling of &#x0A; in URLs
20371 !! wikitext
20372 *irc://&#x0A;a
20373 !! html/php
20374 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20375
20376 !! html/parsoid
20377 <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>
20378 !! end
20379
20380 !! test
20381 Handling of %0A in URLs
20382 !! wikitext
20383 *irc://%0Aa
20384 !! html/php
20385 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20386
20387 !! html/parsoid
20388 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20389 !! end
20390
20391 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20392 !! test
20393 5 quotes, code coverage +1 line
20394 !! options
20395 parsoid=wt2html
20396 !! wikitext
20397 '''''
20398 !! html/php
20399 !! html/parsoid
20400 <b><i></i></b>
20401 !! end
20402
20403 # same html as previous, but wikitext adjusted to match parsoid html2wt
20404 # note that wt2html and html2html will put the <i> before the <b>
20405 !! test
20406 5 quotes, code coverage +1 line w/ nowiki (1)
20407 !! options
20408 parsoid=wt2wt,html2wt
20409 !! wikitext
20410 '''''<nowiki/>'''''
20411 !! html/php
20412 <p><i></i>
20413 </p>
20414 !! html/parsoid
20415 <p><b><i></i></b></p>
20416 !! end
20417
20418 # same as previous, just swapping the <i> and <b>
20419 !! test
20420 5 quotes, code coverage +1 line w/ nowiki (2)
20421 !! wikitext
20422 '''''<nowiki/>'''''
20423 !! html/php
20424 <p><i></i>
20425 </p>
20426 !! html/parsoid
20427 <p><i><b></b></i></p>
20428 !! end
20429
20430 !! test
20431 Special:Search page linking.
20432 !! wikitext
20433 {{Special:search}}
20434 !! html
20435 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20436 </p>
20437 !! end
20438
20439 !! test
20440 {{!}} is a magic word
20441 !! wikitext
20442 {{!}} is a magic word there and {{!}} is still a magic word here
20443 | is not a magic word here but {{!}} is still a magic word here
20444 !! html/php
20445 <p>| is a magic word there and | is still a magic word here
20446 | is not a magic word here but | is still a magic word here
20447 </p>
20448 !! html/parsoid
20449 <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
20450 | 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>
20451 !! end
20452
20453 !! test
20454 Say the magic word
20455 !! options
20456 title=[[Parser test]]
20457 !! wikitext
20458 *{{PAGENAME}}
20459 *{{PAGENAMEE}}
20460 *{{FULLPAGENAME}}
20461 *{{FULLPAGENAMEE}}
20462 *{{BASEPAGENAME}}
20463 *{{BASEPAGENAMEE}}
20464 *{{SUBPAGENAME}}
20465 *{{SUBPAGENAMEE}}
20466 *{{ROOTPAGENAME}}
20467 *{{ROOTPAGENAMEE}}
20468 *{{TALKPAGENAME}}
20469 *{{TALKPAGENAMEE}}
20470 *{{SUBJECTPAGENAME}}
20471 *{{SUBJECTPAGENAMEE}}
20472 *{{NAMESPACEE}}
20473 *{{NAMESPACE}}
20474 *{{NAMESPACENUMBER}}
20475 *{{TALKSPACE}}
20476 *{{TALKSPACEE}}
20477 *{{SUBJECTSPACE}}
20478 *{{SUBJECTSPACEE}}
20479 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20480 !! html
20481 <ul><li>Parser test</li>
20482 <li>Parser_test</li>
20483 <li>Parser test</li>
20484 <li>Parser_test</li>
20485 <li>Parser test</li>
20486 <li>Parser_test</li>
20487 <li>Parser test</li>
20488 <li>Parser_test</li>
20489 <li>Parser test</li>
20490 <li>Parser_test</li>
20491 <li>Talk:Parser test</li>
20492 <li>Talk:Parser_test</li>
20493 <li>Parser test</li>
20494 <li>Parser_test</li>
20495 <li></li>
20496 <li></li>
20497 <li>0</li>
20498 <li>Talk</li>
20499 <li>Talk</li>
20500 <li></li>
20501 <li></li>
20502 <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>
20503
20504 !! end
20505 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20506
20507 !! test
20508 Gallery with valid attributes
20509 !! wikitext
20510 <gallery type="123" summary="345">
20511 File:File:Foobar.jpg
20512 </gallery>
20513 !! html/php
20514 <ul class="gallery mw-gallery-traditional" type="123">
20515 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20516 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20517 <div class="gallerytext">
20518 </div>
20519 </div></li>
20520 </ul>
20521
20522 !! html/parsoid
20523 <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"}}'>
20524 <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>
20525 </ul>
20526 !! end
20527
20528 ## Parsoid thinks the "centre" here is a property, not a caption.
20529 !! test
20530 Gallery
20531 !! options
20532 parsoid={
20533 "modes": ["wt2html"],
20534 "nativeGallery": true
20535 }
20536 !! wikitext
20537 <gallery>
20538 image1.png |
20539 image2.gif|||||
20540
20541 image3|
20542 image4 |300px| centre
20543 image5.svg| http://///////
20544 [[x|xx]]]]
20545 * image6
20546 </gallery>
20547 !! html/php
20548 <ul class="gallery mw-gallery-traditional">
20549 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20550 <div class="thumb" style="height: 150px;">Image1.png</div>
20551 <div class="gallerytext">
20552 </div>
20553 </div></li>
20554 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20555 <div class="thumb" style="height: 150px;">Image2.gif</div>
20556 <div class="gallerytext">
20557 </div>
20558 </div></li>
20559 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20560 <div class="thumb" style="height: 150px;">Image3</div>
20561 <div class="gallerytext">
20562 </div>
20563 </div></li>
20564 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20565 <div class="thumb" style="height: 150px;">Image4</div>
20566 <div class="gallerytext">
20567 <pre>centre
20568 </pre>
20569 </div>
20570 </div></li>
20571 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20572 <div class="thumb" style="height: 150px;">Image5.svg</div>
20573 <div class="gallerytext">
20574 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20575 </p>
20576 </div>
20577 </div></li>
20578 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20579 <div class="thumb" style="height: 150px;">* image6</div>
20580 <div class="gallerytext">
20581 </div>
20582 </div></li>
20583 </ul>
20584
20585 !! html/parsoid
20586 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20587 <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>
20588 <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>
20589 <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>
20590 <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>
20591 <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>
20592 <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>
20593 </ul>
20594 !! end
20595
20596 !! test
20597 Gallery (with options, html)
20598 !! options
20599 parsoid={
20600 "modes": ["wt2html", "html2html"],
20601 "nativeGallery": true
20602 }
20603 !! wikitext
20604 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20605 File:Nonexistent.jpg|caption
20606 File:Nonexistent.jpg
20607 image:foobar.jpg|some '''caption''' [[Main Page]]
20608 image:foobar.jpg
20609 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20610 </gallery>
20611 !! html/php
20612 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20613 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20614 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20615 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20616 <div class="gallerytext">
20617 <p>caption
20618 </p>
20619 </div>
20620 </div></li>
20621 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20622 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20623 <div class="gallerytext">
20624 </div>
20625 </div></li>
20626 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20627 <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>
20628 <div class="gallerytext">
20629 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20630 </p>
20631 </div>
20632 </div></li>
20633 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20634 <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>
20635 <div class="gallerytext">
20636 </div>
20637 </div></li>
20638 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20639 <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>
20640 <div class="gallerytext">
20641 <p>blabla.
20642 </p>
20643 </div>
20644 </div></li>
20645 </ul>
20646
20647 !! html/parsoid
20648 <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":{}}'>
20649 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20650 <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>
20651 <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>
20652 <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>
20653 <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>
20654 <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>
20655 </ul>
20656 !! end
20657
20658 !! test
20659 Gallery (with options, extsrc)
20660 !! options
20661 parsoid={
20662 "nativeGallery": false
20663 }
20664 !! wikitext
20665 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20666 File:Nonexistent.jpg|caption
20667 File:Nonexistent.jpg
20668 image:foobar.jpg|some '''caption''' [[Main Page]]
20669 image:foobar.jpg
20670 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20671 </gallery>
20672 !! html/php
20673 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20674 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20675 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20676 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20677 <div class="gallerytext">
20678 <p>caption
20679 </p>
20680 </div>
20681 </div></li>
20682 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20683 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20684 <div class="gallerytext">
20685 </div>
20686 </div></li>
20687 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20688 <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>
20689 <div class="gallerytext">
20690 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20691 </p>
20692 </div>
20693 </div></li>
20694 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20695 <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>
20696 <div class="gallerytext">
20697 </div>
20698 </div></li>
20699 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20700 <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>
20701 <div class="gallerytext">
20702 <p>blabla.
20703 </p>
20704 </div>
20705 </div></li>
20706 </ul>
20707
20708 !! html/parsoid
20709 <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"}}'>
20710 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20711 <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>
20712 <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>
20713 <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>
20714 <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>
20715 <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>
20716 </ul>
20717 !! end
20718
20719 !! test
20720 Gallery (without px units)
20721 !! wikitext
20722 <gallery widths="70" heights="40">
20723 File:Foobar.jpg
20724 </gallery>
20725 !! html/php
20726 <ul class="gallery mw-gallery-traditional">
20727 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20728 <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>
20729 <div class="gallerytext">
20730 </div>
20731 </div></li>
20732 </ul>
20733
20734 !! html/parsoid
20735 <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"}}'>
20736 <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>
20737 </ul>
20738 !! end
20739
20740 !! test
20741 Gallery (with invalid units)
20742 !! wikitext
20743 <gallery widths="70em" heights="40em">
20744 File:Foobar.jpg
20745 </gallery>
20746 !! html/php
20747 <ul class="gallery mw-gallery-traditional">
20748 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20749 <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>
20750 <div class="gallerytext">
20751 </div>
20752 </div></li>
20753 </ul>
20754
20755 !! html/parsoid
20756 <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"}}'>
20757 <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>
20758 </ul>
20759 !! end
20760
20761 !! test
20762 Gallery with link that has fragment
20763 !! options
20764 parsoid={
20765 "modes": ["wt2html", "html2html"],
20766 "nativeGallery": true
20767 }
20768 !! wikitext
20769 <gallery>
20770 image:foobar.jpg|link=Main_Page
20771 image:foobar.jpg|link=Main_Page#section
20772 image:foobar.jpg|link=Main Page#section|caption
20773 </gallery>
20774 !! html/php
20775 <ul class="gallery mw-gallery-traditional">
20776 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20777 <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>
20778 <div class="gallerytext">
20779 </div>
20780 </div></li>
20781 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20782 <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>
20783 <div class="gallerytext">
20784 </div>
20785 </div></li>
20786 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20787 <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>
20788 <div class="gallerytext">
20789 <p>caption
20790 </p>
20791 </div>
20792 </div></li>
20793 </ul>
20794
20795 !! html/parsoid
20796 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20797 <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>
20798 <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>
20799 <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>
20800 </ul>
20801 !! end
20802
20803 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20804 !! test
20805 Gallery with template inside caption
20806 !! options
20807 parsoid={
20808 "nativeGallery": true
20809 }
20810 !! wikitext
20811 <gallery caption="{{echo|hi}}">
20812 File:Foobar.jpg|{{echo|ho}}
20813 </gallery>
20814 !! html/php
20815 <ul class="gallery mw-gallery-traditional">
20816 <li class='gallerycaption'>{{echo|hi}}</li>
20817 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20818 <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>
20819 <div class="gallerytext">
20820 <p>ho
20821 </p>
20822 </div>
20823 </div></li>
20824 </ul>
20825
20826 !! html/parsoid
20827 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20828 <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>
20829 <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>
20830 </ul>
20831 !! end
20832
20833 !! test
20834 Gallery with wikitext inside caption
20835 !! options
20836 parsoid={
20837 "nativeGallery": true
20838 }
20839 !! wikitext
20840 <gallery>
20841 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20842 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20843 </gallery>
20844 !! html/php
20845 <ul class="gallery mw-gallery-traditional">
20846 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20847 <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>
20848 <div class="gallerytext">
20849 <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>
20850 </p>
20851 </div>
20852 </div></li>
20853 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20854 <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>
20855 <div class="gallerytext">
20856 <p>This is a test template
20857 </p>
20858 </div>
20859 </div></li>
20860 </ul>
20861
20862 !! html/parsoid
20863 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20864 <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>
20865 <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>
20866 </ul>
20867 !! end
20868
20869 !! test
20870 Gallery (with showfilename option)
20871 !! options
20872 parsoid={
20873 "nativeGallery": true
20874 }
20875 !! wikitext
20876 <gallery showfilename="">
20877 File:Nonexistent.jpg|caption
20878 File:Nonexistent.jpg
20879 File:Foobar.jpg|some '''caption''' [[Main Page]]
20880 File:Foobar.jpg
20881 </gallery>
20882 !! html/php
20883 <ul class="gallery mw-gallery-traditional">
20884 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20885 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20886 <div class="gallerytext">
20887 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20888 caption
20889 </p>
20890 </div>
20891 </div></li>
20892 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20893 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20894 <div class="gallerytext">
20895 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20896 </p>
20897 </div>
20898 </div></li>
20899 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20900 <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>
20901 <div class="gallerytext">
20902 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20903 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20904 </p>
20905 </div>
20906 </div></li>
20907 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20908 <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>
20909 <div class="gallerytext">
20910 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20911 </p>
20912 </div>
20913 </div></li>
20914 </ul>
20915
20916 !! html/parsoid
20917 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20918 <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>
20919 <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>
20920 <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>
20921 <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>
20922 </ul>
20923 !! end
20924
20925 ## Should Parsoid be preserving these variations? See T151367
20926 !! test
20927 Gallery (with namespace-less filenames)
20928 !! options
20929 parsoid={
20930 "modes": ["wt2html", "html2html"],
20931 "nativeGallery": true
20932 }
20933 !! wikitext
20934 <gallery>
20935 File:Nonexistent.jpg
20936 Nonexistent.jpg
20937 image:foobar.jpg
20938 foobar.jpg
20939 </gallery>
20940 !! html/php
20941 <ul class="gallery mw-gallery-traditional">
20942 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20943 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20944 <div class="gallerytext">
20945 </div>
20946 </div></li>
20947 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20948 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20949 <div class="gallerytext">
20950 </div>
20951 </div></li>
20952 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20953 <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>
20954 <div class="gallerytext">
20955 </div>
20956 </div></li>
20957 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20958 <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>
20959 <div class="gallerytext">
20960 </div>
20961 </div></li>
20962 </ul>
20963
20964 !! html/parsoid
20965 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20966 <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>
20967 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File: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>
20968 <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>
20969 <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>
20970 </ul>
20971 !! end
20972
20973 !! test
20974 Gallery override link with wikilink (T36852)
20975 !! options
20976 parsoid={
20977 "nativeGallery": true
20978 }
20979 !! wikitext
20980 <gallery>
20981 File:Foobar.jpg|alt=galleryalt|link=Wikilink
20982 </gallery>
20983 !! html/php
20984 <ul class="gallery mw-gallery-traditional">
20985 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20986 <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>
20987 <div class="gallerytext">
20988 </div>
20989 </div></li>
20990 </ul>
20991
20992 !! html/parsoid
20993 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20994 <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>
20995 </ul>
20996 !! end
20997
20998 !! test
20999 Gallery override link with absolute external link (T36852)
21000 !! options
21001 parsoid={
21002 "nativeGallery": true
21003 }
21004 !! wikitext
21005 <gallery>
21006 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
21007 </gallery>
21008 !! html/php
21009 <ul class="gallery mw-gallery-traditional">
21010 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21011 <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>
21012 <div class="gallerytext">
21013 </div>
21014 </div></li>
21015 </ul>
21016
21017 !! html/parsoid
21018 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21019 <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>
21020 </ul>
21021 !! end
21022
21023 !! test
21024 Gallery override link with absolute external link with LanguageConverter
21025 !! options
21026 language=zh
21027 !! wikitext
21028 <gallery>
21029 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21030 </gallery>
21031 !! html/php
21032 <ul class="gallery mw-gallery-traditional">
21033 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21034 <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>
21035 <div class="gallerytext">
21036 <p>caption
21037 </p>
21038 </div>
21039 </div></li>
21040 </ul>
21041
21042 !! html/parsoid
21043 <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"}}'>
21044 <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>
21045 </ul>
21046 !! end
21047
21048 !! test
21049 Gallery override link with malicious javascript (T36852)
21050 !! options
21051 parsoid={
21052 "modes": ["wt2html", "html2html"],
21053 "nativeGallery": true
21054 }
21055 !! wikitext
21056 <gallery>
21057 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21058 </gallery>
21059 !! html/php
21060 <ul class="gallery mw-gallery-traditional">
21061 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21062 <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>
21063 <div class="gallerytext">
21064 </div>
21065 </div></li>
21066 </ul>
21067
21068 !! html/parsoid
21069 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21070 <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>
21071 </ul>
21072 !! end
21073
21074 # Note that parsoid uses the invalid link as a caption, PHP does not.
21075 !! test
21076 Gallery with invalid title as link (T45964)
21077 !! options
21078 parsoid={
21079 "modes": ["wt2html", "html2html"],
21080 "nativeGallery": true
21081 }
21082 !! wikitext
21083 <gallery>
21084 File:Foobar.jpg|link=<
21085 </gallery>
21086 !! html/php
21087 <ul class="gallery mw-gallery-traditional">
21088 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21089 <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>
21090 <div class="gallerytext">
21091 </div>
21092 </div></li>
21093 </ul>
21094
21095 !! html/parsoid
21096 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21097 <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>
21098 </ul>
21099 !! end
21100
21101 !! test
21102 Serialize gallery without attrs in data-mw
21103 !! options
21104 parsoid={
21105 "modes": ["html2wt"],
21106 "nativeGallery": true
21107 }
21108 !! html/parsoid
21109 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
21110 <li class="gallerycaption">123</li>
21111 <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>
21112 </ul>
21113 !! wikitext
21114 <gallery caption="123">
21115 File:Test.png
21116 </gallery>
21117 !! end
21118
21119 !! test
21120 Gallery with class and style attributes
21121 !! options
21122 parsoid={
21123 "nativeGallery": true
21124 }
21125 !! wikitext
21126 <gallery class="center" style="text-align: center;">
21127 File:Foobar.jpg
21128 </gallery>
21129 !! html/php
21130 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
21131 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21132 <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>
21133 <div class="gallerytext">
21134 </div>
21135 </div></li>
21136 </ul>
21137
21138 !! html/parsoid
21139 <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":{}}'>
21140 <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>
21141 </ul>
21142 !! end
21143
21144 !! test
21145 Gallery in slideshow mode
21146 !! options
21147 parsoid={
21148 "nativeGallery": true
21149 }
21150 !! wikitext
21151 <gallery mode="slideshow" showthumbnails="">
21152 File:Foobar.jpg
21153 </gallery>
21154 !! html/php
21155 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
21156 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21157 <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>
21158 <div class="gallerytext">
21159 </div>
21160 </div></li>
21161 </ul>
21162
21163 !! html/parsoid
21164 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
21165 <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>
21166 </ul>
21167 !! end
21168
21169 !! test
21170 Serialize gallery image captions on a line
21171 !! options
21172 parsoid={
21173 "modes": ["html2wt"],
21174 "nativeGallery": true
21175 }
21176 !! html/parsoid
21177 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21178 <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>
21179 <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>
21180 </ul>
21181 !! wikitext
21182 <gallery>
21183 File:Foobar.jpg| hi ho
21184 File:Foobar.jpg|hi<br />ho
21185 </gallery>
21186 !! end
21187
21188 !! test
21189 HTML Hex character encoding (spells the word "JavaScript")
21190 !! options
21191 parsoid=wt2html,wt2wt,html2html
21192 !! wikitext
21193 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
21194 !! html/php
21195 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
21196 </p>
21197 !! html/parsoid
21198 <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>
21199 !! end
21200
21201 !! test
21202 HTML Hex character encoding bogus encoding (T28437 regression check)
21203 !! wikitext
21204 &#xsee;&#XSEE;
21205 !! html
21206 <p>&amp;#xsee;&amp;#XSEE;
21207 </p>
21208 !! end
21209
21210 !! test
21211 HTML Hex character encoding mixed case
21212 !! options
21213 parsoid=wt2html,wt2wt,html2html
21214 !! wikitext
21215 &#xEE;&#Xee;
21216 !! html/php
21217 <p>&#xee;&#xee;
21218 </p>
21219 !! html/parsoid
21220 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
21221 !! end
21222
21223 # See: https://www.w3.org/TR/html5/syntax.html#character-references
21224 # Note that U+000C (form feed) is not a valid XML character, so
21225 # it is banned even though allowed in HTML5.
21226 !! test
21227 Illegal character references (T106578)
21228 !! wikitext
21229 ; Null: &#00;
21230 ; FF: &#xC;
21231 ; CR: &#xD;
21232 ; Control (low): &#8;
21233 ; Control (high): &#x7F; &#x9F;
21234 ; Surrogate: &#xD83D;&#xDCA9;
21235 ; This is an okay astral character: &#x1F4A9;
21236 !! html+tidy
21237 <dl><dt>Null</dt>
21238 <dd>&amp;#00;</dd>
21239 <dt>FF</dt>
21240 <dd>&amp;#xC;</dd>
21241 <dt>CR</dt>
21242 <dd>&amp;#xD;</dd>
21243 <dt>Control (low)</dt>
21244 <dd>&amp;#8;</dd>
21245 <dt>Control (high)</dt>
21246 <dd>&amp;#x7F; &amp;#x9F;</dd>
21247 <dt>Surrogate</dt>
21248 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
21249 <dt>This is an okay astral character</dt>
21250 <dd>&#x1f4a9;</dd></dl>
21251 !! end
21252
21253 !! test
21254 __FORCETOC__ override
21255 !! wikitext
21256 __NEWSECTIONLINK__
21257 __FORCETOC__
21258 !! html/php
21259 <p><br />
21260 </p>
21261 !! end
21262
21263 !! test
21264 ISBN code coverage
21265 !! wikitext
21266 ISBN 978-0-1234-56&#x20;789
21267 !! html/php
21268 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21269 </p>
21270 !! html/parsoid
21271 <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>
21272 !! end
21273
21274 !! test
21275 ISBN followed by 5 spaces
21276 !! wikitext
21277 ISBN
21278 !! html
21279 <p>ISBN
21280 </p>
21281 !! end
21282
21283 !! test
21284 Double ISBN
21285 !! wikitext
21286 ISBN ISBN 1234567890
21287 !! html/php
21288 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21289 </p>
21290 !! html/parsoid
21291 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21292 !! end
21293
21294 # Uppercase X and lowercase x as well
21295 !! test
21296 ISBN with an X
21297 !! wikitext
21298 ISBN 3-462-04561-X
21299 ISBN 3-462-04561-x
21300 ISBN 080442957X
21301 ISBN 080442957x
21302 ISBN 978080442957X
21303 ISBN 978080442957x
21304 !! html/php
21305 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21306 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21307 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21308 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21309 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21310 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21311 </p>
21312 !! html/parsoid
21313 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21314 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21315 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21316 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21317 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21318 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21319 !! end
21320
21321 !! test
21322 ISBN with empty prefix (parsoid test)
21323 !! wikitext
21324 ISBN 1234567890
21325 !! html/php
21326 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21327 </p>
21328 !! html/parsoid
21329 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21330 !! end
21331
21332 !! test
21333 T24905: <abbr> followed by ISBN followed by </a>
21334 !! wikitext
21335 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21336 !! html/php
21337 <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>
21338 </p>
21339 !! html/parsoid
21340 <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>
21341 !! end
21342
21343 !! test
21344 Double RFC
21345 !! wikitext
21346 RFC RFC 1234
21347 !! html/php
21348 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21349 </p>
21350 !! html/parsoid
21351 <p>RFC <a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
21352 !! end
21353
21354 !! test
21355 Double RFC with a wiki link
21356 !! wikitext
21357 RFC [[RFC 1234]]
21358 !! html/php
21359 <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>
21360 </p>
21361 !! html/parsoid
21362 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234" title="RFC 1234">RFC 1234</a></p>
21363 !! end
21364
21365 !! test
21366 RFC code coverage
21367 !! wikitext
21368 RFC 983&#x20;987
21369 !! html/php
21370 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21371 </p>
21372 !! html/parsoid
21373 <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>
21374 !! end
21375
21376 !! test
21377 Centre-aligned image
21378 !! wikitext
21379 [[Image:foobar.jpg|centre]]
21380 !! html/php
21381 <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>
21382
21383 !! html/parsoid
21384 <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>
21385 !! end
21386
21387 !! test
21388 None-aligned image
21389 !! wikitext
21390 [[Image:foobar.jpg|none]]
21391 !! html/php
21392 <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>
21393
21394 !! html/parsoid
21395 <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>
21396 !! end
21397
21398 !! test
21399 Width + Height sized image (using px) (height is ignored)
21400 !! wikitext
21401 [[Image:foobar.jpg|640x480px]]
21402 !! html/php
21403 <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>
21404 </p>
21405 !! html/parsoid
21406 <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>
21407 !! end
21408
21409 !! test
21410 Width-sized image (using px, no following whitespace)
21411 !! wikitext
21412 [[Image:foobar.jpg|640px]]
21413 !! html/php
21414 <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>
21415 </p>
21416 !! html/parsoid
21417 <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>
21418 !! end
21419
21420 !! test
21421 Width-sized image (using px, with following whitespace - test regression from r39467)
21422 !! wikitext
21423 [[Image:foobar.jpg|640px ]]
21424 !! html/php
21425 <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>
21426 </p>
21427 !! html/parsoid
21428 <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>
21429 !!end
21430
21431 !! test
21432 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21433 !! wikitext
21434 [[Image:foobar.jpg| 640px]]
21435 !! html/php
21436 <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>
21437 </p>
21438 !! html/parsoid
21439 <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>
21440 !! end
21441
21442 !! test
21443 Image with page parameter
21444 !! options
21445 djvu
21446 !! wikitext
21447 [[File:LoremIpsum.djvu|page=2]]
21448 !! html/php
21449 <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>
21450 </p>
21451 !! html/parsoid
21452 <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>
21453 !! end
21454
21455 !! test
21456 Another italics / bold test
21457 !! wikitext
21458 ''' ''x'
21459 !! html
21460 <pre>'<i> </i>x'
21461 </pre>
21462 !!end
21463
21464 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21465 !! test
21466 dt/dd/dl test
21467 !! wikitext
21468 :;;;::
21469 !! html/php
21470 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21471
21472 !! html/parsoid
21473 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21474
21475 !!end
21476
21477 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21478 !! test
21479 Images with the "|" character in the comment
21480 !! wikitext
21481 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21482 !! html/php
21483 <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>
21484
21485 !! html/parsoid
21486 <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>
21487 !! end
21488
21489 !! test
21490 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21491 !! wikitext
21492 <html><script>alert(1);</script></html>
21493 !! html
21494 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21495 </p>
21496 !! end
21497
21498 !! test
21499 HTML with raw HTML ($wgRawHtml==true)
21500 !! options
21501 wgRawHtml=1
21502 !! wikitext
21503 <html><script>alert(1);</script></html>
21504 !! html/php
21505 <p><script>alert(1);</script>
21506 </p>
21507 !! end
21508
21509 !! test
21510 Parents of subpages, one level up
21511 !! options
21512 subpage title=[[Subpage test/L1/L2/L3]]
21513 !! wikitext
21514 [[../|L2]]
21515 !! html
21516 <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>
21517 </p>
21518 !! end
21519
21520
21521 !! test
21522 Parents of subpages, one level up, not named
21523 !! options
21524 subpage title=[[Subpage test/L1/L2/L3]]
21525 !! wikitext
21526 [[../]]
21527 !! html
21528 <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>
21529 </p>
21530 !! end
21531
21532
21533
21534 !! test
21535 Parents of subpages, two levels up
21536 !! options
21537 subpage title=[[Subpage test/L1/L2/L3]]
21538 !! wikitext
21539 [[../../|L1]]2
21540
21541 [[../../|L1]]l
21542 !! html
21543 <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
21544 </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>
21545 </p>
21546 !! end
21547
21548 !! test
21549 Parents of subpages, two levels up, without trailing slash or name.
21550 !! options
21551 subpage title=[[Subpage test/L1/L2/L3]]
21552 !! wikitext
21553 [[../..]]
21554 !! html
21555 <p>[[../..]]
21556 </p>
21557 !! end
21558
21559 !! test
21560 Parents of subpages, two levels up, with lots of extra trailing slashes.
21561 !! options
21562 subpage title=[[Subpage test/L1/L2/L3]]
21563 !! wikitext
21564 [[../../////]]
21565 !! html
21566 <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>
21567 </p>
21568 !! end
21569
21570 !! article
21571 Subpage test/L1/L2/L3Sibling
21572 !! text
21573 Sibling article
21574 !! endarticle
21575
21576 !! test
21577 Transclusion of a sibling page (one level up)
21578 !! options
21579 subpage title=[[Subpage test/L1/L2/L3]]
21580 !! wikitext
21581 {{../L3Sibling}}
21582 !! html
21583 <p>Sibling article
21584 </p>
21585 !! end
21586
21587 !! test
21588 Transclusion of a child page
21589 !! options
21590 subpage title=[[Subpage test/L1/L2]]
21591 !! wikitext
21592 {{/L3Sibling}}
21593 !! html
21594 <p>Sibling article
21595 </p>
21596 !! end
21597
21598 # This is wt2html only in Parsoid because we add <nowiki>
21599 # because of {{..}} and we don't expect to fix that to
21600 # eliminate the nowikis selective for {{..}} markup.
21601 !! test
21602 Non-transclusion because of too many up levels
21603 !! options
21604 subpage title=[[Subpage test/L1/L2/L3]]
21605 parsoid=wt2html
21606 !! wikitext
21607 {{../../../../More than parent}}
21608 !! html/php
21609 <p>{{../../../../More than parent}}
21610 </p>
21611 !! html/parsoid
21612 <p>{{../../../../More than parent}}</p>
21613 !! end
21614
21615 !! test
21616 Definition list code coverage
21617 !! wikitext
21618 ;title :def
21619 ;title :def
21620 ;title:def
21621 !! html/php
21622 <dl><dt>title &#160;</dt>
21623 <dd>def</dd>
21624 <dt>title&#160;</dt>
21625 <dd>def</dd>
21626 <dt>title</dt>
21627 <dd>def</dd></dl>
21628
21629 !! html/parsoid
21630 <dl><dt>title <span typeof="mw:Placeholder"> </span></dt><dd>def</dd>
21631 <dt>title<span typeof="mw:Placeholder"> </span></dt><dd>def</dd>
21632 <dt>title</dt><dd>def</dd></dl>
21633 !! end
21634
21635 !! test
21636 Don't fall for the self-closing div
21637 !! wikitext
21638 <div>hello world</div/>
21639 !! html
21640 <div>hello world</div>
21641
21642 !! end
21643
21644 !! test
21645 MSGNW magic word
21646 !! wikitext
21647 {{MSGNW:msg}}
21648 !! html/php
21649 <p>&#91;&#91;:Template:Msg&#93;&#93;
21650 </p>
21651 !! end
21652
21653 !! test
21654 RAW magic word
21655 !! wikitext
21656 {{RAW:QUERTY}}
21657 !! html
21658 <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>
21659 </p>
21660 !! end
21661
21662 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21663 !! test
21664 Always escape literal '>' in output, not just after '<'
21665 !! wikitext
21666 ><>
21667 !! html
21668 <p>&gt;&lt;&gt;
21669 </p>
21670 !! end
21671
21672 !! test
21673 Template caching
21674 !! wikitext
21675 {{Test}}
21676 {{Test}}
21677 !! html
21678 <p>This is a test template
21679 This is a test template
21680 </p>
21681 !! end
21682
21683
21684 !! article
21685 MediaWiki:Fake
21686 !! text
21687 ==header==
21688 !! endarticle
21689
21690 !! test
21691 Inclusion of !userCanEdit() content
21692 !! wikitext
21693 {{MediaWiki:Fake}}
21694 !! html
21695 <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>
21696
21697 !! end
21698
21699
21700 !! test
21701 Out-of-order TOC heading levels
21702 !! wikitext
21703 ==2==
21704 ======6======
21705 ===3===
21706 =1=
21707 =====5=====
21708 ==2==
21709 !! html
21710 <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>
21711 <ul>
21712 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21713 <ul>
21714 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21715 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21716 </ul>
21717 </li>
21718 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21719 <ul>
21720 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21721 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21722 </ul>
21723 </li>
21724 </ul>
21725 </div>
21726
21727 <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>
21728 <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>
21729 <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>
21730 <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>
21731 <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>
21732 <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>
21733
21734 !! end
21735
21736
21737 !! test
21738 ISBN with a dummy number
21739 !! wikitext
21740 ISBN ---
21741 !! html
21742 <p>ISBN ---
21743 </p>
21744 !! end
21745
21746
21747 !! test
21748 ISBN with space-delimited number
21749 !! wikitext
21750 ISBN 92 9017 032 8
21751 !! html/php
21752 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21753 </p>
21754 !! html/parsoid
21755 <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>
21756 !! end
21757
21758
21759 !! test
21760 ISBN with multiple spaces, no number
21761 !! wikitext
21762 ISBN foo
21763 !! html
21764 <p>ISBN foo
21765 </p>
21766 !! end
21767
21768
21769 !! test
21770 ISBN length
21771 !! wikitext
21772 ISBN 123456789
21773
21774 ISBN 1234567890
21775
21776 ISBN 12345678901
21777 !! html/php
21778 <p>ISBN 123456789
21779 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21780 </p><p>ISBN 12345678901
21781 </p>
21782 !! html/parsoid
21783 <p>ISBN 123456789</p>
21784
21785 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21786
21787 <p>ISBN 12345678901</p>
21788 !! end
21789
21790
21791 !! test
21792 ISBN with trailing year (T9110)
21793 !! wikitext
21794 ISBN 1-234-56789-0 - 2006
21795
21796 ISBN 1 234 56789 0 - 2006
21797 !! html/php
21798 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21799 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21800 </p>
21801 !! html/parsoid
21802 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21803
21804 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21805 !! end
21806
21807
21808 !! test
21809 anchorencode
21810 !! config
21811 wgFragmentMode=[ 'html5', 'legacy' ]
21812 !! wikitext
21813 {{anchorencode:foo bar©#%n}}
21814 !! html/php
21815 <p>foo_bar©#%n
21816 </p>
21817 !! html/parsoid
21818 <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>
21819 !! end
21820
21821 !! test
21822 anchorencode (legacy)
21823 !! config
21824 wgFragmentMode=[ 'legacy' ]
21825 !! wikitext
21826 {{anchorencode:foo bar©#%n}}
21827 !! html/php
21828 <p>foo_bar.C2.A9.23.25n
21829 </p>
21830 !! end
21831
21832 !! test
21833 anchorencode trims spaces
21834 !! config
21835 wgFragmentMode=[ 'html5', 'legacy' ]
21836 !! wikitext
21837 {{anchorencode: __pretty__please__}}
21838 !! html/php
21839 <p>pretty_please
21840 </p>
21841 !! html/parsoid
21842 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
21843 !! end
21844
21845 !! test
21846 anchorencode deals with links
21847 !! config
21848 wgFragmentMode=[ 'html5', 'legacy' ]
21849 !! wikitext
21850 {{anchorencode: [[hello|world]] [[hi]]}}
21851 !! html/php
21852 <p>world_hi
21853 </p>
21854 !! html/parsoid
21855 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
21856 !! end
21857
21858 !! test
21859 anchorencode deals with templates
21860 !! config
21861 wgFragmentMode=[ 'html5', 'legacy' ]
21862 !! wikitext
21863 {{anchorencode: {{Foo}} x}}
21864 !! html/php
21865 <p>FOO_x
21866 </p>
21867 !! html/parsoid
21868 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
21869 !! end
21870
21871 !! test
21872 anchorencode encodes like the TOC generator: (T20431)
21873 !! config
21874 wgFragmentMode=[ 'html5', 'legacy' ]
21875 !! wikitext
21876 ===_ +:.3A%3A _ &&amp;]] x===
21877 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
21878 __NOEDITSECTION__
21879 !! html/php
21880 <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>
21881 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
21882 </p>
21883 !! html/parsoid
21884 <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>
21885 <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>
21886 <meta property="mw:PageProp/noeditsection"/>
21887 !! end
21888
21889 !! test
21890 anchorencode encodes like the TOC generator: (T20431) (legacy)
21891 !! config
21892 wgFragmentMode=[ 'legacy' ]
21893 !! wikitext
21894 ===_ +:.3A%3A&&amp;]]===
21895 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21896 __NOEDITSECTION__
21897 !! html/php
21898 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21899 <p>.2B:.3A.253A.26.26.5D.5D
21900 </p>
21901 !! end
21902
21903 !! test
21904 T8200: blockquotes and paragraph formatting
21905 !! wikitext
21906 <blockquote>
21907 foo
21908 </blockquote>
21909
21910 bar
21911
21912 baz
21913 !! html
21914 <blockquote>
21915 <p>foo
21916 </p>
21917 </blockquote>
21918 <p>bar
21919 </p>
21920 <pre>baz
21921 </pre>
21922 !! end
21923
21924 !! test
21925 T10293: Use of center tag ruins paragraph formatting
21926 !! wikitext
21927 <center>
21928 foo
21929 </center>
21930
21931 bar
21932
21933 baz
21934 !! html
21935 <center>
21936 <p>foo
21937 </p>
21938 </center>
21939 <p>bar
21940 </p>
21941 <pre>baz
21942 </pre>
21943 !! end
21944
21945 !!test
21946 Parsing of overlapping (improperly nested) inline html tags
21947 !! wikitext
21948 <span><s>x</span></s>
21949 !! html/php
21950 <p><span><s>x&lt;/span&gt;</s></span>
21951 </p>
21952 !! html/parsoid
21953 <p><span><s>x</s></span>
21954 </p>
21955 !!end
21956
21957 ###
21958 ### Language variants related tests
21959 ###
21960
21961 # Parsoid does not mark self-links.
21962 # Parsoid does not convert links; PHP will do any necessary redirects.
21963
21964 !! test
21965 Self-link in language variants
21966 !! options
21967 title=[[Dunav]] language=sr
21968 !! wikitext
21969 Both [[Dunav]] and [[Дунав]] are names for this river.
21970 !! html/php
21971 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21972 </p>
21973 !! html/parsoid
21974 <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>
21975 !! end
21976
21977 !! article
21978 Дуна
21979 !! text
21980 content
21981 !! endarticle
21982
21983 !! test
21984 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21985 !! options
21986 title=[[Duna]] language=sr
21987 !! wikitext
21988 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21989 !! html/php
21990 <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.
21991 </p>
21992 !! html/parsoid
21993 <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>
21994 !! end
21995
21996 !! test
21997 Link to a section of a variant of this title shouldn't be parsed as self-link
21998 !! options
21999 title=[[Duna]] language=sr
22000 !! wikitext
22001 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
22002 !! html/php
22003 <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.
22004 </p>
22005 !! html/parsoid
22006 <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>
22007 !! end
22008
22009 !! test
22010 Link to pages in language variants
22011 !! options
22012 language=sr
22013 !! wikitext
22014 Main Page can be written as [[Маин Паге]]
22015 !! html/php
22016 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
22017 </p>
22018 !! html/parsoid
22019 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
22020 !! end
22021
22022
22023 !! test
22024 Multiple links to pages in language variants
22025 !! options
22026 language=sr
22027 !! wikitext
22028 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
22029 !! html/php
22030 <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>.
22031 </p>
22032 !! html/parsoid
22033 <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>
22034 !! end
22035
22036
22037 !! test
22038 Simple template in language variants
22039 !! options
22040 language=sr
22041 !! wikitext
22042 {{тест}}
22043 !! html/php
22044 <p>This is a test template
22045 </p>
22046 !! end
22047
22048
22049 !! test
22050 Template with explicit namespace in language variants
22051 !! options
22052 language=sr
22053 !! wikitext
22054 {{Template:тест}}
22055 !! html/php
22056 <p>This is a test template
22057 </p>
22058 !! end
22059
22060
22061 !! test
22062 Basic test for template parameter in language variants
22063 !! options
22064 language=sr
22065 !! wikitext
22066 {{парамтест|param=foo}}
22067 !! html/php
22068 <p>This is a test template with parameter foo
22069 </p>
22070 !! end
22071
22072 !! test
22073 Simple category in language variants
22074 !! options
22075 language=sr cat
22076 !! wikitext
22077 [[Category:МедиаWики Усер'с Гуиде]]
22078 !! html/php
22079 cat=МедиаWики_Усер'с_Гуиде sort=
22080 !! html/parsoid
22081 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
22082 !! end
22083
22084 !! article
22085 Category:分类
22086 !! text
22087 blah
22088 !! endarticle
22089
22090 !! article
22091 Category:分類
22092 !! text
22093 blah
22094 !! endarticle
22095
22096 ## We used to, but no longer wt2wt this test since the default serializer
22097 ## will normalize all categories to serialize on their own line.
22098 ## This wikitext usage is going to be fairly uncommon in production and
22099 ## selser will take care of preserving formatting in those scenarios.
22100 !! test
22101 Don't convert blue categorylinks to another variant (T35210)
22102 !! options
22103 cat
22104 language=zh
22105 parsoid=wt2html
22106 !! wikitext
22107 [[A]][[Category:分类]]
22108 !! html/php
22109 cat=分类 sort=
22110 !! html/parsoid
22111 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
22112 <link rel="mw:PageProp/Category" href="./Category:分类"/>
22113 !! end
22114
22115 !! test
22116 Stripping -{}- tags (language variants)
22117 !! options
22118 language=sr
22119 !! wikitext
22120 Latin proverb: -{Ne nuntium necare}-
22121 !! html/php
22122 <p>Latin proverb: Ne nuntium necare
22123 </p>
22124 !! html/parsoid
22125 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22126 !! end
22127
22128
22129 !! test
22130 Prevent conversion with -{}- tags (language variants)
22131 !! options
22132 language=sr variant=sr-ec
22133 !! wikitext
22134 Latinski: -{Ne nuntium necare}-
22135 !! html/php
22136 <p>Латински: Ne nuntium necare
22137 </p>
22138 !! html/parsoid
22139 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22140 !! end
22141
22142
22143 !! test
22144 Prevent conversion of text with -{}- tags (language variants)
22145 !! options
22146 language=sr variant=sr-ec
22147 !! wikitext
22148 Latinski: -{Ne nuntium necare}-
22149 !! html/php
22150 <p>Латински: Ne nuntium necare
22151 </p>
22152 !! html/parsoid
22153 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22154 !! end
22155
22156
22157 !! test
22158 Prevent conversion of links with -{}- tags (language variants)
22159 !! options
22160 language=sr variant=sr-ec
22161 !! wikitext
22162 -{[[Main Page]]}-
22163 !! html/php
22164 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22165 </p>
22166 !! html/parsoid
22167 <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>
22168 !! end
22169
22170
22171 !! test
22172 -{}- tags within headlines (within html for parserConvert())
22173 !! config
22174 wgFragmentMode=[ 'html5', 'legacy' ]
22175 !! options
22176 language=sr variant=sr-ec
22177 !! wikitext
22178 ==-{Naslov}-==
22179
22180 Note that even an unprotected headline ID is not affected by language
22181 conversion:
22182
22183 ==Latinski==
22184 !! html/php
22185 <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>
22186 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
22187 цонверсион:
22188 </p>
22189 <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>
22190
22191 !! html/parsoid
22192 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
22193
22194 <p>Note that even an unprotected headline ID is not affected by language
22195 conversion:</p>
22196
22197 <h2 id="Latinski">Latinski</h2>
22198 !! end
22199
22200 !! test
22201 Explicit definition of language variant alternatives
22202 !! options
22203 language=zh variant=zh-tw
22204 !! wikitext
22205 -{zh:China;zh-tw:Taiwan}-, not China
22206 !! html/php
22207 <p>Taiwan, not China
22208 </p>
22209 !! html/parsoid
22210 <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>
22211 !! end
22212
22213 !! test
22214 Filter syntax for language variants
22215 !! options
22216 language=zh variant=zh-tw
22217 !! wikitext
22218 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
22219 !! html/php
22220 <p>fooblog, WEBJOURNAL, WEBLOGquux
22221 </p>
22222 !! html/parsoid
22223 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
22224 !! end
22225
22226 # Note that Parsoid post-processing for language variants needs to
22227 # update the `title` attribute here, based on the mw:ExpandedAttrs property
22228 !! test
22229 Conversion around HTML tags
22230 !! options
22231 language=sr variant=sr-ec
22232 !! wikitext
22233 -{H|span=>sr-ec:script;title=>sr-ec:src}-
22234 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
22235 !! html/php
22236 <p>
22237 <span title="ЛаCтин">ски</span>
22238 </p>
22239 !! html/parsoid
22240 <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"}]}'/>
22241 <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>
22242 !! end
22243
22244 !! test
22245 Explicit session-wise two-way language variant mapping (A flag and - flag)
22246 !! options
22247 language=zh variant=zh-tw
22248 !! wikitext
22249 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
22250
22251 Taiwan is not China.
22252
22253 But -{A|zh:China; zh-tw:Taiwan}- is China,
22254
22255 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
22256
22257 and -{China}- is China.
22258 !! html/php
22259 <p>This is Taiwan, but we'll forget that now.
22260 </p><p>Taiwan is not China.
22261 </p><p>But Taiwan is Taiwan,
22262 </p><p>(This should be stripped!)
22263 </p><p>and China is China.
22264 </p>
22265 !! html/parsoid
22266 <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>
22267 <p>Taiwan is not China.</p>
22268 <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>
22269 <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>
22270 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22271 !! end
22272
22273 !! test
22274 Explicit session-wise one-way language variant mapping (A flag and - flag)
22275 !! options
22276 language=zh variant=zh-tw
22277 !! wikitext
22278 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
22279
22280 COUNTRY is China or Taiwan.
22281
22282 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
22283
22284 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22285
22286 and -{COUNTRY}- is COUNTRY.
22287 !! html/php
22288 <p>This is Taiwan, but we'll forget that now.
22289 </p><p>COUNTRY is China or Taiwan.
22290 </p><p>But Taiwan is Taiwan,
22291 </p><p>(This should be stripped!)
22292 </p><p>and COUNTRY is COUNTRY.
22293 </p>
22294 !! html/parsoid
22295 <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>
22296 <p>COUNTRY is China or Taiwan.</p>
22297 <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>
22298 <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>
22299 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22300 !! end
22301
22302 !! test
22303 Explicit session-wise two-way language variant mapping (H flag for hide)
22304 !! options
22305 language=zh variant=zh-tw
22306 !! wikitext
22307 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22308
22309 Taiwan is China.
22310 !! html/php
22311 <p>(This should be stripped!)
22312 </p><p>Taiwan is Taiwan.
22313 </p>
22314 !! html/parsoid
22315 <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>
22316 <p>Taiwan is China.</p>
22317 !! end
22318
22319 !! test
22320 Explicit session-wise one-way language variant mapping (H flag for hide)
22321 !! options
22322 language=zh variant=zh-tw
22323 !! wikitext
22324 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22325
22326 COUNTRY is Taiwan or China.
22327 !! html/php
22328 <p>(This should be stripped!)
22329 </p><p>Taiwan is Taiwan or China.
22330 </p>
22331 !! html/parsoid
22332 <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>
22333 <p>COUNTRY is Taiwan or China.</p>
22334 !! end
22335
22336 ## Note that parsoid test runner does not support 'showtitle' option.
22337 !! test
22338 Adding explicit conversion rule for title (T flag)
22339 !! options
22340 language=zh variant=zh-tw showtitle
22341 !! wikitext
22342 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22343
22344 Taiwan is China.
22345 !! html/php
22346 Taiwan
22347 <p>Should be stripped!
22348 </p><p>Taiwan is China.
22349 </p>
22350 !! html/parsoid
22351 <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>
22352 <p>Taiwan is China.</p>
22353 !! end
22354
22355 !! test
22356 Code coverage: T combined with H flag
22357 !! options
22358 language=zh variant=zh-tw showtitle
22359 !! wikitext
22360 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22361
22362 Taiwan is China.
22363 !! html/php
22364 Taiwan
22365 <p>Should be stripped!
22366 </p><p>Taiwan is Taiwan.
22367 </p>
22368 !! html/parsoid
22369 <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>
22370 <p>Taiwan is China.</p>
22371 !! end
22372
22373 !! test
22374 Code coverage: T with no variants
22375 !! options
22376 language=zh variant=zh-tw showtitle
22377 !! wikitext
22378 -{H|zh:China; zh-tw:Taiwan}-
22379 Taiwan is China.-{T|Taiwan is China}-
22380 !! html/php
22381 Taiwan is China
22382 <p>
22383 Taiwan is Taiwan.
22384 </p>
22385 !! html/parsoid
22386 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22387 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22388 !! end
22389
22390 !! test
22391 Code coverage: rules with no variants
22392 !! options
22393 language=zh variant=zh-tw
22394 !! wikitext
22395 -{H|zh:China; zh-tw:Taiwan}-
22396 Taiwan is China.
22397 -{H|China}-
22398 Taiwan is China.
22399 !! html/php
22400 <p>
22401 Taiwan is Taiwan.
22402
22403 Taiwan is China.
22404 </p>
22405 !! html/parsoid
22406 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22407 Taiwan is China.
22408 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22409 Taiwan is China.</p>
22410 !! end
22411
22412
22413 !! test
22414 Code coverage: D flag for conversion rule
22415 !! options
22416 language=zh variant=zh-tw
22417 !! wikitext
22418 -{D|zh-cn:XA; zh-tw:YA}-
22419 -{A;D|zh-cn:XB; zh-tw:YB}-
22420 -{D;H|zh-cn:XC; zh-tw:YC}-
22421
22422 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22423
22424 -{D|0=>zh-tw:1}-
22425 -{A;D|2=>zh-tw:3}-
22426 -{D;H|4=>zh-tw:5}-
22427
22428 XA XB XC YA YB YC FOO BAR BAT 012345
22429 !! html/php
22430 <p>大陆:XA;台灣:YA;
22431
22432 大陆:XC;台灣:YC;
22433 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22434 </p><p>0⇒台灣:1;
22435
22436 4⇒台灣:5;
22437 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22438 </p>
22439 !! html/parsoid
22440 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22441 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22442 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22443 <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>
22444 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22445 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22446 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22447 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22448 !! end
22449
22450 !! test
22451 Code coverage: N flag for conversion rule
22452 !! options
22453 language=zh variant=zh-cn
22454 !! wikitext
22455 -{N|zh-cn}-
22456
22457 -{N|zh-tw}-
22458
22459 -{N|sr-ec}-
22460 !! html/php
22461 <p>大陆
22462 </p><p>台灣
22463 </p><p>српски (ћирилица)‎
22464 </p>
22465 !! html/parsoid
22466 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22467 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22468 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22469 !! end
22470
22471 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22472 !! test
22473 Code coverage: N flag for conversion rule (wt2html only)
22474 !! options
22475 language=zh variant=zh-cn
22476 parsoid=wt2html,html2html
22477 !! wikitext
22478 -{D;N|en}-
22479 !! html/php
22480 <p>English
22481 </p>
22482 !! html/parsoid
22483 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22484 !! end
22485
22486 !! test
22487 Testing that changing the language variant here in the tests actually works
22488 !! options
22489 language=zh variant=zh showtitle
22490 !! wikitext
22491 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22492 !! html/php
22493 China
22494 <p>Should be stripped!
22495 </p>
22496 !! html/parsoid
22497 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22498 !! end
22499
22500 !! test
22501 Recursive conversion of alt and title attrs shouldn't clear converter state
22502 !! options
22503 language=zh variant=zh-cn
22504 showtitle
22505 !! wikitext
22506 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22507 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22508 !! html/php
22509 China
22510 <p>
22511 Should be stripped<span title="Exclamation">!</span>
22512 </p>
22513 !! html/parsoid
22514 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22515 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>
22516 !! end
22517
22518 !! test
22519 T26072: more test on conversion rule for title
22520 !! options
22521 language=zh variant=zh-tw showtitle
22522 !! wikitext
22523 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22524
22525 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22526 !! html/php
22527 Taiwan
22528 <p>This should be stripped!
22529 </p><p>This won't take interferes with the title rule.
22530 </p>
22531 !! html/parsoid
22532 <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>
22533 <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>
22534 !! end
22535
22536 !! test
22537 Partly disable title conversion if variant == main language code
22538 !! options
22539 language=zh variant=zh title=[[ZH]] showtitle
22540 !! wikitext
22541 -{T|zh-cn:CN;zh-tw:TW}-
22542 !! html/php
22543 ZH
22544 <p>
22545 </p>
22546 !! html/parsoid
22547 <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>
22548 !! end
22549
22550 !! test
22551 Partly disable title conversion if variant == main language code, more
22552 !! options
22553 language=zh variant=zh title=[[ZH]] showtitle
22554 !! wikitext
22555 -{T|TW}-
22556 !! html/php
22557 ZH
22558 <p>
22559 </p>
22560 !! html/parsoid
22561 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22562 !! end
22563
22564 !! test
22565 Raw output of variant escape tags (R flag)
22566 !! options
22567 language=zh variant=zh-tw
22568 !! wikitext
22569 Raw: -{R|zh:China;zh-tw:Taiwan}-
22570 !! html/php
22571 <p>Raw: zh:China;zh-tw:Taiwan
22572 </p>
22573 !! html/parsoid
22574 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22575 !! end
22576
22577 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22578 !! test
22579 Raw output of variant escape tags (R flag) (wt2html only)
22580 !! options
22581 language=zh variant=zh-tw
22582 parsoid=wt2html,html2html
22583 !! wikitext
22584 -{Variant}- -{D|syntax}- -{D;R|options}-
22585 !! html/php
22586 <p>Variant syntax options
22587 </p>
22588 !! html/parsoid
22589 <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>
22590 !! end
22591
22592 !! test
22593 Nested markup inside raw output of variant escape tags (R flag)
22594 !! options
22595 language=zh variant=zh-tw
22596 !! wikitext
22597 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22598 !! html/php
22599 <p>Nested raw: nested Taiwan nested
22600 </p>
22601 !! html/parsoid
22602 <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>
22603 !! end
22604
22605 !! test
22606 Nested markup and spaces inside raw output of variant escape tags (R flag)
22607 !! options
22608 language=zh variant=zh-tw
22609 !! wikitext
22610 X-{ outer -{ inner }- outer }-X
22611 !! html/php
22612 <p>X outer inner outer X
22613 </p>
22614 !! html/parsoid
22615 <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>
22616 !! end
22617
22618 !! test
22619 Templates inside raw output of variant escape tags (R flag)
22620 !! options
22621 language=zh variant=zh-tw
22622 !! wikitext
22623 Nested raw: -{R|nested {{echo|hi}} templates}-
22624 !! html/php
22625 <p>Nested raw: nested hi templates
22626 </p>
22627 !! html/parsoid
22628 <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>
22629 !! end
22630
22631 !! test
22632 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22633 !! options
22634 language=zh variant=zh-cn
22635 !! wikitext
22636 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22637 !! html/php
22638 <p>0
22639 </p>
22640 !! html/parsoid
22641 <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>
22642 !! end
22643
22644 !! test
22645 Conversion rules from [numeric-only string] to [something else] (T48634)
22646 !! options
22647 language=zh variant=zh-cn
22648 !! wikitext
22649 -{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
22650 !! html/php
22651 <p>D12345EE12345
22652 </p>
22653 !! html/parsoid
22654 <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>
22655 !! end
22656
22657 !! test
22658 Two-way converter rule entries with an empty value should be ignored (T53551)
22659 !! options
22660 language=zh variant=zh-cn
22661 !! wikitext
22662 -{H|zh-cn:foo;zh-tw:;}-foobar
22663 !! html/php
22664 <p>foobar
22665 </p>
22666 !! html/parsoid
22667 <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>
22668 !! end
22669
22670 !! test
22671 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22672 !! options
22673 language=zh variant=zh-cn
22674 !! wikitext
22675 -{H|=>zh-cn:foo;}-foobar
22676 !! html/php
22677 <p>foobar
22678 </p>
22679 !! html/parsoid
22680 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22681 !! end
22682
22683 !! test
22684 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22685 !! options
22686 language=zh variant=zh-cn
22687 !! wikitext
22688 -{H|}-foobar
22689 !! html/php
22690 <p>foobar
22691 </p>
22692 !! html/parsoid
22693 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22694 !! end
22695
22696 !! test
22697 Nested using of manual convert syntax
22698 !! options
22699 language=zh variant=zh-hk
22700 !! wikitext
22701 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22702 !! html/php
22703 <p>Nested: Hello Hong Kong!
22704 </p>
22705 !! html/parsoid
22706 <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>
22707 !! end
22708
22709 !! test
22710 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22711 !! options
22712 language=zh variant=zh-cn
22713 !! wikitext
22714 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22715 !! html/php
22716 <p><span title="X">A</span>
22717 </p>
22718 !! html/parsoid
22719 <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>
22720 !! end
22721
22722 !! test
22723 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22724 !! options
22725 language=zh variant=zh-cn
22726 !! wikitext
22727 -{<span title="-{X}-">A</span>}-
22728 !! html/php+disabled
22729 <p><span title="X">A</span>
22730 </p>
22731 !! html/parsoid
22732 <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>
22733 !! end
22734
22735 # Parsoid and PHP disagree on how to parse this example: Parsoid
22736 # insists that the content of a language converter element be a valid
22737 # DOM fragment or attribute string
22738 !! test
22739 Language converter markup with block content
22740 !! options
22741 language=zh variant=zh-cn
22742 !! wikitext
22743 <span>a-{b<div>c}-d
22744
22745 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22746
22747 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22748 !! html/php+tidy
22749 <span>ab<div>cd
22750 <span>ab<div>cd
22751 <span>ad
22752 </span></div></span></div></span>
22753 !! html/parsoid
22754 <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>
22755
22756 <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>
22757
22758 <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>
22759 !! end
22760
22761 !! test
22762 LanguageConverter selser (1)
22763 !! options
22764 language=zh variant=zh-cn
22765 parsoid={
22766 "modes": ["wt2wt", "selser"],
22767 "changes": [
22768 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22769 ]
22770 }
22771 !! wikitext
22772 -{raw}-
22773 !! wikitext/edited
22774 -{edited}-
22775 !! end
22776
22777 !! test
22778 LanguageConverter selser (2)
22779 !! options
22780 language=zh variant=zh-cn
22781 parsoid={
22782 "modes": ["wt2wt", "selser"],
22783 "changes": [
22784 ["span[class='x']", "contents", "text", "-{foo}-"],
22785 ["a", "contents", "text", "-{"],
22786 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22787 ]
22788 }
22789 !! wikitext
22790 <span class="x">TEXT1</span>
22791 [http://example.com TEXT2]
22792 [[Foo|TEXT3]]
22793 {{echo|TEXT4}}
22794 !! wikitext/edited
22795 <span class="x"><nowiki>-{foo}-</nowiki></span>
22796 [http://example.com -{]
22797 [[Foo|<nowiki>-{</nowiki>]]
22798 {{1x|<nowiki>-{</nowiki>}}
22799 !! end
22800
22801 # Tests LanguageVariantText in ConstrainedText
22802 !! test
22803 LanguageConverter selser (3)
22804 !! options
22805 language=zh variant=zh-cn
22806 parsoid={
22807 "modes": ["wt2wt", "selser"],
22808 "changes": [
22809 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22810 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22811 ]
22812 }
22813 !! wikitext
22814 {|
22815 |-
22816 |<span>Foo</span>
22817 |}
22818 !! wikitext/edited
22819 {|
22820 |-
22821 |<nowiki/>-{edited}-
22822 |}
22823 !! end
22824
22825 # Tests LanguageVariantText._fromSelSer
22826 !! test
22827 LanguageConverter selser (4)
22828 !! options
22829 language=zh variant=zh-cn
22830 parsoid={
22831 "modes": ["wt2wt", "selser"],
22832 "changes": [
22833 ["td > span.x", "remove"]
22834 ]
22835 }
22836 !! wikitext
22837 {|
22838 |-
22839 |<span class="x">Foo</span>-{Bar}-
22840 ||<span class="x">Foo</span>-{Bar}-
22841 |}
22842 !! wikitext/edited
22843 {|
22844 |-
22845 |<nowiki/>-{Bar}-
22846 ||-{Bar}-
22847 |}
22848 !! end
22849
22850 # Since Parsoid is starting to emit canonical wikitext for links,
22851 # [http://example.com http://example.com] will not RT back to that
22852 # form anymore.
22853 # Parsoid does not language-convert links (it is done in a
22854 # post-processing step)
22855 !! test
22856 Proper conversion of text in external links
22857 !! options
22858 language=sr variant=sr-ec
22859 parsoid=wt2html
22860 !! wikitext
22861 http://www.google.com
22862 gopher://www.google.com
22863 [http://www.google.com http://www.google.com]
22864 [gopher://www.google.com gopher://www.google.com]
22865 [https://www.google.com irc://www.google.com]
22866 [ftp://www.google.com www.google.com/ftp://dir]
22867 [//www.google.com www.google.com]
22868 !! html/php
22869 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22870 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22871 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
22872 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22873 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22874 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22875 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22876 </p>
22877 !! html/parsoid
22878 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22879 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22880 <a rel="mw:ExtLink" class="external text" href="http://www.google.com">http://www.google.com</a>
22881 <a rel="mw:ExtLink" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22882 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
22883 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22884 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
22885 !! end
22886
22887 !! test
22888 Do not convert roman numbers to language variants
22889 !! options
22890 language=sr variant=sr-ec
22891 !! wikitext
22892 Fridrih IV je car.
22893 !! html/php
22894 <p>Фридрих IV је цар.
22895 </p>
22896 !! html/parsoid
22897 <p>Fridrih IV je car.</p>
22898 !! end
22899
22900 !! test
22901 Unclosed language converter markup "-{"
22902 !! options
22903 language=sr
22904 !! wikitext
22905 -{T|hello
22906 !! html
22907 <p>-{T|hello
22908 </p>
22909 !! end
22910
22911 !! test
22912 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22913 !! options
22914 language=sr
22915 !! wikitext
22916 -{R|=&gt;}-
22917 !! html/php
22918 <p>=&gt;
22919 </p>
22920 !! html/parsoid
22921 <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>
22922 !!end
22923
22924 !! test
22925 Don't break link parsing if language converter markup is in the caption.
22926 !! options
22927 language=sr variant=sr-ec
22928 !! wikitext
22929 [[Main Page|-{R|main page}-]]
22930 !! html/php
22931 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22932 </p>
22933 !! html/parsoid
22934 <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>
22935 !! end
22936
22937 !! test
22938 T146304: Don't break template parsing if language converter markup is in the parameter.
22939 !! options
22940 language=sr variant=sr-ec
22941 !! wikitext
22942 {{echo|-{R|foo}-}}
22943 !! html/php
22944 <p>foo
22945 </p>
22946 !! html/parsoid
22947 <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>
22948 !! end
22949
22950 !! test
22951 T146305: Don't break image parsing if language converter markup is in the caption.
22952 !! options
22953 language=sr
22954 !! wikitext
22955 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
22956 !! html/php
22957 <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>
22958
22959 !! html/parsoid
22960 <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>
22961 !! end
22962
22963 !! test
22964 T146305: Don't break image parsing if nested language converter markup is in the caption.
22965 !! options
22966 language=zh variant=zh-cn
22967 !! wikitext
22968 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
22969 !! html/php
22970 <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>
22971
22972 !! html/parsoid
22973 <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>
22974 !! end
22975
22976 # XXX html2wt disabled because rich markup in alt is not preserved.
22977 !! test
22978 Don't break gallery if language converter markup is inside.
22979 !! options
22980 language=zh
22981 !! wikitext
22982 <gallery>
22983 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
22984 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
22985 </gallery>
22986 !! html/php
22987 <ul class="gallery mw-gallery-traditional">
22988 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22989 <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>
22990 <div class="gallerytext">
22991 <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>
22992 </p>
22993 </div>
22994 </div></li>
22995 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22996 <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>
22997 <div class="gallerytext">
22998 <p>This is a test template
22999 </p>
23000 </div>
23001 </div></li>
23002 </ul>
23003
23004 !! html/parsoid
23005 <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"}}'>
23006 <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>
23007 <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>
23008 </ul>
23009 !! end
23010
23011 !! test
23012 T153135: Don't break list handling if language converter markup is in the item.
23013 !! options
23014 language=zh variant=zh-cn
23015 !! wikitext
23016 ;-{zh-cn:AAA;zh-tw:BBB}-
23017 ;-{R|foo:bar}-
23018 !! html/php
23019 <dl><dt>AAA</dt>
23020 <dt>foo:bar</dt></dl>
23021
23022 !! html/parsoid
23023 <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>
23024 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
23025 </dl>
23026 !! end
23027
23028 // Note that parsoid does not protect colons unless language converter
23029 // markup is properly nested, because it is a backtracking parser.
23030 !! test
23031 T153135: Unclosed markup in definition list (code coverage)
23032 !! options
23033 language=zh variant=zh-cn
23034 !! wikitext
23035 ;<b>foo:bar
23036 ;-{zh-cn:AAA
23037 !! html/php+tidy
23038 <dl><dt><b>foo:bar</b></dt><b>
23039 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
23040 </b></p>
23041 !! html/parsoid
23042 <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}'>
23043 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
23044 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
23045 </b></dl>
23046 !! end
23047
23048 !! test
23049 T153135: Nested language converter markup in definition list (code coverage)
23050 !! options
23051 language=zh variant=zh-cn
23052 !! wikitext
23053 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
23054 !! html/php
23055 <dl><dt>AAA foo:bar bat:baz</dt>
23056 <dd>def</dd></dl>
23057
23058 !! html/parsoid
23059 <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>
23060 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
23061 </dl>
23062 !! end
23063
23064 # html2wt mode disabled due to <nowiki> insertion.
23065 !! test
23066 T153140: Don't break table handling if language converter markup is in the cell.
23067 !! options
23068 language=sr variant=sr-ec
23069 parsoid=wt2html,wt2wt,html2html
23070 !! wikitext
23071 {|
23072 |-
23073 | -{R|B}-
23074 |}
23075 !! html/php
23076 <table>
23077
23078 <tr>
23079 <td>B
23080 </td></tr></table>
23081
23082 !! html/parsoid
23083 <table>
23084 <tbody>
23085 <tr>
23086 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
23087 </tr>
23088 </tbody>
23089 </table>
23090 !! end
23091
23092 !! test
23093 Language converter tricky html2wt cases (1)
23094 !! options
23095 language=sr
23096 parsoid=html2wt,wt2wt
23097 !! html/parsoid
23098 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
23099 !! wikitext
23100 -{<nowiki>}-</nowiki>}-
23101 !! html/php
23102 <p>&#125;-
23103 </p>
23104 !! end
23105
23106 !! test
23107 Language converter tricky html2wt cases (2)
23108 !! options
23109 language=sr
23110 parsoid=html2wt,wt2wt
23111 !! html/parsoid
23112 <p>-{foo}-</p>
23113 !! wikitext
23114 <nowiki>-{foo}-</nowiki>
23115 !! html/php
23116 <p>-&#123;foo&#125;-
23117 </p>
23118 !! end
23119
23120 !! test
23121 Language converter tricky html2wt cases (3)
23122 !! options
23123 language=sr
23124 parsoid=html2wt,wt2wt
23125 !! html/parsoid
23126 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
23127 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
23128 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
23129 !! wikitext
23130 -{R||}-
23131
23132 -{R|R|raw}-
23133
23134 -{<nowiki>-{foo}-</nowiki>}-
23135 !! html/php
23136 <p>|
23137 </p><p>R|raw
23138 </p><p>-&#123;foo&#125;-
23139 </p>
23140 !! end
23141
23142 !! test
23143 Language converter tricky html2wt cases (4)
23144 !! options
23145 language=sr
23146 parsoid=html2wt,wt2wt
23147 !! html/parsoid
23148 <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>
23149 !! wikitext
23150 -{R|{{echo|hey}}}-
23151 !! html/php
23152 <p>hey
23153 </p>
23154 !! end
23155
23156 # Note that the <nowiki> escaping added by parsoid for source text,
23157 # destination text, and language names only works on the PHP side
23158 # for *destination text*. (HTML entity escaping wouldn't work
23159 # any better.) This is probably a bug, at least for source texts.
23160 # (For language names PHP uses a precise regexp based on the languages
23161 # it currently knows have variants, which is fragile since this set
23162 # can grow/shrink over time.)
23163 !! test
23164 Language converter tricky html2wt cases (5)
23165 !! options
23166 language=zh variant=zh-cn
23167 !! html/parsoid
23168 <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>
23169 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
23170 <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>
23171 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
23172 <p>a:b=>c xyz</p>
23173 !! wikitext
23174 -{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
23175
23176 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
23177
23178 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
23179
23180 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
23181
23182 a:b=>c xyz
23183 !! html/php+disabled
23184 <p>foobat;xyz=&gt;zh-cn:abc
23185 </p><p>A
23186 </p><p>0;zh-tw:bar
23187 </p><p>abc
23188 </p><p>a:b=&gt;c 0;zh-tw:bar
23189 </p>
23190 !! end
23191
23192 !! test
23193 T179579: Nowiki and lc interaction
23194 !! options
23195 parsoid=wt2html
23196 language=sr
23197 !! wikitext
23198 -{</nowiki>123}-
23199
23200 -{123<nowiki>|</nowiki>456}-
23201 !! html/parsoid
23202 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
23203
23204 <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>
23205 !! end
23206
23207 !! test
23208 T2529: Uncovered bullet
23209 !! wikitext
23210 *Foo {{bullet}}
23211 !! html
23212 <ul><li>Foo</li>
23213 <li>Bar</li></ul>
23214
23215 !! end
23216
23217 !! test
23218 T2529: Uncovered bullet in a deeply nested list
23219 !! wikitext
23220 *******Foo {{bullet}}
23221 !! html
23222 <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>
23223 <li>Bar</li></ul>
23224
23225 !! end
23226
23227 !! test
23228 T2529: Uncovered table already at line-start
23229 !! wikitext
23230 x
23231
23232 {{table}}
23233 y
23234 !! html
23235 <p>x
23236 </p>
23237 <table>
23238 <tr>
23239 <td>1</td>
23240 <td>2
23241 </td></tr>
23242 <tr>
23243 <td>3</td>
23244 <td>4
23245 </td></tr></table>
23246 <p>y
23247 </p>
23248 !! end
23249
23250 !! test
23251 T2529: Uncovered bullet in parser function result
23252 !! wikitext
23253 *Foo {{lc:{{bullet}} }}
23254 !! html
23255 <ul><li>Foo</li>
23256 <li>bar</li></ul>
23257
23258 !! end
23259
23260 !! test
23261 T7678: Double-parsed template argument
23262 !! wikitext
23263 {{lc:{{{1}}}|hello}}
23264 !! html
23265 <p>{{{1}}}
23266 </p>
23267 !! end
23268
23269 !! test
23270 T7678: Double-parsed template invocation
23271 !! wikitext
23272 {{lc:{{paramtest {{!}} param = hello }} }}
23273 !! html
23274 <p>{{paramtest | param = hello }}
23275 </p>
23276 !! end
23277
23278 !! test
23279 Case insensitivity of parser functions for non-ASCII characters (T10143)
23280 !! options
23281 language=cs
23282 title=[[Main Page]]
23283 !! wikitext
23284 {{PRVNÍVELKÉ:ěščř}}
23285 {{prvnívelké:ěščř}}
23286 {{PRVNÍMALÉ:ěščř}}
23287 {{prvnímalé:ěščř}}
23288 {{MALÁ:ěščř}}
23289 {{malá:ěščř}}
23290 {{VELKÁ:ěščř}}
23291 {{velká:ěščř}}
23292 !! html
23293 <p>Ěščř
23294 Ěščř
23295 ěščř
23296 ěščř
23297 ěščř
23298 ěščř
23299 ĚŠČŘ
23300 ĚŠČŘ
23301 </p>
23302 !! end
23303
23304 !! test
23305 Morwen/13: Unclosed link followed by heading
23306 !! wikitext
23307 [[link
23308 ==heading==
23309 !! html
23310 <p>[[link
23311 </p>
23312 <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>
23313
23314 !! end
23315
23316 !! test
23317 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23318 !! wikitext
23319 {{foo|
23320 =heading=
23321 !! html
23322 <p>{{foo|
23323 </p>
23324 <h1><span class="mw-headline" id="heading">heading</span></h1>
23325
23326 !! end
23327
23328 !! test
23329 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23330 !! wikitext
23331 {{foo|
23332 ==heading==
23333 !! html
23334 <p>{{foo|
23335 </p>
23336 <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>
23337
23338 !! end
23339
23340 !! test
23341 Tildes in comments
23342 !! options
23343 pst
23344 !! wikitext
23345 <!-- ~~~~ -->
23346 !! html/php
23347 <!-- ~~~~ -->
23348 !! end
23349
23350 !! test
23351 Paragraphs inside divs (no extra line breaks)
23352 !! wikitext
23353 <div>Line one
23354
23355 Line two</div>
23356 !! html
23357 <div>Line one
23358 Line two</div>
23359
23360 !! end
23361
23362 !! test
23363 Paragraphs inside divs (extra line break on open)
23364 !! wikitext
23365 <div>
23366 Line one
23367
23368 Line two</div>
23369 !! html
23370 <div>
23371 <p>Line one
23372 </p>
23373 Line two</div>
23374
23375 !! end
23376
23377 !! test
23378 Paragraphs inside divs (extra line break on close)
23379 !! wikitext
23380 <div>Line one
23381
23382 Line two
23383 </div>
23384 !! html
23385 <div>Line one
23386 <p>Line two
23387 </p>
23388 </div>
23389
23390 !! end
23391
23392 !! test
23393 Paragraphs inside divs (extra line break on open and close)
23394 !! wikitext
23395 <div>
23396 Line one
23397
23398 Line two
23399 </div>
23400 !! html
23401 <div>
23402 <p>Line one
23403 </p><p>Line two
23404 </p>
23405 </div>
23406
23407 !! end
23408
23409 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23410 # Parsoid seems to do a better job here since its p-wrapper is probably smarter.
23411 !! test
23412 Nesting tags, paragraphs on lines which begin with <div>
23413 !! wikitext
23414 <div></div><strong>A
23415 B</strong>
23416 !! html/php+tidy
23417 <div></div><p><strong>A
23418 </strong></p><strong></strong><p><strong>B</strong>
23419 </p>
23420 !! html/parsoid
23421 <div></div>
23422 <p><strong>A
23423 B</strong>
23424 </p>
23425 !! end
23426
23427 # T8200: <blockquote> should behave like <div> with respect to line breaks
23428 !! test
23429 T8200: paragraphs inside blockquotes (no extra line breaks)
23430 !! wikitext
23431 <blockquote>Line one
23432
23433 Line two</blockquote>
23434 !! html
23435 <blockquote>Line one
23436 Line two</blockquote>
23437
23438 !! html+tidy
23439 <blockquote><p>Line one
23440 Line two</p></blockquote>
23441 !! end
23442
23443 !! test
23444 T8200: paragraphs inside blockquotes (extra line break on open)
23445 !! wikitext
23446 <blockquote>
23447 Line one
23448
23449 Line two</blockquote>
23450 !! html
23451 <blockquote>
23452 <p>Line one
23453 </p>
23454 Line two</blockquote>
23455
23456 !! html+tidy
23457 <blockquote>
23458 <p>Line one
23459 </p><p>
23460 Line two</p></blockquote>
23461 !! end
23462
23463 # Parsoid's output is broken on this because of Tidy-compatibility cruft
23464 !! test
23465 T8200: paragraphs inside blockquotes (extra line break on close)
23466 !! wikitext
23467 <blockquote>Line one
23468
23469 Line two
23470 </blockquote>
23471 !! html
23472 <blockquote>Line one
23473 <p>Line two
23474 </p>
23475 </blockquote>
23476
23477 !! html+tidy
23478 <blockquote><p>Line one
23479 </p><p>Line two
23480 </p>
23481 </blockquote>
23482 !! end
23483
23484 !! test
23485 T8200: paragraphs inside blockquotes (extra line break on open and close)
23486 !! wikitext
23487 <blockquote>
23488 Line one
23489
23490 Line two
23491 </blockquote>
23492 !! html
23493 <blockquote>
23494 <p>Line one
23495 </p><p>Line two
23496 </p>
23497 </blockquote>
23498
23499 !! end
23500
23501 ## This is a corner case interaction between the paragraph wrapping in the
23502 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
23503 ## some tags which close paragraphs (and thus prevent wrapping on their line),
23504 ## of which "div" is one, but do p-wrapping inside them. These are referred
23505 ## to as "never suppressing". Remex, for its part, doesn't traverse into
23506 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
23507 !! test
23508 Paragraphs inside blockquotes/divs (no extra line breaks)
23509 !! wikitext
23510 <blockquote><div>Line one
23511
23512 Line two</div></blockquote>
23513 !! html
23514 <blockquote><div>Line one
23515 Line two</div></blockquote>
23516
23517 !! end
23518
23519 !! test
23520 Paragraphs inside blockquotes/divs (extra line break on open)
23521 !! wikitext
23522 <blockquote><div>
23523 Line one
23524
23525 Line two</div></blockquote>
23526 !! html
23527 <blockquote><div>
23528 <p>Line one
23529 </p>
23530 Line two</div></blockquote>
23531
23532 !! end
23533
23534 !! test
23535 Paragraphs inside blockquotes/divs (extra line break on close)
23536 !! wikitext
23537 <blockquote><div>Line one
23538
23539 Line two
23540 </div></blockquote>
23541 !! html
23542 <blockquote><div>Line one
23543 <p>Line two
23544 </p>
23545 </div></blockquote>
23546
23547 !! end
23548
23549 !! test
23550 Paragraphs inside blockquotes/divs (extra line break on open and close)
23551 !! wikitext
23552 <blockquote><div>
23553 Line one
23554
23555 Line two
23556 </div></blockquote>
23557 !! html
23558 <blockquote><div>
23559 <p>Line one
23560 </p><p>Line two
23561 </p>
23562 </div></blockquote>
23563
23564 !! end
23565
23566 !! test
23567 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23568 !! options
23569 wgLinkHolderBatchSize=0
23570 !! wikitext
23571 [[meatball:1]]
23572 [[meatball:2]]
23573 [[meatball:3]]
23574 !! html
23575 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23576 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23577 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23578 </p>
23579 !! end
23580
23581 !! test
23582 Free external link invading image caption
23583 !! wikitext
23584 [[Image:Foobar.jpg|thumb|http://x|hello]]
23585 !! html/php
23586 <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>
23587
23588 !! html/parsoid
23589 <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>
23590 !! end
23591
23592 !! test
23593 T17196: localised external link numbers
23594 !! options
23595 language=fa
23596 !! wikitext
23597 [http://en.wikipedia.org/]
23598 !! html/php
23599 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23600 </p>
23601 !! html/parsoid
23602 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23603 !! end
23604
23605 !! test
23606 Multibyte character in padleft
23607 !! wikitext
23608 {{padleft:-Hello|7|Æ}}
23609 !! html/php
23610 <p>Æ-Hello
23611 </p>
23612 !! html/parsoid
23613 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23614 !! end
23615
23616 !! test
23617 Multibyte character in padright
23618 !! wikitext
23619 {{padright:Hello-|7|Æ}}
23620 !! html/php
23621 <p>Hello-Æ
23622 </p>
23623 !! html/parsoid
23624 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23625 !! end
23626
23627 !!test
23628 formatdate parser function
23629 !! wikitext
23630 {{#formatdate:2009-03-24}}
23631 !! html
23632 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23633 </p>
23634 !! end
23635
23636 !!test
23637 formatdate parser function, with default format
23638 !! wikitext
23639 {{#formatdate:2009-03-24|mdy}}
23640 !! html
23641 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23642 </p>
23643 !! end
23644
23645 !! test
23646 Spacing of numbers in formatted dates
23647 !! wikitext
23648 {{#formatdate:January 15}}
23649 !! html
23650 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23651 </p>
23652 !! end
23653
23654 !! test
23655 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
23656 !! options
23657 language=nl title=[[MediaWiki:Common.css]]
23658 !! wikitext
23659 {{#formatdate:2009-03-24|dmy}}
23660 !! html
23661 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23662 </p>
23663 !! end
23664
23665 #
23666 #
23667 #
23668
23669 #
23670 # Edit comments
23671 #
23672
23673 !! test
23674 Edit comment with link
23675 !! options
23676 comment
23677 !! wikitext
23678 I like the [[Main Page]] a lot
23679 !! html/php
23680 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23681 !!end
23682
23683 !! test
23684 Edit comment with link and link text
23685 !! options
23686 comment
23687 !! wikitext
23688 I like the [[Main Page|best pages]] a lot
23689 !! html/php
23690 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23691 !!end
23692
23693 !! test
23694 Edit comment with link and link text with suffix
23695 !! options
23696 comment
23697 !! wikitext
23698 I like the [[Main Page|best page]]s a lot
23699 !! html/php
23700 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23701 !!end
23702
23703 !! test
23704 Edit comment with section link (non-local, eg in history list)
23705 !! options
23706 comment title=[[Main Page]]
23707 !! wikitext
23708 /* External links */ removed bogus entries
23709 !! html/php
23710 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23711 !!end
23712
23713 !! test
23714 Edit comment with section link and text before it (non-local, eg in history list)
23715 !! options
23716 comment title=[[Main Page]]
23717 !! wikitext
23718 pre-comment text /* External links */ removed bogus entries
23719 !! html/php
23720 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>
23721 !!end
23722
23723 !! test
23724 Edit comment with section link (local, eg in diff view)
23725 !! options
23726 comment local title=[[Main Page]]
23727 !! wikitext
23728 /* External links */ removed bogus entries
23729 !! html/php
23730 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23731 !!end
23732
23733 !! test
23734 Edit comment with subpage link (T16080)
23735 !! options
23736 comment
23737 subpage
23738 title=[[Subpage test]]
23739 !! wikitext
23740 Poked at a [[/subpage]] here...
23741 !! html/php
23742 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23743 !!end
23744
23745 !! test
23746 Edit comment with subpage link and link text (T16080)
23747 !! options
23748 comment
23749 subpage
23750 title=[[Subpage test]]
23751 !! wikitext
23752 Poked at a [[/subpage|neat little page]] here...
23753 !! html/php
23754 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23755 !!end
23756
23757 !! test
23758 Edit comment with bogus subpage link in non-subpage NS (T16080)
23759 !! options
23760 comment
23761 title=[[Subpage test]]
23762 !! wikitext
23763 Poked at a [[/subpage]] here...
23764 !! html/php
23765 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...
23766 !!end
23767
23768 !! test
23769 Edit comment with bare anchor link (local, as on diff)
23770 !! options
23771 comment
23772 local
23773 title=[[Main Page]]
23774 !! wikitext
23775 [[#section]]
23776 !! html/php
23777 <a href="#section">#section</a>
23778 !! end
23779
23780 !! test
23781 Edit comment with bare anchor link (non-local, as on history)
23782 !! options
23783 comment
23784 title=[[Main Page]]
23785 !! wikitext
23786 [[#section]]
23787 !! html/php
23788 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23789 !! end
23790
23791 !! test
23792 Anchor starting with underscore
23793 !! options
23794 title=[[Foo]]
23795 !! wikitext
23796 [[#_ref|One]]
23797 !! html/php
23798 <p><a href="#_ref">One</a>
23799 </p>
23800 !! html/parsoid
23801 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23802 !! end
23803
23804 !! test
23805 Id starting with underscore
23806 !! wikitext
23807 <div id="_ref"></div>
23808 !! html/*
23809 <div id="_ref"></div>
23810
23811 !! end
23812
23813 !! test
23814 Edit comment with link with more than one pipe (T99346)
23815 !! options
23816 comment
23817 !! wikitext
23818 [[Main Page|Many|pipes]]
23819 !! html/php
23820 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23821 !! end
23822
23823 !! test
23824 Complex edit comment with link with more than one pipe (T99346)
23825 !! options
23826 comment
23827 !! wikitext
23828 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23829 !! html/php
23830 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;
23831 !! end
23832
23833 !! test
23834 Space normalisation on autocomment (T24784)
23835 !! options
23836 comment
23837 title=[[Main Page]]
23838 !! wikitext
23839 /* __hello__world__ */
23840 !! html/php
23841 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23842 !! end
23843
23844 !! test
23845 percent-encoding and + signs in comments (T28410)
23846 !! options
23847 comment
23848 !! wikitext
23849 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23850 !! html/php
23851 <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>
23852 !! end
23853
23854 # Parsoid doesn't support this yet: see T75581
23855 # but it *should* omit the 'src' attribute if the image is bad.
23856 # PHP side of tests was disabled in
23857 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23858 # because of issues in the PHP parserTests infrastructure
23859 # (but the output below is indeed what the PHP side emits)
23860 !! test
23861 Bad images - basic functionality
23862 !! wikitext
23863 [[File:Bad.jpg]]
23864 !! html/php+disabled
23865 !! html/parsoid
23866 <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>
23867 !! end
23868
23869 !! test
23870 Bad images - T18039: text after bad image disappears
23871 !! wikitext
23872 Foo bar
23873 [[File:Bad.jpg]]
23874 Bar foo
23875 !! html/php+disabled
23876 <p>Foo bar
23877 </p><p>Bar foo
23878 </p>
23879 !! html/parsoid
23880 <p>Foo bar
23881 <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>
23882 Bar foo</p>
23883 !! end
23884
23885 !! test
23886 Verify that displaytitle works (T24501) no displaytitle
23887 !! options
23888 showtitle
23889 !! config
23890 wgAllowDisplayTitle=true
23891 wgRestrictDisplayTitle=false
23892 !! wikitext
23893 this is not the the title
23894 !! html/php
23895 Parser test
23896 <p>this is not the the title
23897 </p>
23898 !! end
23899
23900 !! test
23901 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23902 !! options
23903 showtitle
23904 title=[[Screen]]
23905 !! config
23906 wgAllowDisplayTitle=true
23907 wgRestrictDisplayTitle=false
23908 !! wikitext
23909 this is not the the title
23910 {{DISPLAYTITLE:whatever}}
23911 !! html/php
23912 whatever
23913 <p>this is not the the title
23914 </p>
23915 !! end
23916
23917 !! test
23918 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23919 !! options
23920 showtitle
23921 title=[[Screen]]
23922 !! config
23923 wgAllowDisplayTitle=true
23924 wgRestrictDisplayTitle=true
23925 !! wikitext
23926 this is not the the title
23927 {{DISPLAYTITLE:whatever}}
23928 !! html/php
23929 Screen
23930 <p>this is not the the title
23931 </p>
23932 !! end
23933
23934 !! test
23935 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23936 !! options
23937 showtitle
23938 title=[[Screen]]
23939 !! config
23940 wgAllowDisplayTitle=true
23941 wgRestrictDisplayTitle=true
23942 !! wikitext
23943 this is not the the title
23944 {{DISPLAYTITLE:screen}}
23945 !! html/php
23946 screen
23947 <p>this is not the the title
23948 </p>
23949 !! end
23950
23951 !! test
23952 Verify that displaytitle works (T24501) AllowDisplayTitle=false
23953 !! options
23954 showtitle
23955 title=[[Screen]]
23956 !! config
23957 wgAllowDisplayTitle=false
23958 !! wikitext
23959 this is not the the title
23960 {{DISPLAYTITLE:screen}}
23961 !! html/php
23962 Screen
23963 <p>this is not the the title
23964 <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>
23965 </p>
23966 !! end
23967
23968 !! test
23969 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
23970 !! options
23971 showtitle
23972 title=[[Screen]]
23973 !! config
23974 wgAllowDisplayTitle=false
23975 !! wikitext
23976 this is not the the title
23977 !! html/php
23978 Screen
23979 <p>this is not the the title
23980 </p>
23981 !! end
23982
23983 !! test
23984 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
23985 !! options
23986 showtitle
23987 title=[[Screen]]
23988 !! config
23989 wgAllowDisplayTitle=true
23990 wgRestrictDisplayTitle=true
23991 !! wikitext
23992 this is not the the title
23993 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
23994 !! html/php
23995 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
23996 <p>this is not the the title
23997 </p>
23998 !! end
23999
24000 !! test
24001 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
24002 !! options
24003 showtitle
24004 title=[[Screen]]
24005 !! config
24006 wgAllowDisplayTitle=true
24007 wgRestrictDisplayTitle=true
24008 !! wikitext
24009 this is not the the title
24010 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
24011 !! html/php
24012 <span style="color: red;">s</span>creen
24013 <p>this is not the the title
24014 </p>
24015 !! end
24016
24017 !! test
24018 Page status indicators: Empty name is invalid
24019 !! options
24020 showindicators
24021 !! wikitext
24022 <indicator name=" "></indicator>
24023 <indicator></indicator>
24024 !! html/php
24025 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24026 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24027 </p>
24028 !! end
24029
24030 !! test
24031 Page status indicators: Weird syntaxes that are okay
24032 !! options
24033 showindicators
24034 !! wikitext
24035 <indicator name="empty" />
24036 <indicator name="name"></indicator>
24037 !! html/php
24038 empty=
24039 name=
24040 <p><br />
24041 </p>
24042 !! end
24043
24044 !! test
24045 Page status indicators: Torture test
24046 !! options
24047 showindicators
24048 !! wikitext
24049 <indicator name="01">hello world</indicator>
24050 <indicator name="02">[[Main Page]]</indicator>
24051 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
24052 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
24053 <indicator name="05">*foo
24054 *bar</indicator>
24055 <indicator name="06"><nowiki>foo</nowiki></indicator>
24056 <indicator name="07"> Preformatted</indicator>
24057 <indicator name="08"><div>Broken tag</indicator>
24058 <indicator name="09">{| class=wikitable
24059 |cell
24060 |}</indicator>
24061 <indicator name="10">Two
24062
24063 paragraphs</indicator>
24064 !! html/php
24065 01=hello world
24066 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
24067 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" />
24068 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>
24069 05=<ul><li>foo</li>
24070 <li>bar</li></ul>
24071
24072 06=foo
24073 07=<pre>Preformatted
24074 </pre>
24075 08=<div>Broken tag</div>
24076
24077 09=<table class="wikitable">
24078 <tr>
24079 <td>cell
24080 </td></tr></table>
24081
24082 10=<p>Two
24083 </p><p>paragraphs
24084 </p>
24085 <p><br />
24086 </p><p><br />
24087 </p><p><br />
24088 </p><p><br />
24089 </p><p><br />
24090 </p>
24091 !! end
24092
24093 !! test
24094 preload: check <noinclude> and <includeonly>
24095 !! options
24096 preload
24097 !! wikitext
24098 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
24099 !! html/php
24100 Hello kind world.
24101 !! end
24102
24103 !! test
24104 preload: check <onlyinclude>
24105 !! options
24106 preload
24107 !! wikitext
24108 Goodbye <onlyinclude>Hello world</onlyinclude>
24109 !! html/php
24110 Hello world
24111 !! end
24112
24113 !! test
24114 preload: can pass tags through if we want to
24115 !! options
24116 preload
24117 !! wikitext
24118 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
24119 !! html/php
24120 <includeonly>Hello world</includeonly>
24121 !! end
24122
24123 !! test
24124 preload: check that it doesn't try to do tricks
24125 !! options
24126 preload
24127 !! wikitext
24128 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24129 !! html/php
24130 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24131 !! end
24132
24133 !! test
24134 Play a bit with r67090 and T5158
24135 !! wikitext
24136 <div style="width:50% !important">&nbsp;</div>
24137 <div style="width:50%&nbsp;!important">&nbsp;</div>
24138 <div style="width:50%&#160;!important">&nbsp;</div>
24139 <div style="border : solid;">&nbsp;</div>
24140 !! html/php
24141 <div style="width:50%&#32;!important">&#160;</div>
24142 <div style="width:50% !important">&#160;</div>
24143 <div style="width:50% !important">&#160;</div>
24144 <div style="border&#32;: solid;">&#160;</div>
24145
24146 !! html/parsoid
24147 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24148 <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>
24149 <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>
24150 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24151
24152 !! end
24153
24154 !! test
24155 T5158: Test for French spaces in attributes
24156 !! wikitext
24157 <br style=" clear : both ; " />
24158 !! html/php
24159 <p><br style="clear&#32;: both&#32;;" />
24160 </p>
24161 !! end
24162
24163 !! test
24164 HTML5 data attributes
24165 !! wikitext
24166 <span data-foo="bar">Baz</span>
24167 <p data-abc-def_hij="">Quuz</p>
24168 !! html/php
24169 <p><span data-foo="bar">Baz</span>
24170 </p>
24171 <p data-abc-def_hij="">Quuz</p>
24172
24173 !! html/parsoid
24174 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
24175 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
24176 !! end
24177
24178 !! test
24179 Strip reserved data attributes
24180 !! wikitext
24181 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
24182 !! html/php
24183 <div data-ok="fred">d</div>
24184
24185 !! html/parsoid
24186 <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>
24187 !! end
24188
24189 !! test
24190 percent-encoding and + signs in internal links (T28410)
24191 !! wikitext
24192 [[User:+%]] [[Page+title%]]
24193 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
24194 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
24195 [[%33%45]] [[%33%45+]]
24196 !! html/php
24197 <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>
24198 <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>
24199 <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>
24200 <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>
24201 </p>
24202 !! html/parsoid
24203 <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>
24204 <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>
24205 <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>
24206 <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>
24207 !! end
24208
24209 !! test
24210 Special characters in embedded file links (T29679)
24211 !! wikitext
24212 [[File:Contains & ampersand.jpg]]
24213 [[File:Does not exist.jpg|Title with & ampersand]]
24214 !! html/php
24215 <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>
24216 <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>
24217 </p>
24218 !! html/parsoid
24219 <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>
24220 <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>
24221 !! end
24222
24223 !! test
24224 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
24225 !! wikitext
24226 Text&apos;s been normalized?
24227 !! html
24228 <p>Text&#39;s been normalized?
24229 </p>
24230 !! end
24231
24232 !! test
24233 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
24234 !! wikitext
24235 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
24236 !! html
24237 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
24238 </p>
24239 !! end
24240
24241 !! test
24242 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
24243 !! wikitext
24244 [http://www.example.org/ ideograms]
24245 !! html
24246 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
24247 </p>
24248 !! end
24249
24250 !! test
24251 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
24252 !! wikitext
24253 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
24254 !! html
24255 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
24256 </p>
24257 !! end
24258
24259 !! article
24260 Mediawiki:loop1
24261 !! text
24262 {{Identical|A}}
24263 !! endarticle
24264
24265 !! article
24266 Mediawiki:loop2
24267 !! text
24268 {{Identical|B}}
24269 !! endarticle
24270
24271 !! article
24272 Template:Identical
24273 !! text
24274 {{int:loop1}}
24275 {{int:loop2}}
24276 !! endarticle
24277
24278 !! test
24279 T33098 Template which includes system messages which includes the template
24280 !! wikitext
24281 {{Identical}}
24282 !! html
24283 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24284 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24285 </p>
24286 !! end
24287
24288 !! test
24289 T33490 Turkish: ucfirst 'blah'
24290 !! options
24291 language=tr
24292 !! wikitext
24293 {{ucfirst:blah}}
24294 !! html
24295 <p>Blah
24296 </p>
24297 !! end
24298
24299 !! test
24300 T33490 Turkish: ucfirst 'ix'
24301 !! options
24302 language=tr
24303 !! wikitext
24304 {{ucfirst:ix}}
24305 !! html
24306 <p>İx
24307 </p>
24308 !! end
24309
24310 !! test
24311 T33490 Turkish: lcfirst 'BLAH'
24312 !! options
24313 language=tr
24314 !! wikitext
24315 {{lcfirst:BLAH}}
24316 !! html
24317 <p>bLAH
24318 </p>
24319 !! end
24320
24321 !! test
24322 T33490 Turkish: ucfırst (with a dotless i)
24323 !! options
24324 language=tr
24325 !! wikitext
24326 {{ucfırst:blah}}
24327 !! html
24328 <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>
24329 </p>
24330 !! end
24331
24332 !! test
24333 T33490 ucfırst (with a dotless i) with English language
24334 !! options
24335 language=en
24336 !! wikitext
24337 {{ucfırst:blah}}
24338 !! html
24339 <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>
24340 </p>
24341 !! end
24342
24343 # Note that Parsoid doesn't emit an explicit TOC.
24344 # Note also that the html2wt direction tends to emit an extra newline
24345 # between the __TOC__ magicword and the first heading unless *both*
24346 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24347 # it's "{}").
24348
24349 !! test
24350 T28375: TOC with italics
24351 !! options
24352 title=[[Main Page]]
24353 !! wikitext
24354 __TOC__
24355 ==''Lost'' episodes==
24356 !! html/php
24357 <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>
24358 <ul>
24359 <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>
24360 </ul>
24361 </div>
24362
24363 <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>
24364
24365 !! html/parsoid
24366 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24367 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24368 !! end
24369
24370 !! test
24371 T28375: TOC with bold
24372 !! options
24373 title=[[Main Page]]
24374 !! wikitext
24375 __TOC__
24376 =='''should be bold''' then normal text==
24377 !! html/php
24378 <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>
24379 <ul>
24380 <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>
24381 </ul>
24382 </div>
24383
24384 <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>
24385
24386 !! html/parsoid
24387 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24388 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24389 !! end
24390
24391 !! test
24392 T35845: Headings become cursive in TOC when they contain an image
24393 !! options
24394 title=[[Main Page]]
24395 !! wikitext
24396 __TOC__
24397 ==Image [[Image:foobar.jpg]]==
24398 !! html/php
24399 <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>
24400 <ul>
24401 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24402 </ul>
24403 </div>
24404
24405 <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>
24406
24407 !! html/parsoid
24408 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24409 <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>
24410 !! end
24411
24412 !! test
24413 T35845 (2): Headings become bold in TOC when they contain a blockquote
24414 !! options
24415 title=[[Main Page]]
24416 !! wikitext
24417 __TOC__
24418 ==<blockquote>Quote</blockquote>==
24419 !! html/php
24420 <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>
24421 <ul>
24422 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24423 </ul>
24424 </div>
24425
24426 <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>
24427
24428 !! html/php+tidy
24429 <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>
24430 <ul>
24431 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24432 </ul>
24433 </div>
24434
24435 <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>
24436 !! html/parsoid
24437 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24438 <h2 id="Quote" data-parsoid='{}'><blockquote>Quote</blockquote></h2>
24439 !! end
24440
24441 !! test
24442 Unclosed tags in TOC
24443 !! config
24444 wgFragmentMode=[ 'html5', 'legacy' ]
24445 !! options
24446 title=[[Main Page]]
24447 !! wikitext
24448 __TOC__
24449 ==Proof: 2 < 3==
24450 <small>Hanc marginis exiguitas non caperet.</small>
24451 QED
24452 !! html/php
24453 <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>
24454 <ul>
24455 <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>
24456 </ul>
24457 </div>
24458
24459 <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>
24460 <p><small>Hanc marginis exiguitas non caperet.</small>
24461 QED
24462 </p>
24463 !! html/parsoid
24464 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24465 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24466 <p><small>Hanc marginis exiguitas non caperet.</small>
24467 QED</p>
24468 !! end
24469
24470 !! test
24471 Multiple tags in TOC
24472 !! wikitext
24473 __TOC__
24474 ==<i>Foo</i> <b>Bar</b>==
24475
24476 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24477 !! html/php
24478 <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>
24479 <ul>
24480 <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>
24481 <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>
24482 </ul>
24483 </div>
24484
24485 <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>
24486 <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>
24487
24488 !! html/php+tidy
24489 <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>
24490 <ul>
24491 <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>
24492 <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>
24493 </ul>
24494 </div>
24495
24496 <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>
24497 <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>
24498 !! html/parsoid
24499 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24500 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
24501
24502 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote></h2>
24503 !! end
24504
24505 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24506 # html5 tag parsing.
24507 !! test
24508 Tags with parameters in TOC
24509 !! options
24510 parsoid=wt2html
24511 !! wikitext
24512 __TOC__
24513 ==<sup class="in-h2">Hello</sup>==
24514
24515 ==<sup class="a > b">Evilbye</sup>==
24516 !! html/php
24517 <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>
24518 <ul>
24519 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24520 <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>
24521 </ul>
24522 </div>
24523
24524 <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>
24525 <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>
24526
24527 !! html/parsoid
24528 <meta property="mw:PageProp/toc" />
24529 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
24530
24531 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
24532 !! end
24533
24534 !! test
24535 span tags with directionality in TOC
24536 !! wikitext
24537 __TOC__
24538 ==<span dir="ltr">C++</span>==
24539
24540 ==<span dir="rtl">זבנג!</span>==
24541
24542 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
24543
24544 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
24545
24546 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
24547 !! html/php
24548 <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>
24549 <ul>
24550 <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>
24551 <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>
24552 <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>
24553 <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>
24554 <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>
24555 </ul>
24556 </div>
24557
24558 <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>
24559 <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>
24560 <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>
24561 <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>
24562 <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>
24563
24564 !! html/parsoid
24565 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24566 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
24567 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
24568 <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>
24569 <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>
24570 <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>
24571 !! end
24572
24573 !! test
24574 T74884: bdi element in ToC
24575 !! wikitext
24576 __TOC__
24577 ==<bdi>test</bdi>==
24578 !! html/php
24579 <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>
24580 <ul>
24581 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24582 </ul>
24583 </div>
24584
24585 <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>
24586
24587 !! html/parsoid
24588 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24589 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
24590 !! end
24591
24592 !! test
24593 T35715: s/strike element in ToC
24594 !! wikitext
24595 __TOC__
24596 ==<s>test</s> test <strike>test</strike>==
24597 !! html/php
24598 <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>
24599 <ul>
24600 <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>
24601 </ul>
24602 </div>
24603
24604 <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>
24605
24606 !! html/parsoid
24607 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24608 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
24609 !! end
24610
24611 !! test
24612 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24613 !! wikitext
24614 __TOC__
24615 ==x==
24616 !! html/php
24617 <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>
24618 <ul>
24619 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24620 </ul>
24621 </div>
24622
24623 <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>
24624
24625 !! html/parsoid
24626 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24627 <h2 id="x" data-parsoid='{}'>x</h2>
24628 !! end
24629
24630 !! article
24631 MediaWiki:T34057
24632 !! text
24633 == {{int:headline_sample}} ==
24634 !! endarticle
24635
24636 !! test
24637 T34057: Title needed when expanding <h> nodes.
24638 !! options
24639 title=[[Main Page]]
24640 !! wikitext
24641 {{int:T34057}}
24642 !! html
24643 <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>
24644
24645 !! end
24646
24647 !! test
24648 Strip marker in urlencode
24649 !! wikitext
24650 {{urlencode:x<nowiki/>y}}
24651 {{urlencode:x<nowiki/>y|wiki}}
24652 {{urlencode:x<nowiki/>y|path}}
24653 {{urlencode:x<pre id="one">two</pre>y}}
24654 !! html/php
24655 <p>xy
24656 xy
24657 xy
24658 xy
24659 </p>
24660 !! end
24661
24662 !! test
24663 Strip marker in lc
24664 !! wikitext
24665 {{lc:x<nowiki/>y}}
24666 !! html
24667 <p>xy
24668 </p>
24669 !! end
24670
24671 !! test
24672 Strip marker in uc
24673 !! wikitext
24674 {{uc:x<nowiki/>y}}
24675 !! html
24676 <p>XY
24677 </p>
24678 !! end
24679
24680 !! test
24681 Strip marker in formatNum
24682 !! wikitext
24683 {{formatnum:1<nowiki/>2}}
24684 {{formatnum:1<nowiki/>2|R}}
24685 !! html
24686 <p>12
24687 12
24688 </p>
24689 !! end
24690
24691 !! test
24692 Check noCommafy in formatNum
24693 !! options
24694 language=be-tarask
24695 !! wikitext
24696 {{formatnum:123456.78}}
24697 {{formatnum:123456.78|NOSEP}}
24698 !! html
24699 <p>123 456,78
24700 123456.78
24701 </p>
24702 !! end
24703
24704 !! test
24705 Wrong option for formatNum (T58199)
24706 !! wikitext
24707 {{formatnum:1,234.56|Random}}
24708 {{formatnum:1,234.56|EVERYTHING}}
24709 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24710 !! html
24711 <p>1,234.56
24712 1,234.56
24713 1,234.56
24714 </p>
24715 !! end
24716
24717 !! test
24718 Strip marker in grammar
24719 !! options
24720 language=fi
24721 !! wikitext
24722 {{grammar:elative|foo<nowiki/>bar}}
24723 !! html
24724 <p>foobarista
24725 </p>
24726 !! end
24727
24728 !! test
24729 Strip marker in padleft
24730 !! wikitext
24731 {{padleft:|2|x<nowiki/>y}}
24732 !! html
24733 <p>xy
24734 </p>
24735 !! end
24736
24737 !! test
24738 Strip marker in padright
24739 !! wikitext
24740 {{padright:|2|x<nowiki/>y}}
24741 !! html
24742 <p>xy
24743 </p>
24744 !! end
24745
24746 !! test
24747 Strip marker in anchorencode
24748 !! wikitext
24749 {{anchorencode:x<nowiki/>y}}
24750 !! html/php
24751 <p>xy
24752 </p>
24753 !! html/parsoid
24754 <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>
24755 !! end
24756
24757 !! test
24758 nowiki inside link inside heading (T20295)
24759 !! wikitext
24760 ==[[foo|x<nowiki>y</nowiki>z]]==
24761 !! html
24762 <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>
24763
24764 !! end
24765
24766 !! test
24767 new support for bdi element (T33817)
24768 !! wikitext
24769 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24770 !! html
24771 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24772
24773 !!end
24774
24775 !! test
24776 Ignore pipe between table row attributes
24777 !! wikitext
24778 {|
24779 |quux
24780 |- id=foo | style='color: red'
24781 |bar
24782 |}
24783 !! html
24784 <table>
24785 <tr>
24786 <td>quux
24787 </td></tr>
24788 <tr id="foo" style="color: red">
24789 <td>bar
24790 </td></tr></table>
24791
24792 !! end
24793
24794 !!test
24795 Language parser function
24796 !! wikitext
24797 {{#language:ar}}
24798 !! html
24799 <p>العربية
24800 </p>
24801 !! end
24802
24803 !!test
24804 Padleft and padright (default 0-padding)
24805 !! wikitext
24806 {{padleft:xyz|5}}
24807 {{padright:xyz|5}}
24808 !! html/php
24809 <p>00xyz
24810 xyz00
24811 </p>
24812 !! html/parsoid
24813 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
24814 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
24815 !! end
24816
24817 !!test
24818 Padleft and padright (partial fill)
24819 !! wikitext
24820 {{padleft:xyz|6|ab}}
24821 {{padright:xyz|6|ab}}
24822 !! html/php
24823 <p>abaxyz
24824 xyzaba
24825 </p>
24826 !! html/parsoid
24827 <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>
24828 <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>
24829 !! end
24830
24831 !!test
24832 Padleft and padright as substr
24833 !! wikitext
24834 {{padleft:|3|abcde}}
24835 {{padright:|3|abcde}}
24836 !! html/php
24837 <p>abc
24838 abc
24839 </p>
24840 !! html/parsoid
24841 <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>
24842 <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>
24843 !! end
24844
24845 !! test
24846 Padleft and padright with non-numerical length (T180403)
24847 !! wikitext
24848 {{padleft:abcdef|junk}}
24849 {{padright:abcdef|junk}}
24850 !! html/php
24851 <p>abcdef
24852 abcdef
24853 </p>
24854 !! end
24855
24856 !!test
24857 Special parser function
24858 !! wikitext
24859 {{#special:RandomPage}}
24860 {{#special:BaDtItLe}}
24861 {{#special:Foobar}}
24862 !! html
24863 <p>Special:Random
24864 Special:Badtitle
24865 Special:Foobar
24866 </p>
24867 !! end
24868
24869 !!test
24870 T36939 - Case insensitive link parsing ([HttP://])
24871 !! wikitext
24872 [HttP://MediaWiki.Org/]
24873 !! html/php
24874 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24875 </p>
24876 !! html/parsoid
24877 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
24878 !! end
24879
24880 !!test
24881 T36939 - Case insensitive link parsing ([HttP:// title])
24882 !! wikitext
24883 [HttP://MediaWiki.Org/ MediaWiki]
24884 !! html
24885 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24886 </p>
24887 !! end
24888
24889 !!test
24890 T36939 - Case insensitive link parsing (HttP://)
24891 !! wikitext
24892 HttP://MediaWiki.Org/
24893 !! html/php
24894 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24895 </p>
24896 !! html/parsoid
24897 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24898 !! end
24899
24900 !!test
24901 Disable TOC
24902 !! options
24903 notoc
24904 !! wikitext
24905 Lead
24906 ==Section 1==
24907 ==Section 2==
24908 ==Section 3==
24909 ==Section 4==
24910 ==Section 5==
24911 !! html
24912 <p>Lead
24913 </p>
24914
24915 <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>
24916 <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>
24917 <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>
24918 <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>
24919 <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>
24920
24921 !! end
24922
24923
24924 ###
24925 ### Parsoid-specific tests
24926 ### Parsoid-PHP parser incompatibilities
24927 ###
24928 !!test
24929 1. SOL-sensitive wikitext tokens as template-args
24930 !!options
24931 parsoid=wt2html,wt2wt
24932 !! wikitext
24933 {{echo|*a}}
24934 {{echo|#a}}
24935 {{echo|:a}}
24936 !! html
24937 <span about="#mwt1" typeof="mw:Transclusion">
24938 </span><ul about="#mwt1"><li>a</li>
24939 </ul>
24940 <span about="#mwt2" typeof="mw:Transclusion">
24941 </span><ol about="#mwt2"><li>a</li>
24942 </ol>
24943 <span about="#mwt3" typeof="mw:Transclusion">
24944 </span><dl about="#mwt3"><dd>a</dd>
24945 </dl>
24946 !!end
24947
24948 #### -----------------------------------------------------------------
24949 #### Parsoid-specific functionality tests
24950 #### -----------------------------------------------------------------
24951
24952 # T65642/T68749: Formatting elt fixup around images is cleaned up.
24953 # We know wt2wt will fail, but we expect selser to pass.
24954 # Due to the nature of our testing, wt2wt and selser tests will enter the
24955 # blacklist and we'll catch selser regressions based on changes to the
24956 # blacklist entries for selser tests.
24957 !! test
24958 1. Bad treebuilder fixup of formatting elt is cleaned up
24959 !! options
24960 parsoid=wt2html,wt2wt
24961 !! wikitext
24962 {|
24963 |
24964 <small>
24965 [[Image:Foobar.jpg|right|Test]]
24966 </small>
24967 |}
24968 !! html/parsoid
24969 <table>
24970 <tbody><tr><td>
24971 <small>
24972 <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>
24973 </small>
24974 </td></tr>
24975 </tbody></table>
24976 !! end
24977
24978 !! test
24979 2. Bad treebuilder fixup of formatting elt is cleaned up
24980 !! options
24981 parsoid=wt2html,wt2wt
24982 !! wikitext
24983 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
24984
24985 <small>[[Image:Foobar.jpg|right|300px]]</small>
24986 !! html/parsoid
24987
24988 <p><b>foo</b></p>
24989 <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>
24990 <p><b>bar</b></p>
24991 <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>
24992 !! end
24993
24994 !! test
24995 3. Bad treebuilder fixup of formatting elt is cleaned up
24996 !! options
24997 parsoid=wt2html,wt2wt
24998 !! wikitext
24999 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
25000 !! html/parsoid
25001 <p><small><b>foo</b></small></p>
25002 <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>
25003 <p><small><b>bar</b></small></p>
25004 !! end
25005
25006 !! test
25007 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
25008 !! options
25009 parsoid=wt2html,wt2wt
25010 !! wikitext
25011 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
25012 !! html/parsoid
25013 <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>
25014 !! end
25015
25016 #### ----------------------------------------------------------------
25017 #### Parsoid-only testing of Parsoid's impl of LST
25018 #### Not implemented yet, see
25019 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
25020 #### ----------------------------------------------------------------
25021
25022 ## We still need to support serializing the older format while content is stored.
25023 !! test
25024 LST Sections: Backwards compatibility
25025 !! options
25026 parsoid={
25027 "suppressErrors": true,
25028 "modes": ["html2wt"]
25029 }
25030 !! wikitext
25031 <section begin="2011-05-16" />
25032 <section end="2014-04-10 (MW 1.23wmf22)" />
25033 !! html/parsoid
25034 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
25035 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
25036 !! end
25037
25038 !! test
25039 LST Sections: Newfangled approach
25040 !! wikitext
25041 <section begin="2011-05-16" />
25042 <section end="2014-04-10 (MW 1.23wmf22)" />
25043 !! html/parsoid
25044 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
25045 </span>
25046 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
25047 </span></p>
25048 !! end
25049
25050 #--------- Test stripping of empty nodes in template content ----------
25051
25052 !! test
25053 Empty LI and TR nodes should be stripped from template content
25054 !! wikitext
25055 {{EmptyLITest}}
25056 {{EmptyTRTest}}
25057 !! html/parsoid
25058 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
25059 <li>a</li>
25060 <li>b</li>
25061 </ul>
25062 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
25063 <tbody>
25064 <tr>
25065 <td>foo</td>
25066 </tr>
25067 <tr>
25068 <td>bar</td>
25069 </tr>
25070 </tbody>
25071 </table>
25072 !! end
25073
25074 !! test
25075 Empty LI and TR nodes should not be stripped from top-level content
25076 !! wikitext
25077 *a
25078 *
25079 *b
25080
25081 {|
25082 |-
25083 |-
25084 |foo
25085 |}
25086 !! html/parsoid
25087 <ul>
25088 <li>a</li>
25089 <li class='mw-empty-elt'></li>
25090 <li>b</li>
25091 </ul>
25092 <table>
25093 <tbody>
25094 <tr class='mw-empty-elt'></tr>
25095 <tr>
25096 <td>foo</td>
25097 </tr>
25098 </tbody>
25099 </table>
25100 !! end
25101
25102 !! test
25103 Empty TR nodes should not be stripped if they have any attributes set
25104 !! wikitext
25105 {{EmptyTRWithHTMLAttrTest}}
25106 !! html/parsoid
25107 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
25108 <tr align='center'></tr>
25109 <tr><td>foo</td></tr>
25110 <tr align='center'></tr>
25111 <tr><td>bar</td></tr>
25112 </table>
25113 !! end
25114
25115 #### ----------------------------------------------------------------
25116 #### The following section of tests are primarily to test
25117 #### wikitext escaping capabilities of Parsoid. Given that
25118 #### escaping can be done any number of ways, the wikitext (input)
25119 #### is always adjusted to reflect how Parsoid adds nowiki
25120 #### escape tags.
25121 ####
25122 #### We are marking several tests as parsoid-only since the
25123 #### HTML in the result section is different from what the
25124 #### PHP parser generates for it.
25125 #### ----------------------------------------------------------------
25126
25127
25128 #### --------------- Headings ---------------
25129 #### 0. Unnested
25130 #### 1. Nested inside html <h1>=foo=</h1>
25131 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
25132 #### 3. Nested inside html with wikitext split by html tags
25133 #### 4. No escape needed
25134 #### 5. Empty headings <h1></h1>
25135 #### 6. Heading chars in SOL context
25136 #### ----------------------------------------
25137 !! test
25138 Headings: 0. Unnested
25139 !! options
25140 parsoid=html2wt
25141 !! html/parsoid
25142 <p>=foo=</p>
25143
25144 <p> =foo=
25145 <!--cmt-->
25146 =foo=</p>
25147
25148 <p>=foo<i>a</i>=</p>
25149 !! wikitext
25150 <nowiki>=foo=</nowiki>
25151
25152 <nowiki> </nowiki>=foo=
25153 <!--cmt-->
25154 <nowiki>=foo=</nowiki>
25155
25156 =foo''a''<nowiki>=</nowiki>
25157 !!end
25158
25159 # New headings and existing headings are handled differently
25160 !! test
25161 Headings: 1. Nested inside html
25162 !! options
25163 parsoid=html2wt
25164 !! html/parsoid
25165 <h1>=foo=</h1>
25166 <h2>=foo=</h2>
25167 <h3>=foo=</h3>
25168
25169 <h1 data-parsoid=''>=foo=</h1>
25170 <h2 data-parsoid=''>=foo=</h2>
25171 <h3 data-parsoid=''>=foo=</h3>
25172 <h4 data-parsoid=''>=foo=</h4>
25173 <h5 data-parsoid=''>=foo=</h5>
25174 <h6 data-parsoid=''>=foo=</h6>
25175 !! wikitext
25176 = =foo= =
25177
25178 == =foo= ==
25179
25180 === =foo= ===
25181
25182 =<nowiki>=foo=</nowiki>=
25183 ==<nowiki>=foo=</nowiki>==
25184 ===<nowiki>=foo=</nowiki>===
25185 ====<nowiki>=foo=</nowiki>====
25186 =====<nowiki>=foo=</nowiki>=====
25187 ======<nowiki>=foo=</nowiki>======
25188
25189 !!end
25190
25191 !! test
25192 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
25193 !! options
25194 parsoid=html2wt
25195 !! html/parsoid
25196 <h1>foo</h1>*bar
25197 <h1>foo</h1>=bar
25198 <h1>foo</h1>=bar=
25199 !! wikitext
25200 = foo =
25201 <nowiki>*</nowiki>bar
25202
25203 = foo =
25204 =bar
25205
25206 = foo =
25207 <nowiki>=bar=</nowiki>
25208 !!end
25209
25210 !! test
25211 Headings: 3. Nested inside html with wikitext split by html tags
25212 !! options
25213 parsoid=html2wt
25214 !! html/parsoid
25215 <h1>=<b>bold</b>foo=</h1>
25216 !! wikitext
25217 = ='''bold'''foo= =
25218 !!end
25219
25220 !! test
25221 Headings: 4a. No escaping needed (testing just h1 and h2)
25222 !! options
25223 parsoid=html2wt
25224 !! html/parsoid
25225 <h1>=foo</h1>
25226 <h1>foo=</h1>
25227 <h1> =foo= </h1>
25228 <h1>=foo= bar</h1>
25229 <h2>=foo</h2>
25230 <h2>foo=</h2>
25231 <h1>=</h1>
25232 <h1><i>=</i>foo=</h1>
25233 !! wikitext
25234 = =foo =
25235
25236 = foo= =
25237
25238 = =foo= =
25239
25240 = =foo= bar =
25241
25242 == =foo ==
25243
25244 == foo= ==
25245
25246 = = =
25247
25248 = ''=''foo= =
25249 !!end
25250
25251 !! test
25252 Headings: 4b. No escaping needed (inside p-tags)
25253 !! options
25254 parsoid=html2wt
25255 !! html/parsoid
25256 <p>=foo= x
25257 =foo= <s></s>
25258 </p>
25259 !! wikitext
25260 =foo= x
25261 =foo= <s></s>
25262 !! html/php
25263 <p>=foo= x
25264 =foo= <s></s>
25265 </p>
25266 !!end
25267
25268 !! test
25269 Headings: 4c. Short headings (1)
25270 !! options
25271 parsoid=html2wt
25272 !! html/parsoid
25273 <p>===
25274 </p>
25275 !! wikitext
25276 <nowiki>===</nowiki>
25277 !! html/php
25278 <p>===
25279 </p>
25280 !! end
25281
25282 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
25283 !! test
25284 Headings: 4d. Short headings (2)
25285 !! options
25286 parsoid=wt2html,html2html
25287 !! wikitext
25288 =
25289 ==
25290 ===
25291 ====
25292 =====
25293 !! html/php
25294 <p>=
25295 ==
25296 </p>
25297 <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>
25298 <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>
25299 <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>
25300
25301 !! html/parsoid
25302 <p>=
25303 ==</p>
25304 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
25305 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
25306 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
25307 !! end
25308
25309 !! test
25310 Headings: 5. Empty headings
25311 !! options
25312 parsoid=html2wt
25313 !! html/parsoid
25314 <h1 data-parsoid='{}'></h1>
25315
25316 <h2 data-parsoid='{}'></h2>
25317
25318 <h3 data-parsoid='{}'></h3>
25319
25320 <h4 data-parsoid='{}'></h4>
25321
25322 <h5 data-parsoid='{}'></h5>
25323
25324 <h6 data-parsoid='{}'></h6>
25325 !! wikitext
25326 =<nowiki/>=
25327
25328 ==<nowiki/>==
25329
25330 ===<nowiki/>===
25331
25332 ====<nowiki/>====
25333
25334 =====<nowiki/>=====
25335
25336 ======<nowiki/>======
25337 !!end
25338
25339 !! test
25340 Headings: 6a. Heading chars in SOL context (with trailing spaces)
25341 !! options
25342 parsoid=html2wt
25343 !! html/parsoid
25344 <p>=a=</p>
25345
25346 <p>=a=</p>
25347
25348 <p>=a=</p>
25349 !! wikitext
25350 <nowiki>=a=</nowiki>
25351
25352 <nowiki>=a=</nowiki>
25353
25354 <nowiki>=a=</nowiki>
25355 !!end
25356
25357 !! test
25358 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25359 !! options
25360 parsoid=html2wt
25361 !! html/parsoid
25362 <p>=a=
25363 b</p>
25364
25365 <p>=a=
25366 b</p>
25367
25368 <p>=a=
25369 b</p>
25370 !! wikitext
25371 <nowiki>=a=</nowiki>
25372 b
25373
25374 <nowiki>=a=</nowiki>
25375 b
25376
25377 <nowiki>=a=</nowiki>
25378 b
25379 !!end
25380
25381 !! test
25382 Headings: 6c. Heading chars in SOL context (leading newline break)
25383 !! options
25384 parsoid=html2wt
25385 !! html/parsoid
25386 <p>a
25387 =b=</p>
25388 !! wikitext
25389 a
25390 <nowiki>=b=</nowiki>
25391 !!end
25392
25393 !! test
25394 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25395 !! options
25396 parsoid=html2wt
25397 !! html/parsoid
25398 <!--c0--><p>=a=</p>
25399
25400 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25401 !! wikitext
25402 <!--c0--><nowiki>=a=</nowiki>
25403
25404 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25405 !!end
25406
25407 !! test
25408 Headings: 6d. Heading chars in SOL context (No escaping needed)
25409 !! options
25410 parsoid=html2wt
25411 !! html/parsoid
25412 =a=<div>b</div>
25413 !! wikitext
25414 =a=<div>b</div>
25415 !!end
25416
25417 !! test
25418 Headings: 7. Insert a newline between new content and headings
25419 !! options
25420 parsoid=html2wt
25421 !! html/parsoid
25422 <h2>NEW</h2>
25423 <p>new</p>
25424 <h2 data-parsoid='{}'>A</h2>
25425 <p data-parsoid='{}'>a</p>
25426 !! wikitext
25427 == NEW ==
25428 new
25429
25430 ==A==
25431 a
25432
25433 !! end
25434
25435 !! test
25436 Headings: Used as horizontal rule
25437 !! config
25438 wgFragmentMode=[ 'html5', 'legacy' ]
25439 !! options
25440 parsoid=wt2html
25441 !! wikitext
25442 ===============
25443 !! html/php
25444 <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>
25445
25446 !! html/parsoid
25447 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25448 !! end
25449
25450 #### --------------- Lists ---------------
25451 #### 0. Outside nests (*foo, etc.)
25452 #### 1. Nested inside html <ul><li>*foo</li></ul>
25453 #### 2. Inside definition lists
25454 #### 3. Only bullets at start should be escaped
25455 #### 4. No escapes needed
25456 #### 5. No unnecessary escapes
25457 #### 6. Escape bullets in SOL position
25458 #### 7. Escape bullets in a multi-line context
25459 #### ----------------------------------------
25460
25461 !! test
25462 Lists: 0. Outside nests
25463 !! options
25464 parsoid=html2wt
25465 !! html/parsoid
25466 <p>*foo</p>
25467
25468 <p>#foo</p>
25469
25470 <p>;Foo:bar</p>
25471 !! wikitext
25472 <nowiki>*</nowiki>foo
25473
25474 <nowiki>#</nowiki>foo
25475
25476 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25477 !!end
25478
25479 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25480 ## to test wikitext escaping, and insignificant whitespace diffs
25481 ## cause PHP parser tests to barf
25482 !! test
25483 Lists: 1. Nested inside html (No unnecessary escapes)
25484 !! options
25485 parsoid=html2wt
25486 !! html/parsoid
25487 <ul>
25488 <li>*foo</li>
25489 <li>#foo</li>
25490 <li>:foo</li>
25491 <li>;foo</li>
25492 <li data-parsoid='{}'>*foo</li>
25493 <li data-parsoid='{}'>#foo</li>
25494 <li data-parsoid='{}'>:foo</li>
25495 <li data-parsoid='{}'>;foo</li>
25496 </ul>
25497
25498 <ol>
25499 <li>*foo</li>
25500 <li>#foo</li>
25501 <li>:foo</li>
25502 <li>;foo</li>
25503 <li data-parsoid='{}'>*foo</li>
25504 <li data-parsoid='{}'>#foo</li>
25505 <li data-parsoid='{}'>:foo</li>
25506 <li data-parsoid='{}'>;foo</li>
25507 </ol>
25508 !! wikitext
25509 * *foo
25510 * #foo
25511 * :foo
25512 * ;foo
25513 *<nowiki>*foo</nowiki>
25514 *<nowiki>#foo</nowiki>
25515 *<nowiki>:foo</nowiki>
25516 *<nowiki>;foo</nowiki>
25517
25518 # *foo
25519 # #foo
25520 # :foo
25521 # ;foo
25522 #<nowiki>*foo</nowiki>
25523 #<nowiki>#foo</nowiki>
25524 #<nowiki>:foo</nowiki>
25525 #<nowiki>;foo</nowiki>
25526 !!end
25527
25528 !! test
25529 Lists: 2. Inside definition lists
25530 !! options
25531 parsoid=html2wt
25532 !! html/parsoid
25533 <dl><dt>;foo</dt></dl>
25534 <dl><dt>:foo</dt></dl>
25535 <dl><dt>:foo</dt>
25536 <dd>bar</dd></dl>
25537 <dl><dd>:foo</dd></dl>
25538 !! wikitext
25539 ; ;foo
25540
25541 ; <nowiki>:foo</nowiki>
25542
25543 ; <nowiki>:foo</nowiki>
25544 : bar
25545
25546 : :foo
25547 !!end
25548
25549 !! test
25550 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25551 !! options
25552 parsoid=html2wt
25553 !! html/parsoid
25554 <ul>
25555 <li>*foo*bar</li>
25556 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25557 </ul>
25558 !! wikitext
25559 * *foo*bar
25560 *<nowiki>*foo</nowiki>''it''*bar
25561 !!end
25562
25563 !! test
25564 Lists: 4. No escapes needed
25565 !! options
25566 parsoid=html2wt
25567 !! html/parsoid
25568 <ul>
25569 <li>foo*bar
25570 </li>
25571 </ul>
25572 <ul>
25573 <li><i>foo</i>*bar
25574 </li>
25575 </ul>
25576 <ul>
25577 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25578 </li>
25579 </ul>
25580 <ul>
25581 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25582 </li>
25583 </ul>
25584 !! wikitext
25585 *foo*bar
25586
25587 *''foo''*bar
25588
25589 *[[Foo]]: bar
25590
25591 *[[Foo]]*bar
25592 !!end
25593
25594 !! test
25595 Lists: 5. No unnecessary escapes
25596 !! options
25597 parsoid=html2wt
25598 !! html/parsoid
25599 <ul><li> bar <span>[[foo]]</span></li></ul>
25600 <ul><li> =bar <span>[[foo]]</span></li></ul>
25601 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25602 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25603 <ul><li> =bar <span>foo]]</span>=</li></ul>
25604 <ul><li> <s></s>: a</li></ul>
25605 <ul><li> <i>* foo</i></li></ul>
25606
25607 !! wikitext
25608 * bar <span><nowiki>[[foo]]</nowiki></span>
25609
25610 * =bar <span><nowiki>[[foo]]</nowiki></span>
25611
25612 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25613
25614 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25615
25616 * =bar <span>foo]]</span>=
25617
25618 * <s></s>: a
25619
25620 * ''* foo''
25621 !!end
25622
25623 !! test
25624 Lists: 6. Escape bullets in SOL position
25625 !! options
25626 parsoid=html2wt
25627 !! html/parsoid
25628 <p><!--cmt-->*foo</p>
25629 !! wikitext
25630 <!--cmt--><nowiki>*</nowiki>foo
25631 !!end
25632
25633 !! test
25634 Lists: 7. Escape bullets in a multi-line context
25635 !! options
25636 parsoid=html2wt
25637 !! html/parsoid
25638 <p>a
25639 *b
25640 </p>
25641 !! wikitext
25642 a
25643 <nowiki>*</nowiki>b
25644 !!end
25645
25646 !! test
25647 Lists: 8. Escape colons only if not present in tags
25648 !! options
25649 parsoid=html2wt
25650 !! html/parsoid
25651 <dl><dt>a:b<i>c:d</i></dt></dl>
25652 !! wikitext
25653 ; <nowiki>a:b</nowiki>''c:d''
25654 !! end
25655
25656 #### --------------- HRs ---------------
25657 #### 1. Single line
25658 #### -----------------------------------
25659
25660 !! test
25661 HRs: 1. Single line
25662 !! options
25663 parsoid=html2wt
25664 !! html/parsoid
25665 <hr />----
25666 <hr />=foo=
25667 <hr />*foo
25668 !! wikitext
25669 ----<nowiki>----</nowiki>
25670 ----=foo=
25671 ----*foo
25672 !! end
25673
25674 #### --------------- Tables ---------------
25675 #### 1a. Simple example
25676 #### 1b. No escaping needed (!foo)
25677 #### 1c. No escaping needed (|foo)
25678 #### 1d. No escaping needed (|}foo)
25679 ####
25680 #### 2a. Nested in td (<td>foo|bar</td>)
25681 #### 2b. Nested in td (<td>foo||bar</td>)
25682 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25683 ####
25684 #### 3a. Nested in th (<th>foo!bar</th>)
25685 #### 3b. Nested in th (<th>foo!!bar</th>)
25686 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25687 ####
25688 #### 4a. Escape -
25689 #### 4b. Escape +
25690 #### 4c. No escaping needed
25691 #### --------------------------------------
25692
25693 !! test
25694 Tables: 1a. Simple example
25695 !! options
25696 parsoid=html2wt
25697 !! html/parsoid
25698 <p>{|
25699 |}
25700 </p>
25701 !! wikitext
25702 <nowiki>{|</nowiki>
25703 |}
25704 !! end
25705
25706 !! test
25707 Tables: 1b. No escaping needed
25708 !! options
25709 parsoid=html2wt
25710 !! html/parsoid
25711 <p>!foo
25712 </p>
25713 !! wikitext
25714 !foo
25715 !! end
25716
25717 !! test
25718 Tables: 1c. No escaping needed
25719 !! options
25720 parsoid=html2wt
25721 !! html/parsoid
25722 <p>|foo
25723 </p>
25724 !! wikitext
25725 |foo
25726 !! end
25727
25728 !! test
25729 Tables: 1d. No escaping needed
25730 !! options
25731 parsoid=html2wt
25732 !! html/parsoid
25733 <p>|}foo
25734 </p>
25735 !! wikitext
25736 |}foo
25737 !! end
25738
25739 !! test
25740 Tables: 2a. Nested in td
25741 !! options
25742 parsoid=html2wt
25743 !! html/parsoid
25744 <table><tbody><tr>
25745 <td>foo|bar</td></tr>
25746 <tr><td>x<div>a|b</div></td>
25747 </tbody></table>
25748 !! wikitext
25749 {|
25750 |<nowiki>foo|bar</nowiki>
25751 |-
25752 |x<div><nowiki>a|b</nowiki></div>
25753 |}
25754 !! html/php+tidy
25755 <table>
25756 <tbody><tr>
25757 <td>foo|bar
25758 </td></tr>
25759 <tr>
25760 <td>x<div>a|b</div>
25761 </td></tr></tbody></table>
25762 !! end
25763
25764 !! test
25765 Tables: 2b. Nested in td
25766 !! options
25767 parsoid=html2wt
25768 !! html/parsoid
25769 <table><tbody><tr>
25770 <td>foo||bar</td>
25771 <td>a<i>b||c</i></td>
25772 <td>a<i><div>b||c</div></i></td>
25773 </tr></tbody></table>
25774 !! wikitext
25775 {|
25776 |<nowiki>foo||bar</nowiki>
25777 |a''<nowiki>b||c</nowiki>''
25778 |a''<div><nowiki>b||c</nowiki></div>''
25779 |}
25780 !! html/php
25781 <table>
25782 <tr>
25783 <td>foo||bar
25784 </td>
25785 <td>a<i>b||c</i>
25786 </td>
25787 <td>a<i><div>b||c</div></i>
25788 </td></tr></table>
25789
25790 !! end
25791
25792 !! test
25793 Tables: 2c. Nested in td -- no escaping needed
25794 !! options
25795 parsoid=html2wt
25796 !! html/*
25797 <table>
25798 <tr>
25799 <td>foo!!bar
25800 </td></tr></table>
25801
25802 !! wikitext
25803 {|
25804 |foo!!bar
25805 |}
25806 !! end
25807
25808 !! test
25809 Tables: 3a. Nested in th
25810 !! options
25811 parsoid=html2wt
25812 !! html/*
25813 <table>
25814 <tr>
25815 <th>foo!bar
25816 </th></tr></table>
25817
25818 !! wikitext
25819 {|
25820 !foo!bar
25821 |}
25822 !! end
25823
25824 !! test
25825 Tables: 3b. Nested in th
25826 !! options
25827 parsoid=html2wt
25828 !! html/parsoid
25829 <table><tbody>
25830 <tr><th>foo!!bar</th>
25831 <th><i>foo|bar</i></th>
25832 <th><i>foo!!bar</i></th>
25833 <th><i><span>foo!!bar</span></i></th>
25834 </tr></tbody></table>
25835 !! wikitext
25836 {|
25837 !<nowiki>foo!!bar</nowiki>
25838 !''<nowiki>foo|bar</nowiki>''
25839 !''<nowiki>foo!!bar</nowiki>''
25840 !''<span><nowiki>foo!!bar</nowiki></span>''
25841 |}
25842 !! html/php
25843 <table>
25844 <tr>
25845 <th>foo!!bar
25846 </th>
25847 <th><i>foo|bar</i>
25848 </th>
25849 <th><i>foo!!bar</i>
25850 </th>
25851 <th><i><span>foo!!bar</span></i>
25852 </th></tr></table>
25853
25854 !! end
25855
25856 !! test
25857 Tables: 3c. Nested in th
25858 !! options
25859 parsoid=html2wt
25860 !! html/parsoid
25861 <table><tbody>
25862 <tr><th>foo||bar</th>
25863 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25864 </tr></tbody></table>
25865 !! wikitext
25866 {|
25867 !<nowiki>foo||bar</nowiki>
25868 !<nowiki>foo||bar</nowiki>
25869 |}
25870 !! html/php
25871 <table>
25872 <tr>
25873 <th>foo||bar
25874 </th>
25875 <th>foo||bar
25876 </th></tr></table>
25877
25878 !! end
25879
25880 !! test
25881 Tables: 4a. Escape -
25882 !! options
25883 parsoid=html2wt
25884 !! html/*
25885 <table>
25886 <tr>
25887 <th>-bar
25888 </th></tr>
25889 <tr>
25890 <td>-bar
25891 </td></tr></table>
25892
25893 !! wikitext
25894 {|
25895 !-bar
25896 |-
25897 |<nowiki>-bar</nowiki>
25898 |}
25899 !! end
25900
25901 !! test
25902 Tables: 4b. Escape +
25903 !! options
25904 parsoid=html2wt
25905 !! html/*
25906 <table>
25907 <tr>
25908 <th>+bar
25909 </th></tr>
25910 <tr>
25911 <td>+bar
25912 </td></tr></table>
25913
25914 !! wikitext
25915 {|
25916 !+bar
25917 |-
25918 |<nowiki>+bar</nowiki>
25919 |}
25920 !! end
25921
25922 !! test
25923 Tables: 4c. No escaping needed
25924 !! options
25925 parsoid=html2wt
25926 !! html/parsoid
25927 <table><tbody>
25928 <tr><td>foo-bar</td><td>foo+bar</td></tr>
25929 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
25930 <tr><td>foo
25931 <p>bar|baz
25932 +bar
25933 -bar</p></td></tr>
25934 <tr><td>x
25935 <div>a|b</div></td>
25936 </tbody></table>
25937 !! wikitext
25938 {|
25939 |foo-bar
25940 |foo+bar
25941 |-
25942 |''foo''-bar
25943 |''foo''+bar
25944 |-
25945 |foo
25946 bar|baz
25947 +bar
25948 -bar
25949 |-
25950 |x
25951 <div>a|b</div>
25952 |}
25953 !! html/php
25954 <table>
25955 <tr>
25956 <td>foo-bar
25957 </td>
25958 <td>foo+bar
25959 </td></tr>
25960 <tr>
25961 <td><i>foo</i>-bar
25962 </td>
25963 <td><i>foo</i>+bar
25964 </td></tr>
25965 <tr>
25966 <td>foo
25967 <p>bar|baz
25968 +bar
25969 -bar
25970 </p>
25971 </td></tr>
25972 <tr>
25973 <td>x
25974 <div>a|b</div>
25975 </td></tr></table>
25976
25977 !! end
25978
25979 !! test
25980 Tables: 4d. No escaping needed
25981 !! options
25982 parsoid=html2wt
25983 !! html/parsoid
25984 <table>
25985 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
25986 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
25987 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
25988 </tbody></table>
25989 !! wikitext
25990 {|
25991 |[[Foo]]-bar
25992 ||+1
25993 ||-2
25994 |}
25995 !! html/php
25996 <table>
25997 <tr>
25998 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
25999 </td>
26000 <td>+1
26001 </td>
26002 <td>-2
26003 </td></tr></table>
26004
26005 !! end
26006
26007 !! test
26008 Tables: 5. Empty table cells should get whitespace to avoid need for nowikis
26009 !! options
26010 parsoid=html2wt
26011 !! html/parsoid
26012 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26013
26014 <table><tr><td></td><td align="center"></td><td></td></tr></table>
26015
26016 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26017
26018 <table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table>
26019 !! wikitext
26020 {|
26021 | || align="center" | ||
26022 |}
26023
26024 {|
26025 |
26026 | align="center" |
26027 |
26028 |}
26029
26030 {|
26031 | {{!}}{{!}} align="center" | ||
26032 |}
26033
26034 {|
26035 ! !! align="center" | !!
26036 |}
26037 !! html/php+tidy
26038 <table>
26039 <tbody><tr>
26040 <td></td>
26041 <td align="center"></td>
26042 <td>
26043 </td></tr></tbody></table>
26044 <table>
26045 <tbody><tr>
26046 <td>
26047 </td>
26048 <td align="center">
26049 </td>
26050 <td>
26051 </td></tr></tbody></table>
26052 <table>
26053 <tbody><tr>
26054 <td></td>
26055 <td align="center"></td>
26056 <td>
26057 </td></tr></tbody></table>
26058 <table>
26059 <tbody><tr>
26060 <th></th>
26061 <th align="center"></th>
26062 <th>
26063 </th></tr></tbody></table>
26064 !! end
26065
26066 !! test
26067 T97430: Don't emit empty nowiki pairs around marker meta tags
26068 !! options
26069 parsoid=html2wt
26070 !! html/parsoid
26071 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26072 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
26073 !! wikitext
26074 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26075 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
26076 !! end
26077
26078 !! test
26079 Unclosed xmlish element in table line shouldn't eat end delimiters
26080 !! options
26081 parsoid=html2wt
26082 !! html/parsoid
26083 <table>
26084 <tbody><tr><td> &lt;foo</td>
26085 <td> bar></td></tr>
26086 </tbody></table>
26087 !! wikitext
26088 {|
26089 | <foo
26090 | bar>
26091 |}
26092 !! html/php
26093 <table>
26094 <tr>
26095 <td>&lt;foo
26096 </td>
26097 <td>bar&gt;
26098 </td></tr></table>
26099
26100 !! end
26101
26102 #### --------------- Links ----------------
26103 #### 1. Quote marks in link text
26104 #### 2. Wikilinks: Escapes needed
26105 #### 3. Wikilinks: No escapes needed
26106 #### 4. Extlinks: Escapes needed
26107 #### 5. Extlinks: No escapes needed
26108 #### --------------------------------------
26109 !! test
26110 Links 1. WikiLinks: No escapes needed
26111 !! options
26112 parsoid=html2wt
26113 !! html/parsoid
26114 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
26115 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
26116 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
26117 !! wikitext
26118 [[Foo|Foo''boo'']]
26119 [[Foo|[Foobar]]]
26120 [[Foo|x [Foobar] x]]
26121 !! html/php
26122 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
26123 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
26124 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
26125 </p>
26126 !! end
26127
26128 !! test
26129 Links 2. WikiLinks: Escapes needed
26130 !! options
26131 parsoid=html2wt
26132 !! html/parsoid
26133 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
26134 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
26135 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
26136 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
26137 <a href="Foo" rel="mw:WikiLink">|Bar</a>
26138 <a href="Foo" rel="mw:WikiLink">]]bar</a>
26139 <a href="Foo" rel="mw:WikiLink">[[bar</a>
26140 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
26141 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
26142 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
26143 !! wikitext
26144 [[Foo|<nowiki>Foobar]</nowiki>]]
26145 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
26146 [[Foo|<nowiki>[[Bar]]</nowiki>]]
26147 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
26148 [[Foo|<nowiki>|Bar</nowiki>]]
26149 [[Foo|<nowiki>]]bar</nowiki>]]
26150 [[Foo|<nowiki>[[bar</nowiki>]]
26151 [[Foo|<nowiki>x [[ y</nowiki>]]
26152 [[Foo|<nowiki>x ]] y</nowiki>]]
26153 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
26154 !! html/php
26155 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
26156 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
26157 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
26158 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
26159 <a href="/wiki/Foo" title="Foo">|Bar</a>
26160 <a href="/wiki/Foo" title="Foo">]]bar</a>
26161 <a href="/wiki/Foo" title="Foo">[[bar</a>
26162 <a href="/wiki/Foo" title="Foo">x [[ y</a>
26163 <a href="/wiki/Foo" title="Foo">x ]] y</a>
26164 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
26165 </p>
26166 !! end
26167
26168 !! test
26169 Links 3. WikiLinks: No escapes needed
26170 !! options
26171 parsoid=html2wt
26172 !! html/parsoid
26173 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
26174 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
26175 !! wikitext
26176 [[Foo|[Foobar]]
26177 [[Foo|foo|bar]]
26178 !! html/php
26179 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
26180 <a href="/wiki/Foo" title="Foo">foo|bar</a>
26181 </p>
26182 !! end
26183
26184 !! test
26185 Links 4. ExtLinks: Escapes needed
26186 !! options
26187 parsoid=html2wt
26188 !! html/parsoid
26189 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
26190 <a rel="mw:ExtLink" href="http://google.com">google]</a>
26191 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
26192 <p>[http://google.com]</p>
26193 <p>[http://google.com google]</p>
26194 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
26195 <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>
26196 !! wikitext
26197 [http://google.com <nowiki>[google]</nowiki>]
26198 [http://google.com <nowiki>google]</nowiki>]
26199 [http://google.com <nowiki>goog] le</nowiki>]
26200
26201 <nowiki>[http://google.com]</nowiki>
26202
26203 <nowiki>[http://google.com google]</nowiki>
26204
26205 [http://google.com<nowiki>]</nowiki>
26206
26207 [{{echo|http://google.com}}<nowiki>]</nowiki>
26208 !! html/php
26209 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
26210 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
26211 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
26212 </p><p>[http://google.com]
26213 </p><p>[http://google.com google]
26214 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26215 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26216 </p>
26217 !! end
26218
26219 !! test
26220 Links 5. ExtLinks: No escapes needed
26221 !! options
26222 parsoid=html2wt
26223 !! html/parsoid
26224 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
26225 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
26226 !! wikitext
26227 [http://google.com [google]
26228
26229 [[http://google.com]]
26230 !! html/php
26231 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
26232 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
26233 </p>
26234 !! end
26235
26236 !! test
26237 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
26238 !! options
26239 parsoid=html2wt
26240 !! html/parsoid
26241 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
26242 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
26243 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
26244 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
26245 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
26246 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
26247 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
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>;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(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
26254 </p>
26255 !! wikitext
26256 x<nowiki/>http://example.com<nowiki/>y
26257 http://example.com<nowiki/>?x
26258 http://example.com<nowiki/>&x
26259 http://example.com<nowiki/>'x
26260 http://example.com<nowiki/>,x
26261 http://example.com<nowiki/>.x
26262 http://example.com<nowiki/>;x
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(x<nowiki/>)
26269 !! end
26270
26271 !! test
26272 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26273 !! options
26274 parsoid=html2wt
26275 !! html/parsoid
26276 <p>x
26277 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
26278 y
26279 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
26280 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
26281 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
26282 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
26283 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
26284 </p>
26285 !! wikitext
26286 x
26287 http://example.com
26288 y
26289 "http://example.com"
26290 (http://example.com)
26291 (http://example.com) foo
26292 http://example.com,
26293 http://example.com, foo
26294 !! html/php
26295 <p>x
26296 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
26297 y
26298 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
26299 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
26300 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
26301 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
26302 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
26303 </p>
26304 !! end
26305
26306 !! test
26307 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26308 !! options
26309 parsoid=html2wt
26310 !! html/parsoid
26311 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
26312 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
26313 !! wikitext
26314 http://example.com.,;:!?\
26315 -http://example.com:
26316 !! html/php
26317 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
26318 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
26319 </p>
26320 !! end
26321
26322 !! test
26323 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
26324 !! options
26325 parsoid=html2wt
26326 !! html/parsoid
26327 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
26328 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
26329 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
26330 !! wikitext
26331 RFC 123<nowiki/>4
26332 RFC 123<nowiki/>y
26333 X<nowiki/>RFC 123<nowiki/>y
26334 !! end
26335
26336 !! test
26337 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
26338 !! options
26339 parsoid=html2wt
26340 !! html/parsoid
26341 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
26342 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
26343 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
26344 </p>
26345 !! wikitext
26346 RFC 123?foo
26347 RFC 123&foo
26348 -RFC 123-
26349 !! html/php
26350 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
26351 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
26352 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
26353 </p>
26354 !! end
26355
26356 !! test
26357 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
26358 !! options
26359 parsoid=html2wt
26360 !! html/parsoid
26361 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
26362 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26363 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26364 !! wikitext
26365 PMID 123<nowiki/>4
26366 PMID 123<nowiki/>y
26367 X<nowiki/>PMID 123<nowiki/>y
26368 !! end
26369
26370 !! test
26371 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
26372 !! options
26373 parsoid=html2wt
26374 !! html/parsoid
26375 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
26376 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
26377 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
26378 </p>
26379 !! wikitext
26380 PMID 123?foo
26381 PMID 123&foo
26382 -PMID 123-
26383 !! html/php
26384 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
26385 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
26386 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
26387 </p>
26388 !! end
26389
26390 !! test
26391 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
26392 !! options
26393 parsoid=html2wt
26394 !! html/parsoid
26395 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
26396 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
26397 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
26398 </p>
26399 !! wikitext
26400 ISBN 1234567890<nowiki/>1
26401 ISBN 1234567890<nowiki/>x
26402 a<nowiki/>ISBN 1234567890<nowiki/>b
26403 !! end
26404
26405 !! test
26406 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
26407 !! options
26408 parsoid=html2wt
26409 !! html/parsoid
26410 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26411 !! wikitext
26412 -ISBN 1234567890's
26413 !! html/php
26414 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26415 </p>
26416 !! end
26417
26418 !! test
26419 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26420 !! options
26421 parsoid=html2wt
26422 !! html/*
26423 <p>this is not a link: http://example.com
26424 </p>
26425 !! wikitext
26426 this is not a link: <nowiki>http://example.com</nowiki>
26427 !! end
26428
26429 !! test
26430 Links 15. Link trails can't become link prefixes.
26431 !! options
26432 language=is
26433 parsoid=html2wt
26434 !! html/parsoid
26435 <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>
26436 !! wikitext
26437 [[Söfnuður]]-[[00]]
26438 !! html/php
26439 <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>
26440 </p>
26441 !! end
26442
26443 #### --------------- Quotes ---------------
26444 #### 1. Quotes inside <b> and <i>
26445 #### 2. Link fragments separated by <i> and <b> tags
26446 #### 3. Link fragments inside <i> and <b>
26447 #### 4. No escaping needed
26448 #### --------------------------------------
26449 !! test
26450 1a. Quotes inside <b> and <i>
26451 !! options
26452 parsoid=html2wt
26453 !! html/*
26454 <p><i>'foo'</i>
26455 <i>''foo''</i>
26456 <i>'''foo'''</i>
26457 <i>foo</i>'s
26458 <b>'foo'</b>
26459 <b>''foo''</b>
26460 <b>'''foo'''</b>
26461 <b>foo'<i>bar'</i>baz</b>
26462 <b>foo</b>'s
26463 '<i>foo</i>
26464 <i>foo</i>'
26465 <i>foo'</i>'
26466 '<i>foo</i>'
26467 '<b>foo</b>
26468 <b>foo</b>'
26469 '<b>foo</b>'
26470 <i>fools'<span> errand</span></i>
26471 <i><span>fool</span>'s errand</i>
26472 '<i>foo</i> bar '<i>baz</i>
26473 a|!*#-:;+-~[]{}b'<i>x</i>
26474 </p>
26475 !! wikitext
26476 ''<nowiki/>'foo'''
26477 ''<nowiki>''foo''</nowiki>''
26478 ''<nowiki>'''foo'''</nowiki>''
26479 ''foo''<nowiki/>'s
26480 '''<nowiki/>'foo''''
26481 '''<nowiki>''foo''</nowiki>'''
26482 '''<nowiki>'''foo'''</nowiki>'''
26483 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26484 '''foo'''<nowiki/>'s
26485 '''foo''
26486 ''foo''<nowiki/>'
26487 ''foo'''<nowiki/>'
26488 '''foo''<nowiki/>'
26489 ''''foo'''
26490 '''foo'''<nowiki/>'
26491 ''''foo'''<nowiki/>'
26492 ''fools'<span> errand</span>''
26493 ''<span>fool</span>'s errand''
26494 '<nowiki/>''foo'' bar '''baz''
26495 a|!*#-:;+-~[]{}b'''x''
26496 !! end
26497
26498 !! test
26499 1b. Quotes inside <b> and <i> with other tags on same line
26500 !! options
26501 parsoid=html2wt
26502 !! html/parsoid
26503 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26504 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26505 <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>
26506 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26507 '<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>
26508 '<i>foo</i> <div title="name">test</div>
26509 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26510 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26511 <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>
26512 </ol>
26513 !! wikitext
26514 '''a'' foo ''[[bar]]''
26515 ''a''' foo ''[[bar]]''
26516 ''a''' foo '''{{echo|[[bar]]}}'''
26517 [[foo]] x'''[[bar]]''
26518 '''foo'' <ref>test</ref>
26519 '''foo'' <div title="name">test</div>
26520 '''foo'' and <br> bar
26521 <references />
26522 !! end
26523
26524 !! test
26525 2. Link fragments separated by <i> and <b> tags
26526 !! options
26527 parsoid=html2wt
26528 !! html/parsoid
26529 <p>[[<i>foo</i>hello]]</p>
26530 <p>[[<b>foo</b>hello]]</p>
26531 !! wikitext
26532 [[''foo''<nowiki>hello]]</nowiki>
26533
26534 [['''foo'''<nowiki>hello]]</nowiki>
26535 !! end
26536
26537 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26538 # this is one of the shortcomings of this format
26539 !! test
26540 3. Link fragments inside <i> and <b>
26541 !! options
26542 parsoid=html2wt
26543 !! html/parsoid
26544 <p><i>[[foo</i>]]</p>
26545 <p><b>[[foo</b>]]</p>
26546 !! wikitext
26547 ''[[foo''<nowiki>]]</nowiki>
26548
26549 '''[[foo'''<nowiki>]]</nowiki>
26550 !! end
26551
26552 !! test
26553 4. No escaping needed
26554 !! options
26555 parsoid=html2wt
26556 !! html/parsoid
26557 <p>'<span><i>bar</i></span>'
26558 '<span><b>bar</b></span>'
26559 'a:b'foo
26560 </p>
26561 !! wikitext
26562 '<span>''bar''</span>'
26563 '<span>'''bar'''</span>'
26564 'a:b'foo
26565 !! end
26566
26567 #### ----------- Paragraphs ---------------
26568 #### 1. No unnecessary escapes
26569 #### --------------------------------------
26570
26571 !! test
26572 1. No unnecessary escapes
26573 !! options
26574 parsoid=html2wt
26575 !! html/parsoid
26576 <p>bar <span>[[foo]]</span>
26577 </p><p>=bar <span>[[foo]]</span>
26578 </p><p>[[bar <span>[[foo]]</span>
26579 </p><p>]]bar <span>[[foo]]</span>
26580 </p><p>=bar <span>foo]]</span>=
26581 </p>
26582 !! wikitext
26583 bar <span><nowiki>[[foo]]</nowiki></span>
26584
26585 =bar <span><nowiki>[[foo]]</nowiki></span>
26586
26587 [[bar <span><nowiki>[[foo]]</nowiki></span>
26588
26589 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26590
26591 =bar <span>foo]]</span><nowiki>=</nowiki>
26592 !!end
26593
26594 #### ----------------------- PRE --------------------------
26595 !! test
26596 1. Leading whitespace in SOL context should be escaped
26597 !! options
26598 parsoid=html2wt
26599 !! html/parsoid
26600 <p> a</p>
26601
26602 <p> a</p>
26603
26604 <p> a(tab)</p>
26605
26606 <p> a
26607 <!--cmt-->
26608 a</p>
26609
26610 <p>a
26611 b</p>
26612
26613 <p>a
26614 b</p>
26615
26616 <p>a
26617 b</p>
26618 !! wikitext
26619 <nowiki> </nowiki>a
26620
26621 <nowiki> </nowiki> a
26622
26623 a(tab)
26624
26625 <nowiki> </nowiki> a
26626 <!--cmt-->
26627 <nowiki> </nowiki>a
26628
26629 a
26630 <nowiki> </nowiki>b
26631
26632 a
26633 b
26634
26635 a
26636 b
26637 !! html/php
26638 <p> a
26639 </p><p> a
26640 </p><p> a(tab)
26641 </p><p> a
26642 a
26643 </p><p>a
26644 b
26645 </p><p>a
26646 b
26647 </p><p>a
26648 b
26649 </p>
26650 !! end
26651
26652 !! test
26653 2. Leading whitespace in non-indent-pre contexts should not be escaped
26654 !! options
26655 parsoid=html2wt
26656 !! html/parsoid
26657 <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>
26658 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26659 <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>
26660 b</span></li>
26661 </ol>
26662 !! wikitext
26663 foo <ref>''a''
26664 b</ref>
26665 <references />
26666 !! end
26667
26668 !! test
26669 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26670 !! options
26671 parsoid=html2wt
26672 !! html/parsoid
26673 <blockquote>
26674 <p>
26675 a
26676 <span>b</span>
26677 c</p>
26678 </blockquote>
26679 !! wikitext
26680 <blockquote>
26681 a
26682 <span>b</span>
26683 c
26684 </blockquote>
26685 !! end
26686
26687 !! test
26688 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26689 !! options
26690 parsoid=html2wt
26691 !! html/parsoid
26692 <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>
26693 !! wikitext
26694 [[File:Foobar.jpg|thumb|caption]]
26695 !! end
26696
26697 !! test
26698 5. Nowiki escaping should account for indent-pres
26699 !! options
26700 parsoid=html2wt
26701 !! html/parsoid
26702 <pre>==foo==</pre>
26703 !! wikitext
26704 ==foo==
26705 !! end
26706
26707 !! test
26708 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26709 !! options
26710 parsoid=html2wt
26711 !! html/parsoid
26712 <pre>
26713 * foo
26714 * bar
26715 </pre>
26716 !! wikitext
26717 * foo
26718 * bar
26719 !! end
26720
26721 !! test
26722 Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup
26723 !! options
26724 parsoid = {
26725 "modes": ["html2wt"],
26726 "scrubWikitext": true
26727 }
26728 !! html/parsoid
26729 <p> foo</p>
26730 <p> %foo</p>
26731 <p> *foo</p>
26732 <p> #foo</p>
26733 <p> =foo=</p>
26734 <p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p>
26735 <p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p>
26736 <p> <!--boo-->*foo</p>
26737 <p><!--boo--> *foo</p>
26738 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p>
26739 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p>
26740 !! wikitext
26741 foo
26742
26743 %foo
26744
26745 <nowiki/>*foo
26746
26747 <nowiki/>#foo
26748
26749 <nowiki/>=foo=
26750
26751 [[Category:Foo]]
26752 <nowiki/>*foo
26753
26754 [[Category:Foo]]
26755 <nowiki>*</nowiki>foo
26756
26757 <nowiki/><!--boo-->*foo
26758
26759 <!--boo--><nowiki/>*foo
26760
26761 <!--a--><!--b--><!--c--><!--d--><!--e-->foo
26762
26763 <!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo
26764 !! end
26765
26766 #### --------------- Behavior Switches --------------------
26767
26768 !! test
26769 1. Valid behavior switches should be escaped
26770 !! options
26771 parsoid=html2wt
26772 !! html/parsoid
26773 __TOC__
26774 <i>__TOC__</i>
26775 !! wikitext
26776 <nowiki>__TOC__</nowiki>
26777 ''<nowiki>__TOC__</nowiki>''
26778 !! end
26779
26780 !! test
26781 2. Invalid behavior switches should not be escaped
26782 !! options
26783 parsoid=html2wt
26784 !! html/parsoid
26785 __TOO__
26786 __|__
26787 !! wikitext
26788 __TOO__
26789 __|__
26790 !! end
26791
26792 # We use indent-pre as an indirect way to test for sol-transparent behavior.
26793 !! test
26794 Behavior switches should be SOL-transparent
26795 !! options
26796 parsoid=html2wt
26797 !! html/parsoid
26798 <meta property="mw:PageProp/toc" />
26799
26800 <!-- this one's bogus -->
26801 <pre>__TOO__</pre>
26802
26803 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26804
26805 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26806 !! wikitext
26807 __TOC__
26808
26809 <!-- this one's bogus -->
26810 __TOO__
26811
26812 __TOC__ foo
26813
26814 __TOC__
26815 bar
26816 !! end
26817
26818 #### --------------- HTML tags ---------------
26819 #### 1. a tags
26820 #### 2. other tags
26821 #### 3. multi-line html tag
26822 #### 4. extension tags
26823 #### -----------------------------------------
26824 !! test
26825 1. a tags
26826 !! options
26827 parsoid=html2wt
26828 !! html/parsoid
26829 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26830 !! wikitext
26831 <a href="http://google.com">google</a>
26832 !! end
26833
26834 !! test
26835 2. other tags
26836 !! options
26837 parsoid=html2wt
26838 !! html/parsoid
26839 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26840 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26841 <li> &lt;td&gt;</li></ul>
26842
26843 !! wikitext
26844 * <nowiki><div>foo</div></nowiki>
26845 * <nowiki><div style="color:red">foo</div></nowiki>
26846 * <nowiki><td></nowiki>
26847 !! end
26848
26849 !! test
26850 3. multi-line html tag
26851 !! options
26852 parsoid=html2wt
26853 !! html/parsoid
26854 <p>&lt;div
26855 &gt;foo&lt;/div
26856 &gt;
26857 </p>
26858 !! wikitext
26859 <nowiki><div
26860 >foo</div
26861 ></nowiki>
26862 !! end
26863
26864 !! test
26865 4. extension tags
26866 !! options
26867 parsoid=html2wt
26868 !! html/parsoid
26869 <p>&lt;ref&gt;foo&lt;/ref&gt;
26870 </p><p>&lt;ref&gt;bar
26871 </p><p>baz&lt;/ref&gt;
26872 </p>
26873 !! wikitext
26874 <nowiki><ref>foo</ref></nowiki>
26875
26876 <nowiki><ref>bar</nowiki>
26877
26878 baz<nowiki></ref></nowiki>
26879 !! end
26880
26881 !! test
26882 Parsoid: newline inducing block nodes don't suppress <nowiki>
26883 !! options
26884 parsoid=html2wt
26885 !! html/parsoid
26886 a<h1>foo</h1>
26887 !! wikitext
26888 <nowiki> </nowiki>a
26889
26890 = foo =
26891 !! end
26892
26893 #### --------------- Others ---------------
26894 !! test
26895 Escaping nowikis
26896 !! options
26897 parsoid=html2wt
26898 !! html/parsoid
26899 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26900 </p>
26901 !! wikitext
26902 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26903 !! end
26904
26905 ## The quote-char in the input is necessary for triggering the bug
26906 !! test
26907 (T54035) Nowiki-escaping should not get tripped by " :" in text
26908 !! options
26909 parsoid=html2wt
26910 !! html/parsoid
26911 <p>foo's bar :</p>
26912 !! wikitext
26913 foo's bar :
26914 !! end
26915
26916 #----------- End of wikitext escaping tests --------------
26917
26918 !! test
26919
26920 Tag-like HTML structures are passed through as text
26921 !! wikitext
26922 <x y>
26923
26924 <x.y>
26925
26926 <x-y>
26927
26928 1>2
26929
26930 x<y
26931
26932 a>b
26933
26934 1<d e>f
26935 !! html
26936 <p>&lt;x y&gt;
26937 </p><p>&lt;x.y&gt;
26938 </p><p>&lt;x-y&gt;
26939 </p><p>1&gt;2
26940 </p><p>x&lt;y
26941 </p><p>a&gt;b
26942 </p><p>1&lt;d e&gt;f
26943 </p>
26944 !! end
26945
26946 !! test
26947 HTML tag with necessary entities in attributes
26948 !! wikitext
26949 <span title="&amp;amp;">foo</span>
26950 !! html
26951 <p><span title="&amp;amp;">foo</span>
26952 </p>
26953 !! end
26954
26955 !! test
26956 HTML tag with 'unnecessary' entity encoding in attributes
26957 !! wikitext
26958 <span title="&amp;">foo</span>
26959 !! html
26960 <p><span title="&amp;">foo</span>
26961 </p>
26962 !! end
26963
26964 !! test
26965 HTML tag with broken attribute value quoting
26966 !! options
26967 parsoid=wt2html,html2html
26968 !! wikitext
26969 <span title="Hello world>Foo</span>
26970 !! html/php
26971 <p><span title="Hello world">Foo</span>
26972 </p>
26973 !! html/parsoid
26974 <p><span title="Hello world">Foo</span></p>
26975 !! end
26976
26977 !! test
26978 Self-closed tag with broken attribute value quoting
26979 !! options
26980 parsoid=wt2html,html2html
26981 !! wikitext
26982 <div title="Hello world />Foo
26983 !! html/php+tidy
26984 <div title="Hello world"></div><p>Foo
26985 </p>
26986 !! html/parsoid
26987 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
26988 !! end
26989
26990 !! test
26991 Table with broken attribute value quoting
26992 !! options
26993 parsoid=wt2html,html2html
26994 !! wikitext
26995 {|
26996 | title="Hello world|Foo
26997 |}
26998 !! html/php
26999 <table>
27000 <tr>
27001 <td title="Hello world">Foo
27002 </td></tr></table>
27003
27004 !! html/parsoid
27005 <table>
27006 <tr>
27007 <td title="Hello world">Foo
27008 </td></tr></table>
27009
27010 !! end
27011
27012 !! test
27013 Table with broken attribute value quoting on consecutive lines
27014 !! options
27015 parsoid=wt2html,html2html
27016 !! wikitext
27017 {|
27018 | title="Hello world|Foo
27019 | style="color:red|Bar
27020 |}
27021 !! html/php
27022 <table>
27023 <tr>
27024 <td title="Hello world">Foo
27025 </td>
27026 <td style="color:red">Bar
27027 </td></tr></table>
27028
27029 !! html/parsoid
27030 <table><tbody>
27031 <tr>
27032 <td title="Hello world">Foo
27033 </td><td style="color: red">Bar
27034 </td></tr></tbody></table>
27035
27036 !! end
27037
27038 !!test
27039 Accept empty td cell attribute
27040 !! wikitext
27041 {|
27042 | align="center" |foo|| |
27043 |}
27044 !! html
27045 <table>
27046 <tr>
27047 <td align="center">foo</td>
27048 <td>
27049 </td></tr></table>
27050
27051 !!end
27052
27053 !!test
27054 Non-empty attributes in th-cells
27055 !! wikitext
27056 {|
27057 !Foo!! style="color: red" |Bar
27058 |}
27059 !! html
27060 <table>
27061 <tr>
27062 <th>Foo</th>
27063 <th style="color: red">Bar
27064 </th></tr></table>
27065
27066 !!end
27067
27068 !!test
27069 Accept empty attributes in th-cells
27070 !! wikitext
27071 {|
27072 !|foo!!|bar
27073 |}
27074 !! html
27075 <table>
27076 <tr>
27077 <th>foo</th>
27078 <th>bar
27079 </th></tr></table>
27080
27081 !!end
27082
27083 !!test
27084 Empty table rows go away
27085 !! wikitext
27086 {|
27087 |Hello
27088 |there
27089 |- class="foo"
27090 |-
27091 |}
27092 !! html
27093 <table>
27094 <tr>
27095 <td>Hello
27096 </td>
27097 <td>there
27098 </td></tr>
27099
27100 </table>
27101
27102 !! end
27103
27104 ###
27105 ### Parsoid-centric tests for testing RTing of inter-element separators
27106 ### Edge cases not tested by existing parser tests and specific to
27107 ### Parsoid-specific serialization strategies.
27108 ###
27109
27110 !!test
27111 RT-ed inter-element separators should be valid separators
27112 !! wikitext
27113 {|
27114 |- [[foo]]
27115 |}
27116 !! html/php
27117 <table>
27118
27119 </table>
27120
27121 !! html/parsoid
27122 <table>
27123 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
27124 </tbody></table>
27125 !!end
27126
27127 # Parsoid-only test of a DOM pass
27128 !!test
27129 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
27130 !! wikitext
27131 {|
27132 |<small>foo
27133 bar
27134 |}
27135
27136 {|
27137 |<small>foo<small>
27138 |}
27139 !! html/parsoid
27140 <table>
27141 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
27142 <p>bar</p></small></td></tr>
27143 </tbody></table>
27144
27145 <table>
27146 <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>
27147 </tbody></table>
27148 !!end
27149
27150 # Note that the "style" attribute is really a template parameter here.
27151 # The = would have to be {{=}} if you wanted the literal.
27152 !!test
27153 Empty TD followed by TD with tpl-generated attribute
27154 !! wikitext
27155 {|
27156 |-
27157 |
27158 |{{echo|style='color:red'}}|foo
27159 |}
27160 !! html
27161 <table>
27162
27163 <tr>
27164 <td>
27165 </td>
27166 <td>foo
27167 </td></tr></table>
27168
27169 !!end
27170
27171 !!test
27172 Indented table with an empty td
27173 !! wikitext
27174 {|
27175 |-
27176 |
27177 |foo
27178 |}
27179 !! html
27180 <table>
27181
27182 <tr>
27183 <td>
27184 </td>
27185 <td>foo
27186 </td></tr></table>
27187
27188 !!end
27189
27190 ## We have some newline diffs RT-ing this edge case
27191 ## and it is not important enough -- we seem to be emitting
27192 ## at most 2 newlines after a </tr> and this is unrelated to
27193 ## the issue from T85627 that this is testing.
27194 !!test
27195 Indented table with blank lines in between (T85627)
27196 !! options
27197 parsoid=wt2html
27198 !! wikitext
27199 {|
27200 |foo
27201
27202
27203 |}
27204 !! html
27205 <table>
27206
27207 <tr>
27208 <td>foo
27209 </td></tr></table>
27210
27211 !!end
27212
27213 !!test
27214 Indented block & table
27215 !! wikitext
27216 <div>foo</div>
27217 {|
27218 |foo
27219 |}
27220 !! html/php
27221 <div>foo</div>
27222 <table>
27223 <tr>
27224 <td>foo
27225 </td></tr></table>
27226
27227 !! html/parsoid
27228 <div data-parsoid='{"stx":"html"}'>foo</div>
27229 <table><tbody>
27230 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
27231 </tbody></table>
27232 !!end
27233
27234 !! test
27235 Indent and comment before table row
27236 !! wikitext
27237 {|
27238 <!--hi-->|-
27239 |there
27240 |}
27241 !! html/php
27242 <table>
27243
27244 <tr>
27245 <td>there
27246 </td></tr></table>
27247
27248 !! html/parsoid
27249 <table>
27250 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
27251 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
27252 </tbody></table>
27253 !! end
27254
27255 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
27256 !!test
27257 Empty TR followed by a template-generated TR
27258 !!options
27259 parsoid
27260 !! wikitext
27261 {|
27262 |-
27263 {{echo|<tr><td>foo</td></tr>}}
27264 |}
27265 !! html
27266 <table>
27267 <tbody>
27268 <tr class='mw-empty-elt'></tr>
27269 <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}}]}'>
27270 <td>foo</td></tr>
27271 </tbody></table>
27272 !!end
27273
27274 ## PHP and parsoid output differ for this, and since this is primarily
27275 ## for testing Parsoid's serializer, marking this Parsoid only
27276 !!test
27277 Empty TR followed by mixed-ws-comment line should RT correctly
27278 !!options
27279 parsoid
27280 !! wikitext
27281 {|
27282 |-
27283 <!--c-->
27284 |-
27285 <!--c--> <!--d-->
27286 |}
27287 !! html
27288 <table>
27289 <tbody>
27290 <tr class='mw-empty-elt'></tr>
27291 <!--c-->
27292 <tr>
27293 <!--c--> </tr><!--d-->
27294 </tbody></table>
27295
27296 !!end
27297
27298 !!test
27299 Multi-line image caption generated by templates with/without trailing newlines
27300 !! wikitext
27301 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
27302 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
27303 !! html/parsoid
27304 <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>
27305 <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>
27306 !!end
27307
27308 !! test
27309 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
27310 !! options
27311 parsoid=html2wt
27312 !! html/parsoid
27313 <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>
27314
27315 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
27316 !! wikitext
27317 <includeonly>foo</includeonly>
27318 new para
27319
27320 [[Category:Foo]]
27321
27322 = new heading =
27323 !! end
27324
27325 ## PHP emits broken html for this, and since this is primarily
27326 ## a Parsoid serializer test, marking this Parsoid only
27327 !!test
27328 Improperly nested inline or quotes tags with whitespace in between
27329 !! wikitext
27330 <span> <s>x</span> </s>
27331 ''' ''x''' ''
27332 !! html/parsoid
27333 <p><span> <s>x</s></span><s> </s>
27334 <b> <i>x</i></b><i> </i>
27335 </p>
27336 !!end
27337
27338 !!test
27339 Encapsulate protected attributes from wt
27340 !! wikitext
27341 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
27342
27343 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
27344 |ok
27345 |}
27346 !! html/parsoid
27347 <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>
27348
27349 <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">
27350 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'>ok</td></tr>
27351 </tbody></table>
27352 !!end
27353
27354 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
27355 ## Having nested or stray pre tags results in the attempt to add duplicates,
27356 ## causing an assertion fail. This test tries to prevent that situation.
27357 !!test
27358 Ensure ParagraphWrapper can deal with stray closing pre tags
27359 !!options
27360 parsoid=wt2html
27361 !! wikitext
27362 plain text</pre>
27363 !! html/parsoid
27364 plain text
27365 !!end
27366
27367 !! test
27368 1. Ensure fostered text content is wrapped in element nodes
27369 !! options
27370 parsoid=wt2html
27371 !! wikitext
27372 <table>hi</table><table>ho</table>
27373 !! html/php+tidy
27374 hi<table></table>ho<table></table>
27375 !! html/parsoid
27376 <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>
27377 !! end
27378
27379 !! test
27380 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
27381 !! options
27382 parsoid=wt2html,wt2wt
27383 !! wikitext
27384 <table>
27385 <tr> || ||
27386 <td> a
27387 </table>
27388 !! html/php+tidy
27389 || ||
27390 <table>
27391 <tbody><tr><td> a
27392 </td></tr></tbody></table>
27393 !! html/parsoid
27394 <span data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||
27395 </span><table data-parsoid='{"stx":"html"}'>
27396 <tbody><tr data-parsoid='{"stx":"html","autoInsertedEnd":true}'><td data-parsoid='{"stx":"html","autoInsertedEnd":true}'> a
27397 </td></tr></tbody></table>
27398 !! end
27399
27400 !! test
27401 Encapsulation properly handles null DSR information from foster box
27402 !! options
27403 parsoid=wt2html,wt2wt
27404 !! wikitext
27405 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
27406 !! html/parsoid
27407 <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>
27408 !! end
27409
27410 !! test
27411 1. Encapsulate foster-parented transclusion content
27412 !! options
27413 parsoid=wt2wt,wt2html
27414 !! wikitext
27415 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
27416 !! html/php+tidy
27417 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
27418 !! html/parsoid
27419 <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>
27420 !! end
27421
27422 !! test
27423 2. Encapsulate foster-parented transclusion content
27424 !! options
27425 parsoid=wt2wt,wt2html
27426 !! wikitext
27427 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
27428 !! html/parsoid
27429 <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>
27430 <table>
27431 <tbody>
27432 <tr>
27433 <td>bar</td>
27434 </tr>
27435 </tbody>
27436 </table>
27437 !! end
27438
27439 !! test
27440 3. Encapsulate foster-parented transclusion content
27441 !! options
27442 parsoid=wt2wt,wt2html
27443 !! wikitext
27444 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27445 !! html/parsoid
27446 <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;]}">
27447 <p>foo</p>
27448 </div>
27449 <table>
27450 <tbody>
27451 <tr>
27452 <td>bar</td>
27453 </tr>
27454 </tbody>
27455 </table>
27456 !! end
27457
27458 !! test
27459 4. Encapsulate foster-parented transclusion content
27460 !! options
27461 parsoid=wt2wt,wt2html
27462 !! wikitext
27463 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27464 !! html/parsoid
27465 <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;]}">
27466 <p>foo</p>
27467 </div>
27468 <table>
27469 <tbody>
27470 <tr>
27471 <td>bar</td>
27472 </tr>
27473 </tbody>
27474 </table>
27475 !! end
27476
27477 !! test
27478 5. Encapsulate foster-parented transclusion content
27479 !!options
27480 parsoid=wt2wt,wt2html
27481 !! wikitext
27482 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27483 !! html/php+tidy
27484 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
27485 !! html/parsoid
27486 <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>
27487 !! end
27488
27489 !! test
27490 6. Encapsulate foster-parented transclusion content
27491 !! options
27492 parsoid=wt2wt,wt2html
27493 !! wikitext
27494 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27495 !! html/php+tidy
27496 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
27497 !! html/parsoid
27498 <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>
27499 !! end
27500
27501 !! test
27502 7. Encapsulate foster-parented transclusion content
27503 !!options
27504 parsoid=wt2wt,wt2html
27505 !! wikitext
27506 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27507 !! html/parsoid
27508 <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>
27509 <table>
27510 <tbody>
27511 <tr>
27512 <td>bar</td>
27513 </tr>
27514 </tbody>
27515 </table>
27516 !! end
27517
27518 # Note that the wt is broken on purpose: the = should be {{=}} if you
27519 # don't want it to be a template parameter key.
27520 !! test
27521 8. Encapsulate foster-parented transclusion content
27522 !! options
27523 parsoid=wt2wt,wt2html
27524 !! wikitext
27525 {{echo|a
27526 }}{|{{echo|style='color:red'}}
27527 |-
27528 |b
27529 |}
27530 !! html/php+tidy
27531 <p>a
27532 </p>
27533 <table>
27534
27535 <tbody><tr>
27536 <td>b
27537 </td></tr></tbody></table>
27538 !! html/parsoid
27539 <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">
27540 </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">
27541 <tbody><tr>
27542 <td>b
27543 </td></tr></tbody></table>
27544 !! end
27545
27546 !! test
27547 9. Encapsulate foster-parented transclusion content
27548 !!options
27549 parsoid=wt2wt,wt2html
27550 !! wikitext
27551 <table>{{echo|hi</table>hello}}
27552 !! html/php+tidy
27553 hi<table></table><p>hello
27554 </p>
27555 !! html/parsoid
27556 <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>
27557 !! end
27558
27559 !! test
27560 Table in fosterable position
27561 !!options
27562 parsoid=wt2html
27563 !! wikitext
27564 {{OpenTable}}
27565 <div>
27566 {|
27567 |}
27568 </div>
27569 |}
27570 !! html/parsoid
27571 <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">
27572 </span>
27573 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27574
27575 <table>
27576 </table>
27577 !! end
27578
27579 # Parsoid only for T66747
27580 !! test
27581 Properly encapsulate empty-content transclusions in fosterable positions
27582 !! wikitext
27583 <table>
27584 {{#if:|
27585 <td>foo</td>
27586 }}
27587 </table>
27588 !! html/parsoid
27589 <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"}]]}'>
27590
27591 </table>
27592 !! end
27593
27594 !! test
27595 Always encapsulate foster box when template range is expanded to table
27596 !! options
27597 parsoid=wt2wt
27598 !! wikitext
27599 {|
27600 hello
27601 {{OpenTable}}
27602 |}
27603 !! html/parsoid
27604
27605 !! end
27606
27607 !! test
27608 T115289: Unclosed table
27609 !! wikitext
27610 {{echo|<table>}}<!--c-->[[Category:Two]]
27611 !! html/parsoid
27612 <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>
27613 !! end
27614
27615 !! test
27616 T115289: Don't migrate newlines out of tables with fostered content
27617 !! wikitext
27618 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27619 !! html/parsoid
27620 <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>
27621 !! end
27622
27623 !! test
27624 T73074: More fostering fun
27625 !! wikitext
27626 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27627 !! html/parsoid
27628 <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>
27629 !! end
27630
27631 !!test
27632 Support <object> element with .data attribute
27633 !!options
27634 parsoid=html2wt
27635 !! html/parsoid
27636 <object data="test.swf"></object>
27637 !! wikitext
27638 <object data="test.swf"></object>
27639 !!end
27640
27641 !! test
27642 Don't block XML namespace declaration
27643 !! wikitext
27644 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27645 !! html/php
27646 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27647 </p>
27648 !! html/parsoid
27649 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27650 !! end
27651
27652 # -----------------------------------------------------------------
27653 # The following section of tests are primarily to spec requirements
27654 # around Parsoid's serialization (old, new, edited content)
27655 #
27656 # All these tests are marked Parsoid html2wt and html2html only
27657 # ----------------------------------------------------------------
27658
27659 !! test
27660 Ignore rel attribute in a-tags during serialization to url-links
27661 !! options
27662 parsoid=html2wt
27663 !! html/parsoid
27664 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27665 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27666 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27667 !! wikitext
27668 http://en.wikipedia.org/wiki/Foobar
27669 http://en.wikipedia.org/wiki/Foobar
27670 http://en.wikipedia.org/wiki/Foobar
27671 !! end
27672
27673 # 'mi' is a localinterwiki prefix as well as a language
27674 !! test
27675 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27676 !! options
27677 parsoid=html2wt
27678 !! html/parsoid
27679 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27680 !! wikitext
27681 [[Foo]]
27682 !! end
27683
27684 !! test
27685 Parsoid should accept interwiki shortcuts
27686 !! options
27687 parsoid=html2wt
27688 !! html/parsoid
27689 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27690 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27691 <a href='./fr:Foo'>Foo</a></p>
27692 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27693 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27694 <a href='fr%3AFoo'>Foo</a></p>
27695 <p><a href='FR%3AFoo'>Foo</a>
27696 <a href='./FR:Foo'>Foo</a></p>
27697 !! wikitext
27698 [[:fr:Foo|Foo]]
27699 [[:fr:Foo|Foo]]
27700 [[:fr:Foo|Foo]]
27701
27702 [[:fr:Foo|Foo]]
27703 [[:fr:Foo|Foo]]
27704 [[:fr:Foo|Foo]]
27705
27706 [[:fr:Foo|Foo]]
27707 [[:fr:Foo|Foo]]
27708 !! end
27709
27710 !! test
27711 Parsoid should not accept invalid interwiki shortcuts
27712 !! options
27713 parsoid=html2wt
27714 !! html/parsoid
27715 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
27716 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
27717 <a href='news:Foo'>Foo</a></p>
27718 !! wikitext
27719 [news:Foo Foo]
27720 [news:Foo Foo]
27721 [news:Foo Foo]
27722 !! end
27723
27724 # See T93839
27725 !! test
27726 New wikilinks should be serialized properly
27727 !! options
27728 parsoid=html2wt
27729 !! html/parsoid
27730 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
27731 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
27732 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
27733 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
27734 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
27735 !! wikitext
27736 [[Foo]]
27737 [[Foo]]
27738 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
27739 http://en.wikipedia.org/wiki/Foo
27740 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
27741 !! end
27742
27743 !! test
27744 New wiki links (href variations)
27745 !! options
27746 parsoid=html2wt
27747 !! html/parsoid
27748 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27749 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
27750 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
27751 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
27752 !! wikitext
27753 [[Foo_bar]]
27754 [[Foo_bar]]
27755 [[Foo_bar]]
27756 [[Toxine bactérienne]]
27757 !! end
27758
27759 !! test
27760 New wiki links (content string variations)
27761 !! options
27762 parsoid=html2wt
27763 !! html/parsoid
27764 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27765 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
27766 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
27767 !! wikitext
27768 [[Foo_bar]]
27769 [[Foo bar]]
27770 [[Foo_bar|./Foo_bar]]
27771 !! end
27772
27773 !! test
27774 New category links (href variations)
27775 !! options
27776 parsoid=html2wt
27777 !! html/parsoid
27778 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
27779 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
27780 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
27781 !! wikitext
27782 [[Category:Toxine bactérienne]]
27783 [[Category:Toxine bactérienne]]
27784 [[Category:Toxine bactérienne]]
27785 !! end
27786
27787 !! test
27788 New sol transparent links don't need indent-pre nowiki protection
27789 !! options
27790 parsoid=html2wt
27791 language=de
27792 !! html/parsoid
27793 <link rel="mw:PageProp/redirect" href="./Main_Page">
27794 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27795 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27796 !! wikitext
27797 #WEITERLEITUNG [[Main Page]]
27798 <!-- this is good --> [[Category:Good]]
27799 <!-- this is great --> [[Kategorie:Great]]
27800 !! end
27801
27802 !! test
27803 New interlanguage links (href variations)
27804 !! options
27805 parsoid=html2wt
27806 !! html/parsoid
27807 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
27808 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
27809 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
27810 !! wikitext
27811 [[es:Toxine bactérienne]]
27812 [[es:Toxine_bactérienne]]
27813 [[es:Toxine_bactérienne]]
27814 !! end
27815
27816 !! test
27817 Image: Modifying size of an image (1)
27818 !! options
27819 parsoid={
27820 "modes": ["wt2wt"],
27821 "changes": [
27822 ["img[height]", "attr", "height", "22"],
27823 ["img[width]", "attr", "width", "200"]
27824 ]
27825 }
27826 !! wikitext
27827 [[Image:Foobar.jpg|230x230px]]
27828 !! wikitext/edited
27829 [[Image:Foobar.jpg|200x200px]]
27830 !!end
27831
27832 !! test
27833 Image: Modifying size of an image (2)
27834 !! options
27835 parsoid={
27836 "modes": ["wt2wt"],
27837 "changes": [
27838 ["img[height]", "attr", "height", "100"],
27839 ["img[width]", "attr", "width", "500"]
27840 ]
27841 }
27842 !! wikitext
27843 [[Image:Foobar.jpg|230x230px]]
27844 !! wikitext/edited
27845 [[Image:Foobar.jpg|500x500px]]
27846 !!end
27847
27848 # Change in size is ignored so long as class='mw-default-size'
27849 !! test
27850 Image: Modifying size of an image (3)
27851 !! options
27852 parsoid={
27853 "modes": ["wt2wt"],
27854 "changes": [
27855 ["figure[class]", "removeClass", "mw-default-size"],
27856 ["figure img", "attr", "height", "19"],
27857 ["figure img", "attr", "width", "170"]
27858 ]
27859 }
27860 !! wikitext
27861 [[Image:Foobar.jpg|thumb]]
27862 !! wikitext/edited
27863 [[Image:Foobar.jpg|thumb|170x170px]]
27864 !!end
27865
27866 !! test
27867 Image: Modifying alignment of an image (T50665)
27868 !! options
27869 parsoid={
27870 "modes": ["wt2wt"],
27871 "changes": [
27872 ["figure[class]", "removeClass", "mw-halign-right"],
27873 ["figure[class]", "addClass", "mw-halign-left"]
27874 ]
27875 }
27876 !! wikitext
27877 [[Image:Foobar.jpg|thumb|caption|right]]
27878 !! wikitext/edited
27879 [[Image:Foobar.jpg|thumb|caption|left]]
27880 !! end
27881
27882 !! test
27883 Image: Modifying mw-default-size of an frameless image (T64805)
27884 !! options
27885 parsoid={
27886 "modes": ["wt2wt"],
27887 "changes": [
27888 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27889 ]
27890 }
27891 !! wikitext
27892 [[Image:Foobar.jpg|frameless|right]]
27893 !! wikitext/edited
27894 [[Image:Foobar.jpg|frameless|right|220x220px]]
27895 !! end
27896
27897 !! test
27898 Image: Modifying valign of an image (T51221)
27899 !! options
27900 parsoid={
27901 "modes": ["wt2wt"],
27902 "changes": [
27903 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27904 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27905 ]
27906 }
27907 !! wikitext
27908 [[File:Foobar.jpg|20px|middle]]
27909 !! wikitext/edited
27910 [[File:Foobar.jpg|20px|text-top]]
27911 !! end
27912
27913 !! test
27914 Image: Modifying alt attribute of an image (T58400)
27915 !! options
27916 parsoid={
27917 "modes": ["wt2wt"],
27918 "changes": [
27919 ["img[alt]", "attr", "alt", "some alternate edited text"]
27920 ]
27921 }
27922 !! wikitext
27923 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
27924 !! wikitext/edited
27925 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
27926 !!end
27927
27928 !! test
27929 Image: Modifying caption of an image
27930 !! options
27931 parsoid={
27932 "modes": ["wt2wt"],
27933 "changes": [
27934 ["figcaption", "text", "new caption"]
27935 ]
27936 }
27937 !! wikitext
27938 [[Image:Foobar.jpg|thumb|original caption]]
27939 !! wikitext/edited
27940 [[Image:Foobar.jpg|thumb|new caption]]
27941 !!end
27942
27943 !! test
27944 Image: empty alt attribute (T50924)
27945 !! options
27946 parsoid
27947 !! wikitext
27948 [[File:Foobar.jpg|thumb|alt=|bar]]
27949 !! html
27950 <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>
27951 !! end
27952
27953 !! test
27954 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
27955 !! options
27956 parsoid=html2wt
27957 language=ar
27958 disabled
27959 !! html/parsoid
27960 <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>
27961 !! wikitext
27962 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
27963 !! end
27964
27965 !! test
27966 Image: Block level image should have \n before and after
27967 !! wikitext
27968 123
27969 [[File:Foobar.jpg|right|thumb|150x150px]]
27970 456
27971 !! html/parsoid
27972 <p>123</p>
27973 <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>
27974 <p>456</p>
27975 !! end
27976
27977 !! test
27978 Image: New block level image should have \n before and after (existing content)
27979 !! wikitext
27980 123
27981 [[File:Foobar.jpg|right|thumb|150x150px]]
27982 456
27983 !! html/parsoid
27984 <p>123</p>
27985 <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>
27986 <p>456</p>
27987 !! end
27988
27989 !! test
27990 Image: upright option (parsoid)
27991 !! wikitext
27992 [[File:Foobar.jpg|thumb|upright|caption]]
27993 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
27994 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
27995 !! html/parsoid
27996 <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>
27997 <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>
27998 <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>
27999 !! end
28000
28001 !! test
28002 Image: upright option is ignored on inline and frame images (parsoid)
28003 !! wikitext
28004 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
28005 !! html/parsoid
28006 <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>
28007 !! end
28008
28009 !! test
28010 Image: in template parameter with empty parameter
28011 !! wikitext
28012 {{echo|[[File:Foobar.jpg|link=]]}}
28013 !! html/parsoid
28014 <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>
28015 !! end
28016
28017 !! test
28018 Image: from basic HTML (1)
28019 !! options
28020 parsoid=html2wt
28021 !! html/parsoid
28022 <span typeof="mw:Image">
28023 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28024 </span>
28025 !! wikitext
28026 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28027 !! end
28028
28029 !! test
28030 Image: from basic HTML (2)
28031 !! options
28032 parsoid=html2wt
28033 !! html/parsoid
28034 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28035 !! wikitext
28036 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28037 !! end
28038
28039 !! test
28040 Image: from basic HTML (3)
28041 !! options
28042 parsoid=html2wt
28043 !! html/parsoid
28044 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
28045 !! wikitext
28046 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
28047 !! end
28048
28049 !! test
28050 Image: from basic HTML (4)
28051 !! options
28052 parsoid=html2wt
28053 !! html/parsoid
28054 <img src="./File:Foobar.jpg">
28055 !! wikitext
28056 [[File:Foobar.jpg|link=]]
28057 !! end
28058
28059 !! test
28060 Image: Invalid title as link
28061 !! wikitext
28062 [[File:Foobar.jpg|link=<]]
28063 !! html/php
28064 <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>
28065 </p>
28066 !! html/parsoid
28067 <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>
28068 !! end
28069
28070 !! test
28071 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
28072 !! options
28073 parsoid=html2wt
28074 !! html/parsoid
28075 <ul>
28076 <li><p>foo</p></li>
28077 </ul>
28078 !! wikitext
28079 * foo
28080 !! end
28081
28082 !! test
28083 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
28084 !! options
28085 parsoid=html2wt
28086 !! html/parsoid
28087 <ul> <li>foo</li></ul>
28088 !! wikitext
28089 * foo
28090 !! end
28091
28092 !! test
28093 Don't strip leading whitespace when handling indent-pre suppressing tags
28094 !! options
28095 parsoid=html2wt
28096 !! html/parsoid
28097 <table>
28098 <tr><td> indented row</td></tr>
28099 </table>
28100 <blockquote><p>
28101 <b>This is very bold of you!</b>
28102 </p>
28103 <table><tr><td>
28104 indented cell (no pre-wrapping!)
28105 </td></tr></table>
28106 </blockquote>
28107 <p>foo</p>
28108 <div>bar</div>
28109 !! wikitext
28110 {|
28111 | indented row
28112 |}
28113 <blockquote>
28114 '''This is very bold of you!'''
28115
28116 {|
28117 |
28118 indented cell (no pre-wrapping!)
28119 |}
28120 </blockquote>
28121 foo
28122 <div>bar</div>
28123 !! end
28124
28125 !! test
28126 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
28127 !! options
28128 parsoid=html2wt
28129 !! html/parsoid
28130 <p>foo</p>
28131 <span>bar</span>
28132
28133 <span>foo2
28134 </span>bar2
28135
28136 <div>foo</div>
28137 <span>bar</span>
28138
28139 <div>
28140 <span>foo</span>
28141 </div>
28142 !! wikitext
28143 foo
28144
28145 <span>bar</span>
28146
28147 <span>foo2
28148 <nowiki> </nowiki></span>bar2
28149
28150 <div>foo</div>
28151 <nowiki> </nowiki><span>bar</span>
28152
28153 <div>
28154 <nowiki> </nowiki><span>foo</span>
28155 </div>
28156 !! end
28157
28158 !! test
28159 Lists: Dont insert newlines in a serialized list item.
28160 !! options
28161 parsoid=html2wt
28162 !! html/parsoid
28163 <ul><li>a<br>b</li><li>c</li></ul>
28164 !! wikitext
28165 * a<br />b
28166 * c
28167 !! end
28168
28169 !! test
28170 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
28171 !! options
28172 parsoid={
28173 "modes": ["html2wt"],
28174 "scrubWikitext": false
28175 }
28176 !! html/parsoid
28177 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28178 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28179
28180 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28181 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28182
28183 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
28184
28185 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28186 !! wikitext
28187 == hello there [[Category:A1]] ==
28188
28189 == [[Category:A2]] hi pal ==
28190
28191 == <!--foo--> [[Category:A3]] how goes it ==
28192
28193 == it goes well [[Category:A4]] <!--bar--> ==
28194
28195 ==howdy [[Category:A5]]==
28196
28197 == __TOC__ ok ==
28198 !! end
28199
28200 !! test
28201 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
28202 !! options
28203 parsoid={
28204 "modes": ["html2wt"],
28205 "scrubWikitext": true
28206 }
28207 !! html/parsoid
28208 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28209 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28210
28211 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28212 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28213
28214 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28215 !! wikitext
28216 == hello there ==
28217 [[Category:A1]]
28218 [[Category:A2]]
28219
28220 == hi pal ==
28221
28222 <!--foo-->[[Category:A3]]
28223
28224 == how goes it ==
28225
28226 == it goes well ==
28227 [[Category:A4]] <!--bar-->
28228
28229 __TOC__
28230
28231 == ok ==
28232 !! end
28233
28234 !! test
28235 Headings: Don't hoist metas that come from templates
28236 !! options
28237 parsoid={
28238 "modes": ["html2wt"],
28239 "scrubWikitext": true
28240 }
28241 !! html/parsoid
28242 <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>
28243 !! wikitext
28244 == {{echo|foo [[Category:Foo]]}} ==
28245 !! end
28246
28247 !! test
28248 Headings: Category in ref isn't hoisted
28249 !! options
28250 parsoid={
28251 "modes": ["html2wt"],
28252 "scrubWikitext": true
28253 }
28254 !! html/parsoid
28255 <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>
28256
28257 <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>
28258 !! wikitext
28259 == foo <ref>bar
28260 [[Category:Baz]] </ref> ==
28261
28262 <references />
28263 !! end
28264
28265 !! test
28266 Parsoid: Serialize positional parameters with = in them as named parameter
28267 !! options
28268 parsoid=html2wt
28269 !! html/parsoid
28270 <p about="#mwt1" typeof="mw:Transclusion"
28271 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
28272
28273 <p about="#mwt1" typeof="mw:Transclusion"
28274 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
28275
28276 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28277 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28278 <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>
28279 !! wikitext
28280 {{echo|1=f=oo}}
28281
28282 {{echo|1=f=oo|2=bar}}
28283
28284 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28285 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28286 {{echo|<nowiki>f=oo</nowiki>|bar}}
28287 !! end
28288
28289 !! test
28290 Parsoid: Serialize positional parameters with = in extlink as named parameter
28291 !! options
28292 parsoid=html2wt
28293 !! html/parsoid
28294 <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>
28295 !! wikitext
28296 {{echo|1=http://stuff?is=ok}}
28297 !! end
28298
28299 !! test
28300 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
28301 !! options
28302 parsoid=html2wt
28303 !! html/parsoid
28304 <div>a<p>b</p></div>
28305 <div>a
28306 <p>b</p></div>
28307 <div>
28308 a
28309 <p>b</p></div>
28310 !! wikitext
28311 <div>a
28312 b
28313 </div>
28314 <div>a
28315 b
28316 </div>
28317 <div>
28318 a
28319
28320 b
28321 </div>
28322 !! end
28323
28324 !! test
28325 Substrings resembling wikitext in hrefs should not get nowiki escapes
28326 !! options
28327 parsoid=html2wt
28328 !! html/parsoid
28329 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
28330 !! wikitext
28331 [[Foo''bar''baz]]
28332 !! end
28333
28334 !! test
28335 Enforce single-line context in the serializer
28336 !! options
28337 parsoid=html2wt
28338 !! html/parsoid
28339 <h2>testing
28340 123</h2>
28341
28342 <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">
28343 </span><span about="#mwt1">you</span> </h2>
28344
28345 <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>
28346
28347 <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
28348 there</span></li></ol>
28349
28350 <ul><li>asd
28351 sdf</li></ul>
28352
28353 <ul><li>foo
28354 bar
28355 baz</li>
28356 <li>foo <b>bar</b>
28357 baz</li></ul>
28358
28359 <dl><dt>hi
28360 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
28361 ho</dd></dl>
28362
28363 <dl><dd> <table>
28364 <tbody><tr><td> ha
28365 ha
28366 ha</td></tr>
28367 </tbody></table></dd></dl>
28368 !! wikitext
28369 == testing 123 ==
28370
28371 == hi {{bogus|there
28372 you}} ==
28373
28374 == foo <ref>hello
28375 there</ref> ==
28376
28377 <references />
28378
28379 * asd sdf
28380
28381 * foo bar baz
28382 * foo '''bar''' baz
28383
28384 ; hi ho : hi ho
28385
28386 : {|
28387 | ha
28388 ha
28389 ha
28390 |}
28391 !! end
28392
28393 !! test
28394 Serialize new placeholder space without spans
28395 !! options
28396 parsoid=html2wt
28397 !! html/parsoid
28398 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
28399
28400 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
28401
28402 <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>
28403 !! wikitext
28404 foo : bar
28405
28406 foo : bar
28407
28408 <ref>foo : bar</ref>ok
28409 !! end
28410
28411
28412 #-----------------------
28413 # Tag minimization tests
28414 #-----------------------
28415
28416 !! test
28417 1. I/B quote minimization: wikitext-only tags should be combined
28418 !! options
28419 parsoid=html2wt
28420 !! html/parsoid
28421 <p><i>A</i><i>B</i></p>
28422 <p><b>A</b><b>B</b></p>
28423 <p><i>A</i><b><i>B</i></b></p>
28424 <p><b>A</b><i><b>B</b></i></p>
28425 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
28426 <p><i><b>A</b></i><i><b>B</b></i></p>
28427 <p><i><b>A</b></i><b><i>B</i></b></p>
28428 <p><b><i>A</i></b><i><b>B</b></i></p>
28429 !! wikitext
28430 ''AB''
28431
28432 '''AB'''
28433
28434 ''A'''B'''''
28435
28436 '''A''B'''''
28437
28438 '''A''BC''D'''
28439
28440 '''''AB'''''
28441
28442 '''''AB'''''
28443
28444 '''''AB'''''
28445 !! end
28446
28447 !! test
28448 2. I/B quote minimization: wikitext and html tags should not be combined
28449 !! options
28450 parsoid=html2wt
28451 !! html/parsoid
28452 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
28453 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
28454 !! wikitext
28455 ''A''<i>B</i>
28456
28457 ''A''<nowiki/>'''<i>B</i>'''
28458 !! end
28459
28460 !! test
28461 3. I/B quote minimization: templated content stops minimization
28462 !! options
28463 parsoid=html2wt
28464 !! html/parsoid
28465 <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>
28466 <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>
28467 !! wikitext
28468 ''A''{{echo|''B''}}
28469
28470 ''A''{{echo|'''''B'''''}}
28471 !! end
28472
28473 !! test
28474 4. I/B quote minimization: new content should be mimimized with adjacent old content
28475 !! options
28476 parsoid=html2wt
28477 !! html/parsoid
28478 <p><i>A</i><i>B</i></p>
28479 <p><b>A</b><b>B</b></p>
28480 <p><i>A</i><b><i>B</i></b></p>
28481 !! wikitext
28482 ''AB''
28483
28484 '''AB'''
28485
28486 ''A'''B'''''
28487 !! end
28488
28489 !! test
28490 5a. Merge adjacent quote nodes if they've been edited
28491 !! options
28492 parsoid={
28493 "modes": ["wt2wt", "selser"],
28494 "changes": [
28495 ["p", "contents", "remove", ":contains('b')"]
28496 ]
28497 }
28498 !! wikitext
28499 ''a''b''c''
28500 !! wikitext/edited
28501 ''ac''
28502 !! end
28503
28504 !! test
28505 5b. Merge adjacent quote nodes if they've been edited
28506 !! options
28507 parsoid={
28508 "modes": ["wt2wt", "selser"],
28509 "changes": [
28510 ["#x", "remove"]
28511 ]
28512 }
28513 !! wikitext
28514 ''a''<span id="x">b</span>''c''
28515 !! wikitext/edited
28516 ''ac''
28517 !! end
28518
28519 !! test
28520 1. Merge adjacent link nodes as long as at least one element is new
28521 !! options
28522 parsoid={
28523 "modes": ["html2wt"],
28524 "scrubWikitext": true
28525 }
28526 !! html/parsoid
28527 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28528 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28529 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28530 !! wikitext
28531 [[Football]]
28532 [[Football]]
28533 [[Football|Foot]][[Football|ball]]
28534 !! end
28535
28536 !! test
28537 2. Merge adjacent link nodes and enable additional normalizations
28538 !! options
28539 parsoid={
28540 "modes": ["html2wt"],
28541 "scrubWikitext": true
28542 }
28543 !! html/parsoid
28544 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28545 !! wikitext
28546 ''[[Football]]''
28547 !! end
28548
28549 !! test
28550 3. Don't merge adjacent link nodes if scrubWikitext is false
28551 !! options
28552 parsoid={
28553 "modes": ["html2wt"],
28554 "scrubWikitext": false
28555 }
28556 !! html/parsoid
28557 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28558 !! wikitext
28559 [[Football|Foot]][[Football|ball]]
28560 !! end
28561
28562 !! test
28563 1. Move format tags outside of WikiLink
28564 !! options
28565 parsoid={
28566 "modes": ["html2wt"],
28567 "scrubWikitext": true
28568 }
28569 !! html/parsoid
28570 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
28571 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
28572 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
28573 !! wikitext
28574 ''[[Football]]''
28575 '''''[[Football]]'''''
28576 <u>'''''[[Football]]'''''</u>
28577 !! end
28578
28579 !! test
28580 2. Move format tags outside of WikiLink with mergable A tags
28581 !! options
28582 parsoid={
28583 "modes": ["html2wt"],
28584 "scrubWikitext": true
28585 }
28586 !! html/parsoid
28587 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
28588 !! wikitext
28589 '''''[[Football]]'''''
28590 !! end
28591
28592 !! test
28593 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
28594 !! options
28595 parsoid={
28596 "modes": ["html2wt"],
28597 "scrubWikitext": true
28598 }
28599 !! html/parsoid
28600 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
28601 !! wikitext
28602 <font color="red"><u>'''[[Foo]]'''</u></font>
28603 !! end
28604
28605 !! test
28606 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
28607 !! options
28608 parsoid={
28609 "modes": ["html2wt"],
28610 "scrubWikitext": true
28611 }
28612 !! html/parsoid
28613 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
28614 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
28615 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
28616 !! wikitext
28617 [[Foo|<font color="red">Foo</font>]]
28618 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
28619 [[Foo|<span class="Bar">Foo</span>]]
28620 !! end
28621
28622 !! test
28623 5. T194083 Regression test: Manual edit test that also enables scrubWikitext to move format tags outside wikilinks
28624 !! options
28625 parsoid={
28626 "modes": ["selser"],
28627 "scrubWikitext": true,
28628 "changes": [
28629 ["a", "html", "<i>Foo</i>"]
28630 ]
28631 }
28632 !! wikitext
28633 [[Foo]]
28634 !! wikitext/edited
28635 ''[[Foo]]''
28636 !! end
28637
28638 !! test
28639 6. Regression test: Manual edit test to ensure diff markers are not lost
28640 !! options
28641 parsoid={
28642 "modes": ["selser"],
28643 "scrubWikitext": true,
28644 "changes": [
28645 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
28646 ]
28647 }
28648 !! wikitext
28649 ''Foo''
28650 !! wikitext/edited
28651 ''[[Foo]]''
28652 !! end
28653
28654 #------------------------------
28655 # End of tag minimization tests
28656 #------------------------------
28657
28658 !!test
28659 T56262: New entities
28660 !! options
28661 parsoid=html2wt
28662 !! html/parsoid
28663 <span typeof="mw:Entity">&nbsp;</span>
28664 !! wikitext
28665 &nbsp;
28666 !! end
28667
28668 ## Note that there is no wikitext output for 'unknownproperty' ##
28669 ## Unknown magic words are silently dropped ##
28670
28671 !! test
28672 Magic words
28673 !! options
28674 parsoid=html2wt
28675 !! html/parsoid
28676 <meta property='mw:PageProp/toc' />
28677 <meta property='mw:PageProp/notoc' />
28678 <meta property='mw:PageProp/forcetoc' />
28679 <meta property='mw:PageProp/index' />
28680 <meta property='mw:PageProp/noindex' />
28681 <meta property='mw:PageProp/nogallery' />
28682 <meta property='mw:PageProp/noeditsection' />
28683 <meta property='mw:PageProp/notitleconvert' />
28684 <meta property='mw:PageProp/nocontentconvert' />
28685 <meta property='mw:PageProp/unknownproperty' />
28686 !! wikitext
28687 __TOC__
28688 __NOTOC__
28689 __FORCETOC__
28690 __INDEX__
28691 __NOINDEX__
28692 __NOGALLERY__
28693 __NOEDITSECTION__
28694 __NOTITLECONVERT__
28695 __NOCONTENTCONVERT__
28696 !! end
28697
28698 !! test
28699 Consecutive <pre>s should not get merged
28700 !! options
28701 parsoid=html2wt,html2html
28702 !! html/parsoid
28703 <pre>a</pre><pre>b</pre>
28704
28705 <pre>c
28706 </pre><pre>
28707 d</pre>
28708
28709 <pre>e
28710
28711 </pre><pre>
28712
28713 f</pre>
28714 !! wikitext
28715 a
28716
28717 b
28718
28719 c
28720
28721 d
28722
28723 e
28724
28725
28726
28727 f
28728 !! end
28729
28730 !! test
28731 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
28732 !! options
28733 parsoid=html2wt
28734 !! html/parsoid
28735 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
28736 !! wikitext
28737 [[Special:BookSources/1234567890|ISBN 1234567895]]
28738 !! end
28739
28740 !! test
28741 Edited RFC links not serializable as RFC links should serialize as extlinks
28742 !! options
28743 parsoid=html2wt
28744 !! html/parsoid
28745 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
28746 !! wikitext
28747 [https://tools.ietf.org/html/rfc123 New RFC]
28748 !! end
28749
28750 !! test
28751 Edited PMID links not serializable as PMID links should serialize as extlinks
28752 !! options
28753 parsoid=html2wt
28754 !! html/parsoid
28755 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
28756 !! wikitext
28757 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
28758 !! end
28759
28760 !! test
28761 WTS of autolinks with trailing/surrounding context
28762 !! options
28763 parsoid=html2wt
28764 !! html/parsoid
28765 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
28766 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
28767 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
28768 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
28769 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
28770 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
28771 !! wikitext
28772 http://cscott.net'''foo'''
28773
28774 http://cscott.net<b>foo</b>
28775
28776 '''http://cscott.net'''
28777
28778 '''http://cscott.net '''
28779
28780 '''http://cscott.net<nowiki/>x'''
28781
28782 http://cscott.net<nowiki/>x
28783 !! end
28784
28785 !! test
28786 WTS of autolinks with nowikis (round-trip)
28787 !! wikitext
28788 x<nowiki/>http://cscott.net<nowiki/>x
28789 !! html/parsoid
28790 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
28791 !! end
28792
28793 # this is the "easy" test because it leaves in place all the
28794 # data-parsoid information indicating this is an autolink
28795 !! test
28796 WTS of autolinks with escapes (editing)
28797 !! options
28798 parsoid={
28799 "modes": ["wt2wt"],
28800 "changes": [
28801 [ "span", "remove" ]
28802 ]
28803 }
28804 !! wikitext
28805 x<nowiki/>http://cscott.net<nowiki/>x
28806 !! wikitext/edited
28807 x<nowiki/>http://cscott.net<nowiki/>x
28808 !! end
28809
28810 !! test
28811 WTS of edited autolink-like text (T103364)
28812 !! options
28813 parsoid={
28814 "modes": ["wt2wt"],
28815 "changes": [
28816 [ "span[typeof]", "removeAttr", "typeof" ]
28817 ]
28818 }
28819 !! wikitext
28820 Not a link: <nowiki>http://example.com</nowiki>.
28821 !! wikitext/edited
28822 Not a link: <span><nowiki>http://example.com</nowiki></span>.
28823 !! end
28824
28825 !! test
28826 WTS of newly-authored autolink-like text (T103364)
28827 !! options
28828 parsoid=html2wt
28829 !! html/parsoid
28830 <p>http://example.com is not a link.</p>
28831 !! wikitext
28832 <nowiki>http://example.com</nowiki> is not a link.
28833 !! end
28834
28835 !! test
28836 WTS of autolink-like text after an autolink (T108563)
28837 !! options
28838 parsoid=html2wt
28839 !! html/parsoid
28840 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
28841 !! wikitext
28842 http://example.com <nowiki>http://example.com</nowiki> is not a link.
28843 !! end
28844
28845 !! test
28846 Magic links inside links (not autolinked)
28847 !! wikitext
28848 [[Foo|http://example.com]]
28849 [[Foo|RFC 1234]]
28850 [[Foo|PMID 1234]]
28851 [[Foo|ISBN 123456789x]]
28852
28853 [http://foo.com http://example.com]
28854 [http://foo.com RFC 1234]
28855 [http://foo.com PMID 1234]
28856 [http://foo.com ISBN 123456789x]
28857 !! html+tidy
28858 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
28859 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
28860 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
28861 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
28862 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
28863 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
28864 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
28865 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
28866 </p>
28867 !! html/parsoid
28868 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
28869 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
28870 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
28871 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
28872
28873 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
28874 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
28875 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
28876 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
28877 !! end
28878
28879 !! test
28880 Magic links inside image captions (autolinked)
28881 !! wikitext
28882 [[File:Foobar.jpg|thumb|http://example.com]]
28883 [[File:Foobar.jpg|thumb|RFC 1234]]
28884 [[File:Foobar.jpg|thumb|PMID 1234]]
28885 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
28886 !! html+tidy
28887 <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>
28888 <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>
28889 <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>
28890 <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>
28891 !! html/parsoid
28892 <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>
28893 <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>
28894 <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>
28895 <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>
28896 !! end
28897
28898 !! test
28899 WTS of magic word text (T109371)
28900 !! options
28901 parsoid=html2wt
28902 !! html/parsoid
28903 <p>RFC 1234</p>
28904 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
28905 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28906 !! wikitext
28907 <nowiki>RFC 1234</nowiki>
28908
28909 [http://foo.com RFC 1234]
28910
28911 [[Foo|RFC 1234]]
28912 !! end
28913
28914 !! test
28915 Edited Redirect link should emit a non-piped wikitext link
28916 !! options
28917 parsoid=html2wt
28918 !! html/parsoid
28919 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28920 !! wikitext
28921 #REDIRECT [[Bar]]
28922 !! end
28923
28924 !! test
28925 T75121: Infer extension name from typeOf if data-mw is not present
28926 !! options
28927 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28928 !! html/parsoid
28929 <div typeOf="mw:Extension/foo"></div>
28930 !! wikitext
28931 <foo />
28932 !! end
28933
28934 # Note that the <p> wrapping isn't present in PHP parser output
28935 # The important thing for this test is that P-wrapping doesn't
28936 # interfere with the <nowiki> protection for leading - in <td>
28937 # (which isn't necessary for <th>).
28938 !! test
28939 T88318: p-wrapped dash in table.
28940 !! options
28941 parsoid=html2wt,wt2wt
28942 !! html/parsoid
28943 <table><tbody>
28944 <tr><th><p>-</p></th><th><p>- </p></th></tr>
28945 <tr><td><p>-</p></td><td><p>- </p></td></tr>
28946 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
28947 </tbody></table>
28948 !! wikitext
28949 {|
28950 !-
28951 !-
28952 |-
28953 |<nowiki>-</nowiki>
28954 |<nowiki>- </nowiki>
28955 |-
28956 |<small>-</small>
28957 |<br />
28958 -
28959 |<br />-
28960 |}
28961 !! html/php+tidy
28962 <table>
28963 <tbody><tr>
28964 <th>-
28965 </th>
28966 <th>-
28967 </th></tr>
28968 <tr>
28969 <td>-
28970 </td>
28971 <td>-
28972 </td></tr>
28973 <tr>
28974 <td><small>-</small>
28975 </td>
28976 <td><br />
28977 <p>-
28978 </p>
28979 </td>
28980 <td><br />-
28981 </td></tr></tbody></table>
28982 !! end
28983
28984 !! test
28985 T149209: WTS: Handle newlines in table cells properly
28986 !! options
28987 parsoid=html2wt
28988 !! html/parsoid
28989 <table>
28990 <tbody>
28991 <tr><td>a
28992 b
28993 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
28994 <tr><td><p>x</p>
28995 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
28996 </tbody></table>
28997 <table>
28998 <tbody>
28999 <tr><th>a
29000 b
29001 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
29002 <tr><th><p>x</h>
29003 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
29004 </tbody></table>
29005 !! wikitext
29006 {|
29007 |a
29008 b
29009 |c
29010 |-
29011 |x
29012 {{!}}y
29013 |}
29014 {|
29015 !a
29016 b
29017 !c
29018 |-
29019 !x
29020 !y
29021 |}
29022 !! end
29023
29024 !! test
29025 T149209: Selser: Handle newlines in table cells properly
29026 !! options
29027 parsoid={
29028 "modes": ["selser"],
29029 "changes": [
29030 [ "#h1", "html", "a\nb\n" ],
29031 [ "#h2", "html", "a\nb\n" ],
29032 [ "#c1", "html", "a\nb\n" ],
29033 [ "#c2", "html", "<p>a</p>" ],
29034 [ "#c3", "html", "<p>a</p>" ],
29035 [ "#c4", "html", "edit-me<p>a</p>" ]
29036 ]
29037 }
29038 !! wikitext
29039 {|
29040 ! id="h1" |edit-me!!1
29041 |-
29042 ! id="h2" |edit-me||2
29043 |-
29044 | id="c1" |edit-me||3
29045 |-
29046 | id="c2" |edit-me||4
29047 |-
29048 | id="c3" |edit-me||p||q||r
29049 |-
29050 | id="c4" |edit-me||p||q||r
29051 |}
29052 !! wikitext/edited
29053 {|
29054 ! id="h1" |a
29055 b
29056 !1
29057 |-
29058 ! id="h2" |a
29059 b
29060 !2
29061 |-
29062 | id="c1" |a
29063 b
29064 |3
29065 |-
29066 | id="c2" |a
29067 |4
29068 |-
29069 | id="c3" |a
29070 |p||q||r
29071 |-
29072 | id="c4" |edit-me
29073 a
29074 |p||q||r
29075 |}
29076 !! end
29077
29078 !! test
29079 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
29080 !! options
29081 parsoid=html2wt
29082 !! html/parsoid
29083 <table id='mwAb'>
29084 <td id='mwAc'>foo</td>
29085 <td id='serialize-this'>bar</td>
29086 </table>
29087 !! wikitext
29088 {|
29089 |foo
29090 | id="serialize-this" |bar
29091 |}
29092 !! end
29093
29094 !! test
29095 Parsoid-like element ids should not be serialized to wikitext unless shadowed
29096 !! options
29097 parsoid=html2wt
29098 !! html/parsoid
29099 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
29100 !! wikitext
29101 <div id="hello">ok</div>
29102 !! end
29103
29104 !! test
29105 Testing serialization after deletion in references
29106 !! options
29107 parsoid={
29108 "modes": ["wt2wt"],
29109 "changes": [
29110 ["#x", "remove"]
29111 ]
29112 }
29113 !! wikitext
29114 hi <ref><div id="x">ho</div></ref>
29115
29116 <references />
29117 !! wikitext/edited
29118 hi <ref></ref>
29119
29120 <references />
29121 !! end
29122
29123 !!test
29124 Testing serialization after deletion of table cells
29125 !!options
29126 parsoid={
29127 "modes": ["wt2wt", "selser"],
29128 "changes": [
29129 ["#x", "remove"]
29130 ]
29131 }
29132 !!wikitext
29133 {|
29134 !h1 !!h2 !!h3
29135 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
29136 |}
29137 !! wikitext/edited
29138 {|
29139 !h1!!h2!!h3
29140 |c2|||c3
29141 |}
29142 !!end
29143
29144 !! test
29145 Testing selser after addition of new row before first row (T125419)
29146 !! options
29147 parsoid={
29148 "modes": ["wt2wt", "selser"],
29149 "changes": [
29150 [ "tr", "before", "<tr><td>X</td></tr>" ]
29151 ]
29152 }
29153 !! wikitext
29154 {|
29155 |a
29156 |}
29157 !! wikitext/edited
29158 {|
29159 |X
29160 |-
29161 |a
29162 |}
29163 !! end
29164
29165 !! test
29166 Serialize new table rows in a HTML table using HTML tags
29167 !! options
29168 parsoid={
29169 "modes": ["wt2wt", "selser"],
29170 "changes": [
29171 [ "tr", "before", "<tr><td>X</td></tr>" ]
29172 ]
29173 }
29174 !! wikitext
29175 <table><tr><td>a</td></tr></table>
29176 !! wikitext/edited
29177 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
29178 !! end
29179
29180 !! test
29181 Serialize new table cells in a HTML row using HTML tags
29182 !! options
29183 parsoid={
29184 "modes": ["wt2wt", "selser"],
29185 "changes": [
29186 [ "td", "before", "<td>X</td>" ]
29187 ]
29188 }
29189 !! wikitext
29190 <table><tr><td>a</td></tr></table>
29191 !! wikitext/edited
29192 <table><tr><td>X</td><td>a</td></tr></table>
29193 !! end
29194
29195 !! test
29196 Serialize wikitext list items as HTML list items when embedded in a HTML list
29197 !! options
29198 parsoid=html2wt
29199 !! html
29200 <ul data-parsoid='{"stx": "html"}'>
29201 <li data-parsoid='{}'>a</li>
29202 <li>b</li>
29203 </ul>
29204 !! wikitext
29205 <ul>
29206 <li>a</li>
29207 <li>b</li>
29208 </ul>
29209 !! end
29210
29211 # SSS FIXME: Is this actually a good thing given the
29212 # odd nested list output that is generated by MW?
29213 # <ul><li>foo<ul>..</ul></li></ul> instead of
29214 # <ul><li>foo</li><ul>..</ul></ul>
29215 !! test
29216 Wikitext lists can be nested inside HTML lists
29217 !! options
29218 parsoid=html2wt
29219 !! html
29220 <ul data-parsoid='{"stx": "html"}'>
29221 <li data-parsoid='{"stx": "html"}'>a
29222 <ul><li>b</li></ul>
29223 </li>
29224 </ul>
29225
29226 <ul data-parsoid='{"stx": "html"}'>
29227 <li>x
29228 <ul><li>y</li></ul>
29229 </li>
29230 </ul>
29231 !! wikitext
29232 <ul>
29233 <li>a
29234 * b
29235 </li>
29236 </ul>
29237
29238 <ul>
29239 <li>x
29240 * y
29241 </li>
29242 </ul>
29243 !! end
29244
29245 !! test
29246 WTS change modes
29247 !! options
29248 parsoid={
29249 "modes": ["wt2wt"],
29250 "changes": [
29251 [ "#xyz", "before", "<b>before</b> stuff " ],
29252 [ "#xyz", "after", " stuff <i>after</i>" ],
29253 [ "#xyz", "html", "x <b>y</b> z" ]
29254 ]
29255 }
29256 !! wikitext
29257 <span id="xyz">hello</span>
29258 !! wikitext/edited
29259 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
29260 !! end
29261
29262 !! test
29263 Never serialize a-tag as html, regardless of what data-parsoid has to say
29264 !! options
29265 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29266 !! html/parsoid
29267 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
29268 !! wikitext
29269 [[Foo]]
29270 !! end
29271
29272 ## SSS FIXME: This is broken output nevertheless.
29273 ## What might be a reasonable non-broken output for this?
29274 ## This is an edge case unlikely to be seen in production
29275 ## that I am not wasting more time on this right now.
29276 !! test
29277 Never serialize a-tag as html, no matter what attributes it has
29278 !! options
29279 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29280 !! html/parsoid
29281 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
29282 !! wikitext
29283 [http://boo.org http://boohoo.org]
29284 !! end
29285
29286 # Misnested is an indication that selser can reuse the source but these have
29287 # shown to sneak through on occasion. See T101768.
29288 # The original wikitext here is: [http://test.com [[one]] two three]
29289 !! test
29290 Strip span tags added to mark misnested links
29291 !! options
29292 parsoid=html2wt
29293 !! html/parsoid
29294 <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>
29295 !! wikitext
29296 [http://test.com][[one]] two three
29297 !! end
29298
29299 !! test
29300 Catch regression when unpacking misnested links
29301 !! options
29302 parsoid=wt2html
29303 !! wikitext
29304 {{echo|hi}}[http://example.com [[ho]]]
29305 !! html/parsoid
29306 <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>
29307 !! end
29308
29309 !! test
29310 Catch regression when unpacking with trailing content
29311 !! wikitext
29312 {{echo|Foo <references/> bar}}
29313 !! html/parsoid
29314 <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>
29315 !! end
29316
29317 !! test
29318 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
29319 !! options
29320 parsoid=html2wt
29321 !! html/parsoid
29322 <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|}"]}'>
29323 <tbody><tr><td>d
29324 </td></tr>
29325 </tbody></table>
29326 !! wikitext
29327 {{echo|a}}
29328 {|{{echo|c
29329 {{!}}d
29330 }}
29331 |}
29332 !! end
29333
29334 ## This test verifies the presence and computation of this attribute indirectly
29335 ## by making an edit and ensuring that the serialization is correct (which it would be
29336 ## only if firstWikitextNode is properly set).
29337 !! test
29338 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
29339 !! options
29340 parsoid= {
29341 "modes": ["wt2wt"],
29342 "changes": [
29343 [ "div#x", "remove" ],
29344 [ "div", "before", "<div>new</div>" ]
29345 ]
29346 }
29347 !! wikitext
29348 <div id="x">foo</div>
29349 {|
29350 {{echo|<div>boo</div>
29351 {{!}}b}}
29352 |c
29353 |}
29354 !! wikitext/edited
29355
29356 <div>new</div>
29357 {|
29358 {{echo|<div>boo</div>
29359 {{!}}b}}
29360 |c
29361 |}
29362 !! end
29363
29364 # --------------------------------------------
29365 # Tests spec'ing wikitext serialization norms |
29366 # --------------------------------------------
29367
29368 !! test
29369 Serialize multi-line indent-pre starting with wikitext syntax
29370 !! options
29371 parsoid=html2wt
29372 !! html/parsoid
29373 <pre>* 1
29374 ** 2
29375 * 3</pre>
29376 !! wikitext
29377 * 1
29378 ** 2
29379 * 3
29380 !! end
29381
29382 !! test
29383 1. Categories should always be serialized on their own line
29384 !! options
29385 parsoid=html2wt
29386 !! html/parsoid
29387 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
29388 !! wikitext
29389 foo
29390 [[Category:Foo]]
29391 bar
29392 !! end
29393
29394 !! test
29395 2. Categories that are part of templates should not introduce a line break
29396 !! wikitext
29397 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
29398 !! html/parsoid
29399 <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>
29400 !! end
29401
29402 # Careful while editing these next 2 tests. There are \u200f characters
29403 # before and after the <link> tags in the HTML and following some
29404 # of the categories in wikitext
29405 # Do not remove these characters in edits.
29406 #
29407 # As part of the serialization, these bidi characters will get stripped.
29408 !! test
29409 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
29410 !! options
29411 parsoid={
29412 "modes": ["html2wt"],
29413 "scrubWikitext": true
29414 }
29415 !! html/parsoid
29416 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
29417 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
29418 !! wikitext
29419 [[קטגוריה:טקסים]]
29420 [[קטגוריה: שיטות משפט]]
29421 !! end
29422
29423 !! test
29424 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
29425 !! options
29426 parsoid={
29427 "modes": ["html2wt"],
29428 "scrubWikitext": true
29429 }
29430 !! html/parsoid
29431 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
29432 !! wikitext
29433 [[קטגוריה:טקסים]]
29434 ‏y
29435 !! end
29436
29437 !! test
29438 Lists: Add space after bullets
29439 !! options
29440 parsoid=html2wt
29441 !! html/parsoid
29442 <ul>
29443 <li>foo</li>
29444 <li> bar</li>
29445 <li><span> baz</span></li>
29446 </ul>
29447 !! wikitext
29448 * foo
29449 * bar
29450 * <span> baz</span>
29451 !! end
29452
29453 !! test
29454 1. Headings: Add space before/after == (T53744)
29455 !! options
29456 parsoid=html2wt
29457 !! html/parsoid
29458 <h2>foo</h2>
29459 <h2> bar</h2>
29460 <h2>baz </h2>
29461 <h2><span> baz</span></h2>
29462 !! wikitext
29463 == foo ==
29464
29465 == bar ==
29466
29467 == baz ==
29468
29469 == <span> baz</span> ==
29470 !! end
29471
29472 !! test
29473 2. Headings: Add space before/after == even after hoisted content
29474 !! options
29475 parsoid={
29476 "modes": ["html2wt"],
29477 "scrubWikitext": true
29478 }
29479 !! html/parsoid
29480 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
29481 !! wikitext
29482 [[Category:A2]]
29483
29484 == ok ==
29485 !! end
29486
29487 !! test
29488 1. Headings: suppress newly created empty headings
29489 !! options
29490 parsoid={
29491 "modes": ["html2wt"],
29492 "scrubWikitext": true
29493 }
29494 !! html/parsoid
29495 <h2></h2>
29496 !! wikitext
29497 !! end
29498
29499 !! test
29500 2. Headings: don't suppress empty headings if scrubWikitext is false
29501 !! options
29502 parsoid=html2wt
29503 !! html/parsoid
29504 <h2></h2>
29505 !! wikitext
29506 ==<nowiki/>==
29507 !! end
29508
29509 !! test
29510 3. Headings: suppress empty headings on edits
29511 !! options
29512 parsoid={
29513 "modes": ["selser"],
29514 "scrubWikitext": true,
29515 "changes": [
29516 [ "#x", "remove"]
29517 ]
29518 }
29519 !! wikitext
29520 ==<span id="x">foo</span>==
29521 !! wikitext/edited
29522 !! end
29523
29524 !! test
29525 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
29526 !! options
29527 parsoid={
29528 "modes": ["html2wt"],
29529 "scrubWikitext": true
29530 }
29531 !! html/parsoid
29532 <h2>foo<br/>bar</h2>
29533 <h2>foo <span><br/>bar</span> baz</h2>
29534 !! wikitext
29535 == foo bar ==
29536
29537 == foo <span> bar</span> baz ==
29538 !! end
29539
29540 !! test
29541 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
29542 !! options
29543 parsoid={
29544 "modes": ["html2wt"],
29545 "scrubWikitext": false
29546 }
29547 !! html/parsoid
29548 <h2>foo<br/>bar</h2>
29549 !! wikitext
29550 == foo<br />bar ==
29551 !! end
29552
29553 !! test
29554 1. WT Quote Tags: suppress newly created empty style tags
29555 !! options
29556 parsoid={
29557 "modes": ["html2wt"],
29558 "scrubWikitext": true
29559 }
29560 !! html/parsoid
29561 <i></i><b></b>
29562 !! wikitext
29563 !! end
29564
29565 !! test
29566 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
29567 !! options
29568 parsoid=html2wt
29569 !! html/parsoid
29570 <i></i><b></b>
29571 !! wikitext
29572 ''<nowiki/>'''''<nowiki/>'''
29573 !! end
29574
29575 !! test
29576 3. WT Quote Tags: suppress empty style tags on edits
29577 !! options
29578 parsoid={
29579 "modes": ["selser"],
29580 "scrubWikitext": true,
29581 "changes": [
29582 [ "#x", "remove"]
29583 ]
29584 }
29585 !! wikitext
29586 '''<span id="x">foo</span>'''
29587 !! wikitext/edited
29588 !! end
29589
29590 !! test
29591 1. Anchors: suppress newly created empty anchors
29592 !! options
29593 parsoid={
29594 "modes": ["html2wt"],
29595 "scrubWikitext": true
29596 }
29597 !! html/parsoid
29598 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29599 !! wikitext
29600 !! end
29601
29602 !! test
29603 2. Anchors: don't suppress empty anchors if scrubWikitext is false
29604 !! options
29605 parsoid={
29606 "modes": ["html2wt"],
29607 "scrubWikitext": false
29608 }
29609 !! html/parsoid
29610 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29611 !! wikitext
29612 [[Test|<nowiki/>]]
29613 !! end
29614
29615 !! test
29616 3. Anchors: suppress empty anchors on edits
29617 !! options
29618 parsoid={
29619 "modes": ["selser"],
29620 "scrubWikitext": true,
29621 "changes": [
29622 [ "#x", "remove"]
29623 ]
29624 }
29625 !! wikitext
29626 [[Test|<span id="x">foo</span>]]
29627 !! wikitext/edited
29628 !! end
29629
29630 !! test
29631 3a. Anchors: do not suppress numbered extlinks
29632 !! options
29633 parsoid={
29634 "modes": ["wt2wt"],
29635 "scrubWikitext": true
29636 }
29637 !! wikitext
29638 [http://foo.com]
29639 !! html/parsoid
29640 <a rel="mw:ExtLink" href="http://foo.com"></a>
29641 !! end
29642
29643 !! test
29644 3b. Anchors: do not suppress numbered extlinks
29645 !! options
29646 parsoid={
29647 "modes": ["wt2wt"],
29648 "scrubWikitext": true,
29649 "changes": [
29650 [ "#x", "remove"]
29651 ]
29652 }
29653 !! wikitext
29654 [http://foo.com <span id="x">foo</span>]
29655 !! wikitext/edited
29656 [http://foo.com]
29657 !! end
29658
29659 !!test
29660 Normalizations should be restricted to edited content
29661 !!options
29662 parsoid={
29663 "modes": ["selser"],
29664 "scrubWikitext": true,
29665 "changes": [
29666 [ "h1", "before", "<i></i>"]
29667 ]
29668 }
29669 !!wikitext
29670 a
29671 = =
29672 b
29673 !!wikitext/edited
29674 a
29675 = =
29676 b
29677 !!end
29678
29679 !! test
29680 1. Multiple normalizations (html2wt)
29681 !! options
29682 parsoid={
29683 "modes": ["html2wt"],
29684 "scrubWikitext": true
29685 }
29686 !! html
29687 <h2><i></i></h2>
29688 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
29689 </a><b><i></i></b>x</p>
29690 !! wikitext
29691
29692 [[foo]]
29693 x
29694
29695 !! end
29696
29697 !! test
29698 2. Multiple normalizations (selser)
29699 !! options
29700 parsoid={
29701 "modes": ["selser"],
29702 "scrubWikitext": true,
29703 "changes": [
29704 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
29705 ]
29706 }
29707 !! wikitext
29708 <span id="x">foo</span>
29709 !! wikitext/edited
29710 <span id="x">foo</span>
29711
29712 x
29713 !! end
29714
29715 !! test
29716 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
29717 !! options
29718 parsoid={
29719 "modes": ["html2wt"],
29720 "scrubWikitext": true
29721 }
29722 !! html/parsoid
29723 <p> hi</p>
29724 <p> hello</p>
29725 !! wikitext
29726 hi
29727
29728 hello
29729 !! end
29730
29731 !! test
29732 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
29733 !! options
29734 parsoid=html2wt
29735 !! html/parsoid
29736 <p> hi</p>
29737 <p> hello</p>
29738 !! wikitext
29739 <nowiki> </nowiki>hi
29740
29741 <nowiki> </nowiki> hello
29742 !! end
29743
29744 !! test
29745 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
29746 !! options
29747 parsoid={
29748 "modes": ["html2wt"],
29749 "scrubWikitext": true
29750 }
29751 !! html/parsoid
29752 <p>Foo
29753 bar
29754 baz</p>
29755
29756 <table><tr><td>Foo
29757 bar
29758 baz bang</td></tr></table>
29759
29760 <p><!--boo--> foo
29761 bar</p>
29762
29763 <p> foo
29764 bar<span>boo</span></p>
29765 !! wikitext
29766 Foo
29767 bar
29768 baz
29769
29770 {|
29771 |Foo
29772 bar
29773 baz bang
29774 |}
29775
29776 <!--boo-->foo
29777 bar
29778
29779 foo
29780 bar<span>boo</span>
29781 !! end
29782
29783 !! test
29784 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
29785 !! options
29786 parsoid={
29787 "modes": ["selser"],
29788 "scrubWikitext": true,
29789 "changes": [
29790 [ "p", "html", " a\n b" ]
29791 ]
29792 }
29793 !! wikitext
29794 xyz
29795 !! wikitext/edited
29796 a
29797 b
29798 !! end
29799
29800 !! test
29801 1. New links that end in spaces
29802 !! options
29803 parsoid={
29804 "modes": ["html2wt"],
29805 "scrubWikitext": false
29806 }
29807 !! html/parsoid
29808 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29809 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29810 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29811 !! wikitext
29812 [[Berlin ]]<nowiki/>is the capital of Germany.
29813
29814 [[Foo ]]'''bar'''
29815
29816 [[Boston ]] is a city.
29817 !! end
29818
29819 !! test
29820 2. New links that end in spaces
29821 !! options
29822 parsoid={
29823 "modes": ["html2wt"],
29824 "scrubWikitext": true
29825 }
29826 !! html/parsoid
29827 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29828 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29829 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29830 !! wikitext
29831 [[Berlin]] is the capital of Germany.
29832
29833 [[Foo]] '''bar'''
29834
29835 [[Boston]] is a city.
29836 !! end
29837
29838 !! test
29839 1. Table cells with escapable prefixes
29840 !! options
29841 parsoid={
29842 "modes": ["html2wt"],
29843 "scrubWikitext": false
29844 }
29845 !! html
29846 <table>
29847 <tr><td>a</td></tr>
29848 <tr><td>-</td></tr>
29849 <tr><td>+</td></tr>
29850 </table>
29851 !! wikitext
29852 {|
29853 |a
29854 |-
29855 |<nowiki>-</nowiki>
29856 |-
29857 |<nowiki>+</nowiki>
29858 |}
29859 !! end
29860
29861 !! test
29862 2. Table cells with escapable prefixes
29863 !! options
29864 parsoid={
29865 "modes": ["html2wt"],
29866 "scrubWikitext": true
29867 }
29868 !! html
29869 <table>
29870 <tr><td>a</td></tr>
29871 <tr><td>-</td></tr>
29872 <tr><td>+</td></tr>
29873 </table>
29874 !! wikitext
29875 {|
29876 |a
29877 |-
29878 | -
29879 |-
29880 | +
29881 |}
29882 !! end
29883
29884 !! test
29885 3a. Table cells with escapable prefixes after edits
29886 !! options
29887 parsoid={
29888 "modes": ["selser"],
29889 "scrubWikitext": true,
29890 "changes": [
29891 [ "table tbody tr:first-child td:first-child", "remove"]
29892 ]
29893 }
29894 !! wikitext
29895 {|
29896 |a||-
29897 |}
29898 !! wikitext/edited
29899 {|
29900 | -
29901 |}
29902 !! end
29903
29904 !! test
29905 3b. Table cells with escapable prefixes after edits
29906 !! options
29907 parsoid={
29908 "modes": ["selser"],
29909 "scrubWikitext": true,
29910 "changes": [
29911 [ "table tbody tr:first-child td:first-child", "html", "-" ],
29912 [ "#x", "remove" ]
29913 ]
29914 }
29915 !! wikitext
29916 {|
29917 |pqr
29918 |<span id="x">foo</span>+
29919 |}
29920 !! wikitext/edited
29921 {|
29922 | -
29923 | +
29924 |}
29925 !! end
29926
29927 # FIXME: This test will fail because
29928 # normalization doesn't realize that the id attribute
29929 # will eliminate the escapable scenario
29930 !! test
29931 4a. Table cells without escapable prefixes after edits
29932 !! options
29933 parsoid={
29934 "modes": ["selser"],
29935 "scrubWikitext": true,
29936 "changes": [
29937 [ "#x", "html", "-" ]
29938 ]
29939 }
29940 !! wikitext
29941 {|
29942 | id="x" |abcd
29943 |}
29944 !! wikitext/edited
29945 {|
29946 | id="x" |-
29947 |}
29948 !! end
29949
29950 ## This tests normalizer's ability to discriminate between
29951 ## cells having identical content.
29952 !! test
29953 4b. Table cells without escapable prefixes after edits
29954 !! options
29955 parsoid={
29956 "modes": ["selser"],
29957 "scrubWikitext": true,
29958 "changes": [
29959 [ "td", "html", "-" ]
29960 ]
29961 }
29962 !! wikitext
29963 {|
29964 |a||b
29965 |}
29966 !! wikitext/edited
29967 {|
29968 | -||-
29969 |}
29970 !! end
29971
29972 ## This tests normalizer's ability to not be tripped by
29973 ## comments (and whitespace)
29974 !! test
29975 4c. Table cells without escapable prefixes after edits
29976 !! options
29977 parsoid={
29978 "modes": ["selser"],
29979 "scrubWikitext": true,
29980 "changes": [
29981 [ "table tbody tr td:first-child", "remove" ]
29982 ]
29983 }
29984 !! wikitext
29985 {|
29986 |-
29987 <!--foo--> |a||-
29988 |}
29989 !! wikitext/edited
29990 {|
29991 |-
29992 <!--foo--> | -
29993 |}
29994 !! end
29995
29996 ## This tests normalizer's ability to handle HTML cells
29997 !! test
29998 4d. Table cells without escapable prefixes after edits
29999 !! options
30000 parsoid={
30001 "modes": ["selser"],
30002 "scrubWikitext": true,
30003 "changes": [
30004 [ "td", "html", "-" ]
30005 ]
30006 }
30007 !! wikitext
30008 <table>
30009 <tr><td>a</td></tr>
30010 </table>
30011 !! wikitext/edited
30012 <table>
30013 <tr><td>-</td></tr>
30014 </table>
30015 !! end
30016
30017 ## T111151 Remove font elements without attributes
30018 !! test
30019 5a. font tags without attributes should be dropped in scrubWikitext mode
30020 !! options
30021 parsoid={
30022 "modes": ["html2wt"],
30023 "scrubWikitext": true
30024 }
30025 !! html
30026 <font>foo</font>
30027 <font><font>bar</font></font>
30028 <font class="x">boo</font>
30029 !! wikitext
30030 foo
30031 bar
30032 <font class="x">boo</font>
30033 !! end
30034
30035 !! test
30036 5b. font tags should not be dropped without scrubWikitext being enabled
30037 !! options
30038 parsoid={
30039 "modes": ["html2wt"],
30040 "scrubWikitext": false
30041 }
30042 !! html
30043 <font>foo</font>
30044 !! wikitext
30045 <font>foo</font>
30046 !! end
30047
30048 !! test
30049 Escape nowiki DOM elements
30050 !! options
30051 parsoid=html2wt
30052 !! html/parsoid
30053 <nowiki><i>foo</i></nowiki>
30054 !! wikitext
30055 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
30056 !! end
30057
30058 # This is meant to be an interim fix while we go about figuring out
30059 # how to not introduce these trailing <nowiki/>s in the first place.
30060 !! test
30061 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
30062 !! options
30063 parsoid=html2wt
30064 !! html/parsoid
30065 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
30066 y</p>
30067 <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>
30068 <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>
30069 !! wikitext
30070 x
30071 y
30072
30073 {{echo|
30074 1 = <nowiki/>}}
30075
30076 {{echo|
30077 1 = <nowiki/>
30078 }}
30079 !! end
30080
30081 !! test
30082 New list is serialized on newlines
30083 !! options
30084 parsoid=html2wt
30085 !! html/parsoid
30086 <p>The quick brown fox jumps over the lazy dog.</p><ul>
30087 <li>Yesterday</li>
30088 <li>Today</li>
30089 <li>Tomorrow</li>
30090 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
30091 !! wikitext
30092 The quick brown fox jumps over the lazy dog.
30093
30094 * Yesterday
30095 * Today
30096 * Tomorrow
30097
30098 The quick onyx goblin jumps over the lazy dwarf.
30099 !! end
30100
30101 !! test
30102 New lists in formatting elements serialized w/o newlines
30103 !! options
30104 parsoid=html2wt
30105 !! html/parsoid
30106 <small>
30107
30108 <ul>
30109 <li>123</li>
30110 </ul>
30111
30112 </small>
30113
30114 <small><ul><li>hi</li></ul></small>
30115 !! wikitext
30116 <small>
30117 * 123
30118 </small>
30119
30120 <small>
30121 * hi
30122 </small>
30123 !! end
30124
30125 !! test
30126 New list in table doesn't need newlines
30127 !! options
30128 parsoid=html2wt
30129 !! html/parsoid
30130 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
30131 !! wikitext
30132 {|
30133 |
30134 * test
30135 * 123
30136 |}
30137 !! end
30138
30139 # ---------------------------------------------------
30140 # End of tests spec'ing wikitext serialization norms |
30141 # ---------------------------------------------------
30142
30143 # T104032
30144 !! test
30145 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
30146 !! options
30147 parsoid=html2wt
30148 !! html/parsoid
30149 a<p>b</p>
30150 <b>c</b><p>d</p>
30151 <table><tr>
30152 <td>a<p>b</p></td>
30153 <td><b>c</b><p>d</p></td>
30154 </tr></table>
30155 !! wikitext
30156 a
30157
30158 b
30159
30160 '''c'''
30161
30162 d
30163 {|
30164 |a
30165 b
30166 |'''c'''
30167 d
30168 |}
30169 !! end
30170
30171 !! test
30172 Anchor without href scenarios
30173 !! options
30174 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30175 !! html/parsoid
30176 <a class="bc"></a>
30177 <a class="no">dice</a>
30178 <a name="foo"></a>
30179 !! wikitext
30180
30181 dice
30182 <span name="foo"></span>
30183 !! end
30184
30185 !! test
30186 New transclusion added after a list should be serialized after the list
30187 !! options
30188 parsoid=html2wt
30189 !! html/parsoid
30190 <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>
30191 !! wikitext
30192 * a
30193 {{echo|foo}}
30194 !! end
30195
30196 # -----------------------------------------------------------------
30197 # End of section for Parsoid-only html2wt tests for serialization
30198 # of new content
30199 # -----------------------------------------------------------------
30200
30201 # -----------------------------------------------------------------
30202 # The following section of tests are primarily to spec behavior of
30203 # the selective serializer. All these tests have manual selser
30204 # changes. The automated selser changes for all tests handle the
30205 # wide variation of changes, but these tests here capture specs
30206 # deterministically.
30207 # ----------------------------------------------------------------
30208
30209 ## T90517
30210 !! test
30211 Selser: New comments should not be lost
30212 !! options
30213 parsoid={
30214 "modes": ["selser"],
30215 "changes": [
30216 [ "#a", "after", "<!--c1-->" ],
30217 [ "#b", "before", "<!--c2-->" ]
30218 ]
30219 }
30220 !! wikitext
30221 <span id="a">a</span>
30222
30223 <span id="b">b</span>
30224 !! wikitext/edited
30225 <span id="a">a</span><!--c1-->
30226
30227 <!--c2--><span id="b">b</span>
30228 !! end
30229
30230 ## T89383
30231 !! test
30232 Selser: Check for validity of DSR before using it
30233 !! options
30234 parsoid={
30235 "modes": ["selser"],
30236 "changes": [
30237 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
30238 ]
30239 }
30240 !! wikitext
30241 <span id="a">a</span>
30242 !! wikitext/edited
30243 {{DISPLAYTITLE:foo}}
30244 <span id="a">a</span>
30245 !! end
30246
30247 !! test
30248 1. DOMDiff: Changes to <ref> content should be looked up using id
30249 !! options
30250 parsoid={
30251 "modes": ["selser"],
30252 "changes": [
30253 ["#X", "after", "bar"],
30254 ["#Y", "after", "baz"]
30255 ]
30256 }
30257 !! wikitext
30258 X <ref><span id="X">foo</span></ref>
30259 Y <ref name="a" />
30260 <references>
30261 <ref name="a"><span id="Y">foo</span></ref>
30262 </references>
30263 !! wikitext/edited
30264 X <ref><span id="X">foo</span>bar</ref>
30265 Y <ref name="a" />
30266 <references>
30267 <ref name="a"><span id="Y">foo</span>baz</ref>
30268 </references>
30269 !! end
30270
30271 !! test
30272 2. DOMDiff: Changes to <ref> content should be looked up using id
30273 !! options
30274 parsoid={
30275 "modes": ["selser"],
30276 "changes": [
30277 ["#Z", "after", "bar"]
30278 ]
30279 }
30280 !! wikitext
30281 A <ref>foo bar for a</ref>
30282 B <ref group="X" name="b" />
30283
30284 <references />
30285
30286 <references group="X">
30287 <ref name="b"><span id="Z">foo</span></ref>
30288 </references>
30289 !! wikitext/edited
30290 A <ref>foo bar for a</ref>
30291 B <ref group="X" name="b" />
30292
30293 <references />
30294
30295 <references group="X">
30296 <ref name="b"><span id="Z">foo</span>bar</ref>
30297 </references>
30298 !! end
30299
30300 !! test
30301 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
30302 !! options
30303 parsoid={
30304 "modes": ["selser"],
30305 "changes": [
30306 [ "div:first-child", "text", "bar" ]
30307 ]
30308 }
30309 !! wikitext
30310 <div style="{{1x|color:red;}}%">foo</div>
30311 !! wikitext/edited
30312 <div style="{{1x|color:red;}}%">bar</div>
30313 !! end
30314
30315 !! test
30316 Empty LI (T49673)
30317 !! wikitext
30318 *a
30319 *
30320 *
30321 *b
30322 !! html+tidy
30323 <ul><li>a</li>
30324 <li class="mw-empty-elt"></li>
30325 <li class="mw-empty-elt"></li>
30326 <li>b</li></ul>
30327 !! end
30328
30329 !! test
30330 Thumbnail output
30331 !! wikitext
30332 [[File:Thumb.png|thumb]]
30333 !! html/php+tidy
30334 <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>
30335 !! html/parsoid
30336 <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>
30337 !! end
30338
30339 !! test
30340 unclosed internal link XSS (T137264)
30341 !! wikitext
30342 [[#%3Cscript%3Ealert(1)%3C/script%3E|
30343 !! html/php
30344 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
30345 </p>
30346 !! html/parsoid
30347 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
30348 !! end
30349
30350 !! test
30351 Validating that <style> isn't eaten by tidy (T167349)
30352 !! options
30353 styletag=1
30354 !! wikitext
30355 <div class="foo">
30356 <style>.foo::before { content: "<foo>"; }</style>
30357 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
30358 </div>
30359 !! html/php+tidy
30360 <div class="foo">
30361 <style>.foo::before { content: "<foo>"; }</style>
30362 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
30363 </div>
30364 !! end
30365
30366 !! test
30367 Validating that <style> isn't wrapped in a paragraph (T186965)
30368 !! options
30369 styletag=1
30370 !! wikitext
30371 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30372
30373 <style>.foo::before { content: "<foo>"; }</style>
30374
30375 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
30376
30377 But if it's on a line with other content, let it be wrapped.
30378
30379 <style>.foo::before { content: "<foo>"; }</style> bar
30380
30381 foo <style>.foo::before { content: "<foo>"; }</style>
30382
30383 foo <style>.foo::before { content: "<foo>"; }</style> bar
30384
30385 And the same if we have non-paragraph-breaking whitespace
30386
30387 foo
30388 <style>.foo::before { content: "<foo>"; }</style>
30389 bar
30390 !! html/php
30391 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30392 </p>
30393 <style>.foo::before { content: "<foo>"; }</style>
30394 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
30395 <p>But if it's on a line with other content, let it be wrapped.
30396 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
30397 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
30398 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
30399 </p><p>And the same if we have non-paragraph-breaking whitespace
30400 </p><p>foo
30401 <style>.foo::before { content: "<foo>"; }</style>
30402 bar
30403 </p>
30404 !! end
30405
30406 !! test
30407 Validating that <link> isn't wrapped in a paragraph (T186965)
30408 !! options
30409 styletag=1
30410 !! wikitext
30411 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30412
30413 <link rel="foo" href="bar"/>
30414
30415 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
30416
30417 But if it's on a line with other content, let it be wrapped.
30418
30419 <link rel="foo" href="bar"/> bar
30420
30421 foo <link rel="foo" href="bar"/>
30422
30423 foo <link rel="foo" href="bar"/> bar
30424
30425 And the same if we have non-paragraph-breaking whitespace
30426
30427 foo
30428 <link rel="foo" href="bar"/>
30429 bar
30430 !! html/php
30431 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30432 </p>
30433 <link rel="foo" href="bar"/>
30434 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
30435 <p>But if it's on a line with other content, let it be wrapped.
30436 </p><p><link rel="foo" href="bar"/> bar
30437 </p><p>foo <link rel="foo" href="bar"/>
30438 </p><p>foo <link rel="foo" href="bar"/> bar
30439 </p><p>And the same if we have non-paragraph-breaking whitespace
30440 </p><p>foo
30441 <link rel="foo" href="bar"/>
30442 bar
30443 </p>
30444 !! end
30445
30446 !! test
30447 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
30448 !! config
30449 wgFragmentMode=[ 'html5', 'legacy' ]
30450 !! wikitext
30451 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
30452 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
30453 !! html/php
30454 <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>
30455 <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>
30456 </p>
30457 !! html/parsoid
30458 <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>
30459 <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>
30460 !! end
30461
30462 !! test
30463 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
30464 !! config
30465 wgFragmentMode=[ 'legacy' ]
30466 !! wikitext
30467 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
30468 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
30469 !! html/php
30470 <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>
30471 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
30472 </p>
30473 !! end
30474
30475 !! test
30476 Decoding of HTML entities in embedded HTML tags
30477 !! wikitext
30478 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
30479 !! html/php
30480 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
30481
30482 !! html/parsoid
30483 <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>
30484 !! end
30485
30486 !! test
30487 Decoding of HTML entities in indicator names for IDs (T104196)
30488 !! options
30489 parsoid=wt2html,html2html
30490 showindicators
30491 !! wikitext
30492 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
30493 !! html/php
30494 1&2&3&amp;4&amp;amp;5=Indicator
30495
30496 !! html/parsoid
30497 <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>
30498 !! end
30499
30500 # this version of the test strips out the ambiguity so Parsoid rts cleanly
30501 !! test
30502 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
30503 !! options
30504 showindicators
30505 !! wikitext
30506 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
30507 !! html/php
30508 1&2&3&amp;4&amp;amp;5=Indicator
30509
30510 !! html/parsoid
30511 <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>
30512 !! end
30513
30514 # This fragment mode is what Parsoid supports.
30515 !! test
30516 HTML5 ids: fallback to legacy
30517 !! config
30518 wgFragmentMode=[ 'html5', 'legacy' ]
30519 !! wikitext
30520 ==Foo bar==
30521
30522 ==foo Bar==
30523
30524 ==Тест==
30525
30526 ==Тест==
30527
30528 ==тест==
30529
30530 ==Hey < # " > % : '==
30531 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30532
30533 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30534
30535 <!-- These two links should produce identical HTML -->
30536 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30537
30538 !! html/php
30539 <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>
30540 <ul>
30541 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30542 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30543 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30544 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30545 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30546 <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>
30547 </ul>
30548 </div>
30549
30550 <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>
30551 <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>
30552 <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>
30553 <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>
30554 <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>
30555 <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>
30556 <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>
30557 </p><p>💩 <span id="💩"></span>
30558 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30559 </p>
30560 !! html/parsoid
30561 <h2 id="Foo_bar">Foo bar</h2>
30562
30563 <h2 id="foo_Bar_2">foo Bar</h2>
30564
30565 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
30566
30567 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
30568
30569 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
30570
30571 <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>
30572 <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>
30573
30574 <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>
30575
30576 <!-- These two links should produce identical HTML -->
30577 <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>
30578 !! end
30579
30580 # Parsoid doesn't support this mode
30581 !! test
30582 HTML5 ids: legacy with a fallback to modern
30583 !! config
30584 wgFragmentMode=[ 'legacy', 'html5' ]
30585 !! wikitext
30586 ==Foo bar==
30587
30588 ==foo Bar==
30589
30590 ==Тест==
30591
30592 ==Тест==
30593
30594 ==тест==
30595
30596 ==Hey < # " > % : '==
30597 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30598
30599 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30600
30601 <!-- These two links should produce identical HTML -->
30602 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30603
30604 !! html/php
30605 <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>
30606 <ul>
30607 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30608 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30609 <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>
30610 <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>
30611 <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>
30612 <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>
30613 </ul>
30614 </div>
30615
30616 <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>
30617 <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>
30618 <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>
30619 <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>
30620 <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>
30621 <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>
30622 <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>
30623 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
30624 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
30625 </p>
30626 !! end
30627
30628 # Parsoid doesn't support this mode.
30629 !! test
30630 HTML5 ids: no legacy
30631 !! config
30632 wgFragmentMode=[ 'html5' ]
30633 !! wikitext
30634 ==Foo bar==
30635
30636 ==foo Bar==
30637
30638 ==Тест==
30639
30640 ==Тест==
30641
30642 ==тест==
30643
30644 ==Hey < # " > % : '==
30645 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30646
30647 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30648
30649 <!-- These two links should produce identical HTML -->
30650 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30651
30652 !! html/php
30653 <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>
30654 <ul>
30655 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30656 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30657 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30658 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30659 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30660 <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>
30661 </ul>
30662 </div>
30663
30664 <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>
30665 <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>
30666 <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>
30667 <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>
30668 <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>
30669 <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>
30670 <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>
30671 </p><p>💩 <span id="💩"></span>
30672 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30673 </p>
30674 !! end
30675
30676 !! test
30677 T90902: Normalize weird characters in section IDs
30678 !! config
30679 wgFragmentMode=[ 'html5', 'legacy' ]
30680 !! wikitext
30681 ==Foo&nbsp;bar==
30682 [[#Foo&nbsp;bar]]
30683
30684 !! html/php
30685 <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>
30686 <p><a href="#Foo_bar">#Foo&#160;bar</a>
30687 </p>
30688 !! html/parsoid
30689 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
30690 <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>
30691 !! end
30692
30693 !! test
30694 T51672: Test for brackets in attributes of elements in external link texts
30695 !! wikitext
30696 [http://example.com/ link <span title="title with [brackets]">span</span>]
30697 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
30698
30699 !! html/php
30700 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
30701 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
30702 </p>
30703 !! html/parsoid
30704 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
30705 <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>
30706 !! end
30707
30708 !! test
30709 T72875: Test for brackets in attributes of elements in internal link texts
30710 !! wikitext
30711 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
30712 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
30713
30714 !! html/php
30715 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30716 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30717 </p>
30718 !! html/parsoid
30719 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
30720 <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>
30721 !! end
30722
30723 !! test
30724 T179544: {{anchorencode:}} output should be always usable in links
30725 !! config
30726 wgFragmentMode=[ 'html5' ]
30727 !! wikitext
30728 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
30729 !! html/php
30730 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
30731 </p>
30732 !! html/parsoid
30733 <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>
30734 !! end
30735
30736 ## ------------------------------
30737 ## Parsoid section-wrapping tests
30738 ## ------------------------------
30739 !! test
30740 Section wrapping for well-nested sections (no leading content)
30741 !! options
30742 parsoid={
30743 "wrapSections": true
30744 }
30745 !! wikitext
30746 =1=
30747 a
30748
30749 =2=
30750 b
30751
30752 ==2.1==
30753 c
30754
30755 ==2.2==
30756 d
30757
30758 ===2.2.1===
30759 e
30760
30761 =3=
30762 f
30763 !! html/parsoid
30764 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30765 <p>a</p>
30766
30767 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30768 <p>b</p>
30769
30770 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30771 <p>c</p>
30772
30773 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
30774 <p>d</p>
30775
30776 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
30777 <p>e</p>
30778
30779 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
30780 <p>f</p>
30781
30782 </section>
30783 !! end
30784
30785 !! test
30786 Section wrapping for well-nested sections (with leading content)
30787 !! options
30788 parsoid={
30789 "wrapSections": true
30790 }
30791 !! wikitext
30792 Para 1.
30793
30794 Para 2 with a <div>nested in it</div>
30795
30796 Para 3.
30797
30798 =1=
30799 a
30800
30801 =2=
30802 b
30803
30804 ==2.1==
30805 c
30806 !! html/parsoid
30807 <section data-mw-section-id="0"><p>Para 1.</p>
30808
30809 <p>Para 2 with a </p><div>nested in it</div>
30810
30811 <p>Para 3.</p>
30812
30813 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30814 <p>a</p>
30815
30816 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30817 <p>b</p>
30818
30819 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30820 <p>c</p>
30821
30822 </section></section>
30823 !! end
30824
30825 !! test
30826 Section wrapping with template-generated sections (good nesting 1)
30827 !! options
30828 parsoid={
30829 "wrapSections": true
30830 }
30831 !! wikitext
30832 =1=
30833 a
30834
30835 {{echo|1=
30836 ==1.1==
30837 b
30838 }}
30839
30840 ==1.2==
30841 c
30842
30843 =2=
30844 d
30845 !! html/parsoid
30846 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30847 <p>a</p>
30848
30849 <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">
30850 </span><p about="#mwt1">b</p>
30851 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
30852 <p>c</p>
30853
30854 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
30855 <p>d</p></section>
30856 !! end
30857
30858 # In this example, the template scope is mildly expanded to incorporate the
30859 # trailing newline after the transclusion since that is part of section 1.1.1
30860 !! test
30861 Section wrapping with template-generated sections (good nesting 2)
30862 !! options
30863 parsoid={
30864 "wrapSections": true,
30865 "modes": ["wt2html", "wt2wt"]
30866 }
30867 !! wikitext
30868 =1=
30869 a
30870
30871 {{echo|1=
30872 ==1.1==
30873 b
30874 ===1.1.1===
30875 d
30876 }}
30877 =2=
30878 e
30879 !! html/parsoid
30880 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30881 <p>a</p>
30882
30883 <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">
30884 </span><p about="#mwt1">b</p><span about="#mwt1">
30885 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
30886 </span><p about="#mwt1">d</p><span about="#mwt1">
30887 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
30888 <p>e</p></section>
30889 !! end
30890
30891 # In this example, the template scope is mildly expanded to incorporate the
30892 # trailing newline after the transclusion since that is part of section 1.2.1
30893 !! test
30894 Section wrapping with template-generated sections (good nesting 3)
30895 !! options
30896 parsoid={
30897 "wrapSections": true,
30898 "modes": ["wt2html", "wt2wt"]
30899 }
30900 !! wikitext
30901 =1=
30902 a
30903
30904 {{echo|1=
30905 x
30906 ==1.1==
30907 b
30908 ==1.2==
30909 c
30910 ===1.2.1===
30911 d
30912 }}
30913 =2=
30914 e
30915 !! html/parsoid
30916 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
30917 <p>a</p>
30918
30919 <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">
30920 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
30921 </span><p about="#mwt1">b</p><span about="#mwt1">
30922 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
30923 </span><p about="#mwt1">c</p><span about="#mwt1">
30924 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
30925 </span><p about="#mwt1">d</p><span about="#mwt1">
30926 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
30927 <p>e</p></section>
30928 !! end
30929
30930 # Because of section-wrapping and template-wrapping interactions,
30931 # the scope of the template is expanded so that the template markup
30932 # is valid in the presence of <section> tags.
30933 # This exercises the s1 is null scenario in the wrapSections code
30934 !! test
30935 Section wrapping with template-generated sections (bad nesting 1)
30936 !! options
30937 parsoid={
30938 "wrapSections": true
30939 }
30940 !! wikitext
30941 <div>
30942 a
30943
30944 {{echo|
30945 =1=
30946 b
30947 }}
30948
30949 c
30950 </div>
30951 !! html/parsoid
30952 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
30953 <p>a</p>
30954
30955 <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"]}'>
30956 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
30957 </span><p about="#mwt1">b
30958 </p><span about="#mwt1">
30959
30960 </span><p about="#mwt1">c</p><span about="#mwt1">
30961 </span></section></div></section>
30962 !! end
30963
30964 # Because of section-wrapping and template-wrapping interactions,
30965 # the scope of the template is expanded so that the template markup
30966 # is valid in the presence of <section> tags.
30967 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
30968 !! test
30969 Section wrapping with template-generated sections (bad nesting 2)
30970 !! options
30971 parsoid={
30972 "wrapSections": true
30973 }
30974 !! wikitext
30975 =1=
30976 a
30977
30978 {{echo|1=
30979 =2=
30980 b
30981 ==2.1==
30982 c
30983 }}
30984
30985 d
30986
30987 =3=
30988 e
30989 !! html/parsoid
30990 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30991 <p>a</p>
30992
30993 </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">
30994 </span><p about="#mwt1">b</p><span about="#mwt1">
30995 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
30996 </span><p about="#mwt1">c</p><span about="#mwt1">
30997
30998 </span><p about="#mwt1">d</p><span about="#mwt1">
30999
31000 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
31001 <p>e</p></section>
31002 !! end
31003
31004 # Because of section-wrapping and template-wrapping interactions,
31005 # additional template wrappers are added to <section> tags
31006 # so that template wrapping semantics are valid whether section
31007 # tags are retained or stripped. But, the template scope can expand
31008 # greatly when accounting for section tags.
31009 # This exercises the s1 and s2 are in different subtrees scenario
31010 !! test
31011 Section wrapping with template-generated sections (bad nesting 3)
31012 !! options
31013 parsoid={
31014 "wrapSections": true,
31015 "modes": ["wt2html", "wt2wt"]
31016 }
31017 !! wikitext
31018 =1=
31019 a
31020
31021 {{echo|1=
31022 ==1.2==
31023 b
31024 =2=
31025 c
31026 }}
31027
31028 d
31029
31030 =3=
31031 e
31032 !! html/parsoid
31033 <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>
31034 <p>a</p>
31035
31036 <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">
31037 </span><p about="#mwt1">b</p><span about="#mwt1">
31038 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
31039 </span><p about="#mwt1">c</p>
31040
31041 <p>d</p>
31042 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
31043 <p>e</p></section>
31044 !! end
31045
31046 !! test
31047 Section wrapping with uneditable lead section + div wrapping multiple sections
31048 !! options
31049 parsoid={
31050 "wrapSections": true
31051 }
31052 !! wikitext
31053 foo
31054
31055 <div style="border:1px solid red;">
31056 =1=
31057 a
31058
31059 ==1.1==
31060 b
31061
31062 =2=
31063 c
31064 </div>
31065
31066 =3=
31067 d
31068
31069 ==3.1==
31070 e
31071 !! html/parsoid
31072 <section data-mw-section-id="-1"><p>foo</p>
31073
31074 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31075 <section data-mw-section-id="1"><h1 id="1">1</h1>
31076 <p>a</p>
31077
31078 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31079 <p>b</p>
31080
31081 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31082 <p>c</p>
31083 </section></div>
31084
31085 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31086 <p>d</p>
31087
31088 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31089 <p>e</p>
31090 </section></section>
31091 !! end
31092
31093 !! test
31094 Section wrapping with editable lead section + div overlapping multiple sections
31095 !! options
31096 parsoid={
31097 "wrapSections": true
31098 }
31099 !! wikitext
31100 foo
31101
31102 =1=
31103 a
31104 <div style="border:1px solid red;">
31105 b
31106
31107 ==1.1==
31108 c
31109
31110 =2=
31111 d
31112 </div>
31113 e
31114
31115 =3=
31116 f
31117
31118 ==3.1==
31119 g
31120 !! html/parsoid
31121 <section data-mw-section-id="0"><p>foo</p>
31122
31123 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
31124 <p>a</p>
31125 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31126 <p>b</p>
31127
31128 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31129 <p>c</p>
31130
31131 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31132 <p>d</p>
31133 </section></div>
31134 <p>e</p>
31135
31136 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31137 <p>f</p>
31138
31139 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31140 <p>g</p>
31141 </section></section>
31142 !! end
31143
31144 !! test
31145 HTML header tags should not be wrapped in section tags
31146 !! options
31147 parsoid={
31148 "wrapSections": true
31149 }
31150 !! wikitext
31151 foo
31152
31153 <h1>a</h1>
31154
31155 =b=
31156
31157 <h1>c</h1>
31158
31159 =d=
31160 !! html/parsoid
31161 <section data-mw-section-id="0"><p>foo</p>
31162
31163 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
31164
31165 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
31166
31167 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
31168
31169 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
31170 !! end
31171
31172 !! test
31173 Lead section containing only whitespace and comments.
31174 !! options
31175 parsoid={
31176 "wrapSections": true
31177 }
31178 !! wikitext
31179
31180 <!-- this is a comment, presumably significant to editors -->
31181 =1=
31182 a
31183
31184 =2=
31185 b
31186 !! html/parsoid
31187 <section data-mw-section-id="0" data-parsoid="{}">
31188 <!-- this is a comment, presumably significant to editors -->
31189 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
31190 <p>a</p>
31191
31192 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31193 <p>b</p></section>
31194 !! end
31195
31196 !! test
31197 Pseudo-sections emitted by templates should have id -2
31198 !! options
31199 parsoid={
31200 "wrapSections": true
31201 }
31202 !! wikitext
31203 foo
31204 {{echo|<div>
31205 ==a==
31206 ==b==
31207 </div>
31208 }}
31209 !! html/parsoid
31210 <section data-mw-section-id="-1"><p>foo</p>
31211 </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}}]}'>
31212 <section data-mw-section-id="-1"><h2 id="a">a</h2>
31213 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
31214 </section></div><span about="#mwt1">
31215 </span></section>
31216 !! end
31217
31218 ##########################################################################
31219 Tests demonstrating white-space insensitivity in input wikitext
31220 for wikitext headings, wikitext list items, and wikitext table captions,
31221 headings, and cells. HTML versions of the same should preserve whitespace.
31222 ##########################################################################
31223 !! test
31224 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
31225 !! options
31226 parsoid={
31227 "modes": ["wt2html"],
31228 "preserveIEW": true
31229 }
31230 !! wikitext
31231 __NOTOC__
31232 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
31233 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
31234 == <!--Headings with fallback ids--> Личная жизнь ==
31235 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
31236 ; <!--term to define--> term : <!--term's definition--> definition
31237 {|
31238 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
31239 |-
31240 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
31241 |-
31242 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31243 |-
31244 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
31245 |-
31246 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
31247 |}
31248 : {|
31249 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31250 |} foo <!--c1-->
31251 !! html/php+tidy
31252 <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>
31253 <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>
31254 <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>
31255 <ul><li>List item</li></ul>
31256 <dl><dt>term&#160;</dt>
31257 <dd>definition</dd></dl>
31258 <table>
31259 <caption>Table Caption
31260 </caption>
31261 <tbody><tr>
31262 <th>Table Heading 1</th>
31263 <th>Table Heading 2
31264 </th></tr>
31265 <tr>
31266 <td>Table Cell 1</td>
31267 <td>Table Cell 2
31268 </td></tr>
31269 <tr>
31270 <td>class="foo"</td>
31271 <td>Table Cell 3
31272 </td></tr>
31273 <tr>
31274 <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
31275 </td></tr></tbody></table>
31276 <dl><dd><table>
31277 <tbody><tr>
31278 <td>Table Cell 1</td>
31279 <td>Table Cell 2
31280 </td></tr></tbody></table> foo</dd></dl>
31281 !! html/parsoid
31282 <meta property="mw:PageProp/notoc">
31283 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
31284 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
31285 <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>
31286 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
31287 <dl><dt><!--term to define-->term&nbsp;</dt><dd><!--term's definition-->definition</dd></dl>
31288 <table>
31289 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
31290 <tbody><tr>
31291 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th>Table Heading 2<!--c5--></th></tr>
31292 <tr>
31293 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31294 <tr>
31295 <td>class="foo"</td><td><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
31296 <tr>
31297 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One">two</a> <!--c2--> | <!--c3--> some content</td></tr>
31298 </tbody></table>
31299 <dl><dd><table>
31300 <tbody><tr><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31301 </tbody></table><p> foo </p><!--c1--></dd></dl>
31302 !! end
31303
31304 # Looks like <caption> is not accepted in HTML
31305 !! test
31306 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
31307 !! options
31308 parsoid={
31309 "modes": ["wt2html"],
31310 "preserveIEW": true
31311 }
31312 !! wikitext
31313 __NOTOC__
31314 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
31315 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
31316 <table>
31317 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
31318 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
31319 </table>
31320 !! html/php+tidy
31321 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
31322 <ul><li> List item </li></ul>
31323 <table>
31324 <tbody><tr><th> Table Heading </th><th></th></tr>
31325 <tr><td> Table Cell </td><th></th></tr>
31326 </tbody></table>
31327 !! html/parsoid
31328 <meta property="mw:PageProp/notoc"/>
31329 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
31330 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
31331 <table>
31332 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
31333 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
31334 </tbody></table>
31335 !! end
31336
31337 !! test
31338 Do not trim whitespace in links and quotes
31339 !! options
31340 parsoid={
31341 "modes": ["wt2html"],
31342 "preserveIEW": true
31343 }
31344 !! wikitext
31345 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
31346 [[Foo| some text ]]
31347 !! html/php+tidy
31348 <p>foo <i> italic </i> and <b> bold </b>
31349 <a href="/wiki/Foo" title="Foo"> some text </a>
31350 </p>
31351 !! html/parsoid
31352 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
31353 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
31354 !! end
31355
31356 !! test
31357 Remove p tags surrounding a single element in a figcaption
31358 !! options
31359 parsoid=html2wt
31360 !! wikitext
31361 [[File:Foobar.jpg|right|200x200px|Caption]]
31362 !! html/parsoid
31363 <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>
31364 !! end
31365
31366 !! test
31367 Selser preserves lack of newline before list and allows newline after the list
31368 !! options
31369 parsoid={
31370 "modes": ["selser"],
31371 "scrubWikitext": true,
31372 "changes": [
31373 [ "ul", "after", "<p>footer</p>" ]
31374 ]
31375 }
31376 !! wikitext
31377 header
31378 *foo
31379 *bar
31380 !! wikitext/edited
31381 header
31382 *foo
31383 *bar
31384
31385 footer
31386 !! end
31387
31388
31389 !! test
31390 Selser does not introduce newlines between unedited paragraph preceding the list
31391 !! options
31392 parsoid={
31393 "modes": ["selser"],
31394 "changes": [
31395 [ "table tbody tr td p:last-child", "empty" ]
31396 ]
31397 }
31398 !! wikitext
31399 {|
31400 |
31401 header
31402 *foo
31403 *bar
31404 footer
31405 |}
31406 !! wikitext/edited
31407 {|
31408 |
31409 header
31410 *foo
31411 *bar
31412
31413 |}
31414 !! end
31415
31416 !! test
31417 Selser does not introduce newlines between unedited paragraph following the list
31418 !! options
31419 parsoid={
31420 "modes": ["selser"],
31421 "changes": [
31422 [ "table tbody tr td p:first-child", "empty" ]
31423 ]
31424 }
31425 !! wikitext
31426 {|
31427 |
31428 header
31429 *foo
31430 *bar
31431 footer
31432 |}
31433 !! wikitext/edited
31434 {|
31435 |
31436
31437 *foo
31438 *bar
31439 footer
31440 |}
31441 !! end
31442
31443 !! test
31444 Remove a list item but do not insert newline above list
31445 !! options
31446 parsoid={
31447 "modes": ["selser"],
31448 "changes": [
31449 [ "ul li:last-child", "remove" ]
31450 ]
31451 }
31452 !! wikitext
31453 header
31454 *foo
31455 *bar
31456 footer
31457 !! wikitext/edited
31458 header
31459 *foo
31460 footer
31461 !! end