Merge "Revert "Pedantic strict equals.""
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 # wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
40 # wgEnableMagicLinks
41 #
42 # For testing purposes, temporary articles can created:
43 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
44 # where '/' denotes a newline.
45
46 # This is the standard article assumed to exist.
47 !! article
48 Main Page
49 !! text
50 blah blah
51 !! endarticle
52
53 !!article
54 Foo
55 !!text
56 FOO
57 !!endarticle
58
59 !!article
60 Template:Foo
61 !!text
62 FOO
63 !!endarticle
64
65 !! article
66 Template:redirect to foo
67 !! text
68 #REDIRECT [[Template:Foo]]
69 !! endarticle
70
71 !! article
72 Template:Blank
73 !! text
74 !! endarticle
75
76 !! article
77 Template:pipe
78 !! text
79 |
80 !! endarticle
81
82 !! article
83 Template:=
84 !! text
85 <nowiki>=</nowiki>
86 !! endarticle
87
88 !!article
89 MediaWiki:bad image list
90 !!text
91 * [[File:Bad.jpg]] except [[Nasty page]]
92 !!endarticle
93
94 !! article
95 Template:inner list
96 !! text
97 * item 1
98 !! endarticle
99
100 !! article
101 Template:tbl-start
102 !! text
103 {|
104 !! endarticle
105
106 !! article
107 Template:tbl-end
108 !! text
109 |}
110 !! endarticle
111
112 !! article
113 Template:echo
114 !! text
115 {{{1}}}
116 !! endarticle
117
118 !! article
119 Template:echo3
120 !! text
121 {{{1}}}
122 {{{1}}}
123 {{{1}}}
124 !! endarticle
125
126 // For Serbian; localize Template namespace
127 !! article
128 Шаблон:Echo
129 !! text
130 {{{1}}}
131 !! endarticle
132
133 !! article
134 Template:echo_with_span
135 !! text
136 <span>{{{1}}}</span>
137 !! endarticle
138
139 !! article
140 Template:echo_with_div
141 !! text
142 <div>{{{1}}}</div>
143 !! endarticle
144
145 !! article
146 Template:echo with depth
147 !! text
148 {{echo|{{{1}}}}}
149 !! endarticle
150
151 !! article
152 Template:blank_param
153 !! text
154 {{{1}}}
155 {{{}}}
156 !! endarticle
157
158 !! article
159 Template:table_attribs
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"|Foo
163 !! endarticle
164
165 !! article
166 Template:table_attribs_2
167 !! text
168 <noinclude>
169 |</noinclude>style="color:red;"|Foo
170 |Bar||Baz
171 !! endarticle
172
173 !! article
174 Template:table_attribs_3
175 !! text
176 <noinclude>
177 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
178 !! endarticle
179
180 !! article
181 Template:table_attribs_4
182 !! text
183 | style="background-color:#DC241f;" width="10px" |
184 !! endarticle
185
186 !! article
187 Template:table_attribs_5
188 !! text
189 <noinclude>
190 |</noinclude>style="color:red;"||Bar
191 !! endarticle
192
193 !! article
194 Template:table_attribs_6
195 !! text
196 style="background: <nowiki>
197
198
199 red;</nowiki>" |
200 !! endarticle
201
202 !! article
203 Template:table_attribs_7
204 !! text
205 <noinclude>
206 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
207 !! endarticle
208
209 !! article
210 Template:table_header_cells
211 !! text
212 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
213 !! endarticle
214
215 !! article
216 Template:table_cells
217 !! text
218 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
219 !! endarticle
220
221 !! article
222 Template:PartialTable
223 !! text
224 {|
225 |-
226 !! endarticle
227
228 !! article
229 Template:image_attribs
230 !! text
231 <noinclude>
232 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
233 !! endarticle
234
235 ## See T48811 for details
236 !! article
237 Template:mixed_attr_content_template
238 !! text
239 style="color:red;" title="T48811"
240 |-
241 |foo
242 !! endarticle
243
244 !! article
245 Template:definition_list
246 !! text
247 one
248 ::two
249 !! endarticle
250
251 !! article
252 A?b
253 !! text
254 Weirdo titles!
255 !! endarticle
256
257 !!article
258 Template:Bullet
259 !!text
260 *Bar
261 !!endarticle
262
263 !!article
264 Template:OpenTable
265 !!text
266 {|
267 !!endarticle
268
269 !!article
270 Template:EmptyLITest
271 !!text
272 *a
273 *
274 *
275 *b
276 !!endarticle
277
278 !!article
279 Template:EmptyTRTest
280 !!text
281 {|
282 |-
283 |-
284 |foo
285 |-
286 |-
287 |bar
288 |}
289 !!endarticle
290
291 !!article
292 Template:EmptyTRWithHTMLAttrTest
293 !!text
294 <table>
295 <tr align="center"></tr>
296 <tr><td>foo</td></tr>
297 <tr align="center"></tr>
298 <tr><td>bar</td></tr>
299 </table>
300 !!endarticle
301
302 !! article
303 Template:With: Colon
304 !! text
305 Template with colon
306 !! endarticle
307
308 ###
309 ### Basic tests
310 ###
311
312 !! test
313 Blank input
314 !! wikitext
315 !! html
316 !! end
317
318 !! test
319 Simple paragraph
320 !! wikitext
321 This is a simple paragraph.
322 !! html
323 <p>This is a simple paragraph.
324 </p>
325 !! end
326
327 !! test
328 Paragraphs with extra newline spacing
329 !! wikitext
330 a
331
332 b (+2 nls)
333
334
335 c (+3 nls)
336
337
338
339 d (+4 nls)
340
341
342
343
344 e (+5 nls)
345 !! html
346 <p>a
347 </p><p>b (+2 nls)
348 </p><p><br />
349 c (+3 nls)
350 </p><p><br />
351 </p><p>d (+4 nls)
352 </p><p><br />
353 </p><p><br />
354 e (+5 nls)
355 </p>
356 !! end
357
358 !! test
359 Paragraphs with newline spacing with comment lines in between
360 !! wikitext
361 ----
362 a
363 <!--foo-->
364 b
365 ----
366 a
367 <!--foo--><!--More than 1 comment, still stripped-->
368 b
369 ----
370 a
371 <!--foo--> <!----> <!-- bar -->
372 b
373 ----
374 a
375 <!--foo-->
376
377 b
378 ----
379 a
380
381 <!--foo-->
382 b
383 ----
384 a
385 <!--foo-->
386
387
388 b
389 ----
390 a
391
392
393 <!--foo-->
394 b
395 ----
396 !! html
397 <hr />
398 <p>a
399 b
400 </p>
401 <hr />
402 <p>a
403 b
404 </p>
405 <hr />
406 <p>a
407 b
408 </p>
409 <hr />
410 <p>a
411 </p><p>b
412 </p>
413 <hr />
414 <p>a
415 </p><p>b
416 </p>
417 <hr />
418 <p>a
419 </p><p><br />
420 b
421 </p>
422 <hr />
423 <p>a
424 </p><p><br />
425 b
426 </p>
427 <hr />
428
429 !! end
430
431 !! test
432 Paragraphs with newline spacing with non-empty white-space lines in between
433 !! wikitext
434 ----
435 a
436
437 b
438 ----
439 a
440
441
442 b
443 ----
444 !! html
445 <hr />
446 <p>a
447 </p><p>b
448 </p>
449 <hr />
450 <p>a
451 </p><p><br />
452 b
453 </p>
454 <hr />
455
456 !! end
457
458 !! test
459 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
460 !! wikitext
461 ----
462 a
463 <!--foo-->
464 b
465 ----
466 a
467 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
468 b
469 ----
470 a
471
472 <!--foo-->
473 <!--bar-->
474 b
475 ----
476 a
477
478 <!--foo-->
479 <!--bar-->
480
481 b
482 ----
483 !! html
484 <hr />
485 <p>a
486 b
487 </p>
488 <hr />
489 <p>a
490 b
491 </p>
492 <hr />
493 <p>a
494 </p><p>b
495 </p>
496 <hr />
497 <p>a
498 </p><p><br />
499 b
500 </p>
501 <hr />
502
503 !! end
504
505 !! test
506 Extra newlines: More paragraphs with indented comment
507 !! wikitext
508 a
509
510 <!--boo-->
511
512 b
513 !! html
514 <p>a
515 </p><p><br />
516 b
517 </p>
518 !!end
519
520 !! test
521 Extra newlines followed by heading
522 !! wikitext
523 a
524
525
526 =b=
527 [[a]]
528
529
530 =b=
531 !! html
532 <p>a
533 </p><p><br />
534 </p>
535 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
536 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
537 </p><p><br />
538 </p>
539 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
540
541 !! end
542
543 !! test
544 Extra newlines between heading and content are swallowed (Parsoid does not)
545 !! wikitext
546 =b=
547
548
549
550 [[a]]
551 !! html/php+tidy
552 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
553 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
554 </p>
555 !! html/parsoid
556 <h1 id="b">b</h1>
557 <p>
558 <br></p>
559
560 <p><a rel="mw:WikiLink" href="./A" title="A">a</a></p>
561 !! end
562
563 !! test
564 Extra new lines before and after lists are preserved
565 !! wikitext
566 a
567
568
569 *b
570
571
572 c
573 !! html/php+tidy
574 <p>a
575 </p><p><br />
576 </p>
577 <ul><li>b</li></ul>
578 <p><br />
579 c
580 </p>
581 !! html/parsoid
582 <p>a</p>
583 <p>
584 <br></p>
585 <ul><li>b</li></ul>
586 <p>
587 <br>
588 c</p>
589 !! end
590
591 # Parsoid regression test
592 !!test
593 Multiple newlines after tables are converted to p-br-p tags
594 !!options
595 parsoid=wt2html,wt2wt
596 !!wikitext
597 {|
598 |x
599 |}
600
601
602
603
604 =b=
605 !!html/php+tidy
606 <table>
607 <tbody><tr>
608 <td>x
609 </td></tr></tbody></table>
610 <p><br />
611 </p><p><br />
612 </p>
613 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
614 !!html/parsoid
615 <table>
616 <tbody>
617 <tr>
618 <td>x</td>
619 </tr>
620 </tbody>
621 </table>
622 <p><br/></p>
623 <p><br/></p>
624 <h1 id="b">b</h1>
625 !!end
626
627 !! test
628 Heading with line break in nowiki
629 !! options
630 parsoid=wt2html
631 !! config
632 wgFragmentMode=[ 'html5', 'legacy' ]
633 !! wikitext
634 ==A <nowiki>B
635 C</nowiki>==
636 !! html/php
637 <h2><span id="A_B.0AC"></span><span class="mw-headline" id="A_B
638 C">A B
639 C</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
640
641 !! html/parsoid
642 <h2 id="A_B
643 C"><span id="A_B.0AC" typeof="mw:FallbackId"></span>A <span typeof="mw:Nowiki">B
644 C</span></h2>
645 !! end
646
647 !! test
648 Parsing an URL
649 !! wikitext
650 http://fr.wikipedia.org/wiki/🍺
651 <!-- EasterEgg we love beer, better be able be able to link to it -->
652 !! html
653 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
654 </p>
655 !! end
656
657 !! test
658 Simple list
659 !! wikitext
660 *Item 1
661 *Item 2
662 !! html
663 <ul><li>Item 1</li>
664 <li>Item 2</li></ul>
665
666 !! end
667
668 !! test
669 Italics and bold
670 !! wikitext
671 *plain
672 *plain''italic''plain
673 *plain''italic''plain''italic''plain
674 *plain'''bold'''plain
675 *plain'''bold'''plain'''bold'''plain
676 *plain''italic''plain'''bold'''plain
677 *plain'''bold'''plain''italic''plain
678 *plain''italic'''bold-italic'''italic''plain
679 *plain'''bold''bold-italic''bold'''plain
680 *plain'''''bold-italic'''italic''plain
681 *plain'''''bold-italic''bold'''plain
682 *plain''italic'''bold-italic'''''plain
683 *plain'''bold''bold-italic'''''plain
684 *plain l'''italic''plain
685 *plain l''''bold''' plain
686 !! html
687 <ul><li>plain</li>
688 <li>plain<i>italic</i>plain</li>
689 <li>plain<i>italic</i>plain<i>italic</i>plain</li>
690 <li>plain<b>bold</b>plain</li>
691 <li>plain<b>bold</b>plain<b>bold</b>plain</li>
692 <li>plain<i>italic</i>plain<b>bold</b>plain</li>
693 <li>plain<b>bold</b>plain<i>italic</i>plain</li>
694 <li>plain<i>italic<b>bold-italic</b>italic</i>plain</li>
695 <li>plain<b>bold<i>bold-italic</i>bold</b>plain</li>
696 <li>plain<i><b>bold-italic</b>italic</i>plain</li>
697 <li>plain<b><i>bold-italic</i>bold</b>plain</li>
698 <li>plain<i>italic<b>bold-italic</b></i>plain</li>
699 <li>plain<b>bold<i>bold-italic</i></b>plain</li>
700 <li>plain l'<i>italic</i>plain</li>
701 <li>plain l'<b>bold</b> plain</li></ul>
702
703 !! end
704
705 # this example taken from the [[simple:Moon]] article (T49326)
706 !! test
707 Italics and possessives (1)
708 !! wikitext
709 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
710 !! html
711 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
712 </p>
713 !! end
714
715 # this example taken from [[en:Flaming Pie]] (T51926)
716 !! test
717 Italics and possessives (2)
718 !! wikitext
719 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
720 !! html
721 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
722 </p>
723 !! end
724
725 # this example taken from [[en:Dictionary]] (T51926)
726 !! test
727 Italics and possessives (3)
728 !! wikitext
729 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
730 !! html
731 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
732 </p>
733 !! end
734
735
736 ###
737 ### 2-quote opening sequence tests
738 ###
739 !! test
740 Italics and bold: 2-quote opening sequence: (2,2)
741 !! wikitext
742 ''foo''
743 !! html
744 <p><i>foo</i>
745 </p>
746 !!end
747
748 !! test
749 Italics and bold: 2-quote opening sequence: (2,3)
750 !! wikitext
751 ''foo'''
752 !! html/*
753 <p><i>foo'</i>
754 </p>
755 !!end
756
757 !! test
758 Italics and bold: 2-quote opening sequence: (2,4)
759 !! options
760 parsoid=wt2html
761 !! wikitext
762 ''foo''''
763 !! html/*
764 <p><i>foo''</i>
765 </p>
766 !!end
767
768 # same html as previous, but wikitext adjusted to match parsoid html2wt
769 !! test
770 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
771 !! wikitext
772 ''foo<nowiki>''</nowiki>''
773 !! html
774 <p><i>foo''</i>
775 </p>
776 !! end
777
778 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
779 !! test
780 Italics and bold: 2-quote opening sequence: (2,5)
781 !! options
782 parsoid=wt2html
783 !! wikitext
784 ''foo'''''
785 !! html/php
786 <p><i>foo</i>
787 </p>
788 !! html/parsoid
789 <p><i>foo</i><b></b>
790 </p>
791 !!end
792
793 # same html as previous, but wikitext adjusted to match parsoid html2wt
794 !! test
795 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
796 !! wikitext
797 ''foo'''''<nowiki/>'''
798 !! html/php
799 <p><i>foo</i>
800 </p>
801 !! html/parsoid
802 <p><i>foo</i><b></b>
803 </p>
804 !! end
805
806
807 ###
808 ### 3-quote opening sequence tests
809 ###
810
811 !! test
812 Italics and bold: 3-quote opening sequence: (3,2)
813 !! wikitext
814 '''foo''
815 !! html/*
816 <p>'<i>foo</i>
817 </p>
818 !!end
819
820 !! test
821 Italics and bold: 3-quote opening sequence: (3,3)
822 !! wikitext
823 '''foo'''
824 !! html
825 <p><b>foo</b>
826 </p>
827 !!end
828
829 !! test
830 Italics and bold: 3-quote opening sequence: (3,4)
831 !! wikitext
832 '''foo''''
833 !! html/*
834 <p><b>foo'</b>
835 </p>
836 !!end
837
838 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
839 !! test
840 Italics and bold: 3-quote opening sequence: (3,5)
841 !! options
842 parsoid=wt2html
843 !! wikitext
844 '''foo'''''
845 !! html/php
846 <p><b>foo</b>
847 </p>
848 !! html/parsoid
849 <p><b>foo</b><i></i>
850 </p>
851 !!end
852
853 # same html as previous, but wikitext adjusted to match parsoid html2wt
854 !! test
855 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
856 !! wikitext
857 '''foo'''''<nowiki/>''
858 !! html/php
859 <p><b>foo</b>
860 </p>
861 !! html/parsoid
862 <p><b>foo</b><i></i>
863 </p>
864 !! end
865
866
867 ###
868 ### 4-quote opening sequence tests
869 ###
870
871 !! test
872 Italics and bold: 4-quote opening sequence: (4,2)
873 !! options
874 parsoid=wt2html
875 !! wikitext
876 ''''foo''
877 !! html/*
878 <p>''<i>foo</i>
879 </p>
880 !!end
881
882 # same html as previous, but wikitext adjusted to match parsoid html2wt
883 !! test
884 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
885 !! wikitext
886 <nowiki>''</nowiki>''foo''
887 !! html
888 <p>''<i>foo</i>
889 </p>
890 !! end
891
892 !! test
893 Italics and bold: 4-quote opening sequence: (4,3)
894 !! wikitext
895 ''''foo'''
896 !! html/*
897 <p>'<b>foo</b>
898 </p>
899 !!end
900
901 !! test
902 Italics and bold: 4-quote opening sequence: (4,4)
903 !! options
904 parsoid=wt2html
905 !! wikitext
906 ''''foo''''
907 !! html/*
908 <p>'<b>foo'</b>
909 </p>
910 !!end
911
912 # same html as previous, but wikitext adjusted to match parsoid html2wt
913 !! test
914 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
915 !! wikitext
916 '<nowiki/>'''foo''''
917 !! html
918 <p>'<b>foo'</b>
919 </p>
920 !! end
921
922 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
923 !! test
924 Italics and bold: 4-quote opening sequence: (4,5)
925 !! options
926 parsoid=wt2html
927 !! wikitext
928 ''''foo'''''
929 !! html/php
930 <p>'<b>foo</b>
931 </p>
932 !! html/parsoid
933 <p>'<b>foo</b><i></i>
934 </p>
935 !!end
936
937 # same html as previous, but wikitext adjusted to match parsoid html2wt
938 !! test
939 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
940 !! wikitext
941 '<nowiki/>'''foo'''''<nowiki/>''
942 !! html/php
943 <p>'<b>foo</b>
944 </p>
945 !! html/parsoid
946 <p>'<b>foo</b><i></i>
947 </p>
948 !! end
949
950
951 ###
952 ### 5-quote opening sequence tests
953 ###
954
955 !! test
956 Italics and bold: 5-quote opening sequence: (5,2)
957 !! options
958 parsoid=wt2html
959 !! wikitext
960 '''''foo''
961 !! html/*
962 <p><b><i>foo</i></b>
963 </p>
964 !!end
965
966 # same html as previous, but wikitext adjusted to match parsoid html2wt
967 !! test
968 Italics and bold: 5-quote opening sequence: (5,2+3)
969 !! wikitext
970 '''''foo'''''
971 !! html/*
972 <p><i><b>foo</b></i>
973 </p>
974 !! end
975
976 !! test
977 Italics and bold: 5-quote opening sequence: (5,3)
978 !! options
979 parsoid=wt2html
980 !! wikitext
981 '''''foo'''
982 !! html/*
983 <p><i><b>foo</b></i>
984 </p>
985 !!end
986
987 # same html as previous, but wikitext adjusted to match parsoid html2wt
988 !! test
989 Italics and bold: 5-quote opening sequence: (5,3+2)
990 !! wikitext
991 '''''foo'''''
992 !! html
993 <p><i><b>foo</b></i>
994 </p>
995 !! end
996
997 !! test
998 Italics and bold: 5-quote opening sequence: (5,4)
999 !! options
1000 parsoid=wt2html
1001 !! wikitext
1002 '''''foo''''
1003 !! html/*
1004 <p><i><b>foo'</b></i>
1005 </p>
1006 !!end
1007
1008 !! test
1009 Italics and bold: 5-quote opening sequence: (5,5)
1010 !! wikitext
1011 '''''foo'''''
1012 !! html
1013 <p><i><b>foo</b></i>
1014 </p>
1015 !!end
1016
1017 !! test
1018 Italics and bold: 5-quote opening sequence: (5,6)
1019 !! wikitext
1020 '''''foo''''''
1021 !! html/*
1022 <p><i><b>foo'</b></i>
1023 </p>
1024 !! end
1025
1026 ###
1027 ### multiple quote sequences in a line
1028 ###
1029
1030 !! test
1031 Italics and bold: multiple quote sequences: (2,4,2)
1032 !! options
1033 parsoid=wt2html
1034 !! wikitext
1035 ''foo''''bar''
1036 !! html/*
1037 <p><i>foo'<b>bar</b></i>
1038 </p>
1039 !! end
1040
1041 # same html as previous, but wikitext adjusted to match parsoid html2wt
1042 !! test
1043 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
1044 !! wikitext
1045 ''foo'<nowiki/>'''bar'''''
1046 !! html
1047 <p><i>foo'<b>bar</b></i>
1048 </p>
1049 !! end
1050
1051 !! test
1052 Italics and bold: multiple quote sequences: (2,4,3)
1053 !! options
1054 parsoid=wt2html
1055 !! wikitext
1056 ''foo''''bar'''
1057 !! html/*
1058 <p><i>foo'<b>bar</b></i>
1059 </p>
1060 !! end
1061
1062 # same html as previous, but wikitext adjusted to match parsoid html2wt
1063 !! test
1064 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
1065 !! wikitext
1066 ''foo'<nowiki/>'''bar'''''
1067 !! html
1068 <p><i>foo'<b>bar</b></i>
1069 </p>
1070 !! end
1071
1072 !! test
1073 Italics and bold: multiple quote sequences: (2,4,4)
1074 !! options
1075 parsoid=wt2html
1076 !! wikitext
1077 ''foo''''bar''''
1078 !! html/*
1079 <p><i>foo'<b>bar'</b></i>
1080 </p>
1081 !! end
1082
1083 # same html as previous, but wikitext adjusted to match parsoid html2wt
1084 !! test
1085 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
1086 !! wikitext
1087 ''foo'<nowiki/>'''bar'<nowiki/>'''''
1088 !! html
1089 <p><i>foo'<b>bar'</b></i>
1090 </p>
1091 !! end
1092
1093 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1094 !! test
1095 Italics and bold: multiple quote sequences: (3,4,2)
1096 !! options
1097 parsoid=wt2html
1098 !! wikitext
1099 '''foo''''bar''
1100 !! html/php
1101 <p><b>foo'</b>bar
1102 </p>
1103 !! html/parsoid
1104 <p><b>foo'</b>bar<i></i>
1105 </p>
1106 !! end
1107
1108 # same html as previous, but wikitext adjusted to match parsoid html2wt
1109 !! test
1110 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1111 !! wikitext
1112 '''foo''''bar''<nowiki/>''
1113 !! html/php
1114 <p><b>foo'</b>bar
1115 </p>
1116 !! html/parsoid
1117 <p><b>foo'</b>bar<i></i>
1118 </p>
1119 !! end
1120
1121 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1122 !! test
1123 Italics and bold: multiple quote sequences: (3,4,3)
1124 !! options
1125 parsoid=wt2html
1126 !! wikitext
1127 '''foo''''bar'''
1128 !! html/php
1129 <p><b>foo'</b>bar
1130 </p>
1131 !! html/parsoid
1132 <p><b>foo'</b>bar<b></b>
1133 </p>
1134 !! end
1135
1136 # same html as previous, but wikitext adjusted to match parsoid html2wt
1137 !! test
1138 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1139 !! wikitext
1140 '''foo''''bar'''<nowiki/>'''
1141 !! html/php
1142 <p><b>foo'</b>bar
1143 </p>
1144 !! html/parsoid
1145 <p><b>foo'</b>bar<b></b>
1146 </p>
1147 !! end
1148
1149 ###
1150 ### other quote tests
1151 ###
1152 !! test
1153 Italics and bold: other quote tests: (2,3,5)
1154 !! wikitext
1155 ''this is about '''foo's family'''''
1156 !! html
1157 <p><i>this is about <b>foo's family</b></i>
1158 </p>
1159 !!end
1160
1161
1162 !! test
1163 Italics and bold: other quote tests: (2,(3,3),2)
1164 !! wikitext
1165 ''this is about '''foo's''' family''
1166 !! html
1167 <p><i>this is about <b>foo's</b> family</i>
1168 </p>
1169 !!end
1170
1171
1172 !! test
1173 Italics and bold: other quote tests: (3,2,3,2)
1174 !! options
1175 parsoid=wt2html
1176 !! wikitext
1177 '''this is about ''foo'''s family''
1178 !! html/*
1179 <p><b>this is about <i>foo</i></b><i>s family</i>
1180 </p>
1181 !!end
1182
1183
1184 # same html as previous, but wikitext adjusted to match parsoid html2wt
1185 !! test
1186 Italics and bold: other quote tests: (3,2,3+2+2,2)
1187 !! wikitext
1188 '''this is about ''foo'''''<nowiki/>''s family''
1189 !! html
1190 <p><b>this is about <i>foo</i></b><i>s family</i>
1191 </p>
1192 !! end
1193
1194
1195 !! test
1196 Italics and bold: other quote tests: (3,2,3,3)
1197 !! wikitext
1198 '''this is about ''foo'''s family'''
1199 !! html/*
1200 <p>'<i>this is about </i>foo<b>s family</b>
1201 </p>
1202 !!end
1203
1204
1205 !! test
1206 Italics and bold: other quote tests: (3,(2,2),3)
1207 !! wikitext
1208 '''this is about ''foo's'' family'''
1209 !! html
1210 <p><b>this is about <i>foo's</i> family</b>
1211 </p>
1212 !!end
1213
1214
1215 !! test
1216 Italicized possessive
1217 !! wikitext
1218 The ''[[Main Page]]'''s talk page.
1219 !! html/php
1220 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1221 </p>
1222 !! html/parsoid
1223 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1224 !! end
1225
1226 !! test
1227 Quote balancing context should be restricted to td/th cells on the same wikitext line
1228 !! options
1229 parsoid=wt2html,wt2wt
1230 !! wikitext
1231 {|
1232 !''a!!''b
1233 |''a||''b
1234 |}
1235 !! html+tidy
1236 <table>
1237 <tbody><tr>
1238 <th><i>a</i></th>
1239 <th><i>b</i>
1240 </th>
1241 <td><i>a</i></td>
1242 <td><i>b</i>
1243 </td></tr></tbody></table>
1244 !! end
1245
1246 ###
1247 ### Non-html5 tags
1248 ###
1249
1250 !! test
1251 Non-html5 tags should be accepted
1252 !! wikitext
1253 <center>''foo''</center>
1254 <big>''foo''</big>
1255 <font>''foo''</font>
1256 <strike>''foo''</strike>
1257 <tt>''foo''</tt>
1258 !! html
1259 <center><i>foo</i></center>
1260 <p><big><i>foo</i></big>
1261 <font><i>foo</i></font>
1262 <strike><i>foo</i></strike>
1263 <tt><i>foo</i></tt>
1264 </p>
1265 !! end
1266
1267 !! test
1268 <wbr> is valid wikitext (T54468)
1269 !! wikitext
1270 <wbr>
1271 !! html
1272 <p><wbr />
1273 </p>
1274 !! end
1275
1276 # <strike> is HTML4, <s> is HTML4/5.
1277 !! test
1278 <s> or <strike> for strikethrough
1279 !! wikitext
1280 <strike>strike</strike>
1281
1282 <s>s</s>
1283 !! html
1284 <p><strike>strike</strike>
1285 </p><p><s>s</s>
1286 </p>
1287 !! end
1288
1289 ## a not permitted
1290 ## i,b,br omitted
1291 !! test
1292 Text-level semantic html elements in wikitext
1293 !! wikitext
1294 <em>text</em>
1295 <strong>text</strong>
1296 <small>text</small>
1297 <s>text</s>
1298 <cite>text</cite>
1299 <q>text</q>
1300 <dfn>text</dfn>
1301 <abbr>text</abbr>
1302 <data>text</data>
1303 <time>text</time>
1304 <code>text</code>
1305 <var>text</var>
1306 <samp>text</samp>
1307 <kbd>text</kbd>
1308 <sub>text</sub>
1309 <u>text</u>
1310 <mark>text</mark>
1311 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1312 <bdi>text</bdi>
1313 <bdo>text</bdo>
1314 <span>text</span>
1315 <wbr />
1316 !! html
1317 <p><em>text</em>
1318 <strong>text</strong>
1319 <small>text</small>
1320 <s>text</s>
1321 <cite>text</cite>
1322 <q>text</q>
1323 <dfn>text</dfn>
1324 <abbr>text</abbr>
1325 <data>text</data>
1326 <time>text</time>
1327 <code>text</code>
1328 <var>text</var>
1329 <samp>text</samp>
1330 <kbd>text</kbd>
1331 <sub>text</sub>
1332 <u>text</u>
1333 <mark>text</mark>
1334 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1335 <bdi>text</bdi>
1336 <bdo>text</bdo>
1337 <span>text</span>
1338 <wbr />
1339 </p>
1340 !! end
1341
1342 # test cases taken from
1343 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1344 !! test
1345 Ruby markup (W3C-style)
1346 !! wikitext
1347 ;Mono-ruby for individual base characters
1348 :<ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1349 ;Group ruby
1350 :<ruby>今日<rt>きょう</rt></ruby>
1351 ;Jukugo ruby
1352 :<ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1353 ;Inline ruby
1354 :<ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1355 ;Double-sided ruby
1356 :<ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1357
1358 <ruby>
1359 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1360 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1361 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1362 </ruby>
1363 !! html
1364 <dl><dt>Mono-ruby for individual base characters</dt>
1365 <dd><ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1366 <dt>Group ruby</dt>
1367 <dd><ruby>今日<rt>きょう</rt></ruby></dd>
1368 <dt>Jukugo ruby</dt>
1369 <dd><ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1370 <dt>Inline ruby</dt>
1371 <dd><ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1372 <dt>Double-sided ruby</dt>
1373 <dd><ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1374 <p><ruby>
1375 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1376 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1377 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1378 </ruby>
1379 </p>
1380 !! end
1381
1382 # The next two test different paths in the sanitizer.
1383 !! test
1384 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1385 !! wikitext
1386 <blockquote|>a</blockquote>
1387
1388 <b→> doesn't terminate </b→>
1389
1390 <bä> doesn't terminate </bä>
1391
1392 <boo> doesn't terminate </boo>
1393
1394 <s.foo> doesn't terminate </s.foo>
1395
1396 <sub-ID#1>
1397 !! html
1398 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1399 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1400 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1401 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1402 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1403 </p><p>&lt;sub-ID#1&gt;
1404 </p>
1405 !! end
1406
1407 !! test
1408 Non-word characters don't terminate tag names
1409 !! wikitext
1410 <blockquote|>a</blockquote>
1411
1412 <b→> doesn't terminate </b→>
1413
1414 <bä> doesn't terminate </bä>
1415
1416 <boo> doesn't terminate </boo>
1417
1418 <s.foo> doesn't terminate </s.foo>
1419
1420 <sub-ID#1>
1421 !! html+tidy
1422 <p>&lt;blockquote|&gt;a
1423 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1424 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1425 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1426 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1427 </p><p>&lt;sub-ID#1&gt;
1428 </p>
1429 !! end
1430
1431 ###
1432 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1433 ### This checks that HTML5 tags (with non-word characters in the tag
1434 ### name) make it safely through the parser -- the Sanitizer will
1435 ### munge them later, as it should.
1436 ###
1437 !! test
1438 Non-word characters are valid in extension tags (T19663)
1439 !! wikitext
1440 <tåg>tåg</tåg>
1441 !! html/php
1442 <pre>
1443 'tåg'
1444 array (
1445 )
1446 </pre>
1447
1448 !! html/parsoid
1449 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1450 !! end
1451
1452 !! test
1453 Isolated close tags should be treated as literal text (T54760)
1454 !! options
1455 parsoid=wt2html
1456 !! wikitext
1457 </b>
1458
1459 <s.foo>s</s>
1460 !! html/php+tidy
1461 <p class="mw-empty-elt">
1462 </p><p>&lt;s.foo&gt;s
1463 </p>
1464 !! html/parsoid
1465 <p>&lt;s.foo&gt;s</p>
1466 !! end
1467
1468 ###
1469 ### Special characters
1470 ###
1471
1472 !! test
1473 Bare pipe character (T54363)
1474 !! wikitext
1475 |
1476 !! html
1477 <p>|
1478 </p>
1479 !! end
1480
1481 !! test
1482 Bare pipe character from a template (T54363)
1483 !! wikitext
1484 {{pipe}}
1485 !! html
1486 <p>|
1487 </p>
1488 !! end
1489
1490 ###
1491 ### <nowiki> test cases
1492 ###
1493
1494 !! test
1495 <nowiki> unordered list
1496 !! wikitext
1497 <nowiki>* This is not an unordered list item.</nowiki>
1498 !! html/php
1499 <p>* This is not an unordered list item.
1500 </p>
1501 !! html/parsoid
1502 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1503 !! end
1504
1505 !! test
1506 <nowiki> spacing
1507 !! wikitext
1508 <nowiki>Lorem ipsum dolor
1509
1510 sed abit.
1511 sed nullum.
1512
1513 :and a colon
1514 </nowiki>
1515 !! html/php
1516 <p>Lorem ipsum dolor
1517
1518 sed abit.
1519 sed nullum.
1520
1521 :and a colon
1522
1523 </p>
1524 !! html/parsoid
1525 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1526
1527 sed abit.
1528 sed nullum.
1529
1530 :and a colon
1531 </span></p>
1532 !! end
1533
1534 !! test
1535 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1536 !! wikitext
1537 <nowiki><span class="error"></nowiki>
1538 !! html/php
1539 <p>&lt;span class="error"&gt;
1540 </p>
1541 !! html/parsoid
1542 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1543 !! end
1544
1545 !! test
1546 nowiki 3
1547 !! wikitext
1548 :There is not nowiki.
1549 :There is <nowiki>nowiki</nowiki>.
1550
1551 #There is not nowiki.
1552 #There is <nowiki>nowiki</nowiki>.
1553
1554 *There is not nowiki.
1555 *There is <nowiki>nowiki</nowiki>.
1556 !! html/php
1557 <dl><dd>There is not nowiki.</dd>
1558 <dd>There is nowiki.</dd></dl>
1559 <ol><li>There is not nowiki.</li>
1560 <li>There is nowiki.</li></ol>
1561 <ul><li>There is not nowiki.</li>
1562 <li>There is nowiki.</li></ul>
1563
1564 !! html/parsoid
1565 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1566 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1567
1568 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1569 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1570
1571 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1572 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1573 !! end
1574
1575 !! test
1576 Entities inside <nowiki>
1577 !! wikitext
1578 <nowiki>&lt;</nowiki>
1579 !! html/php
1580 <p>&lt;
1581 </p>
1582 !! html/parsoid
1583 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1584 !! end
1585
1586 !! test
1587 Entities inside template parameters
1588 !! wikitext
1589 {{echo|&ndash;}}
1590 !! html/php+tidy
1591 <p>&#8211;
1592 </p>
1593 !! html/parsoid
1594 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1595 !! end
1596
1597 !! test
1598 Properly escape nowiki when combined with other wiki markup
1599 !! options
1600 parsoid=html2wt
1601 !! html/parsoid
1602 <p>* &lt;/nowiki&gt; tag</p>
1603 !! wikitext
1604 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1605 !! end
1606
1607 !! test
1608 T93824: Put escaped HTML tags inside nowiki
1609 !! options
1610 parsoid=html2wt
1611 !! html/parsoid
1612 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1613 !! wikitext
1614 <nowiki><h2>foo</h2></nowiki>
1615 !! end
1616
1617 !! test
1618 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1619 !! options
1620 parsoid=html2wt
1621 !! html/parsoid
1622 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1623 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1624 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1625 !! wikitext
1626 This text: L'[[Foo]]
1627 This text: L<nowiki>''</nowiki>[[Foo]]
1628 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1629 !! end
1630
1631 # This test fails because wikitext whitespace is not normalized before comparing.
1632 !! test
1633 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1634 !! options
1635 parsoid=html2wt
1636 !! html/parsoid
1637 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1638 </p>
1639 !! wikitext
1640 This text : L<nowiki>''</nowiki>[[Foo]]
1641 !! end
1642
1643 # This test and the next one are html2wt only as they test that incorrect wikitext
1644 # passed in template arguments gets escaped or wrapped in nowikis where required.
1645 !! test
1646 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1647 !! options
1648 parsoid=html2wt
1649 !! html/parsoid
1650 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1651 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1652 !! wikitext
1653 {{echo|foo{{!}}bar}}
1654 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1655 !! end
1656
1657 !! test
1658 T53961: Output correct nowikis in template arguments
1659 !! options
1660 parsoid=html2wt
1661 !! html/parsoid
1662 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1663 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1664 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1665 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1666 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1667 !! wikitext
1668 {{echo|a [ b}}
1669 {{echo|<nowiki>a }} b</nowiki>}}
1670 {{echo|<nowiki>a [[ b</nowiki>}}
1671 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1672 {{echo|a <nowiki>}</nowiki>}}
1673 !! end
1674
1675 !! test
1676 Cases where "!!" needs nowiki protection
1677 !! options
1678 parsoid=html2wt
1679 !! html/parsoid
1680 <table>
1681 <tr><th>this needs protection !! here</th></tr>
1682 </table>
1683
1684 <table>
1685 <tr><th>this does not need
1686 protection !! here</th></tr>
1687 </table>
1688 !! wikitext
1689 {|
1690 !<nowiki>this needs protection !! here</nowiki>
1691 |}
1692
1693 {|
1694 !this does not need
1695 protection !! here
1696 |}
1697 !! end
1698
1699 ###
1700 ### Comments
1701 ###
1702 !! test
1703 Comments and Indent-Pre
1704 !! wikitext
1705 <!-- comment 1 --> asdf
1706
1707 <!-- comment 1 --> asdf
1708 <!-- comment 2 -->
1709
1710 <!-- comment 1 --> asdf
1711 <!-- comment 2 -->xyz
1712
1713 <!-- comment 1 --> asdf
1714 <!-- comment 2 --> xyz
1715 !! html
1716 <pre>asdf
1717 </pre>
1718 <pre>asdf
1719 </pre>
1720 <pre>asdf
1721 </pre>
1722 <p>xyz
1723 </p>
1724 <pre>asdf
1725 xyz
1726 </pre>
1727 !! end
1728
1729 !! test
1730 Comment test 2a
1731 !! wikitext
1732 asdf
1733 <!-- comment 1 -->
1734 jkl
1735 !! html
1736 <p>asdf
1737 jkl
1738 </p>
1739 !! end
1740
1741 !! test
1742 Comment test 2b
1743 !! wikitext
1744 asdf
1745 <!-- comment 1 -->
1746
1747 jkl
1748 !! html
1749 <p>asdf
1750 </p><p>jkl
1751 </p>
1752 !! end
1753
1754 !! test
1755 Comment test 3
1756 !! wikitext
1757 asdf
1758 <!-- comment 1 -->
1759 <!-- comment 2 -->
1760 jkl
1761 !! html
1762 <p>asdf
1763 jkl
1764 </p>
1765 !! end
1766
1767 !! test
1768 Comment test 4
1769 !! wikitext
1770 asdf<!-- comment 1 -->jkl
1771 !! html
1772 <p>asdfjkl
1773 </p>
1774 !! end
1775
1776 !! test
1777 Comment spacing
1778 !! wikitext
1779 a
1780 <!-- foo --> b <!-- bar -->
1781 c
1782 !! html
1783 <p>a
1784 </p>
1785 <pre> b
1786 </pre>
1787 <p>c
1788 </p>
1789 !! end
1790
1791 !! test
1792 Comment whitespace
1793 !! wikitext
1794 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1795 !! html
1796
1797 !! end
1798
1799 !! test
1800 Comment semantics and delimiters
1801 !! wikitext
1802 <!-- --><!----><!-----><!------>
1803 !! html/php
1804
1805 !! html/parsoid
1806 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1807 !! end
1808
1809 !! test
1810 Comment semantics and delimiters, redux
1811 !! wikitext
1812 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1813 -- foo -- funky huh? ... -->
1814 !! html/php
1815
1816 !! html/parsoid
1817 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1818 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1819 !! end
1820
1821 !! test
1822 Comment semantics and delimiters: directors cut
1823 !! wikitext
1824 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1825 everything starting with < followed by !-- until the first -- and > we see,
1826 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1827 -->-->
1828 !! html/php
1829 <p>--&gt;
1830 </p>
1831 !! html/parsoid
1832 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1833 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1834 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1835 --><p>--></p>
1836 !! end
1837
1838 !! test
1839 Comment semantics: nesting
1840 !! wikitext
1841 <!--<!-- no, we're not going to do anything fancy here -->-->
1842 !! html/php
1843 <p>--&gt;
1844 </p>
1845 !! html/parsoid
1846 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1847 !! end
1848
1849 # Parsoid closes the unclosed comment, even if it means a slight
1850 # round-trip diff.
1851 !! test
1852 Comment semantics: unclosed comment at end
1853 !! options
1854 parsoid=wt2html,html2html
1855 !! wikitext
1856 <!--This comment will run out to the end of the document
1857 !! html/php
1858
1859 !! html/parsoid
1860 <!--This comment will run out to the end of the document-->
1861 !! end
1862
1863 !! test
1864 Comment semantics: normalize comments to play nice with XML and browsers
1865 !! wikitext
1866 <!-- Browsers --!> think this is closed -->
1867 <!--> This would normally be text -->
1868 <!---> As would this -->
1869 <!-- XML doesn't like trailing dashes -------->
1870 <!-- Nor doubled hyphens -- anywhere in the data -->
1871 But this is not a comment.
1872 !! html/php
1873 <p>But this is not a comment.
1874 </p>
1875 !! html/parsoid
1876 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1877 <!--&#x3E; This would normally be text -->
1878 <!--&#x2D;&#x3E; As would this -->
1879 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1880 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1881 <p>But this is not a comment.</p>
1882 !! end
1883
1884 !! test
1885 Comment semantics: round-trip even text which contains encoded -->
1886 !! wikitext
1887 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1888 !! html/parsoid
1889 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1890 !! end
1891
1892 !! test
1893 Comment in template title
1894 !! wikitext
1895 {{f<!---->oo}}
1896 !! html
1897 <p>FOO
1898 </p>
1899 !! end
1900
1901 !! test
1902 Comment on its own line post-expand
1903 !! wikitext
1904 a
1905 {{blank}}<!---->
1906 b
1907 !! html
1908 <p>a
1909 </p><p>b
1910 </p>
1911 !! end
1912
1913 !! test
1914 Comment on its own line post-expand with non-significant whitespace
1915 !! wikitext
1916 a
1917 {{blank}} <!---->
1918 b
1919 !! html
1920 <p>a
1921 </p><p>b
1922 </p>
1923 !! end
1924
1925 !! test
1926 post-expand include size being exceeded
1927 !! options
1928 maxincludesize=20
1929 !! wikitext
1930 {{echo3|1234567890}}
1931 !! html
1932 <p><a href="/wiki/Template:Echo3" title="Template:Echo3">Template:Echo3</a><!-- WARNING: template omitted, post-expand include size too large -->
1933 </p>
1934 !! end
1935
1936 !! test
1937 max template depth being reached
1938 !! options
1939 maxtemplatedepth=1
1940 !! wikitext
1941 {{echo with depth|too deep!}}
1942 !! html
1943 <p><span class="error">Template recursion depth limit exceeded (1)</span>
1944 </p>
1945 !! end
1946
1947 !! test
1948 multiple templates that are redirects
1949 !! wikitext
1950 {{redirect to foo}}
1951 {{redirect to foo}}
1952 !! html
1953 <p>FOO
1954 FOO
1955 </p>
1956 !! end
1957
1958 !! test
1959 Multiple comments should still parse as SOL-transparent
1960 !! options
1961 parsoid=wt2html,wt2wt
1962 !! wikitext
1963 <!--c1-->*a
1964 <!--c2--><!--c3--><!--c4-->*b
1965 !! html/php
1966 <ul><li>a</li>
1967 <li>b</li></ul>
1968
1969 !! html/parsoid
1970 <!--c1--><ul>
1971 <li>a
1972 </li>
1973 <!--c2--><!--c3--><!--c4-->
1974 <li>b
1975 </li>
1976 </ul>
1977 !! end
1978
1979 ## Make sure ">" gets escaped in comments to avoid XSS
1980 !! test
1981 IE conditional comments
1982 !! wikitext
1983 <!--[if lt IE 9]>
1984 <script>alert('hi');</script>
1985 <![endif]-->
1986 !! html/parsoid
1987 <!--[if lt IE 9]&#x3E;
1988 <script&#x3E;alert('hi');</script&#x3E;
1989 <![endif]-->
1990 !! end
1991
1992 ###
1993 ### paragraph wrapping tests
1994 ###
1995
1996 !! test
1997 No block tags
1998 !! wikitext
1999 a
2000
2001 b
2002 !! html
2003 <p>a
2004 </p><p>b
2005 </p>
2006 !! end
2007
2008 !! test
2009 Block tag on one line (<div>)
2010 !! wikitext
2011 a <div>foo</div>
2012
2013 b
2014 !! html
2015 a <div>foo</div>
2016 <p>b
2017 </p>
2018 !! html+tidy
2019 <p>a </p><div>foo</div>
2020 <p>b
2021 </p>
2022 !! end
2023
2024 # Remex wraps empty tag runs with p-tags.
2025 # Parsoid strips them out during p-wrapping.
2026 !! test
2027 No p-wrappable content
2028 !! wikitext
2029 <span><div>x</div></span>
2030 <span><s><div>x</div></s></span>
2031 <small><em></em></small><span><s><div>x</div></s></span>
2032 !! html/php+tidy
2033 <span><div>x</div></span>
2034 <span><s><div>x</div></s></span>
2035 <p><small><em></em></small></p><span><s><div>x</div></s></span>
2036 !! html/parsoid
2037 <span><div>x</div></span>
2038 <span><s><div>x</div></s></span>
2039 <small><em></em></small><span><s><div>x</div></s></span>
2040 !! end
2041
2042 # T177612: Parsoid-only test
2043 !! test
2044 Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code
2045 !! wikitext
2046 {{echo|<span><div>x</div></span>}}
2047 x
2048 !! html/parsoid
2049 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>&lt;div>x&lt;/div>&lt;/span>"}},"i":0}}]}'><div>x</div></span>
2050 <p>x</p>
2051 !! end
2052
2053 !! test
2054 Block tag on one line (<blockquote>)
2055 !! wikitext
2056 a <blockquote>foo</blockquote>
2057
2058 b
2059 !! html
2060 a <blockquote>foo</blockquote>
2061 <p>b
2062 </p>
2063 !! html+tidy
2064 <p>a </p><blockquote><p>foo</p></blockquote>
2065 <p>b
2066 </p>
2067 !! end
2068
2069 !! test
2070 Block tag on both lines (<div>)
2071 !! wikitext
2072 a <div>foo</div>
2073
2074 b <div>foo</div>
2075 !! html
2076 a <div>foo</div>
2077 b <div>foo</div>
2078
2079 !! html+tidy
2080 <p>a </p><div>foo</div><p>
2081 b </p><div>foo</div>
2082 !! end
2083
2084 !! test
2085 Block tag on both lines (<blockquote>)
2086 !! wikitext
2087 a <blockquote>foo</blockquote>
2088
2089 b <blockquote>foo</blockquote>
2090 !! html
2091 a <blockquote>foo</blockquote>
2092 b <blockquote>foo</blockquote>
2093
2094 !! html+tidy
2095 <p>a </p><blockquote><p>foo</p></blockquote><p>
2096 b </p><blockquote><p>foo</p></blockquote>
2097 !! end
2098
2099 !! test
2100 Multiple lines without block tags
2101 !! wikitext
2102 <div>foo</div> a
2103 b
2104 c
2105 d<!--foo--> e
2106 x <div>foo</div> z
2107 !! html
2108 <div>foo</div> a
2109 <p>b
2110 c
2111 d e
2112 </p>
2113 x <div>foo</div> z
2114
2115 !! html+tidy
2116 <div>foo</div><p> a
2117 </p><p>b
2118 c
2119 d e
2120 </p><p>
2121 x </p><div>foo</div><p> z
2122 </p>
2123 !! end
2124
2125 # The difference between Parsoid & Remex here
2126 # is because of Parsoid's Tidy-emulation code
2127 # for p-wrapping. We'll start work to remove this
2128 # emulation code in Parsoid sooner than later.
2129 # Remex wraps empty tag runs with p-tags.
2130 # Parsoid strips them out in a separate pass.
2131 !! test
2132 Empty lines between lines with block tags
2133 !! wikitext
2134 <div></div>
2135
2136
2137 <div></div>a
2138
2139 b
2140 <div>a</div>b
2141
2142 <div>b</div>d
2143
2144
2145 <div>e</div>
2146 !! html
2147 <div></div>
2148 <p><br />
2149 </p>
2150 <div></div>a
2151 <p>b
2152 </p>
2153 <div>a</div>b
2154 <div>b</div>d
2155 <p><br />
2156 </p>
2157 <div>e</div>
2158
2159 !! html+tidy
2160 <div></div>
2161 <p><br />
2162 </p>
2163 <div></div><p>a
2164 </p><p>b
2165 </p>
2166 <div>a</div><p>b
2167 </p><div>b</div><p>d
2168 </p><p><br />
2169 </p>
2170 <div>e</div>
2171 !! html/parsoid
2172 <div data-parsoid='{"stx":"html"}'></div>
2173
2174 <p><br /></p>
2175 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2176
2177 <p>b</p>
2178 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2179
2180 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2181
2182 <p><br /></p>
2183 <div data-parsoid='{"stx":"html"}'>e</div>
2184 !! end
2185
2186 !! test
2187 Unclosed HTML p-tags should be handled properly
2188 !! wikitext
2189 <div><p>foo</div>
2190 a
2191
2192 b
2193 !! html/php+tidy
2194 <div><p>foo</p></div>
2195 <p>a
2196 </p><p>b
2197 </p>
2198 !! html/parsoid
2199 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2200 <p>a</p>
2201 <p>b</p>
2202 !! end
2203
2204 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2205 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2206 ## them for now.
2207 !! test
2208 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2209 !! options
2210 parsoid=wt2html
2211 !! wikitext
2212 a [[Category:A1]] [[Category:A2]]
2213 [[Category:A3]]
2214 [[Category:A4]]
2215 !! html/parsoid
2216 <p>a</p>
2217 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2218 !! end
2219
2220 !! test
2221 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2222 !! options
2223 parsoid=wt2html
2224 !! wikitext
2225 [[Category:A1]]a
2226 !! html/parsoid
2227 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2228 !! end
2229
2230 !! test
2231 No paragraph necessary for SOL transparent template
2232 !! wikitext
2233 <span><div>foo</div></span>
2234 [[Category:Foo]]
2235
2236 <span><div>foo</div></span>
2237 {{echo|[[Category:Foo]]}}
2238 !! html/php
2239 <span><div>foo</div></span>
2240 <span><div>foo</div></span>
2241
2242 !! html/parsoid
2243 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2244 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
2245
2246 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2247 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]"}},"i":0}}]}'/>
2248 !! end
2249
2250 !! test
2251 Avoid expanding multiline sol transparent template ranges unnecessarily
2252 !! wikitext
2253 hi
2254
2255
2256 {{echo|<br/>
2257 }}
2258
2259 [[Category:Ho]]
2260 !! html/php
2261 <p>hi
2262 </p><p><br />
2263 <br />
2264 </p>
2265 !! html/parsoid
2266 <p>hi</p>
2267
2268 <p><br />
2269 <br about="#mwt1" typeof="mw:Transclusion" data-parsoid='{}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;br/>\n"}},"i":0}}]}'/><span about="#mwt1">
2270 </span></p>
2271
2272 <link rel="mw:PageProp/Category" href="./Category:Ho" />
2273 !! end
2274
2275 !! test
2276 Paragraph wrapping following unclosed table
2277 !! options
2278 parsoid=wt2html,html2html
2279 !! wikitext
2280 {|
2281 |-
2282
2283 {|
2284 | x
2285 |}
2286
2287 a
2288
2289 b
2290
2291 c
2292 !! html/php+tidy
2293 <table>
2294
2295
2296 </table><table>
2297 <tbody><tr>
2298 <td>x
2299 </td></tr></tbody></table>
2300 <p>a
2301 </p><p>b
2302 </p><p>c
2303 </p>
2304 !! html/parsoid
2305 <table data-parsoid='{"autoInsertedEnd":true}'>
2306 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr>
2307
2308 </tbody></table><table>
2309 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>x</td></tr>
2310 </tbody></table>
2311
2312 <p>a</p>
2313
2314 <p>b</p>
2315
2316 <p>c</p>
2317 !! end
2318
2319 !! test
2320 Paragraph wrapping suppressed in html p
2321 !! options
2322 parsoid=wt2html,html2html
2323 !! wikitext
2324 <p>
2325
2326
2327 hi
2328
2329
2330
2331 </p>
2332 !! html/php+tidy
2333 <p>
2334
2335
2336 hi
2337
2338
2339
2340 </p>
2341 !! html/parsoid
2342 <p data-parsoid='{"stx":"html"}'>
2343
2344
2345 hi
2346
2347
2348
2349 </p>
2350 !! end
2351
2352 ###
2353 ### Preformatted text
2354 ###
2355
2356 !! test
2357 Preformatted text
2358 !! wikitext
2359 This is some
2360 Preformatted text
2361 With ''italic''
2362 And '''bold'''
2363 And a [[Main Page|link]]
2364 !! html
2365 <pre>This is some
2366 Preformatted text
2367 With <i>italic</i>
2368 And <b>bold</b>
2369 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2370 </pre>
2371 !! end
2372
2373 !! test
2374 Tabs don't trigger preformatted text
2375 !! wikitext
2376 This is not
2377 preformatted text.
2378 This is preformatted text.
2379 So is this.
2380 !! html/php
2381 <p> This is not
2382 preformatted text.
2383 </p>
2384 <pre>This is preformatted text.
2385 So is this.
2386 </pre>
2387 !! html/parsoid
2388 <p> This is not
2389 preformatted text.</p>
2390 <pre>This is preformatted text.
2391 So is this.</pre>
2392 !! end
2393
2394 !! test
2395 Space before tab needs nowiki pre protection
2396 !! options
2397 parsoid=html2wt
2398 !! html/parsoid
2399 <p> a</p>
2400 !! wikitext
2401 <nowiki> </nowiki> a
2402 !! end
2403
2404 !! test
2405 Ident preformatting with inline content
2406 !! wikitext
2407 a
2408 ''b''
2409 !! html
2410 <pre>a
2411 <i>b</i>
2412 </pre>
2413 !! end
2414
2415 !! test
2416 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2417 !! wikitext
2418 <pre><nowiki>
2419 <b>
2420 <cite>
2421 <em>
2422 </nowiki></pre>
2423 !! html
2424 <pre>
2425 &lt;b&gt;
2426 &lt;cite&gt;
2427 &lt;em&gt;
2428 </pre>
2429
2430 !! end
2431
2432 !! test
2433 Regression with preformatted in <center>
2434 !! wikitext
2435 <center>
2436 Blah
2437 </center>
2438 !! html
2439 <center>
2440 <pre>Blah
2441 </pre>
2442 </center>
2443
2444 !! end
2445
2446 !! test
2447 T54763: Preformatted in <blockquote>
2448 !! wikitext
2449 <blockquote>
2450 Blah
2451 {|
2452 |
2453 indented cell (no pre-wrapping!)
2454 |}
2455 </blockquote>
2456 !! html
2457 <blockquote>
2458 <p> Blah
2459 </p>
2460 <table>
2461 <tr>
2462 <td>
2463 <p> indented cell (no pre-wrapping!)
2464 </p>
2465 </td></tr></table>
2466 </blockquote>
2467
2468 !! end
2469
2470 !! test
2471 T53086: Double newlines in blockquotes should be turned into paragraphs
2472 !! wikitext
2473 <blockquote>
2474 Foo
2475
2476 Bar
2477 </blockquote>
2478 !! html
2479 <blockquote>
2480 <p>Foo
2481 </p><p>Bar
2482 </p>
2483 </blockquote>
2484
2485 !! end
2486
2487 !! test
2488 T17491: <ins>/<del> in blockquote
2489 !! wikitext
2490 <blockquote>
2491 Foo <del>bar</del> <ins>baz</ins> quux
2492 </blockquote>
2493 !! html
2494 <blockquote>
2495 <p>Foo <del>bar</del> <ins>baz</ins> quux
2496 </p>
2497 </blockquote>
2498
2499 !! html+tidy
2500 <blockquote>
2501 <p>Foo <del>bar</del> <ins>baz</ins> quux
2502 </p>
2503 </blockquote>
2504 !! end
2505
2506 !! test
2507 T17491: <ins>/<del> in blockquote (2)
2508 !! wikitext
2509 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2510 </blockquote>
2511 !! html
2512 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2513 </blockquote>
2514
2515 !! html+tidy
2516 <blockquote><p>Foo <del>bar</del> <ins>baz</ins> quux
2517 </p></blockquote>
2518 !! end
2519
2520 !! test
2521 <pre> with attributes (T5202)
2522 !! wikitext
2523 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2524 !! html
2525 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2526
2527 !! end
2528
2529 !! test
2530 <pre> with width attribute (T5202)
2531 !! wikitext
2532 <pre width="8">Narrow screen goodies</pre>
2533 !! html
2534 <pre width="8">Narrow screen goodies</pre>
2535
2536 !! end
2537
2538 !! test
2539 <pre> with forbidden attribute (T5202)
2540 !! wikitext
2541 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2542 !! html
2543 <pre width="8">Narrow screen goodies</pre>
2544
2545 !! end
2546
2547 !! test
2548 Entities inside <pre>
2549 !! wikitext
2550 <pre>&lt;</pre>
2551 !! html
2552 <pre>&lt;</pre>
2553
2554 !! end
2555
2556 !! test
2557 <pre> with forbidden attribute values (T5202)
2558 !! wikitext
2559 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2560 !! html
2561 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2562
2563 !! end
2564
2565 !! test
2566 <nowiki> inside <pre> (T15238)
2567 !! wikitext
2568 <pre>
2569 <nowiki>
2570 </pre>
2571 <pre>
2572 <nowiki></nowiki>
2573 </pre>
2574 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2575 !! html
2576 <pre>
2577 &lt;nowiki&gt;
2578 </pre>
2579 <pre>
2580
2581 </pre>
2582 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2583
2584 !! end
2585
2586 !! test
2587 <nowiki> inside of #tag:pre
2588 !! wikitext
2589 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2590 !! html/php
2591 <pre>Foo &#8594;bar</pre>
2592
2593 !! html/parsoid
2594 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2595 !! end
2596
2597 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2598 ## aren't enclosed in nowikis.
2599 !! test
2600 <nowiki> and <pre> preference (first one wins)
2601 !! options
2602 parsoid=wt2html
2603 !! wikitext
2604 <pre>
2605 <nowiki>
2606 </pre>
2607 </nowiki>
2608 </pre>
2609
2610 <nowiki>
2611 <pre>
2612 <nowiki>
2613 </pre>
2614 </nowiki>
2615 </pre>
2616
2617 !! html/php
2618 <pre>
2619 &lt;nowiki&gt;
2620 </pre>
2621 <p>&lt;/nowiki&gt;
2622 &lt;/pre&gt;
2623 </p><p>
2624 &lt;pre&gt;
2625 &lt;nowiki&gt;
2626 &lt;/pre&gt;
2627
2628 &lt;/pre&gt;
2629 </p>
2630 !! html/parsoid
2631 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2632 </pre>
2633 <p>&lt;/nowiki></p>
2634
2635
2636 <p><span typeof="mw:Nowiki">
2637 &lt;pre>
2638 &lt;nowiki>
2639 &lt;/pre>
2640 </span></p>
2641 !! end
2642
2643 !! test
2644 </pre> inside nowiki
2645 !! wikitext
2646 <nowiki></pre></nowiki>
2647 !! html
2648 <p>&lt;/pre&gt;
2649 </p>
2650 !! end
2651
2652 !! test
2653 Empty pre; pre inside other HTML tags (T56946)
2654 !! wikitext
2655 a
2656
2657 <div><pre>
2658 foo
2659 </pre></div>
2660 <pre></pre>
2661 !! html/php+tidy
2662 <p>a
2663 </p>
2664 <div><pre>foo
2665 </pre></div>
2666 <pre></pre>
2667 !! html/parsoid
2668 <p>a</p>
2669
2670 <div data-parsoid='{"stx":"html"}'><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
2671 </pre></div>
2672 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2673 !! end
2674
2675 !! test
2676 HTML pre followed by indent-pre
2677 !! wikitext
2678 <pre>foo</pre>
2679 bar
2680 !! html
2681 <pre>foo</pre>
2682 <pre>bar
2683 </pre>
2684 !! end
2685
2686 !! test
2687 Block tag pre
2688 !! wikitext
2689 <p><pre>foo</pre></p>
2690 !! html/php+tidy
2691 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2692 !! html/parsoid
2693 <p class='mw-empty-elt' data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre><p class='mw-empty-elt' data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2694 !! end
2695
2696 !!test
2697 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2698 !! wikitext
2699 {{echo|}}
2700 !! html
2701
2702 !!end
2703
2704 !!test
2705 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2706 !! wikitext
2707 {{echo|
2708 foo}}
2709 !! html
2710 <p>foo
2711 </p>
2712 !!end
2713
2714 !! test
2715 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2716 !! wikitext
2717 {{echo|a
2718 b}}
2719 !! html
2720 <pre>a
2721 </pre>
2722 <p>b
2723 </p>
2724 !!end
2725
2726 !! test
2727 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2728 !! wikitext
2729 {{echo|a
2730 b
2731 c
2732 d
2733 e
2734 }}
2735 !! html
2736 <pre>a
2737 </pre>
2738 <p>b
2739 c
2740 </p>
2741 <pre>d
2742 </pre>
2743 <p>e
2744 </p>
2745 !!end
2746
2747 !!test
2748 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2749 !! wikitext
2750 {{echo| foo}}
2751
2752 {{echo| foo}}{{echo| bar}}
2753
2754 {{echo| foo}}
2755 {{echo| bar}}
2756
2757 {{echo|<!--cmt--> foo}}
2758
2759 <!--cmt-->{{echo| foo}}
2760
2761 {{echo|{{echo| }}bar}}
2762 !! html
2763 <pre>foo
2764 </pre>
2765 <pre>foo bar
2766 </pre>
2767 <pre>foo
2768 bar
2769 </pre>
2770 <pre>foo
2771 </pre>
2772 <pre>foo
2773 </pre>
2774 <pre>bar
2775 </pre>
2776 !!end
2777
2778 !! test
2779 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2780 !! wikitext
2781 {{echo| }}a
2782
2783 {{echo|
2784 }}a
2785
2786 {{echo|
2787 b}}
2788
2789 {{echo|a
2790 }}b
2791
2792 {{echo|a
2793 }} b
2794 !! html
2795 <pre>a
2796 </pre>
2797 <p><br />
2798 </p>
2799 <pre>a
2800 </pre>
2801 <p><br />
2802 </p>
2803 <pre>b
2804 </pre>
2805 <p>a
2806 </p>
2807 <pre>b
2808 </pre>
2809 <p>a
2810 </p>
2811 <pre>b
2812 </pre>
2813 !!end
2814
2815 ## Hmm, should Parsoid rt this?
2816 !! test
2817 Pres with newline attributes
2818 !! options
2819 parsoid=wt2html,html2html
2820 !! wikitext
2821 <pre class="one
2822 two">hi</pre>
2823 !! html/php
2824 <pre class="one two">hi</pre>
2825
2826 !! html/parsoid
2827 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2828 !! end
2829
2830 !! test
2831 Things that look like <pre> tags aren't treated as such
2832 !! wikitext
2833 Barack Obama <President> of the United States
2834 <President></President>
2835 !! html
2836 <p>Barack Obama &lt;President&gt; of the United States
2837 &lt;President&gt;&lt;/President&gt;
2838 </p>
2839 !! end
2840
2841 !! test
2842 Handle broken pre-like tags (T66025)
2843 !! options
2844 parsoid=wt2html
2845 !! wikitext
2846 {{echo|<pre <pre>x</pre>}}
2847
2848 <table><pre </table>
2849 !! html/php
2850 <pre>x</pre>
2851 <table>&lt;pre </table>
2852
2853 !! html/php+tidy
2854 <pre>x</pre>
2855 &lt;pre <table></table>
2856 !! html/parsoid
2857 <pre typeof="mw:Transclusion mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html","a":{"&lt;pre":null},"sa":{"&lt;pre":""},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2858
2859 <span data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>&lt;pre </span><table data-parsoid='{"stx":"html"}'></table>
2860 !! end
2861
2862 !! test
2863 Parsoid: handle pre with space after attribute
2864 !! options
2865 parsoid=wt2html
2866 !! wikitext
2867 <pre style="width:50%;" >{{echo|foo}}</pre>
2868 !! html/php
2869 <pre style="width:50%;">{{echo|foo}}</pre>
2870
2871 !! html/parsoid
2872 <pre typeof="mw:Extension/pre" about="#mwt2" style="width:50%;" data-mw='{"name":"pre","attrs":{"style":"width:50%;"},"body":{"extsrc":"{{echo|foo}}"}}'>{{echo|foo}}</pre>
2873 !! end
2874
2875 # TODO / maybe: fix wt2wt for this
2876 !! test
2877 Parsoid: Don't paragraph-wrap fosterable content
2878 !! options
2879 parsoid=wt2html
2880 !! wikitext
2881 {|
2882 <td></td>
2883 <td></td>
2884
2885
2886
2887 |}
2888 !! html
2889 <table>
2890
2891 <tbody>
2892 <tr>
2893 <td></td>
2894
2895 <td></td></tr>
2896
2897
2898
2899 </tbody></table>
2900 !! end
2901
2902 !! test
2903 Self-closed pre
2904 !! wikitext
2905 <pre />
2906 !! html/php
2907 <pre></pre>
2908
2909 !! html/parsoid
2910 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":null}'></pre>
2911 !! end
2912
2913 !! test
2914 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2915 !! options
2916 parsoid=wt2html
2917 !! wikitext
2918 {|
2919 <td>
2920 <td>
2921 </td>
2922
2923
2924
2925 |}
2926 !! html
2927 <table>
2928
2929 <tbody>
2930 <tr>
2931 <td></td>
2932
2933 <td>
2934 </td></tr>
2935
2936
2937
2938 </tbody></table>
2939 !! end
2940
2941
2942 #--------------------------------------------------------------------
2943 # Transclusion parameter whitespace stripping tests
2944 # Behavior is different for positional and named parameters
2945 #--------------------------------------------------------------------
2946 !! test
2947 Templates: Strip leading and trailing whitespace from named-param values
2948 !! wikitext
2949 {{echo|1= a }}
2950
2951 {{echo|1= {{echo|b}} }}
2952
2953 {{echo| 1 =
2954 c }}
2955
2956 {{echo| 1 =
2957 * d
2958 }}
2959 !! html
2960 <p>a
2961 </p><p>b
2962 </p><p>c
2963 </p>
2964 <ul><li>d</li></ul>
2965
2966 !! end
2967
2968 !! test
2969 Templates: Don't strip whitespace from positional-param values
2970 !! wikitext
2971 {{echo|a }}
2972
2973 {{echo|{{echo|b}} }}
2974
2975 {{echo| c
2976 }}
2977
2978 {{echo| {{echo|d}}
2979 }}
2980
2981 {{echo|
2982 e}}
2983
2984 {{echo|
2985 *f}}
2986
2987 {{echo|
2988 }}g
2989 !! html
2990 <p>a
2991 </p><p>b
2992 </p>
2993 <pre>c
2994 </pre>
2995 <p><br />
2996 </p>
2997 <pre>d
2998 </pre>
2999 <p><br />
3000 </p>
3001 <pre>e
3002 </pre>
3003 <p><br />
3004 </p>
3005 <ul><li>f</li></ul>
3006 <p><br />
3007 </p>
3008 <pre>g
3009 </pre>
3010 !! end
3011
3012 !! test
3013 Templates: Don't recognize targets split by newlines
3014 !! options
3015 parsoid=wt2html
3016 !! wikitext
3017 {{ech
3018 o|foo}}
3019 !! html/php
3020 <p>{{ech
3021 o|foo}}
3022 </p>
3023 !! html/parsoid
3024 <p>{{ech
3025 o|foo}}</p>
3026 !! end
3027
3028 !! test
3029 Templates: Recognize targets when newlines and comments don't split the target
3030 !! options
3031 parsoid=wt2html
3032 !! wikitext
3033 {{
3034 <!--X--> ech<!--X-->o<!--X-->
3035 <!--X--> <!--X-->
3036
3037 |foo}}
3038 !! html/php
3039 <p>foo
3040 </p>
3041 !! html/parsoid
3042 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ech&lt;!--X-->o&lt;!--X--> \n &lt;!--X--> &lt;!--X-->\n\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3043 !! end
3044
3045 !! test
3046 Templates: Handle empty comment-and-ws-only lines correctly
3047 !! wikitext
3048 {{echo|foo
3049 <!--should be ignored-->
3050 <!--should be ignored as well-->
3051 bar}}
3052 !! html/php
3053 <p>foo
3054 bar
3055 </p>
3056 !! html/parsoid
3057 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
3058 !! end
3059
3060 !! test
3061 Templates: Handle comments in the target
3062 !! wikitext
3063 {{echo
3064 <!-- should be ignored -->
3065 |foo}}
3066
3067 {{echo
3068 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
3069 |foo}}
3070
3071 {{echo<!-- should be ignored -->
3072 |foo}}
3073
3074 {{echo<!-- should be ignored -->|foo}}
3075
3076 {{<!-- should be ignored -->echo|foo}}
3077 !! html/php
3078 <p>foo
3079 </p><p>foo
3080 </p><p>foo
3081 </p><p>foo
3082 </p><p>foo
3083 </p>
3084 !! html/parsoid
3085 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3086
3087 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored and spaces on next line should not trip us up (T147742) -->\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3088
3089 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3090
3091 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3092
3093 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3094 !! end
3095
3096 !! test
3097 Templates: Handle comments in parameter names (T69657)
3098 !! wikitext
3099 {{echo|1
3100 <!-- should be ignored -->
3101 =foo}}
3102
3103 {{echo|
3104 <!-- should be ignored -->
3105 1 = foo}}
3106
3107 {{echo|1<!-- should be ignored -->=foo}}
3108
3109 {{echo|<!-- should be ignored -->1=foo}}
3110 !! html/php
3111 <p>foo
3112 </p><p>foo
3113 </p><p>foo
3114 </p><p>foo
3115 </p>
3116 !! html/parsoid
3117 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
3118
3119 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
3120
3121 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
3122
3123 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
3124 !! end
3125
3126 !! test
3127 Templates: Other wikitext in parameter names (T69657)
3128 !! wikitext
3129 {{echo|''1''=foo}}
3130 !! html/php
3131 <p>{{{1}}}
3132 </p>
3133 !! html/parsoid
3134 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3135 !! end
3136
3137 !! test
3138 Templates: With colons
3139 !! wikitext
3140 {{With: Colon}}
3141 !! html/php
3142 <p>Template with colon
3143 </p>
3144 !! html/parsoid
3145 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"With: Colon","href":"./Template:With:_Colon"},"params":{},"i":0}}]}'>Template with colon</p>
3146 !! end
3147
3148 #--------------------------------------------------------------------
3149 # Transclusion parameter escaping tests
3150 #--------------------------------------------------------------------
3151
3152 !! test
3153 Templates: Parsoid parameter escaping test 1
3154 !! wikitext
3155 {{echo|[foo]|{{echo|[bar]}}}}
3156 !! html/php+tidy
3157 <p>[foo]
3158 </p>
3159 !! html/parsoid
3160 <p about="#mwt1" typeof="mw:Transclusion"
3161 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
3162 !! end
3163
3164 !! test
3165 Parsoid: Pipes in external links in template parameter
3166 !! wikitext
3167 {{echo|[{{echo|http://example.com}} link]}}
3168 !! html/php+tidy
3169 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
3170 </p>
3171 !! html/parsoid
3172 <p><a rel="mw:ExtLink" class="external text" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
3173 !! end
3174
3175 !! test
3176 Parsoid: pipe in transclusion parameter
3177 !! wikitext
3178 {{echo|http://foo.com/a&#124;b}}
3179 !! html/php+tidy
3180 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
3181 </p>
3182 !! html/parsoid
3183 <p><a rel="mw:ExtLink" class="external free" href="http://foo.com/a%7Cb" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a%7Cb</a></p>
3184 !! end
3185
3186 !! test
3187 Parsoid: Pipe in external link target and content in template parameter
3188 !! options
3189 parsoid=html2wt,wt2wt
3190 !! wikitext
3191 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
3192 !! html/php+tidy
3193 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
3194 </p>
3195 !! html/parsoid
3196 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
3197 typeof="mw:Transclusion"
3198 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
3199 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
3200 !! end
3201
3202 !! test
3203 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
3204 !! options
3205 parsoid
3206 !! wikitext
3207 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
3208 !! html
3209 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
3210 !! end
3211
3212 !! test
3213 Templates: Don't escape already nowiki-escaped text in template parameters
3214 !! options
3215 parsoid=html2wt,wt2wt
3216 !! wikitext
3217 {{echo|foo<nowiki>|</nowiki>bar}}
3218 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3219 {{echo|<nowiki></nowiki>}}
3220 !! html/php+tidy
3221 <p>foo|bar
3222 &lt;div&gt;
3223
3224 </p>
3225 !! html/parsoid
3226 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
3227 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
3228 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
3229 </p>
3230 !! end
3231
3232 ## T54824
3233 !! test
3234 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3235 !! options
3236 parsoid=html2wt,wt2wt
3237 !! wikitext
3238 {{echo|{{echo|1=bar}}}}
3239 !! html/php+tidy
3240 <p>bar
3241 </p>
3242 !! html/parsoid
3243 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
3244 !! end
3245
3246 ## T58733
3247 !! test
3248 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3249 !! wikitext
3250 {{echo|a : b}}
3251 !! html/php+tidy
3252 <p>a&#160;: b
3253 </p>
3254 !! html/parsoid
3255 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
3256 !! end
3257
3258 ## T73412
3259 !! test
3260 Templates: Preserve blank parameter names
3261 !! wikitext
3262 {{echo|=foo}}
3263 !! html/php+tidy
3264 <p>{{{1}}}
3265 </p>
3266 !! html/parsoid
3267 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3268 !! end
3269
3270 !! test
3271 Templates: Preserve blank parameter names in other positions
3272 !! wikitext
3273 {{blank_param|bar|=foo}}
3274 !! html/php+tidy
3275 <p>bar
3276 foo
3277 </p>
3278 !! html/parsoid
3279 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
3280 foo</p>
3281 !! end
3282
3283 ###
3284 ### Parsoid-centric tests for testing RT edge cases for pre
3285 ###
3286
3287 !!test
3288 1a. Indent-Pre and Comments
3289 !! wikitext
3290 a
3291 <!--a-->
3292 c
3293 !! html
3294 <pre>a
3295 </pre>
3296 <p>c
3297 </p>
3298 !!end
3299
3300 !!test
3301 1b. Indent-Pre and Comments
3302 !! wikitext
3303 a
3304 <!--a-->
3305 c
3306 !! html
3307 <pre>a
3308 </pre>
3309 <p>c
3310 </p>
3311 !!end
3312
3313 !!test
3314 1c. Indent-Pre and Comments
3315 !! wikitext
3316 <!--a--> a
3317
3318 <!--a--> a
3319 !! html
3320 <pre> a
3321 </pre>
3322 <pre> a
3323 </pre>
3324 !!end
3325
3326 !!test
3327 1d. Indent-Pre and Comments
3328 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3329 !! wikitext
3330 <!--a--> a
3331
3332 <!--b-->b
3333 !! html
3334 <pre>a
3335 </pre>
3336 <pre>b
3337 </pre>
3338 !!end
3339
3340 !!test
3341 2a. Indent-Pre and tables
3342 !! wikitext
3343 {|
3344 |-
3345 !h1!!h2
3346 |foo||bar
3347 |}
3348 !! html
3349 <table>
3350
3351 <tr>
3352 <th>h1</th>
3353 <th>h2
3354 </th>
3355 <td>foo</td>
3356 <td>bar
3357 </td></tr></table>
3358
3359 !!end
3360
3361 !!test
3362 2b. Indent-Pre and tables
3363 !! wikitext
3364 {|
3365 |-
3366 |foo
3367 |}
3368 !! html
3369 <table>
3370
3371 <tr>
3372 <td>foo
3373 </td></tr></table>
3374
3375 !!end
3376
3377 !!test
3378 2c. Indent-Pre and tables (T44252)
3379 !! wikitext
3380 {|
3381 |+foo
3382 ! |bar
3383 |}
3384 !! html
3385 <table>
3386 <caption>foo
3387 </caption>
3388 <tr>
3389 <th>bar
3390 </th></tr></table>
3391
3392 !!end
3393
3394 !!test
3395 2d. Indent-Pre and tables
3396 !! wikitext
3397 a
3398 {|
3399 |b
3400 |}
3401 !! html/php
3402 <pre>a
3403 </pre>
3404 <table>
3405 <tr>
3406 <td>b
3407 </td></tr></table>
3408
3409 !! html/parsoid
3410 <pre>a</pre>
3411 <table>
3412 <tbody><tr><td> b</td></tr>
3413 </tbody></table>
3414 !!end
3415
3416 !!test
3417 2e. Indent-Pre and table-line syntax
3418 !! wikitext
3419 a
3420 | b
3421 | c
3422 !! html/php
3423 <pre>a
3424 | b
3425 | c
3426 </pre>
3427 !!end
3428
3429 !!test
3430 2f. Indent-pre started by table-line syntax
3431 !! wikitext
3432 a
3433 | b
3434 | c
3435 !! html/php
3436 <p>a
3437 </p>
3438 <pre>| b
3439 | c
3440 </pre>
3441 !! html/parsoid
3442 <p>a</p>
3443 <pre>
3444 | b
3445 | c</pre>
3446 !!end
3447
3448 !! test
3449 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3450 !! wikitext
3451 <table>
3452 <tr>
3453 <td>
3454 Text that should be rendered preformatted
3455 </td>
3456 </tr>
3457 </table>
3458 !! html
3459 <table>
3460 <tr>
3461 <td>
3462 <pre>Text that should be rendered preformatted
3463 </pre>
3464 </td>
3465 </tr>
3466 </table>
3467
3468 !! end
3469
3470 !! test
3471 2h. Indent pre in tables
3472 !! options
3473 parsoid=wt2html,html2html
3474 !! wikitext
3475 {|
3476 !
3477 foo
3478 !
3479 bar
3480 |-
3481 |
3482 baz
3483 {{!}}
3484 bam
3485 |}
3486 !! html/php
3487 <table>
3488 <tr>
3489 <th>
3490 <pre>foo
3491 </pre>
3492 </th>
3493 <th>
3494 <pre>bar
3495 </pre>
3496 </th></tr>
3497 <tr>
3498 <td>
3499 <pre>baz
3500 </pre>
3501 </td>
3502 <td>
3503 <pre>bam
3504 </pre>
3505 </td></tr></table>
3506
3507 !! html/parsoid
3508 <table>
3509 <tbody><tr><th>
3510 <pre>foo</pre>
3511 </th><th>
3512 <pre>bar</pre>
3513 </th></tr><tr>
3514 <td>
3515 <pre>baz</pre>
3516 </td><td data-parsoid='{"startTagSrc":"{{!}}"}'>
3517 <pre>bam</pre>
3518 </td></tr></tbody></table>
3519 !! end
3520
3521 !!test
3522 3a. Indent-Pre and block tags (single-line html)
3523 !! wikitext
3524 a <p> foo </p>
3525 b <div> foo </div>
3526 c <blockquote> foo </blockquote>
3527 <span> foo </span>
3528 !! html
3529 a <p> foo </p>
3530 b <div> foo </div>
3531 c <blockquote> foo </blockquote>
3532 <pre><span> foo </span>
3533 </pre>
3534 !! html/parsoid
3535 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3536 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3537 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3538 <pre><span> foo </span>
3539 </pre>
3540 !! html/php+tidy
3541 <p> a </p><p> foo </p><p>
3542 b </p><div> foo </div><p>
3543 c </p><blockquote><p> foo </p></blockquote>
3544 <pre><span> foo </span>
3545 </pre>
3546 !! end
3547
3548 !! test
3549 3b. Indent-Pre and block tags (multi-line html)
3550 !! wikitext
3551 a <span>foo</span>
3552 <!-- comment --> b <div> foo </div>
3553 !! html/php
3554 <pre>a <span>foo</span>
3555 </pre>
3556 b <div> foo </div>
3557
3558 !! html/parsoid
3559 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3560 <!-- comment --> <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3561 !! html/php+tidy
3562 <pre>a <span>foo</span>
3563 </pre><p>
3564 b </p><div> foo </div>
3565 !! end
3566
3567 !!test
3568 3c. Indent-Pre and block tags (pre-content on separate line)
3569 !! wikitext
3570 <p>
3571 foo
3572 </p>
3573
3574 <div>
3575 foo
3576 </div>
3577
3578 <center>
3579 foo
3580 </center>
3581
3582 <blockquote>
3583 foo
3584 </blockquote>
3585
3586 <blockquote>
3587 <pre>
3588 foo
3589 </pre>
3590 </blockquote>
3591
3592 <table><tr><td>
3593 foo
3594 </td></tr></table>
3595
3596 <ul><li>
3597 foo
3598 </li></ul>
3599
3600 !! html
3601 <p>
3602 foo
3603 </p>
3604 <div>
3605 <pre>foo
3606 </pre>
3607 </div>
3608 <center>
3609 <pre>foo
3610 </pre>
3611 </center>
3612 <blockquote>
3613 <p> foo
3614 </p>
3615 </blockquote>
3616 <blockquote>
3617 <pre>
3618 foo
3619 </pre>
3620 </blockquote>
3621 <table><tr><td>
3622 <pre>foo
3623 </pre>
3624 </td></tr></table>
3625 <ul><li>
3626 foo
3627 </li></ul>
3628
3629 !!end
3630
3631 !! test
3632 4. Indent-Pre and extension tags
3633 !! wikitext
3634 a <tag />
3635 !! html/php
3636 a <pre>
3637 NULL
3638 array (
3639 )
3640 </pre>
3641
3642 !! html/parsoid
3643 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3644 !! end
3645
3646 !! test
3647 5. Indent-Pre and html pre
3648 !! wikitext
3649 <pre class="123">hi</pre>
3650 !! html/php
3651 <pre class="123">hi</pre>
3652
3653 !! html/parsoid
3654 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3655 !! end
3656
3657 !!test
3658 Render paragraphs when indent-pre is suppressed in blocklevels
3659 !! wikitext
3660 <blockquote>
3661 foo
3662
3663 bar
3664 </blockquote>
3665 !! html
3666 <blockquote>
3667 <p> foo
3668 </p><p> bar
3669 </p>
3670 </blockquote>
3671
3672 !!end
3673
3674 !!test
3675 4. Multiple spaces at start-of-line
3676 !! wikitext
3677 <p> foo </p>
3678 foo
3679 {|
3680 |foo
3681 |}
3682 !! html
3683 <p> foo </p>
3684 <pre> foo
3685 </pre>
3686 <table>
3687 <tr>
3688 <td>foo
3689 </td></tr></table>
3690
3691 !!end
3692
3693 ## NOTE: the leading white-space chars on empty line are significant
3694 !! test
3695 5a. White-space in indent-pre
3696 !! wikitext
3697 a<br />
3698
3699 b
3700 !! html
3701 <pre>a<br />
3702
3703 b
3704 </pre>
3705 !! end
3706
3707 ## NOTE: the leading white-space chars on empty line are significant
3708 !! test
3709 5b. White-space in indent-pre
3710 !! wikitext
3711 a
3712
3713 b
3714
3715
3716 c
3717 !! html
3718 <pre>a
3719
3720 b
3721
3722
3723 c
3724 </pre>
3725 !! end
3726
3727 !! test
3728 5c. White-space in indent-pre
3729 !! wikitext
3730 ''a''
3731 ''b''
3732 ''c''
3733 !! html
3734 <pre><i>a</i>
3735 <i>b</i>
3736 <i>c</i>
3737 </pre>
3738 !! end
3739
3740 !! test
3741 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3742 !! wikitext
3743 a
3744
3745 <!-- continue -->
3746 b
3747
3748 c
3749
3750 d
3751 !! html
3752 <pre>a
3753
3754 b
3755 </pre>
3756 <pre>c
3757
3758 </pre>
3759 <p>d
3760 </p>
3761 !! end
3762
3763 !! test
3764 7a. Indent-pre and category links
3765 !! options
3766 parsoid=wt2html,wt2wt
3767 !! wikitext
3768 [[Category:foo]] <!-- No pre-wrapping -->
3769 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3770 !! html/php+tidy
3771 !! html/parsoid
3772 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3773 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3774 !! end
3775
3776 ## We used to, but no longer wt2wt this test since the default serializer
3777 ## will normalize all categories to serialize on their own line.
3778 ## This wikitext usage is going to be fairly uncommon in production and
3779 ## selser will take care of preserving formatting in those scenarios.
3780 !! test
3781 7b. Indent-pre and category links
3782 !! options
3783 parsoid=wt2html
3784 !! wikitext
3785 [[Category:foo]] a
3786 [[Category:foo]] {{echo|b}}
3787 !! html/parsoid
3788 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3789 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3790 !! end
3791
3792 !! test
3793 Indent-Pre: Newlines in comments shouldn't affect sol state
3794 !! wikitext
3795 a <!--
3796 foo
3797 --> b
3798 !! html/php+tidy
3799 <p>a b
3800 </p>
3801 !! html/parsoid
3802 <p>a <!--
3803 foo
3804 --> b</p>
3805 !! end
3806
3807 ###
3808 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3809 ###
3810
3811 !!test
3812 HTML-pre: 1. embedded newlines
3813 !! wikitext
3814 <pre>foo</pre>
3815
3816 <pre>
3817 foo
3818 </pre>
3819
3820 <pre>
3821
3822 foo
3823 </pre>
3824
3825 <pre>
3826
3827
3828 foo
3829 </pre>
3830 !! html/php+tidy
3831 <pre>foo</pre>
3832 <pre>foo
3833 </pre>
3834 <pre>
3835
3836 foo
3837 </pre>
3838 <pre>
3839
3840
3841 foo
3842 </pre>
3843 !! html/parsoid
3844 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3845
3846 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3847 </pre>
3848
3849 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3850
3851 foo
3852 </pre>
3853
3854 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3855
3856
3857 foo
3858 </pre>
3859 !!end
3860
3861 !! test
3862 HTML-pre: big spaces
3863 !! wikitext
3864 <pre>
3865
3866
3867
3868
3869 haha
3870
3871
3872
3873
3874 haha
3875
3876
3877
3878
3879 </pre>
3880 !! html/php+tidy
3881 <pre>
3882
3883
3884
3885
3886 haha
3887
3888
3889
3890
3891 haha
3892
3893
3894
3895
3896 </pre>
3897 !! html/parsoid
3898 <pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\n\n\nhaha\n\n\n\n\nhaha\n\n\n\n\n"}}'>
3899
3900
3901
3902
3903 haha
3904
3905
3906
3907
3908 haha
3909
3910
3911
3912
3913 </pre>
3914 !! end
3915
3916 !!test
3917 HTML-pre: 2: indented text
3918 !! wikitext
3919 <pre>
3920 foo
3921 </pre>
3922 !! html
3923 <pre>
3924 foo
3925 </pre>
3926
3927 !!end
3928
3929 !!test
3930 HTML-pre: 3: other wikitext
3931 !! wikitext
3932 <pre>
3933 * foo
3934 # bar
3935 = no-h =
3936 '' no-italic ''
3937 [[ NoLink ]]
3938 </pre>
3939 !! html/php
3940 <pre>
3941 * foo
3942 # bar
3943 = no-h =
3944 '' no-italic ''
3945 [[ NoLink ]]
3946 </pre>
3947
3948 !! html/parsoid
3949 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n* foo\n# bar\n= no-h =\n&#39;&#39; no-italic &#39;&#39;\n[[ NoLink ]]\n"}}'>* foo
3950 # bar
3951 = no-h =
3952 '' no-italic ''
3953 [[ NoLink ]]
3954 </pre>
3955 !!end
3956
3957 ###
3958 ### Definition lists
3959 ###
3960 !! test
3961 Simple definition
3962 !! wikitext
3963 ;name :Definition
3964 !! html
3965 <dl><dt>name</dt>
3966 <dd>Definition</dd></dl>
3967
3968 !! end
3969
3970 !! test
3971 Definition list for indentation only
3972 !! wikitext
3973 :Indented text
3974 !! html
3975 <dl><dd>Indented text</dd></dl>
3976
3977 !! end
3978
3979 !! test
3980 Definition list with no space
3981 !! wikitext
3982 ;name:Definition
3983 !! html
3984 <dl><dt>name</dt>
3985 <dd>Definition</dd></dl>
3986
3987 !!end
3988
3989 !! test
3990 Definition list with URL link
3991 !! wikitext
3992 ;http://example.com/ :definition
3993 !! html
3994 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a></dt>
3995 <dd>definition</dd></dl>
3996
3997 !! end
3998
3999 !! test
4000 Definition list with bracketed URL link
4001 !! wikitext
4002 ;[http://www.example.com/ Example]:Something about it
4003 !! html
4004 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
4005 <dd>Something about it</dd></dl>
4006
4007 !! end
4008
4009 !! test
4010 Definition list with wikilink containing colon
4011 !! wikitext
4012 ;[[Help:FAQ]]:The least-read page on Wikipedia
4013 !! html
4014 <dl><dt><a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
4015 <dd>The least-read page on Wikipedia</dd></dl>
4016
4017 !! end
4018
4019 # At Brion's and JeLuF's insistence... :)
4020 !! test
4021 Definition list with news link containing colon
4022 !! wikitext
4023 ;news:alt.wikipedia.rox :This isn't even a real newsgroup!
4024 !! html/php
4025 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
4026 <dd>This isn't even a real newsgroup!</dd></dl>
4027
4028 !! html/parsoid
4029 <dl><dt><a rel="mw:ExtLink" class="external free" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'>This isn't even a real newsgroup!</dd></dl>
4030 !! end
4031
4032 !! test
4033 Malformed definition list with colon
4034 !! wikitext
4035 ;news:alt.wikipedia.rox -- don't crash or enter an infinite loop
4036 !! html
4037 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
4038
4039 !! end
4040
4041 !! test
4042 Definition lists: colon in external link text
4043 !! wikitext
4044 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
4045 !! html
4046 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia :The Next Generation</a></dt>
4047 <dd>OK, I made that up</dd></dl>
4048
4049 !! end
4050
4051 !! test
4052 Definition lists: colon in HTML attribute
4053 !! wikitext
4054 ;<b style="display: inline">bold</b>
4055 !! html
4056 <dl><dt><b style="display: inline">bold</b></dt></dl>
4057
4058 !! end
4059
4060 !! test
4061 Definition lists: self-closed tag
4062 !! wikitext
4063 ;one<br/>two :two-line fun
4064 !! html
4065 <dl><dt>one<br />two</dt>
4066 <dd>two-line fun</dd></dl>
4067
4068 !! end
4069
4070 !! test
4071 Definition lists: ignore colons inside tags
4072 !! wikitext
4073 ;one <b>two : tag <i>fun:</i>:</b>:def
4074 !! html
4075 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
4076 <dd>def</dd></dl>
4077
4078 !! end
4079
4080 !! test
4081 Definition lists: excess closed tags
4082 !! wikitext
4083 ;one</b>two :bad tag fun
4084 !! html/php+tidy
4085 <dl><dt>onetwo</dt>
4086 <dd>bad tag fun</dd></dl>
4087 !! html/parsoid
4088 <dl>
4089 <dt>onetwo</dt>
4090 <dd>bad tag fun</dd>
4091 </dl>
4092 !! end
4093
4094 !! test
4095 T13748: Literal closing tags
4096 !! wikitext
4097 <dl>
4098 <dt>test 1</dt>
4099 <dd>test test test test test</dd>
4100 <dt>test 2</dt>
4101 <dd>test test test test test</dd>
4102 </dl>
4103 !! html
4104 <dl>
4105 <dt>test 1</dt>
4106 <dd>test test test test test</dd>
4107 <dt>test 2</dt>
4108 <dd>test test test test test</dd>
4109 </dl>
4110
4111 !! end
4112
4113 !! test
4114 Definition and unordered list using wiki syntax nested in unordered list using html tags.
4115 !! wikitext
4116 <ul><li>
4117 ;term :description
4118 *unordered
4119 </li></ul>
4120 !! html
4121 <ul><li>
4122 <dl><dt>term</dt>
4123 <dd>description</dd></dl>
4124 <ul><li>unordered</li></ul>
4125 </li></ul>
4126
4127 !! end
4128
4129 !! test
4130 Definition list with empty definition and following paragraph
4131 !! wikitext
4132 ;term:
4133
4134 Paragraph text
4135 !! html
4136 <dl><dt>term</dt>
4137 <dd></dd></dl>
4138 <p>Paragraph text
4139 </p>
4140 !! end
4141
4142 !! test
4143 Nested definition lists using html syntax
4144 !! wikitext
4145 <dl><dt>x</dt>
4146 <dd>a</dd>
4147 <dd>b</dd></dl>
4148 !! html
4149 <dl><dt>x</dt>
4150 <dd>a</dd>
4151 <dd>b</dd></dl>
4152
4153 !! end
4154
4155 !! test
4156 Definition Lists: No nesting: Multiple dd's
4157 !! wikitext
4158 ;x
4159 :a
4160 :b
4161 !! html
4162 <dl><dt>x</dt>
4163 <dd>a</dd>
4164 <dd>b</dd></dl>
4165
4166 !! end
4167
4168 !! test
4169 Definition Lists: Indentation: Regular
4170 !! wikitext
4171 :i1
4172 ::i2
4173 :::i3
4174 !! html
4175 <dl><dd>i1
4176 <dl><dd>i2
4177 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4178
4179 !! end
4180
4181 !! test
4182 Definition Lists: Indentation: Missing 1st level
4183 !! wikitext
4184 ::i2
4185 :::i3
4186 !! html
4187 <dl><dd><dl><dd>i2
4188 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4189
4190 !! end
4191
4192 !! test
4193 Definition Lists: Indentation: Multi-level indent
4194 !! wikitext
4195 :::i3
4196 !! html
4197 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
4198
4199 !! end
4200
4201 !! test
4202 Definition Lists: Hacky use to indent tables
4203 !! wikitext
4204 ::{|
4205 |foo
4206 |bar
4207 |}
4208 this text
4209 should be left alone
4210 !! html
4211 <dl><dd><dl><dd><table>
4212 <tr>
4213 <td>foo
4214 </td>
4215 <td>bar
4216 </td></tr></table></dd></dl></dd></dl>
4217 <p>this text
4218 should be left alone
4219 </p>
4220 !! end
4221
4222 !! test
4223 Definition Lists: Hacky use to indent tables (with content following table)
4224 !! wikitext
4225 :{|
4226 |foo
4227 |bar
4228 |} <!--c1--> this text should be part of the dl
4229 !! html/php+tidy
4230 <dl><dd><table>
4231 <tbody><tr>
4232 <td>foo
4233 </td>
4234 <td>bar
4235 </td></tr></tbody></table> this text should be part of the dl</dd></dl>
4236 !! html/parsoid
4237 <dl><dd><table>
4238 <tbody><tr>
4239 <td>foo
4240 </td>
4241 <td>bar
4242 </td></tr></tbody></table> <!--c1--> this text should be part of the dl</dd></dl>
4243 !! end
4244
4245 !! test
4246 Definition Lists: Hacky use to indent tables, with comments (T65979)
4247 !! wikitext
4248 <!-- foo -->
4249 ::{|
4250 |foo
4251 |bar
4252 |}<!-- bar -->
4253 this text
4254 should be left alone
4255 !! html/parsoid
4256 <!-- foo -->
4257 <dl><dd><dl><dd><table><tr>
4258 <td>foo</td>
4259 <td>bar</td>
4260 </tr></table><!-- bar --></dd></dl></dd></dl>
4261 <p>this text
4262 should be left alone</p>
4263 !! end
4264
4265 !! test
4266 Definition Lists: Hacky use to indent tables, with comment before table
4267 !!options
4268 parsoid=wt2html
4269 !! wikitext
4270 ::<!-- foo -->{|
4271 |foo
4272 |}
4273 !! html/parsoid
4274 <dl><dd><dl><dd><!-- foo --><table><tr>
4275 <td>foo</td>
4276 </tr></table></dd></dl></dd></dl>
4277 !! end
4278
4279 # The trailing whitespace in this test is to catch a regression in
4280 # Parsoid after T54473.
4281 !! test
4282 Definition Lists: Hacky use to indent tables (WS-insensitive)
4283 !! wikitext
4284 :{|
4285 |a
4286 |}
4287 !! html/php
4288 <dl><dd><table>
4289 <tr>
4290 <td>a
4291 </td></tr></table></dd></dl>
4292
4293 !! html/parsoid
4294 <dl><dd><table>
4295 <tbody><tr><td>a</td></tr>
4296 </tbody></table></dd></dl>
4297 !! end
4298
4299 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4300 ## as an empty dt item. It also ignores all but the last ";" when followed
4301 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4302 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4303 ## ";"s.
4304 ##
4305 ## Ex: ";;t2 ::d2" is transformed into:
4306 ##
4307 ## <dl>
4308 ## <dt>t2 </dt>
4309 ## <dd>
4310 ## <dl>
4311 ## <dt></dt>
4312 ## <dd>d2</dd>
4313 ## </dl>
4314 ## </dd>
4315 ## </dl>
4316 ##
4317 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4318 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4319 ##
4320 ## <dl>
4321 ## <dt>
4322 ## <dl>
4323 ## <dt>t2 </dt>
4324 ## <dd>:d2</dd>
4325 ## </dl>
4326 ## </dt>
4327 ## </dl>
4328 ##
4329 ## All Parsoid only definition list tests have this difference.
4330 ##
4331 ## See also: https://phabricator.wikimedia.org/T8569
4332 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4333
4334 !! test
4335 Table / list interaction: indented table with lists in table contents
4336 !! wikitext
4337 :{|
4338 |-
4339 |a
4340
4341 *b
4342 |-
4343 |c
4344
4345 *d
4346 |}
4347 !! html
4348 <dl><dd><table>
4349
4350 <tr>
4351 <td>a
4352 <ul><li>b</li></ul>
4353 </td></tr>
4354 <tr>
4355 <td>c
4356 <ul><li>d</li></ul>
4357 </td></tr></table></dd></dl>
4358
4359 !! end
4360
4361 !!test
4362 Table / list interaction: lists nested in tables nested in indented lists
4363 !! wikitext
4364 :{|
4365 |
4366 :a
4367 :b
4368 |
4369 *c
4370 *d
4371 |}
4372
4373 *e
4374 *f
4375 !! html
4376 <dl><dd><table>
4377 <tr>
4378 <td>
4379 <dl><dd>a</dd>
4380 <dd>b</dd></dl>
4381 </td>
4382 <td>
4383 <ul><li>c</li>
4384 <li>d</li></ul>
4385 </td></tr></table></dd></dl>
4386 <ul><li>e</li>
4387 <li>f</li></ul>
4388
4389 !!end
4390
4391 !! test
4392 Definition Lists: Nesting: Multi-level (Parsoid only)
4393 !! wikitext
4394 ;t1 :d1
4395 ;;t2 ::d2
4396 ;;;t3 :::d3
4397 !! html/parsoid
4398 <dl>
4399 <dt>t1 </dt>
4400 <dd>d1</dd>
4401 <dt>
4402 <dl>
4403 <dt>t2 </dt>
4404 <dd>:d2</dd>
4405 <dt>
4406 <dl>
4407 <dt>t3 </dt>
4408 <dd>::d3</dd>
4409 </dl>
4410 </dt>
4411 </dl>
4412 </dt>
4413 </dl>
4414
4415
4416 !! end
4417
4418
4419 !! test
4420 Definition Lists: Nesting: Test 2
4421 !! wikitext
4422 ;t1
4423 ::d2
4424 !! html+tidy
4425 <dl><dt>t1</dt>
4426 <dd>
4427 <dl><dd>d2</dd></dl></dd></dl>
4428 !! end
4429
4430
4431 !! test
4432 Definition Lists: Nesting: Test 3
4433 !! wikitext
4434 :;t1
4435 ::::d2
4436 !! html+tidy
4437 <dl><dd><dl><dt>t1</dt>
4438 <dd>
4439 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4440 !! end
4441
4442
4443 !! test
4444 Definition Lists: Nesting: Test 4
4445 !! wikitext
4446 ::;t3
4447 :::d3
4448 !! html
4449 <dl><dd><dl><dd><dl><dt>t3</dt>
4450 <dd>d3</dd></dl></dd></dl></dd></dl>
4451
4452 !! end
4453
4454
4455 ## The Parsoid team believes the following three test exposes a
4456 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4457 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4458 ## It also exposes a "misfeature" in tidy, which doesn't like
4459 ## <dl> tags with a single <dt> child; it converts the <dt> into
4460 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4461 !! test
4462 Definition Lists: Mixed Lists: Test 1
4463 !! wikitext
4464 :;*foo
4465 ::*bar
4466 :;baz
4467 !! html/php
4468 <dl><dd><dl><dt><ul><li>foo</li>
4469 <li>bar</li></ul></dt></dl>
4470 <dl><dt>baz</dt></dl></dd></dl>
4471
4472 !! html/php+tidy
4473 <dl><dd><dl><dt><ul><li>foo</li>
4474 <li>bar</li></ul></dt></dl>
4475 <dl><dt>baz</dt></dl></dd></dl>
4476 !! html/parsoid
4477 <dl>
4478 <dd><dl>
4479 <dt><ul>
4480 <li>foo
4481 </li>
4482 </ul></dt>
4483 <dd><ul>
4484 <li>bar
4485 </li>
4486 </ul></dd>
4487 <dt>baz</dt>
4488 </dl></dd>
4489 </dl>
4490 !! end
4491
4492 !! test
4493 Definition Lists: Mixed Lists: Test 2
4494 !! wikitext
4495 *:d1
4496 *:d2
4497 !! html
4498 <ul><li><dl><dd>d1</dd>
4499 <dd>d2</dd></dl></li></ul>
4500
4501 !! end
4502
4503
4504 !! test
4505 Definition Lists: Mixed Lists: Test 3
4506 !! wikitext
4507 *:::d1
4508 *:::d2
4509 !! html
4510 <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
4511 <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
4512
4513 !! end
4514
4515
4516 !! test
4517 Definition Lists: Mixed Lists: Test 4
4518 !! wikitext
4519 *;d1 :d2
4520 *;d3 :d4
4521 !! html
4522 <ul><li><dl><dt>d1</dt>
4523 <dd>d2</dd>
4524 <dt>d3</dt>
4525 <dd>d4</dd></dl></li></ul>
4526
4527 !! end
4528
4529
4530 !! test
4531 Definition Lists: Mixed Lists: Test 5
4532 !! wikitext
4533 *:d1
4534 *::d2
4535 !! html
4536 <ul><li><dl><dd>d1
4537 <dl><dd>d2</dd></dl></dd></dl></li></ul>
4538
4539 !! end
4540
4541
4542 !! test
4543 Definition Lists: Mixed Lists: Test 6
4544 !! wikitext
4545 #*:d1
4546 #*:::d3
4547 !! html
4548 <ol><li><ul><li><dl><dd>d1
4549 <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4550
4551 !! end
4552
4553
4554 !! test
4555 Definition Lists: Mixed Lists: Test 7
4556 !! wikitext
4557 :*d1
4558 :*d2
4559 !! html
4560 <dl><dd><ul><li>d1</li>
4561 <li>d2</li></ul></dd></dl>
4562
4563 !! end
4564
4565
4566 !! test
4567 Definition Lists: Mixed Lists: Test 8
4568 !! wikitext
4569 :*d1
4570 ::*d2
4571 !! html
4572 <dl><dd><ul><li>d1</li></ul>
4573 <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
4574
4575 !! end
4576
4577
4578 !! test
4579 Definition Lists: Mixed Lists: Test 9
4580 !! wikitext
4581 *;foo :bar
4582 !! html
4583 <ul><li><dl><dt>foo</dt>
4584 <dd>bar</dd></dl></li></ul>
4585
4586 !! end
4587
4588
4589 !! test
4590 Definition Lists: Mixed Lists: Test 10
4591 !! wikitext
4592 *#;foo :bar
4593 !! html
4594 <ul><li><ol><li><dl><dt>foo</dt>
4595 <dd>bar</dd></dl></li></ol></li></ul>
4596
4597 !! end
4598
4599 # The Parsoid team disagrees with the PHP parser's seemingly-random
4600 # rules regarding dd/dt on the next few tests. Parsoid is more
4601 # consistent, and recognizes the shared nesting and keeps the
4602 # still-open tags around until the nesting is complete.
4603
4604 # This is a regression test for T175099
4605 !! test
4606 Definition Lists: Mixed Lists: Test 11
4607 !! wikitext
4608 ;a
4609 :*b
4610 !! html/php
4611 <dl><dt>a</dt>
4612 <dd>
4613 <ul><li>b</li></ul></dd></dl>
4614
4615 !! html/parsoid
4616 <dl><dt>a
4617 <dd><ul><li>b</li></ul></dd></dl>
4618 !! end
4619
4620 # FIXME: Maybe get rid of this test?
4621 !! test
4622 Definition Lists: Mixed Lists: Test 12
4623 !! wikitext
4624 *#*#;*;;foo :bar
4625 *#*#;boo :baz
4626 !! html/php
4627 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4628 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4629 <dl><dt>boo</dt>
4630 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4631
4632 !! html/php+tidy
4633 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4634 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4635 <dl><dt>boo</dt>
4636 <dd>baz</dd></dl></li></ol></li></ul>
4637 !! html/parsoid
4638 <ul>
4639 <li>
4640 <ol>
4641 <li>
4642 <ul>
4643 <li>
4644 <ol>
4645 <li>
4646 <dl>
4647 <dt>
4648 <ul>
4649 <li>
4650 <dl>
4651 <dt>
4652 <dl>
4653 <dt>foo</dt>
4654 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4655 </dl></dt>
4656 </dl></li>
4657 </ul></dt>
4658 <dt>boo</dt>
4659 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4660 </dl></li>
4661 </ol></li>
4662 </ul></li>
4663 </ol></li>
4664 </ul>
4665 !! end
4666
4667 !! test
4668 Definition Lists: Mixed Lists: Test 13
4669 !! wikitext
4670 *#*#;*;;foo : bar
4671 *#*#;boo : baz
4672 !! html+tidy
4673 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4674 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4675 <dl><dt>boo&#160;</dt>
4676 <dd>baz</dd></dl></li></ol></li></ul>
4677 !! end
4678
4679 # FIXME: Maybe get rid of this test?
4680 # From whitelist:
4681 # * The test is wrong, there are two colons where there should be :;
4682 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4683 !! test
4684 Definition Lists: Weird Ones: Test 1
4685 !! wikitext
4686 *#;*::;;foo :bar (who uses this?)
4687 !! html/php+tidy
4688 <ul><li><ol><li><dl><dt>foo</dt>
4689 <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>
4690 !! html/parsoid
4691 <ul>
4692 <li>
4693 <ol>
4694 <li>
4695 <dl>
4696 <dt>
4697 <ul>
4698 <li>
4699 <dl>
4700 <dd>
4701 <dl>
4702 <dd>
4703 <dl>
4704 <dt>
4705 <dl>
4706 <dt>foo</dt>
4707 <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
4708 </dl></dt>
4709 </dl></dd>
4710 </dl></dd>
4711 </dl></li>
4712 </ul></dt>
4713 </dl></li>
4714 </ol></li>
4715 </ul>
4716 !! end
4717
4718 !! test
4719 Definition Lists: colons occurring in tags
4720 !! wikitext
4721 ;a:b
4722 ;'''a:b'''
4723 ;<i>a:b</i>
4724 ;<span>a:b</span>
4725 ;<div>a:b</div>
4726 ;<div>a
4727 :b</div>
4728 ;{{echo|a:b}}
4729 ;{{echo|''a:b''}}
4730 ;;;''a:b''
4731 !! html+tidy
4732 <dl><dt>a</dt>
4733 <dd>b</dd>
4734 <dt><b>a:b</b></dt>
4735 <dt><i>a:b</i></dt>
4736 <dt><span>a:b</span></dt>
4737 <dt><div>a:b</div></dt>
4738 <dt><div>a</div></dt>
4739 <dd>b</dd>
4740 <dt>a</dt>
4741 <dd>b</dd>
4742 <dt><i>a:b</i></dt></dl>
4743 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4744 !! html/parsoid
4745 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4746 <dt><b>a:b</b></dt>
4747 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4748 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4749 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4750 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4751 <dd>b</dd>
4752 <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>
4753 <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>
4754 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4755 !! end
4756
4757 # Parsoid's output differs here again because it shares
4758 # nesting between the two lists unlike the PHP parser.
4759 # Unsure which is more desirable.
4760 !! test
4761 Definition Lists: colons and tables 1
4762 !! wikitext
4763 :{|
4764 |x
4765 |}
4766 :{|
4767 |y
4768 |}
4769 !! html/php
4770 <dl><dd><table>
4771 <tr>
4772 <td>x
4773 </td></tr></table></dd></dl>
4774 <dl><dd><table>
4775 <tr>
4776 <td>y
4777 </td></tr></table></dd></dl>
4778
4779 !! html/parsoid
4780 <dl><dd><table>
4781 <tr>
4782 <td>x
4783 </td></tr></table></dd>
4784 <dd><table>
4785 <tr>
4786 <td>y
4787 </td></tr></table></dd></dl>
4788 !! end
4789
4790 # FIXME: Does this need a html/php section?
4791 !! test
4792 Definition Lists: template interaction
4793 !! wikitext
4794 ::{{definition_list}}
4795
4796 :one
4797 ::{{definition_list}}
4798 :::two
4799 :::three
4800 ::four
4801 !! html/parsoid
4802 <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">
4803 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4804
4805 <dl><dd data-parsoid='{}'>one
4806 <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">
4807 </span><dd about="#mwt2">two
4808 <dl><dd>two</dd>
4809 <dd>three</dd></dl></dd>
4810 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4811 !! end
4812
4813
4814 ###
4815 ### External links
4816 ###
4817 !! test
4818 External links: non-bracketed
4819 !! wikitext
4820 Non-bracketed: http://example.com
4821 !! html
4822 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4823 </p>
4824 !! end
4825
4826 # parsoid doesn't explicitly mark autonumbered links, see T55505
4827 !! test
4828 External links: numbered
4829 !! wikitext
4830 Numbered: [http://example.com]
4831 Numbered: [http://example.net]
4832 Numbered: [http://example.com]
4833 !! html/php
4834 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4835 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4836 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4837 </p>
4838 !! html/parsoid
4839 <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
4840 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4841 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
4842 !!end
4843
4844 !! test
4845 External links: specified text
4846 !! wikitext
4847 Specified text: [http://example.com link]
4848 !! html
4849 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4850 </p>
4851 !!end
4852
4853 !! test
4854 External links: trail
4855 !! wikitext
4856 Linktrails should not work for external links: [http://example.com link]s
4857 !! html
4858 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4859 </p>
4860 !! end
4861
4862 !! test
4863 External links: dollar sign in URL
4864 !! wikitext
4865 http://example.com/1$2345
4866 !! html
4867 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4868 </p>
4869 !! end
4870
4871 # parsoid doesn't explicitly mark autonumbered links, see T55505
4872 !! test
4873 External links: dollar sign in URL (autonumber)
4874 !! wikitext
4875 [http://example.com/1$2345]
4876 !! html/php
4877 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4878 </p>
4879 !! html/parsoid
4880 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
4881 !!end
4882
4883 !! test
4884 External links: open square bracket forbidden in URL (T6377)
4885 !! options
4886 parsoid=wt2html,wt2wt,html2html
4887 !! wikitext
4888 http://example.com/1[2345
4889 !! html/php
4890 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4891 </p>
4892 !! html/parsoid
4893 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
4894 !! end
4895
4896 !! test
4897 External links: open square bracket forbidden in URL (named) (T6377)
4898 !! options
4899 parsoid=wt2html,html2html
4900 !! wikitext
4901 [http://example.com/1[2345]
4902 !! html/php
4903 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4904 </p>
4905 !! html/parsoid
4906 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
4907 !!end
4908
4909 # parsoid adds a space before the link name
4910 !! test
4911 External links: open square bracket forbidden in URL (named) (T6377)
4912 Parsoid variant.
4913 !! wikitext
4914 [http://example.com/1 [2345]
4915 !! html
4916 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4917 </p>
4918 !!end
4919
4920 !! test
4921 External links: nowiki in URL link text (T8230)
4922 !! wikitext
4923 [http://example.com/ <nowiki>''example site''</nowiki>]
4924 !! html
4925 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4926 </p>
4927 !! end
4928
4929 !! test
4930 External links: newline forbidden in text (T8230 regression check)
4931 !! wikitext
4932 [http://example.com/ first
4933 second]
4934 !! html
4935 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4936 second]
4937 </p>
4938 !!end
4939
4940 !! test
4941 External links: Pipe char between url and text
4942 !! wikitext
4943 [http://example.com | link]
4944 !! html
4945 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4946 </p>
4947 !!end
4948
4949 !! test
4950 External links: protocol-relative URL in brackets
4951 !! wikitext
4952 [//example.com/ Test]
4953 !! html
4954 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4955 </p>
4956 !! end
4957
4958 # parsoid doesn't explicitly mark autonumbered links, see T55505
4959 !! test
4960 External links: protocol-relative URL in brackets without text
4961 !! wikitext
4962 [//example.com]
4963 !! html/php
4964 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4965 </p>
4966 !! html/parsoid
4967 <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
4968 !! end
4969
4970 !! test
4971 External links: protocol-relative URL in free text is left alone
4972 !! wikitext
4973 //example.com/Foo
4974 !! html
4975 <p>//example.com/Foo
4976 </p>
4977 !!end
4978
4979 !! test
4980 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4981 !! wikitext
4982 foo//example.com/Foo
4983 !! html
4984 <p>foo//example.com/Foo
4985 </p>
4986 !! end
4987
4988 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
4989 !! test
4990 External links: with no contents
4991 !! options
4992 parsoid=wt2html,wt2wt
4993 !! wikitext
4994 [http://en.wikipedia.org/wiki/Foo]
4995
4996 [[wikipedia:Foo|Bar]]
4997
4998 [[wikipedia:Foo|<span>Bar</span>]]
4999 !! html/php
5000 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
5001 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
5002 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
5003 </p>
5004 !! html/parsoid
5005 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
5006 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
5007 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
5008 !! end
5009
5010 !! test
5011 External links: Free with trailing punctuation
5012 !! wikitext
5013 http://example.com,
5014 http://example.com;
5015 http://example.com\
5016 http://example.com.
5017 http://example.com:
5018 http://example.com!
5019 http://example.com?
5020 http://example.com)
5021 http://example.com/url_with_(brackets)
5022 (http://example.com/url_without_brackets)
5023 http://example.com/url_with_entity&amp;
5024 http://example.com/url_with_entity&#x26;
5025 http://example.com/url_with_entity&#038;
5026 http://example.com/url_with_entity&nbsp;
5027 http://example.com/url_with_entity&#xA0;
5028 http://example.com/url_with_entity&#160;
5029 http://example.com/url_with_entity&lt;
5030 http://example.com/url_with_entity&#x3C;
5031 http://example.com/url_with_entity&#60;
5032 !! html/php
5033 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
5034 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
5035 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
5036 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
5037 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
5038 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
5039 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
5040 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5041 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5042 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5043 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5044 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5045 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5046 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5047 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
5048 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5049 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
5050 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
5051 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
5052 </p>
5053 !! html/parsoid
5054 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
5055 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
5056 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
5057 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
5058 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
5059 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
5060 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
5061 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
5062 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5063 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5064 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5065 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5066 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5067 <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>
5068 <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>
5069 <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>
5070 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
5071 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
5072 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
5073 !! end
5074
5075 !! test
5076 External links: tricky Parsoid html2html case
5077 !! options
5078 parsoid=wt2html,wt2wt,html2html
5079 !! wikitext
5080 http://example.com/url_with_entity&amp;amp;
5081 !! html/php
5082 <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>;
5083 </p>
5084 !! html/parsoid
5085 <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>
5086 !! end
5087
5088 !! test
5089 External links: Free with trailing quotes (T113666)
5090 !! wikitext
5091 '''News:''' Stuff here
5092
5093 news:'a'b''c''d e
5094 !! html/php
5095 <p><b>News:</b> Stuff here
5096 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
5097 </p>
5098 !! html/parsoid
5099 <p><b>News:</b> Stuff here</p>
5100 <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
5101 !! end
5102
5103 !! test
5104 External links: with entity
5105 !! wikitext
5106 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
5107 !! html/php
5108 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
5109 </p>
5110 !! html/parsoid
5111 <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>
5112 !! end
5113
5114 !! test
5115 External links: Lone protocols are never linked (T105697)
5116 !! wikitext
5117 http://
5118 http://;
5119 (http://)
5120 bitcoin:
5121 bitcoin:;
5122 (bitcoin:)
5123 !! html
5124 <p>http://
5125 http://;
5126 (http://)
5127 bitcoin:
5128 bitcoin:;
5129 (bitcoin:)
5130 </p>
5131 !! end
5132
5133 !! test
5134 External links: No preceding word characters allowed (T67278)
5135 !! wikitext
5136 NOPEhttp://example.com
5137 N0http://example.com
5138 ok:http://example.com
5139 ok-http://example.com
5140 !! html
5141 <p>NOPEhttp://example.com
5142 N0http://example.com
5143 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5144 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5145 </p>
5146 !! end
5147
5148 !! test
5149 External links: nofollow domain exception
5150 !! wikitext
5151 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
5152 !! html
5153 <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>.
5154 </p>
5155 !!end
5156
5157 !! test
5158 External image
5159 !! wikitext
5160 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5161 !! html
5162 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5163 </p>
5164 !! end
5165
5166 !! test
5167 External image from https
5168 !! wikitext
5169 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5170 !! html
5171 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5172 </p>
5173 !! end
5174
5175 !! test
5176 External image (when not allowed)
5177 !! options
5178 wgAllowExternalImages=0
5179 !! wikitext
5180 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5181 !! html
5182 <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>
5183 </p>
5184 !! end
5185
5186 !! test
5187 Link to non-http image, no img tag
5188 !! wikitext
5189 Link to non-http image, no img tag: ftp://example.com/test.jpg
5190 !! html
5191 <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>
5192 </p>
5193 !! end
5194
5195 !! test
5196 External links: terminating separator
5197 !! wikitext
5198 Terminating separator: http://example.com/thing,
5199 !! html
5200 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
5201 </p>
5202 !! end
5203
5204 !! test
5205 External links: intervening separator
5206 !! wikitext
5207 Intervening separator: http://example.com/1,2,3
5208 !! html
5209 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
5210 </p>
5211 !! end
5212
5213 !! test
5214 External links: old bug with URL in query
5215 !! wikitext
5216 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
5217 !! html
5218 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
5219 </p>
5220 !! end
5221
5222 !! test
5223 External links: old URL-in-URL bug, mixed protocols
5224 !! wikitext
5225 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
5226 !! html
5227 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
5228 </p>
5229 !!end
5230
5231 # Since Parsoid is starting to emit canonical wikitext for links,
5232 # [http://example.com http://example.com] will not RT back to that
5233 # form anymore.
5234 !! test
5235 External links: URL in text
5236 !! options
5237 parsoid=wt2html
5238 !! wikitext
5239 URL in text: [http://example.com http://example.com]
5240 !! html/php
5241 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
5242 </p>
5243 !! html/parsoid
5244 <p>URL in text: <a rel="mw:ExtLink" class="external text" href="http://example.com">http://example.com</a></p>
5245 !! end
5246
5247 !! test
5248 External links: Clickable images
5249 !! wikitext
5250 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5251 !! html/php
5252 <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>
5253 </p>
5254 !! html/parsoid
5255 <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>
5256 !! end
5257
5258 !! test
5259 External links: raw ampersand
5260 !! wikitext
5261 Old &amp; use: http://x&y
5262 !! html
5263 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5264 </p>
5265 !! end
5266
5267 !! test
5268 External links: encoded ampersand
5269 !! wikitext
5270 Old &amp; use: http://x&amp;y
5271 !! html/php
5272 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5273 </p>
5274 !! html/parsoid
5275 <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>
5276 !! end
5277
5278 !! test
5279 External links: encoded equals (T8102)
5280 !! wikitext
5281 http://example.com/?foo&#61;bar
5282 !! html/php
5283 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5284 </p>
5285 !! html/parsoid
5286 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5287 !! end
5288
5289 ##
5290 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5291 ## does it number them. As discussed in T55505, we can identify
5292 ## autonumbered links via CSS.
5293 ##
5294
5295 !! test
5296 External links: [raw ampersand]
5297 !! wikitext
5298 Old &amp; use: [http://x&y]
5299 !! html/php
5300 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5301 </p>
5302 !! html/parsoid
5303 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5304 !! end
5305
5306 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5307 # mode will return the [raw ampersand] wikitext
5308 !! test
5309 External links: [encoded ampersand]
5310 !! options
5311 parsoid=wt2html,wt2wt,html2html
5312 !! wikitext
5313 Old &amp; use: [http://x&amp;y]
5314 !! html/php
5315 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5316 </p>
5317 !! html/parsoid
5318 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5319 !! end
5320
5321 !! test
5322 External links: [raw equals]
5323 !! wikitext
5324 [http://example.com/?foo=bar]
5325 !! html/php
5326 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5327 </p>
5328 !! html/parsoid
5329 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5330 !! end
5331
5332 # note that parsoid html is identical to [raw equals] case; so html2wt
5333 # mode will return the [raw equals] wikitext
5334 !! test
5335 External links: [encoded equals] (T8102)
5336 !! options
5337 parsoid=wt2html,wt2wt,html2html
5338 !! wikitext
5339 [http://example.com/?foo&#61;bar]
5340 !! html/php
5341 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5342 </p>
5343 !! html/parsoid
5344 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5345 !! end
5346
5347 # xxx parsoid strips the IDN character, so the round-trip tests will
5348 # obviously fail and are disabled. --cscott
5349 !! test
5350 External links: [IDN ignored character reference in hostname; strip it right off]
5351 !! options
5352 parsoid=wt2html,wt2wt,html2html
5353 !! wikitext
5354 [http://e&zwnj;xample.com/]
5355 !! html/php
5356 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5357 </p>
5358 !! html/parsoid
5359 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
5360 !! end
5361
5362 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5363 # Where an external link could easily circumvent the sanitization of the text of
5364 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5365 # test demands a higher standard. That's a bit strange.
5366 #
5367 # Example:
5368 #
5369 # http://e‌xample.com -> [http://example.com|http://example.com]
5370 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5371 #
5372 # The first example is sanitized, but the second is not. Any security benefits
5373 # from this production are trivial to circumvent. Either remove this test and
5374 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5375 # the test accordingly.
5376 #
5377 # All our love,
5378 # The Parsoid team.
5379 # xxx parsoid strips the IDN character, so the round-trip tests will
5380 # obviously fail and are disabled. --cscott
5381 !! test
5382 External links: IDN ignored character reference in hostname; strip it right off
5383 !! options
5384 parsoid=wt2html,html2html
5385 !! wikitext
5386 http://e&zwnj;xample.com/
5387 !! html/php
5388 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5389 </p>
5390 !! html/parsoid
5391 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
5392 !! end
5393
5394 !! test
5395 External links: www.jpeg.org (T2554)
5396 !! wikitext
5397 http://www.jpeg.org
5398 !! html
5399 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5400 </p>
5401 !! end
5402
5403 # parsoid doesn't explicitly mark autonumbered links, see T55505
5404 !! test
5405 External links: URL within URL (T2002)
5406 !! wikitext
5407 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5408 !! html/php
5409 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5410 </p>
5411 !! html/parsoid
5412 <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>
5413 !! end
5414
5415 !! test
5416 T2361: URL inside bracketed URL
5417 !! wikitext
5418 [http://www.example.com/foo http://www.example.com/bar]
5419 !! html
5420 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5421 </p>
5422 !! end
5423
5424 !! test
5425 T2361: URL within URL, not bracketed
5426 !! wikitext
5427 http://www.example.com/foo?=http://www.example.com/bar
5428 !! html
5429 <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>
5430 </p>
5431 !! end
5432
5433 !! test
5434 T2289: ">"-token in URL-tail
5435 !! wikitext
5436 http://www.example.com/<hello>
5437 !! html
5438 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5439 </p>
5440 !!end
5441
5442 !! test
5443 T2289: literal ">"-token in URL-tail
5444 !! wikitext
5445 http://www.example.com/<b>html</b>
5446 !! html/php
5447 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5448 </p>
5449 !! html/parsoid
5450 <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>
5451 !! end
5452
5453 !! test
5454 T2289: ">"-token in bracketed URL
5455 !! wikitext
5456 [http://www.example.com/<hello> stuff]
5457 !! html
5458 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5459 </p>
5460 !!end
5461
5462 !! test
5463 T2289: literal ">"-token in bracketed URL
5464 !! wikitext
5465 [http://www.example.com/<b>html</b> stuff]
5466 !! html
5467 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5468 </p>
5469 !!end
5470
5471 !! test
5472 T2289: literal double quote at end of URL
5473 !! wikitext
5474 http://www.example.com/"hello"
5475 !! html
5476 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5477 </p>
5478 !!end
5479
5480 !! test
5481 T2289: literal double quote in bracketed URL
5482 !! wikitext
5483 [http://www.example.com/"hello" stuff]
5484 !! html
5485 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5486 </p>
5487 !!end
5488
5489 !! test
5490 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5491 !! wikitext
5492 [http://www.example.com test]
5493 !! html
5494 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5495 </p>
5496 !! end
5497
5498 !! test
5499 External links: link text with spaces
5500 !! wikitext
5501 [http://www.example.com a b c]
5502 [http://www.example.com ''a'' ''b'']
5503 !! html
5504 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5505 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5506 </p>
5507 !! end
5508
5509 # Note edge case difference between PHP and Parsoid here.
5510 !! test
5511 External links: wiki links within external link (T5695)
5512 !! options
5513 parsoid=wt2html,html2html
5514 !! wikitext
5515 [http://example.com [[wikilink]] embedded in ext link]
5516
5517 [http://example.com test [[wikilink]] embedded in ext link]
5518 !! html/php
5519 <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>
5520 </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>
5521 </p>
5522 !! html/parsoid
5523 <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>
5524 <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>
5525 !! end
5526
5527 !! test
5528 T2787: Links with one slash after the url protocol are invalid
5529 !! wikitext
5530 http:/example.com
5531
5532 [http:/example.com title]
5533 !! html
5534 <p>http:/example.com
5535 </p><p>[http:/example.com title]
5536 </p>
5537 !! end
5538
5539 !! test
5540 Bracketed external links with template-generated invalid target
5541 !! wikitext
5542 [{{echo|http:/example.com}} title]
5543 !! html
5544 <p>[http:/example.com title]
5545 </p>
5546 !! end
5547
5548 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5549 !! test
5550 Broken wikilinks (but not external links) prevent templates from closing
5551 !! options
5552 parsoid=wt2html
5553 !! wikitext
5554 [http://example.com x
5555
5556 {{echo|[http://example.com x}}
5557
5558 [[Foo
5559
5560 {{echo|[[Foo}}
5561 !! html/php
5562 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5563 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5564 </p><p>[[Foo
5565 </p><p>{{echo|[[Foo}}
5566 </p>
5567 !! html/parsoid
5568 <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5569 <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>
5570 <p>[[Foo</p>
5571 <p>{{echo|[[Foo}}</p>
5572 !! end
5573
5574 !! test
5575 Wikilinks with embedded newlines are not broken
5576 !! wikitext
5577 {{echo|[[ Foo
5578 B
5579 C]]}}
5580 !! html/php
5581 <p>[[ Foo
5582 B
5583 C]]
5584 </p>
5585 !! html/parsoid
5586 <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>
5587 !! end
5588
5589 !! test
5590 Broken templates
5591 !! options
5592 parsoid=wt2html
5593 !! wikitext
5594 {{echo|[[Foo|}}]]
5595
5596 [[Foo|{{echo|]]}}
5597 !! html/php
5598 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5599 </p><p>[[Foo|]]
5600 </p>
5601 !! html/parsoid
5602 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5603 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5604 !! end
5605
5606 !! test
5607 T4702: Mismatched <i>, <b> and <a> tags are invalid
5608 !! wikitext
5609 ''[http://example.com text'']
5610 [http://example.com '''text]'''
5611 ''Something [http://example.com in italic'']
5612 ''Something [http://example.com mixed''''', even bold]'''
5613 '''''Now [http://example.com both''''']
5614 !! html
5615 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5616 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5617 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5618 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5619 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5620 </p>
5621 !! end
5622
5623
5624 !! test
5625 T6781: %26 in URL
5626 !! wikitext
5627 http://www.example.com/?title=AT%26T
5628 !! html/php
5629 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5630 </p>
5631 !! html/parsoid
5632 <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>
5633 !! end
5634
5635 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5636 # % is actually legal in HTML5. Any change in output would need testing though.
5637 !! test
5638 T6781, T7267: %25 in URL
5639 !! wikitext
5640 http://www.example.com/?title=100%25_Bran
5641 !! html/php
5642 <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>
5643 </p>
5644 !! html/parsoid
5645 <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>
5646 !! end
5647
5648 !! test
5649 T6781, T7267: %28, %29 in URL
5650 !! wikitext
5651 http://www.example.com/?title=Ben-Hur_%281959_film%29
5652 !! html/php
5653 <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>
5654 </p>
5655 !! html/parsoid
5656 <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>
5657 !! end
5658
5659
5660 !! test
5661 T6781: %26 in autonumber URL
5662 !! wikitext
5663 [http://www.example.com/?title=AT%26T]
5664 !! html/php
5665 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5666 </p>
5667 !! html/parsoid
5668 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5669 !! end
5670
5671 !! test
5672 T6781, T7267: %26 in autonumber URL
5673 !! wikitext
5674 [http://www.example.com/?title=100%25_Bran]
5675 !! html/php
5676 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5677 </p>
5678 !! html/parsoid
5679 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5680 !! end
5681
5682 !! test
5683 T6781, T7267: %28, %29 in autonumber URL
5684 !! wikitext
5685 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5686 !! html/php
5687 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5688 </p>
5689 !! html/parsoid
5690 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5691 !! end
5692
5693
5694 !! test
5695 T6781: %26 in bracketed URL
5696 !! wikitext
5697 [http://www.example.com/?title=AT%26T link]
5698 !! html/php
5699 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5700 </p>
5701 !! html/parsoid
5702 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5703 !! end
5704
5705 !! test
5706 T6781, T7267: %25 in bracketed URL
5707 !! wikitext
5708 [http://www.example.com/?title=100%25_Bran link]
5709 !! html
5710 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5711 </p>
5712 !! end
5713
5714 !! test
5715 T6781, T7267: %28, %29 in bracketed URL
5716 !! wikitext
5717 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5718 !! html/php
5719 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5720 </p>
5721 !! html/parsoid
5722 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5723 !! end
5724
5725 !! test
5726 External link containing a period in the anchor. (T65947)
5727 !! wikitext
5728 [//foo.org/bar#baz. bang]
5729
5730 [//foo.org/bar. bang]
5731 !! html/php
5732 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5733 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5734 </p>
5735 !! html/parsoid
5736 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5737 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5738 !! end
5739
5740 !! test
5741 External link containing a single quote. (T65947)
5742 !! wikitext
5743 [//foo.org/bar'baz]
5744
5745 [//foo.org/bar'baz bang]
5746 !! html/php
5747 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5748 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5749 </p>
5750 !! html/parsoid
5751 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5752 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5753 !! end
5754
5755 !! test
5756 External link containing double-single-quotes in text '' (T6598 sanity check)
5757 !! wikitext
5758 Some [http://example.com/ pretty ''italics'' and stuff]!
5759 !! html
5760 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5761 </p>
5762 !! end
5763
5764 !! test
5765 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5766 !! wikitext
5767 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5768 !! html
5769 <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>
5770 </p>
5771 !! end
5772
5773 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5774 !! test
5775 External link containing double-single-quotes with no space separating the url from text in italics
5776 !! wikitext
5777 [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]].]
5778 !! html/php+tidy
5779 <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>.
5780 </p>
5781 !! html/parsoid
5782 <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>
5783 !! end
5784
5785 !! test
5786 External link with comments in link text
5787 !! wikitext
5788 [http://www.google.com Google <!-- comment -->]
5789 !! html/php
5790 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5791 </p>
5792 !! html/parsoid
5793 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5794 !! end
5795
5796 !! test
5797 External link to bare IPv4 address
5798 !! wikitext
5799 [http://192.168.0.1 Link]
5800 !! html/php
5801 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5802 </p>
5803 !! html/parsoid
5804 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5805 !! end
5806
5807 !! test
5808 URL-encoding in URL functions (single parameter)
5809 !! wikitext
5810 {{localurl:Some page|amp=&}}
5811 !! html
5812 <p>/index.php?title=Some_page&amp;amp=&amp;
5813 </p>
5814 !! end
5815
5816 !! test
5817 URL-encoding in URL functions (multiple parameters)
5818 !! wikitext
5819 {{localurl:Some page|q=?&amp=&}}
5820 !! html
5821 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5822 </p>
5823 !! end
5824
5825 !! test
5826 Brackets in urls
5827 !! wikitext
5828 http://example.com/index.php?foozoid%5B%5D=bar
5829
5830 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5831 !! html/php
5832 <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>
5833 </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>
5834 </p>
5835 !! html/parsoid
5836 <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>
5837
5838 <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>
5839 !! end
5840
5841 !! test
5842 IPv6 urls, autolink format (T23261)
5843 !! wikitext
5844 http://[2404:130:0:1000::187:2]/index.php
5845
5846 Examples from RFC 2373, section 2.2:
5847
5848 *http://[1080::8:800:200C:417A]/unicast
5849 *http://[FF01::101]/multicast
5850 *http://[::1]/loopback
5851 *http://[::]/unspecified
5852 *http://[::13.1.68.3]/ipv4compat
5853 *http://[::FFFF:129.144.52.38]/ipv4compat
5854
5855 Examples from RFC 2732, section 2:
5856
5857 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5858 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5859 *http://[3ffe:2a00:100:7031::1]
5860 *http://[1080::8:800:200C:417A]/foo
5861 *http://[::192.9.5.5]/ipng
5862 *http://[::FFFF:129.144.52.38]:80/index.html
5863 *http://[2010:836B:4179::836B:4179]
5864 !! html/php
5865 <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>
5866 </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:
5867 </p>
5868 <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>
5869 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5870 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5871 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5872 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5873 <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>
5874 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5875 </p>
5876 <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>
5877 <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>
5878 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5879 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5880 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5881 <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>
5882 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5883
5884 !! html/parsoid
5885 <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>
5886
5887 <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>
5888 <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>
5889 <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5890 <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5891 <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5892 <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5893 <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>
5894
5895 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5896 <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>
5897 <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>
5898 <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5899 <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>
5900 <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5901 <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>
5902 <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5903 !! end
5904
5905 !! test
5906 IPv6 urls, bracketed format (T23261)
5907 !! wikitext
5908 [http://[2404:130:0:1000::187:2]/index.php test]
5909
5910 Examples from RFC 2373, section 2.2:
5911
5912 *[http://[1080::8:800:200C:417A] unicast]
5913 *[http://[FF01::101] multicast]
5914 *[http://[::1]/ loopback]
5915 *[http://[::] unspecified]
5916 *[http://[::13.1.68.3] ipv4compat]
5917 *[http://[::FFFF:129.144.52.38] ipv4compat]
5918
5919 Examples from RFC 2732, section 2:
5920
5921 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5922 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5923 *[http://[3ffe:2a00:100:7031::1] 3]
5924 *[http://[1080::8:800:200C:417A]/foo 4]
5925 *[http://[::192.9.5.5]/ipng 5]
5926 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5927 *[http://[2010:836B:4179::836B:4179] 7]
5928 !! html/php
5929 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5930 </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:
5931 </p>
5932 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5933 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5934 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5935 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5936 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5937 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5938 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5939 </p>
5940 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5941 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5942 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5943 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5944 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5945 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5946 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5947
5948 !! html/parsoid
5949 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5950
5951 <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>
5952 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5953 <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5954 <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5955 <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5956 <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5957 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5958
5959 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5960 <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>
5961 <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5962 <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5963 <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5964 <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5965 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5966 <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5967 !! end
5968
5969 !! test
5970 Non-extlinks in brackets
5971 !! wikitext
5972 [foo]
5973 [foo bar]
5974 [foo ''bar'']
5975 [fool's] errand
5976 [fool's errand]
5977 [{{echo|foo}}]
5978 [{{echo|foo}} bar]
5979 [{{echo|foo}} ''bar'']
5980 [{{echo|foo}}l's] errand
5981 [{{echo|foo}}l's errand]
5982 [url={{echo|foo}}]
5983 [url=http://example.com]
5984 [http:// bare protocols don't count]
5985 !! html/php
5986 <p>[foo]
5987 [foo bar]
5988 [foo <i>bar</i>]
5989 [fool's] errand
5990 [fool's errand]
5991 [foo]
5992 [foo bar]
5993 [foo <i>bar</i>]
5994 [fool's] errand
5995 [fool's errand]
5996 [url=foo]
5997 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5998 [http:// bare protocols don't count]
5999 </p>
6000 !! html/parsoid
6001 <p>[foo]
6002 [foo bar]
6003 [foo <i>bar</i>]
6004 [fool's] errand
6005 [fool's errand]
6006 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
6007 [<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]
6008 [<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>]
6009 [<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
6010 [<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]
6011 [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>]
6012 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
6013 [http:// bare protocols don't count]</p>
6014 !! end
6015
6016 !! test
6017 Percent encoding in external links
6018 !! wikitext
6019 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
6020 !! html/php
6021 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
6022 </p>
6023 !! html/parsoid
6024 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
6025 !! end
6026
6027 !! test
6028 Use url link syntax for links where the content is equal the link target
6029 !! wikitext
6030 http://example.com
6031 !! html/php
6032 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
6033 </p>
6034 !! html/parsoid
6035 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
6036 !! end
6037
6038 !! test
6039 Parenthesis in external links, especially URL links
6040 !! wikitext
6041 http://example.com)
6042
6043 http://example.com/test)
6044
6045 http://example.com/(test)
6046
6047 http://example.com/((test)
6048
6049 (http://example.com/(test))
6050
6051 (http://example.com/(test)))))
6052
6053 http://example.com/a)b
6054
6055 [http://example.com) foo]
6056 !! html/php
6057 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6058 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
6059 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
6060 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
6061 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
6062 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
6063 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
6064 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
6065 </p>
6066 !! html/parsoid
6067 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
6068 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
6069 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
6070 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
6071 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
6072 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
6073 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
6074 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
6075 !! end
6076
6077 !! test
6078 Parenthesis in external links, w/ transclusion or comment
6079 !! wikitext
6080 (http://example.com/{{echo|hi}})
6081
6082 (http://example.com<!-- hi -->)
6083 !! html/php
6084 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
6085 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6086 </p>
6087 !! html/parsoid
6088 <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>
6089
6090 <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>
6091 !! end
6092
6093 !! test
6094 Serialize <a> tags with invalid link targets as plain text
6095 !! options
6096 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
6097 !! html/parsoid
6098 <a rel="mw:WikiLink" href="[[foo]]">text</a>
6099 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
6100 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
6101 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
6102 !! wikitext
6103 text
6104 <nowiki>*</nowiki>text
6105 <nowiki>[[foo]]</nowiki>
6106 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
6107 !! end
6108
6109 !! test
6110 mw:ExtLink -vs- mw:WikiLink (T94723)
6111 !! options
6112 parsoid=html2wt
6113 !! html/parsoid
6114 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
6115 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
6116 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6117 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6118 <p>
6119 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6120 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6121 </p>
6122 !! wikitext
6123 [[Foo|Bar]]
6124 [[Foo|Bar]]
6125 [[:en:Foo|Bar]]
6126 [[:en:Foo|Bar]]
6127
6128 [[:en:European_Robin|European Robin]]
6129 [[:en:European_Robin|European Robin]]
6130 !! end
6131
6132 !! test
6133 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
6134 !! options
6135 parsoid=wt2wt
6136 !! wikitext
6137 [http://en.wikipedia.org/wiki/European_Robin European Robin]
6138 !! html/parsoid
6139 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
6140 !! end
6141
6142
6143 ###
6144 ### Quotes
6145 ###
6146
6147 !! test
6148 Quotes
6149 !! wikitext
6150 Normal text. '''Bold text.''' Normal text. ''Italic text.''
6151
6152 Normal text. '''''Bold italic text.''''' Normal text.
6153 !! html
6154 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
6155 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
6156 </p>
6157 !! end
6158
6159
6160 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
6161 # parser strips. The wikitext contains just the first half of the bold
6162 # quote pair.
6163 !! test
6164 Unclosed and unmatched quotes
6165 !! wikitext
6166 '''''Bold italic text '''with bold deactivated''' in between.'''''
6167
6168 '''''Bold italic text ''with italic deactivated'' in between.'''''
6169
6170 '''Bold text..
6171
6172 ..spanning two paragraphs (should not work).'''
6173
6174 '''Bold tag left open
6175
6176 ''Italic tag left open
6177
6178 Normal text.
6179
6180 <!-- Unmatching number of opening, closing tags: -->
6181 '''This year''''s election ''should'' beat '''last year''''s.
6182
6183 ''Tom'''s car is bigger than ''Susan'''s.
6184
6185 Plain ''italic'''s plain
6186 !! html/php
6187 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6188 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6189 </p><p><b>Bold text..</b>
6190 </p><p>..spanning two paragraphs (should not work).
6191 </p><p><b>Bold tag left open</b>
6192 </p><p><i>Italic tag left open</i>
6193 </p><p>Normal text.
6194 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6195 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6196 </p><p>Plain <i>italic'</i>s plain
6197 </p>
6198 !! html/parsoid
6199 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6200 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6201 </p><p><b>Bold text..</b>
6202 </p><p>..spanning two paragraphs (should not work).<b></b>
6203 </p><p><b>Bold tag left open</b>
6204 </p><p><i>Italic tag left open</i>
6205 </p><p>Normal text.
6206 </p>
6207 <!-- Unmatching number of opening, closing tags: -->
6208 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6209 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6210 </p><p>Plain <i>italic'</i>s plain
6211 </p>
6212 !! end
6213
6214 ###
6215 ### Tables
6216 ###
6217 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
6218 ###
6219
6220 # This should not produce <table></table> as <table><tr><td></td></tr></table>
6221 # is the bare minimum required by the spec, see:
6222 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
6223 # Parsoid team replies: empty table tags are legal in HTML5
6224 !! test
6225 A table with no data.
6226 !! options
6227 parsoid=wt2html
6228 !! wikitext
6229 {||}
6230 !! html/php
6231
6232 !! html/parsoid
6233 <table></table>
6234
6235 !! end
6236
6237 !! test
6238 A table with stray table end tags on start tag line (wt2html)
6239 !! options
6240 parsoid=wt2html
6241 !! wikitext
6242 {|style="color: red;"|}
6243
6244 {|style="color: red;" |}
6245 |foo
6246 |}
6247
6248 {|style="color: red;"|} id="foo"
6249 |foo
6250 |}
6251
6252 {|style="color: red;" |} id="foo"
6253 |foo
6254 |}
6255 !! html
6256 <table style="color: red;"></table>
6257
6258 <table style="color: red;">
6259 <tbody><tr>
6260 <td>foo</td>
6261 </tr></tbody>
6262 </table>
6263
6264 <table style="color: red;" id="foo">
6265 <tbody><tr>
6266 <td>foo</td>
6267 </tr></tbody>
6268 </table>
6269
6270 <table style="color: red;" id="foo">
6271 <tbody><tr>
6272 <td>foo</td>
6273 </tr></tbody>
6274 </table>
6275
6276 !! end
6277
6278 !! test
6279 A table with no data (take 2)
6280 !! wikitext
6281 {|
6282 |}
6283 !! html/parsoid
6284 <table></table>
6285 !! end
6286
6287 # A table with nothing but a caption is invalid XHTML, we might want to render
6288 # this as <p>caption</p>
6289 # Parsoid team replies: table with only a caption is legal in HTML5
6290 !! test
6291 A table with nothing but a caption
6292 !! wikitext
6293 {|
6294 |+caption
6295 |}
6296 !! html/php
6297 <table>
6298 <caption>caption
6299 </caption><tr><td></td></tr></table>
6300
6301 !! html/parsoid
6302 <table><caption>caption</caption></table>
6303 !! end
6304
6305 !! test
6306 A table with caption with default-spaced attributes and a table row
6307 !! wikitext
6308 {|
6309 |+ style="color: red;" |caption1
6310 |-
6311 |foo
6312 |}
6313 !! html
6314 <table>
6315 <caption style="color: red;">caption1
6316 </caption>
6317 <tr>
6318 <td>foo
6319 </td></tr></table>
6320
6321 !! end
6322
6323 !! test
6324 A table with captions with non-default spaced attributes and a table row
6325 !! wikitext
6326 {|
6327 |+style="color: red;"|caption2
6328 |+ style="color: red;"|caption3
6329 |-
6330 |foo
6331 |}
6332 !! html
6333 <table>
6334 <caption style="color: red;">caption2
6335 </caption>
6336 <caption style="color: red;">caption3
6337 </caption>
6338 <tr>
6339 <td>foo
6340 </td></tr></table>
6341
6342 !! end
6343
6344 !! test
6345 Table td-cell syntax variations
6346 !! wikitext
6347 {|
6348 |foo bar foo|baz
6349 |foo bar foo||baz
6350 |style='color:red;'|baz
6351 |style='color:red;'||baz
6352 |}
6353 !! html
6354 <table>
6355 <tr>
6356 <td>baz
6357 </td>
6358 <td>foo bar foo</td>
6359 <td>baz
6360 </td>
6361 <td style="color:red;">baz
6362 </td>
6363 <td>style='color:red;'</td>
6364 <td>baz
6365 </td></tr></table>
6366
6367 !! end
6368
6369 !! test
6370 Simple table
6371 !! wikitext
6372 {|
6373 |1||2
6374 |-
6375 |3||4
6376 |}
6377 !! html
6378 <table>
6379 <tr>
6380 <td>1</td>
6381 <td>2
6382 </td></tr>
6383 <tr>
6384 <td>3</td>
6385 <td>4
6386 </td></tr></table>
6387
6388 !! end
6389
6390 !! test
6391 Simple table but with multiple dashes for row wikitext
6392 !! wikitext
6393 {|
6394 |foo
6395 |-----
6396 |bar
6397 |}
6398 !! html
6399 <table>
6400 <tr>
6401 <td>foo
6402 </td></tr>
6403 <tr>
6404 <td>bar
6405 </td></tr></table>
6406
6407 !! end
6408
6409 !! test
6410 Multiplication table
6411 !! wikitext
6412 {| border="1" cellpadding="2"
6413 |+Multiplication table
6414 |-
6415 !&times;!!1!!2!!3
6416 |-
6417 !1
6418 |1||2||3
6419 |-
6420 !2
6421 |2||4||6
6422 |-
6423 !3
6424 |3||6||9
6425 |-
6426 !4
6427 |4||8||12
6428 |-
6429 !5
6430 |5||10||15
6431 |}
6432 !! html
6433 <table border="1" cellpadding="2">
6434 <caption>Multiplication table
6435 </caption>
6436 <tr>
6437 <th>&#215;</th>
6438 <th>1</th>
6439 <th>2</th>
6440 <th>3
6441 </th></tr>
6442 <tr>
6443 <th>1
6444 </th>
6445 <td>1</td>
6446 <td>2</td>
6447 <td>3
6448 </td></tr>
6449 <tr>
6450 <th>2
6451 </th>
6452 <td>2</td>
6453 <td>4</td>
6454 <td>6
6455 </td></tr>
6456 <tr>
6457 <th>3
6458 </th>
6459 <td>3</td>
6460 <td>6</td>
6461 <td>9
6462 </td></tr>
6463 <tr>
6464 <th>4
6465 </th>
6466 <td>4</td>
6467 <td>8</td>
6468 <td>12
6469 </td></tr>
6470 <tr>
6471 <th>5
6472 </th>
6473 <td>5</td>
6474 <td>10</td>
6475 <td>15
6476 </td></tr></table>
6477
6478 !! end
6479
6480 !! test
6481 Accept "||" in table headings
6482 !! wikitext
6483 {|
6484 !h1||h2
6485 |}
6486 !! html
6487 <table>
6488 <tr>
6489 <th>h1</th>
6490 <th>h2
6491 </th></tr></table>
6492
6493 !! end
6494
6495 !! test
6496 Accept "!!" in table data
6497 !! wikitext
6498 {|
6499 |Foo!!||
6500 |}
6501 !! html
6502 <table>
6503 <tr>
6504 <td>Foo!!</td>
6505 <td>
6506 </td></tr></table>
6507
6508 !! html/parsoid
6509 <table>
6510 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6511 </tbody></table>
6512 !! end
6513
6514 !! test
6515 Accept "||" in indented table headings
6516 !! wikitext
6517 :{|
6518 !h1||h2
6519 |}
6520 !! html
6521 <dl><dd><table>
6522 <tr>
6523 <th>h1</th>
6524 <th>h2
6525 </th></tr></table></dd></dl>
6526
6527 !! end
6528
6529 !! test
6530 Accept "!!" in templates
6531 !! wikitext
6532 {|
6533 !a {{echo|b!!c}}
6534 |}
6535 !! html/php
6536 <table>
6537 <tr>
6538 <th>a b</th>
6539 <th>c
6540 </th></tr></table>
6541
6542 !! html/parsoid
6543 <table>
6544 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6545 !! end
6546
6547 !! test
6548 Accept "!!" in table headings after newline
6549 !! wikitext
6550 {|
6551 !a
6552 b!!c
6553 |}
6554 !! html/php
6555 <table>
6556 <tr>
6557 <th>a
6558 <p>b!!c
6559 </p>
6560 </th></tr></table>
6561
6562 !! html/parsoid
6563 <table>
6564 <tbody><tr><th>a
6565 <p>b!!c</p></th></tr>
6566 </tbody></table>
6567 !! end
6568
6569 !! test
6570 Accept "!!" in table data of mixed wikitext / html syntax
6571 !! wikitext
6572 {|
6573 !a
6574 <tr><td>b!!c</td></tr>
6575 |}
6576 !! html/php+tidy
6577 <table>
6578 <tbody><tr>
6579 <th>a
6580 </th></tr><tr><td>b!!c</td></tr>
6581 </tbody></table>
6582 !! html/parsoid
6583 <table>
6584 <tbody><tr><th>a</th></tr>
6585 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6586 </tbody></table>
6587 !! end
6588
6589 !! test
6590 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6591 !! wikitext
6592 {|
6593 !|h1
6594 ||a
6595 |}
6596 !! html
6597 <table>
6598 <tr>
6599 <th>h1
6600 </th>
6601 <td>a
6602 </td></tr></table>
6603
6604 !! end
6605
6606 !!test
6607 Accept "| !" at start of line in tables (ignore !-attribute)
6608 !! wikitext
6609 {|
6610 |-
6611 |!style="color:red"|bar
6612 |}
6613 !! html
6614 <table>
6615
6616 <tr>
6617 <td>bar
6618 </td></tr></table>
6619
6620 !!end
6621
6622 !!test
6623 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 +/-
6624 !! wikitext
6625 {|
6626 |-
6627 |style='color:red;'|+1
6628 |style='color:blue;'|-1
6629 |-
6630 |1||2||3
6631 |1||+2||-3
6632 |-
6633 | +1
6634 | -1
6635 |}
6636 !! html
6637 <table>
6638
6639 <tr>
6640 <td style="color:red;">+1
6641 </td>
6642 <td style="color:blue;">-1
6643 </td></tr>
6644 <tr>
6645 <td>1</td>
6646 <td>2</td>
6647 <td>3
6648 </td>
6649 <td>1</td>
6650 <td>+2</td>
6651 <td>-3
6652 </td></tr>
6653 <tr>
6654 <td>+1
6655 </td>
6656 <td>-1
6657 </td></tr></table>
6658
6659 !!end
6660
6661 !! test
6662 Table rowspan
6663 !! wikitext
6664 {| border=1
6665 |Cell 1, row 1
6666 |rowspan=2|Cell 2, row 1 (and 2)
6667 |Cell 3, row 1
6668 |-
6669 |Cell 1, row 2
6670 |Cell 3, row 2
6671 |}
6672 !! html
6673 <table border="1">
6674 <tr>
6675 <td>Cell 1, row 1
6676 </td>
6677 <td rowspan="2">Cell 2, row 1 (and 2)
6678 </td>
6679 <td>Cell 3, row 1
6680 </td></tr>
6681 <tr>
6682 <td>Cell 1, row 2
6683 </td>
6684 <td>Cell 3, row 2
6685 </td></tr></table>
6686
6687 !! end
6688
6689 !! test
6690 Nested table
6691 !! wikitext
6692 {| border=1
6693 | &alpha;
6694 |
6695 {| bgcolor=#ABCDEF border=2
6696 |nested
6697 |-
6698 |table
6699 |}
6700 |the original table again
6701 |}
6702 !! html
6703 <table border="1">
6704 <tr>
6705 <td>&#945;
6706 </td>
6707 <td>
6708 <table bgcolor="#ABCDEF" border="2">
6709 <tr>
6710 <td>nested
6711 </td></tr>
6712 <tr>
6713 <td>table
6714 </td></tr></table>
6715 </td>
6716 <td>the original table again
6717 </td></tr></table>
6718
6719 !! end
6720
6721 !! test
6722 Invalid attributes in table cell (T3830)
6723 !! wikitext
6724 {|
6725 |Cell:|broken
6726 |}
6727 !! html
6728 <table>
6729 <tr>
6730 <td>broken
6731 </td></tr></table>
6732
6733 !! end
6734
6735 !! test
6736 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6737 !! wikitext
6738 {|
6739 |title="foo" |bar
6740 |title="foo<nowiki>|</nowiki>" |bar
6741 |title="foo<nowiki>|</nowiki>" bar
6742 |}
6743 !! html/php
6744 <table>
6745 <tr>
6746 <td title="foo">bar
6747 </td>
6748 <td title="foo&#124;">bar
6749 </td>
6750 <td>title="foo|" bar
6751 </td></tr></table>
6752
6753 !! html/parsoid
6754 <table>
6755 <tbody><tr><td title="foo">bar</td>
6756 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6757 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6758 </tbody></table>
6759 !! end
6760
6761 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6762 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6763 # *2wt modes will fail.
6764 !! test
6765 Table security: embedded pipes
6766 !! options
6767 parsoid=wt2html,html2html
6768 !! wikitext
6769 {|
6770 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6771 !! html/php
6772 <table>
6773 <tr>
6774 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6775 <td>]" onmouseover="alert(document.cookie)"&gt;test
6776 </td>
6777 </tr>
6778 </table>
6779
6780 !! html/parsoid
6781 <table><tbody>
6782 <tr>
6783 <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>
6784 !! end
6785
6786 !! test
6787 Element attributes with double ! should not be broken up by <th>
6788 !! wikitext
6789 {|
6790 !hi <div class="!!">ha</div> ho
6791 |}
6792 !! html/php
6793 <table>
6794 <tr>
6795 <th>hi <div class="!!">ha</div> ho
6796 </th></tr></table>
6797
6798 !! html/parsoid
6799 <table>
6800 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6801 </tbody></table>
6802 !! end
6803
6804 !! test
6805 ! and || in element attributes should not be parsed as <th>/<td>
6806 !! wikitext
6807 {|
6808 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6809 |}
6810 !! html/php
6811 <table>
6812 <tr>
6813 <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6814 </td></tr></table>
6815
6816 !! html/parsoid
6817 <table>
6818 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6819 </tbody></table>
6820 !! end
6821
6822 # FIXME: The output seems broken. Filed as T110268.
6823 !! test
6824 ! and || in td attributes should not be parsed as <th>/<td>
6825 !! options
6826 parsoid=wt2html
6827 !! wikitext
6828 {|
6829 |style="color: red !important;" data-contrived="put this here ||"|foo
6830 |}
6831 !! html/php
6832 <table>
6833 <tr>
6834 <td>style="color: red !important;" data-contrived="put this here</td>
6835 <td>foo
6836 </td></tr></table>
6837
6838 !! html/parsoid
6839 <table>
6840 <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>
6841 </tbody></table>
6842 !! end
6843
6844 !! test
6845 Break on | in element attribute in template
6846 !! options
6847 parsoid=wt2html,html2html
6848 !! wikitext
6849 {{echo|1=<div class="hi|ho">ha</div>}}
6850 !! html/php
6851 <p>ho"&gt;ha&lt;/div&gt;
6852 </p>
6853 !! html/parsoid
6854 <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>
6855 !! end
6856
6857 !! test
6858 Break on | in element attribute name in template
6859 !! wikitext
6860 {{echo|<div cla|ss="hiho">ha</div>}}
6861 !! html/parsoid
6862 <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>
6863 !! end
6864
6865 !! test
6866 Don't break on | in extension attribute in template
6867 !! wikitext
6868 {{echo|<ref name="hi|ho">ha</ref>}}
6869
6870 <references />
6871 !! html/parsoid
6872 <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>
6873
6874 <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>
6875 !! end
6876
6877 ## We don't support roundtripping of these attributes in Parsoid.
6878 ## Selective serialization takes care of preventing dirty diffs.
6879 ## But, on edits, we dirty-diff the invalid attribute text.
6880 !! test
6881 Invalid text in table attributes should be discarded
6882 !! options
6883 parsoid=wt2html
6884 !! wikitext
6885 {| <span>boo</span> style='border:1px solid black'
6886 | <span>boo</span> style='color:blue' |1
6887 |<span>boo</span> style='color:blue'|2
6888 |}
6889 !! html/php
6890 <table style="border:1px solid black">
6891 <tr>
6892 <td style="color:blue">1
6893 </td>
6894 <td style="color:blue">2
6895 </td></tr></table>
6896
6897 !! html/parsoid
6898 <table style="border:1px solid black">
6899 <tr>
6900 <td style="color:blue">1</td>
6901 <td style="color:blue">2</td>
6902 </tr>
6903 </table>
6904 !! end
6905
6906 !! test
6907 Invalid text in table attributes should be preserved by selective serializer
6908 !! options
6909 parsoid={
6910 "modes": ["selser"],
6911 "changes": [
6912 ["td:first-child", "text", "abc"],
6913 ["td + td", "text", "xyz"]
6914 ]
6915 }
6916 !! wikitext
6917 {| <span>boo</span> style='border:1px solid black'
6918 | <span>boo</span> style='color:blue' | 1
6919 |<span>boo</span> style='color:blue'| 2
6920 |}
6921 !! wikitext/edited
6922 {| <span>boo</span> style='border:1px solid black'
6923 | <span>boo</span> style='color:blue' | abc
6924 |<span>boo</span> style='color:blue'| xyz
6925 |}
6926 !! end
6927
6928 !! test
6929 1. Template-generated table cell attributes and cell content
6930 !! wikitext
6931 {|
6932 |{{table_attribs}}
6933 | {{table_attribs}}
6934 || {{table_attribs_5}}
6935 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6936 |align=center {{table_attribs}}
6937 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6938 |}
6939 !! html
6940 <table>
6941 <tr>
6942 <td style="color:red;">Foo
6943 </td>
6944 <td style="color:red;">Foo
6945 </td>
6946 <td>style="color:red;"</td>
6947 <td>Bar
6948 </td>
6949 <td style="color:red;">Foo
6950 </td>
6951 <td align="center" style="color:red;">Foo
6952 </td>
6953 <td align="center" style="color:red;">Foo
6954 </td></tr></table>
6955
6956 !! end
6957
6958 !! test
6959 2. Template-generated table cell attributes and cell content
6960 !! wikitext
6961 {|
6962 |{{table_attribs_2}}
6963 |}
6964 !! html/php
6965 <table>
6966 <tr>
6967 <td style="color:red;">Foo
6968 </td>
6969 <td>Bar</td>
6970 <td>Baz
6971 </td></tr></table>
6972
6973 !! html/parsoid
6974 <table>
6975 <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>
6976 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6977 </tbody></table>
6978 !! end
6979
6980 !! test
6981 3. Template-generated table cell attributes and cell content
6982 !! wikitext
6983 {|
6984 !align=center {{table_header_cells}}
6985 |-
6986 |align=center {{table_cells}}
6987 |}
6988 !! html/php
6989 <table>
6990 <tr>
6991 <th align="center" style="color:red;">Foo</th>
6992 <th style="color:red;"><i>Bar</i></th>
6993 <th style="color:brown;"><i>Foo</i> and Baz
6994 </th></tr>
6995 <tr>
6996 <td align="center" style="color:red;">Foo</td>
6997 <td style="color:red;"><i>Bar</i></td>
6998 <td style="color:brown;"><i>Foo</i> and Baz
6999 </td></tr></table>
7000
7001 !! html/parsoid
7002 <table>
7003 <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>
7004 <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>
7005 </tbody></table>
7006 !! end
7007
7008 !! test
7009 4. Template-generated table cell attributes and cell content inside a templated table
7010 !! wikitext
7011 {{tbl-start}}
7012 !align=center {{table_header_cells}}
7013 |-
7014 |align=center {{table_cells}}
7015 {{tbl-end}}
7016 !! html/php
7017 <table>
7018 <tr>
7019 <th align="center" style="color:red;">Foo</th>
7020 <th style="color:red;"><i>Bar</i></th>
7021 <th style="color:brown;"><i>Foo</i> and Baz
7022 </th></tr>
7023 <tr>
7024 <td align="center" style="color:red;">Foo</td>
7025 <td style="color:red;"><i>Bar</i></td>
7026 <td style="color:brown;"><i>Foo</i> and Baz
7027 </td></tr></table>
7028
7029 !! html/parsoid
7030 <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}}]}'>
7031 <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>
7032 <tr>
7033 <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>
7034 </tbody></table>
7035 !! end
7036
7037 ## Edge case fix to prevent future regressions
7038 !! test
7039 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
7040 !! wikitext
7041 {|
7042 |{{table_attribs_7}}
7043 |}
7044 <references />
7045 !! html/parsoid
7046 <table>
7047 <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>
7048 </tbody></table>
7049 <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>
7050 !! end
7051
7052 !! test
7053 Table with row followed by newlines and table heading
7054 !! options
7055 parsoid=wt2html,html2html
7056 !! wikitext
7057 {|
7058 |-
7059
7060 !foo
7061 |}
7062 !! html/*
7063 <table>
7064
7065
7066 <tr>
7067 <th>foo
7068 </th></tr></table>
7069
7070 !! end
7071
7072 !! test
7073 Table with empty line following the start tag
7074 !! options
7075 parsoid=wt2html,html2html
7076 !! wikitext
7077 {|
7078
7079 |-
7080 |foo
7081 |}
7082 !! html/*
7083 <table>
7084
7085
7086 <tr>
7087 <td>foo
7088 </td></tr></table>
7089
7090 !! end
7091
7092 !! test
7093 Table attributes with empty value
7094 !! options
7095 parsoid=wt2html,html2html
7096 !! wikitext
7097 {|
7098 | style=|hello
7099 |}
7100 !! html/php
7101 <table>
7102 <tr>
7103 <td style="">hello
7104 </td></tr></table>
7105
7106 !! html/parsoid
7107 <table>
7108 <tbody><tr><td style="">hello</td></tr>
7109 </tbody></table>
7110 !! end
7111
7112 !! test
7113 Wikitext table with a lot of comments
7114 !! wikitext
7115 {|
7116 <!-- c0 -->
7117 |foo
7118 <!-- c1 -->
7119 |-<!-- c2 -->
7120 <!-- c3 -->
7121 |<!-- c4 -->
7122 <!-- c5 -->
7123 |}
7124 !! html
7125 <table>
7126 <tr>
7127 <td>foo
7128 </td></tr>
7129 <tr>
7130 <td>
7131 </td></tr></table>
7132
7133 !! end
7134
7135 !! test
7136 Wikitext table comments represented in parsoid dom
7137 !! wikitext
7138 {|<!--c1--><!--c2-->
7139 |-<!--c3-->
7140 |x
7141 |}
7142 !! html/php+tidy
7143 <table>
7144
7145 <tbody><tr>
7146 <td>x
7147 </td></tr></tbody></table>
7148 !! html/parsoid
7149 <table><!--c1--><!--c2-->
7150 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
7151 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
7152 </tbody></table>
7153 !! end
7154
7155 !! test
7156 Wikitext table with double-line table cell
7157 !! wikitext
7158 {|
7159 |a
7160 b
7161 |}
7162 !! html
7163 <table>
7164 <tr>
7165 <td>a
7166 <p>b
7167 </p>
7168 </td></tr></table>
7169
7170 !! end
7171
7172 !! test
7173 Table cell with a single comment
7174 !! wikitext
7175 {|
7176 |<!-- c1 -->
7177 |a
7178 |}
7179 !! html
7180 <table>
7181 <tr>
7182 <td>
7183 </td>
7184 <td>a
7185 </td></tr></table>
7186
7187 !! end
7188
7189 !! test
7190 Table-cell after a comment-only-empty-line
7191 !! wikitext
7192 {|
7193 |a
7194 <!--c1-->
7195 <!--c2-->|b
7196 |}
7197 !! html
7198 <table>
7199 <tr>
7200 <td>a
7201 </td>
7202 <td>b
7203 </td></tr></table>
7204
7205 !! html/parsoid
7206 <table>
7207 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7208 <!--c1-->
7209 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
7210 </tbody></table>
7211
7212 !! end
7213
7214 !! test
7215 Build table with {{!}}
7216 !! wikitext
7217 {{{!}} class="wikitable"
7218 !header
7219 !second header
7220 {{!}}- style="color:red;"
7221 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
7222 {{!}}}
7223 !! html
7224 <table class="wikitable">
7225 <tr>
7226 <th>header
7227 </th>
7228 <th>second header
7229 </th></tr>
7230 <tr style="color:red;">
7231 <td>data</td>
7232 <td style="color:red;">second data
7233 </td></tr></table>
7234
7235 !! end
7236
7237 !! test
7238 Build table with pipe as data
7239 !! wikitext
7240 {| class="wikitable"
7241 !header
7242 !second header
7243 |- style="color:red;"
7244 |data|| style="color:red;" |second data
7245 |-
7246 | style="color:red;" |data with | || style="color:red;" | second data with |
7247 |-
7248 ||data with | |||second data with |
7249 |}
7250 !! html
7251 <table class="wikitable">
7252 <tr>
7253 <th>header
7254 </th>
7255 <th>second header
7256 </th></tr>
7257 <tr style="color:red;">
7258 <td>data</td>
7259 <td style="color:red;">second data
7260 </td></tr>
7261 <tr>
7262 <td style="color:red;">data with |</td>
7263 <td style="color:red;">second data with |
7264 </td></tr>
7265 <tr>
7266 <td>data with |</td>
7267 <td>second data with |
7268 </td></tr></table>
7269
7270 !! end
7271
7272 !! test
7273 Build table with wikilink
7274 !! wikitext
7275 {| class="wikitable"
7276 !header||second header
7277 |- style="color:red;"
7278 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
7279 |-
7280 |data||second data [[Main Page|link|text with pipe]]
7281 |}
7282 !! html
7283 <table class="wikitable">
7284 <tr>
7285 <th>header</th>
7286 <th>second header
7287 </th></tr>
7288 <tr style="color:red;">
7289 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
7290 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7291 </td></tr>
7292 <tr>
7293 <td>data</td>
7294 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7295 </td></tr></table>
7296
7297 !! end
7298
7299 # The expected HTML structure in this test is debatable. The PHP parser does
7300 # not parse this kind of table at all. The main focus for Parsoid is on
7301 # round-tripping, so this output is ok for now. TODO: revisit!
7302 !! test
7303 Wikitext table with html-syntax row
7304 !! wikitext
7305 {|
7306 |-
7307 <td>foo</td>
7308 |}
7309 !! html/parsoid
7310 <table>
7311 <tbody>
7312 <tr>
7313 <td>foo</td></tr></tbody></table>
7314 !! end
7315
7316 !! test
7317 Fostered content in tables: Plain text
7318 !! options
7319 parsoid=wt2html,html2html
7320 !! wikitext
7321 {|
7322 |-
7323 a
7324 |}
7325 !! html/php
7326 <table>
7327
7328 a
7329 </table>
7330
7331 !! html/php+tidy
7332
7333
7334 a
7335 <table></table>
7336 !! html/parsoid
7337 <span data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
7338 a
7339 </span><table>
7340 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr></tbody></table>
7341 !! end
7342
7343 !! test
7344 Fostered content in tables: Lists
7345 !! options
7346 parsoid=wt2html,html2html
7347 !! wikitext
7348 {|
7349 |-
7350 *a
7351 |}
7352 !! html/php
7353 <table>
7354
7355 <ul><li>a</li></ul>
7356 </table>
7357
7358 !! html/php+tidy
7359 <ul><li>a</li></ul><table>
7360
7361
7362 </table>
7363 !! html/parsoid
7364 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7365 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7366
7367 </tr></tbody></table>
7368 !! end
7369
7370 !! test
7371 Template generated table cell with attributes
7372 !! wikitext
7373 {|
7374 |-
7375 {{table_attribs_4}} ||a||b
7376 |}
7377 !! html/php+tidy
7378 <table>
7379
7380 <tbody><tr>
7381 <td style="background-color:#DC241f;" width="10px"></td>
7382 <td>a</td>
7383 <td>b
7384 </td></tr></tbody></table>
7385 !! html/parsoid
7386 <table>
7387 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7388 <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>
7389 !! end
7390
7391 !! test
7392 Parsoid: Round-trip tables directly followed by content (T53219)
7393 !! options
7394 parsoid=wt2html,wt2wt
7395 !! wikitext
7396 {|
7397 |foo
7398 |} bar
7399
7400 {|
7401 |baz
7402 |}<b>quux</b>
7403 !! html+tidy
7404 <table>
7405 <tbody><tr>
7406 <td>foo
7407 </td></tr></tbody></table><p> bar
7408 </p><table>
7409 <tbody><tr>
7410 <td>baz
7411 </td></tr></tbody></table><p><b>quux</b>
7412 </p>
7413 !! end
7414
7415 !! test
7416 Parsoid: Default to a newline after tables in new content (T53219)
7417 !! options
7418 parsoid=html2wt
7419 !! html/parsoid
7420 <table><tbody>
7421 <tr><td>foo</td></tr></tbody></table> bar
7422 <table><tbody>
7423 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7424 !! wikitext
7425 {|
7426 |foo
7427 |}
7428 <nowiki> </nowiki>bar
7429 {|
7430 |baz
7431 |}
7432 '''quux'''
7433 !! end
7434
7435 !! test
7436 Parsoid: Row-syntax table headings followed by comment & table cells
7437 !! options
7438 parsoid=wt2html,wt2wt
7439 !! wikitext
7440 {|
7441 !foo||bar
7442 <!-- foo --> ||baz||quux
7443 |}
7444 !! html/php
7445 <table>
7446 <tr>
7447 <th>foo</th>
7448 <th>bar
7449 </th>
7450 <td>baz</td>
7451 <td>quux
7452 </td></tr></table>
7453
7454 !! html/parsoid
7455 <table>
7456 <tbody><tr><th>foo</th><th>bar
7457 <!-- foo --></th><td> baz </td><td>quux</td></tr>
7458 </tbody></table>
7459 !! end
7460
7461 !!test
7462 Parsoid: Recover better from broken table attributes
7463 !!options
7464 parsoid=wt2html
7465 !!wikitext
7466 {| class="foo
7467 | class="bar" |
7468 foo
7469 |}
7470 !!html/php+tidy
7471 <table class="foo">
7472 <tbody><tr>
7473 <td class="bar">
7474 <p>foo
7475 </p>
7476 </td></tr></tbody></table>
7477 !!html/parsoid
7478 <table class="foo">
7479 <tr>
7480 <td class="bar">
7481 <p>foo</p></td></tr>
7482 </tbody></table>
7483 !!end
7484
7485 !! test
7486 Tables: Digest broken attributes on table and tr tag
7487 !! options
7488 parsoid=wt2html
7489 !! wikitext
7490 {| || |} ++
7491 |- || || ++ --
7492 |- > [
7493 |}
7494 !! html
7495 <table>
7496 <tbody>
7497 <tr class='mw-empty-elt'></tr>
7498 <tr class='mw-empty-elt'></tr>
7499 </tbody></table>
7500 !! end
7501
7502 !! test
7503 Table with missing opening <tr> tag
7504 !! options
7505 parsoid=wt2html,wt2wt
7506 !! wikitext
7507 <table>
7508 <td>foo</td>
7509 </tr>
7510 </table>
7511 !! html+tidy
7512 <table>
7513 <tbody><tr><td>foo</td>
7514 </tr>
7515 </tbody></table>
7516 !! end
7517
7518 # T137406: Whitespace in the HTML
7519 !! test
7520 1. Generate correct wikitext for tables with thead/tbody/tfoot
7521 !! options
7522 parsoid=html2wt
7523 !! html/parsoid
7524 <table>
7525 <caption>Test</caption>
7526 <thead>
7527 <tr>
7528 <th>Month</th>
7529 <th>Savings</th>
7530 </tr>
7531 </thead>
7532 <tbody>
7533 <tr>
7534 <td>January</td>
7535 <td>$100</td>
7536 </tr>
7537 <tr>
7538 <td>February</td>
7539 <td>$80</td>
7540 </tr>
7541 </tbody>
7542 <tfoot>
7543 <tr>
7544 <td>Sum</td>
7545 <td>$180</td>
7546 </tr>
7547 </tfoot>
7548 </table>
7549 !! wikitext
7550 {|
7551 |+Test
7552 !Month
7553 !Savings
7554 |-
7555 |January
7556 |$100
7557 |-
7558 |February
7559 |$80
7560 |-
7561 |Sum
7562 |$180
7563 |}
7564 !! html/php+tidy
7565 <table>
7566 <caption>Test
7567 </caption>
7568 <tbody><tr>
7569 <th>Month
7570 </th>
7571 <th>Savings
7572 </th></tr>
7573 <tr>
7574 <td>January
7575 </td>
7576 <td>$100
7577 </td></tr>
7578 <tr>
7579 <td>February
7580 </td>
7581 <td>$80
7582 </td></tr>
7583 <tr>
7584 <td>Sum
7585 </td>
7586 <td>$180
7587 </td></tr></tbody></table>
7588 !! end
7589
7590 # T137406: No whitespace in the HTML
7591 !! test
7592 2. Generate correct wikitext for tables with thead/tbody/tfoot
7593 !! options
7594 parsoid=html2wt
7595 !! html/parsoid
7596 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7597 !! wikitext
7598 {|
7599 !heading
7600 |-
7601 |foo
7602 |}
7603 !! end
7604
7605 !! test
7606 Wikitext tables can be nested inside HTML tables
7607 !! options
7608 parsoid=html2wt
7609 !! html
7610 <table data-parsoid='{"stx":"html"}'>
7611 <tr><td>
7612 <table>
7613 <tr><td>foo</td></tr>
7614 </table>
7615 </td></tr>
7616 </table>
7617 !! wikitext
7618 <table>
7619 <tr><td>
7620 {|
7621 |foo
7622 |}
7623 </td></tr>
7624 </table>
7625 !! end
7626
7627 ###
7628 ### Internal links
7629 ###
7630 !! test
7631 Plain link, capitalized
7632 !! wikitext
7633 [[Main Page]]
7634 !! html
7635 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7636 </p>
7637 !! end
7638
7639 !! test
7640 Plain link, uncapitalized
7641 !! wikitext
7642 [[main Page]]
7643 !! html
7644 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7645 </p>
7646 !! end
7647
7648 !! test
7649 Piped link
7650 !! wikitext
7651 [[Main Page|The Main Page]]
7652 !! html
7653 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7654 </p>
7655 !! end
7656
7657 !! test
7658 Piped link with comment in link text
7659 !! wikitext
7660 [[Main Page|The Main<!--front--> Page]]
7661 !! html
7662 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7663 </p>
7664 !! end
7665
7666 !! test
7667 Piped link with multiple pipe characters in link text
7668 !! wikitext
7669 [[Main Page||The|Main|Page|]]
7670 !! html/php
7671 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7672 </p>
7673 !! html/parsoid
7674 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7675 !! end
7676
7677 !! test
7678 Piped link with no link text
7679 !! wikitext
7680 [[Thomas Bek (bishop of St David's)|]]
7681 !! html/php
7682 <p>[[Thomas Bek (bishop of St David's)|]]
7683 </p>
7684 !! html/parsoid
7685 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7686 !! end
7687
7688 !! test
7689 Piped link with empty link text
7690 !! wikitext
7691 [[Main Page|<nowiki/>]] - empty nowiki
7692 [[Main Page| ]] - empty space
7693 [[Main Page|&nbsp;]] - empty non breaking space
7694 !! html/php
7695 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7696 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7697 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7698 </p>
7699 !! html/parsoid
7700 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7701 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7702 <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>
7703 !! end
7704
7705 !! test
7706 Broken link
7707 !! wikitext
7708 [[Zigzagzogzagzig]]
7709 !! html
7710 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7711 </p>
7712 !! end
7713
7714 !! test
7715 Broken link with fragment
7716 !! wikitext
7717 [[Zigzagzogzagzig#zug]]
7718 !! html
7719 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7720 </p>
7721 !! end
7722
7723 !! test
7724 Special page link with fragment
7725 !! wikitext
7726 [[Special:Version#anchor]]
7727 !! html
7728 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7729 </p>
7730 !! end
7731
7732 !! test
7733 Nonexistent special page link with fragment
7734 !! wikitext
7735 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7736 !! html
7737 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7738 </p>
7739 !! end
7740
7741 !! test
7742 Link with prefix
7743 !! wikitext
7744 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7745 !! html
7746 <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>
7747 </p>
7748 !! end
7749
7750 !! test
7751 Link with suffix
7752 !! wikitext
7753 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7754 !! html
7755 <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>!!!
7756 </p>
7757 !! end
7758
7759 !! article
7760 prefixed article
7761 !! text
7762 Some text
7763 !! endarticle
7764
7765 !! test
7766 T45661: Piped links with identical prefixes
7767 !! wikitext
7768 [[prefixed article|prefixed articles with spaces]]
7769
7770 [[prefixed article|prefixed articlesaoeu]]
7771
7772 [[Main Page|Main Page test]]
7773 !! html
7774 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7775 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7776 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7777 </p>
7778 !! end
7779
7780
7781 !! test
7782 Link with HTML entity in suffix / tail
7783 !! wikitext
7784 [[Main Page]]&quot;, [[Main Page]]&#97;
7785 !! html/php
7786 <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;
7787 </p>
7788 !! html/parsoid
7789 <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>
7790 !! end
7791
7792 !! test
7793 Link with 3 brackets
7794 !! wikitext
7795 [[[Main Page]]]
7796 Foo [[[Main Page]]]
7797 !! html
7798 <p>[[[Main Page]]]
7799 Foo [[[Main Page]]]
7800 </p>
7801 !! end
7802
7803 !! test
7804 Link with 4 brackets
7805 !! wikitext
7806 [[[[Main Page]]]]
7807 !! html
7808 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7809 </p>
7810 !! end
7811
7812 !! test
7813 Piped link with 3 brackets
7814 !! wikitext
7815 [[[main page|the main page]]]
7816 !! html
7817 <p>[[[main page|the main page]]]
7818 </p>
7819 !! end
7820
7821 !! test
7822 Piped link with extlink-like text
7823 !! wikitext
7824 [[Main Page|[bar]]]
7825 [[Main Page|This is a [bar]]]
7826 [[Main Page|[bar]]
7827 !! html/php
7828 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7829 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7830 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7831 </p>
7832 !! html/parsoid
7833 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7834 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7835 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7836 !! end
7837
7838 !! test
7839 Link with multiple pipes
7840 !! wikitext
7841 [[Main Page|The|Main|Page]]
7842 !! html
7843 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7844 </p>
7845 !! end
7846
7847 !! test
7848 Anchor containing a #. (T65430)
7849 !! config
7850 wgFragmentMode=[ 'html5', 'legacy' ]
7851 !! wikitext
7852 [[Main Page#And#Link]]
7853 !! html/php
7854 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7855 </p>
7856 !! html/parsoid
7857 <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>
7858 !! end
7859
7860 !! test
7861 Link to namespaces
7862 !! wikitext
7863 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7864 !! html
7865 <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>
7866 </p>
7867 !! end
7868
7869 !! test
7870 Link with space in namespace
7871 !! wikitext
7872 [[User talk:Foo bar]]
7873 !! html
7874 <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>
7875 </p>
7876 !! end
7877
7878 !! article
7879 MemoryAlpha:AlphaTest
7880 !! text
7881 This is an article in the MemoryAlpha namespace
7882 (which shadows the memoryalpha interwiki link).
7883 !! endarticle
7884
7885 !! test
7886 Namespace takes precedence over interwiki link (T53680)
7887 !! wikitext
7888 [[MemoryAlpha:AlphaTest]]
7889 !! html
7890 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7891 </p>
7892 !! end
7893
7894 # The previous test doesn't work correctly in html2*, due to not recognizing the
7895 # link as an internal one. This one checks for the correct behavior.
7896 !! test
7897 Link to namespace preferred over interwiki with correct rel attribute
7898 !! options
7899 parsoid=html2wt,html2html
7900 !! html/parsoid
7901 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7902 !! wikitext
7903 [[MemoryAlpha:AlphaTest]]
7904 !! end
7905
7906 !! test
7907 Piped link to namespace
7908 !! wikitext
7909 [[Meta:Disclaimers|The disclaimers]]
7910 !! html
7911 <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>
7912 </p>
7913 !! end
7914
7915 !! test
7916 Link containing }
7917 !! wikitext
7918 [[Usually caused by a typo (oops}]]
7919 !! html
7920 <p>[[Usually caused by a typo (oops}]]
7921 </p>
7922 !! end
7923
7924 !! article
7925 7% Solution
7926 !! text
7927 Just a test of an article title containing a percent.
7928 !! endarticle
7929
7930 !! test
7931 Link containing % (not as a hex sequence)
7932 !! wikitext
7933 [[7% Solution]]
7934 [[7% Solution|7%25 Solution]]
7935 !! html/php
7936 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7937 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7938 </p>
7939 !! html/parsoid
7940 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7941 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7942 !! end
7943
7944 # note that the parsoid HTML is identical to the previous test output,
7945 # so the previous test ensures that the html2wt mode will generate the
7946 # "not as a hex sequence" wikitext.
7947 !! test
7948 Link containing % as a single hex sequence interpreted to char
7949 !! options
7950 parsoid=wt2wt,wt2html,html2html
7951 !! wikitext
7952 [[7%25 Solution]]
7953 [[7%25 Solution|7%25 Solution]]
7954 !! html/php
7955 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7956 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7957 </p>
7958 !! html/parsoid
7959 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7960 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7961 !!end
7962
7963 !! test
7964 Link containing % as a double hex sequence interpreted to hex sequence
7965 !! wikitext
7966 [[7%2525 Solution]]
7967 !! html
7968 <p>[[7%2525 Solution]]
7969 </p>
7970 !!end
7971
7972 ## Example for such a section: == < ==
7973 !! test
7974 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7975 !! config
7976 wgFragmentMode=[ 'html5', 'legacy' ]
7977 !! wikitext
7978 [[%23%3c]][[%23%3e]]
7979 !! html/php
7980 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
7981 </p>
7982 !! html/parsoid
7983 <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>
7984 !! end
7985
7986 ## Example for such a section: == < ==
7987 !! test
7988 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
7989 !! config
7990 wgFragmentMode=[ 'legacy' ]
7991 !! wikitext
7992 [[%23%3c]][[%23%3e]]
7993 !! html/php
7994 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7995 </p>
7996 !! end
7997
7998 !! test
7999 Link containing "<#" and ">#" as a hex sequences
8000 !! wikitext
8001 [[%3c%23]][[%3e%23]]
8002 !! html
8003 <p>[[%3c%23]][[%3e%23]]
8004 </p>
8005 !! end
8006
8007 !! test
8008 Link containing an equals sign
8009 !! wikitext
8010 [[Special:BookSources/isbn=4-00-026157-6]]
8011 !! html/php
8012 <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>
8013 </p>
8014 !! html/parsoid
8015 <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>
8016 !! end
8017
8018 !! article
8019 Foo~bar
8020 !! text
8021 Just a test of an article title containing a tilde.
8022 !! endarticle
8023
8024 # note that links containing signatures, like [[Foo~~~~]], are
8025 # massaged by the pre-save transform (PST) and so the tildes are never
8026 # seen by the parser.
8027 !! test
8028 Link containing a tilde
8029 !! wikitext
8030 [[Foo~bar]]
8031 !! html/php
8032 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
8033 </p>
8034 !! html/parsoid
8035 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
8036 !! end
8037
8038 !! test
8039 Link containing double-single-quotes '' (T6598)
8040 !! wikitext
8041 [[Lista d''e paise d''o munno]]
8042 !! html/php
8043 <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>
8044 </p>
8045 !! html/parsoid
8046 <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>
8047 !! end
8048
8049 !! test
8050 Link containing double quotes and spaces
8051 !! wikitext
8052 [[Cool "Gator"]]
8053 !! html/php
8054 <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>
8055 </p>
8056 !! html/parsoid
8057 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
8058 !! end
8059
8060 !! test
8061 File containing double quotes and spaces
8062 !! wikitext
8063 [[File:Cool "Gator".png]]
8064 !! html/parsoid
8065 <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>
8066 !! end
8067
8068 !! test
8069 Redirect containing double quotes and spaces
8070 !! wikitext
8071 #REDIRECT [[Cool "Gator"]]
8072 !! html/parsoid
8073 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
8074 !! end
8075
8076 !! test
8077 Link containing double-single-quotes '' in text (T6598 sanity check)
8078 !! wikitext
8079 Some [[Link|pretty ''italics'' and stuff]]!
8080 !! html/php
8081 <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>!
8082 </p>
8083 !! html/parsoid
8084 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8085 !! end
8086
8087 !! test
8088 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8089 !! wikitext
8090 ''Some [[Link|pretty ''italics'' and stuff]]!''
8091 !! html
8092 <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>
8093 </p>
8094 !! end
8095
8096 !! test
8097 Link with double quotes in title part (literal) and alternate part (interpreted)
8098 !! wikitext
8099 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8100
8101 [[''Pentecoste'']]
8102
8103 [[''Pentecoste''|Pentecoste]]
8104
8105 [[''Pentecoste''|''Pentecoste'']]
8106 !! html/php
8107 <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>
8108 </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>
8109 </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>
8110 </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>
8111 </p>
8112 !! html/parsoid
8113 <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>
8114 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8115 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8116 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8117 !! end
8118
8119 !! test
8120 Broken image links with HTML captions (T41700)
8121 !! wikitext
8122 [[File:Nonexistent|<script></script>]]
8123 [[File:Nonexistent|100x100px|<script></script>]]
8124 [[File:Nonexistent|&lt;]]
8125 [[File:Nonexistent|a<i>b</i>c]]
8126 !! html/php
8127 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8128 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8129 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8130 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8131 </p>
8132 !! html/parsoid
8133 <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>
8134 <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>
8135 <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>
8136 <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>
8137 !! end
8138
8139 !! test
8140 Plain link to URL
8141 !! wikitext
8142 [[http://www.example.com]]
8143 !! html/php
8144 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8145 </p>
8146 !! html/parsoid
8147 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
8148 !! end
8149
8150 !! test
8151 Plain link to URL with link text
8152 !! wikitext
8153 [[http://www.example.com Link text]]
8154 !! html
8155 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8156 </p>
8157 !! end
8158
8159 !! test
8160 Plain link to protocol-relative URL
8161 !! wikitext
8162 [[//www.example.com]]
8163 !! html/php
8164 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8165 </p>
8166 !! html/parsoid
8167 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8168 !! end
8169
8170 !! test
8171 Plain link to protocol-relative URL with link text
8172 !! wikitext
8173 [[//www.example.com Link text]]
8174 !! html
8175 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8176 </p>
8177 !! end
8178
8179 !! test
8180 Plain link to page with question mark in title
8181 !! wikitext
8182 [[A?b]]
8183
8184 [[A?b|Baz]]
8185 !! html
8186 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8187 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8188 </p>
8189 !! end
8190
8191 # I'm fairly sure the expected result here is wrong.
8192 # We want these to be URL links, not pseudo-pages with URLs for titles....
8193 # However the current output is also pretty screwy.
8194 #
8195 # ----
8196 # I'm changing it to match the current output--it arguably makes more
8197 # sense in the light of the test above. Old expected result was:
8198 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8199 #</p>
8200 # But I think this test is bordering on "garbage in, garbage out" anyway.
8201 # -- wtm
8202 !! test
8203 Piped link to URL
8204 !! wikitext
8205 Piped link to URL: [[http://www.example.com|an example URL]]
8206 !! html/php
8207 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8208 </p>
8209 !! html/parsoid
8210 <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>
8211 !! end
8212
8213 !! test
8214 Plain link in template argument
8215 !! options
8216 parsoid=wt2html
8217 !! wikitext
8218 {{echo|[http://www.example.com |123]}}
8219
8220 {{echo|[[http://www.example.com |123]]}}
8221
8222 {{echo|[[http://www.example.com |123]}}
8223
8224 {{echo|[http://www.example.com |123]]}}
8225 !! html/php
8226 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8227 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8228 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8229 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8230 </p>
8231 !! html/parsoid
8232 <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>
8233
8234 <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>
8235
8236 <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>
8237
8238 <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>
8239 !! end
8240
8241 !! test
8242 T2002: [[page|http://url/]] should link to page, not http://url/
8243 !! wikitext
8244 [[Main Page|http://url/]]
8245 !! html/php
8246 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8247 </p>
8248 !! html/parsoid
8249 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8250 !! end
8251
8252 # Parsoid does not mark self-links, by design.
8253 !! test
8254 T2337: Escaped self-links should be bold
8255 !! options
8256 title=[[Bug462]]
8257 !! wikitext
8258 [[Bu&#103;462]] [[Bug462]]
8259 !! html/php+tidy
8260 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8261 </p>
8262 !! html/parsoid
8263 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8264 !! end
8265
8266 !! test
8267 Self-link to section should not be bold
8268 !! options
8269 title=[[Main Page]]
8270 !! wikitext
8271 [[Main Page#section]]
8272 !! html
8273 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8274 </p>
8275 !! end
8276
8277 !! article
8278 00
8279 !! text
8280 This is 00.
8281 !! endarticle
8282
8283 !!test
8284 Self-link to numeric title
8285 !!options
8286 title=[[0]]
8287 !! wikitext
8288 [[0]]
8289 !! html
8290 <p><a class="mw-selflink selflink">0</a>
8291 </p>
8292 !!end
8293
8294 !!test
8295 Link to numeric-equivalent title
8296 !!options
8297 title=[[0]]
8298 !! wikitext
8299 [[00]]
8300 !! html
8301 <p><a href="/wiki/00" title="00">00</a>
8302 </p>
8303 !!end
8304
8305 !! test
8306 <nowiki> inside a link
8307 !! wikitext
8308 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8309 !! html
8310 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8311 </p>
8312 !! end
8313
8314 !! test
8315 Non-breaking spaces in title
8316 !! wikitext
8317 [[&nbsp; Main &nbsp; Page &nbsp;]]
8318 !! html
8319 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8320 </p>
8321 !!end
8322
8323 # Add new article for the test below so that it doesn't red-link
8324 !! article
8325 Foo bar baz
8326 !! text
8327 boo
8328 !! endarticle
8329
8330 !! test
8331 Multiple spaces in titles should normalize to a single underscore
8332 !! options
8333 parsoid=wt2html,wt2wt
8334 !! wikitext
8335 [[Foo bar baz|x]]
8336 [[Foo bar baz|x]]
8337 [[Foo bar baz|x]]
8338 !! html/php
8339 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8340 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8341 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8342 </p>
8343 !! html/parsoid
8344 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8345 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8346 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8347 </p>
8348 !! end
8349
8350 !! test
8351 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8352 !! options
8353 language=ca
8354 !! wikitext
8355 '''[[Main Page]]'''
8356 !! html
8357 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8358 </p>
8359 !! end
8360
8361 !! test
8362 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8363 !! options
8364 language=ca
8365 !! wikitext
8366 ''[[Main Page]]''
8367 !! html
8368 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8369 </p>
8370 !! end
8371
8372 !! test
8373 Internal link with en linktrail: no apostrophes (T29473)
8374 !! options
8375 language=en
8376 !! wikitext
8377 [[Something]]'nice
8378 !! html
8379 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8380 </p>
8381 !! end
8382
8383 !! test
8384 Internal link with ca linktrail with apostrophes (T29473)
8385 !! options
8386 language=ca
8387 !! wikitext
8388 [[Something]]'nice
8389 !! html
8390 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8391 </p>
8392 !! end
8393
8394 !! test
8395 Internal link with kaa linktrail with apostrophes (T29473)
8396 !! options
8397 language=kaa
8398 !! wikitext
8399 [[Something]]'nice
8400 !! html
8401 <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>
8402 </p>
8403 !! end
8404
8405 !! test
8406 Link with multiple ":" in a subpage-supporting namespace (T65636)
8407 !! wikitext
8408 [[User:Foo/Test/63636:Bar|Test]]
8409 !! html/php
8410 <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>
8411 </p>
8412 !! html/parsoid
8413 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8414 !! end
8415
8416 ## Mainly a sanity check for Parsoid
8417 !! test
8418 Handle title parsing for subpages
8419 !! options
8420 title=[[/123123]]
8421 subpage
8422 !! wikitext
8423 123
8424 !! html/php
8425 <p>123
8426 </p>
8427 !! html/parsoid
8428 <p>123</p>
8429 !! end
8430
8431 !! article
8432 User:Test/123
8433 !! text
8434 test 123
8435 !! endarticle
8436
8437 !! test
8438 Link to a subpage from a namespace other than main
8439 !! options
8440 title=[[User:Test]]
8441 subpage
8442 !! wikitext
8443 [[/123]]
8444 !! html/php
8445 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8446 </p>
8447 !! html/parsoid
8448 <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>
8449 !! end
8450
8451 !! test
8452 Ensure that transclusion titles are not url-decoded
8453 !! options
8454 subpage title=[[Test]]
8455 parsoid=wt2html
8456 !! wikitext
8457 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8458 !! html/php
8459 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8460 </p>
8461 !! html/parsoid
8462 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8463 !! end
8464
8465 !! test
8466 Purely hash wikilink
8467 !! options
8468 title=[[User:Test/123]]
8469 subpage
8470 !! wikitext
8471 [[#a|b]]
8472 !! html/php
8473 <p><a href="#a">b</a>
8474 </p>
8475 !! html/parsoid
8476 <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>
8477 !! end
8478
8479 !! test
8480 Serialization of purely hash wikilink
8481 !! options
8482 title=[[User:Test/123]]
8483 subpage
8484 parsoid=html2wt
8485 !! html/parsoid
8486 <p><a href="#a">[[</a></p>
8487 !! wikitext
8488 [[#a|<nowiki>[[</nowiki>]]
8489 !! html/php
8490 <p><a href="#a">[[</a>
8491 </p>
8492 !! end
8493
8494 !! test
8495 1. Interaction of linktrail and template encapsulation
8496 !! wikitext
8497 {{echo|[[Foo]]}}l
8498 !! html/parsoid
8499 <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>
8500 !! end
8501
8502 !! test
8503 2. Interaction of linktrail and template encapsulation
8504 !! options
8505 parsoid
8506 !! wikitext
8507 {{echo|Some [[Fool]]}}s
8508 !! html
8509 <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>
8510 !! end
8511
8512 !! test
8513 3. Interaction of linktrail and template encapsulation
8514 !! options
8515 parsoid
8516 !! wikitext
8517 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8518 !! html
8519 <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>
8520 !! end
8521
8522 !! article
8523 Söfnuður
8524 !! text
8525 Test.
8526 !! endarticle
8527
8528 !! test
8529 Internal link with is link prefix
8530 !! options
8531 language=is
8532 !! wikitext
8533 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8534 !! html
8535 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8536 </p>
8537 !! end
8538
8539 !! article
8540 Mótmælendatrú
8541 !! text
8542 Test.
8543 !! endarticle
8544
8545 !! test
8546 Internal link with is link trail and link prefix
8547 !! options
8548 language=is
8549 !! wikitext
8550 [[mótmælendatrú|xxx]]ar
8551 [[mótmælendatrú]]ar
8552 mótmælenda[[söfnuður]]
8553 mótmælenda[[söfnuður|söfnuðir]]
8554 mótmælenda[[söfnuður|söfnuðir]]xxx
8555 !! html
8556 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8557 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8558 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8559 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8560 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8561 </p>
8562 !! end
8563
8564 !! test
8565 Parsoid link trail escaping
8566 !! options
8567 parsoid=html2wt,html2html
8568 !! html/parsoid
8569 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8570 !! wikitext
8571 [[apple]]<nowiki/>s
8572 !! end
8573
8574 !! test
8575 Parsoid link prefix escaping
8576 !! options
8577 language=is
8578 parsoid=html2wt,html2html
8579 !! html/parsoid
8580 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8581 !! wikitext
8582 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8583 !! end
8584
8585 !! test
8586 Parsoid link bracket escaping
8587 !! options
8588 parsoid=html2wt,html2html
8589 !! html/parsoid
8590 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8591 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8592 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8593 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8594 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8595 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8596 !! wikitext
8597 [[Test]]
8598
8599 [<nowiki/>[[Test]]]
8600
8601 [[[[Test]]]]
8602
8603 [[[<nowiki/>[[Test]]]]]
8604
8605 [[[[[[Test]]]]]]
8606
8607 [[[[[<nowiki/>[[Test]]]]]]]
8608 !! end
8609
8610 !! test
8611 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8612 !! wikitext
8613 [[Foo| bar]]
8614
8615 [[Foo| ''bar'']]
8616
8617 [http://wp.org foo]
8618
8619 [http://wp.org ''foo'']
8620 !! html
8621 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8622 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8623 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8624 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8625 </p>
8626 !! end
8627
8628 !! test
8629 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8630 !! wikitext
8631 [[Foo|{{echo|a}} b {{echo|c}}]]
8632 !! html/parsoid
8633 <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>
8634 !! end
8635
8636 !! test
8637 Link with angle bracket after anchor
8638 !! config
8639 wgFragmentMode=[ 'html5', 'legacy' ]
8640 !! wikitext
8641 [[Foo#<bar>]]
8642 !! html/php
8643 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8644 </p>
8645 !! html/parsoid
8646 <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>
8647 !! end
8648
8649 !! test
8650 Link with angle bracket after anchor (legacy)
8651 !! config
8652 wgFragmentMode=[ 'legacy' ]
8653 !! wikitext
8654 [[Foo#<bar>]]
8655 !! html/php
8656 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8657 </p>
8658 !! end
8659
8660 ###
8661 ### Interwiki links (see maintenance/interwiki.sql)
8662 ###
8663
8664 !! test
8665 Inline interwiki link
8666 !! options
8667 parsoid=wt2html,wt2wt,html2html
8668 !! wikitext
8669 [[MeatBall:SoftSecurity]]
8670 !! html/php
8671 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8672 </p>
8673 !! html/parsoid
8674 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8675 !! end
8676
8677 !! test
8678 Inline interwiki link with empty title (T4372)
8679 !! options
8680 parsoid=wt2html,wt2wt,html2html
8681 !! wikitext
8682 [[MeatBall:]]
8683 !! html/php
8684 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8685 </p>
8686 !! html/parsoid
8687 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8688 !! end
8689
8690 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8691 !! test
8692 Interwiki link encoding conversion (T3636)
8693 !! options
8694 parsoid=wt2html,wt2wt
8695 !! wikitext
8696 *[[Wikipedia:ro:Olteni&#0355;a]]
8697 *[[Wikipedia:ro:Olteni&#355;a]]
8698 !! html
8699 <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>
8700 <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>
8701
8702 !! html/php+tidy
8703 <ul>
8704 <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>
8705 <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>
8706 </ul>
8707 !! html/parsoid
8708 <ul>
8709 <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>
8710 <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>
8711 </ul>
8712 !! end
8713
8714 !! test
8715 Interwiki link with fragment (T4130)
8716 !! wikitext
8717 [[MeatBall:SoftSecurity#foo]]
8718 !! html
8719 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8720 </p>
8721 !! end
8722
8723 !! test
8724 Link scenarios with escaped fragments
8725 !! config
8726 wgFragmentMode=[ 'html5', 'legacy' ]
8727 !! wikitext
8728 [[#Is this great?]]
8729 [[Foo#Is this great?]]
8730 [[meatball:Foo#Is this great?]]
8731 !! html/php
8732 <p><a href="#Is_this_great?">#Is this great?</a>
8733 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8734 <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>
8735 </p>
8736 !! html/parsoid
8737 <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>
8738 <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>
8739 <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>
8740 !! end
8741
8742 !! test
8743 Link scenarios with escaped fragments (legacy)
8744 !! config
8745 wgFragmentMode=[ 'legacy' ]
8746 !! wikitext
8747 [[#Is this great?]]
8748 [[Foo#Is this great?]]
8749 [[meatball:Foo#Is this great?]]
8750 !! html/php
8751 <p><a href="#Is_this_great.3F">#Is this great?</a>
8752 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8753 <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>
8754 </p>
8755 !! end
8756
8757 # Ideally the wikipedia: prefix here should be proto-relative too
8758 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8759 # define the 'en' prefix, and originally the test used 'wikipedia',
8760 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8761 # article.
8762 !! test
8763 Different interwiki prefixes mapping to the same URL
8764 !! wikitext
8765 [[:en:Foo]]
8766
8767 [[:en:Foo|Foo]]
8768
8769 [[wikipedia:Foo]]
8770
8771 [[:wikipedia:Foo|Foo]]
8772
8773 [[wikipedia:en:Foo]]
8774
8775 [[:wikipedia:en:Foo]]
8776
8777 [[ wikiPEdia :Foo]]
8778 !! html/parsoid
8779 <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>
8780
8781 <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>
8782
8783 <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>
8784
8785 <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>
8786
8787 <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>
8788
8789 <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>
8790
8791 <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>
8792 !! end
8793
8794 !! test
8795 Interwiki links that cannot be represented in wiki syntax
8796 !! wikitext
8797 [[meatball:ok]]
8798 [[meatball:ok#foo|ok with fragment]]
8799 [[meatball:ok_as_well?|ok ending with ? mark]]
8800 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8801 [http://de.wikipedia.org/wiki/#foo is just fragment]
8802
8803 !! html/php
8804 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8805 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8806 <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>
8807 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8808 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8809 </p>
8810 !! html/parsoid
8811 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8812 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8813 <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>
8814 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8815 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8816 !! end
8817
8818 !! test
8819 Interwiki links: trail
8820 !! wikitext
8821 [[wikipedia:Foo|Ba]]r
8822 !! html/php
8823 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8824 </p>
8825 !! html/parsoid
8826 <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>
8827 !! end
8828
8829 !! test
8830 Local interwiki link
8831 !! options
8832 parsoid=wt2html,wt2wt,html2html
8833 !! wikitext
8834 [[local:Template:Foo]]
8835 !! html/php
8836 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8837 </p>
8838 !! html/parsoid
8839 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8840 !! end
8841
8842 # Parsoid does not mark self-links, by design.
8843 !! test
8844 Local interwiki link: self-link to current page
8845 !! options
8846 title=[[Main Page]]
8847 parsoid=wt2html,wt2wt,html2html
8848 !! wikitext
8849 [[local:Main Page]]
8850 !! html/php
8851 <p><a class="mw-selflink selflink">local:Main Page</a>
8852 </p>
8853 !! html/parsoid
8854 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8855 !! end
8856
8857 !! test
8858 Local interwiki link: prefix only (T66167)
8859 !! options
8860 parsoid=wt2html,wt2wt,html2html
8861 !! wikitext
8862 [[local:]]
8863 !! html/php
8864 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8865 </p>
8866 !! html/parsoid
8867 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8868 !! end
8869
8870 !! test
8871 Local interwiki link: with additional interwiki prefix (T63357)
8872 !! options
8873 parsoid=wt2html,wt2wt,html2html
8874 !! wikitext
8875 [[local:meatball:Hello]]
8876 !! html/php
8877 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8878 </p>
8879 !! html/parsoid
8880 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8881 !! end
8882
8883 !! test
8884 Multiple local interwiki link prefixes
8885 !! wikitext
8886 [[local:local:local:local:mi:local:Foo]]
8887 !! options
8888 parsoid=wt2html,wt2wt,html2html
8889 !! html/php
8890 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8891 </p>
8892 !! html/parsoid
8893 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8894 !! end
8895
8896 ###
8897 ### Interlanguage links
8898 ### Language links (so that searching for '### language' matches..)
8899 ###
8900
8901 !! test
8902 Interlanguage link
8903 !! wikitext
8904 Blah blah blah
8905 [[zh:Chinese]]
8906 !! html/php
8907 <p>Blah blah blah
8908 </p>
8909 !! html/parsoid
8910 <p>Blah blah blah</p>
8911 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8912 !! end
8913
8914 ## parsoid html2wt will lose the space variations
8915 !! test
8916 Interlanguage link with spacing
8917 !! options
8918 parsoid=wt2html,wt2wt,html2html
8919 !! wikitext
8920 Blah blah blah
8921 [[ zh : Chinese ]]
8922 !! html/php
8923 <p>Blah blah blah
8924 </p>
8925 !! html/parsoid
8926 <p>Blah blah blah</p>
8927 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8928 !! end
8929
8930 !! test
8931 Double interlanguage link
8932 !! wikitext
8933 Blah blah blah
8934 [[es:Spanish]]
8935 [[zh:Chinese]]
8936 !! html/php
8937 <p>Blah blah blah
8938 </p>
8939 !! html/parsoid
8940 <p>Blah blah blah</p>
8941 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8942 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8943 !! end
8944
8945 ## parsoid html2wt will lose the space variations
8946 !! test
8947 Interlanguage link variations
8948 !! options
8949 parsoid=wt2html,wt2wt,html2html
8950 !! wikitext
8951 Blah blah blah
8952 [[ es :Spanish]]
8953 [[ ZH :Chinese]]
8954 [[es:Foo_bar]]
8955 !! html/php
8956 <p>Blah blah blah
8957 </p>
8958 !! html/parsoid
8959 <p>Blah blah blah</p>
8960 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8961 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8962 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8963 !! end
8964
8965 !! test
8966 Escaping of interlanguage links (T129218, T156308)
8967 !! wikitext
8968 Blah blah blah
8969 [[:es:Spanish]]
8970 [[ : zh : Chinese ]]
8971 !! html/php
8972 <p>Blah blah blah
8973 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8974 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8975 </p>
8976 !! html/parsoid
8977 <p>Blah blah blah
8978 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8979 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8980 !! end
8981
8982 !! test
8983 Multiple colons escaping interlanguage links
8984 !! options
8985 parsoid=wt2html
8986 !! wikitext
8987 [[:es:Spanish]]
8988 [[::es:Spanish]]
8989 [[:::es:Spanish]]
8990 !! html/php
8991 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8992 [[::es:Spanish]]
8993 [[:::es:Spanish]]
8994 </p>
8995 !! html/parsoid
8996 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8997 [[::es:Spanish]]
8998 [[:::es:Spanish]]</p>
8999 !! end
9000
9001 ## parsoid html2wt will normalize the space to _
9002 !! test
9003 Space and question mark encoding in interlanguage links (T95473)
9004 !! options
9005 parsoid=wt2html,wt2wt,html2html
9006 !! wikitext
9007 Blah blah blah
9008 [[es:Foo bar?]]
9009 !! html/php
9010 <p>Blah blah blah
9011 </p>
9012 !! html/parsoid
9013 <p>Blah blah blah</p>
9014 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
9015 !! end
9016
9017 !! test
9018 Interlanguage link, with prefix links
9019 !! options
9020 language=ln
9021 !! wikitext
9022 Blah blah blah
9023 [[zh:Chinese]]
9024 !! html/php
9025 <p>Blah blah blah
9026 </p>
9027 !! html/parsoid
9028 <p>Blah blah blah</p>
9029 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9030 !! end
9031
9032 !! test
9033 Double interlanguage link, with prefix links (T10897)
9034 !! options
9035 language=ln
9036 !! wikitext
9037 Blah blah blah
9038 [[es:Spanish]]
9039 [[zh:Chinese]]
9040 !! html/php
9041 <p>Blah blah blah
9042 </p>
9043 !! html/parsoid
9044 <p>Blah blah blah</p>
9045 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9046 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9047 !! end
9048
9049 !! test
9050 "Extra" interlanguage links (T34189 / gerrit 111390)
9051 !! wikitext
9052 Blah blah blah
9053 [[mul:Article]]
9054 !! html/php
9055 <p>Blah blah blah
9056 </p>
9057 !! html/parsoid
9058 <p>Blah blah blah</p>
9059 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
9060 !! end
9061
9062 ## PHP parser tests script needs an update
9063 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9064 !! test
9065 Language links render as inline links if $wgInterwikiMagic=false
9066 !! options
9067 wgInterwikiMagic=false
9068 parsoid=wt2html,wt2wt,html2html
9069 !! wikitext
9070 Blah blah blah
9071 [[zh:Chinese]]
9072 !! html/parsoid
9073 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9074 !! end
9075
9076 ## PHP parser tests script needs an update
9077 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9078 !! test
9079 Language links render as inline links in the Talk namespace
9080 !! options
9081 title=Talk:Foo
9082 parsoid=wt2html,wt2wt,html2html
9083 !! wikitext
9084 Blah blah blah
9085 [[zh:Chinese]]
9086 !! html/parsoid
9087 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9088 !! end
9089
9090 !! test
9091 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
9092 !! options
9093 language=ln
9094 !! wikitext
9095 [[WW&nbsp;II]]
9096 !! html
9097 <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>
9098 </p>
9099 !! end
9100
9101 !! test
9102 Parsoid T55221: Wikilinks should be properly entity-escaped
9103 !! options
9104 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
9105 !! html/parsoid
9106 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9107 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9108 !! wikitext
9109 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
9110
9111 He&amp;nbsp;llo He&amp;nbsp;llo
9112 !! html/php
9113 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
9114 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
9115 </p>
9116 !! end
9117
9118 # html2wt will fail because of title normalization without data-parsoid
9119 !! test
9120 Parsoid: handle constructor well
9121 !! options
9122 parsoid=wt2html,wt2wt
9123 !! wikitext
9124 [[constructor]]
9125
9126 [[constructor:foo]]
9127 !! html/php
9128 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9129 </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>
9130 </p>
9131 !! html/parsoid
9132 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9133
9134 <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>
9135 !! end
9136
9137 !! test
9138 Template parameter named "constructor"
9139 !! wikitext
9140 {{echo| constructor = |hi}}
9141 !! html/parsoid
9142 <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>
9143 !! end
9144
9145 !! article
9146 ko:
9147 !! text
9148 Test.
9149 !! endarticle
9150
9151 # Note that `ko` isn't a known interlanguage prefix
9152 !! test
9153 Parsoid: recognize interlanguage links without a target page
9154 !! options
9155 ill
9156 !! wikitext
9157 [[es:]]
9158
9159 [[ko:]]
9160 !! html/php
9161 es:
9162 !! html/parsoid
9163 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9164
9165 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9166 !! end
9167
9168 # Note that `ko` isn't a known interwiki prefix
9169 !! test
9170 Parsoid: recognize interwiki links without a target page
9171 !! options
9172 parsoid=wt2html,wt2wt,html2html
9173 !! wikitext
9174 [[:es:]]
9175
9176 [[:ko:]]
9177 !! html/php
9178 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9179 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9180 </p>
9181 !! html/parsoid
9182 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9183 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9184 !! end
9185
9186 !! test
9187 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9188 !! wikitext
9189 [[mi:Foo]]
9190 !! html/php
9191 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9192 </p>
9193 !! html/parsoid
9194 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9195 !! end
9196
9197 !! test
9198 Interlanguage link with preceding local interwiki link (T70085)
9199 !! options
9200 parsoid=wt2html,wt2wt,html2html
9201 !! wikitext
9202 Blah blah blah
9203 [[local:es:Spanish]]
9204 !! html/php
9205 <p>Blah blah blah
9206 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9207 </p>
9208 !! html/parsoid
9209 <p>Blah blah blah
9210 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9211 !! end
9212
9213 !! test
9214 Looks like an interlanguage link, but is actually a local interwiki
9215 !! options
9216 parsoid=wt2html,wt2wt,html2html
9217 !! wikitext
9218 Blah blah blah
9219 [[mi:Template:Foo]]
9220 !! html/php
9221 <p>Blah blah blah
9222 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9223 </p>
9224 !! html/parsoid
9225 <p>Blah blah blah
9226 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9227 !! end
9228
9229 ###
9230 ### Redirects, Parsoid-only
9231 ###
9232
9233 !! test
9234 1. Simple redirect to page
9235 !! wikitext
9236 #REDIRECT [[Main Page]]
9237 !! html/parsoid
9238 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9239 !! end
9240
9241 !! test
9242 2. Other redirect variants
9243 !! wikitext
9244 #REDIRECT [[Main_Page]]
9245 !! html/parsoid
9246 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9247 !! end
9248
9249 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9250 # This tests the Parsoid bail-out code.
9251 !! test
9252 3. Other redirect variants
9253 !! options
9254 parsoid=wt2html
9255 !! wikitext
9256 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9257 !! html/parsoid
9258 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9259 !! end
9260
9261 !! test
9262 4. Redirect to a templated destination
9263 !! wikitext
9264 #REDIRECT [[{{echo|Foo}}bar]]
9265 !! html/parsoid
9266 <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"}]]}'/>
9267 !! end
9268
9269 !! test
9270 Empty redirect
9271 !! options
9272 parsoid=wt2html,wt2wt
9273 !! wikitext
9274 #REDIRECT [[]]
9275 !! html/parsoid
9276 <ol>
9277 <li>REDIRECT [[]]</li></ol>
9278 !! end
9279
9280 !! test
9281 Optional colon in #REDIRECT
9282 !! options
9283 # the colon is archaic syntax. we support it for wt2html, but we
9284 # don't care that it roundtrips back to the modern syntax.
9285 parsoid=wt2html,html2html
9286 !! wikitext
9287 #REDIRECT:[[Main Page]]
9288 !! html/parsoid
9289 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9290 !! end
9291
9292 !! test
9293 Whitespace in #REDIRECT with optional colon
9294 !! options
9295 # the colon and gratuitous whitespace is archaic syntax. we support
9296 # it for wt2html, but we don't care that it roundtrips back to the
9297 # modern syntax (without extra whitespace)
9298 parsoid=wt2html,html2html
9299 !! wikitext
9300
9301 #REDIRECT
9302 :
9303 [[Main Page]]
9304 !! html/parsoid
9305 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9306 !! end
9307
9308 !! test
9309 Piped link in #REDIRECT
9310 !! options
9311 # content after piped link is ignored. we support this syntax,
9312 # but don't care that the piped link is lost when we roundtrip this.
9313 parsoid=wt2html
9314 !! wikitext
9315 #REDIRECT [[Main Page|bar]]
9316 !! html/parsoid
9317 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9318 !! end
9319
9320 !! test
9321 Redirect to category (T104502)
9322 !! options
9323 parsoid=wt2html,wt2wt
9324 !! wikitext
9325 #REDIRECT [[Category:Foo]]
9326 !! html/parsoid
9327 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9328 !! end
9329
9330 !! test
9331 Redirect to category with URL encoding (T104502)
9332 !! options
9333 parsoid=wt2html
9334 !! wikitext
9335 #REDIRECT [[Category%3AFoo]]
9336 !! html/parsoid
9337 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9338 !! end
9339
9340 !! test
9341 Redirect to category page
9342 !! wikitext
9343 #REDIRECT [[:Category:Foo]]
9344 !! html/parsoid
9345 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9346 !! end
9347
9348 !! test
9349 Redirect to image page (1)
9350 !! wikitext
9351 #REDIRECT [[File:Wiki.png]]
9352 !! html/parsoid
9353 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9354 !! end
9355
9356 !! test
9357 Redirect to image page (2)
9358 !! wikitext
9359 #REDIRECT [[Image:Wiki.png]]
9360 !! html/parsoid
9361 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9362 !! end
9363
9364 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9365 # Next test confirms this.
9366 !! test
9367 Redirect to language (1) (T104918)
9368 !! options
9369 parsoid=wt2html,wt2wt,html2html
9370 !! wikitext
9371 #REDIRECT [[en:File:Wiki.png]]
9372 !! html/parsoid
9373 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9374 !! end
9375
9376 !! test
9377 Redirect to language (2) (T104918)
9378 !! wikitext
9379 #REDIRECT [[:en:File:Wiki.png]]
9380 !! html/parsoid
9381 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9382 !! end
9383
9384 !! test
9385 Redirect to interwiki (T104918)
9386 !! wikitext
9387 #REDIRECT [[meatball:File:Wiki.png]]
9388 !! html/parsoid
9389 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9390 !! end
9391
9392 !! test
9393 Non-English #REDIRECT
9394 !! options
9395 language=is
9396 !! wikitext
9397 #TILVÍSUN [[Main Page]]
9398 !! html/parsoid
9399 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9400 !! end
9401
9402 !! test
9403 Redirect syntax under text isn't considered a redirect
9404 !! wikitext
9405 some text
9406
9407 #redirect [[Main Page]]
9408 !! html/parsoid
9409 <p>some text</p>
9410 <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>
9411 !! end
9412
9413 !! test
9414 New redirect
9415 !! options
9416 parsoid=html2wt
9417 !! html/parsoid
9418 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9419 !! wikitext
9420 #REDIRECT [[Foo]]
9421 Foo
9422 !! end
9423
9424 !! test
9425 Redirect followed by block on the same line
9426 !! options
9427 parsoid=wt2html
9428 !! wikitext
9429 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9430 !! html/parsoid
9431 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9432 !! end
9433
9434 !! test
9435 Redirect followed by a newline
9436 !! wikitext
9437 #REDIRECT [[Main Page]]
9438 A newline
9439 !! html/parsoid
9440 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9441 <p>A newline</p>
9442 !! end
9443
9444 !! test
9445 Redirect followed by multiple newlines
9446 !! wikitext
9447 #REDIRECT [[Main Page]]
9448
9449
9450 A newline
9451 !! html/parsoid
9452 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9453
9454 <p><br/>
9455 A newline</p>
9456 !! end
9457
9458 !! test
9459 Drop duplicate redirects
9460 !! options
9461 parsoid=html2wt
9462 !! html/parsoid
9463 <link rel="mw:PageProp/redirect" href="./Foo"/>
9464 <link rel="mw:PageProp/redirect" href="./Bar"/>
9465 <link rel="mw:PageProp/redirect" href="./Baz"/>
9466 !! wikitext
9467 #REDIRECT [[Foo]]
9468 !! end
9469
9470 ##
9471 ## XHTML tidiness
9472 ###
9473
9474 !! test
9475 <br> to <br />
9476 !! wikitext
9477 1<br>2<br />3
9478 !! html
9479 <p>1<br />2<br />3
9480 </p>
9481 !! end
9482
9483 !! test
9484 Broken br tag sanitization
9485 !! wikitext
9486 </br>
9487 !! html/php
9488 <p>&lt;/br&gt;
9489 </p>
9490 !! end
9491
9492 # TODO: Fix html2html mode (T53055)!
9493 !! test
9494 Parsoid: Broken br tag recognition
9495 !! options
9496 parsoid=wt2html
9497 !! wikitext
9498 </br>
9499
9500 <br/ >
9501 !! html+tidy
9502 <p><br />
9503 </p><p><br />
9504 </p>
9505 !! end
9506
9507 !! test
9508 Incorrecly removing closing slashes from correctly formed XHTML
9509 !! wikitext
9510 <br style="clear:both;" />
9511 !! html
9512 <p><br style="clear:both;" />
9513 </p>
9514 !! end
9515
9516 !! test
9517 Failing to transform badly formed HTML into correct XHTML
9518 !! wikitext
9519 <br style="clear: left;">
9520 <br style="clear: right;">
9521 <br style="clear: both;">
9522 !! html
9523 <p><br style="clear: left;" />
9524 <br style="clear: right;" />
9525 <br style="clear: both;" />
9526 </p>
9527 !!end
9528
9529 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9530 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9531 !! test
9532 Handling html with a div self-closing tag
9533 !! wikitext
9534 <div title />
9535 <div title/>
9536 <div title/ >
9537 <div title=bar />
9538 <div title=bar/>
9539 <div title=bar/ >
9540 !! html/php
9541 <p>&lt;div title /&gt;
9542 &lt;div title/&gt;
9543 </p>
9544 <div>
9545 <p>&lt;div title=bar /&gt;
9546 &lt;div title=bar/&gt;
9547 </p>
9548 <div title="bar/"></div>
9549 </div>
9550
9551 !! html/parsoid
9552 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9553 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9554 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9555 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9556 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9557 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9558 !! end
9559
9560 !! test
9561 Handling html with a br self-closing tag
9562 !! wikitext
9563 <br title />
9564 <br title/>
9565 <br title/ >
9566 <br title=bar />
9567 <br title=bar/>
9568 <br title=bar/ >
9569 !! html/php
9570 <p><br title="" />
9571 <br title="" />
9572 <br />
9573 <br title="bar" />
9574 <br title="bar" />
9575 <br title="bar/" />
9576 </p>
9577 !! html/parsoid
9578 <p><br title="" />
9579 <br title="" />
9580 <br title="" />
9581 <br title="bar" />
9582 <br title="bar" />
9583 <br title="bar/" />
9584 </p>
9585 !! end
9586
9587 !! test
9588 Horizontal ruler (should it add that extra space?)
9589 !! wikitext
9590 <hr>
9591 <hr >
9592 foo <hr
9593 > bar
9594 !! html+tidy
9595 <hr />
9596 <hr /><p>
9597 foo </p><hr /><p> bar
9598 </p>
9599 !! end
9600
9601 !! test
9602 Horizontal ruler -- 4+ dashes render hr
9603 !! wikitext
9604 ----
9605 !! html
9606 <hr />
9607
9608 !! end
9609
9610 !! test
9611 Horizontal ruler -- eats additional dashes on the same line
9612 !! wikitext
9613 ---------
9614 !! html
9615 <hr />
9616
9617 !! end
9618
9619 !! test
9620 Horizontal ruler -- does not collapse dashes on consecutive lines
9621 !! wikitext
9622 ----
9623 ----
9624 !! html
9625 <hr />
9626 <hr />
9627
9628 !! end
9629
9630 !! test
9631 Horizontal ruler -- <4 dashes render as plain text
9632 !! wikitext
9633 ---
9634 !! html
9635 <p>---
9636 </p>
9637 !! end
9638
9639 !! test
9640 Horizontal ruler -- Supports content following dashes on same line
9641 !! wikitext
9642 ---- Foo
9643 !! html
9644 <hr /> Foo
9645
9646 !! html+tidy
9647 <hr /><p> Foo
9648 </p>
9649 !! end
9650
9651 ###
9652 ### Block-level elements
9653 ###
9654 !! test
9655 Common list
9656 !! wikitext
9657 *Common list
9658 *item 2
9659 *item 3
9660 !! html
9661 <ul><li>Common list</li>
9662 <li>item 2</li>
9663 <li>item 3</li></ul>
9664
9665 !! end
9666
9667 !! test
9668 Numbered list
9669 !! wikitext
9670 #Numbered list
9671 #item 2
9672 #item 3
9673 !! html
9674 <ol><li>Numbered list</li>
9675 <li>item 2</li>
9676 <li>item 3</li></ol>
9677
9678 !! end
9679
9680 # the switch from level 3 to ordered should not introduce a newline between
9681 !! test
9682 Mixed list
9683 !! wikitext
9684 *Mixed list
9685 *#with numbers
9686 **and bullets
9687 *#and numbers
9688 *bullets again
9689 **bullet level 2
9690 ***bullet level 3
9691 ***#Number on level 4
9692 **bullet level 2
9693 **#Number on level 3
9694 **#Number on level 3
9695 *#number level 2
9696 *Level 1
9697 ***Level 3
9698 #**Level 3, but ordered
9699 !! html
9700 <ul><li>Mixed list
9701 <ol><li>with numbers</li></ol>
9702 <ul><li>and bullets</li></ul>
9703 <ol><li>and numbers</li></ol></li>
9704 <li>bullets again
9705 <ul><li>bullet level 2
9706 <ul><li>bullet level 3
9707 <ol><li>Number on level 4</li></ol></li></ul></li>
9708 <li>bullet level 2
9709 <ol><li>Number on level 3</li>
9710 <li>Number on level 3</li></ol></li></ul>
9711 <ol><li>number level 2</li></ol></li>
9712 <li>Level 1
9713 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9714 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9715
9716 !! end
9717
9718 !! test
9719 1. Nested mixed wikitext and html list
9720 !! wikitext
9721 *hi
9722 *<ul><li>ho</li></ul>
9723 *hi
9724 **ho
9725 !! html/php
9726 <ul><li>hi</li>
9727 <li><ul><li>ho</li></ul></li>
9728 <li>hi
9729 <ul><li>ho</li></ul></li></ul>
9730
9731 !! html/parsoid
9732 <ul><li>hi</li>
9733 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9734 <li>hi
9735 <ul><li>ho</li></ul></li></ul>
9736 !! end
9737
9738 !! test
9739 2. Nested mixed wikitext and html list (incompatible)
9740 !! wikitext
9741 ;hi
9742 :{{echo|<li>ho</li>}}
9743 !! html/php
9744 <dl><dt>hi</dt>
9745 <dd><li>ho</li></dd></dl>
9746
9747 !! html/parsoid
9748 <dl><dt>hi</dt>
9749 <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>
9750 !! end
9751
9752 !! test
9753 Nested lists 1
9754 !! wikitext
9755 *foo
9756 **bar
9757 !! html
9758 <ul><li>foo
9759 <ul><li>bar</li></ul></li></ul>
9760
9761 !! end
9762
9763 !! test
9764 Nested lists 2
9765 !! wikitext
9766 **foo
9767 *bar
9768 !! html
9769 <ul><li><ul><li>foo</li></ul></li>
9770 <li>bar</li></ul>
9771
9772 !! end
9773
9774 !! test
9775 Nested lists 3 (first element empty)
9776 !! wikitext
9777 *
9778 **bar
9779 !! html
9780 <ul><li>
9781 <ul><li>bar</li></ul></li></ul>
9782
9783 !! end
9784
9785 !! test
9786 Nested lists 4 (first element empty)
9787 !! wikitext
9788 **
9789 *bar
9790 !! html
9791 <ul><li><ul><li></li></ul></li>
9792 <li>bar</li></ul>
9793
9794 !! end
9795
9796 !! test
9797 Nested lists 5 (both elements empty)
9798 !! wikitext
9799 **
9800 *
9801 !! html
9802 <ul><li><ul><li></li></ul></li>
9803 <li></li></ul>
9804
9805 !! end
9806
9807 !! test
9808 Nested lists 6 (both elements empty)
9809 !! wikitext
9810 *
9811 **
9812 !! html
9813 <ul><li>
9814 <ul><li></li></ul></li></ul>
9815
9816 !! end
9817
9818 !! test
9819 Nested lists 7 (skip initial nesting levels)
9820 !! wikitext
9821 ***foo
9822 !! html
9823 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9824
9825 !! end
9826
9827 !! test
9828 Nested lists 8 (multiple nesting transitions)
9829 !! wikitext
9830 *foo
9831 ***bar
9832 **baz
9833 *boo
9834 !! html
9835 <ul><li>foo
9836 <ul><li><ul><li>bar</li></ul></li>
9837 <li>baz</li></ul></li>
9838 <li>boo</li></ul>
9839
9840 !! end
9841
9842 !! test
9843 Nested lists 9 (extension interaction)
9844 !! options
9845 parsoid
9846 !! wikitext
9847 *<references />
9848 !! html/parsoid
9849 <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>
9850 !! end
9851
9852 !! test
9853 1. Lists with start-of-line-transparent tokens before bullets: Comments
9854 !! wikitext
9855 *foo
9856 *<!--cmt-->bar
9857 <!--cmt-->*baz
9858 !! html
9859 <ul><li>foo</li>
9860 <li>bar</li>
9861 <li>baz</li></ul>
9862
9863 !! end
9864
9865 !! test
9866 Nested lists 10 (list and span siblings: wt2wt regression)
9867 !! wikitext
9868 *a <span>x</span>
9869 **b <span>y</span>
9870 !! html/parsoid
9871 <ul><li>a <span>x</span>
9872 <ul><li>b <span>y</span></li></ul></li></ul>
9873 !! end
9874
9875 !! test
9876 2. Lists with start-of-line-transparent tokens before bullets: Template close
9877 !! wikitext
9878 *foo {{echo|bar
9879 }}*baz
9880 !! html
9881 <ul><li>foo bar</li>
9882 <li>baz</li></ul>
9883
9884 !! end
9885
9886 !! test
9887 List items are not parsed correctly following a <pre> block (T2785)
9888 !! wikitext
9889 *<pre>foo</pre>
9890 *<pre>bar</pre>
9891 *zar
9892 !! html/php
9893 <ul><li><pre>foo</pre></li>
9894 <li><pre>bar</pre></li>
9895 <li>zar</li></ul>
9896
9897 !! html/parsoid
9898 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9899 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9900 <li>zar</li></ul>
9901 !! end
9902
9903 # FIXME: Might benefit from a html/parsoid since this has a template
9904 !! test
9905 List items from template
9906 !! wikitext
9907
9908 {{inner list}}
9909 *item 2
9910
9911 *item 0
9912 {{inner list}}
9913 *item 2
9914
9915 *item 0
9916 *notSOL{{inner list}}
9917 *item 2
9918 !! html
9919 <ul><li>item 1</li>
9920 <li>item 2</li></ul>
9921 <ul><li>item 0</li>
9922 <li>item 1</li>
9923 <li>item 2</li></ul>
9924 <ul><li>item 0</li>
9925 <li>notSOL</li>
9926 <li>item 1</li>
9927 <li>item 2</li></ul>
9928
9929 !! end
9930
9931 !! test
9932 List interrupted by empty line or heading
9933 !! wikitext
9934 *foo
9935
9936 **bar
9937 ==A heading==
9938 *Another list item
9939 !! html
9940 <ul><li>foo</li></ul>
9941 <ul><li><ul><li>bar</li></ul></li></ul>
9942 <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>
9943 <ul><li>Another list item</li></ul>
9944
9945 !!end
9946
9947 !! test
9948 Multiple list tags generated by templates
9949 !! wikitext
9950 {{echo|<li>}}a
9951 {{echo|<li>}}b
9952 {{echo|<li>}}c
9953 !! html
9954 <li>a
9955 <li>b
9956 <li>c</li>
9957 </li>
9958 </li>
9959
9960
9961 !! html+tidy
9962 <li>a
9963 </li><li>b
9964 </li><li>c
9965 </li>
9966 !! html/parsoid
9967 <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
9968 </li><li about="#mwt1">b
9969 </li><li about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[null,44,null,0]}'>c</li>
9970 !! end
9971
9972 !! test
9973 Multiple newlines in between HTML list items don't induce paragraph wrapping
9974 !! wikitext
9975 <ul>
9976 <li>hi</li>
9977
9978
9979
9980
9981 <li>ho</li>
9982 </ul>
9983
9984 <dl>
9985 <dt>hi</dt>
9986 <dd>ho<div>123</div>
9987 </dd>
9988
9989
9990 </dl>
9991 !! html/php+tidy
9992 <ul>
9993 <li>hi</li>
9994
9995
9996
9997
9998 <li>ho</li>
9999 </ul>
10000 <dl>
10001 <dt>hi</dt>
10002 <dd>ho<div>123</div>
10003 </dd>
10004
10005
10006 </dl>
10007 !! end
10008
10009 !!test
10010 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
10011 !! wikitext
10012 *a
10013 <!--This line will NOT split the list-->
10014 *b
10015 <!--This line will NOT split the list either-->
10016 *c
10017 <!--foo--> <!----> <!--This line NOT split the list either-->
10018 *d
10019 !! html
10020 <ul><li>a</li>
10021 <li>b</li>
10022 <li>c</li>
10023 <li>d</li></ul>
10024
10025 !!end
10026
10027 !!test
10028 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
10029 !! wikitext
10030 *a
10031 <!--This line will NOT split the list-->
10032 *b
10033 <!--This line will NOT split the list either-->
10034 *c
10035 <!--foo--> <!----> <!--This line NOT split the list
10036 either-->
10037 *d
10038 !! html
10039 <ul><li>a</li>
10040 <li>b</li>
10041 <li>c</li>
10042 <li>d</li></ul>
10043
10044 !!end
10045
10046 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
10047 # That pass could possibly be removed.
10048 !!test
10049 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
10050 !!options
10051 parsoid=wt2html,wt2wt
10052 !! wikitext
10053 *foo
10054 *<li>li-hack
10055 *{{echo|<li>templated li-hack}}
10056 *<!--foo--><li> unsupported li-hack with preceding comments
10057
10058 <ul>
10059 <li><li>not a li-hack
10060 </li>
10061 </ul>
10062 !! html+tidy
10063 <ul><li>foo</li>
10064 <li class="mw-empty-elt"></li><li>li-hack</li>
10065 <li class="mw-empty-elt"></li><li>templated li-hack</li>
10066 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
10067 <ul>
10068 <li class="mw-empty-elt"></li><li>not a li-hack
10069 </li>
10070 </ul>
10071 !! html/parsoid
10072 <ul><li> foo</li>
10073 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
10074 <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>
10075 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
10076
10077 <ul data-parsoid='{"stx":"html"}'>
10078 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
10079 </li>
10080 </ul>
10081
10082 !!end
10083
10084 !! test
10085 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
10086 !! options
10087 parsoid
10088 !! wikitext
10089 #foo
10090 ##bar
10091
10092 *foo
10093 **bar
10094
10095 :foo
10096 ::bar
10097 !! html
10098 <ol>
10099 <li>foo<ol>
10100 <li>bar</li>
10101 </ol></li>
10102 </ol><ul>
10103 <li>foo<ul>
10104 <li>bar</li>
10105 </ul></li>
10106 </ul><dl>
10107 <dd>foo<dl>
10108 <dd>bar</dd>
10109 </dl></dd>
10110 </dl>
10111 !! end
10112
10113 !! test
10114 Parsoid: Test of whitespace serialization with Templated bullets
10115 !! options
10116 parsoid=wt2html
10117 !! wikitext
10118 * {{bullet}}
10119 !! html/parsoid
10120 <ul>
10121 <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>
10122 </ul>
10123 !! end
10124
10125 # ------------------------------------------------------------------------
10126 # The next set of tests are about Parsoid's ability to handle badly nested
10127 # tags (parse, minimize scope of fixup, and roundtrip back)
10128 # ------------------------------------------------------------------------
10129
10130 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
10131 # Parsoid's list handling is more aware of block structure.
10132 !! test
10133 Unbalanced closing block tags break a list
10134 !! wikitext
10135 <div>
10136 *a</div><div>
10137 *b</div>
10138 !! html+tidy
10139 <div>
10140 <ul><li>a</li></ul></div><div>
10141 <li>b</li></div>
10142 !! html/parsoid
10143 <div><ul>
10144 <li>a</li>
10145 </ul></div>
10146 <div><ul>
10147 <li>b</li>
10148 </ul></div>
10149 !! end
10150
10151 !! test
10152 Unbalanced closing non-block tags don't break a list
10153 !! wikitext
10154 <span>
10155 *a</span><span>
10156 *b</span>
10157 !! html/php+tidy
10158 <p><span>
10159 </span></p>
10160 <ul><li>a<span></span></li>
10161 <li>b</li></ul>
10162 !! html/parsoid
10163 <span>
10164 <ul>
10165 <li>a<span></span></li>
10166 <li>b</li>
10167 </ul>
10168 </span>
10169 !! end
10170
10171 # Parsoid does some post-dom-building cleanup
10172 # which is why its output differs from Remex.
10173 !! test
10174 Unclosed formatting tags that straddle lists are closed and reopened
10175 !! options
10176 parsoid=wt2html,wt2wt,html2html
10177 !! wikitext
10178 #<s> a
10179 #b </s>
10180 !! html/php+tidy
10181 <ol><li><s> a</s></li><s>
10182 </s><li><s>b </s></li></ol>
10183 !! html/parsoid
10184 <ol><li><s> a</s></li>
10185 <li><s>b </s></li></ol>
10186 !! end
10187
10188 # Output is ugly because of all the misnested tag fixups.
10189 # Remex is wrapping p-tags around empty elements.
10190 # Parsoid has special-case handling of this pattern of
10191 # wrapping lists in formatting tags.
10192 # FIXME: Should we remove this code from Parsoid? Or add
10193 # special support in Remex? If the latter, maybe just wait
10194 # for Parsoid to become the default parser.
10195 # See T70395.
10196 !!test
10197 1. List embedded in a formatting tag
10198 !! wikitext
10199 <small>
10200 *foo
10201 </small>
10202 !! html/php+tidy
10203 <p><small>
10204 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10205 </p>
10206 !! html/parsoid
10207 <small>
10208 <ul>
10209 <li>foo</li>
10210 </ul>
10211 </small>
10212 !!end
10213
10214 # Output is ugly because of all the misnested tag fixups
10215 # Remex is wrapping p-tags around empty elements.
10216 # Parsoid has code that strips useless p-tags.
10217 !!test
10218 2. List embedded in a formatting tag in a misnested way
10219 !! wikitext
10220 <small>
10221 *a
10222 *b</small>
10223 !! html/php+tidy
10224 <p><small>
10225 </small></p><small></small><ul><small><li>a</li>
10226 </small><li><small>b</small></li></ul>
10227 !! html/parsoid
10228 <small></small>
10229 <ul><small>
10230 <li>a</li>
10231 </small>
10232 <li><small>b</small></li>
10233 </ul>
10234 !!end
10235
10236 ###
10237 ### Magic Words
10238 ###
10239
10240 # Note that the current date is hard-coded as
10241 # 1970-01-01T00:02:03Z (a Thursday)
10242 # when running parser tests. The timezone is also fixed to GMT, so
10243 # local date will be identical to current date.
10244
10245 !! test
10246 Magic Word: {{CURRENTDAY}}
10247 !! wikitext
10248 {{CURRENTDAY}}
10249 !! html
10250 <p>1
10251 </p>
10252 !! end
10253
10254 !! test
10255 Magic Word: {{CURRENTDAY2}}
10256 !! wikitext
10257 {{CURRENTDAY2}}
10258 !! html
10259 <p>01
10260 </p>
10261 !! end
10262
10263 !! test
10264 Magic Word: {{CURRENTDAYNAME}}
10265 !! wikitext
10266 {{CURRENTDAYNAME}}
10267 !! html
10268 <p>Thursday
10269 </p>
10270 !! end
10271
10272 !! test
10273 Magic Word: {{CURRENTDOW}}
10274 !! wikitext
10275 {{CURRENTDOW}}
10276 !! html
10277 <p>4
10278 </p>
10279 !! end
10280
10281 !! test
10282 Magic Word: {{CURRENTMONTH}}
10283 !! wikitext
10284 {{CURRENTMONTH}}
10285 !! html
10286 <p>01
10287 </p>
10288 !! end
10289
10290 !! test
10291 Magic Word: {{CURRENTMONTH1}}
10292 !! wikitext
10293 {{CURRENTMONTH1}}
10294 !! html
10295 <p>1
10296 </p>
10297 !! end
10298
10299 !! test
10300 Magic Word: {{CURRENTMONTHABBREV}}
10301 !! wikitext
10302 {{CURRENTMONTHABBREV}}
10303 !! html
10304 <p>Jan
10305 </p>
10306 !! end
10307
10308 !! test
10309 Magic Word: {{CURRENTMONTHNAME}}
10310 !! wikitext
10311 {{CURRENTMONTHNAME}}
10312 !! html
10313 <p>January
10314 </p>
10315 !! end
10316
10317 !! test
10318 Magic Word: {{CURRENTMONTHNAMEGEN}}
10319 !! wikitext
10320 {{CURRENTMONTHNAMEGEN}}
10321 !! html
10322 <p>January
10323 </p>
10324 !! end
10325
10326 !! test
10327 Magic Word: {{CURRENTTIME}}
10328 !! wikitext
10329 {{CURRENTTIME}}
10330 !! html
10331 <p>00:02
10332 </p>
10333 !! end
10334
10335 !! test
10336 Magic Word: {{CURRENTHOUR}}
10337 !! wikitext
10338 {{CURRENTHOUR}}
10339 !! html
10340 <p>00
10341 </p>
10342 !! end
10343
10344 !! test
10345 Magic Word: {{CURRENTWEEK}} (T6594)
10346 !! wikitext
10347 {{CURRENTWEEK}}
10348 !! html
10349 <p>1
10350 </p>
10351 !! end
10352
10353 !! test
10354 Magic Word: {{CURRENTYEAR}}
10355 !! wikitext
10356 {{CURRENTYEAR}}
10357 !! html
10358 <p>1970
10359 </p>
10360 !! end
10361
10362 !! test
10363 Magic Word: {{CURRENTTIMESTAMP}}
10364 !! wikitext
10365 {{CURRENTTIMESTAMP}}
10366 !! html
10367 <p>19700101000203
10368 </p>
10369 !! end
10370
10371 !! test
10372 Magic Words LOCAL (UTC)
10373 !! wikitext
10374 *{{LOCALMONTH}}
10375 *{{LOCALMONTH1}}
10376 *{{LOCALMONTHNAME}}
10377 *{{LOCALMONTHNAMEGEN}}
10378 *{{LOCALMONTHABBREV}}
10379 *{{LOCALDAY}}
10380 *{{LOCALDAY2}}
10381 *{{LOCALDAYNAME}}
10382 *{{LOCALYEAR}}
10383 *{{LOCALTIME}}
10384 *{{LOCALHOUR}}
10385 *{{LOCALWEEK}}
10386 *{{LOCALDOW}}
10387 *{{LOCALTIMESTAMP}}
10388 !! html
10389 <ul><li>01</li>
10390 <li>1</li>
10391 <li>January</li>
10392 <li>January</li>
10393 <li>Jan</li>
10394 <li>1</li>
10395 <li>01</li>
10396 <li>Thursday</li>
10397 <li>1970</li>
10398 <li>00:02</li>
10399 <li>00</li>
10400 <li>1</li>
10401 <li>4</li>
10402 <li>19700101000203</li></ul>
10403
10404 !! end
10405
10406 !! test
10407 Magic Word: {{FULLPAGENAME}}
10408 !! options
10409 title=[[User:Ævar Arnfjörð Bjarmason]]
10410 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10411 !! wikitext
10412 {{FULLPAGENAME}}
10413 !! html/*
10414 <p>User:Ævar Arnfjörð Bjarmason
10415 </p>
10416 !! end
10417
10418 !! test
10419 Magic Word: {{FULLPAGENAMEE}}
10420 !! options
10421 title=[[User:Ævar Arnfjörð Bjarmason]]
10422 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10423 !! wikitext
10424 {{FULLPAGENAMEE}}
10425 !! html/*
10426 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10427 </p>
10428 !! end
10429
10430 !! test
10431 Magic Word: {{TALKSPACE}}
10432 !! options
10433 title=[[User:Ævar Arnfjörð Bjarmason]]
10434 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10435 !! wikitext
10436 {{TALKSPACE}}
10437 !! html/*
10438 <p>User talk
10439 </p>
10440 !! end
10441
10442 !! test
10443 Magic Word: {{TALKSPACE}}, same namespace
10444 !! options
10445 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10446 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10447 !! wikitext
10448 {{TALKSPACE}}
10449 !! html/*
10450 <p>User talk
10451 </p>
10452 !! end
10453
10454 !! test
10455 Magic Word: {{TALKSPACE}}, main namespace
10456 !! options
10457 title=[[Parser Test]]
10458 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10459 !! wikitext
10460 {{TALKSPACE}}
10461 !! html/*
10462 <p>Talk
10463 </p>
10464 !! end
10465
10466 !! test
10467 Magic Word: {{TALKSPACEE}}
10468 !! options
10469 title=[[User:Ævar Arnfjörð Bjarmason]]
10470 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10471 !! wikitext
10472 {{TALKSPACEE}}
10473 !! html/*
10474 <p>User_talk
10475 </p>
10476 !! end
10477
10478 !! test
10479 Magic Word: {{SUBJECTSPACE}}
10480 !! options
10481 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10482 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10483 !! wikitext
10484 {{SUBJECTSPACE}}
10485 !! html/*
10486 <p>User
10487 </p>
10488 !! end
10489
10490 !! test
10491 Magic Word: {{SUBJECTSPACE}}, same namespace
10492 !! options
10493 title=[[User:Ævar Arnfjörð Bjarmason]]
10494 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10495 !! wikitext
10496 {{SUBJECTSPACE}}
10497 !! html/*
10498 <p>User
10499 </p>
10500 !! end
10501
10502 !! test
10503 Magic Word: {{SUBJECTSPACE}}, main namespace
10504 !! options
10505 title=[[Parser Test]]
10506 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10507 !! wikitext
10508 {{SUBJECTSPACE}}
10509 !! html/*
10510
10511 !! end
10512
10513 !! test
10514 Magic Word: {{SUBJECTSPACEE}}
10515 !! options
10516 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10517 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10518 !! wikitext
10519 {{SUBJECTSPACEE}}
10520 !! html/*
10521 <p>User
10522 </p>
10523 !! end
10524
10525 !! test
10526 Magic Word: {{NAMESPACE}}
10527 !! options
10528 title=[[User:Ævar Arnfjörð Bjarmason]]
10529 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10530 !! wikitext
10531 {{NAMESPACE}}
10532 !! html/*
10533 <p>User
10534 </p>
10535 !! end
10536
10537 !! test
10538 Magic Word: {{NAMESPACEE}}
10539 !! options
10540 title=[[User:Ævar Arnfjörð Bjarmason]]
10541 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10542 !! wikitext
10543 {{NAMESPACEE}}
10544 !! html/*
10545 <p>User
10546 </p>
10547 !! end
10548
10549 !! test
10550 Magic Word: {{NAMESPACENUMBER}}
10551 !! options
10552 title=[[User:Ævar Arnfjörð Bjarmason]]
10553 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10554 !! wikitext
10555 {{NAMESPACENUMBER}}
10556 !! html/*
10557 <p>2
10558 </p>
10559 !! end
10560
10561 !! test
10562 Magic Word: {{SUBPAGENAME}}
10563 !! options
10564 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10565 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10566 !! wikitext
10567 {{SUBPAGENAME}}
10568 !! html/*
10569 <p>sub ö
10570 </p>
10571 !! end
10572
10573 !! test
10574 Magic Word: {{SUBPAGENAMEE}}
10575 !! options
10576 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10577 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10578 !! wikitext
10579 {{SUBPAGENAMEE}}
10580 !! html/*
10581 <p>sub_%C3%B6
10582 </p>
10583 !! end
10584
10585 !! test
10586 Magic Word: {{ROOTPAGENAME}}
10587 !! options
10588 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10589 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10590 !! wikitext
10591 {{ROOTPAGENAME}}
10592 !! html/*
10593 <p>Ævar Arnfjörð Bjarmason
10594 </p>
10595 !! end
10596
10597 !! test
10598 Magic Word: {{ROOTPAGENAMEE}}
10599 !! options
10600 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10601 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10602 !! wikitext
10603 {{ROOTPAGENAMEE}}
10604 !! html/*
10605 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10606 </p>
10607 !! end
10608
10609 !! test
10610 Magic Word: {{BASEPAGENAME}}
10611 !! options
10612 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10613 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10614 !! wikitext
10615 {{BASEPAGENAME}}
10616 !! html/*
10617 <p>Ævar Arnfjörð Bjarmason
10618 </p>
10619 !! end
10620
10621 !! test
10622 Magic Word: {{BASEPAGENAMEE}}
10623 !! options
10624 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10625 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10626 !! wikitext
10627 {{BASEPAGENAMEE}}
10628 !! html/*
10629 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10630 </p>
10631 !! end
10632
10633 !! test
10634 Magic Word: {{TALKPAGENAME}}
10635 !! options
10636 title=[[User:Ævar Arnfjörð Bjarmason]]
10637 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10638 !! wikitext
10639 {{TALKPAGENAME}}
10640 !! html/*
10641 <p>User talk:Ævar Arnfjörð Bjarmason
10642 </p>
10643 !! end
10644
10645 !! test
10646 Magic Word: {{TALKPAGENAMEE}}
10647 !! options
10648 title=[[User:Ævar Arnfjörð Bjarmason]]
10649 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10650 !! wikitext
10651 {{TALKPAGENAMEE}}
10652 !! html/*
10653 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10654 </p>
10655 !! end
10656
10657 !! test
10658 Magic Word: {{SUBJECTPAGENAME}}
10659 !! options
10660 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10661 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10662 !! wikitext
10663 {{SUBJECTPAGENAME}}
10664 !! html/*
10665 <p>User:Ævar Arnfjörð Bjarmason
10666 </p>
10667 !! end
10668
10669 !! test
10670 Magic Word: {{SUBJECTPAGENAMEE}}
10671 !! options
10672 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10673 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10674 !! wikitext
10675 {{SUBJECTPAGENAMEE}}
10676 !! html/*
10677 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10678 </p>
10679 !! end
10680
10681 !! test
10682 Magic Word: {{NUMBEROFFILES}}
10683 !! options
10684 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10685 !! wikitext
10686 {{NUMBEROFFILES}}
10687 !! html/*
10688 <p>7
10689 </p>
10690 !! end
10691
10692 !! test
10693 Magic Word: {{PAGENAME}}
10694 !! options
10695 title=[[User:Ævar Arnfjörð Bjarmason]]
10696 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10697 !! wikitext
10698 {{PAGENAME}}
10699 !! html/*
10700 <p>Ævar Arnfjörð Bjarmason
10701 </p>
10702 !! end
10703
10704 !! test
10705 Magic Word: {{PAGENAME}} with metacharacters
10706 !! options
10707 title=[['foo & bar = baz']]
10708 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10709 !! wikitext
10710 ''{{PAGENAME}}''
10711 !! html+tidy
10712 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10713 </p>
10714 !! end
10715
10716 !! test
10717 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10718 !! options
10719 title=[[*RFC 1234 http://example.com/]]
10720 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10721 !! wikitext
10722 {{PAGENAME}}
10723 !! html+tidy
10724 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10725 </p>
10726 !! end
10727
10728 !! test
10729 Magic Word: {{PAGENAMEE}}
10730 !! options
10731 title=[[User:Ævar Arnfjörð Bjarmason]]
10732 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10733 !! wikitext
10734 {{PAGENAMEE}}
10735 !! html/*
10736 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10737 </p>
10738 !! end
10739
10740 !! test
10741 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10742 !! options
10743 title=[[*RFC 1234 http://example.com/]]
10744 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10745 !! wikitext
10746 {{PAGENAMEE}}
10747 !! html+tidy
10748 <p>&#42;RFC_1234_http&#58;//example.com/
10749 </p>
10750 !! end
10751
10752 !! test
10753 Magic Word: {{REVISIONID}}
10754 !! options
10755 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10756 showflags
10757 !! wikitext
10758 {{REVISIONID}}
10759 !! html/*
10760 <p>1337
10761 </p>
10762 flags=vary-revision-id
10763 !! end
10764
10765 !! test
10766 Magic Word: {{SCRIPTPATH}}
10767 !! options
10768 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10769 !! wikitext
10770 {{SCRIPTPATH}}
10771 !! html/*
10772
10773 !! end
10774
10775 !! test
10776 Magic Word: {{STYLEPATH}}
10777 !! options
10778 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10779 !! wikitext
10780 {{STYLEPATH}}
10781 !! html/*
10782 <p>/skins
10783 </p>
10784 !! end
10785
10786 !! test
10787 Magic Word: {{SERVER}}
10788 !! options
10789 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10790 !! wikitext
10791 {{SERVER}}
10792 !! html/*
10793 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10794 </p>
10795 !! end
10796
10797 !! test
10798 Magic Word: {{SERVERNAME}}
10799 !! options
10800 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10801 !! wikitext
10802 {{SERVERNAME}}
10803 !! html/*
10804 <p>example.org
10805 </p>
10806 !! end
10807
10808 !! test
10809 Magic Word: {{SITENAME}}
10810 !! options
10811 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10812 !! wikitext
10813 {{SITENAME}}
10814 !! html/*
10815 <p>MediaWiki
10816 </p>
10817 !! end
10818
10819 !! test
10820 Magic Word: {{PAGELANGUAGE}}
10821 !! options
10822 language=fr
10823 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10824 !! wikitext
10825 {{PAGELANGUAGE}}
10826 !! html/*
10827 <p>fr
10828 </p>
10829 !! end
10830
10831 !! test
10832 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10833 !! options
10834 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10835 !! wikitext
10836 {{PAGELANGUAGE}}
10837 !! html/*
10838 <p>en
10839 </p>
10840 !! end
10841
10842 !! test
10843 Case-sensitive magic words, when cased differently, should just be template transclusions
10844 !! wikitext
10845 {{CurrentMonth}}
10846 {{currentday}}
10847 {{cURreNTweEK}}
10848 {{currentHour}}
10849 !! html
10850 <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>
10851 <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>
10852 <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>
10853 <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>
10854 </p>
10855 !! end
10856
10857 !! test
10858 Case-insensitive magic words should still work with weird casing.
10859 !! wikitext
10860 {{sErVeRNaMe}}
10861 {{LCFirst:AOEU}}
10862 {{ucFIRST:aoeu}}
10863 {{SERver}}
10864 !! html
10865 <p>example.org
10866 aOEU
10867 Aoeu
10868 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10869 </p>
10870 !! end
10871
10872 # From plwiki:PLOS_ONE
10873 !! test
10874 Parsoid: Page property magic word with magic word contents
10875 !! wikitext
10876 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10877 !! html/parsoid
10878 <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>"}]]}'/>
10879 !! end
10880
10881 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10882 # But, this is a limitation of our representation and is documented in
10883 # TemplateHandler.js in processSpecialMagicWord
10884 !! test
10885 Parsoid: Template-generated DISPLAYTITLE
10886 !! wikitext
10887 {{{{echo|DISPLAYTITLE}}:Foo}}
10888 !! options
10889 showtitle
10890 !! config
10891 wgAllowDisplayTitle=true
10892 wgRestrictDisplayTitle=false
10893 !! html/php
10894 Foo
10895
10896 !! html/parsoid
10897 <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"}]]}'/>
10898 !! end
10899
10900 !! test
10901 Namespace 1 {{ns:1}}
10902 !! wikitext
10903 {{ns:1}}
10904 !! html
10905 <p>Talk
10906 </p>
10907 !! end
10908
10909 !! test
10910 Namespace 1 {{ns:01}}
10911 !! wikitext
10912 {{ns:01}}
10913 !! html
10914 <p>Talk
10915 </p>
10916 !! end
10917
10918 !! test
10919 Namespace 0 {{ns:0}} (T6783)
10920 !! wikitext
10921 {{ns:0}}
10922 !! html
10923
10924 !! end
10925
10926 !! test
10927 Namespace 0 {{ns:00}} (T6783)
10928 !! wikitext
10929 {{ns:00}}
10930 !! html
10931
10932 !! end
10933
10934 !! test
10935 Namespace -1 {{ns:-1}}
10936 !! wikitext
10937 {{ns:-1}}
10938 !! html
10939 <p>Special
10940 </p>
10941 !! end
10942
10943 !! test
10944 Namespace User {{ns:User}}
10945 !! wikitext
10946 {{ns:User}}
10947 !! html
10948 <p>User
10949 </p>
10950 !! end
10951
10952 !! test
10953 Namespace User talk {{ns:User_talk}}
10954 !! wikitext
10955 {{ns:User_talk}}
10956 !! html
10957 <p>User talk
10958 </p>
10959 !! end
10960
10961 !! test
10962 Namespace User talk {{ns:uSeR tAlK}}
10963 !! wikitext
10964 {{ns:uSeR tAlK}}
10965 !! html
10966 <p>User talk
10967 </p>
10968 !! end
10969
10970 !! test
10971 Namespace File {{ns:File}}
10972 !! wikitext
10973 {{ns:File}}
10974 !! html
10975 <p>File
10976 </p>
10977 !! end
10978
10979 !! test
10980 Namespace File {{ns:Image}}
10981 !! wikitext
10982 {{ns:Image}}
10983 !! html
10984 <p>File
10985 </p>
10986 !! end
10987
10988 !! test
10989 Namespace (lang=de) Benutzer {{ns:User}}
10990 !! options
10991 language=de
10992 !! wikitext
10993 {{ns:User}}
10994 !! html
10995 <p>Benutzer
10996 </p>
10997 !! end
10998
10999 !! test
11000 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
11001 !! options
11002 language=de
11003 !! wikitext
11004 {{ns:3}}
11005 !! html
11006 <p>Benutzer Diskussion
11007 </p>
11008 !! end
11009
11010 !! test
11011 Urlencode
11012 !! wikitext
11013 {{urlencode:hi world?!}}
11014 {{urlencode:hi world?!|WIKI}}
11015 {{urlencode:hi world?!|PATH}}
11016 {{urlencode:hi world?!|QUERY}}
11017 !! html/php
11018 <p>hi+world%3F%21
11019 hi_world%3F!
11020 hi%20world%3F%21
11021 hi+world%3F%21
11022 </p>
11023 !! end
11024
11025 !! test
11026 Magic Word: prioritize type info over data-parsoid
11027 !! options
11028 parsoid=html2wt
11029 !! html/parsoid
11030 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
11031 !! wikitext
11032 __FORCETOC__
11033 !! end
11034
11035 !! test
11036 Magic Word: serialize on separate line (parsoid)
11037 !! options
11038 parsoid=wt2wt,html2wt
11039 !! wikitext
11040 foo
11041 __NOTOC__
11042 bar
11043 !! html/parsoid
11044 foo<meta property="mw:PageProp/notoc"/>bar
11045 !! end
11046
11047 !! test
11048 Magic Word: rt non-english wikis
11049 !! options
11050 parsoid=wt2wt
11051 language=de
11052 !! wikitext
11053 __NOEDITSECTION__
11054 !! html/parsoid
11055 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
11056 !! end
11057
11058 !!test
11059 __proto__ is treated as normal wikitext (T105997)
11060 !!wikitext
11061 __proto__
11062 !!html
11063 <p>__proto__
11064 </p>
11065 !!end
11066
11067 ###
11068 ### Magic links
11069 ###
11070 !! test
11071 Magic links: internal link to RFC (T2479)
11072 !! wikitext
11073 [[RFC 123]]
11074 !! html/php
11075 <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>
11076 </p>
11077 !! html/parsoid
11078 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
11079 !! end
11080
11081 !! test
11082 Magic links: RFC (T2479)
11083 !! wikitext
11084 RFC 822
11085 !! html/php
11086 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11087 </p>
11088 !! html/parsoid
11089 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
11090 !! end
11091
11092 !! test
11093 Magic links: RFC (T67278)
11094 !! wikitext
11095 This is RFC 822 but thisRFC 822 is not RFC 822linked.
11096 !! html/php
11097 <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.
11098 </p>
11099 !! html/parsoid
11100 <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>
11101 !! end
11102
11103 !! test
11104 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
11105 !! wikitext
11106 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
11107 RFC
11108 822
11109 !! html/php
11110 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11111 RFC
11112 822
11113 </p>
11114 !! html/parsoid
11115 <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>
11116 RFC
11117 822</p>
11118 !! end
11119
11120 !! test
11121 Magic links: ISBN (T3937)
11122 !! wikitext
11123 ISBN 0-306-40615-2
11124 !! html/php
11125 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
11126 </p>
11127 !! html/parsoid
11128 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
11129 !! end
11130
11131 !! test
11132 Magic links: ISBN (T67278)
11133 !! wikitext
11134 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11135 !! html/php
11136 <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.
11137 </p>
11138 !! html/parsoid
11139 <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>
11140 !! end
11141
11142 !! test
11143 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
11144 !! wikitext
11145 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
11146 ISBN
11147 9780316098113
11148 ISBN 978
11149 0316098113
11150 !! html/php
11151 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11152 ISBN
11153 9780316098113
11154 ISBN 978
11155 0316098113
11156 </p>
11157 !! html/parsoid
11158 <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>
11159 ISBN
11160 9780316098113
11161 ISBN 978
11162 0316098113</p>
11163 !! end
11164
11165 !! test
11166 Magic links: PMID incorrectly converts space to underscore
11167 !! wikitext
11168 PMID 1234
11169 !! html/php
11170 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11171 </p>
11172 !! html/parsoid
11173 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
11174 !! end
11175
11176 !! test
11177 Magic links: PMID (T67278)
11178 !! wikitext
11179 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11180 !! html/php
11181 <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.
11182 </p>
11183 !! html/parsoid
11184 <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>
11185 !! end
11186
11187 !! test
11188 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11189 !! wikitext
11190 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11191 PMID
11192 1234
11193 !! html/php
11194 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11195 PMID
11196 1234
11197 </p>
11198 !! html/parsoid
11199 <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>
11200 PMID
11201 1234</p>
11202 !! end
11203
11204 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11205 # since these are ExtLinkText, not MagicLinkText
11206 !! test
11207 Magic links: use appropriate serialization for "almost" magic links.
11208 !! wikitext
11209 X[[Special:BookSources/0978739256|foo]]
11210
11211 X[https://tools.ietf.org/html/rfc1234 foo]
11212 !! html/php
11213 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11214 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11215 </p>
11216 !! html/parsoid
11217 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11218 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11219 !! end
11220
11221 !! test
11222 Magic links: All disabled (T47942)
11223 !! options
11224 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11225 !! wikitext
11226 ISBN 0-306-40615-2
11227 PMID 1234
11228 RFC 4321
11229 !! html/php
11230 <p>ISBN 0-306-40615-2
11231 PMID 1234
11232 RFC 4321
11233 </p>
11234 !! end
11235
11236 ###
11237 ### Templates
11238 ####
11239
11240 !! test
11241 Nonexistent template
11242 !! wikitext
11243 {{thistemplatedoesnotexist}}
11244 !! html
11245 <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>
11246 </p>
11247 !! end
11248
11249 !! test
11250 Template with invalid target containing tags
11251 !! wikitext
11252 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11253 !! html
11254 <p>{{a<b>b</b>|foo|a=b|a = b}}
11255 </p>
11256 !! end
11257
11258 !! test
11259 Template with invalid target containing unclosed tag
11260 !! wikitext
11261 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11262 !! html
11263 <p>{{a<b>|foo|a=b|a = b}}</b>
11264 </p>
11265 !! end
11266
11267 !! test
11268 Template with invalid target containing wikilink
11269 !! wikitext
11270 {{[[Main Page]]}}
11271 !! html/php
11272 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11273 </p>
11274 !! html/parsoid
11275 <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>
11276 !! end
11277
11278 !! test
11279 Template with just whitespace in it, T70421
11280 !! wikitext
11281 {{echo|{{ }}}}
11282 !! html/parsoid
11283 <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>
11284 !! end
11285
11286 !! article
11287 Template:test
11288 !! text
11289 This is a test template
11290 !! endarticle
11291
11292 !! test
11293 Simple template
11294 !! wikitext
11295 {{test}}
11296 !! html
11297 <p>This is a test template
11298 </p>
11299 !! end
11300
11301 !! test
11302 Template with explicit namespace
11303 !! wikitext
11304 {{Template:test}}
11305 !! html
11306 <p>This is a test template
11307 </p>
11308 !! end
11309
11310
11311 !! article
11312 Template:paramtest
11313 !! text
11314 This is a test template with parameter {{{param}}}
11315 !! endarticle
11316
11317 !! test
11318 Template parameter
11319 !! wikitext
11320 {{paramtest|param=foo}}
11321 !! html
11322 <p>This is a test template with parameter foo
11323 </p>
11324 !! end
11325
11326 !! article
11327 Template:paramtestnum
11328 !! text
11329 [[{{{1}}}|{{{2}}}]]
11330 !! endarticle
11331
11332 !! test
11333 Template unnamed parameter
11334 !! wikitext
11335 {{paramtestnum|Main Page|the main page}}
11336 !! html
11337 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11338 </p>
11339 !! end
11340
11341 !! article
11342 Template:templatesimple
11343 !! text
11344 (test)
11345 !! endarticle
11346
11347 !! article
11348 Template:templateredirect
11349 !! text
11350 #redirect [[Template:templatesimple]]
11351 !! endarticle
11352
11353 !! article
11354 Template:templateasargtestnum
11355 !! text
11356 {{{{{1}}}}}
11357 !! endarticle
11358
11359 !! article
11360 Template:templateasargtest
11361 !! text
11362 {{template{{{templ}}}}}
11363 !! endarticle
11364
11365 !! article
11366 Template:templateasargtest2
11367 !! text
11368 {{{{{templ}}}}}
11369 !! endarticle
11370
11371 !! test
11372 Template with template name as unnamed argument
11373 !! wikitext
11374 {{templateasargtestnum|templatesimple}}
11375 !! html
11376 <p>(test)
11377 </p>
11378 !! end
11379
11380 !! test
11381 Template with template name as argument
11382 !! wikitext
11383 {{templateasargtest|templ=simple}}
11384 !! html
11385 <p>(test)
11386 </p>
11387 !! end
11388
11389 !! test
11390 Template with template name as argument (2)
11391 !! wikitext
11392 {{templateasargtest2|templ=templatesimple}}
11393 !! html
11394 <p>(test)
11395 </p>
11396 !! end
11397
11398 !! article
11399 Template:templateasargtestdefault
11400 !! text
11401 {{{{{templ|templatesimple}}}}}
11402 !! endarticle
11403
11404 !! article
11405 Template:templa
11406 !! text
11407 '''templ'''
11408 !! endarticle
11409
11410 !! test
11411 Template with default value
11412 !! wikitext
11413 {{templateasargtestdefault}}
11414 !! html
11415 <p>(test)
11416 </p>
11417 !! end
11418
11419 !! test
11420 Template with default value (value set)
11421 !! wikitext
11422 {{templateasargtestdefault|templ=templa}}
11423 !! html
11424 <p><b>templ</b>
11425 </p>
11426 !! end
11427
11428 !! test
11429 Template redirect
11430 !! wikitext
11431 {{templateredirect}}
11432 !! html/php
11433 <p>(test)
11434 </p>
11435 !! html/parsoid
11436 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11437 !! end
11438
11439 !! test
11440 Template with argument in separate line
11441 !! wikitext
11442 {{ templateasargtest |
11443 templ = simple }}
11444 !! html
11445 <p>(test)
11446 </p>
11447 !! end
11448
11449 !! test
11450 Template with complex template as argument
11451 !! wikitext
11452 {{paramtest|
11453 param ={{ templateasargtest |
11454 templ = simple }}}}
11455 !! html
11456 <p>This is a test template with parameter (test)
11457 </p>
11458 !! end
11459
11460 !! test
11461 Templates with templated name
11462 !! wikitext
11463 {{{{echo|echo}}|foo}}
11464 {{{{echo|inner list}} }}
11465 !! html
11466 <p>foo
11467 </p>
11468 <ul><li>item 1</li></ul>
11469
11470 !! html/parsoid
11471 <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>
11472 <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>
11473 !! end
11474
11475 ## Regression test; the output here isn't really that interesting.
11476 !! test
11477 Templates with templated name and top level template args
11478 !! wikitext
11479 {{1{{2{{{3}}}|4=5}}}}
11480 !! html/parsoid
11481 <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>
11482 !! end
11483
11484 # Parsoid markup is deliberate "broken". This is an edge case.
11485 # See long comment in TemplateHandler.js:convertAttribsToString.
11486 !! test
11487 Templates with invalid templated targets
11488 !! wikitext
11489 {{echo
11490 {{echo|foo}}
11491 }}
11492 !! html/php
11493 <p>{{echo
11494 foo
11495 }}
11496 </p>
11497 !! html/parsoid
11498 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11499 foo }}</p>
11500 !! end
11501
11502 !! test
11503 Template with thumb image (with link in description)
11504 !! wikitext
11505 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11506 !! html/php
11507 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>
11508
11509 !! html+tidy
11510 <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>
11511 !! html/parsoid
11512 <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>
11513 !! end
11514
11515 !! article
11516 Template:complextemplate
11517 !! text
11518 {{{1}}} {{paramtest|
11519 param ={{{param}}}}}
11520 !! endarticle
11521
11522 !! test
11523 Template with complex arguments
11524 !! wikitext
11525 {{complextemplate|
11526 param ={{ templateasargtest |
11527 templ = simple }}|[[Template:complextemplate|link]]}}
11528 !! html
11529 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11530 </p>
11531 !! end
11532
11533 !! test
11534 T2553: link with two variables in a piped link
11535 !! wikitext
11536 {|
11537 |[[{{{1}}}|{{{2}}}]]
11538 |}
11539 !! html/php
11540 <table>
11541 <tr>
11542 <td>[[{{{1}}}|{{{2}}}]]
11543 </td></tr></table>
11544
11545 !! html/parsoid
11546 <table>
11547 <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>
11548 </tbody></table>
11549 !! end
11550
11551 # See: T2553
11552 !! test
11553 Abort table cell attribute parsing on wikilink
11554 !! wikitext
11555 {|
11556 |testing [[one|two]] |three||four
11557 |testing one two |three||four
11558 |testing="[[one|two]]" |three||four
11559 |}
11560 !! html/php
11561 <table>
11562 <tr>
11563 <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>
11564 <td>four
11565 </td>
11566 <td>three</td>
11567 <td>four
11568 </td>
11569 <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>
11570 <td>four
11571 </td></tr></table>
11572
11573 !! html/parsoid
11574 <table>
11575 <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>
11576 <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>
11577 <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>
11578 </tbody></table>
11579 !! end
11580
11581 !! test
11582 Don't abort table cell attribute parsing if wikilink is found in template arg
11583 !! wikitext
11584 {|
11585 |Test {{#tag:ref|One two "[[three]]" four}}
11586 |}
11587 !! html/parsoid
11588 <table>
11589 <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>
11590 </tbody></table>
11591 !! end
11592
11593 !! test
11594 Magic variable as template parameter
11595 !! wikitext
11596 {{paramtest|param={{SITENAME}}}}
11597 !! html
11598 <p>This is a test template with parameter MediaWiki
11599 </p>
11600 !! end
11601
11602 !! article
11603 Template:linktest
11604 !! text
11605 [[{{{param}}}|link]]
11606 !! endarticle
11607
11608 !! test
11609 Template parameter as link source
11610 !! wikitext
11611 {{linktest|param=Main Page}}
11612 !! html
11613 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11614 </p>
11615 !! end
11616
11617 !!article
11618 Template:paramtest2
11619 !! text
11620 including another template, {{paramtest|param={{{arg}}}}}
11621 !! endarticle
11622
11623 !! test
11624 Template passing argument to another template
11625 !! wikitext
11626 {{paramtest2|arg='hmm'}}
11627 !! html
11628 <p>including another template, This is a test template with parameter 'hmm'
11629 </p>
11630 !! end
11631
11632 !! article
11633 Template:Linktest2
11634 !! text
11635 Main Page
11636 !! endarticle
11637
11638 !! test
11639 Template as link source
11640 !! wikitext
11641 [[{{linktest2}}]]
11642
11643 [[{{linktest2}}|Main Page]]
11644
11645 [[{{linktest2}}]]Page
11646 !! html
11647 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11648 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11649 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11650 </p>
11651 !! end
11652
11653
11654 !! article
11655 Template:loop1
11656 !! text
11657 {{loop2}}
11658 !! endarticle
11659
11660 !! article
11661 Template:loop2
11662 !! text
11663 {{loop1}}
11664 !! endarticle
11665
11666 !! test
11667 Template infinite loop
11668 !! wikitext
11669 {{loop1}}
11670 !! html
11671 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11672 </p>
11673 !! end
11674
11675 !! test
11676 Template from main namespace
11677 !! wikitext
11678 {{:Main Page}}
11679 !! html
11680 <p>blah blah
11681 </p>
11682 !! end
11683
11684 !! test
11685 Template from non-includable namespace
11686 !! options
11687 wgNonincludableNamespaces=10
11688 !! wikitext
11689 {{echo|uh oh!}}
11690 !! html
11691 <p><a href="/wiki/Template:Echo" title="Template:Echo">Template:Echo</a>
11692 </p>
11693 !! end
11694
11695 !! article
11696 Template:table
11697 !! text
11698 {|
11699 | 1 || 2
11700 |-
11701 | 3 || 4
11702 |}
11703 !! endarticle
11704
11705 !! test
11706 T2529: Template with table, not included at beginning of line
11707 !! wikitext
11708 foo {{table}}
11709 !! html
11710 <p>foo
11711 </p>
11712 <table>
11713 <tr>
11714 <td>1</td>
11715 <td>2
11716 </td></tr>
11717 <tr>
11718 <td>3</td>
11719 <td>4
11720 </td></tr></table>
11721
11722 !! end
11723
11724 !! test
11725 T2523: Template shouldn't eat newline (or add an extra one before table)
11726 !! wikitext
11727 foo
11728 {{table}}
11729 !! html
11730 <p>foo
11731 </p>
11732 <table>
11733 <tr>
11734 <td>1</td>
11735 <td>2
11736 </td></tr>
11737 <tr>
11738 <td>3</td>
11739 <td>4
11740 </td></tr></table>
11741
11742 !! end
11743
11744 !! test
11745 T2041: Template parameters shown as broken links
11746 !! wikitext
11747 {{{parameter}}}
11748 !! html
11749 <p>{{{parameter}}}
11750 </p>
11751 !! end
11752
11753 !! test
11754 Template with targets containing wikilinks
11755 !! options
11756 parsoid=wt2html
11757 !! wikitext
11758 {{[[foo]]}}
11759
11760 {{[[{{echo|foo}}]]}}
11761
11762 {{{{echo|[[foo}}]]}}
11763 !! html/php
11764 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11765 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11766 </p><p>{{[[foo}}]]
11767 </p>
11768 !! html/parsoid
11769 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11770 <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>
11771 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11772 !! end
11773
11774 !! article
11775 Template:''
11776 !! text
11777 bar
11778 !! endarticle
11779
11780 !! test
11781 Templates: Double quotes as template target
11782 !! wikitext
11783 foo {{''}} baz
11784 !! html/php
11785 <p>foo bar baz
11786 </p>
11787 !! html/parsoid
11788 <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
11789 </p>
11790 !! end
11791
11792 ## This test is about making sure Parsoid's data-mw is well formed in the
11793 ## face of multiple templates with intersecting and overlapping ranges. The
11794 ## wikitext itself is wretched.
11795 !! test
11796 Templates with intersecting and overlapping ranges
11797 !! wikitext
11798 {|{{echo|
11799 <p>ha</p>}}
11800 {|{{echo|
11801 <p>ho</p>}}
11802 {{echo|{{!}}hi}}
11803 |}
11804 !! html/php+tidy
11805 <p>ha</p><table>
11806
11807 </table><p>ho</p><table>
11808
11809 <tbody><tr>
11810 <td>hi
11811 </td></tr></tbody></table>
11812 !! html/parsoid
11813 <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":""}]]}'>
11814
11815 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11816
11817 <tbody><tr><td>hi</td></tr>
11818 </tbody></table>
11819 !! end
11820
11821 !! article
11822 Template:MSGNW test
11823 !! text
11824 ''None'' of '''this''' should be
11825 * interpreted
11826 but rather passed unmodified
11827 {{test}}
11828 <gallery>
11829 File:Foobar.jpg
11830 </gallery>
11831 <!-- comment -->
11832 !! endarticle
11833
11834 # hmm, fix this or just deprecate msgnw and document its behavior?
11835 !! test
11836 msgnw keyword
11837 !! wikitext
11838 {{msgnw:MSGNW test}}
11839 !! html/php
11840 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11841 &#42; interpreted
11842 &#32;but rather passed unmodified
11843 &#123;&#123;test&#125;&#125;
11844 &#60;gallery&#62;
11845 File:Foobar.jpg
11846 &#60;/gallery&#62;
11847 &#60;!-- comment --&#62;
11848 </p>
11849 !! end
11850
11851 !! test
11852 int keyword
11853 !! wikitext
11854 {{int:youhavenewmessages|lots of money|not!}}
11855 !! html
11856 <p>You have lots of money (not!).
11857 </p>
11858 !! end
11859
11860 !! test
11861 int keyword - non-existing message
11862 !! wikitext
11863 {{int:var}}
11864 !! html
11865 <p>⧼var⧽
11866 </p>
11867 !! end
11868
11869 !! article
11870 Template:Includes
11871 !! text
11872 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11873 !! endarticle
11874
11875 !! test
11876 <includeonly> and <noinclude> being included
11877 !! wikitext
11878 {{Includes}}
11879 !! html
11880 <p>Foobar
11881 </p>
11882 !! end
11883
11884 !! article
11885 Template:Includes2
11886 !! text
11887 <onlyinclude>Foo</onlyinclude>bar
11888 !! endarticle
11889
11890 !! test
11891 <onlyinclude> being included
11892 !! wikitext
11893 {{Includes2}}
11894 !! html
11895 <p>Foo
11896 </p>
11897 !! end
11898
11899
11900 !! article
11901 Template:Includes3
11902 !! text
11903 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11904 !! endarticle
11905
11906 !! test
11907 <onlyinclude> and <includeonly> being included
11908 !! wikitext
11909 {{Includes3}}
11910 !! html
11911 <p>Foo
11912 </p>
11913 !! end
11914
11915 !! test
11916 <includeonly> and <noinclude> on a page
11917 !! wikitext
11918 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11919 !! html
11920 <p>Foozar
11921 </p>
11922 !! end
11923
11924 !! test
11925 Un-closed <noinclude>
11926 !! wikitext
11927 <noinclude>
11928 !! html
11929 !! end
11930
11931 !! test
11932 <onlyinclude> on a page
11933 !! wikitext
11934 <onlyinclude>Foo</onlyinclude>bar
11935 !! html
11936 <p>Foobar
11937 </p>
11938 !! end
11939
11940 !! test
11941 Un-closed <onlyinclude>
11942 !! wikitext
11943 <onlyinclude>
11944 !! html
11945 !! end
11946
11947 !!test
11948 Self-closed noinclude, includeonly, onlyinclude tags
11949 !! wikitext
11950 <noinclude />
11951 <includeonly />
11952 <onlyinclude />
11953 !! html
11954 <p><br />
11955 </p>
11956 !!end
11957
11958 !!test
11959 Unbalanced includeonly and noinclude tags
11960 !! wikitext
11961 {|
11962 |a</noinclude>
11963 |b</noinclude></noinclude>
11964 |c</noinclude></includeonly>
11965 |d</includeonly></includeonly>
11966 |}
11967 !! html
11968 <table>
11969 <tr>
11970 <td>a
11971 </td>
11972 <td>b
11973 </td>
11974 <td>c&lt;/includeonly&gt;
11975 </td>
11976 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11977 </td></tr></table>
11978
11979 !!end
11980
11981 !! article
11982 Template:Includeonly section
11983 !! text
11984 <includeonly>
11985 ==Includeonly section==
11986 </includeonly>
11987 ==Section T-1==
11988 !!endarticle
11989
11990 !! test
11991 T8563: Edit link generation for section shown by <includeonly>
11992 !! wikitext
11993 {{includeonly section}}
11994 !! html
11995 <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>
11996 <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>
11997
11998 !! end
11999
12000 # Uses same input as the contents of [[Template:Includeonly section]]
12001 !! test
12002 T8563: Section extraction for section shown by <includeonly>
12003 !! options
12004 section=T-2
12005 !! wikitext
12006 <includeonly>
12007 ==Includeonly section==
12008 </includeonly>
12009 ==Section T-2==
12010 !! html
12011 ==Section T-2==
12012 !! end
12013
12014 !! test
12015 T8563: Edit link generation for section suppressed by <includeonly>
12016 !! wikitext
12017 <includeonly>
12018 ==Includeonly section==
12019 </includeonly>
12020 ==Section 1==
12021 !! html
12022 <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>
12023
12024 !! end
12025
12026 !! test
12027 T8563: Section extraction for section suppressed by <includeonly>
12028 !! options
12029 section=1
12030 !! wikitext
12031 <includeonly>
12032 ==Includeonly section==
12033 </includeonly>
12034 ==Section 1==
12035 !! html
12036 ==Section 1==
12037 !! end
12038
12039 !! test
12040 Un-closed <includeonly>
12041 !! wikitext
12042 <includeonly>
12043 !! html/php
12044 !! html/parsoid
12045 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
12046 !! end
12047
12048 ## We used to, but no longer wt2wt this test since the default serializer
12049 ## will normalize the include directives to serialize on their own line.
12050 ## Selser will take care of preserving formatting in scenarios where they
12051 ## intermingled with other wikitext.
12052 !! test
12053 Includes and comments at SOL
12054 !! options
12055 parsoid=wt2html,html2html
12056 !! wikitext
12057 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
12058
12059 <noinclude>
12060 some
12061 </noinclude>*stuff
12062 *here
12063
12064 <includeonly>can have stuff</includeonly>===here===
12065
12066 !! html/php
12067 <h2><span class="mw-headline" id="hu">hu</span></h2>
12068 <p>some
12069 </p>
12070 <ul><li>stuff</li>
12071 <li>here</li></ul>
12072 <h3><span class="mw-headline" id="here">here</span></h3>
12073
12074 !! html/parsoid
12075 <!-- 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>
12076
12077 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12078 <p>some</p>
12079 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
12080 <li>here</li></ul>
12081
12082 <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>
12083
12084 !! end
12085
12086 # TODO: test with DOM fragment reuse!
12087 !! test
12088 Parsoid: DOM fragment reuse
12089 !! options
12090 parsoid=wt2wt,wt2html
12091 !! wikitext
12092 a{{echo|b<table></table>c}}d
12093
12094 a{{echo|b
12095 <table></table>
12096 c}}d
12097
12098 {{echo|a
12099
12100 <table></table>
12101
12102 b}}
12103 !! html
12104 <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>
12105
12106 <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">
12107 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
12108 </span><p about="#mwt2">cd</p>
12109
12110 <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">
12111
12112 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
12113
12114 </span><p about="#mwt3">b</p>
12115 !! end
12116
12117 !! test
12118 Parsoid: Merge double tds (T52603)
12119 !! options
12120 parsoid
12121 !! wikitext
12122 {|
12123 |{{echo|{{!}} foo}}
12124 |}
12125 !! html
12126 <table><tbody>
12127 <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>
12128 </tbody></table>
12129 !! end
12130
12131 !! test
12132 Parsoid: Merge double tds in nested transclusion content (T52603)
12133 !! options
12134 parsoid
12135 !! wikitext
12136 {{echo|<div>}}
12137 {|
12138 |{{echo|{{!}} foo}}
12139 |}
12140 {{echo|</div>}}
12141 !! html
12142 <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}}]}'>
12143 <table><tbody>
12144 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
12145 </tbody></table>
12146 </div>
12147 !! end
12148
12149 ###
12150 ### <includeonly> and <noinclude> in attributes
12151 ###
12152 !!test
12153 0. includeonly around the entire attribute
12154 !! wikitext
12155 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12156 !! html
12157 <p><span id="v2">bar</span>
12158 </p>
12159 !!end
12160
12161 !!test
12162 1. includeonly in html attr key
12163 !! wikitext
12164 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12165 !! html
12166 <p><span id="foo">bar</span>
12167 </p>
12168 !!end
12169
12170 !!test
12171 2. includeonly in html attr value
12172 !! wikitext
12173 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12174 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12175 !! html
12176 <p><span id="v1">bar</span>
12177 <span id="v1">bar</span>
12178 </p>
12179 !!end
12180
12181 !!test
12182 3. includeonly in part of an attr value
12183 !! wikitext
12184 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12185 !! html
12186 <p><span style="color:red;">bar</span>
12187 </p>
12188 !!end
12189
12190 !!test
12191 4. includeonly in table attributes
12192 !! wikitext
12193 {|
12194 |- <noinclude>
12195 |-
12196 |a
12197 </noinclude>
12198 |- <includeonly>
12199 |-
12200 |b
12201 </includeonly>
12202 |}
12203 !! html
12204 <table>
12205
12206
12207 <tr>
12208 <td>a
12209 </td></tr>
12210 </table>
12211
12212 !!end
12213
12214 ###
12215 ### Preprocessor precedence tests
12216 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12217 ###
12218 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12219 !! test
12220 Preprocessor precedence 1: link is rightmost opening
12221 !! options
12222 parsoid=wt2html
12223 !! wikitext
12224 {{[[Foo|bar}}]]
12225
12226 But close-brace is not a valid character in a link title:
12227 {{[[Foo}}|bar]]
12228
12229 However, we can still tell this was handled as a link in the preprocessor:
12230 {{echo|[[Foo}}|bar]]|bat}}
12231 !! html/php
12232 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12233 </p><p>But close-brace is not a valid character in a link title:
12234 {{[[Foo}}|bar]]
12235 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12236 [[Foo}}|bar]]
12237 </p>
12238 !! html/parsoid
12239 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12240 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12241 <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>
12242 !! end
12243
12244 !! test
12245 Preprocessor precedence 2: template is rightmost opening
12246 !! options
12247 language=zh
12248 !! wikitext
12249 -{{echo|foo}-}}-
12250 !! html/php
12251 <p>-foo}--
12252 </p>
12253 !! html/parsoid
12254 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12255 !! end
12256
12257 !! test
12258 Preprocessor precedence 3: language converter is rightmost opening
12259 !! options
12260 language=zh
12261 parsoid=wt2html
12262 !! wikitext
12263 {{echo|hi}}
12264
12265 {{-{R|echo|hi}}}-
12266
12267 [[-{R|raw]]}-
12268 !! html/php
12269 <p>hi
12270 </p><p>{{echo|hi}}
12271 </p><p>[[raw]]
12272 </p>
12273 !! html/parsoid
12274 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12275 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12276 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12277 !! end
12278
12279 !! test
12280 Preprocessor precedence 4: left-most angle bracket
12281 !! options
12282 language=zh
12283 !! wikitext
12284 <!--{raw}-->
12285 !! html/php
12286 !! html/parsoid
12287 <!--{raw}-->
12288 !! end
12289
12290 !! article
12291 Template:Precedence5
12292 !! text
12293 {{{{{1}}}}}
12294 !! endarticle
12295
12296 !! test
12297 Preprocessor precedence 5: tplarg takes precedence over template
12298 !! wikitext
12299 {{Precedence5|Bullet}}
12300 !! html/php
12301 <ul><li>Bar</li></ul>
12302
12303 !! html/parsoid
12304 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12305 !! end
12306
12307 !! test
12308 Preprocessor precedence 6: broken link is rightmost opening
12309 !! options
12310 parsoid=wt2html
12311 !! wikitext
12312 {{echo|[[Foo}}
12313
12314 {{echo|[[Foo|bar|bat=baz}}
12315 !! html/php
12316 <p>{{echo|[[Foo}}
12317 </p><p>{{echo|[[Foo|bar|bat=baz}}
12318 </p>
12319 !! html/parsoid
12320 <p>{{echo|[[Foo}}</p>
12321 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12322 !! end
12323
12324 # This next test exposes a difference between PHP and Parsoid:
12325 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12326 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12327 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12328 # outer `[[Foo` extends until the `y]]`
12329 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12330 # intermediate result (after template expansion), and link processing
12331 # happens on this intermediate result, which moves the wikilink
12332 # boundary leftward to `[[Foo|Bar]]`
12333 # 2b) Parsoid works in a single step, so it's going to keep the
12334 # wikilink as extending to the `y]]`
12335 # 3a) Then PHP does linktrail processing which slurps up the trailing
12336 # `xy` inside the link.
12337 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12338 # `z` inside the link.
12339 # This is "correct" behavior. Parsoid's basic worldview is that the
12340 # `]]` inside the template shouldn't be allowed to leak out to affect
12341 # the surrounding wikilink. PHP may match Parsoid (in the future)
12342 # if you use {{#balance}} (T114445).
12343
12344 !! test
12345 Preprocessor precedence 7: broken template is rightmost opening
12346 !! options
12347 parsoid=wt2html
12348 !! wikitext
12349 [[Foo|{{echo|Bar]]
12350
12351 [[Foo|{{echo|Bar]]-x}}-y]]-z
12352
12353 Careful: linktrails can move the end of the wikilink:
12354 [[Foo|{{echo|y']]a}}l]]l
12355 !! html/php
12356 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12357 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12358 </p><p>Careful: linktrails can move the end of the wikilink:
12359 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12360 </p>
12361 !! html/parsoid
12362 <p>[[Foo|{{echo|Bar]]</p>
12363 <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>
12364 <p>Careful: linktrails can move the end of the wikilink:
12365 <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>
12366 !! end
12367
12368 !! test
12369 Preprocessor precedence 8: broken language converter is rightmost opening
12370 !! options
12371 language=zh
12372 !! wikitext
12373 [[Foo-{R|raw]]
12374 !! html
12375 <p>[[Foo-{R|raw]]
12376 </p>
12377 !! end
12378
12379 !! article
12380 Template:Preprocessor_precedence_9
12381 !! text
12382 ;4: {{{{1}}}}
12383 ;5: {{{{{2}}}}}
12384 ;6: {{{{{{3}}}}}}
12385 ;7: {{{{{{{4}}}}}}}
12386 !! endarticle
12387
12388 !! test
12389 Preprocessor precedence 9: groups of braces
12390 !! wikitext
12391 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12392 !! html/php
12393 <dl><dt>4</dt>
12394 <dd>{Four}</dd>
12395 <dt>5</dt>
12396 <dd></dd></dl>
12397 <ul><li>Bar</li></ul>
12398 <dl><dt>6</dt>
12399 <dd>Four</dd>
12400 <dt>7</dt>
12401 <dd>{Bullet}</dd></dl>
12402
12403 !! html/parsoid
12404 <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}}]}'>
12405 <dt>4</dt>
12406 <dd>{Four}</dd>
12407 <dt>5</dt>
12408 <dd></dd>
12409 </dl><ul about="#mwt1">
12410 <li>Bar</li>
12411 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12412 <dt>6</dt>
12413 <dd>Four</dd>
12414 <dt>7</dt>
12415 <dd>{Bullet}</dd>
12416 </dl>
12417 !! end
12418
12419 !! article
12420 Template:Preprocessor_precedence_10
12421 !! text
12422 ;1: -{R|raw}-
12423 ;2: -{{Bullet}}-
12424 ;3: -{{{1}}}-
12425 ;4: -{{{{2}}}}-
12426 ;5: -{{{{{3}}}}}-
12427 ;6: -{{{{{{4}}}}}}-
12428 ;7: -{{{{{{{5}}}}}}}-
12429 !! endarticle
12430
12431 !! test
12432 Preprocessor precedence 10: groups of braces with leading dash
12433 !! options
12434 language=zh
12435 !! wikitext
12436 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12437 !! html/php
12438 <dl><dt>1</dt>
12439 <dd>raw</dd>
12440 <dt>2</dt>
12441 <dd>-</dd></dl>
12442 <ul><li>Bar-</li></ul>
12443 <dl><dt>3</dt>
12444 <dd>-Three-</dd>
12445 <dt>4</dt>
12446 <dd>raw2</dd>
12447 <dt>5</dt>
12448 <dd>-</dd></dl>
12449 <ul><li>Bar-</li></ul>
12450 <dl><dt>6</dt>
12451 <dd>-Three-</dd>
12452 <dt>7</dt>
12453 <dd>raw2</dd></dl>
12454
12455 !! html/parsoid
12456 <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}}]}'>
12457 <dt>1</dt>
12458 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12459 <dt>2</dt>
12460 <dd>-</dd>
12461 </dl><ul about="#mwt1">
12462 <li>Bar-</li>
12463 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12464 <dt>3</dt>
12465 <dd>-Three-</dd>
12466 <dt>4</dt>
12467 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12468 <dt>5</dt>
12469 <dd>-</dd>
12470 </dl><ul about="#mwt1">
12471 <li>Bar-</li>
12472 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12473 <dt>6</dt>
12474 <dd>-Three-</dd>
12475 <dt>7</dt>
12476 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12477 </dl>
12478 !! end
12479
12480 !! test
12481 Preprocessor precedence 11: found during visual diff testing
12482 !! wikitext
12483 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12484
12485 {{echo|-{{echo|-{{echo|x}}}}}}
12486
12487 {{echo|-{{echo|x}}}}
12488 !! html/php
12489 <p><span>-<span>-x</span></span>
12490 </p><p>--x
12491 </p><p>-x
12492 </p>
12493 !! html/parsoid
12494 <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>
12495
12496 <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>
12497
12498 <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>
12499 !! end
12500
12501 !! test
12502 Preprocessor precedence 12: broken language converter closed by brace.
12503 !! options
12504 parsoid=wt2html
12505 !! wikitext
12506 This form breaks the template, which is unfortunate:
12507 *{{echo|foo-{bar}bat}}
12508
12509 But if the broken language converter markup is inside an extension
12510 tag, nothing bad happens:
12511 *<nowiki>foo-{bar}bat</nowiki>
12512 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12513 *<pre>foo-{bar}bat</pre>
12514 *{{echo|<pre>foo-{bar}bat</pre>}}
12515
12516 <tag>foo-{bar}bat</tag>
12517 {{echo|<tag>foo-{bar}bat</tag>}}
12518
12519 !! html/php+tidy
12520 <p>This form breaks the template, which is unfortunate:
12521 </p>
12522 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12523 <p>But if the broken language converter markup is inside an extension
12524 tag, nothing bad happens:
12525 </p>
12526 <ul><li>foo-&#123;bar}bat</li>
12527 <li>foo-&#123;bar}bat</li>
12528 <li><pre>foo-{bar}bat</pre></li>
12529 <li><pre>foo-{bar}bat</pre></li></ul>
12530 <pre>'foo-{bar}bat'
12531 array (
12532 )
12533 </pre>
12534 <pre>'foo-{bar}bat'
12535 array (
12536 )
12537 </pre>
12538 !! html/parsoid
12539 <p>This form breaks the template, which is unfortunate:</p>
12540 <ul>
12541 <li>{{echo|foo-{bar}bat}}</li>
12542 </ul>
12543 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12544 <ul>
12545 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12546 <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>
12547 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12548 <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>
12549 </ul>
12550 <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>
12551 !! end
12552
12553 !! test
12554 Preprocessor precedence 13: broken language converter in external link
12555 !! options
12556 parsoid=wt2html
12557 !! wikitext
12558 *[http://example.com/-{foo Example in URL]
12559 *[http://example.com Example in -{link} description]
12560 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12561 !! html/php+tidy
12562 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12563 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12564 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12565 !! html/parsoid
12566 <ul>
12567 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12568 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12569 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12570 </ul>
12571 !! end
12572
12573 !! test
12574 Preprocessor precedence 14: broken language converter in comment
12575 !! wikitext
12576 *<!--{{foo}}-->...should be ok
12577 *<!---{{foo}}-->...extra dashes
12578 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12579 !! html/php+tidy
12580 <ul><li>...should be ok</li>
12581 <li>...extra dashes</li>
12582 <li>foobat...should be ok</li></ul>
12583 !! html/parsoid
12584 <ul>
12585 <li><!--{{foo}}-->...should be ok</li>
12586 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12587 <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>
12588 </ul>
12589 !! end
12590
12591 !! test
12592 Preprocessor precedence 15: broken brace markup in headings
12593 !! config
12594 wgFragmentMode=[ 'html5', 'legacy' ]
12595 !! options
12596 parsoid=wt2html
12597 !! wikitext
12598 __NOTOC__ __NOEDITSECTION__
12599 ===1 foo[bar 1===
12600 1
12601 ===2 foo[[bar 2===
12602 2
12603 ===3 foo{bar 3===
12604 3
12605 ===4 foo{{bar 4===
12606 4
12607 ===5 foo{{{bar 5===
12608 5
12609 ===6 foo-{bar 6===
12610 6
12611 !! html/php+tidy
12612 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12613 <p>1
12614 </p>
12615 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12616 <p>2
12617 </p>
12618 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12619 <p>3
12620 </p>
12621 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12622 <p>4
12623 </p>
12624 <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>
12625 <p>5
12626 </p>
12627 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12628 <p>6
12629 </p>
12630 !! html/parsoid
12631 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12632 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12633 <p>1</p>
12634 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12635 <p>2</p>
12636 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12637 <p>3</p>
12638 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12639 <p>4</p>
12640 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12641 <p>5</p>
12642 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12643 <p>6</p>
12644 !! end
12645
12646 !! test
12647 Preprocessor precedence 16: matching closing braces to opening braces
12648 !! options
12649 language=zh
12650 parsoid=wt2html
12651 !! wikitext
12652 -{{{echo|foo}}bar}-
12653 !! html/php
12654 <p>foobar
12655 </p>
12656 !! html/parsoid
12657 <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>
12658 !! end
12659
12660 !! test
12661 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12662 !! options
12663 parsoid=wt2html
12664 !! wikitext
12665 {{echo|hi {{}}}}
12666 !! html/php
12667 <p>hi {{}}
12668 </p>
12669 !! html/parsoid
12670 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12671 !! end
12672
12673 !! test
12674 Preprocessor precedence 18: another rightmost wins scenario
12675 !! options
12676 parsoid=wt2html
12677 !! wikitext
12678 {{ -{{{{1|tplarg}}} }} }-
12679 !! html/php
12680 <p>{{ -{tplarg }} }-
12681 </p>
12682 !! html/parsoid
12683 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12684 !! end
12685
12686 !! test
12687 Preprocessor precedence 19: break syntax
12688 !! options
12689 parsoid=wt2html
12690 !! wikitext
12691 -{{
12692 !! html/php
12693 <p>-{{
12694 </p>
12695 !! html/parsoid
12696 <p>-{{</p>
12697 !! end
12698
12699 ###
12700 ### Token Stream Patcher tests
12701 ###
12702 ### These tests won't always pass wt2wt and other modes because
12703 ### on serialization, the table will be output on a new line.
12704 ### For now, we are blacklisting them, and using this to test selser.
12705 ###
12706
12707 !!test
12708 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12709 !!options
12710 parsoid=wt2html,wt2wt
12711 !!wikitext
12712 {{echo|}}{| width = '100%'
12713 |foo
12714 |}
12715 !!html/parsoid
12716 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12717 <tbody><tr><td>foo</td></tr>
12718 </tbody></table>
12719 !!end
12720
12721 ## We used to, but no longer wt2wt this test since the default serializer
12722 ## will normalize the include directives to serialize on their own line.
12723 ## Selser will take care of preserving formatting in scenarios where they
12724 ## intermingled with other wikitext.
12725 !!test
12726 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12727 !!options
12728 parsoid=wt2html
12729 !!wikitext
12730 <includeonly>a</includeonly>{| {{{b}}}
12731 |c
12732 |}
12733 !!html/parsoid
12734 <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":""}]]}'>
12735 <tbody><tr><td>c</td></tr>
12736 </tbody></table>
12737 !!end
12738
12739 !! test
12740 Table wikitext syntax outside wiki-tables
12741 !! wikitext
12742 a
12743 |+ not a caption
12744 ! not a table heading
12745 |- not a table row
12746 | not a table cell
12747 | class="foo bar" | baz
12748 b
12749 |}
12750 |-
12751 c
12752 !! html
12753 <p>a
12754 |+ not a caption
12755 ! not a table heading
12756 |- not a table row
12757 | not a table cell
12758 | class="foo bar" | baz
12759 b
12760 |}
12761 |-
12762 c
12763 </p>
12764 !! end
12765
12766 ###
12767 ### Testing parsing of templates where a template arg
12768 ### has the same name as the template itself.
12769 ###
12770
12771 !! article
12772 Template:quote
12773 !! text
12774 {{{quote|{{{1}}}}}}
12775 !! endarticle
12776
12777 !!test
12778 Templates: Template Name/Arg clash: 1. Use of positional param
12779 !! wikitext
12780 {{quote|foo}}
12781 !! html
12782 <p>foo
12783 </p>
12784 !!end
12785
12786 !!test
12787 Templates: Template Name/Arg clash: 2. Use of named param
12788 !! wikitext
12789 {{quote|quote=foo}}
12790 !! html
12791 <p>foo
12792 </p>
12793 !!end
12794
12795 !!test
12796 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12797 !! wikitext
12798 {{quote|quote}}
12799 !! html
12800 <p>quote
12801 </p>
12802 !!end
12803
12804 ###
12805 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12806 ###
12807
12808 !!test
12809 Templates: 1. Simple use
12810 !! wikitext
12811 {{echo|Foo}}
12812 !! html
12813 <p>Foo
12814 </p>
12815 !!end
12816
12817 !!test
12818 Templates: 2. Inside a block tag
12819 !! wikitext
12820 <div>{{echo|Foo}}</div>
12821 <blockquote>{{echo|Foo}}</blockquote>
12822 !! html
12823 <div>Foo</div>
12824 <blockquote>Foo</blockquote>
12825
12826 !! html+tidy
12827 <div>Foo</div>
12828 <blockquote><p>Foo</p></blockquote>
12829 !!end
12830
12831 !!test
12832 Templates: P-wrapping: 1a. Templates on consecutive lines
12833 !! wikitext
12834 {{echo|Foo}}
12835 {{echo|bar}}
12836 !! html
12837 <p>Foo
12838 bar
12839 </p>
12840 !!end
12841
12842 !!test
12843 Templates: P-wrapping: 1b. Templates on consecutive lines
12844 !! wikitext
12845 Foo
12846
12847 {{echo|bar}}
12848 {{echo|baz}}
12849 !! html
12850 <p>Foo
12851 </p><p>bar
12852 baz
12853 </p>
12854 !!end
12855
12856 !!test
12857 Templates: P-wrapping: 1c. Templates on consecutive lines
12858 !! wikitext
12859 {{echo|Foo}}
12860 {{echo|bar}} <div>baz</div>
12861 !! html
12862 <p>Foo
12863 </p>
12864 bar <div>baz</div>
12865
12866 !! html+tidy
12867 <p>Foo
12868 </p><p>
12869 bar </p><div>baz</div>
12870 !! end
12871
12872 !!test
12873 Templates: P-wrapping: 1d. Template preceded by comment-only line
12874 !!options
12875 parsoid
12876 !! wikitext
12877 <!-- foo -->
12878 {{echo|Bar}}
12879 !! html
12880 <!-- foo -->
12881
12882 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12883 !!end
12884
12885 !!test
12886 Templates: Inline Text: 1. Multiple template uses
12887 !! wikitext
12888 {{echo|Foo}}bar{{echo|baz}}
12889 !! html
12890 <p>Foobarbaz
12891 </p>
12892 !!end
12893
12894 !!test
12895 Templates: Inline Text: 2. Back-to-back template uses
12896 !! wikitext
12897 {{echo|Foo}}{{echo|bar}}
12898 !! html
12899 <p>Foobar
12900 </p>
12901 !!end
12902
12903 !!test
12904 Templates: Block Tags: 1. Multiple template uses
12905 !! wikitext
12906 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12907 !! html
12908 <div>Foo</div><div>bar</div><div>baz</div>
12909
12910 !!end
12911
12912 !!test
12913 Templates: Block Tags: 2. Back-to-back template uses
12914 !! wikitext
12915 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12916 !! html
12917 <div>Foo</div><div>bar</div>
12918
12919 !!end
12920
12921 ## This is an edge case relating to paragraph wrapping.
12922 ## Note that Parsoid fails to match Remex because it's using the closing tag
12923 ## as a heuristic to determine if it's in a block, rather than SAX based events.
12924 ## And Parsoid drops empty elements in templates.
12925 !! test
12926 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12927 !! wikitext
12928 {{echo|a
12929 b</p>}}
12930 !! html/php+tidy
12931 <p>a
12932 </p><p>
12933 b</p><p class="mw-empty-elt"></p>
12934 !! html/parsoid
12935 <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">
12936 </span><span about="#mwt1">b</span>
12937 !! end
12938
12939 !!test
12940 Templates: Links: 1. Simple example
12941 !! wikitext
12942 {{echo|[[Foo|bar]]}}
12943 !! html
12944 <p><a href="/wiki/Foo" title="Foo">bar</a>
12945 </p>
12946 !!end
12947
12948 !!test
12949 Templates: Links: 2. Generation of link href
12950 !! wikitext
12951 [[{{echo|Foo}}|bar]]
12952 !! html
12953 <p><a href="/wiki/Foo" title="Foo">bar</a>
12954 </p>
12955 !!end
12956
12957 !!test
12958 Templates: Links: 3. Generation of part of a link href
12959 !! wikitext
12960 [[Fo{{echo|o}}|bar]]
12961
12962 [[Foo{{echo|bar}}]]
12963
12964 [[Foo{{echo|bar}}baz]]
12965
12966 [[Foo{{echo|bar}}|bar]]
12967
12968 [[:Foo{{echo|bar}}]]
12969
12970 [[:Foo{{echo|bar}}|bar]]
12971 !! html
12972 <p><a href="/wiki/Foo" title="Foo">bar</a>
12973 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12974 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12975 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12976 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12977 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12978 </p>
12979 !!end
12980
12981 !!test
12982 Templates: Links: 4. Multiple templates generating link href
12983 !! wikitext
12984 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12985 !! html
12986 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12987 </p>
12988 !!end
12989
12990 !!test
12991 Templates: Links: 5. Generation of link text
12992 !! wikitext
12993 [[Foo|{{echo|bar}}]]
12994 !! html
12995 <p><a href="/wiki/Foo" title="Foo">bar</a>
12996 </p>
12997 !!end
12998
12999 !!test
13000 Templates: Links: 5. Nested templates (only outermost template should be marked)
13001 !! wikitext
13002 {{echo|[[{{echo|Foo}}|bar]]}}
13003 !! html
13004 <p><a href="/wiki/Foo" title="Foo">bar</a>
13005 </p>
13006 !!end
13007
13008 !!test
13009 Templates: HTML Tag: 1. Generation of HTML attr. key
13010 !! wikitext
13011 <div {{echo|style}}="color:red;">foo</div>
13012 !! html
13013 <div style="color:red;">foo</div>
13014
13015 !!end
13016
13017 !!test
13018 Templates: HTML Tag: 2. Generation of HTML attr. value
13019 !! wikitext
13020 <div style={{echo|'color:red;'}}>foo</div>
13021 !! html
13022 <div style="color:red;">foo</div>
13023
13024 !!end
13025
13026 !!test
13027 Templates: HTML Tag: 3. Generation of HTML attr key and value
13028 !! wikitext
13029 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
13030 !! html
13031 <div style="color:red;">foo</div>
13032
13033 !!end
13034
13035 !!test
13036 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
13037 !! wikitext
13038 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
13039 !! html
13040 <div title="This is a long title with just one piece templated">foo</div>
13041
13042 !!end
13043
13044 !!test
13045 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
13046 !! wikitext
13047 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
13048 !! html
13049 <div title="This is a long title with just one piece templated">foo</div>
13050
13051 !!end
13052
13053 !!test
13054 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
13055 !! wikitext
13056 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
13057 !! html
13058 <div title="This is a long title with just one piece templated">foo</div>
13059
13060 !!end
13061
13062 # SSS FIXME: While it is great we added support for all this,
13063 # do we want to make this part of the spec? Maybe we want to
13064 # deprecate this kind of usage in the future?
13065 !!test
13066 Templates: HTML Tag: 7. Generation of partial attribute key string
13067 !! wikitext
13068 <div st{{echo|yle}}="color:red;">foo</div>
13069 !! html
13070 <div style="color:red;">foo</div>
13071
13072 !!end
13073
13074 !! test
13075 Templates: HTML Tag: 8. Template-generated attribute (k=v)
13076 !! wikitext
13077 <div {{echo|1=id="v1"}}>bar</div>
13078 !! html
13079 <div id="v1">bar</div>
13080
13081 !!end
13082
13083 !! test
13084 Templates: HTML Tag: 9. Multiple template-generated attributes
13085 !! wikitext
13086 <div {{echo|1=id="v1" title="foo"}}>bar</div>
13087 !! html
13088 <div id="v1" title="foo">bar</div>
13089
13090 !!end
13091
13092 !! test
13093 Templates: Support for templates generating attributes and content
13094 !! wikitext
13095 {| {{mixed_attr_content_template}}
13096 |-
13097 |bar
13098 |}
13099 !! html/php
13100 <table style="color:red;" title="T48811">
13101
13102 <tr>
13103 <td>foo
13104 </td></tr>
13105 <tr>
13106 <td>bar
13107 </td></tr></table>
13108
13109 !! html/parsoid
13110 <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|}"]}'>
13111 <tbody><tr>
13112 <td>foo</td></tr>
13113 <tr>
13114 <td>bar</td></tr>
13115 </tbody></table>
13116 !!end
13117
13118 !! article
13119 Template:attribute_from_template
13120 !! text
13121 class="123"
13122 !! endarticle
13123
13124 !! test
13125 Table cell with attribute before expanded attribute
13126 !! wikitext
13127 {|
13128 | align="center" {{attribute_from_template}} |456
13129 |}
13130 !! html/parsoid
13131 <table>
13132 <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>
13133 </tbody></table>
13134 !! end
13135
13136 !! test
13137 1. Entities and nowikis inside templated attributes should be handled correctly
13138 !! wikitext
13139 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
13140 !! html/php
13141 <div style="background:#f9f9f9;">foo</div>
13142
13143 !! html/parsoid
13144 <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>
13145 !! end
13146
13147 !! test
13148 2. Entities and nowikis inside templated attributes should be handled correctly
13149 !! wikitext
13150 {|
13151 |{{table_attribs_3}}
13152 |}
13153 !! html/php
13154 <table>
13155 <tr>
13156 <td style="background:#f9f9f9;">Foo
13157 </td></tr></table>
13158
13159 !! html/parsoid
13160 <table>
13161 <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>
13162 </tbody></table>
13163 !! end
13164
13165 !! test
13166 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13167 !! wikitext
13168 {{tbl-start}}
13169 |{{table_attribs_3}}
13170 {{tbl-end}}
13171 !! html/php
13172 <table>
13173 <tr>
13174 <td style="background:#f9f9f9;">Foo
13175 </td></tr></table>
13176
13177 !! html/parsoid
13178 <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}}]}'>
13179 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
13180 </tbody></table>
13181 !! end
13182
13183 # T107622
13184 !! test
13185 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13186 !! wikitext
13187 {|
13188 |{{table_attribs_6}} hi
13189 |}
13190 !! html/php
13191 <table>
13192 <tr>
13193 <td style="background: red;">hi
13194 </td></tr></table>
13195
13196 !! html/parsoid
13197 <table>
13198 <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>
13199 </tbody></table>
13200 !! end
13201
13202 !!test
13203 Templates: HTML Tables: 1. Generating start of a HTML table
13204 !! wikitext
13205 {{echo|<table><tr><td>foo</td>}}</tr></table>
13206 !! html
13207 <table><tr><td>foo</td></tr></table>
13208
13209 !!end
13210
13211 !!test
13212 Templates: HTML Tables: 2a. Generating middle of a HTML table
13213 !! wikitext
13214 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13215 !! html
13216 <table><tr><td>foo</td></tr></table>
13217
13218 !!end
13219
13220 !!test
13221 Templates: HTML Tables: 2b. Generating middle of a HTML table
13222 !! wikitext
13223 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13224 !! html
13225 <table><tr><td>foo</td></tr></table>
13226
13227 !!end
13228
13229 !!test
13230 Templates: HTML Tables: 3. Generating end of a HTML table
13231 !! wikitext
13232 <table><tr>{{echo|<td>foo</td></tr></table>}}
13233 !! html
13234 <table><tr><td>foo</td></tr></table>
13235
13236 !!end
13237
13238 !!test
13239 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13240 !! wikitext
13241 {{echo|<table>}}<tr><td>foo</td></tr></table>
13242 !! html
13243 <table><tr><td>foo</td></tr></table>
13244
13245 !!end
13246
13247 !!test
13248 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13249 !! wikitext
13250 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13251 !! html
13252 <table><tr><td>foo</td></tr></table>
13253
13254 !!end
13255
13256 !!test
13257 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13258 !! wikitext
13259 <table><tr>{{echo|<td>}}foo</td></tr></table>
13260 !! html
13261 <table><tr><td>foo</td></tr></table>
13262
13263 !!end
13264
13265 !!test
13266 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13267 !! wikitext
13268 <table><tr><td>foo{{echo|</td>}}</tr></table>
13269 !! html
13270 <table><tr><td>foo</td></tr></table>
13271
13272 !!end
13273
13274 !!test
13275 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13276 !! wikitext
13277 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13278 !! html
13279 <table><tr><td>foo</td></tr></table>
13280
13281 !!end
13282
13283 !!test
13284 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13285 !! wikitext
13286 <table><tr><td>foo</td></tr>{{echo|</table>}}
13287 !! html
13288 <table><tr><td>foo</td></tr></table>
13289
13290 !!end
13291
13292 !!test
13293 Templates: HTML Tables: 5. Proper fostering of categories from inside
13294 !!options
13295 parsoid=wt2html,wt2wt
13296 !! wikitext
13297 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13298 <!--Two categories (T52330)-->
13299 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13300 !! html
13301 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13302 <!--Two categories (T52330)-->
13303 <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>
13304 !!end
13305
13306 !! test
13307 Templates: Wiki Tables: 1a. Fostering of entire template content
13308 !! wikitext
13309 {|
13310 {{echo|a}}
13311 |}
13312 !! html/php
13313 <table>
13314 a
13315 <tr><td></td></tr></table>
13316
13317 !! html/php+tidy
13318
13319 a
13320 <table><tbody><tr><td></td></tr></tbody></table>
13321 !! html/parsoid
13322 <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">
13323
13324 </table>
13325 !! end
13326
13327 !!test
13328 Templates: Wiki Tables: 1b. Fostering of entire template content
13329 !! wikitext
13330 {|
13331 {{echo|<div>}}
13332 foo
13333 {{echo|</div>}}
13334 |}
13335 !! html
13336 <table>
13337 <div>
13338 <p>foo
13339 </p>
13340 </div>
13341 <tr><td></td></tr></table>
13342
13343 !! html/php+tidy
13344 <div>
13345 <p>foo
13346 </p>
13347 </div><table>
13348
13349 <tbody><tr><td></td></tr></tbody></table>
13350 !! html/parsoid
13351 <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|}"]}'>
13352 <p>foo</p>
13353 </div><table about="#mwt3">
13354
13355 </table>
13356 !! end
13357
13358 !! test
13359 Templates: Wiki Tables: 2. Fostering of partial template content
13360 !! wikitext
13361 {|
13362 {{echo|a
13363 <div>b</div>}}
13364 |}
13365 !! html/php
13366 <table>
13367 a
13368 <div>b</div>
13369 <tr><td></td></tr></table>
13370
13371 !! html/php+tidy
13372
13373 a
13374 <div>b</div><table>
13375 <tbody><tr><td></td></tr></tbody></table>
13376 !! html/parsoid
13377 <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">
13378
13379
13380 </table>
13381 !! end
13382
13383 !!test
13384 Templates: Wiki Tables: 3. td-content via multiple templates
13385 !! wikitext
13386 {|
13387 {{echo|{{pipe}}a}}{{echo|b}}
13388 |}
13389 !! html
13390 <table>
13391 <tr>
13392 <td>ab
13393 </td></tr></table>
13394
13395 !!end
13396
13397 !!test
13398 Templates: Wiki Tables: 4. Templated tags, no content
13399 !! wikitext
13400 {{tbl-start}}
13401 {{tbl-end}}
13402 !! html
13403 <table>
13404 <tr><td></td></tr></table>
13405
13406 !!end
13407
13408 !!test
13409 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13410 !! wikitext
13411 {{tbl-start}}
13412 |foo
13413 {{tbl-end}}
13414 !! html
13415 <table>
13416 <tr>
13417 <td>foo
13418 </td></tr></table>
13419
13420 !!end
13421
13422 !!test
13423 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13424 !! wikitext
13425 {{tbl-start}}
13426 {{!}}foo
13427 {{tbl-end}}
13428 !! html
13429 <table>
13430 <tr>
13431 <td>foo
13432 </td></tr></table>
13433
13434 !!end
13435
13436 ## This test case is very specific to Parsoid's internals
13437 ## and is hence only tested for Parsoid's code. Parsoid uses
13438 ## a <meta> marker tag for <ref> tags and they are expanded
13439 ## much later. We are verifying that this <meta> tag usage
13440 ## doesn't prevent foster parenting.
13441 !!test
13442 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13443 !!wikitext
13444 {{PartialTable}}<ref>foo</ref>
13445 |}
13446
13447 <references />
13448 !!html/parsoid
13449 <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">
13450 <tbody>
13451 </tbody></table>
13452
13453 <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>
13454 !!end
13455
13456 !! test
13457 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13458 !! wikitext
13459 {{echo|
13460 {{{!}}
13461 {{!}}-}}
13462 <onlyinclude>
13463 |foo
13464 </onlyinclude>
13465 {{!}}}
13466 !! html/parsoid
13467 <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{{!}}}"]}'>
13468 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13469 <tbody><tr>
13470
13471 <td>foo
13472 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13473 </tbody></table>
13474 !! end
13475
13476 !!test
13477 Templates: Lists: Multi-line list-items via templates
13478 !! wikitext
13479 *{{echo|a {{nonexistent|
13480 unused}}}}
13481 *{{echo|b {{nonexistent|
13482 unused}}}}
13483 !! html
13484 <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>
13485 <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>
13486
13487 !!end
13488
13489 !!test
13490 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13491 !! wikitext
13492 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13493 !! html
13494 <p><i>ab</i>c<i>d</i>e
13495 </p>
13496 !!end
13497
13498 !!test
13499 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13500 (PHP parser generates misnested html)
13501 !! wikitext
13502 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13503 !! html/parsoid
13504 <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>
13505 !!end
13506
13507 !!test
13508 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13509 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13510 !! options
13511 parsoid=wt2html,wt2wt
13512 !! wikitext
13513 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13514 !! html
13515 <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>
13516 <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>
13517 <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>
13518 !!end
13519
13520 !!test
13521 Templates: Ugly nesting: 4. Divs opened/closed across templates
13522 !! wikitext
13523 a<div>b{{echo|c</div>d}}e
13524 !! html
13525 a<div>bc</div>de
13526
13527 !! html+tidy
13528 <p>a</p><div>bc</div><p>de
13529 </p>
13530 !! end
13531
13532 !! test
13533 Templates: Ugly templates: 3. newline-only template parameter
13534 !! wikitext
13535 foo {{echo|
13536 }}
13537 !! html
13538 <p>foo
13539 </p>
13540 !! end
13541
13542 # This looks like a bug: a single newline triggers p/br for some reason.
13543 !! test
13544 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13545 !! wikitext
13546 {{echo|
13547 }}
13548 !! html
13549 <p><br />
13550 </p>
13551 !! end
13552
13553 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13554 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13555 !! test
13556 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13557 !! wikitext
13558 {{echo|<table>}}
13559 {{echo|<div>foo}}
13560 {{echo|</table>}}
13561 !! html/parsoid
13562 <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
13563 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13564 </table>
13565 !! end
13566
13567 # T66017 -- ugly wikitext with fostered content generates two template ranges
13568 # that are "identical" and generate nesting cycles in the algorithm
13569 !! test
13570 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13571 !! wikitext
13572 {{echo|<table><tr><td><table>}}
13573 {{echo|<div>}}
13574 {{echo|</div>}}
13575 !! html/parsoid
13576 <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"}'>
13577 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13578 </table></td></tr></tbody></table>
13579 !! end
13580
13581 !! test
13582 Templates: Parameters substituted at the top-level
13583 !! wikitext
13584 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13585
13586 {{{foo|bar|baz}}}
13587 !! html/php
13588 <p><i>who</i> me? <b>never!</b>
13589 </p><p>bar
13590 </p>
13591 !! html/parsoid
13592 <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>
13593
13594 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13595 !! end
13596
13597 !! test
13598 Templates: Param with empty arg in the final position
13599 !! wikitext
13600 {{{hi|}}}
13601 !! html/parsoid
13602 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13603 !! end
13604
13605 !!test
13606 Parser Functions: 1. Simple example
13607 !! wikitext
13608 {{uc:foo}}
13609 !! html
13610 <p>FOO
13611 </p>
13612 !!end
13613
13614 !!test
13615 Parser Functions: 2. Nested use (only outermost should be marked up)
13616 !! wikitext
13617 {{uc:{{lc:FOO}}}}
13618 !! html
13619 <p>FOO
13620 </p>
13621 !!end
13622
13623 ## Note that the templates inside the references are not wrapped
13624 !! test
13625 Template nested in extension tag in template
13626 !! wikitext
13627 {{echo|hi<ref>[[ho|{{echo|hi}}]]</ref>}}
13628 {{echo|hi<ref>[http://test.com?q={{echo|ho}}]</ref>}}
13629 <references />
13630 !! html/parsoid
13631 <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>
13632 <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>
13633 <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>
13634 !! end
13635
13636 ###
13637 ### Pre-save transform tests
13638 ###
13639 !! test
13640 pre-save transform: subst:
13641 !! options
13642 pst
13643 !! wikitext
13644 {{subst:test}}
13645 !! html/php
13646 This is a test template
13647 !! end
13648
13649 !! test
13650 pre-save transform: normal template
13651 !! options
13652 pst
13653 !! wikitext
13654 {{test}}
13655 !! html/php
13656 {{test}}
13657 !! end
13658
13659 !! test
13660 pre-save transform: nonexistent template
13661 !! options
13662 pst
13663 !! wikitext
13664 {{thistemplatedoesnotexist}}
13665 !! html/php
13666 {{thistemplatedoesnotexist}}
13667 !! end
13668
13669 !! test
13670 pre-save transform: subst magic variables
13671 !! options
13672 pst
13673 !! wikitext
13674 {{subst:SITENAME}}
13675 !! html/php
13676 MediaWiki
13677 !! end
13678
13679 # This is T2089, which I fixed. -- wtm
13680 !! test
13681 pre-save transform: subst: templates with parameters
13682 !! options
13683 pst
13684 !! wikitext
13685 {{subst:paramtest|param="something else"}}
13686 !! html/php
13687 This is a test template with parameter "something else"
13688 !! end
13689
13690 !! article
13691 Template:nowikitest
13692 !! text
13693 <nowiki>'''not wiki'''</nowiki>
13694 !! endarticle
13695
13696 !! test
13697 pre-save transform: nowiki in subst (T3188)
13698 !! options
13699 pst
13700 !! wikitext
13701 {{subst:nowikitest}}
13702 !! html/php
13703 <nowiki>'''not wiki'''</nowiki>
13704 !! end
13705
13706 !! article
13707 Template:commenttest
13708 !! text
13709 This template has <!-- a comment --> in it.
13710 !! endarticle
13711
13712 !! test
13713 pre-save transform: comment in subst (T3936)
13714 !! options
13715 pst
13716 !! wikitext
13717 {{subst:commenttest}}
13718 !! html/php
13719 This template has <!-- a comment --> in it.
13720 !! end
13721
13722 !! test
13723 pre-save transform: unclosed tag
13724 !! options
13725 pst
13726 !! wikitext
13727 <nowiki>'''not wiki'''
13728 !! html/php
13729 <nowiki>'''not wiki'''
13730 !! end
13731
13732 !! test
13733 pre-save transform: mixed tag case
13734 !! options
13735 pst
13736 !! wikitext
13737 <NOwiki>'''not wiki'''</noWIKI>
13738 !! html/php
13739 <NOwiki>'''not wiki'''</noWIKI>
13740 !! end
13741
13742 !! test
13743 pre-save transform: unclosed comment in <nowiki>
13744 !! options
13745 pst
13746 !! wikitext
13747 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13748 !! html/php
13749 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13750 !!end
13751
13752 # Leading @ in this template definition works around a limitation
13753 # in parsoid's parserTests which otherwise strips the <span> from the
13754 # result (confusing it for a template wrapper)
13755 !! article
13756 Template:dangerous
13757 !!text
13758 @<span onmouseover="alert('crap')">Oh no</span>
13759 !!endarticle
13760
13761 !!test
13762 (confirming safety of fix for subst T3936)
13763 !! wikitext
13764 {{Template:dangerous}}
13765 !! html
13766 <p>@<span>Oh no</span>
13767 </p>
13768 !! end
13769
13770 !! test
13771 pre-save transform: comment containing gallery (T7024)
13772 !! options
13773 pst
13774 !! wikitext
13775 <!-- <gallery>data</gallery> -->
13776 !! html/php
13777 <!-- <gallery>data</gallery> -->
13778 !!end
13779
13780 !! test
13781 pre-save transform: comment containing extension
13782 !! options
13783 pst
13784 !! wikitext
13785 <!-- <tag>data</tag> -->
13786 !! html/php
13787 <!-- <tag>data</tag> -->
13788 !!end
13789
13790 !! test
13791 pre-save transform: comment containing nowiki
13792 !! options
13793 pst
13794 !! wikitext
13795 <!-- <nowiki>data</nowiki> -->
13796 !! html/php
13797 <!-- <nowiki>data</nowiki> -->
13798 !!end
13799
13800 !! test
13801 pre-save transform: <noinclude> in subst (T5298)
13802 !! options
13803 pst
13804 !! wikitext
13805 {{subst:Includes}}
13806 !! html/php
13807 Foobar
13808 !! end
13809
13810 !! test
13811 pre-save transform: <onlyinclude> in subst (T5298)
13812 !! options
13813 pst
13814 !! wikitext
13815 {{subst:Includes2}}
13816 !! html/php
13817 Foo
13818 !! end
13819
13820 !! article
13821 Template:SubstTest
13822 !!text
13823 {{<includeonly>subst:</includeonly>Includes}}
13824 !! endarticle
13825
13826 !! article
13827 Template:SafeSubstTest
13828 !! text
13829 {{<includeonly>safesubst:</includeonly>Includes}}
13830 !! endarticle
13831
13832 !! test
13833 T24297: safesubst: works during PST
13834 !! options
13835 pst
13836 !! wikitext
13837 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13838 !! html/php
13839 FoobarFoobar
13840 !! end
13841
13842 !! test
13843 T24297: safesubst: works during normal parse
13844 !! wikitext
13845 {{SafeSubstTest}}
13846 !! html
13847 <p>Foobar
13848 </p>
13849 !! end
13850
13851 !! test
13852 subst: does not work during normal parse
13853 !! wikitext
13854 {{SubstTest}}
13855 !! html
13856 <p>{{subst:Includes}}
13857 </p>
13858 !! end
13859
13860 !! test
13861 pre-save transform: context links ("pipe trick")
13862 !! options
13863 pst
13864 !! wikitext
13865 [[Article (context)|]]
13866 [[Bar:Article|]]
13867 [[:Bar:Article|]]
13868 [[Bar:Article (context)|]]
13869 [[:Bar:Article (context)|]]
13870 [[|Article]]
13871 [[|Article (context)]]
13872 [[Bar:X (Y) Z|]]
13873 [[:Bar:X (Y) Z|]]
13874 !! html/php
13875 [[Article (context)|Article]]
13876 [[Bar:Article|Article]]
13877 [[:Bar:Article|Article]]
13878 [[Bar:Article (context)|Article]]
13879 [[:Bar:Article (context)|Article]]
13880 [[Article]]
13881 [[Article (context)]]
13882 [[Bar:X (Y) Z|X (Y) Z]]
13883 [[:Bar:X (Y) Z|X (Y) Z]]
13884 !! end
13885
13886 !! test
13887 pre-save transform: context links ("pipe trick") with interwiki prefix
13888 !! options
13889 pst
13890 !! wikitext
13891 [[interwiki:Article|]]
13892 [[:interwiki:Article|]]
13893 [[interwiki:Bar:Article|]]
13894 [[:interwiki:Bar:Article|]]
13895 !! html/php
13896 [[interwiki:Article|Article]]
13897 [[:interwiki:Article|Article]]
13898 [[interwiki:Bar:Article|Bar:Article]]
13899 [[:interwiki:Bar:Article|Bar:Article]]
13900 !! end
13901
13902 !! test
13903 pre-save transform: context links ("pipe trick") with parens in title
13904 !! options
13905 pst title=[[Somearticle (context)]]
13906 !! wikitext
13907 [[|Article]]
13908 !! html/php
13909 [[Article (context)|Article]]
13910 !! end
13911
13912 !! test
13913 pre-save transform: context links ("pipe trick") with comma in title
13914 !! options
13915 pst title=[[Someplace, Somewhere]]
13916 !! wikitext
13917 [[|Otherplace]]
13918 [[Otherplace, Elsewhere|]]
13919 [[Otherplace, Elsewhere, Anywhere|]]
13920 !! html/php
13921 [[Otherplace, Somewhere|Otherplace]]
13922 [[Otherplace, Elsewhere|Otherplace]]
13923 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13924 !! end
13925
13926 !! test
13927 pre-save transform: context links ("pipe trick") with parens and comma
13928 !! options
13929 pst title=[[Someplace (IGNORED), Somewhere]]
13930 !! wikitext
13931 [[|Otherplace]]
13932 [[Otherplace (place), Elsewhere|]]
13933 !! html/php
13934 [[Otherplace, Somewhere|Otherplace]]
13935 [[Otherplace (place), Elsewhere|Otherplace]]
13936 !! end
13937
13938 !! test
13939 pre-save transform: context links ("pipe trick") with comma and parens
13940 !! options
13941 pst title=[[Who, me? (context)]]
13942 !! wikitext
13943 [[|Yes, you.]]
13944 [[Me, Myself, and I (1937 song)|]]
13945 !! html/php
13946 [[Yes, you. (context)|Yes, you.]]
13947 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13948 !! end
13949
13950 !! test
13951 pre-save transform: context links ("pipe trick") with namespace
13952 !! options
13953 pst title=[[Ns:Somearticle]]
13954 !! wikitext
13955 [[|Article]]
13956 !! html/php
13957 [[Ns:Article|Article]]
13958 !! end
13959
13960 !! test
13961 pre-save transform: context links ("pipe trick") with namespace and parens
13962 !! options
13963 pst title=[[Ns:Somearticle (context)]]
13964 !! wikitext
13965 [[|Article]]
13966 !! html/php
13967 [[Ns:Article (context)|Article]]
13968 !! end
13969
13970 !! test
13971 pre-save transform: context links ("pipe trick") with namespace and comma
13972 !! options
13973 pst title=[[Ns:Somearticle, Context, Whatever]]
13974 !! wikitext
13975 [[|Article]]
13976 !! html/php
13977 [[Ns:Article, Context, Whatever|Article]]
13978 !! end
13979
13980 !! test
13981 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13982 !! options
13983 pst title=[[Ns:Somearticle, Context (context)]]
13984 !! wikitext
13985 [[|Article]]
13986 !! html/php
13987 [[Ns:Article (context)|Article]]
13988 !! end
13989
13990 !! test
13991 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13992 !! options
13993 pst title=[[Ns:Somearticle (IGNORED), Context]]
13994 !! wikitext
13995 [[|Article]]
13996 !! html/php
13997 [[Ns:Article, Context|Article]]
13998 !! end
13999
14000 !! test
14001 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
14002 !! options
14003 pst
14004 !! wikitext
14005 [[Article(context)|]]
14006 [[Bar:Article(context)|]]
14007 [[:Bar:Article(context)|]]
14008 [[|Article(context)]]
14009 [[Bar:X(Y)Z|]]
14010 [[:Bar:X(Y)Z|]]
14011 !! html/php
14012 [[Article(context)|Article]]
14013 [[Bar:Article(context)|Article]]
14014 [[:Bar:Article(context)|Article]]
14015 [[Article(context)]]
14016 [[Bar:X(Y)Z|X(Y)Z]]
14017 [[:Bar:X(Y)Z|X(Y)Z]]
14018 !! end
14019
14020 !! test
14021 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
14022 !! options
14023 pst
14024 !! wikitext
14025 [[Article (context)|]]
14026 [[Bar:Article (context)|]]
14027 [[:Bar:Article (context)|]]
14028 [[|Article (context)]]
14029 [[Bar:X (Y) Z|]]
14030 [[:Bar:X (Y) Z|]]
14031 !! html/php
14032 [[Article (context)|Article]]
14033 [[Bar:Article (context)|Article]]
14034 [[:Bar:Article (context)|Article]]
14035 [[Article (context)]]
14036 [[Bar:X (Y) Z|X (Y) Z]]
14037 [[:Bar:X (Y) Z|X (Y) Z]]
14038 !! end
14039
14040 !! test
14041 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
14042 !! options
14043 pst
14044 !! wikitext
14045 [[Article(context)|]]
14046 [[Bar:Article(context)|]]
14047 [[:Bar:Article(context)|]]
14048 [[|Article(context)]]
14049 [[Bar:X(Y)Z|]]
14050 [[:Bar:X(Y)Z|]]
14051 !! html/php
14052 [[Article(context)|Article]]
14053 [[Bar:Article(context)|Article]]
14054 [[:Bar:Article(context)|Article]]
14055 [[Article(context)]]
14056 [[Bar:X(Y)Z|X(Y)Z]]
14057 [[:Bar:X(Y)Z|X(Y)Z]]
14058 !! end
14059
14060 !! test
14061 pre-save transform: context links ("pipe trick") with commas (T23660)
14062 !! options
14063 pst
14064 !! wikitext
14065 [[Article (context), context|]]
14066 [[Article (context),context|]]
14067 [[Bar:Article (context), context|]]
14068 [[Bar:Article (context),context|]]
14069 [[:Bar:Article (context), context|]]
14070 [[:Bar:Article (context),context|]]
14071 !! html/php
14072 [[Article (context), context|Article]]
14073 [[Article (context),context|Article]]
14074 [[Bar:Article (context), context|Article]]
14075 [[Bar:Article (context),context|Article]]
14076 [[:Bar:Article (context), context|Article]]
14077 [[:Bar:Article (context),context|Article]]
14078 !! end
14079
14080 !! test
14081 Parsoid: backwards pipe trick
14082 !! wikitext
14083 [[|'''bar''']]
14084 !! html/php
14085 <p>[[|<b>bar</b>]]
14086 </p>
14087 !! html/parsoid
14088 <p>[[|<b>bar</b>]]</p>
14089 !! end
14090
14091 !! test
14092 pre-save transform: trim trailing empty lines
14093 !! options
14094 pst
14095 !! wikitext
14096 Empty lines are trimmed
14097
14098
14099
14100
14101 !! html/php
14102 Empty lines are trimmed
14103 !! end
14104
14105 !! test
14106 pre-save transform: Signature expansion
14107 !! options
14108 pst
14109 !! wikitext
14110 * ~~~
14111 * ~~~~
14112 * ~~~~~
14113 * <noinclude>~~~</noinclude>
14114 * <includeonly>~~~</includeonly>
14115 * <onlyinclude>~~~</onlyinclude>
14116 !! html/php
14117 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
14118 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14119 * 00:02, 1 January 1970 (UTC)
14120 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
14121 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
14122 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
14123 !! end
14124
14125
14126 !! test
14127 ParserOutput flags from signature expansion (T84843)
14128 !! options
14129 pst
14130 showflags
14131 !! wikitext
14132 ~~~~
14133 !! html/php
14134 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14135 flags=user-signature
14136 !! end
14137
14138
14139 !! test
14140 pre-save transform: Signature expansion in nowiki tags (T2093)
14141 !! options
14142 pst disabled
14143 !! wikitext
14144 Shall not expand:
14145
14146 <nowiki>~~~~</nowiki>
14147
14148 <includeonly><nowiki>~~~~</nowiki></includeonly>
14149
14150 <noinclude><nowiki>~~~~</nowiki></noinclude>
14151
14152 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14153
14154 {{subst:Foo}} shall be converted to FOO
14155
14156 As well as inside noinclude/onlyinclude
14157 <noinclude>{{subst:Foo}}</noinclude>
14158 <onlyinclude>{{subst:Foo}}</onlyinclude>
14159
14160 But not inside includeonly
14161 <includeonly>{{subst:Foo}}</includeonly>
14162 !! html/php
14163 Shall not expand:
14164
14165 <nowiki>~~~~</nowiki>
14166
14167 <includeonly><nowiki>~~~~</nowiki></includeonly>
14168
14169 <noinclude><nowiki>~~~~</nowiki></noinclude>
14170
14171 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14172
14173 FOO shall be converted to FOO
14174
14175 As well as inside noinclude/onlyinclude
14176 <noinclude>FOO</noinclude>
14177 <onlyinclude>FOO</onlyinclude>
14178
14179 But not inside includeonly
14180 <includeonly>{{subst:Foo}}</includeonly>
14181 !! end
14182
14183 !! test
14184 Parsoid: Recognize nowiki with trailing space in tags
14185 !! options
14186 parsoid=wt2html
14187 !! wikitext
14188 <nowiki ><div>[[foo]]</nowiki >
14189
14190 a<nowiki / >b
14191
14192 c<nowiki />d
14193
14194 e<nowiki/ >f
14195 !! html
14196 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14197 <p>ab</p>
14198 <p>cd</p>
14199 <p>ef</p>
14200 !! end
14201
14202 !! test
14203 Parsoid: Recognize nowiki with odd capitalization
14204 !! options
14205 parsoid=wt2html
14206 !! wikitext
14207 <noWikI ><div>[[foo]]</Nowiki >
14208 !! html
14209 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14210 !! end
14211
14212
14213 !! test
14214 Parsoid: Escape nowiki with trailing space in tags
14215 !! options
14216 parsoid=html2wt
14217 !! html/parsoid
14218 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14219 <p>a&lt;nowiki /&gt;b</p>
14220 <p>c&lt;nowiki/ &gt;d</p>
14221 !! wikitext
14222 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14223
14224 a&lt;nowiki /&gt;b
14225
14226 c&lt;nowiki/ &gt;d
14227 !! end
14228
14229 !! test
14230 Parsoid: Escape weird noWikI capitalizations
14231 !! options
14232 parsoid=html2wt
14233 !! html/parsoid
14234 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14235 !! wikitext
14236 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14237 !! end
14238
14239 ###
14240 ### Message transform tests
14241 ###
14242 !! test
14243 message transform: magic variables
14244 !! options
14245 msg
14246 !! wikitext
14247 {{SITENAME}}
14248 !! html
14249 MediaWiki
14250 !! end
14251
14252 !! test
14253 message transform: should not transform wiki markup
14254 !! options
14255 msg
14256 !! wikitext
14257 ''test''
14258 !! html
14259 ''test''
14260 !! end
14261
14262 !! test
14263 message transform: <noinclude> in transcluded template (T6926)
14264 !! options
14265 msg
14266 !! wikitext
14267 {{Includes}}
14268 !! html
14269 Foobar
14270 !! end
14271
14272 !! test
14273 message transform: <onlyinclude> in transcluded template (T6926)
14274 !! options
14275 msg
14276 !! wikitext
14277 {{Includes2}}
14278 !! html
14279 Foo
14280 !! end
14281
14282 !! test
14283 {{#special:}} page name, known
14284 !! options
14285 msg
14286 !! wikitext
14287 {{#special:Recentchanges}}
14288 !! html
14289 Special:RecentChanges
14290 !! end
14291
14292 !! test
14293 {{#special:}} page name with subpage, known
14294 !! options
14295 msg
14296 !! wikitext
14297 {{#special:Recentchanges/param}}
14298 !! html
14299 Special:RecentChanges/param
14300 !! end
14301
14302 !! test
14303 {{#special:}} page name, unknown
14304 !! options
14305 msg
14306 !! wikitext
14307 {{#special:foobar nonexistent}}
14308 !! html
14309 Special:Foobar nonexistent
14310 !! end
14311
14312 !! test
14313 {{#speciale:}} page name, known
14314 !! options
14315 msg
14316 !! wikitext
14317 {{#speciale:Recentchanges}}
14318 !! html
14319 Special:RecentChanges
14320 !! end
14321
14322 !! test
14323 {{#speciale:}} page name with subpage, known
14324 !! options
14325 msg
14326 !! wikitext
14327 {{#speciale:Recentchanges/param}}
14328 !! html
14329 Special:RecentChanges/param
14330 !! end
14331
14332 !! test
14333 {{#speciale:}} page name, unknown
14334 !! options
14335 msg
14336 !! wikitext
14337 {{#speciale:foobar nonexistent}}
14338 !! html
14339 Special:Foobar_nonexistent
14340 !! end
14341
14342 ###
14343 ### Images
14344 ###
14345 ### For Parsoid-specific tests, see
14346 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14347
14348 !! test
14349 Simple image
14350 !! options
14351 parsoid=wt2html,wt2wt,html2html
14352 !! wikitext
14353 [[Image:foobar.jpg]]
14354 !! html/php
14355 <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>
14356 </p>
14357 !! html/parsoid
14358 <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>
14359 !! end
14360
14361 !! test
14362 Serialize simple image with span wrapper
14363 !! options
14364 parsoid=html2wt
14365 !! html/parsoid
14366 <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>
14367 !! wikitext
14368 [[File:Foobar.jpg]]
14369 !! end
14370
14371 !! test
14372 Simple image (using File: namespace, now canonical)
14373 !! wikitext
14374 [[File:Foobar.jpg]]
14375 !! html/php
14376 <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>
14377 </p>
14378 !! html/parsoid
14379 <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>
14380 !! end
14381
14382 !! test
14383 Right-aligned image
14384 !! wikitext
14385 [[File:Foobar.jpg|right]]
14386 !! html/php
14387 <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>
14388
14389 !! html/parsoid
14390 <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>
14391 !! end
14392
14393 !! test
14394 Image with caption
14395 !! wikitext
14396 [[File:Foobar.jpg|right|Caption text]]
14397 !! html/php
14398 <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>
14399
14400 !! html/parsoid
14401 <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>
14402 !! end
14403
14404 !! test
14405 Image with caption, T55312 #1
14406 !! wikitext
14407 [[File:Foobar.jpg|right|Caption page stuff]]
14408 !! html/php
14409 <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>
14410
14411 !! html/parsoid
14412 <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>
14413 !! end
14414
14415 !! test
14416 Image with caption, T55312 #2
14417 !! wikitext
14418 [[File:Foobar.jpg|right|Caption page=]]
14419 !! html/php
14420 <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>
14421
14422 !! html/parsoid
14423 <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>
14424 !! end
14425
14426 !! test
14427 Image with caption, T55312 #3
14428 !! wikitext
14429 [[File:Foobar.jpg|right|Caption page=stuff]]
14430 !! html/php
14431 <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>
14432
14433 !! html/parsoid
14434 <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>
14435 !! end
14436
14437 !! test
14438 Image caption with pipe entity
14439 !! wikitext
14440 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14441 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14442 !! html/php
14443 <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>
14444 <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>
14445
14446 !! html/parsoid
14447 <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>
14448 <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>
14449 !! end
14450
14451 !! test
14452 Allow empty links in image captions (T62753)
14453 !! options
14454 thumbsize=220
14455 !! wikitext
14456 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14457 [[]]
14458 [[Link2]]
14459 ]]
14460 !! html/php
14461 <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>
14462
14463 !! html/parsoid
14464 <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>
14465 [[]]
14466 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14467 </figcaption></figure>
14468 !! end
14469
14470 !! test
14471 Titles in unlinked images (T23454)
14472 !! wikitext
14473 [[File:Foobar.jpg|link=|stuff]]
14474 !! html/php
14475 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14476 </p>
14477 !! html/parsoid
14478 <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>
14479 !! end
14480
14481 !! test
14482 Link with empty target
14483 !! wikitext
14484 [[]]
14485 !! html
14486 <p>[[]]
14487 </p>
14488 !! end
14489
14490 !! test
14491 Image with link trail
14492 !! wikitext
14493 Linktrails should not work for images: [[File:Foobar.jpg]]s
14494 !! html/php
14495 <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
14496 </p>
14497 !! html/parsoid
14498 <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>
14499 !! end
14500
14501 !! test
14502 Image with empty attribute
14503 !! options
14504 parsoid=wt2html,wt2wt,html2html
14505 !! wikitext
14506 [[File:Foobar.jpg|right||Caption text]]
14507 !! html/php
14508 <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>
14509
14510 !! html/parsoid
14511 <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>
14512 !! end
14513
14514 !! test
14515 1. Block image with individual attributes from templates
14516 !! wikitext
14517 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14518 !! html/php
14519 <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>
14520
14521 !! html/parsoid
14522 <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>
14523 !! end
14524
14525 !! test
14526 2. Block Image with individual attributes from templates
14527 !! wikitext
14528 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14529 !! html/php
14530 <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>
14531
14532 !! html/parsoid
14533 <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>
14534 !! end
14535
14536 !! test
14537 3. Inline image with individual attributes from templates
14538 !! wikitext
14539 [[File:Foobar.jpg|{{echo|50px}}]]
14540 !! html/php
14541 <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>
14542 </p>
14543 !! html/parsoid
14544 <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>
14545 !! end
14546
14547 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14548 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14549 !! test
14550 Image with multiple attributes from the same template
14551 !! wikitext
14552 [[File:Foobar.jpg|{{image_attribs}}]]
14553 !! html/php
14554 <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>
14555
14556 !! html/parsoid
14557 <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>
14558 !! end
14559
14560 !! test
14561 Image with link tails
14562 !! options
14563 thumbsize=220
14564 !! wikitext
14565 123[[File:Foobar.jpg]]456
14566 123[[File:Foobar.jpg|right]]456
14567 123[[File:Foobar.jpg|thumb]]456
14568 !! html/php
14569 <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
14570 </p>
14571 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
14572 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
14573
14574 !! html/php+tidy
14575 <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
14576 </p><p>
14577 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
14578 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
14579 </p>
14580 !! html/parsoid
14581 <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>
14582 <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>
14583 <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>
14584 !! end
14585
14586 !! test
14587 Image with multiple captions -- only last one is accepted
14588 !! wikitext
14589 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14590 !! html/php
14591 <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>
14592
14593 !! html/parsoid
14594 <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>
14595 !! end
14596
14597 !! test
14598 Image with multiple widths -- use last
14599 !! wikitext
14600 [[File:Foobar.jpg|200px|300px|caption]]
14601 !! html/php
14602 <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>
14603 </p>
14604 !! html/parsoid
14605 <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>
14606 !! end
14607
14608 !! test
14609 Image with multiple alignments -- use first (T50664)
14610 !! options
14611 thumbsize=220
14612 !! wikitext
14613 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14614
14615 [[File:Foobar.jpg|middle|text-top|caption]]
14616 !! html/php
14617 <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>
14618 <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>
14619 </p>
14620 !! html/parsoid
14621 <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>
14622 <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>
14623 !! end
14624
14625 !! test
14626 Image with width attribute at different positions
14627 !! wikitext
14628 [[File:Foobar.jpg|200px|right|Caption]]
14629 [[File:Foobar.jpg|right|200px|Caption]]
14630 [[File:Foobar.jpg|right|Caption|200px]]
14631 !! html/php
14632 <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>
14633 <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>
14634 <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>
14635
14636 !! html/parsoid
14637 <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>
14638 <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>
14639 <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>
14640 !! end
14641
14642 # a sad bit of backward-compatibility
14643 !! test
14644 Image with size specified with pxpx (T15500, T53628)
14645 !! options
14646 parsoid=wt2html,wt2wt,html2html
14647 !! wikitext
14648 [[File:Foobar.jpg|20pxpx]]
14649 [[File:Foobar.jpg|200x20pxpx]]
14650 !! html/php
14651 <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>
14652 <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>
14653 </p>
14654 !! html/parsoid
14655 <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>
14656 !! end
14657
14658 !! test
14659 Image with link parameter, wiki target
14660 !! wikitext
14661 [[File:Foobar.jpg|link=Main Page]]
14662 !! html/php
14663 <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>
14664 </p>
14665 !! html/parsoid
14666 <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>
14667 !! end
14668
14669 # parsoid T51293 (part 1)
14670 !! test
14671 Image with link parameter, URL target
14672 !! wikitext
14673 [[File:Foobar.jpg|link=http://example.com/]]
14674 !! html/php
14675 <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>
14676 </p>
14677 !! html/parsoid
14678 <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>
14679 !! end
14680
14681 # parsoid T51293 (part 2)
14682 !! test
14683 Image with link parameter, protocol-less URL target
14684 !! wikitext
14685 [[File:Foobar.jpg|link=//example.com/]]
14686 !! html/php
14687 <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>
14688 </p>
14689 !! html/parsoid
14690 <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>
14691 !! end
14692
14693 !! test
14694 Escaping non-block captions (T107435)
14695 !! options
14696 parsoid={
14697 "modes": ["wt2wt"],
14698 "changes": [
14699 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14700 ]
14701 }
14702 !! wikitext
14703 [[Image:Foobar.jpg|caption]]
14704 !! wikitext/edited
14705 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14706 !! end
14707
14708 # wgExternalLinkTarget not supported by Parsoid
14709 !! test
14710 Image with link parameter, wgExternalLinkTarget
14711 !! wikitext
14712 [[Image:foobar.jpg|link=http://example.com/]]
14713 !! config
14714 wgExternalLinkTarget='foobar'
14715 !! html/php
14716 <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>
14717 </p>
14718 !! end
14719
14720 !! test
14721 Image with link parameter, wgNoFollowLinks set to false
14722 !! wikitext
14723 [[Image:foobar.jpg|link=http://example.com/]]
14724 !! config
14725 wgNoFollowLinks=false
14726 !! html/php
14727 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14728 </p>
14729 !! end
14730
14731 !! test
14732 Image with link parameter, wgNoFollowDomainExceptions
14733 !! wikitext
14734 [[Image:foobar.jpg|link=http://example.com/]]
14735 !! config
14736 wgNoFollowDomainExceptions='example.com'
14737 !! html/php
14738 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14739 </p>
14740 !! end
14741
14742 # wgExternalLinkTarget not supported by Parsoid
14743 !! test
14744 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14745 !! wikitext
14746 [[Image:foobar.jpg|link=http://example.com/|Title]]
14747 !! config
14748 wgExternalLinkTarget='foobar'
14749 !! html/php
14750 <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>
14751 </p>
14752 !! end
14753
14754 !! test
14755 Image with empty link parameter
14756 !! wikitext
14757 [[File:Foobar.jpg|link=]]
14758 !! html/php
14759 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14760 </p>
14761 !! html/parsoid
14762 <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>
14763 !! end
14764
14765 !! test
14766 Image with link parameter (wiki target) and unnamed parameter
14767 !! wikitext
14768 [[File:Foobar.jpg|link=Main_Page|Title]]
14769 !! html/php
14770 <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>
14771 </p>
14772 !! html/parsoid
14773 <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>
14774 !! end
14775
14776 !! test
14777 Image with link parameter (URL target) and unnamed parameter
14778 !! wikitext
14779 [[File:Foobar.jpg|link=http://example.com/|Title]]
14780 !! html/php
14781 <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>
14782 </p>
14783 !! html/parsoid
14784 <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>
14785 !! end
14786
14787 !! test
14788 Thumbnail image with link parameter
14789 !! options
14790 thumbsize=220
14791 parsoid=wt2html,wt2wt,html2html
14792 !! wikitext
14793 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14794 !! html/php
14795 <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>
14796
14797 !! html/parsoid
14798 <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>
14799 !! end
14800
14801 !! test
14802 Manually-specified thumbnail image
14803 !! options
14804 thumbsize=220
14805 !! wikitext
14806 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14807 !! html/php
14808 <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>
14809
14810 !! html/parsoid
14811 <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>
14812 !! end
14813
14814 !! test
14815 Manually-specified thumbnail image with explicit link to wiki page
14816 !! options
14817 thumbsize=220
14818 parsoid=wt2html,wt2wt,html2html
14819 !! wikitext
14820 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14821 !! html/php
14822 <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>
14823
14824 !! html/parsoid
14825 <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>
14826 !! end
14827
14828 !! test
14829 Manually-specified thumbnail image with explicit link to url
14830 !! options
14831 thumbsize=220
14832 parsoid=wt2html,wt2wt,html2html
14833 !! wikitext
14834 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14835 !! html/php
14836 <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>
14837
14838 !! html/parsoid
14839 <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>
14840 !! end
14841
14842 !! test
14843 Manually-specified thumbnail image with explicit no link
14844 !! options
14845 thumbsize=220
14846 parsoid=wt2html,wt2wt,html2html
14847 !! wikitext
14848 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14849 !! html/php
14850 <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>
14851
14852 !! html/parsoid
14853 <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>
14854 !! end
14855
14856 !! test
14857 Manually-specified thumbnail image with explicit link and alt text
14858 !! options
14859 thumbsize=220
14860 parsoid=wt2html,wt2wt,html2html
14861 !! wikitext
14862 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14863 !! html/php
14864 <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>
14865
14866 !! html/parsoid
14867 <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>
14868 !! end
14869
14870 !! test
14871 Image with frame and link
14872 !! options
14873 parsoid=wt2html,wt2wt,html2html
14874 !! wikitext
14875 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14876 !! html/php
14877 <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>
14878
14879 !! html/parsoid
14880 <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>
14881 !! end
14882
14883 !! test
14884 Image with frame and link and explicit alt
14885 !! options
14886 parsoid=wt2html,wt2wt,html2html
14887 !! wikitext
14888 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14889 !! html/php
14890 <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>
14891
14892 !! html/parsoid
14893 <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>
14894 !! end
14895
14896 !! test
14897 Image with wiki markup in implicit alt
14898 !! wikitext
14899 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14900
14901 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14902 !! html/php
14903 <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>
14904 </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>
14905 </p>
14906 !! html/parsoid
14907 <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>
14908
14909 <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>
14910 !! end
14911
14912 !! test
14913 Alt image option should handle most kinds of wikitext without barfing
14914 !! wikitext
14915 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14916 !! html/php
14917 <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>
14918
14919 !! html/parsoid
14920 <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>
14921 !! end
14922
14923 !! test
14924 Image with table with attributes in caption
14925 !! options
14926 parsoid=wt2html,html2html
14927 !! wikitext
14928 [[File:Foobar.jpg|thumb|
14929 {| class="123" |
14930 |- class="456" |
14931 | ha
14932 |}
14933 ]]
14934 !! html/parsoid
14935 <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>
14936 <table class="123">
14937 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
14938 <td> ha</td></tr>
14939 </tbody></table>
14940 </figcaption></figure>
14941 !! end
14942
14943 !! test
14944 Image with table with rows from templates in caption
14945 !! wikitext
14946 [[File:Foobar.jpg|thumb|
14947 {|
14948 {{echo|{{!}} hi}}
14949 |}
14950 ]]
14951 !! html/parsoid
14952 <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>
14953 <table>
14954 <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>
14955 </tbody></table>
14956 </figcaption></figure>
14957 !! end
14958
14959 !! test
14960 Image with nested tables in caption
14961 !! wikitext
14962 [[File:Foobar.jpg|thumb|Foo<br />
14963 {|
14964 |
14965 {|
14966 |z
14967 |}
14968 |}
14969 ]]
14970 !! html/parsoid
14971 <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}'/>
14972 <table>
14973 <tbody><tr><td>
14974 <table>
14975 <tbody><tr><td>z</td></tr>
14976 </tbody></table></td></tr>
14977 </tbody></table>
14978 </figcaption></figure>
14979 !! end
14980
14981 !! test
14982 Image with heading and horizontal rule in caption
14983 !! wikitext
14984 [[File:Foobar.jpg|thumb|
14985 ===Testing===
14986 123
14987 --------------
14988 ]]
14989 !! html/php
14990 <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>
14991
14992 !! html/parsoid
14993 <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>
14994 <h3 id="Testing">Testing</h3>
14995 123
14996 <hr data-parsoid='{"extra_dashes":10}'/>
14997 </figcaption></figure>
14998 !! end
14999
15000 ###################
15001 # Conflicting image format options.
15002 # First option specified should 'win'.
15003 # All three cases in each test should be identical.
15004
15005 !! test
15006 Image with 'frameless' first.
15007 !! options
15008 parsoid=wt2html,wt2wt,html2html
15009 !! wikitext
15010 [[File:Foobar.jpg|frameless|caption]]
15011
15012 [[File:Foobar.jpg|frameless|frame|caption]]
15013
15014 [[File:Foobar.jpg|frameless|thumb|caption]]
15015 !! html/php
15016 <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>
15017 </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>
15018 </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>
15019 </p>
15020 !! html/parsoid
15021 <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>
15022 <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>
15023 <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>
15024 !! end
15025
15026 !! test
15027 Image with 'frame' first.
15028 !! options
15029 parsoid=wt2html,wt2wt,html2html
15030 !! wikitext
15031 [[File:Foobar.jpg|frame|caption]]
15032 [[File:Foobar.jpg|frame|frameless|caption]]
15033 [[File:Foobar.jpg|frame|thumb|caption]]
15034 !! html/php
15035 <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>
15036 <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>
15037 <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>
15038
15039 !! html/parsoid
15040 <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>
15041 <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>
15042 <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>
15043 !! end
15044
15045 !! test
15046 Image with 'thumb' first.
15047 !! options
15048 parsoid=wt2html,wt2wt,html2html
15049 !! wikitext
15050 [[File:Foobar.jpg|thumb|caption]]
15051 [[File:Foobar.jpg|thumb|frameless|caption]]
15052 [[File:Foobar.jpg|thumb|frame|caption]]
15053 !! html/php
15054 <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>
15055 <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>
15056 <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>
15057
15058 !! html/parsoid
15059 <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>
15060 <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>
15061 <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>
15062 !! end
15063
15064 ###################
15065 # Image sizing.
15066 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
15067 # and https://phabricator.wikimedia.org/T64258
15068 # Foobar has actual size of 1941x220
15069 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
15070 # a scalable format.
15071 # 2. Framed images always ignore size options; always render at default size.
15072 # 3. "Unspecified format" and border are the only types which can be
15073 # enlarged.
15074
15075 !! test
15076 Image: unspecified format and border enlarge
15077 !! options
15078 parsoid=wt2html,wt2wt,html2html
15079 !! wikitext
15080 [[File:Foobar.jpg|2000px]]
15081
15082 [[File:Foobar.jpg|border|2000px]]
15083 !! html/php
15084 <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>
15085 </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>
15086 </p>
15087 !! html/parsoid
15088 <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>
15089 <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>
15090 !! end
15091
15092 !! test
15093 Image: "unspecified format" and border reduce
15094 !! options
15095 parsoid=wt2html,wt2wt,html2html
15096 !! wikitext
15097 [[File:Foobar.jpg|1000px]]
15098
15099 [[File:Foobar.jpg|border|1000px]]
15100 !! html/php
15101 <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>
15102 </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>
15103 </p>
15104 !! html/parsoid
15105 <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>
15106 <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>
15107 !! end
15108
15109 !! test
15110 Image: thumbs reduce
15111 !! options
15112 parsoid=wt2html,wt2wt,html2html
15113 !! wikitext
15114 [[File:Foobar.jpg|thumb|50px]]
15115 !! html/php
15116 <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>
15117
15118 !! html/parsoid
15119 <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>
15120 !! end
15121
15122 !! test
15123 Image: bitmap thumbs can't be enlarged past original size, but vector can.
15124 !! options
15125 parsoid=wt2html,wt2wt,html2html
15126 !! wikitext
15127 [[File:Foobar.jpg|thumb|2000px]]
15128
15129 [[File:Foobar.svg|thumb|2000px]]
15130 !! html/php
15131 <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>
15132 <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>
15133
15134 !! html/parsoid
15135 <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>
15136 <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>
15137 !! end
15138
15139 !! test
15140 Image: frameless can reduce in size
15141 !! options
15142 parsoid=wt2html,wt2wt,html2html
15143 !! wikitext
15144 [[File:Foobar.jpg|frameless|50px]]
15145 !! html/php
15146 <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>
15147 </p>
15148 !! html/parsoid
15149 <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>
15150 !! end
15151
15152 !! test
15153 Image: bitmap frameless can't be enlarged past original size, but vector can
15154 !! options
15155 parsoid=wt2html,wt2wt,html2html
15156 !! wikitext
15157 [[File:Foobar.jpg|frameless|2000px]]
15158
15159 [[File:Foobar.svg|frameless|2000px]]
15160 !! html/php
15161 <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>
15162 </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>
15163 </p>
15164 !! html/parsoid
15165 <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>
15166 <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>
15167 !! end
15168
15169 !! test
15170 Image: framed images are always unscaled.
15171 !! options
15172 parsoid=wt2html,wt2wt,html2html
15173 !! wikitext
15174 [[File:Foobar.jpg|frame]]
15175
15176 [[File:Foobar.jpg|frame|50px]]
15177
15178 [[File:Foobar.jpg|frame|50x50px]]
15179
15180 [[File:Foobar.jpg|frame|2000px]]
15181 !! html/php
15182 <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>
15183 <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>
15184 <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>
15185 <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>
15186
15187 !! html/parsoid
15188 <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>
15189 <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>
15190 <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>
15191 <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>
15192 !! end
15193
15194 ###################
15195
15196 !! test
15197 Link to image page- image page normally doesn't exists, hence edit link
15198 Add test with existing image page
15199 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
15200 !! wikitext
15201 [[:Image:test]]
15202 !! html
15203 <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>
15204 </p>
15205 !! end
15206
15207 !! test
15208 T20784 Link to non-existent image page with caption should use caption as link text
15209 !! wikitext
15210 [[:Image:test|caption]]
15211 !! html
15212 <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>
15213 </p>
15214 !! end
15215
15216 !! test
15217 Frameless image caption with a free URL
15218 !! wikitext
15219 [[File:Foobar.jpg|http://example.com]]
15220 !! html/php
15221 <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>
15222 </p>
15223 !! html/parsoid
15224 <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>
15225 !! end
15226
15227 !! test
15228 Thumbnail image caption with a free URL
15229 !! options
15230 thumbsize=220
15231 !! wikitext
15232 [[File:Foobar.jpg|thumb|http://example.com]]
15233 !! html/php
15234 <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>
15235
15236 !! html/parsoid
15237 <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>
15238 !! end
15239
15240 !! test
15241 Thumbnail image caption with a free URL and explicit alt
15242 !! options
15243 thumbsize=220
15244 parsoid=wt2html,wt2wt,html2html
15245 !! wikitext
15246 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15247 !! html/php
15248 <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>
15249
15250 !! html/parsoid
15251 <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>
15252 !! end
15253
15254 !! test
15255 SVG thumbnails with no language set
15256 !! options
15257 !! wikitext
15258 [[File:Foobar.svg|thumb|caption]]
15259 !! html/php
15260 <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>
15261
15262 !! html/parsoid
15263 <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>
15264 !! end
15265
15266 !! test
15267 SVG thumbnails with language de
15268 !! options
15269 parsoid=wt2html,wt2wt,html2html
15270 !! wikitext
15271 [[File:Foobar.svg|thumb|caption|lang=de]]
15272 !! html/php
15273 <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>
15274
15275 !! html/parsoid
15276 <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>
15277 !! end
15278
15279 !! test
15280 SVG thumbnails with invalid language code
15281 !! options
15282 parsoid=wt2html,wt2wt,html2html
15283 !! wikitext
15284 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15285 !! html/php
15286 <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>
15287
15288 !! html/parsoid
15289 <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>
15290 !! end
15291
15292 !! test
15293 T3887: A ISBN with a thumbnail
15294 !! wikitext
15295 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15296 !! html/php
15297 <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>
15298
15299 !! html/parsoid
15300 <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>
15301 !! end
15302
15303 !! test
15304 T3887: A RFC with a thumbnail
15305 !! wikitext
15306 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15307 !! html/php
15308 <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>
15309
15310 !! html/parsoid
15311 <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>
15312 !! end
15313
15314 !! test
15315 T3887: A mailto link with a thumbnail
15316 !! wikitext
15317 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15318 !! html/php
15319 <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>
15320
15321 !! html/parsoid
15322 <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>
15323 !! end
15324
15325 # Pending resolution to T2368
15326 !! test
15327 T2648: Frameless image caption with a link
15328 !! wikitext
15329 [[File:Foobar.jpg|text with a [[link]] in it]]
15330 !! html/php
15331 <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>
15332 </p>
15333 !! html/parsoid
15334 <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>
15335 !! end
15336
15337 !! test
15338 T2648: Frameless image caption with a link (suffix)
15339 !! wikitext
15340 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15341 !! html/php
15342 <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>
15343 </p>
15344 !! html/parsoid
15345 <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>
15346 !! end
15347
15348 !! test
15349 T2648: Frameless image caption with an interwiki link
15350 !! wikitext
15351 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15352 !! html/php
15353 <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>
15354 </p>
15355 !! html/parsoid
15356 <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>
15357 !! end
15358
15359 !! test
15360 T2648: Frameless image caption with a piped interwiki link
15361 !! wikitext
15362 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15363 !! html/php
15364 <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>
15365 </p>
15366 !! html/parsoid
15367 <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>
15368 !! end
15369
15370 !! test
15371 T107474: Frameless image caption with <nowiki>
15372 !! wikitext
15373 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15374 !! html/parsoid
15375 <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>
15376 !! end
15377
15378 !! test
15379 Escape HTML special chars in image alt text
15380 !! wikitext
15381 [[File:Foobar.jpg|& < > "]]
15382 !! html/php
15383 <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>
15384 </p>
15385 !! html/parsoid
15386 <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>
15387 !! end
15388
15389 !! test
15390 Escape HTML special chars in image alt text with LanguageConverter
15391 !! options
15392 language=zh
15393 !! wikitext
15394 [[File:Foobar.jpg|& < > "]]
15395 !! html/php
15396 <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>
15397 </p>
15398 !! html/parsoid
15399 <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>
15400 !! end
15401
15402 !! test
15403 Entities in file name and attributes
15404 !! wikitext
15405 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15406 !! html/php
15407 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15408 </p>
15409 !! html/parsoid
15410 <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>
15411 !! end
15412
15413 !! test
15414 T2499: Alt text should have &#1234;, not &amp;1234;
15415 !! wikitext
15416 [[File:Foobar.jpg|&#9792;]]
15417 !! html/php
15418 <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>
15419 </p>
15420 !! html/parsoid
15421 <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>
15422 !! end
15423
15424 !! test
15425 Broken image caption with link
15426 !! options
15427 parsoid=wt2html,wt2wt,html2html
15428 !! wikitext
15429 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15430 !! html/php
15431 <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.
15432 </p>
15433 !! html/parsoid
15434 <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>
15435 !! end
15436
15437 !! test
15438 Image caption containing another image
15439 !! wikitext
15440 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15441 !! html/php
15442 <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>
15443
15444 !! html/parsoid
15445 <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>
15446 !! end
15447
15448 !! test
15449 Image: caption containing a newline
15450 !! wikitext
15451 [[File:Foobar.jpg|This
15452 *is some text]]
15453 !! html/php
15454 <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>
15455 </p>
15456 !! html/parsoid
15457 <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>
15458 !!end
15459
15460 !!test
15461 Image: caption containing leading space
15462 (The leading space should not trigger nowiki escaping in wt2wt mode)
15463 !! wikitext
15464 [[File:Foobar.jpg|thumb| bar]]
15465 !! html/php
15466 <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>
15467
15468 !! html/parsoid
15469 <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>
15470 !!end
15471
15472 # html/php output not have newlines after table, td, th, etc. because
15473 # Linker::makeThumbLink2() replaces the newlines with spaces since
15474 # the table is inside a caption.
15475 # FIXME: Verify if that circa 2004 fix is still required.
15476 !! test
15477 Image: caption containing a table
15478 !! options
15479 parsoid=wt2html,wt2wt,html2html
15480 !! wikitext
15481 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15482 {|
15483 !Foo!!Bar
15484 |-
15485 |Foo1||Bar1
15486 |}
15487 and some more text.]]
15488 !! html/php
15489 <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>
15490
15491 !! html/parsoid
15492 <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
15493 <table>
15494 <tbody>
15495 <tr><th>Foo</th><th>Bar</th></tr>
15496 <tr>
15497 <td>Foo1</td>
15498 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15499 !! end
15500
15501 !! test
15502 T5090: External links other than http: in image captions
15503 !! wikitext
15504 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15505 !! html/php
15506 <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>
15507
15508 !! html/parsoid
15509 <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>
15510 !! end
15511
15512 !! test
15513 Custom class
15514 !! options
15515 parsoid=wt2html,wt2wt,html2html
15516 !! wikitext
15517 [[Image:foobar.jpg|a|class=b]]
15518 !! html/php
15519 <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>
15520 </p>
15521 !! html/parsoid
15522 <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>
15523 !! end
15524
15525 !! test
15526 Localized image handling (1).
15527 !! options
15528 parsoid=wt2html,wt2wt,html2html
15529 language=es
15530 !! wikitext
15531 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15532 !! html/php
15533 <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>
15534
15535 !! html/parsoid
15536 <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>
15537 !! end
15538
15539 !! test
15540 Localized image handling (2).
15541 !! options
15542 thumbsize=220
15543 parsoid=wt2html,wt2wt,html2html
15544 language=es
15545 !! wikitext
15546 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15547 !! html/php
15548 <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>
15549
15550 !! html/parsoid
15551 <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>
15552 !! end
15553
15554 !! test
15555 Localized image handling (3).
15556 !! options
15557 language=fa
15558 parsoid=html2wt
15559 !! html/parsoid
15560 <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>
15561 !! wikitext
15562 [[File:Foobar.jpg|بندانگشتی]]
15563 !! end
15564
15565 !! test
15566 "border", "frameless" and "class" attributes on an image.
15567 !! options
15568 thumbsize=220
15569 parsoid=wt2html,wt2wt,html2html
15570 !! wikitext
15571 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15572 !! html/php
15573 <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>
15574 </p>
15575 !! html/parsoid
15576 <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>
15577 !! end
15578
15579 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15580 !! test
15581 Invalid image attributes (T64500)
15582 !! options
15583 thumbsize=220
15584 parsoid=wt2html,wt2wt,html2html
15585 !! wikitext
15586 [[File:Foobar.jpg|thumb|float|left|caption]]
15587
15588 [[File:Foobar.jpg|thumb|righ|caption]]
15589
15590 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15591 !! html/php
15592 <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>
15593 <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>
15594 <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>
15595
15596 !! html/parsoid
15597 <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>
15598 <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>
15599 <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>
15600 !! end
15601
15602 !! article
15603 File:Barfoo.jpg
15604 !! text
15605 #REDIRECT [[File:Barfoo.jpg]]
15606 !! endarticle
15607
15608 # FIXME: Parsoid should run this test -- but we'd need to teach the
15609 # mockAPI about the redirected Barfoo.jpg image.
15610 !! test
15611 Redirected image
15612 !! wikitext
15613 [[Image:Barfoo.jpg]]
15614 !! html/php
15615 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15616 </p>
15617 !! end
15618
15619 !! test
15620 Missing image with uploads disabled
15621 !! options
15622 wgEnableUploads=0
15623 !! wikitext
15624 [[File:Foobaz.jpg]]
15625 !! html/php
15626 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15627 </p>
15628 !! html/parsoid
15629 <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>
15630 !! end
15631
15632 # Parsoid-specific testing for images
15633 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15634 # Currently imperfect due to a flaw in the Parsoid testrunner
15635 # Work in progress
15636 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15637 # image tests.
15638
15639 !! test
15640 Parsoid-specific image handling - simple image with size and middle alignment
15641 !! wikitext
15642 [[File:Foobar.jpg|middle|50px]]
15643 !! html/parsoid
15644 <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>
15645 !! end
15646
15647 !! test
15648 Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
15649 !! options
15650 parsoid=wt2wt,wt2html,html2html
15651 !! wikitext
15652 [[Image:Foobar.jpg|middle|50px]]
15653 !! html/parsoid
15654 <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>
15655 !! end
15656
15657 !! test
15658 Parsoid-specific image handling - simple image with size and middle alignment (existing content)
15659 !! wikitext
15660 [[File:Foobar.jpg|50px|middle]]
15661 !! html/parsoid
15662 <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>
15663 !! end
15664
15665 !! test
15666 Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
15667 !! options
15668 parsoid=wt2html,wt2wt,html2html
15669 !! wikitext
15670 [[Image:Foobar.jpg|50px|middle]]
15671 !! html/parsoid
15672 <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>
15673 !! end
15674
15675 !! test
15676 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15677 !! wikitext
15678 [[File:Foobar.jpg|500x10px|baseline|caption]]
15679 !! html/parsoid
15680 <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>
15681 !! end
15682
15683 !! test
15684 Parsoid-specific image handling - simple image with border and size spec
15685 !! wikitext
15686 [[File:Foobar.jpg|50px|border|caption]]
15687 !! html/parsoid
15688 <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>
15689 !! end
15690
15691 !! test
15692 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15693 !! options
15694 parsoid=wt2html,html2html
15695 !! wikitext
15696 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15697 !! html/parsoid
15698 <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>
15699 !! end
15700
15701 !! test
15702 Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
15703 !! options
15704 parsoid=wt2html,html2html
15705 !! wikitext
15706 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15707 !! html/parsoid
15708 <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>
15709 !! end
15710
15711 !! test
15712 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15713 !! options
15714 parsoid=wt2html,html2html
15715 !! wikitext
15716 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15717 !! html/parsoid
15718 <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>
15719 !! end
15720
15721 !! test
15722 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
15723 !! options
15724 parsoid=wt2html,html2html
15725 !! wikitext
15726 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15727 !! html/parsoid
15728 <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>
15729 !! end
15730
15731 !! test
15732 Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
15733 !! options
15734 parsoid=wt2html,wt2wt,html2html
15735 !! wikitext
15736 [[File:Foobar.jpg|frame|500x50px|caption]]
15737 !! html/parsoid
15738 <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>
15739 !! end
15740
15741 !! test
15742 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
15743 !! options
15744 parsoid=wt2html,html2html
15745 !! wikitext
15746 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15747 !! html/parsoid
15748 <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>
15749 !! end
15750
15751 !! test
15752 Parsoid-specific image handling - frameless image with specific size, border, and caption
15753 !! wikitext
15754 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15755 !! html/parsoid
15756 <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>
15757 !! end
15758
15759 !! test
15760 Parsoid-specific image handling - simple image with a formatted caption
15761 !! wikitext
15762 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15763 !! html/parsoid
15764 <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>
15765 !! end
15766
15767 !! test
15768 Parsoid-specific image handling - caption with a template in it
15769 !! wikitext
15770 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15771 !! html/parsoid
15772 <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>
15773 !! end
15774
15775 !! test
15776 Parsoid-specific image handling - caption with unbalanced tags in it
15777 !! options
15778 parsoid=wt2html,wt2wt,html2html
15779 !! wikitext
15780 foo
15781 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15782 bar
15783 !! html/parsoid
15784 <p>foo</p>
15785 <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>
15786 <p>bar</p>
15787 !! end
15788
15789 !! test
15790 Parsoid-specific image handling - empty caption (1)
15791 !! options
15792 parsoid=wt2html,wt2wt
15793 !! wikitext
15794 [[File:Foobar.jpg|thumb|]]
15795 !! html/parsoid
15796 <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>
15797 !! end
15798
15799 # empty captions don't get serialized unless we're in the "round trip" case
15800 !! test
15801 Parsoid-specific image handling - empty caption (2)
15802 !! options
15803 parsoid=html2wt
15804 !! html/parsoid
15805 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15806 <a href="./File:Foobar.jpg">
15807 <img resource="./File:Foobar.jpg"
15808 src="//example.com/images/3/3a/Foobar.jpg"
15809 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15810 height="25" width="220"/>
15811 </a>
15812 <figcaption></figcaption>
15813 </figure>
15814 !! wikitext
15815 [[File:Foobar.jpg|thumb]]
15816 !! end
15817
15818 !! test
15819 Parsoid-specific image handling - whitespace caption
15820 !! wikitext
15821 [[File:Foobar.jpg|thumb| ]]
15822 !! html/parsoid
15823 <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>
15824 !! end
15825
15826 !! test
15827 Parsoid-specific image handling - lang option
15828 !! wikitext
15829 foo
15830 [[File:Foobar.svg|lang=de|caption]]
15831 bar
15832 !! html/parsoid
15833 <p>foo
15834 <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>
15835 bar</p>
15836 !! end
15837
15838 ## Edge case bugs in Parsoid from T93580
15839 !! test
15840 T93580: 1. Templated <ref> inside block images
15841 !! wikitext
15842 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15843
15844 <references />
15845 !! html/parsoid
15846 <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>
15847
15848 <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>
15849 !! end
15850
15851 !! test
15852 T93580: 2. <ref> inside inline images
15853 !! wikitext
15854 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15855
15856 <references />
15857 !! html/parsoid
15858 <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>
15859
15860 <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>
15861 !! end
15862
15863 !! test
15864 T93580: 3. Templated <ref> inside inline images
15865 !! wikitext
15866 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15867
15868 <references />
15869 !! html/parsoid
15870 <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>
15871
15872 <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>
15873 !! end
15874
15875 ###
15876 ### Subpages
15877 ###
15878 !! article
15879 Subpage test/subpage
15880 !! text
15881 foo
15882 !! endarticle
15883
15884 !! test
15885 Subpage link
15886 !! options
15887 subpage title=[[Subpage test]]
15888 !! wikitext
15889 [[/subpage]]
15890 !! html
15891 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15892 </p>
15893 !! end
15894
15895 !! test
15896 Subpage noslash link
15897 !! options
15898 subpage title=[[Subpage test]]
15899 !! wikitext
15900 [[/subpage/]]
15901 !! html
15902 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15903 </p>
15904 !! end
15905
15906 !! article
15907 Subpage test/1/2/subpage
15908 !! text
15909 blah
15910 !! endarticle
15911
15912 !! test
15913 Relative subpage noslash link
15914 !! options
15915 parsoid=wt2wt,wt2html,html2html
15916 subpage title=[[Subpage test/1/2/3/4]]
15917 !! wikitext
15918 [[../../subpage/]]
15919
15920 [[../../subpage]]
15921 !! html/php
15922 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15923 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15924 </p>
15925 !! html/parsoid
15926 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15927 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15928 !! end
15929
15930 !! test
15931 Parsoid: dot-slash prefixed wikilinks
15932 !! wikitext
15933 [[./foo]]
15934
15935 [[././bar]]
15936
15937 [[././baz/]]
15938 !! html/php
15939 <p>[[./foo]]
15940 </p><p>[[././bar]]
15941 </p><p>[[././baz/]]
15942 </p>
15943 !! html/parsoid
15944 <p>[[./foo]]
15945 </p><p>[[././bar]]
15946 </p><p>[[././baz/]]
15947 </p>
15948 !! end
15949
15950 !! test
15951 Render invalid page names as plain text (T53090)
15952 !! wikitext
15953 [[./../foo|bar]]
15954 [[foo�|bar]]
15955 [[foo/.|bar]]
15956 [[foo/..|bar]]
15957 [[foo~~~bar]]
15958 [[foo>bar]]
15959 [[foo[bar]]
15960 [[.]]
15961 [[..]]
15962 [[foo././bar]]
15963 [[foo[http://example.com]xyz]]
15964
15965 [[{{echo|./../foo}}|bar]]
15966 [[{{echo|foo/.}}|bar]]
15967 [[{{echo|foo/..}}|bar]]
15968 [[{{echo|foo~~~~bar}}]]
15969 [[{{echo|foo>bar}}]]
15970 [[{{echo|foo././bar}}]]
15971 [[{{echo|foo{bar}}]]
15972 [[{{echo|foo}bar}}]]
15973 [[{{echo|foo[bar}}]]
15974 [[{{echo|foo]bar}}]]
15975 [[{{echo|foo<bar}}]]
15976 !!html/php
15977 <p>[[./../foo|bar]]
15978 [[foo�|bar]]
15979 [[foo/.|bar]]
15980 [[foo/..|bar]]
15981 [[foo~~~bar]]
15982 [[foo&gt;bar]]
15983 [[foo[bar]]
15984 [[.]]
15985 [[..]]
15986 [[foo././bar]]
15987 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15988 </p><p>[[./../foo|bar]]
15989 [[foo/.|bar]]
15990 [[foo/..|bar]]
15991 [[foo~~~~bar]]
15992 [[foo&gt;bar]]
15993 [[foo././bar]]
15994 [[foo{bar]]
15995 [[foo}bar]]
15996 [[foo[bar]]
15997 [[foo]bar]]
15998 [[foo&lt;bar]]
15999 </p>
16000 !!html/parsoid
16001 <p>[[./../foo|bar]]
16002 [[foo�|bar]]
16003 [[foo/.|bar]]
16004 [[foo/..|bar]]
16005 [[foo~~~bar]]
16006 [[foo>bar]]
16007 [[foo[bar]]
16008 [[.]]
16009 [[..]]
16010 [[foo././bar]]
16011 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
16012
16013 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
16014 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
16015 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
16016 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
16017 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
16018 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
16019 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
16020 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
16021 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
16022 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
16023 [[<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>
16024 !!end
16025
16026 !! test
16027 Disabled subpages
16028 !! wikitext
16029 [[/subpage]]
16030 !! html
16031 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
16032 </p>
16033 !! end
16034
16035 !! test
16036 T2561: {{/Subpage}}
16037 !! options
16038 subpage title=[[Page]]
16039 !! wikitext
16040 {{/Subpage}}
16041 !! html
16042 <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>
16043 </p>
16044 !! end
16045
16046 ###
16047 ### Categories
16048 ###
16049 !! article
16050 Category:MediaWiki User's Guide
16051 !! text
16052 blah
16053 !! endarticle
16054
16055 !! test
16056 Link to category
16057 !! wikitext
16058 [[:Category:MediaWiki User's Guide]]
16059 !! html
16060 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
16061 </p>
16062 !! end
16063
16064 !! test
16065 Simple category
16066 !! options
16067 cat
16068 !! wikitext
16069 [[Category:MediaWiki User's Guide]]
16070 !! html/php
16071 cat=MediaWiki_User's_Guide sort=
16072 !! html/parsoid
16073 <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"}}'/>
16074 !! end
16075
16076 !! test
16077 PAGESINCATEGORY invalid title fatal (r33546 fix)
16078 !! wikitext
16079 {{PAGESINCATEGORY:<bogus>}}
16080 !! html
16081 <p>0
16082 </p>
16083 !! end
16084
16085 !! test
16086 Category with different sort key
16087 !! options
16088 cat
16089 !! wikitext
16090 [[Category:MediaWiki User's Guide|Foo]]
16091 !! html/php
16092 cat=MediaWiki_User's_Guide sort=Foo
16093 !! html/parsoid
16094 <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"}}'/>
16095 !! end
16096
16097 !! test
16098 Category with identical sort key
16099 !! options
16100 cat
16101 !! wikitext
16102 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16103 !! html/php
16104 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
16105 !! html/parsoid
16106 <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"}}'/>
16107 !! end
16108
16109 !! test
16110 Category with empty sort key
16111 !! options
16112 cat
16113 pst
16114 !! wikitext
16115 [[Category:MediaWiki User's Guide|]]
16116 !! html/php
16117 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16118 !! end
16119
16120 !! test
16121 Category with empty sort key and parentheses
16122 !! options
16123 cat
16124 pst
16125 !! wikitext
16126 [[Category:Foo (bar)|]]
16127 !! html/php
16128 [[Category:Foo (bar)|Foo]]
16129 !! end
16130
16131 !! test
16132 Category with link tail
16133 !! options
16134 cat
16135 pst
16136 !! wikitext
16137 123[[Category:Foo]]456
16138 !! html/php
16139 123[[Category:Foo]]456
16140 !! end
16141
16142 !! test
16143 Category with template
16144 !! options
16145 cat
16146 pst
16147 !! wikitext
16148 [[Category:{{echo|Foo}}]]
16149 !! html/php
16150 [[Category:{{echo|Foo}}]]
16151 !! end
16152
16153 !! test
16154 Category with template in sort key
16155 !! options
16156 cat
16157 pst
16158 !! wikitext
16159 [[Category:Foo|{{echo|Bar}}]]
16160 !! html/php
16161 [[Category:Foo|{{echo|Bar}}]]
16162 !! end
16163
16164 !! test
16165 Category with template in sort key and title
16166 !! options
16167 cat
16168 pst
16169 !! wikitext
16170 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16171 !! html/php
16172 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16173 !! end
16174
16175 ## We used to, but no longer wt2wt this test since the default serializer
16176 ## will normalize all categories to serialize on their own line.
16177 ## This wikitext usage is going to be fairly uncommon in production and
16178 ## selser will take care of preserving formatting in those scenarios.
16179 !! test
16180 Category / paragraph interactions
16181 !! options
16182 parsoid=wt2html
16183 !! wikitext
16184 Foo [[Category:Baz]] Bar
16185
16186 Foo [[Category:Baz]]
16187 Bar
16188
16189 Foo
16190 [[Category:Baz]]
16191 Bar
16192
16193 Foo
16194 [[Category:Baz]] Bar
16195
16196 Foo
16197 [[Category:Baz]]
16198 [[Category:Baz]]
16199 [[Category:Baz]]
16200 Bar
16201
16202 [[Category:Baz]]
16203 [[Category:Baz]]
16204 [[Category:Baz]]
16205
16206 [[Category:Baz]]
16207 {{echo|[[Category:Baz]]}}
16208 [[Category:Baz]]
16209 !! html/php
16210 <p>Foo Bar
16211 </p><p>Foo
16212 Bar
16213 </p><p>Foo
16214 Bar
16215 </p><p>Foo Bar
16216 </p><p>Foo
16217 Bar
16218 </p>
16219 !! html/parsoid
16220 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16221 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16222 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16223 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16224 <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>
16225 <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}}]}'/>
16226 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16227 !! end
16228
16229 ## We used to, but no longer wt2wt this test since the default serializer
16230 ## will normalize all categories to serialize on their own line.
16231 ## This wikitext usage is going to be fairly uncommon in production and
16232 ## selser will take care of preserving formatting in those scenarios.
16233 ##
16234 ## The whitespace on the empty line is part of the test. Please do not delete
16235 !! test
16236 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16237 !! options
16238 parsoid=wt2html
16239 !! wikitext
16240 This
16241
16242 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16243
16244 {{echo|[[Category:Foo]] and so should this!}}
16245 !! html/php
16246 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16247 </p>
16248 !! html/parsoid
16249 <p>This
16250
16251 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16252
16253 <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>
16254 !! end
16255
16256 ## Parsoid will not try to wt2wt this while preserving newlines because
16257 ## it suppresses excess newlines within list items -- and we don't want to
16258 ## introduce a special case just for categories, which is, in reality somewhat
16259 ## odd behavior -- categories are unlikely to be used in list items like this
16260 ## in top-level pages and are only likely to show up in template-generated
16261 ## list items where this RT-ing is a non-issue.
16262 ##
16263 ## The whitespace on the empty line is part of the test. Please do not delete
16264 !! test
16265 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16266 !! options
16267 parsoid=wt2html
16268 !! wikitext
16269 * This
16270
16271 [[Category:Foo]] and this should be part of the same list item
16272 * So should this
16273
16274 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16275 !! html
16276 <ul><li>This and this should be part of the same list item</li>
16277 <li>So should this and this should be part of the same list item</li></ul>
16278 !! html/parsoid
16279 <ul>
16280 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16281 <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>
16282 </ul>
16283 !! end
16284
16285 ## Newlines and categories that follow the last item of a list
16286 ## are treated differently because this (list followed by categories)
16287 ## is an extremely common pattern on wikis.
16288 !! test
16289 3. Categories and newlines: newline suppression for last list item should RT properly
16290 !! wikitext
16291 *a
16292 *b
16293
16294 [[Category:Foo]]
16295
16296 [[Category:Bar]]
16297 [[Category:Baz]]
16298
16299 :c
16300
16301 [[Category:C]]
16302
16303 ;d
16304
16305 [[Category:D]]
16306 !! html/parsoid
16307 <ul><li>a</li>
16308 <li>b</li></ul>
16309
16310 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16311
16312 <link rel="mw:PageProp/Category" href="./Category:Bar"/>
16313 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16314
16315 <dl><dd>c</dd></dl>
16316
16317 <link rel="mw:PageProp/Category" href="./Category:C"/>
16318
16319 <dl><dt>d</dt></dl>
16320
16321 <link rel="mw:PageProp/Category" href="./Category:D"/>
16322 !! end
16323
16324 !! test
16325 4. Categories and newlines: newline suppression for last list item should RT properly
16326 !! wikitext
16327 *a
16328 ****b
16329
16330 [[Category:Foo]]
16331 !! html/parsoid
16332 <ul><li>a
16333 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
16334
16335 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16336 !! end
16337
16338 ## only wt2html for this to make sure the algo only applies to the rightmost path
16339 !! test
16340 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16341 !! options
16342 parsoid=wt2html
16343 !! wikitext
16344 *a
16345 **b
16346 [[Category:Foo]]
16347 *c
16348 **d
16349 [[Category:Foo]]
16350 !! html/parsoid
16351 <ul><li>a
16352 <ul><li>b
16353 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16354 <li>c
16355 <ul><li>d</li></ul></li></ul>
16356 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16357 !! end
16358
16359 ## We used to, but no longer wt2wt this test since the default serializer
16360 ## will normalize all categories to serialize on their own line.
16361 ## This wikitext usage is going to be fairly uncommon in production and
16362 ## selser will take care of preserving formatting in those scenarios.
16363 !! test
16364 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16365 !! options
16366 parsoid=wt2html
16367 !! wikitext
16368 *a [[Category:Foo]]
16369 !! html/parsoid
16370 <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>
16371 !! end
16372
16373 # This test also demonstrates because of newline+category tunneling
16374 # through the list hander, template wrapping doesn't expand to the
16375 # containing list when the list item swallows the category.
16376 !! test
16377 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16378 !! wikitext
16379 *{{echo|a
16380 [[Category:Foo]]}}
16381 !! html/parsoid
16382 <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
16383 </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>
16384 !! end
16385
16386 !! test
16387 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16388 !! wikitext
16389 *a
16390
16391 {{echo|[[Category:Foo]]
16392 [[Category:Bar]]}}
16393 [[Category:Baz]]
16394 !! html/parsoid
16395 <ul><li>a</li></ul>
16396
16397 <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">
16398 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16399 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16400 !! end
16401
16402 !! test
16403 Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
16404 !! wikitext
16405 *a
16406
16407 [[Category:Bar]]<!--boo1--> <!--boo2-->
16408 [[Category:Baz]]<!--boo3--> <!--boo4-->
16409 !! html/parsoid
16410 <ul><li>a</li></ul>
16411
16412 <link rel="mw:PageProp/Category" href="./Category:Bar"/><!--boo1--> <!--boo2-->
16413 <link rel="mw:PageProp/Category" href="./Category:Baz"/><!--boo3--> <!--boo4-->
16414 !! end
16415
16416 !! test
16417 Categories and newlines: should behave properly with linkprefix (T87753)
16418 !! options
16419 language=ar
16420 !! wikitext
16421 foo bar
16422 foo bar
16423 [[تصنيف:Foo]]
16424 [[تصنيف:Bar]]
16425 !! html/php
16426 <p>foo bar
16427 foo bar
16428 </p>
16429 !! html/parsoid
16430 <p>foo bar
16431 foo bar</p>
16432 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16433 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16434 !! end
16435
16436 !! test
16437 No regressions on internal links following category (T174639)
16438 !! options
16439 parsoid=wt2html,html2html
16440 !! wikitext
16441 [[Category:Foo]]<div>a
16442
16443 [[Foo]]</div>
16444 !! html/php
16445 <div>a
16446 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16447
16448 !! html/parsoid
16449 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16450
16451 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16452 !! end
16453
16454 # Note that Parsoid differs slightly from PHP due to T175421
16455 !! test
16456 11. Special case where only newlines separate links (T175416)
16457 !! options
16458 parsoid=wt2html,html2html
16459 !! wikitext
16460 [[Category:Foo]]
16461
16462 [[Foo]][[es:Alimento]]
16463
16464 [[Foo]]
16465 !! html/php
16466 <p><br />
16467 <a href="/wiki/Foo" title="Foo">Foo</a>
16468 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16469 </p>
16470 !! html/parsoid
16471 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16472
16473 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16474
16475 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16476 !! end
16477
16478 !! test
16479 Category links with multiple namespaces
16480 !! wikitext
16481 [[Category:Project:Foo]]
16482 !! html/parsoid
16483 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16484 !! end
16485
16486 !! test
16487 Parsoid: Serialize link to category page with colon escape
16488 !! options
16489 parsoid
16490 !! wikitext
16491
16492 [[:Category:Foo]]
16493 [[:Category:Foo|Bar]]
16494 !! html
16495 <p>
16496 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16497 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16498 </p>
16499 !! end
16500
16501 # We used to, but no longer wt2wt this test since the default serializer
16502 # will normalize all categories to serialize on their own line.
16503 # This wikitext usage is going to be fairly uncommon in production and
16504 # selser will take care of preventing whitespace insertion if this
16505 # occurs in an article.
16506 #
16507 # html2html disabled for the same reason (whitespace insertion between
16508 # x and y).
16509 #
16510 # html2wt disabled because it localizes the "Category" namespace.
16511 !! test
16512 Link prefix/suffixes aren't applied to category links
16513 !! options
16514 parsoid=wt2html
16515 language=is
16516 !! wikitext
16517 x[[Category:Foo]]y
16518 !! html/php
16519 <p>xy
16520 </p>
16521 !! html/parsoid
16522 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16523 !! end
16524
16525 !! test
16526 Link prefix/suffixes aren't applied to language links
16527 !! options
16528 parsoid=wt2html
16529 language=is
16530 !! wikitext
16531 x[[es:Foo]]y
16532 !! html/php
16533 <p>xy
16534 </p>
16535 !! html/parsoid
16536 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16537 !! end
16538
16539 !! test
16540 Parsoid: Serialize link to file page with colon escape
16541 !! options
16542 parsoid
16543 !! wikitext
16544
16545 [[:File:Foo.png]]
16546 [[:File:Foo.png|Bar]]
16547 !! html
16548 <p>
16549 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16550 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16551 </p>
16552 !! end
16553
16554 !! test
16555 Parsoid: Serialize a genuine category link without colon escape
16556 !! options
16557 parsoid
16558 !! wikitext
16559 [[Category:Foo]]
16560 [[Category:Foo|Bar]]
16561 !! html
16562 <link rel="mw:PageProp/Category" href="./Category:Foo">
16563 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16564 !! end
16565
16566 !! test
16567 Normalize hrefs properly before testing for invalid link targets (T72894)
16568 !! options
16569 parsoid=html2wt
16570 !! html/parsoid
16571 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16572 !! wikitext
16573 [[Category:Toxine bactérienne]]
16574 !! end
16575
16576 !! test
16577 Parsoid: Defaultsort
16578 !! wikitext
16579 {{DEFAULTSORT:Foo}}
16580 !! html/parsoid
16581 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16582 !! end
16583
16584 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16585 # But, this is a limitation of our representation and is documented in
16586 # TemplateHandler.js in processSpecialMagicWord
16587 !! test
16588 Parsoid: Defaultsort (template-generated)
16589 !! wikitext
16590 {{{{echo|DEFAULTSORT}}:Foo}}
16591 !! html/parsoid
16592 <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"}]]}'/>
16593 !! end
16594
16595 ###
16596 ### Inter-language links
16597 ###
16598 !! test
16599 Interlanguage links
16600 !! options
16601 ill
16602 !! wikitext
16603 [[es:Alimento]]
16604 [[fr:Nourriture]]
16605 [[zh:食品]]
16606 !! html/php
16607 es:Alimento fr:Nourriture zh:食品
16608 !! html/parsoid
16609 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16610 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16611 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16612 !! end
16613
16614 !! test
16615 Duplicate interlanguage links (T26502)
16616 !! options
16617 ill
16618 !! wikitext
16619 [[es:1]]
16620 [[es:2]]
16621 [[fr:1]]
16622 [[fr:2]]
16623 !! html/php
16624 es:1 fr:1
16625 !! html/parsoid
16626 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16627 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16628 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16629 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16630 !! end
16631
16632 ###
16633 ### Sections
16634 ###
16635 !! test
16636 Basic section headings
16637 !! wikitext
16638 ==Headline 1==
16639 Some text
16640
16641 ==Headline 2==
16642 More
16643 ===Smaller headline===
16644 Blah blah
16645 !! html
16646 <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>
16647 <p>Some text
16648 </p>
16649 <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>
16650 <p>More
16651 </p>
16652 <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>
16653 <p>Blah blah
16654 </p>
16655 !! end
16656
16657 !! test
16658 Section headings with TOC
16659 !! wikitext
16660 ==Headline 1==
16661 ===Subheadline 1===
16662 =====Skipping a level=====
16663 ======Skipping a level======
16664
16665 ==Headline 2==
16666 Some text
16667 ===Another headline===
16668 !! html
16669 <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>
16670 <ul>
16671 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16672 <ul>
16673 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16674 <ul>
16675 <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>
16676 <ul>
16677 <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>
16678 </ul>
16679 </li>
16680 </ul>
16681 </li>
16682 </ul>
16683 </li>
16684 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16685 <ul>
16686 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16687 </ul>
16688 </li>
16689 </ul>
16690 </div>
16691
16692 <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>
16693 <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>
16694 <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>
16695 <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>
16696 <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>
16697 <p>Some text
16698 </p>
16699 <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>
16700
16701 !! end
16702
16703 !! test
16704 TOC anchors don't collide
16705 !! wikitext
16706 __FORCETOC__
16707 ==Headline 2==
16708 ==Headline==
16709 ==Headline 2==
16710 ==Headline==
16711 !! html/php
16712 <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>
16713 <ul>
16714 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16715 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16716 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16717 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16718 </ul>
16719 </div>
16720
16721 <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>
16722 <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>
16723 <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>
16724 <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>
16725
16726 !! end
16727
16728 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16729 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
16730 !! test
16731 Handling of sections up to level 6 and beyond
16732 !! options
16733 parsoid=wt2html
16734 !! wikitext
16735 =Level 1 Heading=
16736 ==Level 2 Heading==
16737 ===Level 3 Heading===
16738 ====Level 4 Heading====
16739 =====Level 5 Heading=====
16740 ======Level 6 Heading======
16741 =======Level 7 Heading=======
16742 ========Level 8 Heading========
16743 =========Level 9 Heading=========
16744 ==========Level 10 Heading==========
16745 !! html/php
16746 <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>
16747 <ul>
16748 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16749 <ul>
16750 <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>
16751 <ul>
16752 <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>
16753 <ul>
16754 <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>
16755 <ul>
16756 <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>
16757 <ul>
16758 <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>
16759 <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>
16760 <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>
16761 <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>
16762 <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>
16763 </ul>
16764 </li>
16765 </ul>
16766 </li>
16767 </ul>
16768 </li>
16769 </ul>
16770 </li>
16771 </ul>
16772 </li>
16773 </ul>
16774 </div>
16775
16776 <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>
16777 <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>
16778 <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>
16779 <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>
16780 <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>
16781 <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>
16782 <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>
16783 <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>
16784 <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>
16785 <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>
16786
16787 !! html/parsoid
16788 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
16789 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
16790 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
16791 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
16792 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
16793 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
16794 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
16795 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
16796 <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>
16797 <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>
16798 !! end
16799
16800 !! test
16801 TOC regression (T11764)
16802 !! wikitext
16803 ==title 1==
16804 ===title 1.1===
16805 ====title 1.1.1====
16806 ===title 1.2===
16807 ==title 2==
16808 ===title 2.1===
16809 !! html
16810 <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>
16811 <ul>
16812 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16813 <ul>
16814 <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>
16815 <ul>
16816 <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>
16817 </ul>
16818 </li>
16819 <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>
16820 </ul>
16821 </li>
16822 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16823 <ul>
16824 <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>
16825 </ul>
16826 </li>
16827 </ul>
16828 </div>
16829
16830 <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>
16831 <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>
16832 <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>
16833 <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>
16834 <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>
16835 <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>
16836
16837 !! end
16838
16839 !! test
16840 TOC for heading containing <span id="..."></span> (T96153)
16841 !! wikitext
16842 __FORCETOC__
16843 ==<span id="old-anchor"></span>New title==
16844 !! html/php
16845 <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>
16846 <ul>
16847 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16848 </ul>
16849 </div>
16850
16851 <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>
16852
16853 !! end
16854
16855 !! test
16856 TOC with wgMaxTocLevel=3 (T8204)
16857 !! options
16858 wgMaxTocLevel=3
16859 !! wikitext
16860 ==title 1==
16861 ===title 1.1===
16862 ====title 1.1.1====
16863 ===title 1.2===
16864 ==title 2==
16865 ===title 2.1===
16866 !! html
16867 <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>
16868 <ul>
16869 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16870 <ul>
16871 <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>
16872 <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>
16873 </ul>
16874 </li>
16875 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16876 <ul>
16877 <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>
16878 </ul>
16879 </li>
16880 </ul>
16881 </div>
16882
16883 <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>
16884 <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>
16885 <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>
16886 <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>
16887 <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>
16888 <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>
16889
16890 !! end
16891
16892 !! test
16893 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16894 !! options
16895 wgMaxTocLevel=3
16896 !! wikitext
16897 ==Section 1==
16898 ===Section 1.1===
16899 ====Section 1.1.1====
16900 ====Section 1.1.1.1====
16901 ==Section 2==
16902 !! html
16903 <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>
16904 <ul>
16905 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16906 <ul>
16907 <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>
16908 </ul>
16909 </li>
16910 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16911 </ul>
16912 </div>
16913
16914 <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>
16915 <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>
16916 <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>
16917 <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>
16918 <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>
16919
16920 !! end
16921
16922
16923 !! test
16924 Resolving duplicate section names
16925 !! wikitext
16926 ==Foo bar==
16927 ==Foo bar==
16928 !! html
16929 <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>
16930 <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>
16931
16932 !! end
16933
16934 !! test
16935 Resolving duplicate section names with differing case (T12721)
16936 !! wikitext
16937 ==Foo bar==
16938 ==Foo Bar==
16939 !! html
16940 <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>
16941 <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>
16942
16943 !! end
16944
16945 !! article
16946 Template:sections
16947 !! text
16948 ===Section 1===
16949 ==Section 2==
16950 !! endarticle
16951
16952 !! test
16953 Template with sections, __NOTOC__
16954 !! wikitext
16955 __NOTOC__
16956 ==Section 0==
16957 {{sections}}
16958 ==Section 4==
16959 !! html
16960 <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>
16961 <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>
16962 <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>
16963 <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>
16964
16965 !! end
16966
16967 !! test
16968 __NOEDITSECTION__ keyword
16969 !! wikitext
16970 __NOEDITSECTION__
16971 ==Section 1==
16972 ==Section 2==
16973 !! html
16974 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16975 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16976
16977 !! end
16978
16979 !! test
16980 Link inside a section heading
16981 !! wikitext
16982 ==Section with a [[Main Page|link]] in it==
16983 !! html
16984 <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>
16985
16986 !! end
16987
16988 !! test
16989 TOC regression (T14077)
16990 !! wikitext
16991 __TOC__
16992 ==title 1==
16993 ===title 1.1===
16994 ==title 2==
16995 !! html
16996 <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>
16997 <ul>
16998 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16999 <ul>
17000 <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>
17001 </ul>
17002 </li>
17003 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
17004 </ul>
17005 </div>
17006
17007 <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>
17008 <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>
17009 <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>
17010
17011 !! end
17012
17013 !! test
17014 T3219 URL next to image (good)
17015 !! wikitext
17016 http://example.com [[File:Foobar.jpg]]
17017 !! html/php
17018 <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>
17019 </p>
17020 !! html/parsoid
17021 <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>
17022 !!end
17023
17024 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
17025 !! test
17026 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
17027 !! options
17028 parsoid=wt2html,html2html
17029 !! wikitext
17030 ===
17031 The line above must have a trailing space!
17032 === <!--
17033 --> <!-- -->
17034 But just in case it doesn't...
17035 !! html/php
17036 <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>
17037 <p>The line above must have a trailing space!
17038 </p>
17039 <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>
17040 <p>But just in case it doesn't...
17041 </p>
17042 !! html/parsoid
17043 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
17044 <p>The line above must have a trailing space!</p>
17045 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
17046 --> <!-- -->
17047 <p>But just in case it doesn't...</p>
17048 !! end
17049
17050 !! test
17051 Header with special characters (T27462)
17052 !! wikitext
17053 The tooltips shall not show entities to the user (ie. be double escaped)
17054
17055 ==text > text==
17056 section 1
17057
17058 ==text < text==
17059 section 2
17060
17061 ==text & text==
17062 section 3
17063
17064 ==text ' text==
17065 section 4
17066
17067 ==text " text==
17068 section 5
17069 !! html/php
17070 <p>The tooltips shall not show entities to the user (ie. be double escaped)
17071 </p>
17072 <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>
17073 <ul>
17074 <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>
17075 <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>
17076 <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>
17077 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
17078 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
17079 </ul>
17080 </div>
17081
17082 <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>
17083 <p>section 1
17084 </p>
17085 <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>
17086 <p>section 2
17087 </p>
17088 <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>
17089 <p>section 3
17090 </p>
17091 <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>
17092 <p>section 4
17093 </p>
17094 <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>
17095 <p>section 5
17096 </p>
17097 !! html/parsoid
17098 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
17099
17100 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
17101 <p>section 1</p>
17102
17103 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
17104 <p>section 2</p>
17105
17106 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
17107 <p>section 3</p>
17108
17109 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
17110 <p>section 4</p>
17111
17112 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
17113 <p>section 5</p>
17114 !! end
17115
17116 !! test
17117 Header with space, plus and underscore as entity
17118 !! wikitext
17119 Id should not contain + for spaces
17120
17121 ==Space between Text==
17122 section 1
17123
17124 ==Space-Entity&#32;between&#32;Text==
17125 section 2
17126
17127 ==Plus+between+Text==
17128 section 3
17129
17130 ==Plus-Entity&#43;between&#43;Text==
17131 section 4
17132
17133 ==Underscore_between_Text==
17134 section 5
17135
17136 ==Underscore-Entity&#95;between&#95;Text==
17137 section 6
17138
17139 [[#Space between Text]]
17140 [[#Space-Entity&#32;between&#32;Text]]
17141 [[#Plus+between+Text]]
17142 [[#Plus-Entity&#43;between&#43;Text]]
17143 [[#Underscore_between_Text]]
17144 [[#Underscore-Entity&#95;between&#95;Text]]
17145 !! html/php
17146 <p>Id should not contain + for spaces
17147 </p>
17148 <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>
17149 <ul>
17150 <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>
17151 <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>
17152 <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>
17153 <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>
17154 <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>
17155 <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>
17156 </ul>
17157 </div>
17158
17159 <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>
17160 <p>section 1
17161 </p>
17162 <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>
17163 <p>section 2
17164 </p>
17165 <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>
17166 <p>section 3
17167 </p>
17168 <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>
17169 <p>section 4
17170 </p>
17171 <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>
17172 <p>section 5
17173 </p>
17174 <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>
17175 <p>section 6
17176 </p><p><a href="#Space_between_Text">#Space between Text</a>
17177 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
17178 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
17179 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
17180 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17181 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17182 </p>
17183 !! html/parsoid
17184 <p>Id should not contain + for spaces</p>
17185
17186 <h2 id="Space_between_Text">Space between Text</h2>
17187 <p>section 1</p>
17188
17189 <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>
17190 <p>section 2</p>
17191
17192 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
17193 <p>section 3</p>
17194
17195 <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>
17196 <p>section 4</p>
17197
17198 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
17199 <p>section 5</p>
17200
17201 <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>
17202 <p>section 6</p>
17203
17204 <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>
17205 <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>
17206 <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>
17207 <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>
17208 <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>
17209 <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>
17210 !! end
17211
17212 # Parsoid html2wt disabled because it adds padding spaces around =
17213 !! test
17214 Headers with excess '=' characters
17215 (Are similar tests necessary beyond the 1st level?)
17216 !! options
17217 parsoid=wt2html,wt2wt,html2html
17218 !! wikitext
17219 =foo==
17220 ==foo=
17221 =''italic'' heading==
17222 ==''italic'' heading=
17223 !! html/php
17224 <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>
17225 <ul>
17226 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17227 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17228 <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>
17229 <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>
17230 </ul>
17231 </div>
17232
17233 <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>
17234 <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>
17235 <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>
17236 <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>
17237
17238 !! html/parsoid
17239 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
17240 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
17241 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
17242 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
17243 !! end
17244
17245 !! test
17246 HTML headers vs TOC (T25393)
17247 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17248 !! wikitext
17249 <h1>Header 1</h1>
17250 ==Header 1.1==
17251 ==Header 1.2==
17252
17253 <h1>Header 2
17254 </h1>
17255 ==Header 2.1==
17256 ==Header 2.2==
17257 __NOEDITSECTION__
17258 !! html/php
17259 <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>
17260 <ul>
17261 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17262 <ul>
17263 <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>
17264 <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>
17265 </ul>
17266 </li>
17267 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
17268 <ul>
17269 <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>
17270 <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>
17271 </ul>
17272 </li>
17273 </ul>
17274 </div>
17275
17276 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17277 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17278 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17279 <h1><span class="mw-headline" id="Header_2">Header 2
17280 </span></h1>
17281 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17282 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17283
17284 !! html/parsoid
17285 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17286 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17287 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17288
17289 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17290 </h1>
17291 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17292 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17293 <meta property="mw:PageProp/noeditsection"/>
17294 !! end
17295
17296 !! test
17297 Single-line or multiline-comments can follow headings
17298 !! options
17299 parsoid=wt2html,wt2wt
17300 !! wikitext
17301 ==foo==<!---->
17302 ==bar==<!--c1-->
17303 ==baz==<!--
17304 c2
17305 c3-->
17306 !! html/php
17307 <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>
17308 <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>
17309 <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>
17310
17311 !! html/parsoid
17312 <h2 id="foo">foo</h2><!---->
17313 <h2 id="bar">bar</h2><!--c1-->
17314 <h2 id="baz">baz</h2><!--
17315 c2
17316 c3-->
17317 !! end
17318
17319 !! test
17320 T3219 URL next to image (broken)
17321 !! wikitext
17322 http://example.com[[File:Foobar.jpg]]
17323 !! html/php
17324 <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>
17325 </p>
17326 !! html/parsoid
17327 <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>
17328 !!end
17329
17330 !! test
17331 T3186 news: in the middle of text
17332 !! wikitext
17333 http://en.wikinews.org/wiki/Wikinews:Workplace
17334 !! html
17335 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17336 </p>
17337 !!end
17338
17339
17340 !! test
17341 Namespaced link must have a title
17342 !! wikitext
17343 [[Project:]]
17344 !! html
17345 <p>[[Project:]]
17346 </p>
17347 !!end
17348
17349 !! test
17350 Namespaced link must have a title (bad fragment version)
17351 !! wikitext
17352 [[Project:#fragment]]
17353 !! html
17354 <p>[[Project:#fragment]]
17355 </p>
17356 !!end
17357
17358
17359 ###
17360 ### HTML tags and HTML attributes
17361 ###
17362
17363 !! test
17364 div with no attributes
17365 !! wikitext
17366 <div>HTML rocks</div>
17367 !! html
17368 <div>HTML rocks</div>
17369
17370 !! end
17371
17372 !! test
17373 div with double-quoted attribute
17374 !! wikitext
17375 <div id="rock">HTML rocks</div>
17376 !! html
17377 <div id="rock">HTML rocks</div>
17378
17379 !! end
17380
17381 !! test
17382 div with single-quoted attribute
17383 !! wikitext
17384 <div id='rock'>HTML rocks</div>
17385 !! html
17386 <div id="rock">HTML rocks</div>
17387
17388 !! end
17389
17390 !! test
17391 div with unquoted attribute
17392 !! wikitext
17393 <div id=rock>HTML rocks</div>
17394 !! html
17395 <div id="rock">HTML rocks</div>
17396
17397 !! end
17398
17399 !! test
17400 div with illegal double attributes
17401 !! wikitext
17402 <div id="a" id="b">HTML rocks</div>
17403 !! html
17404 <div id="b">HTML rocks</div>
17405
17406 !!end
17407
17408 !! test
17409 div with empty attribute value, space before equals
17410 !! options
17411 parsoid=wt2html,html2html
17412 !! wikitext
17413 <div class =>HTML rocks</div>
17414 !! html/php
17415 <div class="">HTML rocks</div>
17416
17417 !! html/parsoid
17418 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17419 !! end
17420
17421 !! test
17422 div with multiple empty attribute values
17423 !! config
17424 wgFragmentMode=[ 'html5', 'legacy' ]
17425 !! options
17426 parsoid=wt2html,html2html
17427 !! wikitext
17428 <div id= title=>HTML rocks</div>
17429 !! html/php
17430 <div id="title=">HTML rocks</div>
17431
17432 !! html/parsoid
17433 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17434 !! end
17435
17436 # FIXME Parsoid doesn't actually match PHP here.
17437 # Probably we should use the synthetic <foo /> or <indicator>
17438 # extensions for this test, which are enabled when running parser tests.
17439 !! test
17440 Extension tag in attribute value
17441 !! wikitext
17442 <span title="<translate>123</translate>">ok</span>
17443 !! html/php+disabled
17444 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17445 </p>
17446 !! html/parsoid
17447 <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>
17448 !! end
17449
17450 !! test
17451 table with multiple empty attribute values
17452 !! options
17453 parsoid=wt2html,html2html
17454 !! wikitext
17455 {| title= id=
17456 |hi
17457 |}
17458 !! html/php
17459 <table title="id=">
17460 <tr>
17461 <td>hi
17462 </td></tr></table>
17463
17464 !! html/parsoid
17465 <table title="id=">
17466 <tbody><tr><td>hi</td></tr>
17467 </tbody></table>
17468 !! end
17469
17470 !! test
17471 div with braces in attribute value
17472 !! wikitext
17473 <div title="{}">Foo</div>
17474 !! html/php
17475 <div title="&#123;&#125;">Foo</div>
17476
17477 !! html/parsoid
17478 <div title="{}">Foo</div>
17479 !! end
17480
17481 !! test
17482 div with empty attribute value, no space before equals
17483 !! options
17484 parsoid=wt2html,html2html
17485 !! wikitext
17486 <div class=>HTML rocks</div>
17487 !! html/php
17488 <div class="">HTML rocks</div>
17489
17490 !! html/parsoid
17491 <div class="">HTML rocks</div>
17492 !! end
17493
17494 !! test
17495 HTML multiple attributes correction
17496 !! wikitext
17497 <p class="error" class="awesome">Awesome!</p>
17498 !! html
17499 <p class="awesome">Awesome!</p>
17500
17501 !!end
17502
17503 !! test
17504 Table multiple attributes correction
17505 !! wikitext
17506 {|
17507 !+ class="error" class="awesome"|status
17508 |}
17509 !! html
17510 <table>
17511 <tr>
17512 <th class="awesome">status
17513 </th></tr></table>
17514
17515 !!end
17516
17517 !! test
17518 DIV IN UPPERCASE
17519 !! wikitext
17520 <DIV ID="x">HTML ROCKS</DIV>
17521 !! html
17522 <div id="x">HTML ROCKS</div>
17523
17524 !!end
17525
17526 !! test
17527 Non-ASCII pseudo-tags are rendered as text
17528 !! wikitext
17529 <khyô>
17530 !! html
17531 <p>&lt;khyô&gt;
17532 </p>
17533 !! end
17534
17535 !! test
17536 Pseudo-tag with URL 'name' renders as url link
17537 !! wikitext
17538 <http://example.com/>
17539 !! html
17540 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17541 </p>
17542 !! end
17543
17544 !! test
17545 text with amp in the middle of nowhere
17546 !! wikitext
17547 Remember AT&T?
17548 !! html
17549 <p>Remember AT&amp;T?
17550 </p>
17551 !! end
17552
17553 !! test
17554 text with character entity: eacute
17555 !! wikitext
17556 I always thought &eacute; was a cute letter.
17557 !! html+tidy
17558 <p>I always thought &#233; was a cute letter.
17559 </p>
17560 !! end
17561
17562 !! test
17563 text with entity-escaped character entity-like string: eacute
17564 !! wikitext
17565 I always thought &amp;eacute; was a cute letter.
17566 !! html
17567 <p>I always thought &amp;eacute; was a cute letter.
17568 </p>
17569 !! end
17570
17571 !! test
17572 text with undefined character entity: xacute
17573 !! wikitext
17574 I always thought &xacute; was a cute letter.
17575 !! html
17576 <p>I always thought &amp;xacute; was a cute letter.
17577 </p>
17578 !! end
17579
17580 !! test
17581 HTML5 tags
17582 !! wikitext
17583 <data value="5">five</data>
17584 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17585 <mark>This highlighted text</mark>
17586 !! html
17587 <p><data value="5">five</data>
17588 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17589 <mark>This highlighted text</mark>
17590 </p>
17591 !! end
17592
17593 !! test
17594 HTML tag with leading space is parsed as text
17595 !! wikitext
17596 < div>foo< /div>
17597 !! html
17598 <p>&lt; div&gt;foo&lt; /div&gt;
17599 </p>
17600 !! end
17601
17602 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17603 ## the HTML5 parsing spec.
17604 !! test
17605 Element with broken attribute syntax
17606 !! options
17607 parsoid=wt2html
17608 !! wikitext
17609 <div style=" style="123">hi</div>
17610 <div =>ho</div>
17611 !! html/php
17612 <div style="123">hi</div>
17613 <div>ho</div>
17614
17615 !! html/parsoid
17616 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17617 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17618 !! end
17619
17620 ###
17621 ### Nesting tests (see T43545, T52604, T53081)
17622 ###
17623
17624 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17625 # Note that html2wt is considerably more difficult if we use <b> in
17626 # the test case, instead of <small>
17627 !! test
17628 Ensure that HTML adoption agency algorithm is properly implemented.
17629 !! wikitext
17630 <small>X<small>Y</small>Z</small>
17631 !! html
17632 <p><small>X<small>Y</small>Z</small>
17633 </p>
17634 !! end
17635
17636 # This was T43545 in the PHP parser.
17637 !! test
17638 Nesting of <kbd>
17639 !! wikitext
17640 <kbd>X<kbd>Y</kbd>Z</kbd>
17641 !! html+tidy
17642 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17643 </p>
17644 !! end
17645
17646 # The following cases were T53081 in the PHP parser.
17647 # Note that there are some other nestable tags (b, i, etc) which are
17648 # not covered; see T53081 for discussion.
17649
17650 !! test
17651 Nesting of <em>
17652 !! wikitext
17653 <em>X<em>Y</em>Z</em>
17654 !! html+tidy
17655 <p><em>X<em>Y</em>Z</em>
17656 </p>
17657 !! end
17658
17659 !! test
17660 Nesting of <strong>
17661 !! wikitext
17662 <strong>X<strong>Y</strong>Z</strong>
17663 !! html+tidy
17664 <p><strong>X<strong>Y</strong>Z</strong>
17665 </p>
17666 !! end
17667
17668 !! test
17669 Nesting of <q>
17670 !! wikitext
17671 <q>X<q>Y</q>Z</q>
17672 !! html+tidy
17673 <p><q>X<q>Y</q>Z</q>
17674 </p>
17675 !! end
17676
17677 !! test
17678 Nesting of <ruby>
17679 !! wikitext
17680 <ruby>X<ruby>Y</ruby>Z</ruby>
17681 !! html
17682 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17683 </p>
17684 !! end
17685
17686 !! test
17687 Nesting of <bdo>
17688 !! wikitext
17689 <bdo>X<bdo>Y</bdo>Z</bdo>
17690 !! html
17691 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17692 </p>
17693 !! end
17694
17695
17696 ###
17697 ### Media links
17698 ###
17699
17700 !! test
17701 Media link
17702 !! wikitext
17703 [[Media:Foobar.jpg]]
17704 [[Media:Video.ogv]]
17705 [[:Media:Video.ogv]]
17706 !! html/php
17707 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17708 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17709 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17710 </p>
17711 !! html/parsoid
17712 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17713 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17714 <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>
17715 !! end
17716
17717 !! test
17718 Media link with text
17719 !! wikitext
17720 [[Media:Foobar.jpg|A neat file to look at]]
17721 !! html/php
17722 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17723 </p>
17724 !! html/parsoid
17725 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17726 !! end
17727
17728 # FIXME: this is still bad HTML tag nesting
17729 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17730 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
17731 !! test
17732 Media link with nasty text
17733 !! wikitext
17734 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17735 !! html/php
17736 <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>
17737
17738 !! html/php+tidy
17739 <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>
17740 !! html/parsoid
17741 <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>
17742
17743 !! end
17744
17745 !! test
17746 Media link to nonexistent file (T3702)
17747 !! wikitext
17748 [[Media:No such.jpg]]
17749 [[Media:No_such file.jpg]]
17750 !! html/php
17751 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17752 <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>
17753 </p>
17754 !! html/parsoid
17755 <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>
17756 <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>
17757 !! end
17758
17759 !! test
17760 Image link to nonexistent file (T3850 - good)
17761 !! wikitext
17762 [[File:No_such.jpg]]
17763 !! html/php
17764 <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>
17765 </p>
17766 !! html/parsoid
17767 <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>
17768 !! end
17769
17770 !! test
17771 :Image link to nonexistent file (T3850 - bad)
17772 !! wikitext
17773 [[:Image:No such.jpg]]
17774 !! html/php
17775 <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>
17776 </p>
17777 !! html/parsoid
17778 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17779 !! end
17780
17781 !! test
17782 Character reference normalization in link text (T3938)
17783 !! wikitext
17784 [[Main Page|this&that]]
17785 !! html
17786 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17787 </p>
17788 !!end
17789
17790 !! article
17791 אַ
17792 !! text
17793 Test for unicode normalization
17794
17795 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17796 !! endarticle
17797
17798 !! test
17799 (T21451) Links should refer to the normalized form.
17800 !! wikitext
17801 [[&#xFB2E;]]
17802 [[&#x5d0;&#x5b7;]]
17803 [[&#x5d0;ַ]]
17804 [[א&#x5b7;]]
17805 [[אַ]]
17806 !! html
17807 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17808 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17809 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17810 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17811 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17812 </p>
17813 !! end
17814
17815 !! test
17816 Empty attribute crash test (T4067)
17817 !! wikitext
17818 <font color="">foo</font>
17819 !! html
17820 <p><font color="">foo</font>
17821 </p>
17822 !! end
17823
17824 !! test
17825 Empty attribute crash test single-quotes (T4067)
17826 !! wikitext
17827 <font color=''>foo</font>
17828 !! html
17829 <p><font color="">foo</font>
17830 </p>
17831 !! end
17832
17833 !! test
17834 Attribute test: equals, then nothing
17835 !! options
17836 parsoid=wt2html,html2html
17837 !! wikitext
17838 <font color=>foo</font>
17839 !! html/php
17840 <p><font color="">foo</font>
17841 </p>
17842 !! html/parsoid
17843 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17844 !! end
17845
17846 !! test
17847 Attribute test: unquoted value
17848 !! options
17849 parsoid=wt2html,html2html
17850 !! wikitext
17851 <font color=x>foo</font>
17852 !! html/php
17853 <p><font color="x">foo</font>
17854 </p>
17855 !! html/parsoid
17856 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17857 !! end
17858
17859 !! test
17860 Attribute test: unquoted but illegal value (hash)
17861 !! wikitext
17862 <font color=#x>foo</font>
17863 !! html
17864 <p><font color="#x">foo</font>
17865 </p>
17866 !! end
17867
17868 # Parsoid does not serialize to empty attribute syntax,
17869 # so wt2wt and html2wt cases are skipped
17870 !! test
17871 Attribute test: no value (T54330)
17872 !! options
17873 parsoid=wt2html,html2html
17874 !! wikitext
17875 <font color>foo</font>
17876 !! html/php
17877 <p><font color="">foo</font>
17878 </p>
17879 !! html/parsoid
17880 <p><font color="">foo</font></p>
17881 !! end
17882
17883 !! test
17884 T4095: link with three closing brackets
17885 !! wikitext
17886 [[Main Page]]]
17887 !! html/php
17888 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17889 </p>
17890 !! html/parsoid
17891 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17892 !! end
17893
17894 !! test
17895 T4095: link with pipe and three closing brackets
17896 !! wikitext
17897 [[Main Page|link]]]
17898 !! html/php
17899 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17900 </p>
17901 !! html/parsoid
17902 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17903 !! end
17904
17905 !! test
17906 T4095: link with pipe and three closing brackets, version 2
17907 !! wikitext
17908 [[Main Page|[http://example.com/]]]
17909 !! html/php
17910 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17911 </p>
17912 !! html/parsoid
17913 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17914 !! end
17915
17916
17917 ###
17918 ### Safety
17919 ###
17920
17921 !! article
17922 Template:Dangerous attribute
17923 !! text
17924 " onmouseover="alert(document.cookie)
17925 !! endarticle
17926
17927 !! article
17928 Template:Dangerous style attribute
17929 !! text
17930 border-size: expression(alert(document.cookie))
17931 !! endarticle
17932
17933 !! article
17934 Template:Div style
17935 !! text
17936 <div style="float: right; {{{1}}}">Magic div</div>
17937 !! endarticle
17938
17939 !! test
17940 T4304: HTML attribute safety (safe template; regression T4309)
17941 !! wikitext
17942 <div title="{{test}}"></div>
17943 !! html/php
17944 <div title="This is a test template"></div>
17945
17946 !! html/parsoid
17947 <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>
17948 !! end
17949
17950 # Parsoid has enough context to handle this case
17951 !! test
17952 T4304: HTML attribute safety (dangerous template; 2309)
17953 !! wikitext
17954 <div title="{{dangerous attribute}}"></div>
17955 !! html/php
17956 <div title=""></div>
17957
17958 !! html/parsoid
17959 <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>
17960 !! end
17961
17962 !! test
17963 T4304: HTML attribute safety (dangerous style template; 2309)
17964 !! wikitext
17965 <div style="{{dangerous style attribute}}"></div>
17966 !! html/php
17967 <div style="/* insecure input */"></div>
17968
17969 !! html/parsoid
17970 <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>
17971 !! end
17972
17973 !! test
17974 T4304: HTML attribute safety (safe parameter; 2309)
17975 !! wikitext
17976 {{div style|width: 200px}}
17977 !! html/php
17978 <div style="float: right; width: 200px">Magic div</div>
17979
17980 !! html/parsoid
17981 <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>
17982 !! end
17983
17984 !! test
17985 T4304: HTML attribute safety (unsafe parameter; 2309)
17986 !! wikitext
17987 {{div style|width: expression(alert(document.cookie))}}
17988 !! html/php
17989 <div style="/* insecure input */">Magic div</div>
17990
17991 !! html/parsoid
17992 <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>
17993 !! end
17994
17995 ## Parsoid output here differs; needs investigation.
17996 !! test
17997 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17998 !! wikitext
17999 {{div style|"><script>alert(document.cookie)</script>}}
18000 !! html
18001 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18002
18003 !! end
18004
18005 ## Parsoid output here differs; needs investigation.
18006 !! test
18007 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
18008 !! wikitext
18009 {{div style|" ><script>alert(document.cookie)</script>}}
18010 !! html
18011 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18012
18013 !! end
18014
18015 !! test
18016 T4304: HTML attribute safety (link)
18017 !! wikitext
18018 <div title="[[Main Page]]"></div>
18019 !! html/php
18020 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
18021
18022 !! html/parsoid
18023 <div title="[[Main Page]]"></div>
18024 !! end
18025
18026 !! test
18027 T4304: HTML attribute safety (italics)
18028 !! wikitext
18029 <div title="''foobar''"></div>
18030 !! html
18031 <div title="&#39;&#39;foobar&#39;&#39;"></div>
18032
18033 !! end
18034
18035 !! test
18036 T4304: HTML attribute safety (bold)
18037 !! wikitext
18038 <div title="'''foobar'''"></div>
18039 !! html
18040 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
18041
18042 !! end
18043
18044 !! test
18045 T4304: HTML attribute safety (ISBN)
18046 !! wikitext
18047 <div title="ISBN 1234567890"></div>
18048 !! html
18049 <div title="&#73;SBN 1234567890"></div>
18050
18051 !! end
18052
18053 !! test
18054 T4304: HTML attribute safety (RFC)
18055 !! wikitext
18056 <div title="RFC 1234"></div>
18057 !! html
18058 <div title="&#82;FC 1234"></div>
18059
18060 !! end
18061
18062 !! test
18063 T4304: HTML attribute safety (PMID)
18064 !! wikitext
18065 <div title="PMID 1234567890"></div>
18066 !! html
18067 <div title="&#80;MID 1234567890"></div>
18068
18069 !! end
18070
18071 !! test
18072 T4304: HTML attribute safety (web link)
18073 !! wikitext
18074 <div title="http://example.com/"></div>
18075 !! html
18076 <div title="http&#58;//example.com/"></div>
18077
18078 !! end
18079
18080 !! test
18081 T4304: HTML attribute safety (named web link)
18082 !! wikitext
18083 <div title="[http://example.com/ link]"></div>
18084 !! html/php
18085 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
18086
18087 !! html/parsoid
18088 <div title="[http://example.com/ link]"></div>
18089 !! end
18090
18091 !! test
18092 T5244: HTML attribute safety (extension; safe)
18093 !! wikitext
18094 <div style="<nowiki>background:blue</nowiki>"></div>
18095 !! html/php
18096 <div style="background:blue"></div>
18097
18098 !! html/parsoid
18099 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
18100 !! end
18101
18102 !! test
18103 T5244: HTML attribute safety (extension; unsafe)
18104 !! wikitext
18105 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
18106 !! html/php
18107 <div style="/* insecure input */"></div>
18108
18109 !! html/parsoid
18110 <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>
18111 !! end
18112
18113 # More MSIE fun discovered by Tom Gilder
18114
18115 !! test
18116 MSIE CSS safety test: spurious slash
18117 !! wikitext
18118 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
18119 !! html/php
18120 <div style="/* insecure input */">evil</div>
18121
18122 !! html/parsoid
18123 <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>
18124 !! end
18125
18126 !! test
18127 MSIE CSS safety test: hex code
18128 !! wikitext
18129 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
18130 !! html/php
18131 <div style="/* insecure input */">evil</div>
18132
18133 !! html/parsoid
18134 <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>
18135 !! end
18136
18137 !! test
18138 MSIE CSS safety test: comment in url
18139 !! wikitext
18140 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
18141 !! html/php
18142 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
18143
18144 !! html/parsoid
18145 <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>
18146 !! end
18147
18148 !! test
18149 MSIE CSS safety test: comment in expression
18150 !! wikitext
18151 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
18152 !! html/php
18153 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
18154
18155 !! html/parsoid
18156 <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>
18157 !! end
18158
18159 !! test
18160 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
18161 !! wikitext
18162 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
18163 !! html/php
18164 <p style="/* invalid control char */">A</p>
18165
18166 !! html/parsoid
18167 <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>
18168 !! end
18169
18170 !! test
18171 MSIE 6 CSS safety test: Fullwidth (T57332)
18172 !! wikitext
18173 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
18174 <div style="top:EXPRESSION(alert())">B</div>
18175 !! html/php
18176 <p style="/* insecure input */">A</p>
18177 <div style="/* insecure input */">B</div>
18178
18179 !! html/parsoid
18180 <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>
18181 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
18182 !! end
18183
18184 !! test
18185 MSIE 6 CSS safety test: IPA extensions (T57332)
18186 !! wikitext
18187 <div style="background-image:uʀʟ(javascript:alert())">A</div>
18188 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
18189 !! html/php
18190 <div style="/* insecure input */">A</div>
18191 <p style="/* insecure input */">B</p>
18192
18193 !! html/parsoid
18194 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
18195 <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>
18196 !! end
18197
18198 !! test
18199 MSIE 6 CSS safety test: sup/sub script (T57332)
18200 !! wikitext
18201 <div style="background-image:url⁽javascript:alert())">A</div>
18202 <div style="background-image:url₍javascript:alert())">B</div>
18203 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
18204 !! html/php
18205 <div style="/* insecure input */">A</div>
18206 <div style="/* insecure input */">B</div>
18207 <p style="/* insecure input */">C</p>
18208
18209 !! html/parsoid
18210 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
18211 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
18212 <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>
18213 !! end
18214
18215 !! test
18216 Opera -o-link CSS
18217 !! options
18218 parsoid=wt2html,html2html
18219 !! wikitext
18220 <div
18221 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;"
18222 style="-o-link:attr(title);-o-link-source:current">X</div>
18223 !! html/php
18224 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
18225
18226 !! html/parsoid
18227 <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>
18228 !! end
18229
18230 !! test
18231 MSIE 6 CSS safety test: Repetition markers (T57332)
18232 !! wikitext
18233 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
18234 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
18235 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
18236 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
18237 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
18238 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
18239 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
18240 !! html/php
18241 <p style="/* insecure input */">A</p>
18242 <p style="/* insecure input */">B</p>
18243 <p style="/* insecure input */">C</p>
18244 <p style="/* insecure input */">D</p>
18245 <p style="/* insecure input */">E</p>
18246 <p style="/* insecure input */">F</p>
18247 <p style="/* insecure input */">G</p>
18248
18249 !! html/parsoid
18250 <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>
18251 <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>
18252 <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>
18253 <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>
18254 <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>
18255 <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>
18256 <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>
18257 !! end
18258
18259 !! test
18260 Table attribute legitimate extension
18261 !! wikitext
18262 {|
18263 !+ style="<nowiki>color:blue</nowiki>"|status
18264 |}
18265 !! html
18266 <table>
18267 <tr>
18268 <th style="color:blue">status
18269 </th></tr></table>
18270
18271 !!end
18272
18273 !! test
18274 Table attribute safety
18275 !! wikitext
18276 {|
18277 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18278 |}
18279 !! html
18280 <table>
18281 <tr>
18282 <th style="/* insecure input */">status
18283 </th></tr></table>
18284
18285 !! end
18286
18287 !! test
18288 CSS line continuation 1
18289 !! wikitext
18290 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18291 !! html
18292 <div style="/* insecure input */"></div>
18293
18294 !! end
18295
18296 !! test
18297 CSS line continuation 2
18298 !! wikitext
18299 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18300 !! html
18301 <div style="/* invalid control char */"></div>
18302
18303 !! end
18304
18305 !! article
18306 Template:Identity
18307 !! text
18308 {{{1}}}
18309 !! endarticle
18310
18311 !! test
18312 Expansion of multi-line templates in attribute values (T8255)
18313 !! wikitext
18314 <div style="background: {{identity|#00FF00}}">-</div>
18315 !! html
18316 <div style="background: #00FF00">-</div>
18317
18318 !! end
18319
18320 !! test
18321 Expansion of multi-line templates in attribute values (T8255 sanity check)
18322 !! wikitext
18323 <div style="background:
18324 #00FF00">-</div>
18325 !! html/php
18326 <div style="background: #00FF00">-</div>
18327
18328 !! html/parsoid
18329 <div style="background:
18330 #00FF00">-</div>
18331 !! end
18332
18333 !! test
18334 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18335 !! wikitext
18336 <div style="background: &#10;#00FF00">-</div>
18337 !! html
18338 <div style="background: &#10;#00FF00">-</div>
18339
18340 !! end
18341
18342 !! test
18343 Tags which are hidden from tidiers cannot pass through the Sanitizer
18344 !! wikitext
18345 <mw:toc><script>alert();</script></mw:toc>
18346 !! html+tidy
18347 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18348 </p>
18349 !! end
18350
18351 ###
18352 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18353 ###
18354
18355 !! test
18356 Parser hook: empty input
18357 !! wikitext
18358 <tag></tag>
18359 !! html/php
18360 <pre>
18361 ''
18362 array (
18363 )
18364 </pre>
18365
18366 !! html/parsoid
18367 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18368 !! end
18369
18370 ## Don't expect parsoid to rt this form.
18371 !! test
18372 Parser hook: empty input using terminated empty elements
18373 !! options
18374 parsoid=wt2html,html2html
18375 !! wikitext
18376 <tag/>
18377 !! html/php
18378 <pre>
18379 NULL
18380 array (
18381 )
18382 </pre>
18383
18384 !! html/parsoid
18385 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18386 !! end
18387
18388 !! test
18389 Parser hook: empty input using terminated empty elements (space before)
18390 !! wikitext
18391 <tag />
18392 !! html/php
18393 <pre>
18394 NULL
18395 array (
18396 )
18397 </pre>
18398
18399 !! html/parsoid
18400 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18401 !! end
18402
18403 !! test
18404 Parser hook: basic input
18405 !! wikitext
18406 <tag>input</tag>
18407 !! html/php
18408 <pre>
18409 'input'
18410 array (
18411 )
18412 </pre>
18413
18414 !! html/parsoid
18415 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18416 !! end
18417
18418 ## Don't expect parsoid to rt this form.
18419 !! test
18420 Parser hook: case insensitive
18421 !! options
18422 parsoid=wt2html,html2html
18423 !! wikitext
18424 <TAG>input</TAG>
18425 !! html/php
18426 <pre>
18427 'input'
18428 array (
18429 )
18430 </pre>
18431
18432 !! html/parsoid
18433 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18434 !! end
18435
18436 ## Don't expect parsoid to rt this form.
18437 !! test
18438 Parser hook: case insensitive, redux
18439 !! options
18440 parsoid=wt2html,html2html
18441 !! wikitext
18442 <TaG>input</TAg>
18443 !! html/php
18444 <pre>
18445 'input'
18446 array (
18447 )
18448 </pre>
18449
18450 !! html/parsoid
18451 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18452 !! end
18453
18454 !! test
18455 Parser hook: nested tags
18456 !! wikitext
18457 <tag><tag></tag></tag>
18458 !! html/php
18459 <pre>
18460 '<tag>'
18461 array (
18462 )
18463 </pre>&lt;/tag&gt;
18464
18465 !! html/parsoid
18466 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
18467 !! end
18468
18469 !! test
18470 Parser hook: basic arguments
18471 !! wikitext
18472 <tag width="200" height="100" depth="50" square=""></tag>
18473 !! html/php
18474 <pre>
18475 ''
18476 array (
18477 'width' => '200',
18478 'height' => '100',
18479 'depth' => '50',
18480 'square' => '',
18481 )
18482 </pre>
18483
18484 !! html/parsoid
18485 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18486 !! end
18487
18488 ## Don't expect parsoid to rt this form.
18489 !! test
18490 Parser hook: basic arguments, variations
18491 !! options
18492 parsoid=wt2html,html2html
18493 !! wikitext
18494 <tag width=200 height = "100" depth = '50' square></tag>
18495 !! html/php
18496 <pre>
18497 ''
18498 array (
18499 'width' => '200',
18500 'height' => '100',
18501 'depth' => '50',
18502 'square' => '',
18503 )
18504 </pre>
18505
18506 !! html/parsoid
18507 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18508 !! end
18509
18510 !! test
18511 Parser hook: argument containing a forward slash (T7344)
18512 !! wikitext
18513 <tag filename="/tmp/bla"></tag>
18514 !! html/php
18515 <pre>
18516 ''
18517 array (
18518 'filename' => '/tmp/bla',
18519 )
18520 </pre>
18521
18522 !! html/parsoid
18523 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18524 !! end
18525
18526 ## Don't expect parsoid to rt this form.
18527 !! test
18528 Parser hook: empty input using terminated empty elements (T4374)
18529 !! options
18530 parsoid=wt2html,html2html
18531 !! wikitext
18532 <tag foo=bar/>text
18533 !! html/php
18534 <pre>
18535 NULL
18536 array (
18537 'foo' => 'bar',
18538 )
18539 </pre>text
18540
18541 !! html/parsoid
18542 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
18543 !! end
18544
18545 ## </tag> should be output literally since there is no matching tag that begins it
18546 ## Don't expect parsoid to rt this form.
18547 !! test
18548 Parser hook: basic arguments using terminated empty elements (T4374)
18549 !! options
18550 parsoid=wt2html
18551 !! wikitext
18552 <tag width=200 height = "100" depth = '50' square/>
18553 other stuff
18554 </tag>
18555 !! html/php
18556 <pre>
18557 NULL
18558 array (
18559 'width' => '200',
18560 'height' => '100',
18561 'depth' => '50',
18562 'square' => '',
18563 )
18564 </pre>
18565 <p>other stuff
18566 &lt;/tag&gt;
18567 </p>
18568 !! html/parsoid
18569 <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
18570 &lt;/tag></p>
18571 !! end
18572
18573 ## Don't expect parsoid to rt this form.
18574 !! test
18575 Parser hook: Don't allow unclosed extension tags
18576 !! options
18577 parsoid=wt2html
18578 !! wikitext
18579 test <tag>123
18580
18581 this is a '''test'''
18582 !! html/php
18583 <p>test &lt;tag&gt;123
18584 </p><p>this is a <b>test</b>
18585 </p>
18586 !! html/parsoid
18587 <p>test &lt;tag>123</p>
18588
18589 <p>this is a <b>test</b></p>
18590 !! end
18591
18592 !! test
18593 Parser hook: horizontal rule inside extension tag that outputs <pre>
18594 !! wikitext
18595 <tag>
18596 Hello
18597 <hr/>
18598 Goodbye
18599 </tag>
18600 !! html/php
18601 <pre>
18602 '
18603 Hello
18604 <hr/>
18605 Goodbye
18606 '
18607 array (
18608 )
18609 </pre>
18610
18611 !! end
18612
18613 ###
18614 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18615 ###
18616
18617 !! test
18618 Parser hook: static parser hook not inside a comment
18619 !! wikitext
18620 <statictag>hello, world</statictag>
18621
18622 <statictag action="flush" />
18623 !! html/php
18624 <p><br />
18625 hello, world
18626 </p>
18627 !! html/parsoid
18628 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18629 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18630 !! end
18631
18632 !! test
18633 Parser hook: static parser hook inside a comment
18634 !! wikitext
18635 <!-- <statictag>hello, world</statictag> -->
18636 <statictag action="flush" />
18637 !! html/php
18638 <p><br />
18639 </p>
18640 !! html/parsoid
18641 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18642 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18643 !! end
18644
18645 # Nested template calls; this case was broken by Parser.php rev 1.506,
18646 # since reverted.
18647
18648 !! article
18649 Template:One-parameter
18650 !! text
18651 (My parameter is: {{{1}}})
18652 !! endarticle
18653
18654 !! article
18655 Template:Map-one-parameter
18656 !! text
18657 {{{{{1}}}|{{{2}}}}}
18658 !! endarticle
18659
18660 !! test
18661 Nested template calls
18662 !! wikitext
18663 {{Map-one-parameter|One-parameter|param}}
18664 !! html
18665 <p>(My parameter is: param)
18666 </p>
18667 !! end
18668
18669
18670 ###
18671 ### Sanitizer
18672 ###
18673
18674 # Remex wraps empty tag runs with p-tags.
18675 # Parsoid strips them out during p-wrapping.
18676 !! test
18677 Sanitizer: Closing of open tags
18678 !! wikitext
18679 <s></s><table></table>
18680 !! html/php+tidy
18681 <p><s></s></p><table></table>
18682 !! html/parsoid
18683 <s></s><table></table>
18684 !! end
18685
18686 !! test
18687 Sanitizer: Closing of open but not closed tags
18688 !! wikitext
18689 <s>foo
18690 !! html
18691 <p><s>foo</s>
18692 </p>
18693 !! end
18694
18695 !! test
18696 Sanitizer: Closing of closed but not open tags
18697 !! options
18698 parsoid=wt2html
18699 !! wikitext
18700 </s>
18701 !! html/php+tidy
18702 <p class="mw-empty-elt">
18703 </p>
18704 !! html/parsoid
18705 !! end
18706
18707 !! test
18708 Sanitizer: Closing of closed but not open table tags
18709 !! options
18710 parsoid=wt2html
18711 !! wikitext
18712 Table not started</td></tr></table>
18713 !! html+tidy
18714 <p>Table not started
18715 </p>
18716 !! end
18717
18718 !! test
18719 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18720 !! config
18721 wgFragmentMode=[ 'html5', 'legacy' ]
18722 !! wikitext
18723 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18724 !! html/php
18725 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18726 </p>
18727 !! html/parsoid
18728 <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>
18729 !! end
18730
18731 !! test
18732 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18733 !! config
18734 wgFragmentMode=[ 'legacy' ]
18735 !! wikitext
18736 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18737 !! html/php
18738 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18739 </p>
18740 !! end
18741
18742 # In HTML5, the restrictions are that id must contain at least one character,
18743 # and must not contain any space characters.
18744 !! test
18745 Sanitizer: Validating the contents of the id attribute (T6515)
18746 !! options
18747 disabled
18748 !! wikitext
18749 <br id="" /><br id="a space" />
18750 !! html
18751 Something ...
18752 !! end
18753
18754 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18755 !! test
18756 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18757 !! options
18758 disabled
18759 !! wikitext
18760 <br id="foo" /><br id="foo" />
18761 !! html
18762 Something need to be done. foo-2 ?
18763 !! end
18764
18765 !! test
18766 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18767 !! wikitext
18768 <div itemscope>
18769 <meta itemprop="hello" content="world">
18770 <meta http-equiv="refresh" content="5">
18771 <meta itemprop="hello" http-equiv="refresh" content="5">
18772 <link itemprop="hello" href="{{SERVER}}">
18773 <link rel="stylesheet" href="{{SERVER}}">
18774 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18775 </div>
18776 !! html
18777 <div itemscope="">
18778 <p> <meta itemprop="hello" content="world" />
18779 &lt;meta http-equiv="refresh" content="5"&gt;
18780 <meta itemprop="hello" content="5" />
18781 <link itemprop="hello" href="http&#58;//example.org" />
18782 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18783 <link itemprop="hello" href="http&#58;//example.org" />
18784 </p>
18785 </div>
18786
18787 !! end
18788
18789 !! test
18790 Sanitizer: Strip comments from CSS attributes
18791 !! options
18792 parsoid=wt2html,wt2wt
18793 !! wikitext
18794 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18795 !! html/php
18796 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18797 </p>
18798 !! html/parsoid
18799 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18800 !! end
18801
18802 !! test
18803 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18804 !! wikitext
18805 [[meatball:Soft"Security]]
18806 !! html/php
18807 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18808 </p>
18809 !! html/parsoid
18810 <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>
18811 !! end
18812
18813 !! test
18814 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18815 !! wikitext
18816 [[meatball:Foo<Bar]]
18817 [[meatball:Foo>Bar]]
18818 [[meatball:Foo&lt;bar]]
18819 [[meatball:Foo&gt;bar]]
18820 !! html/php
18821 <p>[[meatball:Foo&lt;Bar]]
18822 [[meatball:Foo&gt;Bar]]
18823 [[meatball:Foo&lt;bar]]
18824 [[meatball:Foo&gt;bar]]
18825 </p>
18826 !! html/parsoid
18827 <p>[[meatball:Foo&lt;Bar]]
18828 [[meatball:Foo>Bar]]
18829 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
18830 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
18831 !! end
18832
18833 !! test
18834 Language converter: output gets cut off unexpectedly (T7757)
18835 !! options
18836 language=zh
18837 !! wikitext
18838 this bit is safe: }-
18839
18840 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18841
18842 then we get cut off here: }-
18843
18844 all additional text is vanished
18845 !! html/php
18846 <p>this bit is safe: }-
18847 </p><p>but if we add a conversion instance: xxx
18848 </p><p>then we get cut off here: }-
18849 </p><p>all additional text is vanished
18850 </p>
18851 !! html/parsoid
18852 <p>this bit is safe: }-</p>
18853 <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>
18854 <p>then we get cut off here: }-</p>
18855 <p>all additional text is vanished</p>
18856 !! end
18857
18858 !! test
18859 Language converter glossary rules inside attributes (T119158)
18860 !! options
18861 language=sr variant=sr-el
18862 !! wikitext
18863 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
18864
18865 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
18866 !! html/php
18867 <p>
18868 </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>
18869 </p>
18870 !! html/parsoid
18871 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
18872
18873 <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>
18874 !! end
18875
18876 !! test
18877 Self closed html pairs (T7487)
18878 !! wikitext
18879 <center><font id="bug" />Centered text</center>
18880 <div><font id="bug2" />In div text</div>
18881 !! html+tidy
18882 <center><font id="bug"></font>Centered text</center>
18883 <div><font id="bug2"></font>In div text</div>
18884 !! end
18885
18886 !! test
18887 Punctuation: nbsp before exclamation
18888 !! wikitext
18889 C'est grave !
18890 !! html
18891 <p>C'est grave&#160;!
18892 </p>
18893 !! end
18894
18895 !! test
18896 Punctuation: CSS !important (T13874)
18897 !! wikitext
18898 <div style="width:50% !important">important</div>
18899 !! html
18900 <div style="width:50% !important">important</div>
18901
18902 !!end
18903
18904 !! test
18905 Punctuation: CSS ! important (T13874; with space after)
18906 !! wikitext
18907 <div style="width:50% ! important">important</div>
18908 !! html
18909 <div style="width:50%&#32;! important">important</div>
18910
18911 !!end
18912
18913 !! test
18914 HTML bullet list, closed tags (T7497)
18915 !! wikitext
18916 <ul>
18917 <li>One</li>
18918 <li>Two</li>
18919 </ul>
18920 !! html/php
18921 <ul>
18922 <li>One</li>
18923 <li>Two</li>
18924 </ul>
18925
18926 !! html/parsoid
18927 <ul data-parsoid='{"stx":"html"}'>
18928 <li data-parsoid='{"stx":"html"}'>One</li>
18929 <li data-parsoid='{"stx":"html"}'>Two</li>
18930 </ul>
18931
18932 !! end
18933
18934 !! test
18935 HTML bullet list, unclosed tags (T7497)
18936 !! wikitext
18937 <ul>
18938 <li>One
18939 <li>Two
18940 </ul>
18941 !! html/php+tidy
18942 <ul>
18943 <li>One
18944 </li><li>Two
18945 </li></ul>
18946 !! html/parsoid
18947 <ul data-parsoid='{"stx":"html"}'>
18948 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18949 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18950 </ul>
18951
18952 !! end
18953
18954 !! test
18955 HTML ordered list, closed tags (T7497)
18956 !! wikitext
18957 <ol>
18958 <li>One</li>
18959 <li>Two</li>
18960 </ol>
18961 !! html/php
18962 <ol>
18963 <li>One</li>
18964 <li>Two</li>
18965 </ol>
18966
18967 !! html/parsoid
18968 <ol data-parsoid='{"stx":"html"}'>
18969 <li data-parsoid='{"stx":"html"}'>One</li>
18970 <li data-parsoid='{"stx":"html"}'>Two</li>
18971 </ol>
18972
18973 !! end
18974
18975 !! test
18976 HTML ordered list, unclosed tags (T7497)
18977 !! options
18978 !! wikitext
18979 <ol>
18980 <li>One
18981 <li>Two
18982 </ol>
18983 !! html/php+tidy
18984 <ol>
18985 <li>One
18986 </li><li>Two
18987 </li></ol>
18988 !! html/parsoid
18989 <ol data-parsoid='{"stx":"html"}'>
18990 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18991 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18992 </ol>
18993
18994 !! end
18995
18996 !! test
18997 HTML nested bullet list, closed tags (T7497)
18998 !! wikitext
18999 <ul>
19000 <li>One</li>
19001 <li>Two:
19002 <ul>
19003 <li>Sub-one</li>
19004 <li>Sub-two</li>
19005 </ul>
19006 </li>
19007 </ul>
19008 !! html/php
19009 <ul>
19010 <li>One</li>
19011 <li>Two:
19012 <ul>
19013 <li>Sub-one</li>
19014 <li>Sub-two</li>
19015 </ul>
19016 </li>
19017 </ul>
19018
19019 !! html/parsoid
19020 <ul data-parsoid='{"stx":"html"}'>
19021 <li data-parsoid='{"stx":"html"}'>One</li>
19022 <li data-parsoid='{"stx":"html"}'>Two:
19023 <ul data-parsoid='{"stx":"html"}'>
19024 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
19025 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
19026 </ul>
19027 </li>
19028 </ul>
19029 !! end
19030
19031 !! test
19032 HTML nested bullet list, open tags (T7497)
19033 !! wikitext
19034 <ul>
19035 <li>One
19036 <li>Two:
19037 <ul>
19038 <li>Sub-one
19039 <li>Sub-two
19040 </ul>
19041 </ul>
19042 !! html+tidy
19043 <ul>
19044 <li>One
19045 </li><li>Two:
19046 <ul>
19047 <li>Sub-one
19048 </li><li>Sub-two
19049 </li></ul>
19050 </li></ul>
19051 !! end
19052
19053 !! test
19054 HTML nested ordered list, closed tags (T7497)
19055 !! wikitext
19056 <ol>
19057 <li>One</li>
19058 <li>Two:
19059 <ol>
19060 <li>Sub-one</li>
19061 <li>Sub-two</li>
19062 </ol>
19063 </li>
19064 </ol>
19065 !! html
19066 <ol>
19067 <li>One</li>
19068 <li>Two:
19069 <ol>
19070 <li>Sub-one</li>
19071 <li>Sub-two</li>
19072 </ol>
19073 </li>
19074 </ol>
19075
19076 !! end
19077
19078 !! test
19079 HTML nested ordered list, open tags (T7497)
19080 !! wikitext
19081 <ol>
19082 <li>One
19083 <li>Two:
19084 <ol>
19085 <li>Sub-one
19086 <li>Sub-two
19087 </ol>
19088 </ol>
19089 !! html/php
19090 <ol>
19091 <li>One
19092 <li>Two:
19093 <ol>
19094 <li>Sub-one
19095 <li>Sub-two
19096 </ol>
19097 </ol>
19098
19099 !! html/parsoid
19100 <ol>
19101 <li>One
19102 </li>
19103 <li>Two:
19104 <ol>
19105 <li>Sub-one
19106 </li>
19107 <li>Sub-two
19108 </li>
19109 </ol>
19110 </li>
19111 </ol>
19112
19113 !! end
19114
19115 !! test
19116 HTML ordered list item with parameters oddity
19117 !! wikitext
19118 <ol><li id="fragment">One</li>
19119 </ol>
19120 !! html
19121 <ol><li id="fragment">One</li>
19122 </ol>
19123
19124 !! end
19125
19126 # parsoid doesn't explicitly mark autonumbered links, see T55505
19127 !!test
19128 T7918: autonumbering
19129 !! wikitext
19130 [http://first/] [http://second] [ftp://ftp]
19131
19132 ftp://inlineftp
19133
19134 [mailto:enclosed@mail.tld With target]
19135
19136 [mailto:enclosed@mail.tld]
19137
19138 mailto:inline@mail.tld
19139 !! html/php
19140 <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>
19141 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
19142 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
19143 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
19144 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
19145 </p>
19146 !! html/parsoid
19147 <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>
19148 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
19149 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
19150 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
19151 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
19152 !! end
19153
19154
19155 #
19156 # Security and HTML correctness
19157 # From Nick Jenkins' fuzz testing
19158 #
19159
19160 !! test
19161 Fuzz testing: Parser13
19162 !! wikitext
19163 {|
19164 | http://a|
19165 !! html
19166 <table>
19167 <tr>
19168 <td>
19169 </td>
19170 </tr>
19171 </table>
19172
19173 !! end
19174
19175 # Note that Parsoid output differs from the PHP parser here: the PHP
19176 # parser breaks the URL for the magic word, while in Parsoid the URL
19177 # production takes precedence.
19178 !! test
19179 Fuzz testing: Parser14
19180 !! wikitext
19181 ==onmouseover===
19182 http://__TOC__
19183 !! html/php
19184 <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>
19185 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>
19186 <ul>
19187 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19188 </ul>
19189 </div>
19190
19191
19192 !! html/php+tidy
19193 <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>
19194 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>
19195 <ul>
19196 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19197 </ul>
19198 </div>
19199 !! html/parsoid
19200 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
19201 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
19202 !! end
19203
19204 !! test
19205 Fuzz testing: Parser14-table
19206 !! options
19207 parsoid=wt2html,html2html
19208 !! wikitext
19209 ==a==
19210 {| STYLE=__TOC__
19211 !! html
19212 <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>
19213 <table style="&#95;_TOC&#95;_">
19214 <tr><td></td></tr>
19215 </table>
19216
19217 !! html+tidy
19218 <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>
19219 <table style="__TOC__">
19220 <tr>
19221 <td></td>
19222 </tr>
19223 </table>
19224 !! html/parsoid
19225 <h2 id="a">a</h2>
19226 <table style="__TOC__"></table>
19227 !! end
19228
19229 # Known to produce bogus xml (extra </td>)
19230 # Don't add the html/php section since it generates broken HTML
19231 !! test
19232 Fuzz testing: Parser16
19233 !! wikitext
19234 {|
19235 !https://||||||
19236 !! html+tidy
19237 <table>
19238 <tbody><tr>
19239 <th>https://</th>
19240 <th></th>
19241 <th></th>
19242 <th>
19243
19244 </th></tr>
19245 </tbody></table>
19246 !! end
19247
19248 !! test
19249 Fuzz testing: Parser21
19250 !! wikitext
19251 {|
19252 !irc://{{ftp://a" onmouseover="alert('hello world');"
19253 |
19254 !! html
19255 <table>
19256 <tr>
19257 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
19258 </th>
19259 <td>
19260 </td>
19261 </tr>
19262 </table>
19263
19264 !! end
19265
19266 !! test
19267 Fuzz testing: Parser22
19268 !! wikitext
19269 http://===r:::https://b
19270
19271 {|
19272 !! html
19273 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
19274 </p>
19275 <table>
19276 <tr><td></td></tr>
19277 </table>
19278
19279 !! end
19280
19281 # Known to produce bad XML for now
19282 !! test
19283 Fuzz testing: Parser24
19284 !! options
19285 parsoid=wt2html
19286 !! wikitext
19287 {|
19288 {{{|
19289 <u CLASS=
19290 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19291 <br style="onmouseover='alert(document.cookie);' " />
19292
19293 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19294 |
19295 !! html/php
19296 <table>
19297 {{{|
19298 <u class="&#124;">}}}} &gt;
19299 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19300
19301 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19302 <tr>
19303 <td></u>
19304 </td>
19305 </tr>
19306 </table>
19307
19308 !! html/parsoid
19309 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
19310 <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>"}'/>}}}} >
19311 <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}'>
19312
19313
19314
19315 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
19316 !! end
19317
19318 # Note: the current result listed for this is not what the original one was,
19319 # but the original bug was JavaScript injection, which is fixed in any case.
19320 # It's not clear that the original result listed was any more correct than the
19321 # current one. Original result:
19322 # <p>{{{|
19323 # </p>
19324 # <li class="&#124;&#124;">
19325 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19326 !!test
19327 Fuzz testing: Parser25 (T8055)
19328 !! wikitext
19329 {{{
19330 |
19331 <LI CLASS=||
19332 >
19333 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19334 !! html/php
19335 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19336 </p>
19337 !! html/parsoid
19338 <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"]}'>
19339 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19340 !! end
19341
19342 !!test
19343 Fuzz testing: URL adjacent extension (with space, clean)
19344 !! wikitext
19345 http://example.com <nowiki>junk</nowiki>
19346 !! html/php
19347 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19348 </p>
19349 !! html/parsoid
19350 <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>
19351 !! end
19352
19353 !!test
19354 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19355 !! wikitext
19356 http://example.com<nowiki>junk</nowiki>
19357 !! html/php
19358 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19359 </p>
19360 !! html/parsoid
19361 <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>
19362 !! end
19363
19364 !! test
19365 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19366 !! wikitext
19367 http://example.com<pre>junk</pre>
19368 !! html/php
19369 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19370
19371 !! html/php+tidy
19372 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19373 !! html/parsoid
19374 <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>
19375 !! end
19376
19377 !! test
19378 Fuzz testing: image with bogus manual thumbnail
19379 !! wikitext
19380 [[Image:foobar.jpg|thumbnail= ]]
19381 !! html/php
19382 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19383
19384 !! html/parsoid
19385 <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>
19386 !! end
19387
19388 # Parsoid will emit the newline literally in wt2wt; see next test case.
19389 !! test
19390 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19391 !! options
19392 parsoid=wt2html
19393 !! wikitext
19394 <pre dir="&#10;"></pre>
19395 !! html/php
19396 <pre dir="&#10;"></pre>
19397
19398 !! html/parsoid
19399 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19400 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19401 !! end
19402
19403 !! test
19404 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19405 !! options
19406 parsoid=html2wt
19407 !! html/parsoid
19408 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19409 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19410 !! wikitext
19411 <pre dir="
19412 "></pre>
19413 !! html/php
19414 <pre dir=""></pre>
19415
19416 !! end
19417
19418 !! test
19419 Templates in extension attributes are not expanded
19420 !! wikitext
19421 <pre dir="{{echo|ltr}}"></pre>
19422 !! html/php
19423 <pre dir="{{echo|ltr}}"></pre>
19424
19425 !! html/parsoid
19426 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19427 !! end
19428
19429 !! test
19430 Parsing optional HTML elements (T8171)
19431 !! options
19432 !! wikitext
19433 <table>
19434 <tr>
19435 <td> Some tabular data</td>
19436 <td> More tabular data ...
19437 <td> And yet som tabular data</td>
19438 </tr>
19439 </table>
19440 !! html
19441 <table>
19442 <tr>
19443 <td> Some tabular data</td>
19444 <td> More tabular data ...
19445 </td><td> And yet som tabular data</td>
19446 </tr>
19447 </table>
19448
19449 !! end
19450
19451 !! test
19452 Correct handling of <td>, <tr> (T8171)
19453 !! options
19454 !! wikitext
19455 <table>
19456 <tr>
19457 <td> Some tabular data</td>
19458 <td> More tabular data ...</td>
19459 <td> And yet som tabular data</td>
19460 </tr>
19461 </table>
19462 !! html
19463 <table>
19464 <tr>
19465 <td> Some tabular data</td>
19466 <td> More tabular data ...</td>
19467 <td> And yet som tabular data</td>
19468 </tr>
19469 </table>
19470
19471 !! end
19472
19473
19474 !! test
19475 Parsing crashing regression (fr:JavaScript)
19476 !! wikitext
19477 </body></x>
19478 !! html
19479 <p>&lt;/body&gt;&lt;/x&gt;
19480 </p>
19481 !! end
19482
19483 !! test
19484 Inline wiki vs wiki block nesting
19485 !! wikitext
19486 '''Bold paragraph
19487
19488 New wiki paragraph
19489 !! html
19490 <p><b>Bold paragraph</b>
19491 </p><p>New wiki paragraph
19492 </p>
19493 !! end
19494
19495 # FIXME: The current php output is documented
19496 # and desired output is the parsoid target.
19497 !! test
19498 Inline HTML vs wiki block nesting
19499 !! wikitext
19500 <b>Bold paragraph
19501
19502 New wiki paragraph
19503 !! html/php
19504 <p><b>Bold paragraph
19505 </p><p>New wiki paragraph</b>
19506 </p>
19507 !! html/parsoid
19508 <p><b>Bold paragraph</b>
19509 </p><p>New wiki paragraph
19510 </p>
19511 !! end
19512
19513 # Original result was this:
19514 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19515 # </p>
19516 # While that might be marginally more intuitive, maybe, the six-apostrophe
19517 # construct is clearly pathological and the result stated here (which is what
19518 # the parser actually does) is about as reasonable as anything.
19519 !!test
19520 Mixing markup for italics and bold
19521 !! options
19522 !! wikitext
19523 '''bold''''''bold''bolditalics'''''
19524 !! html
19525 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19526 </p>
19527 !! end
19528
19529
19530 !! article
19531 Xyzzyx
19532 !! text
19533 Article for special page transclusion test
19534 !! endarticle
19535
19536 !! test
19537 Special page transclusion
19538 !! options
19539 !! wikitext
19540 {{Special:Prefixindex/Xyzzyx}}
19541 !! html
19542 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19543 </ul>
19544
19545 !! end
19546
19547 !! test
19548 Special page transclusion twice (T7021)
19549 !! options
19550 !! wikitext
19551 {{Special:Prefixindex/Xyzzyx}}
19552 {{Special:Prefixindex/Xyzzyx}}
19553 !! html
19554 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19555 </ul>
19556 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19557 </ul>
19558
19559 !! end
19560
19561 !! test
19562 Transclusion of default MediaWiki message
19563 !! wikitext
19564 {{MediaWiki:Mainpage}}
19565 !! html
19566 <p>Main Page
19567 </p>
19568 !! end
19569
19570 !! test
19571 Transclusion of nonexistent MediaWiki message
19572 !! wikitext
19573 {{MediaWiki:Mainpagexxx}}
19574 !! html
19575 <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>
19576 </p>
19577 !! end
19578
19579 !! test
19580 Transclusion of MediaWiki message with underscore
19581 !! wikitext
19582 {{MediaWiki:history_short}}
19583 !! html
19584 <p>History
19585 </p>
19586 !! end
19587
19588 !! test
19589 Transclusion of MediaWiki message with space
19590 !! wikitext
19591 {{MediaWiki:history short}}
19592 !! html
19593 <p>History
19594 </p>
19595 !! end
19596
19597 !! test
19598 Invalid header with following text
19599 !! wikitext
19600 = x = y
19601 !! html
19602 <p>= x = y
19603 </p>
19604 !! end
19605
19606
19607 !! test
19608 Section extraction test (section 0)
19609 !! options
19610 section=0
19611 !! wikitext
19612 start
19613 ==a==
19614 ===aa===
19615 ====aaa====
19616 ==b==
19617 ===ba===
19618 ===bb===
19619 ====bba====
19620 ===bc===
19621 ==c==
19622 ===ca===
19623 !! html/php
19624 start
19625 !! end
19626
19627 !! test
19628 Section extraction test (section 1)
19629 !! options
19630 section=1
19631 !! wikitext
19632 start
19633 ==a==
19634 ===aa===
19635 ====aaa====
19636 ==b==
19637 ===ba===
19638 ===bb===
19639 ====bba====
19640 ===bc===
19641 ==c==
19642 ===ca===
19643 !! html/php
19644 ==a==
19645 ===aa===
19646 ====aaa====
19647 !! end
19648
19649 !! test
19650 Section extraction test (section 2)
19651 !! options
19652 section=2
19653 !! wikitext
19654 start
19655 ==a==
19656 ===aa===
19657 ====aaa====
19658 ==b==
19659 ===ba===
19660 ===bb===
19661 ====bba====
19662 ===bc===
19663 ==c==
19664 ===ca===
19665 !! html/php
19666 ===aa===
19667 ====aaa====
19668 !! end
19669
19670 !! test
19671 Section extraction test (section 3)
19672 !! options
19673 section=3
19674 !! wikitext
19675 start
19676 ==a==
19677 ===aa===
19678 ====aaa====
19679 ==b==
19680 ===ba===
19681 ===bb===
19682 ====bba====
19683 ===bc===
19684 ==c==
19685 ===ca===
19686 !! html/php
19687 ====aaa====
19688 !! end
19689
19690 !! test
19691 Section extraction test (section 4)
19692 !! options
19693 section=4
19694 !! wikitext
19695 start
19696 ==a==
19697 ===aa===
19698 ====aaa====
19699 ==b==
19700 ===ba===
19701 ===bb===
19702 ====bba====
19703 ===bc===
19704 ==c==
19705 ===ca===
19706 !! html/php
19707 ==b==
19708 ===ba===
19709 ===bb===
19710 ====bba====
19711 ===bc===
19712 !! end
19713
19714 !! test
19715 Section extraction test (section 5)
19716 !! options
19717 section=5
19718 !! wikitext
19719 start
19720 ==a==
19721 ===aa===
19722 ====aaa====
19723 ==b==
19724 ===ba===
19725 ===bb===
19726 ====bba====
19727 ===bc===
19728 ==c==
19729 ===ca===
19730 !! html/php
19731 ===ba===
19732 !! end
19733
19734 !! test
19735 Section extraction test (section 6)
19736 !! options
19737 section=6
19738 !! wikitext
19739 start
19740 ==a==
19741 ===aa===
19742 ====aaa====
19743 ==b==
19744 ===ba===
19745 ===bb===
19746 ====bba====
19747 ===bc===
19748 ==c==
19749 ===ca===
19750 !! html/php
19751 ===bb===
19752 ====bba====
19753 !! end
19754
19755 !! test
19756 Section extraction test (section 7)
19757 !! options
19758 section=7
19759 !! wikitext
19760 start
19761 ==a==
19762 ===aa===
19763 ====aaa====
19764 ==b==
19765 ===ba===
19766 ===bb===
19767 ====bba====
19768 ===bc===
19769 ==c==
19770 ===ca===
19771 !! html/php
19772 ====bba====
19773 !! end
19774
19775 !! test
19776 Section extraction test (section 8)
19777 !! options
19778 section=8
19779 !! wikitext
19780 start
19781 ==a==
19782 ===aa===
19783 ====aaa====
19784 ==b==
19785 ===ba===
19786 ===bb===
19787 ====bba====
19788 ===bc===
19789 ==c==
19790 ===ca===
19791 !! html/php
19792 ===bc===
19793 !! end
19794
19795 !! test
19796 Section extraction test (section 9)
19797 !! options
19798 section=9
19799 !! wikitext
19800 start
19801 ==a==
19802 ===aa===
19803 ====aaa====
19804 ==b==
19805 ===ba===
19806 ===bb===
19807 ====bba====
19808 ===bc===
19809 ==c==
19810 ===ca===
19811 !! html/php
19812 ==c==
19813 ===ca===
19814 !! end
19815
19816 !! test
19817 Section extraction test (section 10)
19818 !! options
19819 section=10
19820 !! wikitext
19821 start
19822 ==a==
19823 ===aa===
19824 ====aaa====
19825 ==b==
19826 ===ba===
19827 ===bb===
19828 ====bba====
19829 ===bc===
19830 ==c==
19831 ===ca===
19832 !! html/php
19833 ===ca===
19834 !! end
19835
19836 !! test
19837 Section extraction test (nonexistent section 11)
19838 !! options
19839 section=11
19840 !! wikitext
19841 start
19842 ==a==
19843 ===aa===
19844 ====aaa====
19845 ==b==
19846 ===ba===
19847 ===bb===
19848 ====bba====
19849 ===bc===
19850 ==c==
19851 ===ca===
19852 !! html/php
19853 !! end
19854
19855 !! test
19856 Section extraction test with bogus heading (section 1)
19857 !! options
19858 section=1
19859 !! wikitext
19860 ==a==
19861 ==bogus== not a legal section
19862 ==b==
19863 !! html/php
19864 ==a==
19865 ==bogus== not a legal section
19866 !! end
19867
19868 !! test
19869 Section extraction test with bogus heading (section 2)
19870 !! options
19871 section=2
19872 !! wikitext
19873 ==a==
19874 ==bogus== not a legal section
19875 ==b==
19876 !! html/php
19877 ==b==
19878 !! end
19879
19880 !! test
19881 Section extraction test with comment after heading (section 1)
19882 !! options
19883 section=1
19884 !! wikitext
19885 ==a==
19886 ==b== <!-- -->
19887 ==c==
19888 !! html/php
19889 ==a==
19890 !! end
19891
19892 !! test
19893 Section extraction test with comment after heading (section 2)
19894 !! options
19895 section=2
19896 !! wikitext
19897 ==a==
19898 ==b== <!-- -->
19899 ==c==
19900 !! html/php
19901 ==b== <!-- -->
19902 !! end
19903
19904 !! test
19905 Section extraction test with bogus <nowiki> heading (section 1)
19906 !! options
19907 section=1
19908 !! wikitext
19909 ==a==
19910 ==bogus== <nowiki>not a legal section</nowiki>
19911 ==b==
19912 !! html/php
19913 ==a==
19914 ==bogus== <nowiki>not a legal section</nowiki>
19915 !! end
19916
19917 !! test
19918 Section extraction test with bogus <nowiki> heading (section 2)
19919 !! options
19920 section=2
19921 !! wikitext
19922 ==a==
19923 ==bogus== <nowiki>not a legal section</nowiki>
19924 ==b==
19925 !! html/php
19926 ==b==
19927 !! end
19928
19929 # Formerly testing for T4587, now resolved by the use of unmarked sections
19930 # instead of respecting commented sections
19931 !! test
19932 Section extraction prefixed by comment (section 1)
19933 !! options
19934 section=1
19935 !! wikitext
19936 <!-- -->==sec1==
19937 ==sec2==
19938 !! html/php
19939 ==sec2==
19940 !!end
19941
19942 !! test
19943 Section extraction prefixed by comment (section 2)
19944 !! options
19945 section=2
19946 !! wikitext
19947 <!-- -->==sec1==
19948 ==sec2==
19949 !! html/php
19950
19951 !!end
19952
19953 # Formerly testing for T4607, now resolved by the use of unmarked sections
19954 # instead of respecting HTML-style headings
19955 !! test
19956 Section extraction, mixed wiki and html (section 1)
19957 !! options
19958 section=1
19959 !! wikitext
19960 <h2>unmarked</h2>
19961 unmarked
19962 ==1==
19963 one
19964 ==2==
19965 two
19966 !! html/php
19967 ==1==
19968 one
19969 !! end
19970
19971 !! test
19972 Section extraction, mixed wiki and html (section 2)
19973 !! options
19974 section=2
19975 !! wikitext
19976 <h2>unmarked</h2>
19977 unmarked
19978 ==1==
19979 one
19980 ==2==
19981 two
19982 !! html/php
19983 ==2==
19984 two
19985 !! end
19986
19987
19988 # Formerly testing for T5342
19989 !! test
19990 Section extraction, heading surrounded by <noinclude>
19991 !! options
19992 section=1
19993 !! wikitext
19994 <noinclude>==unmarked==</noinclude>
19995 ==marked==
19996 !! html/php
19997 ==marked==
19998 !!end
19999
20000 # Test behavior of T21910
20001 !! test
20002 Sectiion with all-equals
20003 !! options
20004 section=2
20005 !! wikitext
20006 ===
20007 The line above must have a trailing space
20008 === <!--
20009 --> <!-- -->
20010 But just in case it doesn't...
20011 !! html/php
20012 === <!--
20013 --> <!-- -->
20014 But just in case it doesn't...
20015 !! end
20016
20017 !! test
20018 Section replacement test (section 0)
20019 !! options
20020 replace=0,"xxx"
20021 !! wikitext
20022 start
20023 ==a==
20024 ===aa===
20025 ====aaa====
20026 ==b==
20027 ===ba===
20028 ===bb===
20029 ====bba====
20030 ===bc===
20031 ==c==
20032 ===ca===
20033 !! html/php
20034 xxx
20035
20036 ==a==
20037 ===aa===
20038 ====aaa====
20039 ==b==
20040 ===ba===
20041 ===bb===
20042 ====bba====
20043 ===bc===
20044 ==c==
20045 ===ca===
20046 !! end
20047
20048 !! test
20049 Section replacement test (section 1)
20050 !! options
20051 replace=1,"xxx"
20052 !! wikitext
20053 start
20054 ==a==
20055 ===aa===
20056 ====aaa====
20057 ==b==
20058 ===ba===
20059 ===bb===
20060 ====bba====
20061 ===bc===
20062 ==c==
20063 ===ca===
20064 !! html/php
20065 start
20066 xxx
20067
20068 ==b==
20069 ===ba===
20070 ===bb===
20071 ====bba====
20072 ===bc===
20073 ==c==
20074 ===ca===
20075 !! end
20076
20077 !! test
20078 Section replacement test (section 2)
20079 !! options
20080 replace=2,"xxx"
20081 !! wikitext
20082 start
20083 ==a==
20084 ===aa===
20085 ====aaa====
20086 ==b==
20087 ===ba===
20088 ===bb===
20089 ====bba====
20090 ===bc===
20091 ==c==
20092 ===ca===
20093 !! html/php
20094 start
20095 ==a==
20096 xxx
20097
20098 ==b==
20099 ===ba===
20100 ===bb===
20101 ====bba====
20102 ===bc===
20103 ==c==
20104 ===ca===
20105 !! end
20106
20107 !! test
20108 Section replacement test (section 3)
20109 !! options
20110 replace=3,"xxx"
20111 !! wikitext
20112 start
20113 ==a==
20114 ===aa===
20115 ====aaa====
20116 ==b==
20117 ===ba===
20118 ===bb===
20119 ====bba====
20120 ===bc===
20121 ==c==
20122 ===ca===
20123 !! html/php
20124 start
20125 ==a==
20126 ===aa===
20127 xxx
20128
20129 ==b==
20130 ===ba===
20131 ===bb===
20132 ====bba====
20133 ===bc===
20134 ==c==
20135 ===ca===
20136 !! end
20137
20138 !! test
20139 Section replacement test (section 4)
20140 !! options
20141 replace=4,"xxx"
20142 !! wikitext
20143 start
20144 ==a==
20145 ===aa===
20146 ====aaa====
20147 ==b==
20148 ===ba===
20149 ===bb===
20150 ====bba====
20151 ===bc===
20152 ==c==
20153 ===ca===
20154 !! html/php
20155 start
20156 ==a==
20157 ===aa===
20158 ====aaa====
20159 xxx
20160
20161 ==c==
20162 ===ca===
20163 !! end
20164
20165 !! test
20166 Section replacement test (section 5)
20167 !! options
20168 replace=5,"xxx"
20169 !! wikitext
20170 start
20171 ==a==
20172 ===aa===
20173 ====aaa====
20174 ==b==
20175 ===ba===
20176 ===bb===
20177 ====bba====
20178 ===bc===
20179 ==c==
20180 ===ca===
20181 !! html/php
20182 start
20183 ==a==
20184 ===aa===
20185 ====aaa====
20186 ==b==
20187 xxx
20188
20189 ===bb===
20190 ====bba====
20191 ===bc===
20192 ==c==
20193 ===ca===
20194 !! end
20195
20196 !! test
20197 Section replacement test (section 6)
20198 !! options
20199 replace=6,"xxx"
20200 !! wikitext
20201 start
20202 ==a==
20203 ===aa===
20204 ====aaa====
20205 ==b==
20206 ===ba===
20207 ===bb===
20208 ====bba====
20209 ===bc===
20210 ==c==
20211 ===ca===
20212 !! html/php
20213 start
20214 ==a==
20215 ===aa===
20216 ====aaa====
20217 ==b==
20218 ===ba===
20219 xxx
20220
20221 ===bc===
20222 ==c==
20223 ===ca===
20224 !! end
20225
20226 !! test
20227 Section replacement test (section 7)
20228 !! options
20229 replace=7,"xxx"
20230 !! wikitext
20231 start
20232 ==a==
20233 ===aa===
20234 ====aaa====
20235 ==b==
20236 ===ba===
20237 ===bb===
20238 ====bba====
20239 ===bc===
20240 ==c==
20241 ===ca===
20242 !! html/php
20243 start
20244 ==a==
20245 ===aa===
20246 ====aaa====
20247 ==b==
20248 ===ba===
20249 ===bb===
20250 xxx
20251
20252 ===bc===
20253 ==c==
20254 ===ca===
20255 !! end
20256
20257 !! test
20258 Section replacement test (section 8)
20259 !! options
20260 replace=8,"xxx"
20261 !! wikitext
20262 start
20263 ==a==
20264 ===aa===
20265 ====aaa====
20266 ==b==
20267 ===ba===
20268 ===bb===
20269 ====bba====
20270 ===bc===
20271 ==c==
20272 ===ca===
20273 !! html/php
20274 start
20275 ==a==
20276 ===aa===
20277 ====aaa====
20278 ==b==
20279 ===ba===
20280 ===bb===
20281 ====bba====
20282 xxx
20283
20284 ==c==
20285 ===ca===
20286 !!end
20287
20288 !! test
20289 Section replacement test (section 9)
20290 !! options
20291 replace=9,"xxx"
20292 !! wikitext
20293 start
20294 ==a==
20295 ===aa===
20296 ====aaa====
20297 ==b==
20298 ===ba===
20299 ===bb===
20300 ====bba====
20301 ===bc===
20302 ==c==
20303 ===ca===
20304 !! html/php
20305 start
20306 ==a==
20307 ===aa===
20308 ====aaa====
20309 ==b==
20310 ===ba===
20311 ===bb===
20312 ====bba====
20313 ===bc===
20314 xxx
20315 !! end
20316
20317 !! test
20318 Section replacement test (section 10)
20319 !! options
20320 replace=10,"xxx"
20321 !! wikitext
20322 start
20323 ==a==
20324 ===aa===
20325 ====aaa====
20326 ==b==
20327 ===ba===
20328 ===bb===
20329 ====bba====
20330 ===bc===
20331 ==c==
20332 ===ca===
20333 !! html/php
20334 start
20335 ==a==
20336 ===aa===
20337 ====aaa====
20338 ==b==
20339 ===ba===
20340 ===bb===
20341 ====bba====
20342 ===bc===
20343 ==c==
20344 xxx
20345 !! end
20346
20347 !! test
20348 Section replacement test with initial whitespace (T15728)
20349 !! options
20350 replace=2,"xxx"
20351 !! wikitext
20352 Preformatted initial line
20353 ==a==
20354 ===a===
20355 !! html/php
20356 Preformatted initial line
20357 ==a==
20358 xxx
20359 !! end
20360
20361
20362 !! test
20363 Section extraction, heading followed by pre with 20 spaces (T8398)
20364 !! options
20365 section=1
20366 !! wikitext
20367 ==a==
20368 a
20369 !! html/php
20370 ==a==
20371 a
20372 !! end
20373
20374 !! test
20375 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20376 !! options
20377 section=1
20378 !! wikitext
20379 ==a==
20380 a
20381 !! html/php
20382 ==a==
20383 a
20384 !! end
20385
20386
20387 !! test
20388 Section extraction, <pre> around bogus header (T12309)
20389 !! options
20390 section=2
20391 !! wikitext
20392 == Section One ==
20393 <pre>
20394 =======
20395 </pre>
20396
20397 == Section Two ==
20398 stuff
20399 !! html/php
20400 == Section Two ==
20401 stuff
20402 !! end
20403
20404 !! test
20405 Section replacement, <pre> around bogus header (T12309)
20406 !! options
20407 replace=2,"xxx"
20408 !! wikitext
20409 == Section One ==
20410 <pre>
20411 =======
20412 </pre>
20413
20414 == Section Two ==
20415 stuff
20416 !! html/php
20417 == Section One ==
20418 <pre>
20419 =======
20420 </pre>
20421
20422 xxx
20423 !! end
20424
20425 !! test
20426 Handling of &#x0A; in URLs
20427 !! wikitext
20428 *irc://&#x0A;a
20429 !! html/php
20430 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20431
20432 !! html/parsoid
20433 <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>
20434 !! end
20435
20436 !! test
20437 Handling of %0A in URLs
20438 !! wikitext
20439 *irc://%0Aa
20440 !! html/php
20441 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20442
20443 !! html/parsoid
20444 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20445 !! end
20446
20447 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20448 !! test
20449 5 quotes, code coverage +1 line
20450 !! options
20451 parsoid=wt2html
20452 !! wikitext
20453 '''''
20454 !! html/php
20455 !! html/parsoid
20456 <b><i></i></b>
20457 !! end
20458
20459 # same html as previous, but wikitext adjusted to match parsoid html2wt
20460 # note that wt2html and html2html will put the <i> before the <b>
20461 !! test
20462 5 quotes, code coverage +1 line w/ nowiki (1)
20463 !! options
20464 parsoid=wt2wt,html2wt
20465 !! wikitext
20466 '''''<nowiki/>'''''
20467 !! html/php
20468 <p><i></i>
20469 </p>
20470 !! html/parsoid
20471 <p><b><i></i></b></p>
20472 !! end
20473
20474 # same as previous, just swapping the <i> and <b>
20475 !! test
20476 5 quotes, code coverage +1 line w/ nowiki (2)
20477 !! wikitext
20478 '''''<nowiki/>'''''
20479 !! html/php
20480 <p><i></i>
20481 </p>
20482 !! html/parsoid
20483 <p><i><b></b></i></p>
20484 !! end
20485
20486 !! test
20487 Special:Search page linking.
20488 !! wikitext
20489 {{Special:search}}
20490 !! html
20491 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20492 </p>
20493 !! end
20494
20495 !! test
20496 {{!}} is a magic word
20497 !! wikitext
20498 {{!}} is a magic word there and {{!}} is still a magic word here
20499 | is not a magic word here but {{!}} is still a magic word here
20500 !! html/php
20501 <p>| is a magic word there and | is still a magic word here
20502 | is not a magic word here but | is still a magic word here
20503 </p>
20504 !! html/parsoid
20505 <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
20506 | 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>
20507 !! end
20508
20509 !! test
20510 Say the magic word
20511 !! options
20512 title=[[Parser test]]
20513 !! wikitext
20514 *{{PAGENAME}}
20515 *{{PAGENAMEE}}
20516 *{{FULLPAGENAME}}
20517 *{{FULLPAGENAMEE}}
20518 *{{BASEPAGENAME}}
20519 *{{BASEPAGENAMEE}}
20520 *{{SUBPAGENAME}}
20521 *{{SUBPAGENAMEE}}
20522 *{{ROOTPAGENAME}}
20523 *{{ROOTPAGENAMEE}}
20524 *{{TALKPAGENAME}}
20525 *{{TALKPAGENAMEE}}
20526 *{{SUBJECTPAGENAME}}
20527 *{{SUBJECTPAGENAMEE}}
20528 *{{NAMESPACEE}}
20529 *{{NAMESPACE}}
20530 *{{NAMESPACENUMBER}}
20531 *{{TALKSPACE}}
20532 *{{TALKSPACEE}}
20533 *{{SUBJECTSPACE}}
20534 *{{SUBJECTSPACEE}}
20535 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20536 !! html
20537 <ul><li>Parser test</li>
20538 <li>Parser_test</li>
20539 <li>Parser test</li>
20540 <li>Parser_test</li>
20541 <li>Parser test</li>
20542 <li>Parser_test</li>
20543 <li>Parser test</li>
20544 <li>Parser_test</li>
20545 <li>Parser test</li>
20546 <li>Parser_test</li>
20547 <li>Talk:Parser test</li>
20548 <li>Talk:Parser_test</li>
20549 <li>Parser test</li>
20550 <li>Parser_test</li>
20551 <li></li>
20552 <li></li>
20553 <li>0</li>
20554 <li>Talk</li>
20555 <li>Talk</li>
20556 <li></li>
20557 <li></li>
20558 <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>
20559
20560 !! end
20561 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20562
20563 !! test
20564 Gallery with valid attributes
20565 !! wikitext
20566 <gallery type="123" summary="345">
20567 File:File:Foobar.jpg
20568 </gallery>
20569 !! html/php
20570 <ul class="gallery mw-gallery-traditional" type="123">
20571 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20572 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20573 <div class="gallerytext">
20574 </div>
20575 </div></li>
20576 </ul>
20577
20578 !! html/parsoid
20579 <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"}}'>
20580 <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>
20581 </ul>
20582 !! end
20583
20584 ## Parsoid thinks the "centre" here is a property, not a caption.
20585 !! test
20586 Gallery
20587 !! options
20588 parsoid={
20589 "modes": ["wt2html"],
20590 "nativeGallery": true
20591 }
20592 !! wikitext
20593 <gallery>
20594 image1.png |
20595 image2.gif|||||
20596
20597 image3|
20598 image4 |300px| centre
20599 image5.svg| http://///////
20600 [[x|xx]]]]
20601 * image6
20602 </gallery>
20603 !! html/php
20604 <ul class="gallery mw-gallery-traditional">
20605 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20606 <div class="thumb" style="height: 150px;">Image1.png</div>
20607 <div class="gallerytext">
20608 </div>
20609 </div></li>
20610 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20611 <div class="thumb" style="height: 150px;">Image2.gif</div>
20612 <div class="gallerytext">
20613 </div>
20614 </div></li>
20615 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20616 <div class="thumb" style="height: 150px;">Image3</div>
20617 <div class="gallerytext">
20618 </div>
20619 </div></li>
20620 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20621 <div class="thumb" style="height: 150px;">Image4</div>
20622 <div class="gallerytext">
20623 <pre>centre
20624 </pre>
20625 </div>
20626 </div></li>
20627 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20628 <div class="thumb" style="height: 150px;">Image5.svg</div>
20629 <div class="gallerytext">
20630 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20631 </p>
20632 </div>
20633 </div></li>
20634 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20635 <div class="thumb" style="height: 150px;">* image6</div>
20636 <div class="gallerytext">
20637 </div>
20638 </div></li>
20639 </ul>
20640
20641 !! html/parsoid
20642 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20643 <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>
20644 <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>
20645 <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>
20646 <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>
20647 <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>
20648 <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>
20649 </ul>
20650 !! end
20651
20652 !! test
20653 Gallery (with options, html)
20654 !! options
20655 parsoid={
20656 "modes": ["wt2html", "html2html"],
20657 "nativeGallery": true
20658 }
20659 !! wikitext
20660 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20661 File:Nonexistent.jpg|caption
20662 File:Nonexistent.jpg
20663 image:foobar.jpg|some '''caption''' [[Main Page]]
20664 image:foobar.jpg
20665 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20666 </gallery>
20667 !! html/php
20668 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20669 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20670 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20671 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20672 <div class="gallerytext">
20673 <p>caption
20674 </p>
20675 </div>
20676 </div></li>
20677 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20678 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20679 <div class="gallerytext">
20680 </div>
20681 </div></li>
20682 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20683 <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>
20684 <div class="gallerytext">
20685 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20686 </p>
20687 </div>
20688 </div></li>
20689 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20690 <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>
20691 <div class="gallerytext">
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="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>
20696 <div class="gallerytext">
20697 <p>blabla.
20698 </p>
20699 </div>
20700 </div></li>
20701 </ul>
20702
20703 !! html/parsoid
20704 <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":{}}'>
20705 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20706 <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>
20707 <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>
20708 <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>
20709 <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>
20710 <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>
20711 </ul>
20712 !! end
20713
20714 !! test
20715 Gallery (with options, extsrc)
20716 !! options
20717 parsoid={
20718 "nativeGallery": false
20719 }
20720 !! wikitext
20721 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20722 File:Nonexistent.jpg|caption
20723 File:Nonexistent.jpg
20724 image:foobar.jpg|some '''caption''' [[Main Page]]
20725 image:foobar.jpg
20726 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20727 </gallery>
20728 !! html/php
20729 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20730 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20731 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20732 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20733 <div class="gallerytext">
20734 <p>caption
20735 </p>
20736 </div>
20737 </div></li>
20738 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20739 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20740 <div class="gallerytext">
20741 </div>
20742 </div></li>
20743 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20744 <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>
20745 <div class="gallerytext">
20746 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20747 </p>
20748 </div>
20749 </div></li>
20750 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20751 <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>
20752 <div class="gallerytext">
20753 </div>
20754 </div></li>
20755 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20756 <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>
20757 <div class="gallerytext">
20758 <p>blabla.
20759 </p>
20760 </div>
20761 </div></li>
20762 </ul>
20763
20764 !! html/parsoid
20765 <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"}}'>
20766 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20767 <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>
20768 <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>
20769 <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>
20770 <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>
20771 <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>
20772 </ul>
20773 !! end
20774
20775 !! test
20776 Gallery (without px units)
20777 !! wikitext
20778 <gallery widths="70" heights="40">
20779 File:Foobar.jpg
20780 </gallery>
20781 !! html/php
20782 <ul class="gallery mw-gallery-traditional">
20783 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20784 <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>
20785 <div class="gallerytext">
20786 </div>
20787 </div></li>
20788 </ul>
20789
20790 !! html/parsoid
20791 <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"}}'>
20792 <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>
20793 </ul>
20794 !! end
20795
20796 !! test
20797 Gallery (with invalid units)
20798 !! wikitext
20799 <gallery widths="70em" heights="40em">
20800 File:Foobar.jpg
20801 </gallery>
20802 !! html/php
20803 <ul class="gallery mw-gallery-traditional">
20804 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20805 <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>
20806 <div class="gallerytext">
20807 </div>
20808 </div></li>
20809 </ul>
20810
20811 !! html/parsoid
20812 <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"}}'>
20813 <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>
20814 </ul>
20815 !! end
20816
20817 !! test
20818 Gallery with link that has fragment
20819 !! options
20820 parsoid={
20821 "modes": ["wt2html", "html2html"],
20822 "nativeGallery": true
20823 }
20824 !! wikitext
20825 <gallery>
20826 image:foobar.jpg|link=Main_Page
20827 image:foobar.jpg|link=Main_Page#section
20828 image:foobar.jpg|link=Main Page#section|caption
20829 </gallery>
20830 !! html/php
20831 <ul class="gallery mw-gallery-traditional">
20832 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20833 <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>
20834 <div class="gallerytext">
20835 </div>
20836 </div></li>
20837 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20838 <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>
20839 <div class="gallerytext">
20840 </div>
20841 </div></li>
20842 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20843 <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>
20844 <div class="gallerytext">
20845 <p>caption
20846 </p>
20847 </div>
20848 </div></li>
20849 </ul>
20850
20851 !! html/parsoid
20852 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20853 <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>
20854 <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>
20855 <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>
20856 </ul>
20857 !! end
20858
20859 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20860 !! test
20861 Gallery with template inside caption
20862 !! options
20863 parsoid={
20864 "nativeGallery": true
20865 }
20866 !! wikitext
20867 <gallery caption="{{echo|hi}}">
20868 File:Foobar.jpg|{{echo|ho}}
20869 </gallery>
20870 !! html/php
20871 <ul class="gallery mw-gallery-traditional">
20872 <li class='gallerycaption'>{{echo|hi}}</li>
20873 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20874 <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>
20875 <div class="gallerytext">
20876 <p>ho
20877 </p>
20878 </div>
20879 </div></li>
20880 </ul>
20881
20882 !! html/parsoid
20883 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20884 <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>
20885 <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>
20886 </ul>
20887 !! end
20888
20889 !! test
20890 Gallery with wikitext inside caption
20891 !! options
20892 parsoid={
20893 "nativeGallery": true
20894 }
20895 !! wikitext
20896 <gallery>
20897 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20898 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20899 </gallery>
20900 !! html/php
20901 <ul class="gallery mw-gallery-traditional">
20902 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20903 <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>
20904 <div class="gallerytext">
20905 <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>
20906 </p>
20907 </div>
20908 </div></li>
20909 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20910 <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>
20911 <div class="gallerytext">
20912 <p>This is a test template
20913 </p>
20914 </div>
20915 </div></li>
20916 </ul>
20917
20918 !! html/parsoid
20919 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
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 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>
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 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>
20922 </ul>
20923 !! end
20924
20925 !! test
20926 Gallery (with showfilename option)
20927 !! options
20928 parsoid={
20929 "nativeGallery": true
20930 }
20931 !! wikitext
20932 <gallery showfilename="">
20933 File:Nonexistent.jpg|caption
20934 File:Nonexistent.jpg
20935 File:Foobar.jpg|some '''caption''' [[Main Page]]
20936 File:Foobar.jpg
20937 </gallery>
20938 !! html/php
20939 <ul class="gallery mw-gallery-traditional">
20940 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20941 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20942 <div class="gallerytext">
20943 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20944 caption
20945 </p>
20946 </div>
20947 </div></li>
20948 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20949 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20950 <div class="gallerytext">
20951 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20952 </p>
20953 </div>
20954 </div></li>
20955 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20956 <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>
20957 <div class="gallerytext">
20958 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20959 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20960 </p>
20961 </div>
20962 </div></li>
20963 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20964 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20965 <div class="gallerytext">
20966 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20967 </p>
20968 </div>
20969 </div></li>
20970 </ul>
20971
20972 !! html/parsoid
20973 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20974 <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>
20975 <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>
20976 <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>
20977 <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>
20978 </ul>
20979 !! end
20980
20981 ## Should Parsoid be preserving these variations? See T151367
20982 !! test
20983 Gallery (with namespace-less filenames)
20984 !! options
20985 parsoid={
20986 "modes": ["wt2html", "html2html"],
20987 "nativeGallery": true
20988 }
20989 !! wikitext
20990 <gallery>
20991 File:Nonexistent.jpg
20992 Nonexistent.jpg
20993 image:foobar.jpg
20994 foobar.jpg
20995 </gallery>
20996 !! html/php
20997 <ul class="gallery mw-gallery-traditional">
20998 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20999 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21000 <div class="gallerytext">
21001 </div>
21002 </div></li>
21003 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21004 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21005 <div class="gallerytext">
21006 </div>
21007 </div></li>
21008 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21009 <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>
21010 <div class="gallerytext">
21011 </div>
21012 </div></li>
21013 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21014 <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>
21015 <div class="gallerytext">
21016 </div>
21017 </div></li>
21018 </ul>
21019
21020 !! html/parsoid
21021 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21022 <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>
21023 <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>
21024 <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>
21025 <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>
21026 </ul>
21027 !! end
21028
21029 !! test
21030 Gallery override link with wikilink (T36852)
21031 !! options
21032 parsoid={
21033 "nativeGallery": true
21034 }
21035 !! wikitext
21036 <gallery>
21037 File:Foobar.jpg|alt=galleryalt|link=Wikilink
21038 </gallery>
21039 !! html/php
21040 <ul class="gallery mw-gallery-traditional">
21041 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21042 <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>
21043 <div class="gallerytext">
21044 </div>
21045 </div></li>
21046 </ul>
21047
21048 !! html/parsoid
21049 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21050 <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>
21051 </ul>
21052 !! end
21053
21054 !! test
21055 Gallery override link with absolute external link (T36852)
21056 !! options
21057 parsoid={
21058 "nativeGallery": true
21059 }
21060 !! wikitext
21061 <gallery>
21062 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
21063 </gallery>
21064 !! html/php
21065 <ul class="gallery mw-gallery-traditional">
21066 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21067 <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>
21068 <div class="gallerytext">
21069 </div>
21070 </div></li>
21071 </ul>
21072
21073 !! html/parsoid
21074 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21075 <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>
21076 </ul>
21077 !! end
21078
21079 !! test
21080 Gallery override link with absolute external link with LanguageConverter
21081 !! options
21082 language=zh
21083 !! wikitext
21084 <gallery>
21085 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21086 </gallery>
21087 !! html/php
21088 <ul class="gallery mw-gallery-traditional">
21089 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21090 <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>
21091 <div class="gallerytext">
21092 <p>caption
21093 </p>
21094 </div>
21095 </div></li>
21096 </ul>
21097
21098 !! html/parsoid
21099 <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"}}'>
21100 <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>
21101 </ul>
21102 !! end
21103
21104 !! test
21105 Gallery override link with malicious javascript (T36852)
21106 !! options
21107 parsoid={
21108 "modes": ["wt2html", "html2html"],
21109 "nativeGallery": true
21110 }
21111 !! wikitext
21112 <gallery>
21113 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21114 </gallery>
21115 !! html/php
21116 <ul class="gallery mw-gallery-traditional">
21117 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21118 <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>
21119 <div class="gallerytext">
21120 </div>
21121 </div></li>
21122 </ul>
21123
21124 !! html/parsoid
21125 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21126 <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>
21127 </ul>
21128 !! end
21129
21130 # Note that parsoid uses the invalid link as a caption, PHP does not.
21131 !! test
21132 Gallery with invalid title as link (T45964)
21133 !! options
21134 parsoid={
21135 "modes": ["wt2html", "html2html"],
21136 "nativeGallery": true
21137 }
21138 !! wikitext
21139 <gallery>
21140 File:Foobar.jpg|link=<
21141 </gallery>
21142 !! html/php
21143 <ul class="gallery mw-gallery-traditional">
21144 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21145 <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>
21146 <div class="gallerytext">
21147 </div>
21148 </div></li>
21149 </ul>
21150
21151 !! html/parsoid
21152 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21153 <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>
21154 </ul>
21155 !! end
21156
21157 !! test
21158 Serialize gallery without attrs in data-mw
21159 !! options
21160 parsoid={
21161 "modes": ["html2wt"],
21162 "nativeGallery": true
21163 }
21164 !! html/parsoid
21165 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
21166 <li class="gallerycaption">123</li>
21167 <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>
21168 </ul>
21169 !! wikitext
21170 <gallery caption="123">
21171 File:Test.png
21172 </gallery>
21173 !! end
21174
21175 !! test
21176 Gallery with class and style attributes
21177 !! options
21178 parsoid={
21179 "nativeGallery": true
21180 }
21181 !! wikitext
21182 <gallery class="center" style="text-align: center;">
21183 File:Foobar.jpg
21184 </gallery>
21185 !! html/php
21186 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
21187 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21188 <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>
21189 <div class="gallerytext">
21190 </div>
21191 </div></li>
21192 </ul>
21193
21194 !! html/parsoid
21195 <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":{}}'>
21196 <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>
21197 </ul>
21198 !! end
21199
21200 !! test
21201 Gallery in slideshow mode
21202 !! options
21203 parsoid={
21204 "nativeGallery": true
21205 }
21206 !! wikitext
21207 <gallery mode="slideshow" showthumbnails="">
21208 File:Foobar.jpg
21209 </gallery>
21210 !! html/php
21211 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
21212 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21213 <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>
21214 <div class="gallerytext">
21215 </div>
21216 </div></li>
21217 </ul>
21218
21219 !! html/parsoid
21220 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
21221 <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>
21222 </ul>
21223 !! end
21224
21225 !! test
21226 Serialize gallery image captions on a line
21227 !! options
21228 parsoid={
21229 "modes": ["html2wt"],
21230 "nativeGallery": true
21231 }
21232 !! html/parsoid
21233 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21234 <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>
21235 <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>
21236 </ul>
21237 !! wikitext
21238 <gallery>
21239 File:Foobar.jpg| hi ho
21240 File:Foobar.jpg|hi<br />ho
21241 </gallery>
21242 !! end
21243
21244 !! test
21245 HTML Hex character encoding (spells the word "JavaScript")
21246 !! options
21247 parsoid=wt2html,wt2wt,html2html
21248 !! wikitext
21249 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
21250 !! html/php
21251 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
21252 </p>
21253 !! html/parsoid
21254 <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>
21255 !! end
21256
21257 !! test
21258 HTML Hex character encoding bogus encoding (T28437 regression check)
21259 !! wikitext
21260 &#xsee;&#XSEE;
21261 !! html
21262 <p>&amp;#xsee;&amp;#XSEE;
21263 </p>
21264 !! end
21265
21266 !! test
21267 HTML Hex character encoding mixed case
21268 !! options
21269 parsoid=wt2html,wt2wt,html2html
21270 !! wikitext
21271 &#xEE;&#Xee;
21272 !! html/php
21273 <p>&#xee;&#xee;
21274 </p>
21275 !! html/parsoid
21276 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
21277 !! end
21278
21279 # See: https://www.w3.org/TR/html5/syntax.html#character-references
21280 # Note that U+000C (form feed) is not a valid XML character, so
21281 # it is banned even though allowed in HTML5.
21282 !! test
21283 Illegal character references (T106578)
21284 !! wikitext
21285 ; Null: &#00;
21286 ; FF: &#xC;
21287 ; CR: &#xD;
21288 ; Control (low): &#8;
21289 ; Control (high): &#x7F; &#x9F;
21290 ; Surrogate: &#xD83D;&#xDCA9;
21291 ; This is an okay astral character: &#x1F4A9;
21292 !! html+tidy
21293 <dl><dt>Null</dt>
21294 <dd>&amp;#00;</dd>
21295 <dt>FF</dt>
21296 <dd>&amp;#xC;</dd>
21297 <dt>CR</dt>
21298 <dd>&amp;#xD;</dd>
21299 <dt>Control (low)</dt>
21300 <dd>&amp;#8;</dd>
21301 <dt>Control (high)</dt>
21302 <dd>&amp;#x7F; &amp;#x9F;</dd>
21303 <dt>Surrogate</dt>
21304 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
21305 <dt>This is an okay astral character</dt>
21306 <dd>&#x1f4a9;</dd></dl>
21307 !! end
21308
21309 !! test
21310 __FORCETOC__ override
21311 !! wikitext
21312 __NEWSECTIONLINK__
21313 __FORCETOC__
21314 !! html/php
21315 <p><br />
21316 </p>
21317 !! end
21318
21319 !! test
21320 ISBN code coverage
21321 !! wikitext
21322 ISBN 978-0-1234-56&#x20;789
21323 !! html/php
21324 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21325 </p>
21326 !! html/parsoid
21327 <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>
21328 !! end
21329
21330 !! test
21331 ISBN followed by 5 spaces
21332 !! wikitext
21333 ISBN
21334 !! html
21335 <p>ISBN
21336 </p>
21337 !! end
21338
21339 !! test
21340 Double ISBN
21341 !! wikitext
21342 ISBN ISBN 1234567890
21343 !! html/php
21344 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21345 </p>
21346 !! html/parsoid
21347 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21348 !! end
21349
21350 # Uppercase X and lowercase x as well
21351 !! test
21352 ISBN with an X
21353 !! wikitext
21354 ISBN 3-462-04561-X
21355 ISBN 3-462-04561-x
21356 ISBN 080442957X
21357 ISBN 080442957x
21358 ISBN 978080442957X
21359 ISBN 978080442957x
21360 !! html/php
21361 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21362 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21363 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21364 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21365 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21366 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21367 </p>
21368 !! html/parsoid
21369 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21370 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21371 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21372 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21373 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21374 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21375 !! end
21376
21377 !! test
21378 ISBN with empty prefix (parsoid test)
21379 !! wikitext
21380 ISBN 1234567890
21381 !! html/php
21382 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21383 </p>
21384 !! html/parsoid
21385 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21386 !! end
21387
21388 !! test
21389 T24905: <abbr> followed by ISBN followed by </a>
21390 !! wikitext
21391 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21392 !! html/php
21393 <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>
21394 </p>
21395 !! html/parsoid
21396 <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>
21397 !! end
21398
21399 !! test
21400 Double RFC
21401 !! wikitext
21402 RFC RFC 1234
21403 !! html/php
21404 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21405 </p>
21406 !! html/parsoid
21407 <p>RFC <a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
21408 !! end
21409
21410 !! test
21411 Double RFC with a wiki link
21412 !! wikitext
21413 RFC [[RFC 1234]]
21414 !! html/php
21415 <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>
21416 </p>
21417 !! html/parsoid
21418 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234" title="RFC 1234">RFC 1234</a></p>
21419 !! end
21420
21421 !! test
21422 RFC code coverage
21423 !! wikitext
21424 RFC 983&#x20;987
21425 !! html/php
21426 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21427 </p>
21428 !! html/parsoid
21429 <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>
21430 !! end
21431
21432 !! test
21433 Centre-aligned image
21434 !! wikitext
21435 [[Image:foobar.jpg|centre]]
21436 !! html/php
21437 <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>
21438
21439 !! html/parsoid
21440 <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>
21441 !! end
21442
21443 !! test
21444 None-aligned image
21445 !! wikitext
21446 [[Image:foobar.jpg|none]]
21447 !! html/php
21448 <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>
21449
21450 !! html/parsoid
21451 <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>
21452 !! end
21453
21454 !! test
21455 Width + Height sized image (using px) (height is ignored)
21456 !! wikitext
21457 [[Image:foobar.jpg|640x480px]]
21458 !! html/php
21459 <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>
21460 </p>
21461 !! html/parsoid
21462 <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>
21463 !! end
21464
21465 !! test
21466 Width-sized image (using px, no following whitespace)
21467 !! wikitext
21468 [[Image:foobar.jpg|640px]]
21469 !! html/php
21470 <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>
21471 </p>
21472 !! html/parsoid
21473 <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>
21474 !! end
21475
21476 !! test
21477 Width-sized image (using px, with following whitespace - test regression from r39467)
21478 !! wikitext
21479 [[Image:foobar.jpg|640px ]]
21480 !! html/php
21481 <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>
21482 </p>
21483 !! html/parsoid
21484 <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>
21485 !!end
21486
21487 !! test
21488 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21489 !! wikitext
21490 [[Image:foobar.jpg| 640px]]
21491 !! html/php
21492 <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>
21493 </p>
21494 !! html/parsoid
21495 <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>
21496 !! end
21497
21498 !! test
21499 Image with page parameter
21500 !! options
21501 djvu
21502 !! wikitext
21503 [[File:LoremIpsum.djvu|page=2]]
21504 !! html/php
21505 <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>
21506 </p>
21507 !! html/parsoid
21508 <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>
21509 !! end
21510
21511 !! test
21512 Another italics / bold test
21513 !! wikitext
21514 ''' ''x'
21515 !! html
21516 <pre>'<i> </i>x'
21517 </pre>
21518 !!end
21519
21520 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21521 !! test
21522 dt/dd/dl test
21523 !! wikitext
21524 :;;;::
21525 !! html/php
21526 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21527
21528 !! html/parsoid
21529 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21530
21531 !!end
21532
21533 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21534 !! test
21535 Images with the "|" character in the comment
21536 !! wikitext
21537 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21538 !! html/php
21539 <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>
21540
21541 !! html/parsoid
21542 <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>
21543 !! end
21544
21545 !! test
21546 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21547 !! wikitext
21548 <html><script>alert(1);</script></html>
21549 !! html
21550 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21551 </p>
21552 !! end
21553
21554 !! test
21555 HTML with raw HTML ($wgRawHtml==true)
21556 !! options
21557 wgRawHtml=1
21558 !! wikitext
21559 <html><script>alert(1);</script></html>
21560 !! html/php
21561 <p><script>alert(1);</script>
21562 </p>
21563 !! end
21564
21565 !! test
21566 Parents of subpages, one level up
21567 !! options
21568 subpage title=[[Subpage test/L1/L2/L3]]
21569 !! wikitext
21570 [[../|L2]]
21571 !! html
21572 <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>
21573 </p>
21574 !! end
21575
21576
21577 !! test
21578 Parents of subpages, one level up, not named
21579 !! options
21580 subpage title=[[Subpage test/L1/L2/L3]]
21581 !! wikitext
21582 [[../]]
21583 !! html
21584 <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>
21585 </p>
21586 !! end
21587
21588
21589
21590 !! test
21591 Parents of subpages, two levels up
21592 !! options
21593 subpage title=[[Subpage test/L1/L2/L3]]
21594 !! wikitext
21595 [[../../|L1]]2
21596
21597 [[../../|L1]]l
21598 !! html
21599 <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
21600 </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>
21601 </p>
21602 !! end
21603
21604 !! test
21605 Parents of subpages, two levels up, without trailing slash or name.
21606 !! options
21607 subpage title=[[Subpage test/L1/L2/L3]]
21608 !! wikitext
21609 [[../..]]
21610 !! html
21611 <p>[[../..]]
21612 </p>
21613 !! end
21614
21615 !! test
21616 Parents of subpages, two levels up, with lots of extra trailing slashes.
21617 !! options
21618 subpage title=[[Subpage test/L1/L2/L3]]
21619 !! wikitext
21620 [[../../////]]
21621 !! html
21622 <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>
21623 </p>
21624 !! end
21625
21626 !! article
21627 Subpage test/L1/L2/L3Sibling
21628 !! text
21629 Sibling article
21630 !! endarticle
21631
21632 !! test
21633 Transclusion of a sibling page (one level up)
21634 !! options
21635 subpage title=[[Subpage test/L1/L2/L3]]
21636 !! wikitext
21637 {{../L3Sibling}}
21638 !! html
21639 <p>Sibling article
21640 </p>
21641 !! end
21642
21643 !! test
21644 Transclusion of a child page
21645 !! options
21646 subpage title=[[Subpage test/L1/L2]]
21647 !! wikitext
21648 {{/L3Sibling}}
21649 !! html
21650 <p>Sibling article
21651 </p>
21652 !! end
21653
21654 # This is wt2html only in Parsoid because we add <nowiki>
21655 # because of {{..}} and we don't expect to fix that to
21656 # eliminate the nowikis selective for {{..}} markup.
21657 !! test
21658 Non-transclusion because of too many up levels
21659 !! options
21660 subpage title=[[Subpage test/L1/L2/L3]]
21661 parsoid=wt2html
21662 !! wikitext
21663 {{../../../../More than parent}}
21664 !! html/php
21665 <p>{{../../../../More than parent}}
21666 </p>
21667 !! html/parsoid
21668 <p>{{../../../../More than parent}}</p>
21669 !! end
21670
21671 !! test
21672 Definition list code coverage
21673 !! wikitext
21674 ;title :def
21675 ;title :def
21676 ;title:def
21677 !! html/php
21678 <dl><dt>title</dt>
21679 <dd>def</dd>
21680 <dt>title</dt>
21681 <dd>def</dd>
21682 <dt>title</dt>
21683 <dd>def</dd></dl>
21684
21685 !! html/parsoid
21686 <dl><dt>title </dt><dd>def</dd>
21687 <dt>title </dt><dd>def</dd>
21688 <dt>title</dt><dd>def</dd></dl>
21689 !! end
21690
21691 !! test
21692 Don't fall for the self-closing div
21693 !! wikitext
21694 <div>hello world</div/>
21695 !! html
21696 <div>hello world</div>
21697
21698 !! end
21699
21700 !! test
21701 MSGNW magic word
21702 !! wikitext
21703 {{MSGNW:msg}}
21704 !! html/php
21705 <p>&#91;&#91;:Template:Msg&#93;&#93;
21706 </p>
21707 !! end
21708
21709 !! test
21710 RAW magic word
21711 !! wikitext
21712 {{RAW:QUERTY}}
21713 !! html
21714 <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>
21715 </p>
21716 !! end
21717
21718 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21719 !! test
21720 Always escape literal '>' in output, not just after '<'
21721 !! wikitext
21722 ><>
21723 !! html
21724 <p>&gt;&lt;&gt;
21725 </p>
21726 !! end
21727
21728 !! test
21729 Template caching
21730 !! wikitext
21731 {{Test}}
21732 {{Test}}
21733 !! html
21734 <p>This is a test template
21735 This is a test template
21736 </p>
21737 !! end
21738
21739
21740 !! article
21741 MediaWiki:Fake
21742 !! text
21743 ==header==
21744 !! endarticle
21745
21746 !! test
21747 Inclusion of !userCanEdit() content
21748 !! wikitext
21749 {{MediaWiki:Fake}}
21750 !! html
21751 <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>
21752
21753 !! end
21754
21755
21756 !! test
21757 Out-of-order TOC heading levels
21758 !! wikitext
21759 ==2==
21760 ======6======
21761 ===3===
21762 =1=
21763 =====5=====
21764 ==2==
21765 !! html
21766 <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>
21767 <ul>
21768 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21769 <ul>
21770 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21771 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21772 </ul>
21773 </li>
21774 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21775 <ul>
21776 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21777 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21778 </ul>
21779 </li>
21780 </ul>
21781 </div>
21782
21783 <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>
21784 <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>
21785 <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>
21786 <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>
21787 <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>
21788 <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>
21789
21790 !! end
21791
21792
21793 !! test
21794 ISBN with a dummy number
21795 !! wikitext
21796 ISBN ---
21797 !! html
21798 <p>ISBN ---
21799 </p>
21800 !! end
21801
21802
21803 !! test
21804 ISBN with space-delimited number
21805 !! wikitext
21806 ISBN 92 9017 032 8
21807 !! html/php
21808 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21809 </p>
21810 !! html/parsoid
21811 <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>
21812 !! end
21813
21814
21815 !! test
21816 ISBN with multiple spaces, no number
21817 !! wikitext
21818 ISBN foo
21819 !! html
21820 <p>ISBN foo
21821 </p>
21822 !! end
21823
21824
21825 !! test
21826 ISBN length
21827 !! wikitext
21828 ISBN 123456789
21829
21830 ISBN 1234567890
21831
21832 ISBN 12345678901
21833 !! html/php
21834 <p>ISBN 123456789
21835 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21836 </p><p>ISBN 12345678901
21837 </p>
21838 !! html/parsoid
21839 <p>ISBN 123456789</p>
21840
21841 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21842
21843 <p>ISBN 12345678901</p>
21844 !! end
21845
21846
21847 !! test
21848 ISBN with trailing year (T9110)
21849 !! wikitext
21850 ISBN 1-234-56789-0 - 2006
21851
21852 ISBN 1 234 56789 0 - 2006
21853 !! html/php
21854 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21855 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21856 </p>
21857 !! html/parsoid
21858 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21859
21860 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21861 !! end
21862
21863
21864 !! test
21865 anchorencode
21866 !! config
21867 wgFragmentMode=[ 'html5', 'legacy' ]
21868 !! wikitext
21869 {{anchorencode:foo bar©#%n}}
21870 !! html/php
21871 <p>foo_bar©#%n
21872 </p>
21873 !! html/parsoid
21874 <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>
21875 !! end
21876
21877 !! test
21878 anchorencode (legacy)
21879 !! config
21880 wgFragmentMode=[ 'legacy' ]
21881 !! wikitext
21882 {{anchorencode:foo bar©#%n}}
21883 !! html/php
21884 <p>foo_bar.C2.A9.23.25n
21885 </p>
21886 !! end
21887
21888 !! test
21889 anchorencode trims spaces
21890 !! config
21891 wgFragmentMode=[ 'html5', 'legacy' ]
21892 !! wikitext
21893 {{anchorencode: __pretty__please__}}
21894 !! html/php
21895 <p>pretty_please
21896 </p>
21897 !! html/parsoid
21898 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
21899 !! end
21900
21901 !! test
21902 anchorencode deals with links
21903 !! config
21904 wgFragmentMode=[ 'html5', 'legacy' ]
21905 !! wikitext
21906 {{anchorencode: [[hello|world]] [[hi]]}}
21907 !! html/php
21908 <p>world_hi
21909 </p>
21910 !! html/parsoid
21911 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
21912 !! end
21913
21914 !! test
21915 anchorencode deals with templates
21916 !! config
21917 wgFragmentMode=[ 'html5', 'legacy' ]
21918 !! wikitext
21919 {{anchorencode: {{Foo}} x}}
21920 !! html/php
21921 <p>FOO_x
21922 </p>
21923 !! html/parsoid
21924 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
21925 !! end
21926
21927 !! test
21928 anchorencode encodes like the TOC generator: (T20431)
21929 !! config
21930 wgFragmentMode=[ 'html5', 'legacy' ]
21931 !! wikitext
21932 ===_ +:.3A%3A _ &&amp;]] x===
21933 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
21934 __NOEDITSECTION__
21935 !! html/php
21936 <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>
21937 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
21938 </p>
21939 !! html/parsoid
21940 <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>
21941 <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>
21942 <meta property="mw:PageProp/noeditsection"/>
21943 !! end
21944
21945 !! test
21946 anchorencode encodes like the TOC generator: (T20431) (legacy)
21947 !! config
21948 wgFragmentMode=[ 'legacy' ]
21949 !! wikitext
21950 ===_ +:.3A%3A&&amp;]]===
21951 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21952 __NOEDITSECTION__
21953 !! html/php
21954 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21955 <p>.2B:.3A.253A.26.26.5D.5D
21956 </p>
21957 !! end
21958
21959 !! test
21960 T8200: blockquotes and paragraph formatting
21961 !! wikitext
21962 <blockquote>
21963 foo
21964 </blockquote>
21965
21966 bar
21967
21968 baz
21969 !! html
21970 <blockquote>
21971 <p>foo
21972 </p>
21973 </blockquote>
21974 <p>bar
21975 </p>
21976 <pre>baz
21977 </pre>
21978 !! end
21979
21980 !! test
21981 T10293: Use of center tag ruins paragraph formatting
21982 !! wikitext
21983 <center>
21984 foo
21985 </center>
21986
21987 bar
21988
21989 baz
21990 !! html
21991 <center>
21992 <p>foo
21993 </p>
21994 </center>
21995 <p>bar
21996 </p>
21997 <pre>baz
21998 </pre>
21999 !! end
22000
22001 !!test
22002 Parsing of overlapping (improperly nested) inline html tags
22003 !! wikitext
22004 <span><s>x</span></s>
22005 !! html/php
22006 <p><span><s>x&lt;/span&gt;</s></span>
22007 </p>
22008 !! html/parsoid
22009 <p><span><s>x</s></span>
22010 </p>
22011 !!end
22012
22013 ###
22014 ### Language variants related tests
22015 ###
22016
22017 # Parsoid does not mark self-links.
22018 # Parsoid does not convert links; PHP will do any necessary redirects.
22019
22020 !! test
22021 Self-link in language variants
22022 !! options
22023 title=[[Dunav]] language=sr
22024 !! wikitext
22025 Both [[Dunav]] and [[Дунав]] are names for this river.
22026 !! html/php
22027 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
22028 </p>
22029 !! html/parsoid
22030 <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>
22031 !! end
22032
22033 !! article
22034 Дуна
22035 !! text
22036 content
22037 !! endarticle
22038
22039 !! test
22040 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
22041 !! options
22042 title=[[Duna]] language=sr
22043 !! wikitext
22044 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
22045 !! html/php
22046 <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.
22047 </p>
22048 !! html/parsoid
22049 <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>
22050 !! end
22051
22052 !! test
22053 Link to a section of a variant of this title shouldn't be parsed as self-link
22054 !! options
22055 title=[[Duna]] language=sr
22056 !! wikitext
22057 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
22058 !! html/php
22059 <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.
22060 </p>
22061 !! html/parsoid
22062 <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>
22063 !! end
22064
22065 !! test
22066 Link to pages in language variants
22067 !! options
22068 language=sr
22069 !! wikitext
22070 Main Page can be written as [[Маин Паге]]
22071 !! html/php
22072 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
22073 </p>
22074 !! html/parsoid
22075 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
22076 !! end
22077
22078
22079 !! test
22080 Multiple links to pages in language variants
22081 !! options
22082 language=sr
22083 !! wikitext
22084 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
22085 !! html/php
22086 <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>.
22087 </p>
22088 !! html/parsoid
22089 <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>
22090 !! end
22091
22092
22093 !! test
22094 Simple template in language variants
22095 !! options
22096 language=sr
22097 !! wikitext
22098 {{тест}}
22099 !! html/php
22100 <p>This is a test template
22101 </p>
22102 !! end
22103
22104
22105 !! test
22106 Template with explicit namespace in language variants
22107 !! options
22108 language=sr
22109 !! wikitext
22110 {{Template:тест}}
22111 !! html/php
22112 <p>This is a test template
22113 </p>
22114 !! end
22115
22116
22117 !! test
22118 Basic test for template parameter in language variants
22119 !! options
22120 language=sr
22121 !! wikitext
22122 {{парамтест|param=foo}}
22123 !! html/php
22124 <p>This is a test template with parameter foo
22125 </p>
22126 !! end
22127
22128 !! test
22129 Simple category in language variants
22130 !! options
22131 language=sr cat
22132 !! wikitext
22133 [[Category:МедиаWики Усер'с Гуиде]]
22134 !! html/php
22135 cat=МедиаWики_Усер'с_Гуиде sort=
22136 !! html/parsoid
22137 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
22138 !! end
22139
22140 !! article
22141 Category:分类
22142 !! text
22143 blah
22144 !! endarticle
22145
22146 !! article
22147 Category:分類
22148 !! text
22149 blah
22150 !! endarticle
22151
22152 ## We used to, but no longer wt2wt this test since the default serializer
22153 ## will normalize all categories to serialize on their own line.
22154 ## This wikitext usage is going to be fairly uncommon in production and
22155 ## selser will take care of preserving formatting in those scenarios.
22156 !! test
22157 Don't convert blue categorylinks to another variant (T35210)
22158 !! options
22159 cat
22160 language=zh
22161 parsoid=wt2html
22162 !! wikitext
22163 [[A]][[Category:分类]]
22164 !! html/php
22165 cat=分类 sort=
22166 !! html/parsoid
22167 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
22168 <link rel="mw:PageProp/Category" href="./Category:分类"/>
22169 !! end
22170
22171 !! test
22172 Stripping -{}- tags (language variants)
22173 !! options
22174 language=sr
22175 !! wikitext
22176 Latin proverb: -{Ne nuntium necare}-
22177 !! html/php
22178 <p>Latin proverb: Ne nuntium necare
22179 </p>
22180 !! html/parsoid
22181 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22182 !! end
22183
22184
22185 !! test
22186 Prevent conversion with -{}- tags (language variants)
22187 !! options
22188 language=sr variant=sr-ec
22189 !! wikitext
22190 Latinski: -{Ne nuntium necare}-
22191 !! html/php
22192 <p>Латински: Ne nuntium necare
22193 </p>
22194 !! html/parsoid
22195 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22196 !! end
22197
22198
22199 !! test
22200 Prevent conversion of text with -{}- tags (language variants)
22201 !! options
22202 language=sr variant=sr-ec
22203 !! wikitext
22204 Latinski: -{Ne nuntium necare}-
22205 !! html/php
22206 <p>Латински: Ne nuntium necare
22207 </p>
22208 !! html/parsoid
22209 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22210 !! end
22211
22212
22213 !! test
22214 Prevent conversion of links with -{}- tags (language variants)
22215 !! options
22216 language=sr variant=sr-ec
22217 !! wikitext
22218 -{[[Main Page]]}-
22219 !! html/php
22220 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22221 </p>
22222 !! html/parsoid
22223 <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>
22224 !! end
22225
22226
22227 !! test
22228 -{}- tags within headlines (within html for parserConvert())
22229 !! config
22230 wgFragmentMode=[ 'html5', 'legacy' ]
22231 !! options
22232 language=sr variant=sr-ec
22233 !! wikitext
22234 ==-{Naslov}-==
22235
22236 Note that even an unprotected headline ID is not affected by language
22237 conversion:
22238
22239 ==Latinski==
22240 !! html/php
22241 <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>
22242 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
22243 цонверсион:
22244 </p>
22245 <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>
22246
22247 !! html/parsoid
22248 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
22249
22250 <p>Note that even an unprotected headline ID is not affected by language
22251 conversion:</p>
22252
22253 <h2 id="Latinski">Latinski</h2>
22254 !! end
22255
22256 !! test
22257 Explicit definition of language variant alternatives
22258 !! options
22259 language=zh variant=zh-tw
22260 !! wikitext
22261 -{zh:China;zh-tw:Taiwan}-, not China
22262 !! html/php
22263 <p>Taiwan, not China
22264 </p>
22265 !! html/parsoid
22266 <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>
22267 !! end
22268
22269 !! test
22270 Filter syntax for language variants
22271 !! options
22272 language=zh variant=zh-tw
22273 !! wikitext
22274 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
22275 !! html/php
22276 <p>fooblog, WEBJOURNAL, WEBLOGquux
22277 </p>
22278 !! html/parsoid
22279 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
22280 !! end
22281
22282 # Note that Parsoid post-processing for language variants needs to
22283 # update the `title` attribute here, based on the mw:ExpandedAttrs property
22284 !! test
22285 Conversion around HTML tags
22286 !! options
22287 language=sr variant=sr-ec
22288 !! wikitext
22289 -{H|span=>sr-ec:script;title=>sr-ec:src}-
22290 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
22291 !! html/php
22292 <p>
22293 <span title="ЛаCтин">ски</span>
22294 </p>
22295 !! html/parsoid
22296 <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"}]}'/>
22297 <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>
22298 !! end
22299
22300 !! test
22301 Explicit session-wise two-way language variant mapping (A flag and - flag)
22302 !! options
22303 language=zh variant=zh-tw
22304 !! wikitext
22305 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
22306
22307 Taiwan is not China.
22308
22309 But -{A|zh:China; zh-tw:Taiwan}- is China,
22310
22311 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
22312
22313 and -{China}- is China.
22314 !! html/php
22315 <p>This is Taiwan, but we'll forget that now.
22316 </p><p>Taiwan is not China.
22317 </p><p>But Taiwan is Taiwan,
22318 </p><p>(This should be stripped!)
22319 </p><p>and China is China.
22320 </p>
22321 !! html/parsoid
22322 <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>
22323 <p>Taiwan is not China.</p>
22324 <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>
22325 <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>
22326 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22327 !! end
22328
22329 !! test
22330 Explicit session-wise one-way language variant mapping (A flag and - flag)
22331 !! options
22332 language=zh variant=zh-tw
22333 !! wikitext
22334 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
22335
22336 COUNTRY is China or Taiwan.
22337
22338 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
22339
22340 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22341
22342 and -{COUNTRY}- is COUNTRY.
22343 !! html/php
22344 <p>This is Taiwan, but we'll forget that now.
22345 </p><p>COUNTRY is China or Taiwan.
22346 </p><p>But Taiwan is Taiwan,
22347 </p><p>(This should be stripped!)
22348 </p><p>and COUNTRY is COUNTRY.
22349 </p>
22350 !! html/parsoid
22351 <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>
22352 <p>COUNTRY is China or Taiwan.</p>
22353 <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>
22354 <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>
22355 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22356 !! end
22357
22358 !! test
22359 Explicit session-wise two-way language variant mapping (H flag for hide)
22360 !! options
22361 language=zh variant=zh-tw
22362 !! wikitext
22363 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22364
22365 Taiwan is China.
22366 !! html/php
22367 <p>(This should be stripped!)
22368 </p><p>Taiwan is Taiwan.
22369 </p>
22370 !! html/parsoid
22371 <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>
22372 <p>Taiwan is China.</p>
22373 !! end
22374
22375 !! test
22376 Explicit session-wise one-way language variant mapping (H flag for hide)
22377 !! options
22378 language=zh variant=zh-tw
22379 !! wikitext
22380 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22381
22382 COUNTRY is Taiwan or China.
22383 !! html/php
22384 <p>(This should be stripped!)
22385 </p><p>Taiwan is Taiwan or China.
22386 </p>
22387 !! html/parsoid
22388 <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>
22389 <p>COUNTRY is Taiwan or China.</p>
22390 !! end
22391
22392 ## Note that parsoid test runner does not support 'showtitle' option.
22393 !! test
22394 Adding explicit conversion rule for title (T flag)
22395 !! options
22396 language=zh variant=zh-tw showtitle
22397 !! wikitext
22398 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22399
22400 Taiwan is China.
22401 !! html/php
22402 Taiwan
22403 <p>Should be stripped!
22404 </p><p>Taiwan is China.
22405 </p>
22406 !! html/parsoid
22407 <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>
22408 <p>Taiwan is China.</p>
22409 !! end
22410
22411 !! test
22412 Code coverage: T combined with H flag
22413 !! options
22414 language=zh variant=zh-tw showtitle
22415 !! wikitext
22416 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22417
22418 Taiwan is China.
22419 !! html/php
22420 Taiwan
22421 <p>Should be stripped!
22422 </p><p>Taiwan is Taiwan.
22423 </p>
22424 !! html/parsoid
22425 <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>
22426 <p>Taiwan is China.</p>
22427 !! end
22428
22429 !! test
22430 Code coverage: T with no variants
22431 !! options
22432 language=zh variant=zh-tw showtitle
22433 !! wikitext
22434 -{H|zh:China; zh-tw:Taiwan}-
22435 Taiwan is China.-{T|Taiwan is China}-
22436 !! html/php
22437 Taiwan is China
22438 <p>
22439 Taiwan is Taiwan.
22440 </p>
22441 !! html/parsoid
22442 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22443 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22444 !! end
22445
22446 !! test
22447 Code coverage: rules with no variants
22448 !! options
22449 language=zh variant=zh-tw
22450 !! wikitext
22451 -{H|zh:China; zh-tw:Taiwan}-
22452 Taiwan is China.
22453 -{H|China}-
22454 Taiwan is China.
22455 !! html/php
22456 <p>
22457 Taiwan is Taiwan.
22458
22459 Taiwan is China.
22460 </p>
22461 !! html/parsoid
22462 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22463 Taiwan is China.
22464 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22465 Taiwan is China.</p>
22466 !! end
22467
22468
22469 !! test
22470 Code coverage: D flag for conversion rule
22471 !! options
22472 language=zh variant=zh-tw
22473 !! wikitext
22474 -{D|zh-cn:XA; zh-tw:YA}-
22475 -{A;D|zh-cn:XB; zh-tw:YB}-
22476 -{D;H|zh-cn:XC; zh-tw:YC}-
22477
22478 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22479
22480 -{D|0=>zh-tw:1}-
22481 -{A;D|2=>zh-tw:3}-
22482 -{D;H|4=>zh-tw:5}-
22483
22484 XA XB XC YA YB YC FOO BAR BAT 012345
22485 !! html/php
22486 <p>大陆:XA;台灣:YA;
22487
22488 大陆:XC;台灣:YC;
22489 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22490 </p><p>0⇒台灣:1;
22491
22492 4⇒台灣:5;
22493 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22494 </p>
22495 !! html/parsoid
22496 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22497 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22498 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22499 <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>
22500 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22501 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22502 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22503 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22504 !! end
22505
22506 !! test
22507 Code coverage: N flag for conversion rule
22508 !! options
22509 language=zh variant=zh-cn
22510 !! wikitext
22511 -{N|zh-cn}-
22512
22513 -{N|zh-tw}-
22514
22515 -{N|sr-ec}-
22516 !! html/php
22517 <p>大陆
22518 </p><p>台灣
22519 </p><p>српски (ћирилица)‎
22520 </p>
22521 !! html/parsoid
22522 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22523 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22524 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22525 !! end
22526
22527 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22528 !! test
22529 Code coverage: N flag for conversion rule (wt2html only)
22530 !! options
22531 language=zh variant=zh-cn
22532 parsoid=wt2html,html2html
22533 !! wikitext
22534 -{D;N|en}-
22535 !! html/php
22536 <p>English
22537 </p>
22538 !! html/parsoid
22539 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22540 !! end
22541
22542 !! test
22543 Testing that changing the language variant here in the tests actually works
22544 !! options
22545 language=zh variant=zh showtitle
22546 !! wikitext
22547 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22548 !! html/php
22549 China
22550 <p>Should be stripped!
22551 </p>
22552 !! html/parsoid
22553 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22554 !! end
22555
22556 !! test
22557 Recursive conversion of alt and title attrs shouldn't clear converter state
22558 !! options
22559 language=zh variant=zh-cn
22560 showtitle
22561 !! wikitext
22562 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22563 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22564 !! html/php
22565 China
22566 <p>
22567 Should be stripped<span title="Exclamation">!</span>
22568 </p>
22569 !! html/parsoid
22570 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22571 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>
22572 !! end
22573
22574 !! test
22575 T26072: more test on conversion rule for title
22576 !! options
22577 language=zh variant=zh-tw showtitle
22578 !! wikitext
22579 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22580
22581 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22582 !! html/php
22583 Taiwan
22584 <p>This should be stripped!
22585 </p><p>This won't take interferes with the title rule.
22586 </p>
22587 !! html/parsoid
22588 <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>
22589 <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>
22590 !! end
22591
22592 !! test
22593 Partly disable title conversion if variant == main language code
22594 !! options
22595 language=zh variant=zh title=[[ZH]] showtitle
22596 !! wikitext
22597 -{T|zh-cn:CN;zh-tw:TW}-
22598 !! html/php
22599 ZH
22600 <p>
22601 </p>
22602 !! html/parsoid
22603 <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>
22604 !! end
22605
22606 !! test
22607 Partly disable title conversion if variant == main language code, more
22608 !! options
22609 language=zh variant=zh title=[[ZH]] showtitle
22610 !! wikitext
22611 -{T|TW}-
22612 !! html/php
22613 ZH
22614 <p>
22615 </p>
22616 !! html/parsoid
22617 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22618 !! end
22619
22620 !! test
22621 Raw output of variant escape tags (R flag)
22622 !! options
22623 language=zh variant=zh-tw
22624 !! wikitext
22625 Raw: -{R|zh:China;zh-tw:Taiwan}-
22626 !! html/php
22627 <p>Raw: zh:China;zh-tw:Taiwan
22628 </p>
22629 !! html/parsoid
22630 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22631 !! end
22632
22633 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22634 !! test
22635 Raw output of variant escape tags (R flag) (wt2html only)
22636 !! options
22637 language=zh variant=zh-tw
22638 parsoid=wt2html,html2html
22639 !! wikitext
22640 -{Variant}- -{D|syntax}- -{D;R|options}-
22641 !! html/php
22642 <p>Variant syntax options
22643 </p>
22644 !! html/parsoid
22645 <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>
22646 !! end
22647
22648 !! test
22649 Nested markup inside raw output of variant escape tags (R flag)
22650 !! options
22651 language=zh variant=zh-tw
22652 !! wikitext
22653 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22654 !! html/php
22655 <p>Nested raw: nested Taiwan nested
22656 </p>
22657 !! html/parsoid
22658 <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>
22659 !! end
22660
22661 !! test
22662 Nested markup and spaces inside raw output of variant escape tags (R flag)
22663 !! options
22664 language=zh variant=zh-tw
22665 !! wikitext
22666 X-{ outer -{ inner }- outer }-X
22667 !! html/php
22668 <p>X outer inner outer X
22669 </p>
22670 !! html/parsoid
22671 <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>
22672 !! end
22673
22674 !! test
22675 Templates inside raw output of variant escape tags (R flag)
22676 !! options
22677 language=zh variant=zh-tw
22678 !! wikitext
22679 Nested raw: -{R|nested {{echo|hi}} templates}-
22680 !! html/php
22681 <p>Nested raw: nested hi templates
22682 </p>
22683 !! html/parsoid
22684 <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>
22685 !! end
22686
22687 !! test
22688 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22689 !! options
22690 language=zh variant=zh-cn
22691 !! wikitext
22692 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22693 !! html/php
22694 <p>0
22695 </p>
22696 !! html/parsoid
22697 <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>
22698 !! end
22699
22700 !! test
22701 Conversion rules from [numeric-only string] to [something else] (T48634)
22702 !! options
22703 language=zh variant=zh-cn
22704 !! wikitext
22705 -{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
22706 !! html/php
22707 <p>D12345EE12345
22708 </p>
22709 !! html/parsoid
22710 <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>
22711 !! end
22712
22713 !! test
22714 Two-way converter rule entries with an empty value should be ignored (T53551)
22715 !! options
22716 language=zh variant=zh-cn
22717 !! wikitext
22718 -{H|zh-cn:foo;zh-tw:;}-foobar
22719 !! html/php
22720 <p>foobar
22721 </p>
22722 !! html/parsoid
22723 <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>
22724 !! end
22725
22726 !! test
22727 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22728 !! options
22729 language=zh variant=zh-cn
22730 !! wikitext
22731 -{H|=>zh-cn:foo;}-foobar
22732 !! html/php
22733 <p>foobar
22734 </p>
22735 !! html/parsoid
22736 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22737 !! end
22738
22739 !! test
22740 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22741 !! options
22742 language=zh variant=zh-cn
22743 !! wikitext
22744 -{H|}-foobar
22745 !! html/php
22746 <p>foobar
22747 </p>
22748 !! html/parsoid
22749 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22750 !! end
22751
22752 !! test
22753 Nested using of manual convert syntax
22754 !! options
22755 language=zh variant=zh-hk
22756 !! wikitext
22757 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22758 !! html/php
22759 <p>Nested: Hello Hong Kong!
22760 </p>
22761 !! html/parsoid
22762 <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>
22763 !! end
22764
22765 !! test
22766 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22767 !! options
22768 language=zh variant=zh-cn
22769 !! wikitext
22770 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22771 !! html/php
22772 <p><span title="X">A</span>
22773 </p>
22774 !! html/parsoid
22775 <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>
22776 !! end
22777
22778 !! test
22779 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22780 !! options
22781 language=zh variant=zh-cn
22782 !! wikitext
22783 -{<span title="-{X}-">A</span>}-
22784 !! html/php+disabled
22785 <p><span title="X">A</span>
22786 </p>
22787 !! html/parsoid
22788 <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>
22789 !! end
22790
22791 # Parsoid and PHP disagree on how to parse this example: Parsoid
22792 # insists that the content of a language converter element be a valid
22793 # DOM fragment or attribute string
22794 !! test
22795 Language converter markup with block content
22796 !! options
22797 language=zh variant=zh-cn
22798 !! wikitext
22799 <span>a-{b<div>c}-d
22800
22801 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22802
22803 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22804 !! html/php+tidy
22805 <span>ab<div>cd
22806 <span>ab<div>cd
22807 <span>ad
22808 </span></div></span></div></span>
22809 !! html/parsoid
22810 <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>
22811
22812 <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>
22813
22814 <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>
22815 !! end
22816
22817 !! test
22818 LanguageConverter selser (1)
22819 !! options
22820 language=zh variant=zh-cn
22821 parsoid={
22822 "modes": ["wt2wt", "selser"],
22823 "changes": [
22824 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22825 ]
22826 }
22827 !! wikitext
22828 -{raw}-
22829 !! wikitext/edited
22830 -{edited}-
22831 !! end
22832
22833 !! test
22834 LanguageConverter selser (2)
22835 !! options
22836 language=zh variant=zh-cn
22837 parsoid={
22838 "modes": ["wt2wt", "selser"],
22839 "changes": [
22840 ["span[class='x']", "contents", "text", "-{foo}-"],
22841 ["a", "contents", "text", "-{"],
22842 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22843 ]
22844 }
22845 !! wikitext
22846 <span class="x">TEXT1</span>
22847 [http://example.com TEXT2]
22848 [[Foo|TEXT3]]
22849 {{echo|TEXT4}}
22850 !! wikitext/edited
22851 <span class="x"><nowiki>-{foo}-</nowiki></span>
22852 [http://example.com -{]
22853 [[Foo|<nowiki>-{</nowiki>]]
22854 {{1x|<nowiki>-{</nowiki>}}
22855 !! end
22856
22857 # Tests LanguageVariantText in ConstrainedText
22858 !! test
22859 LanguageConverter selser (3)
22860 !! options
22861 language=zh variant=zh-cn
22862 parsoid={
22863 "modes": ["wt2wt", "selser"],
22864 "changes": [
22865 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22866 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22867 ]
22868 }
22869 !! wikitext
22870 {|
22871 |-
22872 |<span>Foo</span>
22873 |}
22874 !! wikitext/edited
22875 {|
22876 |-
22877 |<nowiki/>-{edited}-
22878 |}
22879 !! end
22880
22881 # Tests LanguageVariantText._fromSelSer
22882 !! test
22883 LanguageConverter selser (4)
22884 !! options
22885 language=zh variant=zh-cn
22886 parsoid={
22887 "modes": ["wt2wt", "selser"],
22888 "changes": [
22889 ["td > span.x", "remove"]
22890 ]
22891 }
22892 !! wikitext
22893 {|
22894 |-
22895 |<span class="x">Foo</span>-{Bar}-
22896 ||<span class="x">Foo</span>-{Bar}-
22897 |}
22898 !! wikitext/edited
22899 {|
22900 |-
22901 |<nowiki/>-{Bar}-
22902 ||-{Bar}-
22903 |}
22904 !! end
22905
22906 # Since Parsoid is starting to emit canonical wikitext for links,
22907 # [http://example.com http://example.com] will not RT back to that
22908 # form anymore.
22909 # Parsoid does not language-convert links (it is done in a
22910 # post-processing step)
22911 !! test
22912 Proper conversion of text in external links
22913 !! options
22914 language=sr variant=sr-ec
22915 parsoid=wt2html
22916 !! wikitext
22917 http://www.google.com
22918 gopher://www.google.com
22919 [http://www.google.com http://www.google.com]
22920 [gopher://www.google.com gopher://www.google.com]
22921 [https://www.google.com irc://www.google.com]
22922 [ftp://www.google.com www.google.com/ftp://dir]
22923 [//www.google.com www.google.com]
22924 !! html/php
22925 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22926 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22927 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
22928 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22929 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22930 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22931 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22932 </p>
22933 !! html/parsoid
22934 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22935 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22936 <a rel="mw:ExtLink" class="external text" href="http://www.google.com">http://www.google.com</a>
22937 <a rel="mw:ExtLink" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22938 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
22939 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22940 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
22941 !! end
22942
22943 !! test
22944 Do not convert roman numbers to language variants
22945 !! options
22946 language=sr variant=sr-ec
22947 !! wikitext
22948 Fridrih IV je car.
22949 !! html/php
22950 <p>Фридрих IV је цар.
22951 </p>
22952 !! html/parsoid
22953 <p>Fridrih IV je car.</p>
22954 !! end
22955
22956 !! test
22957 Unclosed language converter markup "-{"
22958 !! options
22959 language=sr
22960 !! wikitext
22961 -{T|hello
22962 !! html
22963 <p>-{T|hello
22964 </p>
22965 !! end
22966
22967 !! test
22968 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22969 !! options
22970 language=sr
22971 !! wikitext
22972 -{R|=&gt;}-
22973 !! html/php
22974 <p>=&gt;
22975 </p>
22976 !! html/parsoid
22977 <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>
22978 !!end
22979
22980 !! test
22981 Don't break link parsing if language converter markup is in the caption.
22982 !! options
22983 language=sr variant=sr-ec
22984 !! wikitext
22985 [[Main Page|-{R|main page}-]]
22986 !! html/php
22987 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22988 </p>
22989 !! html/parsoid
22990 <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>
22991 !! end
22992
22993 !! test
22994 T146304: Don't break template parsing if language converter markup is in the parameter.
22995 !! options
22996 language=sr variant=sr-ec
22997 !! wikitext
22998 {{echo|-{R|foo}-}}
22999 !! html/php
23000 <p>foo
23001 </p>
23002 !! html/parsoid
23003 <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>
23004 !! end
23005
23006 !! test
23007 T146305: Don't break image parsing if language converter markup is in the caption.
23008 !! options
23009 language=sr
23010 !! wikitext
23011 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
23012 !! html/php
23013 <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>
23014
23015 !! html/parsoid
23016 <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>
23017 !! end
23018
23019 !! test
23020 T146305: Don't break image parsing if nested language converter markup is in the caption.
23021 !! options
23022 language=zh variant=zh-cn
23023 !! wikitext
23024 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
23025 !! html/php
23026 <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>
23027
23028 !! html/parsoid
23029 <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>
23030 !! end
23031
23032 # XXX html2wt disabled because rich markup in alt is not preserved.
23033 !! test
23034 Don't break gallery if language converter markup is inside.
23035 !! options
23036 language=zh
23037 !! wikitext
23038 <gallery>
23039 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
23040 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
23041 </gallery>
23042 !! html/php
23043 <ul class="gallery mw-gallery-traditional">
23044 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23045 <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>
23046 <div class="gallerytext">
23047 <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>
23048 </p>
23049 </div>
23050 </div></li>
23051 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23052 <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>
23053 <div class="gallerytext">
23054 <p>This is a test template
23055 </p>
23056 </div>
23057 </div></li>
23058 </ul>
23059
23060 !! html/parsoid
23061 <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"}}'>
23062 <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>
23063 <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>
23064 </ul>
23065 !! end
23066
23067 !! test
23068 T153135: Don't break list handling if language converter markup is in the item.
23069 !! options
23070 language=zh variant=zh-cn
23071 !! wikitext
23072 ;-{zh-cn:AAA;zh-tw:BBB}-
23073 ;-{R|foo:bar}-
23074 !! html/php
23075 <dl><dt>AAA</dt>
23076 <dt>foo:bar</dt></dl>
23077
23078 !! html/parsoid
23079 <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>
23080 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
23081 </dl>
23082 !! end
23083
23084 // Note that parsoid does not protect colons unless language converter
23085 // markup is properly nested, because it is a backtracking parser.
23086 !! test
23087 T153135: Unclosed markup in definition list (code coverage)
23088 !! options
23089 language=zh variant=zh-cn
23090 !! wikitext
23091 ;<b>foo:bar
23092 ;-{zh-cn:AAA
23093 !! html/php+tidy
23094 <dl><dt><b>foo:bar</b></dt><b>
23095 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
23096 </b></p>
23097 !! html/parsoid
23098 <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}'>
23099 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
23100 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
23101 </b></dl>
23102 !! end
23103
23104 !! test
23105 T153135: Nested language converter markup in definition list (code coverage)
23106 !! options
23107 language=zh variant=zh-cn
23108 !! wikitext
23109 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
23110 !! html/php
23111 <dl><dt>AAA foo:bar bat:baz</dt>
23112 <dd>def</dd></dl>
23113
23114 !! html/parsoid
23115 <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>
23116 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
23117 </dl>
23118 !! end
23119
23120 # html2wt mode disabled due to <nowiki> insertion.
23121 !! test
23122 T153140: Don't break table handling if language converter markup is in the cell.
23123 !! options
23124 language=sr variant=sr-ec
23125 parsoid=wt2html,wt2wt,html2html
23126 !! wikitext
23127 {|
23128 |-
23129 | -{R|B}-
23130 |}
23131 !! html/php
23132 <table>
23133
23134 <tr>
23135 <td>B
23136 </td></tr></table>
23137
23138 !! html/parsoid
23139 <table>
23140 <tbody>
23141 <tr>
23142 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
23143 </tr>
23144 </tbody>
23145 </table>
23146 !! end
23147
23148 !! test
23149 Language converter tricky html2wt cases (1)
23150 !! options
23151 language=sr
23152 parsoid=html2wt,wt2wt
23153 !! html/parsoid
23154 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
23155 !! wikitext
23156 -{<nowiki>}-</nowiki>}-
23157 !! html/php
23158 <p>&#125;-
23159 </p>
23160 !! end
23161
23162 !! test
23163 Language converter tricky html2wt cases (2)
23164 !! options
23165 language=sr
23166 parsoid=html2wt,wt2wt
23167 !! html/parsoid
23168 <p>-{foo}-</p>
23169 !! wikitext
23170 <nowiki>-{foo}-</nowiki>
23171 !! html/php
23172 <p>-&#123;foo&#125;-
23173 </p>
23174 !! end
23175
23176 !! test
23177 Language converter tricky html2wt cases (3)
23178 !! options
23179 language=sr
23180 parsoid=html2wt,wt2wt
23181 !! html/parsoid
23182 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
23183 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
23184 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
23185 !! wikitext
23186 -{R||}-
23187
23188 -{R|R|raw}-
23189
23190 -{<nowiki>-{foo}-</nowiki>}-
23191 !! html/php
23192 <p>|
23193 </p><p>R|raw
23194 </p><p>-&#123;foo&#125;-
23195 </p>
23196 !! end
23197
23198 !! test
23199 Language converter tricky html2wt cases (4)
23200 !! options
23201 language=sr
23202 parsoid=html2wt,wt2wt
23203 !! html/parsoid
23204 <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>
23205 !! wikitext
23206 -{R|{{echo|hey}}}-
23207 !! html/php
23208 <p>hey
23209 </p>
23210 !! end
23211
23212 # Note that the <nowiki> escaping added by parsoid for source text,
23213 # destination text, and language names only works on the PHP side
23214 # for *destination text*. (HTML entity escaping wouldn't work
23215 # any better.) This is probably a bug, at least for source texts.
23216 # (For language names PHP uses a precise regexp based on the languages
23217 # it currently knows have variants, which is fragile since this set
23218 # can grow/shrink over time.)
23219 !! test
23220 Language converter tricky html2wt cases (5)
23221 !! options
23222 language=zh variant=zh-cn
23223 !! html/parsoid
23224 <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>
23225 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
23226 <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>
23227 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
23228 <p>a:b=>c xyz</p>
23229 !! wikitext
23230 -{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
23231
23232 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
23233
23234 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
23235
23236 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
23237
23238 a:b=>c xyz
23239 !! html/php+disabled
23240 <p>foobat;xyz=&gt;zh-cn:abc
23241 </p><p>A
23242 </p><p>0;zh-tw:bar
23243 </p><p>abc
23244 </p><p>a:b=&gt;c 0;zh-tw:bar
23245 </p>
23246 !! end
23247
23248 !! test
23249 T179579: Nowiki and lc interaction
23250 !! options
23251 parsoid=wt2html
23252 language=sr
23253 !! wikitext
23254 -{</nowiki>123}-
23255
23256 -{123<nowiki>|</nowiki>456}-
23257 !! html/parsoid
23258 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
23259
23260 <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>
23261 !! end
23262
23263 !! test
23264 T2529: Uncovered bullet
23265 !! wikitext
23266 *Foo {{bullet}}
23267 !! html
23268 <ul><li>Foo</li>
23269 <li>Bar</li></ul>
23270
23271 !! end
23272
23273 !! test
23274 T2529: Uncovered bullet in a deeply nested list
23275 !! wikitext
23276 *******Foo {{bullet}}
23277 !! html
23278 <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>
23279 <li>Bar</li></ul>
23280
23281 !! end
23282
23283 !! test
23284 T2529: Uncovered table already at line-start
23285 !! wikitext
23286 x
23287
23288 {{table}}
23289 y
23290 !! html
23291 <p>x
23292 </p>
23293 <table>
23294 <tr>
23295 <td>1</td>
23296 <td>2
23297 </td></tr>
23298 <tr>
23299 <td>3</td>
23300 <td>4
23301 </td></tr></table>
23302 <p>y
23303 </p>
23304 !! end
23305
23306 !! test
23307 T2529: Uncovered bullet in parser function result
23308 !! wikitext
23309 *Foo {{lc:{{bullet}} }}
23310 !! html
23311 <ul><li>Foo</li>
23312 <li>bar</li></ul>
23313
23314 !! end
23315
23316 !! test
23317 T7678: Double-parsed template argument
23318 !! wikitext
23319 {{lc:{{{1}}}|hello}}
23320 !! html
23321 <p>{{{1}}}
23322 </p>
23323 !! end
23324
23325 !! test
23326 T7678: Double-parsed template invocation
23327 !! wikitext
23328 {{lc:{{paramtest {{!}} param = hello }} }}
23329 !! html
23330 <p>{{paramtest | param = hello }}
23331 </p>
23332 !! end
23333
23334 !! test
23335 Case insensitivity of parser functions for non-ASCII characters (T10143)
23336 !! options
23337 language=cs
23338 title=[[Main Page]]
23339 !! wikitext
23340 {{PRVNÍVELKÉ:ěščř}}
23341 {{prvnívelké:ěščř}}
23342 {{PRVNÍMALÉ:ěščř}}
23343 {{prvnímalé:ěščř}}
23344 {{MALÁ:ěščř}}
23345 {{malá:ěščř}}
23346 {{VELKÁ:ěščř}}
23347 {{velká:ěščř}}
23348 !! html
23349 <p>Ěščř
23350 Ěščř
23351 ěščř
23352 ěščř
23353 ěščř
23354 ěščř
23355 ĚŠČŘ
23356 ĚŠČŘ
23357 </p>
23358 !! end
23359
23360 !! test
23361 Morwen/13: Unclosed link followed by heading
23362 !! wikitext
23363 [[link
23364 ==heading==
23365 !! html
23366 <p>[[link
23367 </p>
23368 <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>
23369
23370 !! end
23371
23372 !! test
23373 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23374 !! wikitext
23375 {{foo|
23376 =heading=
23377 !! html
23378 <p>{{foo|
23379 </p>
23380 <h1><span class="mw-headline" id="heading">heading</span></h1>
23381
23382 !! end
23383
23384 !! test
23385 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23386 !! wikitext
23387 {{foo|
23388 ==heading==
23389 !! html
23390 <p>{{foo|
23391 </p>
23392 <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>
23393
23394 !! end
23395
23396 !! test
23397 Tildes in comments
23398 !! options
23399 pst
23400 !! wikitext
23401 <!-- ~~~~ -->
23402 !! html/php
23403 <!-- ~~~~ -->
23404 !! end
23405
23406 !! test
23407 Paragraphs inside divs (no extra line breaks)
23408 !! wikitext
23409 <div>Line one
23410
23411 Line two</div>
23412 !! html
23413 <div>Line one
23414 Line two</div>
23415
23416 !! end
23417
23418 !! test
23419 Paragraphs inside divs (extra line break on open)
23420 !! wikitext
23421 <div>
23422 Line one
23423
23424 Line two</div>
23425 !! html
23426 <div>
23427 <p>Line one
23428 </p>
23429 Line two</div>
23430
23431 !! end
23432
23433 !! test
23434 Paragraphs inside divs (extra line break on close)
23435 !! wikitext
23436 <div>Line one
23437
23438 Line two
23439 </div>
23440 !! html
23441 <div>Line one
23442 <p>Line two
23443 </p>
23444 </div>
23445
23446 !! end
23447
23448 !! test
23449 Paragraphs inside divs (extra line break on open and close)
23450 !! wikitext
23451 <div>
23452 Line one
23453
23454 Line two
23455 </div>
23456 !! html
23457 <div>
23458 <p>Line one
23459 </p><p>Line two
23460 </p>
23461 </div>
23462
23463 !! end
23464
23465 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23466 # Parsoid seems to do a better job here since its p-wrapper is probably smarter.
23467 !! test
23468 Nesting tags, paragraphs on lines which begin with <div>
23469 !! wikitext
23470 <div></div><strong>A
23471 B</strong>
23472 !! html/php+tidy
23473 <div></div><p><strong>A
23474 </strong></p><strong></strong><p><strong>B</strong>
23475 </p>
23476 !! html/parsoid
23477 <div></div>
23478 <p><strong>A
23479 B</strong>
23480 </p>
23481 !! end
23482
23483 # T8200: <blockquote> should behave like <div> with respect to line breaks
23484 !! test
23485 T8200: paragraphs inside blockquotes (no extra line breaks)
23486 !! wikitext
23487 <blockquote>Line one
23488
23489 Line two</blockquote>
23490 !! html
23491 <blockquote>Line one
23492 Line two</blockquote>
23493
23494 !! html+tidy
23495 <blockquote><p>Line one
23496 Line two</p></blockquote>
23497 !! end
23498
23499 !! test
23500 T8200: paragraphs inside blockquotes (extra line break on open)
23501 !! wikitext
23502 <blockquote>
23503 Line one
23504
23505 Line two</blockquote>
23506 !! html
23507 <blockquote>
23508 <p>Line one
23509 </p>
23510 Line two</blockquote>
23511
23512 !! html+tidy
23513 <blockquote>
23514 <p>Line one
23515 </p><p>
23516 Line two</p></blockquote>
23517 !! end
23518
23519 # Parsoid's output is broken on this because of Tidy-compatibility cruft
23520 !! test
23521 T8200: paragraphs inside blockquotes (extra line break on close)
23522 !! wikitext
23523 <blockquote>Line one
23524
23525 Line two
23526 </blockquote>
23527 !! html
23528 <blockquote>Line one
23529 <p>Line two
23530 </p>
23531 </blockquote>
23532
23533 !! html+tidy
23534 <blockquote><p>Line one
23535 </p><p>Line two
23536 </p>
23537 </blockquote>
23538 !! end
23539
23540 !! test
23541 T8200: paragraphs inside blockquotes (extra line break on open and close)
23542 !! wikitext
23543 <blockquote>
23544 Line one
23545
23546 Line two
23547 </blockquote>
23548 !! html
23549 <blockquote>
23550 <p>Line one
23551 </p><p>Line two
23552 </p>
23553 </blockquote>
23554
23555 !! end
23556
23557 ## This is a corner case interaction between the paragraph wrapping in the
23558 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
23559 ## some tags which close paragraphs (and thus prevent wrapping on their line),
23560 ## of which "div" is one, but do p-wrapping inside them. These are referred
23561 ## to as "never suppressing". Remex, for its part, doesn't traverse into
23562 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
23563 !! test
23564 Paragraphs inside blockquotes/divs (no extra line breaks)
23565 !! wikitext
23566 <blockquote><div>Line one
23567
23568 Line two</div></blockquote>
23569 !! html
23570 <blockquote><div>Line one
23571 Line two</div></blockquote>
23572
23573 !! end
23574
23575 !! test
23576 Paragraphs inside blockquotes/divs (extra line break on open)
23577 !! wikitext
23578 <blockquote><div>
23579 Line one
23580
23581 Line two</div></blockquote>
23582 !! html
23583 <blockquote><div>
23584 <p>Line one
23585 </p>
23586 Line two</div></blockquote>
23587
23588 !! end
23589
23590 !! test
23591 Paragraphs inside blockquotes/divs (extra line break on close)
23592 !! wikitext
23593 <blockquote><div>Line one
23594
23595 Line two
23596 </div></blockquote>
23597 !! html
23598 <blockquote><div>Line one
23599 <p>Line two
23600 </p>
23601 </div></blockquote>
23602
23603 !! end
23604
23605 !! test
23606 Paragraphs inside blockquotes/divs (extra line break on open and close)
23607 !! wikitext
23608 <blockquote><div>
23609 Line one
23610
23611 Line two
23612 </div></blockquote>
23613 !! html
23614 <blockquote><div>
23615 <p>Line one
23616 </p><p>Line two
23617 </p>
23618 </div></blockquote>
23619
23620 !! end
23621
23622 !! test
23623 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23624 !! options
23625 wgLinkHolderBatchSize=0
23626 !! wikitext
23627 [[meatball:1]]
23628 [[meatball:2]]
23629 [[meatball:3]]
23630 !! html
23631 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23632 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23633 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23634 </p>
23635 !! end
23636
23637 !! test
23638 Free external link invading image caption
23639 !! wikitext
23640 [[Image:Foobar.jpg|thumb|http://x|hello]]
23641 !! html/php
23642 <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>
23643
23644 !! html/parsoid
23645 <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>
23646 !! end
23647
23648 !! test
23649 T17196: localised external link numbers
23650 !! options
23651 language=fa
23652 !! wikitext
23653 [http://en.wikipedia.org/]
23654 !! html/php
23655 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23656 </p>
23657 !! html/parsoid
23658 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23659 !! end
23660
23661 !! test
23662 Multibyte character in padleft
23663 !! wikitext
23664 {{padleft:-Hello|7|Æ}}
23665 !! html/php
23666 <p>Æ-Hello
23667 </p>
23668 !! html/parsoid
23669 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23670 !! end
23671
23672 !! test
23673 Multibyte character in padright
23674 !! wikitext
23675 {{padright:Hello-|7|Æ}}
23676 !! html/php
23677 <p>Hello-Æ
23678 </p>
23679 !! html/parsoid
23680 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23681 !! end
23682
23683 !!test
23684 formatdate parser function
23685 !! wikitext
23686 {{#formatdate:2009-03-24}}
23687 !! html
23688 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23689 </p>
23690 !! end
23691
23692 !!test
23693 formatdate parser function, with default format
23694 !! wikitext
23695 {{#formatdate:2009-03-24|mdy}}
23696 !! html
23697 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23698 </p>
23699 !! end
23700
23701 !! test
23702 Spacing of numbers in formatted dates
23703 !! wikitext
23704 {{#formatdate:January 15}}
23705 !! html
23706 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23707 </p>
23708 !! end
23709
23710 !! test
23711 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
23712 !! options
23713 language=nl title=[[MediaWiki:Common.css]]
23714 !! wikitext
23715 {{#formatdate:2009-03-24|dmy}}
23716 !! html
23717 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23718 </p>
23719 !! end
23720
23721 #
23722 #
23723 #
23724
23725 #
23726 # Edit comments
23727 #
23728
23729 !! test
23730 Edit comment with link
23731 !! options
23732 comment
23733 !! wikitext
23734 I like the [[Main Page]] a lot
23735 !! html/php
23736 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23737 !!end
23738
23739 !! test
23740 Edit comment with link and link text
23741 !! options
23742 comment
23743 !! wikitext
23744 I like the [[Main Page|best pages]] a lot
23745 !! html/php
23746 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23747 !!end
23748
23749 !! test
23750 Edit comment with link and link text with suffix
23751 !! options
23752 comment
23753 !! wikitext
23754 I like the [[Main Page|best page]]s a lot
23755 !! html/php
23756 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23757 !!end
23758
23759 !! test
23760 Edit comment with section link (non-local, eg in history list)
23761 !! options
23762 comment title=[[Main Page]]
23763 !! wikitext
23764 /* External links */ removed bogus entries
23765 !! html/php
23766 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23767 !!end
23768
23769 !! test
23770 Edit comment with section link and text before it (non-local, eg in history list)
23771 !! options
23772 comment title=[[Main Page]]
23773 !! wikitext
23774 pre-comment text /* External links */ removed bogus entries
23775 !! html/php
23776 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>
23777 !!end
23778
23779 !! test
23780 Edit comment with section link (local, eg in diff view)
23781 !! options
23782 comment local title=[[Main Page]]
23783 !! wikitext
23784 /* External links */ removed bogus entries
23785 !! html/php
23786 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23787 !!end
23788
23789 !! test
23790 Edit comment with subpage link (T16080)
23791 !! options
23792 comment
23793 subpage
23794 title=[[Subpage test]]
23795 !! wikitext
23796 Poked at a [[/subpage]] here...
23797 !! html/php
23798 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23799 !!end
23800
23801 !! test
23802 Edit comment with subpage link and link text (T16080)
23803 !! options
23804 comment
23805 subpage
23806 title=[[Subpage test]]
23807 !! wikitext
23808 Poked at a [[/subpage|neat little page]] here...
23809 !! html/php
23810 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23811 !!end
23812
23813 !! test
23814 Edit comment with bogus subpage link in non-subpage NS (T16080)
23815 !! options
23816 comment
23817 title=[[Subpage test]]
23818 !! wikitext
23819 Poked at a [[/subpage]] here...
23820 !! html/php
23821 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...
23822 !!end
23823
23824 !! test
23825 Edit comment with bare anchor link (local, as on diff)
23826 !! options
23827 comment
23828 local
23829 title=[[Main Page]]
23830 !! wikitext
23831 [[#section]]
23832 !! html/php
23833 <a href="#section">#section</a>
23834 !! end
23835
23836 !! test
23837 Edit comment with bare anchor link (non-local, as on history)
23838 !! options
23839 comment
23840 title=[[Main Page]]
23841 !! wikitext
23842 [[#section]]
23843 !! html/php
23844 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23845 !! end
23846
23847 !! test
23848 Anchor starting with underscore
23849 !! options
23850 title=[[Foo]]
23851 !! wikitext
23852 [[#_ref|One]]
23853 !! html/php
23854 <p><a href="#_ref">One</a>
23855 </p>
23856 !! html/parsoid
23857 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23858 !! end
23859
23860 !! test
23861 Id starting with underscore
23862 !! wikitext
23863 <div id="_ref"></div>
23864 !! html/*
23865 <div id="_ref"></div>
23866
23867 !! end
23868
23869 !! test
23870 Edit comment with link with more than one pipe (T99346)
23871 !! options
23872 comment
23873 !! wikitext
23874 [[Main Page|Many|pipes]]
23875 !! html/php
23876 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23877 !! end
23878
23879 !! test
23880 Complex edit comment with link with more than one pipe (T99346)
23881 !! options
23882 comment
23883 !! wikitext
23884 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23885 !! html/php
23886 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;
23887 !! end
23888
23889 !! test
23890 Space normalisation on autocomment (T24784)
23891 !! options
23892 comment
23893 title=[[Main Page]]
23894 !! wikitext
23895 /* __hello__world__ */
23896 !! html/php
23897 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23898 !! end
23899
23900 !! test
23901 percent-encoding and + signs in comments (T28410)
23902 !! options
23903 comment
23904 !! wikitext
23905 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23906 !! html/php
23907 <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>
23908 !! end
23909
23910 # Parsoid doesn't support this yet: see T75581
23911 # but it *should* omit the 'src' attribute if the image is bad.
23912 # PHP side of tests was disabled in
23913 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23914 # because of issues in the PHP parserTests infrastructure
23915 # (but the output below is indeed what the PHP side emits)
23916 !! test
23917 Bad images - basic functionality
23918 !! wikitext
23919 [[File:Bad.jpg]]
23920 !! html/php+disabled
23921 !! html/parsoid
23922 <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>
23923 !! end
23924
23925 !! test
23926 Bad images - T18039: text after bad image disappears
23927 !! wikitext
23928 Foo bar
23929 [[File:Bad.jpg]]
23930 Bar foo
23931 !! html/php+disabled
23932 <p>Foo bar
23933 </p><p>Bar foo
23934 </p>
23935 !! html/parsoid
23936 <p>Foo bar
23937 <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>
23938 Bar foo</p>
23939 !! end
23940
23941 !! test
23942 Verify that displaytitle works (T24501) no displaytitle
23943 !! options
23944 showtitle
23945 !! config
23946 wgAllowDisplayTitle=true
23947 wgRestrictDisplayTitle=false
23948 !! wikitext
23949 this is not the the title
23950 !! html/php
23951 Parser test
23952 <p>this is not the the title
23953 </p>
23954 !! end
23955
23956 !! test
23957 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23958 !! options
23959 showtitle
23960 title=[[Screen]]
23961 !! config
23962 wgAllowDisplayTitle=true
23963 wgRestrictDisplayTitle=false
23964 !! wikitext
23965 this is not the the title
23966 {{DISPLAYTITLE:whatever}}
23967 !! html/php
23968 whatever
23969 <p>this is not the the title
23970 </p>
23971 !! end
23972
23973 !! test
23974 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23975 !! options
23976 showtitle
23977 title=[[Screen]]
23978 !! config
23979 wgAllowDisplayTitle=true
23980 wgRestrictDisplayTitle=true
23981 !! wikitext
23982 this is not the the title
23983 {{DISPLAYTITLE:whatever}}
23984 !! html/php
23985 Screen
23986 <p>this is not the the title
23987 </p>
23988 !! end
23989
23990 !! test
23991 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23992 !! options
23993 showtitle
23994 title=[[Screen]]
23995 !! config
23996 wgAllowDisplayTitle=true
23997 wgRestrictDisplayTitle=true
23998 !! wikitext
23999 this is not the the title
24000 {{DISPLAYTITLE:screen}}
24001 !! html/php
24002 screen
24003 <p>this is not the the title
24004 </p>
24005 !! end
24006
24007 !! test
24008 Verify that displaytitle works (T24501) AllowDisplayTitle=false
24009 !! options
24010 showtitle
24011 title=[[Screen]]
24012 !! config
24013 wgAllowDisplayTitle=false
24014 !! wikitext
24015 this is not the the title
24016 {{DISPLAYTITLE:screen}}
24017 !! html/php
24018 Screen
24019 <p>this is not the the title
24020 <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>
24021 </p>
24022 !! end
24023
24024 !! test
24025 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
24026 !! options
24027 showtitle
24028 title=[[Screen]]
24029 !! config
24030 wgAllowDisplayTitle=false
24031 !! wikitext
24032 this is not the the title
24033 !! html/php
24034 Screen
24035 <p>this is not the the title
24036 </p>
24037 !! end
24038
24039 !! test
24040 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
24041 !! options
24042 showtitle
24043 title=[[Screen]]
24044 !! config
24045 wgAllowDisplayTitle=true
24046 wgRestrictDisplayTitle=true
24047 !! wikitext
24048 this is not the the title
24049 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
24050 !! html/php
24051 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
24052 <p>this is not the the title
24053 </p>
24054 !! end
24055
24056 !! test
24057 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
24058 !! options
24059 showtitle
24060 title=[[Screen]]
24061 !! config
24062 wgAllowDisplayTitle=true
24063 wgRestrictDisplayTitle=true
24064 !! wikitext
24065 this is not the the title
24066 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
24067 !! html/php
24068 <span style="color: red;">s</span>creen
24069 <p>this is not the the title
24070 </p>
24071 !! end
24072
24073 !! test
24074 Page status indicators: Empty name is invalid
24075 !! options
24076 showindicators
24077 !! wikitext
24078 <indicator name=" "></indicator>
24079 <indicator></indicator>
24080 !! html/php
24081 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24082 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24083 </p>
24084 !! end
24085
24086 !! test
24087 Page status indicators: Weird syntaxes that are okay
24088 !! options
24089 showindicators
24090 !! wikitext
24091 <indicator name="empty" />
24092 <indicator name="name"></indicator>
24093 !! html/php
24094 empty=
24095 name=
24096 <p><br />
24097 </p>
24098 !! end
24099
24100 !! test
24101 Page status indicators: Torture test
24102 !! options
24103 showindicators
24104 !! wikitext
24105 <indicator name="01">hello world</indicator>
24106 <indicator name="02">[[Main Page]]</indicator>
24107 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
24108 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
24109 <indicator name="05">*foo
24110 *bar</indicator>
24111 <indicator name="06"><nowiki>foo</nowiki></indicator>
24112 <indicator name="07"> Preformatted</indicator>
24113 <indicator name="08"><div>Broken tag</indicator>
24114 <indicator name="09">{| class=wikitable
24115 |cell
24116 |}</indicator>
24117 <indicator name="10">Two
24118
24119 paragraphs</indicator>
24120 !! html/php
24121 01=hello world
24122 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
24123 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" />
24124 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>
24125 05=<ul><li>foo</li>
24126 <li>bar</li></ul>
24127
24128 06=foo
24129 07=<pre>Preformatted
24130 </pre>
24131 08=<div>Broken tag</div>
24132
24133 09=<table class="wikitable">
24134 <tr>
24135 <td>cell
24136 </td></tr></table>
24137
24138 10=<p>Two
24139 </p><p>paragraphs
24140 </p>
24141 <p><br />
24142 </p><p><br />
24143 </p><p><br />
24144 </p><p><br />
24145 </p><p><br />
24146 </p>
24147 !! end
24148
24149 !! test
24150 preload: check <noinclude> and <includeonly>
24151 !! options
24152 preload
24153 !! wikitext
24154 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
24155 !! html/php
24156 Hello kind world.
24157 !! end
24158
24159 !! test
24160 preload: check <onlyinclude>
24161 !! options
24162 preload
24163 !! wikitext
24164 Goodbye <onlyinclude>Hello world</onlyinclude>
24165 !! html/php
24166 Hello world
24167 !! end
24168
24169 !! test
24170 preload: can pass tags through if we want to
24171 !! options
24172 preload
24173 !! wikitext
24174 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
24175 !! html/php
24176 <includeonly>Hello world</includeonly>
24177 !! end
24178
24179 !! test
24180 preload: check that it doesn't try to do tricks
24181 !! options
24182 preload
24183 !! wikitext
24184 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24185 !! html/php
24186 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24187 !! end
24188
24189 !! test
24190 Play a bit with r67090 and T5158
24191 !! wikitext
24192 <div style="width:50% !important">&nbsp;</div>
24193 <div style="width:50%&nbsp;!important">&nbsp;</div>
24194 <div style="width:50%&#160;!important">&nbsp;</div>
24195 <div style="border : solid;">&nbsp;</div>
24196 !! html/php
24197 <div style="width:50% !important">&#160;</div>
24198 <div style="width:50% !important">&#160;</div>
24199 <div style="width:50% !important">&#160;</div>
24200 <div style="border&#32;: solid;">&#160;</div>
24201
24202 !! html/parsoid
24203 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24204 <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>
24205 <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>
24206 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24207
24208 !! end
24209
24210 !! test
24211 French spaces in wikitext
24212 !! wikitext
24213 foo ! bar ? bat 50 % is less than 75 %.
24214
24215 Hello : this ; is « something ‹ else › again »
24216 !! html
24217 <p>foo&#160;! bar&#160;? bat 50&#160;% is less than 75&#160;%.
24218 </p><p>Hello&#160;: this&#160;; is «&#160;something ‹&#160;else&#160;› again&#160;»
24219 </p>
24220 !! end
24221
24222 # It would be reasonable for Parsoid and PHP to differ here.
24223 # The PHP behavior is arguably a bug.
24224 !! test
24225 Corner case: french spaces in definition list
24226 !! wikitext
24227 ;foo : bar
24228 !! html+tidy
24229 <dl><dt>foo&#160;</dt>
24230 <dd>bar</dd></dl>
24231 !! end
24232
24233 !! test
24234 T5158: Test for French spaces in attributes
24235 !! wikitext
24236 <br style=" clear : both ; " />
24237 !! html/php
24238 <p><br style="clear&#32;: both&#32;;" />
24239 </p>
24240 !! end
24241
24242 !! test
24243 HTML5 data attributes
24244 !! wikitext
24245 <span data-foo="bar">Baz</span>
24246 <p data-abc-def_hij="">Quuz</p>
24247 !! html/php
24248 <p><span data-foo="bar">Baz</span>
24249 </p>
24250 <p data-abc-def_hij="">Quuz</p>
24251
24252 !! html/parsoid
24253 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
24254 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
24255 !! end
24256
24257 !! test
24258 Strip reserved data attributes
24259 !! wikitext
24260 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
24261 !! html/php
24262 <div data-ok="fred">d</div>
24263
24264 !! html/parsoid
24265 <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>
24266 !! end
24267
24268 !! test
24269 percent-encoding and + signs in internal links (T28410)
24270 !! wikitext
24271 [[User:+%]] [[Page+title%]]
24272 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
24273 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
24274 [[%33%45]] [[%33%45+]]
24275 !! html/php
24276 <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>
24277 <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>
24278 <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>
24279 <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>
24280 </p>
24281 !! html/parsoid
24282 <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>
24283 <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>
24284 <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>
24285 <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>
24286 !! end
24287
24288 !! test
24289 Special characters in embedded file links (T29679)
24290 !! wikitext
24291 [[File:Contains & ampersand.jpg]]
24292 [[File:Does not exist.jpg|Title with & ampersand]]
24293 !! html/php
24294 <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>
24295 <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>
24296 </p>
24297 !! html/parsoid
24298 <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>
24299 <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>
24300 !! end
24301
24302 !! test
24303 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
24304 !! wikitext
24305 Text&apos;s been normalized?
24306 !! html
24307 <p>Text&#39;s been normalized?
24308 </p>
24309 !! end
24310
24311 !! test
24312 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
24313 !! wikitext
24314 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
24315 !! html
24316 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
24317 </p>
24318 !! end
24319
24320 !! test
24321 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
24322 !! wikitext
24323 [http://www.example.org/ ideograms]
24324 !! html
24325 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
24326 </p>
24327 !! end
24328
24329 !! test
24330 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
24331 !! wikitext
24332 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
24333 !! html
24334 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
24335 </p>
24336 !! end
24337
24338 !! article
24339 Mediawiki:loop1
24340 !! text
24341 {{Identical|A}}
24342 !! endarticle
24343
24344 !! article
24345 Mediawiki:loop2
24346 !! text
24347 {{Identical|B}}
24348 !! endarticle
24349
24350 !! article
24351 Template:Identical
24352 !! text
24353 {{int:loop1}}
24354 {{int:loop2}}
24355 !! endarticle
24356
24357 !! test
24358 T33098 Template which includes system messages which includes the template
24359 !! wikitext
24360 {{Identical}}
24361 !! html
24362 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24363 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24364 </p>
24365 !! end
24366
24367 !! test
24368 T33490 Turkish: ucfirst 'blah'
24369 !! options
24370 language=tr
24371 !! wikitext
24372 {{ucfirst:blah}}
24373 !! html
24374 <p>Blah
24375 </p>
24376 !! end
24377
24378 !! test
24379 T33490 Turkish: ucfirst 'ix'
24380 !! options
24381 language=tr
24382 !! wikitext
24383 {{ucfirst:ix}}
24384 !! html
24385 <p>İx
24386 </p>
24387 !! end
24388
24389 !! test
24390 T33490 Turkish: lcfirst 'BLAH'
24391 !! options
24392 language=tr
24393 !! wikitext
24394 {{lcfirst:BLAH}}
24395 !! html
24396 <p>bLAH
24397 </p>
24398 !! end
24399
24400 !! test
24401 T33490 Turkish: ucfırst (with a dotless i)
24402 !! options
24403 language=tr
24404 !! wikitext
24405 {{ucfırst:blah}}
24406 !! html
24407 <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>
24408 </p>
24409 !! end
24410
24411 !! test
24412 T33490 ucfırst (with a dotless i) with English language
24413 !! options
24414 language=en
24415 !! wikitext
24416 {{ucfırst:blah}}
24417 !! html
24418 <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>
24419 </p>
24420 !! end
24421
24422 # Note that Parsoid doesn't emit an explicit TOC.
24423 # Note also that the html2wt direction tends to emit an extra newline
24424 # between the __TOC__ magicword and the first heading unless *both*
24425 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24426 # it's "{}").
24427
24428 !! test
24429 T28375: TOC with italics
24430 !! options
24431 title=[[Main Page]]
24432 !! wikitext
24433 __TOC__
24434 ==''Lost'' episodes==
24435 !! html/php
24436 <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>
24437 <ul>
24438 <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>
24439 </ul>
24440 </div>
24441
24442 <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>
24443
24444 !! html/parsoid
24445 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24446 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24447 !! end
24448
24449 !! test
24450 T28375: TOC with bold
24451 !! options
24452 title=[[Main Page]]
24453 !! wikitext
24454 __TOC__
24455 =='''should be bold''' then normal text==
24456 !! html/php
24457 <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>
24458 <ul>
24459 <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>
24460 </ul>
24461 </div>
24462
24463 <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>
24464
24465 !! html/parsoid
24466 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24467 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24468 !! end
24469
24470 !! test
24471 T35845: Headings become cursive in TOC when they contain an image
24472 !! options
24473 title=[[Main Page]]
24474 !! wikitext
24475 __TOC__
24476 ==Image [[Image:foobar.jpg]]==
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="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24481 </ul>
24482 </div>
24483
24484 <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>
24485
24486 !! html/parsoid
24487 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24488 <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>
24489 !! end
24490
24491 !! test
24492 T35845 (2): Headings become bold in TOC when they contain a blockquote
24493 !! options
24494 title=[[Main Page]]
24495 !! wikitext
24496 __TOC__
24497 ==<blockquote>Quote</blockquote>==
24498 !! html/php
24499 <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>
24500 <ul>
24501 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24502 </ul>
24503 </div>
24504
24505 <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>
24506
24507 !! html/php+tidy
24508 <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>
24509 <ul>
24510 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24511 </ul>
24512 </div>
24513
24514 <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>
24515 !! html/parsoid
24516 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24517 <h2 id="Quote" data-parsoid='{}'><blockquote>Quote</blockquote></h2>
24518 !! end
24519
24520 !! test
24521 Unclosed tags in TOC
24522 !! config
24523 wgFragmentMode=[ 'html5', 'legacy' ]
24524 !! options
24525 title=[[Main Page]]
24526 !! wikitext
24527 __TOC__
24528 ==Proof: 2 < 3==
24529 <small>Hanc marginis exiguitas non caperet.</small>
24530 QED
24531 !! html/php
24532 <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>
24533 <ul>
24534 <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>
24535 </ul>
24536 </div>
24537
24538 <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>
24539 <p><small>Hanc marginis exiguitas non caperet.</small>
24540 QED
24541 </p>
24542 !! html/parsoid
24543 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24544 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24545 <p><small>Hanc marginis exiguitas non caperet.</small>
24546 QED</p>
24547 !! end
24548
24549 !! test
24550 Multiple tags in TOC
24551 !! wikitext
24552 __TOC__
24553 ==<i>Foo</i> <b>Bar</b>==
24554
24555 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24556 !! html/php
24557 <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>
24558 <ul>
24559 <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>
24560 <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>
24561 </ul>
24562 </div>
24563
24564 <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>
24565 <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>
24566
24567 !! html/php+tidy
24568 <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>
24569 <ul>
24570 <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>
24571 <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>
24572 </ul>
24573 </div>
24574
24575 <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>
24576 <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>
24577 !! html/parsoid
24578 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24579 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
24580
24581 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote></h2>
24582 !! end
24583
24584 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24585 # html5 tag parsing.
24586 !! test
24587 Tags with parameters in TOC
24588 !! options
24589 parsoid=wt2html
24590 !! wikitext
24591 __TOC__
24592 ==<sup class="in-h2">Hello</sup>==
24593
24594 ==<sup class="a > b">Evilbye</sup>==
24595 !! html/php
24596 <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>
24597 <ul>
24598 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24599 <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>
24600 </ul>
24601 </div>
24602
24603 <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>
24604 <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>
24605
24606 !! html/parsoid
24607 <meta property="mw:PageProp/toc" />
24608 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
24609
24610 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
24611 !! end
24612
24613 !! test
24614 span tags with directionality in TOC
24615 !! wikitext
24616 __TOC__
24617 ==<span dir="ltr">C++</span>==
24618
24619 ==<span dir="rtl">זבנג!</span>==
24620
24621 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
24622
24623 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
24624
24625 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
24626 !! html/php
24627 <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>
24628 <ul>
24629 <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>
24630 <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>
24631 <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>
24632 <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>
24633 <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>
24634 </ul>
24635 </div>
24636
24637 <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>
24638 <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>
24639 <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>
24640 <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>
24641 <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>
24642
24643 !! html/parsoid
24644 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24645 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
24646 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
24647 <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>
24648 <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>
24649 <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>
24650 !! end
24651
24652 !! test
24653 T74884: bdi element in ToC
24654 !! wikitext
24655 __TOC__
24656 ==<bdi>test</bdi>==
24657 !! html/php
24658 <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>
24659 <ul>
24660 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24661 </ul>
24662 </div>
24663
24664 <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>
24665
24666 !! html/parsoid
24667 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24668 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
24669 !! end
24670
24671 !! test
24672 T35715: s/strike element in ToC
24673 !! wikitext
24674 __TOC__
24675 ==<s>test</s> test <strike>test</strike>==
24676 !! html/php
24677 <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>
24678 <ul>
24679 <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>
24680 </ul>
24681 </div>
24682
24683 <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>
24684
24685 !! html/parsoid
24686 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24687 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
24688 !! end
24689
24690 !! test
24691 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24692 !! wikitext
24693 __TOC__
24694 ==x==
24695 !! html/php
24696 <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>
24697 <ul>
24698 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24699 </ul>
24700 </div>
24701
24702 <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>
24703
24704 !! html/parsoid
24705 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24706 <h2 id="x" data-parsoid='{}'>x</h2>
24707 !! end
24708
24709 !! article
24710 MediaWiki:T34057
24711 !! text
24712 == {{int:headline_sample}} ==
24713 !! endarticle
24714
24715 !! test
24716 T34057: Title needed when expanding <h> nodes.
24717 !! options
24718 title=[[Main Page]]
24719 !! wikitext
24720 {{int:T34057}}
24721 !! html
24722 <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>
24723
24724 !! end
24725
24726 !! test
24727 Strip marker in urlencode
24728 !! wikitext
24729 {{urlencode:x<nowiki/>y}}
24730 {{urlencode:x<nowiki/>y|wiki}}
24731 {{urlencode:x<nowiki/>y|path}}
24732 {{urlencode:x<pre id="one">two</pre>y}}
24733 !! html/php
24734 <p>xy
24735 xy
24736 xy
24737 xy
24738 </p>
24739 !! end
24740
24741 !! test
24742 Strip marker in lc
24743 !! wikitext
24744 {{lc:x<nowiki/>y}}
24745 !! html
24746 <p>xy
24747 </p>
24748 !! end
24749
24750 !! test
24751 Strip marker in uc
24752 !! wikitext
24753 {{uc:x<nowiki/>y}}
24754 !! html
24755 <p>XY
24756 </p>
24757 !! end
24758
24759 !! test
24760 Strip marker in formatNum
24761 !! wikitext
24762 {{formatnum:1<nowiki/>2}}
24763 {{formatnum:1<nowiki/>2|R}}
24764 !! html
24765 <p>12
24766 12
24767 </p>
24768 !! end
24769
24770 !! test
24771 Check noCommafy in formatNum
24772 !! options
24773 language=be-tarask
24774 !! wikitext
24775 {{formatnum:123456.78}}
24776 {{formatnum:123456.78|NOSEP}}
24777 !! html
24778 <p>123 456,78
24779 123456.78
24780 </p>
24781 !! end
24782
24783 !! test
24784 Wrong option for formatNum (T58199)
24785 !! wikitext
24786 {{formatnum:1,234.56|Random}}
24787 {{formatnum:1,234.56|EVERYTHING}}
24788 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24789 !! html
24790 <p>1,234.56
24791 1,234.56
24792 1,234.56
24793 </p>
24794 !! end
24795
24796 !! test
24797 Strip marker in grammar
24798 !! options
24799 language=fi
24800 !! wikitext
24801 {{grammar:elative|foo<nowiki/>bar}}
24802 !! html
24803 <p>foobarista
24804 </p>
24805 !! end
24806
24807 !! test
24808 Strip marker in padleft
24809 !! wikitext
24810 {{padleft:|2|x<nowiki/>y}}
24811 !! html
24812 <p>xy
24813 </p>
24814 !! end
24815
24816 !! test
24817 Strip marker in padright
24818 !! wikitext
24819 {{padright:|2|x<nowiki/>y}}
24820 !! html
24821 <p>xy
24822 </p>
24823 !! end
24824
24825 !! test
24826 Strip marker in anchorencode
24827 !! wikitext
24828 {{anchorencode:x<nowiki/>y}}
24829 !! html/php
24830 <p>xy
24831 </p>
24832 !! html/parsoid
24833 <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>
24834 !! end
24835
24836 !! test
24837 nowiki inside link inside heading (T20295)
24838 !! wikitext
24839 ==[[foo|x<nowiki>y</nowiki>z]]==
24840 !! html
24841 <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>
24842
24843 !! end
24844
24845 !! test
24846 new support for bdi element (T33817)
24847 !! wikitext
24848 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24849 !! html
24850 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24851
24852 !!end
24853
24854 !! test
24855 Ignore pipe between table row attributes
24856 !! wikitext
24857 {|
24858 |quux
24859 |- id=foo | style='color: red'
24860 |bar
24861 |}
24862 !! html
24863 <table>
24864 <tr>
24865 <td>quux
24866 </td></tr>
24867 <tr id="foo" style="color: red">
24868 <td>bar
24869 </td></tr></table>
24870
24871 !! end
24872
24873 !!test
24874 Language parser function
24875 !! wikitext
24876 {{#language:ar}}
24877 !! html
24878 <p>العربية
24879 </p>
24880 !! end
24881
24882 !!test
24883 Padleft and padright (default 0-padding)
24884 !! wikitext
24885 {{padleft:xyz|5}}
24886 {{padright:xyz|5}}
24887 !! html/php
24888 <p>00xyz
24889 xyz00
24890 </p>
24891 !! html/parsoid
24892 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
24893 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
24894 !! end
24895
24896 !!test
24897 Padleft and padright (partial fill)
24898 !! wikitext
24899 {{padleft:xyz|6|ab}}
24900 {{padright:xyz|6|ab}}
24901 !! html/php
24902 <p>abaxyz
24903 xyzaba
24904 </p>
24905 !! html/parsoid
24906 <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>
24907 <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>
24908 !! end
24909
24910 !!test
24911 Padleft and padright as substr
24912 !! wikitext
24913 {{padleft:|3|abcde}}
24914 {{padright:|3|abcde}}
24915 !! html/php
24916 <p>abc
24917 abc
24918 </p>
24919 !! html/parsoid
24920 <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>
24921 <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>
24922 !! end
24923
24924 !! test
24925 Padleft and padright with non-numerical length (T180403)
24926 !! wikitext
24927 {{padleft:abcdef|junk}}
24928 {{padright:abcdef|junk}}
24929 !! html/php
24930 <p>abcdef
24931 abcdef
24932 </p>
24933 !! end
24934
24935 !!test
24936 Special parser function
24937 !! wikitext
24938 {{#special:RandomPage}}
24939 {{#special:BaDtItLe}}
24940 {{#special:Foobar}}
24941 !! html
24942 <p>Special:Random
24943 Special:Badtitle
24944 Special:Foobar
24945 </p>
24946 !! end
24947
24948 !!test
24949 T36939 - Case insensitive link parsing ([HttP://])
24950 !! wikitext
24951 [HttP://MediaWiki.Org/]
24952 !! html/php
24953 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24954 </p>
24955 !! html/parsoid
24956 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
24957 !! end
24958
24959 !!test
24960 T36939 - Case insensitive link parsing ([HttP:// title])
24961 !! wikitext
24962 [HttP://MediaWiki.Org/ MediaWiki]
24963 !! html
24964 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24965 </p>
24966 !! end
24967
24968 !!test
24969 T36939 - Case insensitive link parsing (HttP://)
24970 !! wikitext
24971 HttP://MediaWiki.Org/
24972 !! html/php
24973 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24974 </p>
24975 !! html/parsoid
24976 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24977 !! end
24978
24979 !!test
24980 Disable TOC
24981 !! options
24982 notoc
24983 !! wikitext
24984 Lead
24985 ==Section 1==
24986 ==Section 2==
24987 ==Section 3==
24988 ==Section 4==
24989 ==Section 5==
24990 !! html
24991 <p>Lead
24992 </p>
24993
24994 <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>
24995 <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>
24996 <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>
24997 <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>
24998 <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>
24999
25000 !! end
25001
25002
25003 ###
25004 ### Parsoid-specific tests
25005 ### Parsoid-PHP parser incompatibilities
25006 ###
25007 !!test
25008 1. SOL-sensitive wikitext tokens as template-args
25009 !!options
25010 parsoid=wt2html,wt2wt
25011 !! wikitext
25012 {{echo|*a}}
25013 {{echo|#a}}
25014 {{echo|:a}}
25015 !! html
25016 <span about="#mwt1" typeof="mw:Transclusion">
25017 </span><ul about="#mwt1"><li>a</li>
25018 </ul>
25019 <span about="#mwt2" typeof="mw:Transclusion">
25020 </span><ol about="#mwt2"><li>a</li>
25021 </ol>
25022 <span about="#mwt3" typeof="mw:Transclusion">
25023 </span><dl about="#mwt3"><dd>a</dd>
25024 </dl>
25025 !!end
25026
25027 #### -----------------------------------------------------------------
25028 #### Parsoid-specific functionality tests
25029 #### -----------------------------------------------------------------
25030
25031 # T65642/T68749: Formatting elt fixup around images is cleaned up.
25032 # We know wt2wt will fail, but we expect selser to pass.
25033 # Due to the nature of our testing, wt2wt and selser tests will enter the
25034 # blacklist and we'll catch selser regressions based on changes to the
25035 # blacklist entries for selser tests.
25036 !! test
25037 1. Bad treebuilder fixup of formatting elt is cleaned up
25038 !! options
25039 parsoid=wt2html,wt2wt
25040 !! wikitext
25041 {|
25042 |
25043 <small>
25044 [[Image:Foobar.jpg|right|Test]]
25045 </small>
25046 |}
25047 !! html/parsoid
25048 <table>
25049 <tbody><tr><td>
25050 <small>
25051 <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>
25052 </small>
25053 </td></tr>
25054 </tbody></table>
25055 !! end
25056
25057 !! test
25058 2. Bad treebuilder fixup of formatting elt is cleaned up
25059 !! options
25060 parsoid=wt2html,wt2wt
25061 !! wikitext
25062 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
25063
25064 <small>[[Image:Foobar.jpg|right|300px]]</small>
25065 !! html/parsoid
25066
25067 <p><b>foo</b></p>
25068 <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>
25069 <p><b>bar</b></p>
25070 <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>
25071 !! end
25072
25073 !! test
25074 3. Bad treebuilder fixup of formatting elt is cleaned up
25075 !! options
25076 parsoid=wt2html,wt2wt
25077 !! wikitext
25078 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
25079 !! html/parsoid
25080 <p><small><b>foo</b></small></p>
25081 <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>
25082 <p><small><b>bar</b></small></p>
25083 !! end
25084
25085 !! test
25086 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
25087 !! options
25088 parsoid=wt2html,wt2wt
25089 !! wikitext
25090 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
25091 !! html/parsoid
25092 <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>
25093 !! end
25094
25095 #### ----------------------------------------------------------------
25096 #### Parsoid-only testing of Parsoid's impl of LST
25097 #### Not implemented yet, see
25098 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
25099 #### ----------------------------------------------------------------
25100
25101 ## We still need to support serializing the older format while content is stored.
25102 !! test
25103 LST Sections: Backwards compatibility
25104 !! options
25105 parsoid={
25106 "suppressErrors": true,
25107 "modes": ["html2wt"]
25108 }
25109 !! wikitext
25110 <section begin="2011-05-16" />
25111 <section end="2014-04-10 (MW 1.23wmf22)" />
25112 !! html/parsoid
25113 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
25114 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
25115 !! end
25116
25117 !! test
25118 LST Sections: Newfangled approach
25119 !! wikitext
25120 <section begin="2011-05-16" />
25121 <section end="2014-04-10 (MW 1.23wmf22)" />
25122 !! html/parsoid
25123 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
25124 </span>
25125 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
25126 </span></p>
25127 !! end
25128
25129 #--------- Test stripping of empty nodes in template content ----------
25130
25131 !! test
25132 Empty LI and TR nodes should be stripped from template content
25133 !! wikitext
25134 {{EmptyLITest}}
25135 {{EmptyTRTest}}
25136 !! html/parsoid
25137 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
25138 <li>a</li>
25139 <li>b</li>
25140 </ul>
25141 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
25142 <tbody>
25143 <tr>
25144 <td>foo</td>
25145 </tr>
25146 <tr>
25147 <td>bar</td>
25148 </tr>
25149 </tbody>
25150 </table>
25151 !! end
25152
25153 !! test
25154 Empty LI and TR nodes should not be stripped from top-level content
25155 !! wikitext
25156 *a
25157 *
25158 *b
25159
25160 {|
25161 |-
25162 |-
25163 |foo
25164 |}
25165 !! html/parsoid
25166 <ul>
25167 <li>a</li>
25168 <li class='mw-empty-elt'></li>
25169 <li>b</li>
25170 </ul>
25171 <table>
25172 <tbody>
25173 <tr class='mw-empty-elt'></tr>
25174 <tr>
25175 <td>foo</td>
25176 </tr>
25177 </tbody>
25178 </table>
25179 !! end
25180
25181 !! test
25182 Empty TR nodes should not be stripped if they have any attributes set
25183 !! wikitext
25184 {{EmptyTRWithHTMLAttrTest}}
25185 !! html/parsoid
25186 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
25187 <tr align='center'></tr>
25188 <tr><td>foo</td></tr>
25189 <tr align='center'></tr>
25190 <tr><td>bar</td></tr>
25191 </table>
25192 !! end
25193
25194 #### ----------------------------------------------------------------
25195 #### The following section of tests are primarily to test
25196 #### wikitext escaping capabilities of Parsoid. Given that
25197 #### escaping can be done any number of ways, the wikitext (input)
25198 #### is always adjusted to reflect how Parsoid adds nowiki
25199 #### escape tags.
25200 ####
25201 #### We are marking several tests as parsoid-only since the
25202 #### HTML in the result section is different from what the
25203 #### PHP parser generates for it.
25204 #### ----------------------------------------------------------------
25205
25206
25207 #### --------------- Headings ---------------
25208 #### 0. Unnested
25209 #### 1. Nested inside html <h1>=foo=</h1>
25210 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
25211 #### 3. Nested inside html with wikitext split by html tags
25212 #### 4. No escape needed
25213 #### 5. Empty headings <h1></h1>
25214 #### 6. Heading chars in SOL context
25215 #### ----------------------------------------
25216 !! test
25217 Headings: 0. Unnested
25218 !! options
25219 parsoid=html2wt
25220 !! html/parsoid
25221 <p>=foo=</p>
25222
25223 <p> =foo=
25224 <!--cmt-->
25225 =foo=</p>
25226
25227 <p>=foo<i>a</i>=</p>
25228 !! wikitext
25229 <nowiki>=foo=</nowiki>
25230
25231 <nowiki> </nowiki>=foo=
25232 <!--cmt-->
25233 <nowiki>=foo=</nowiki>
25234
25235 =foo''a''<nowiki>=</nowiki>
25236 !!end
25237
25238 # New headings and existing headings are handled differently
25239 !! test
25240 Headings: 1. Nested inside html
25241 !! options
25242 parsoid=html2wt
25243 !! html/parsoid
25244 <h1>=foo=</h1>
25245 <h2>=foo=</h2>
25246 <h3>=foo=</h3>
25247
25248 <h1 data-parsoid=''>=foo=</h1>
25249 <h2 data-parsoid=''>=foo=</h2>
25250 <h3 data-parsoid=''>=foo=</h3>
25251 <h4 data-parsoid=''>=foo=</h4>
25252 <h5 data-parsoid=''>=foo=</h5>
25253 <h6 data-parsoid=''>=foo=</h6>
25254 !! wikitext
25255 = =foo= =
25256
25257 == =foo= ==
25258
25259 === =foo= ===
25260
25261 =<nowiki>=foo=</nowiki>=
25262 ==<nowiki>=foo=</nowiki>==
25263 ===<nowiki>=foo=</nowiki>===
25264 ====<nowiki>=foo=</nowiki>====
25265 =====<nowiki>=foo=</nowiki>=====
25266 ======<nowiki>=foo=</nowiki>======
25267
25268 !!end
25269
25270 !! test
25271 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
25272 !! options
25273 parsoid=html2wt
25274 !! html/parsoid
25275 <h1>foo</h1>*bar
25276 <h1>foo</h1>=bar
25277 <h1>foo</h1>=bar=
25278 !! wikitext
25279 = foo =
25280 <nowiki>*</nowiki>bar
25281
25282 = foo =
25283 =bar
25284
25285 = foo =
25286 <nowiki>=bar=</nowiki>
25287 !!end
25288
25289 !! test
25290 Headings: 3. Nested inside html with wikitext split by html tags
25291 !! options
25292 parsoid=html2wt
25293 !! html/parsoid
25294 <h1>=<b>bold</b>foo=</h1>
25295 !! wikitext
25296 = ='''bold'''foo= =
25297 !!end
25298
25299 !! test
25300 Headings: 4a. No escaping needed (testing just h1 and h2)
25301 !! options
25302 parsoid=html2wt
25303 !! html/parsoid
25304 <h1>=foo</h1>
25305 <h1>foo=</h1>
25306 <h1> =foo= </h1>
25307 <h1>=foo= bar</h1>
25308 <h2>=foo</h2>
25309 <h2>foo=</h2>
25310 <h1>=</h1>
25311 <h1><i>=</i>foo=</h1>
25312 !! wikitext
25313 = =foo =
25314
25315 = foo= =
25316
25317 = =foo= =
25318
25319 = =foo= bar =
25320
25321 == =foo ==
25322
25323 == foo= ==
25324
25325 = = =
25326
25327 = ''=''foo= =
25328 !!end
25329
25330 !! test
25331 Headings: 4b. No escaping needed (inside p-tags)
25332 !! options
25333 parsoid=html2wt
25334 !! html/parsoid
25335 <p>=foo= x
25336 =foo= <s></s>
25337 </p>
25338 !! wikitext
25339 =foo= x
25340 =foo= <s></s>
25341 !! html/php
25342 <p>=foo= x
25343 =foo= <s></s>
25344 </p>
25345 !!end
25346
25347 !! test
25348 Headings: 4c. Short headings (1)
25349 !! options
25350 parsoid=html2wt
25351 !! html/parsoid
25352 <p>===
25353 </p>
25354 !! wikitext
25355 <nowiki>===</nowiki>
25356 !! html/php
25357 <p>===
25358 </p>
25359 !! end
25360
25361 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
25362 !! test
25363 Headings: 4d. Short headings (2)
25364 !! options
25365 parsoid=wt2html,html2html
25366 !! wikitext
25367 =
25368 ==
25369 ===
25370 ====
25371 =====
25372 !! html/php
25373 <p>=
25374 ==
25375 </p>
25376 <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>
25377 <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>
25378 <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>
25379
25380 !! html/parsoid
25381 <p>=
25382 ==</p>
25383 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
25384 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
25385 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
25386 !! end
25387
25388 !! test
25389 Headings: 5. Empty headings
25390 !! options
25391 parsoid=html2wt
25392 !! html/parsoid
25393 <h1 data-parsoid='{}'></h1>
25394
25395 <h2 data-parsoid='{}'></h2>
25396
25397 <h3 data-parsoid='{}'></h3>
25398
25399 <h4 data-parsoid='{}'></h4>
25400
25401 <h5 data-parsoid='{}'></h5>
25402
25403 <h6 data-parsoid='{}'></h6>
25404 !! wikitext
25405 =<nowiki/>=
25406
25407 ==<nowiki/>==
25408
25409 ===<nowiki/>===
25410
25411 ====<nowiki/>====
25412
25413 =====<nowiki/>=====
25414
25415 ======<nowiki/>======
25416 !!end
25417
25418 !! test
25419 Headings: 6a. Heading chars in SOL context (with trailing spaces)
25420 !! options
25421 parsoid=html2wt
25422 !! html/parsoid
25423 <p>=a=</p>
25424
25425 <p>=a=</p>
25426
25427 <p>=a=</p>
25428 !! wikitext
25429 <nowiki>=a=</nowiki>
25430
25431 <nowiki>=a=</nowiki>
25432
25433 <nowiki>=a=</nowiki>
25434 !!end
25435
25436 !! test
25437 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25438 !! options
25439 parsoid=html2wt
25440 !! html/parsoid
25441 <p>=a=
25442 b</p>
25443
25444 <p>=a=
25445 b</p>
25446
25447 <p>=a=
25448 b</p>
25449 !! wikitext
25450 <nowiki>=a=</nowiki>
25451 b
25452
25453 <nowiki>=a=</nowiki>
25454 b
25455
25456 <nowiki>=a=</nowiki>
25457 b
25458 !!end
25459
25460 !! test
25461 Headings: 6c. Heading chars in SOL context (leading newline break)
25462 !! options
25463 parsoid=html2wt
25464 !! html/parsoid
25465 <p>a
25466 =b=</p>
25467 !! wikitext
25468 a
25469 <nowiki>=b=</nowiki>
25470 !!end
25471
25472 !! test
25473 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25474 !! options
25475 parsoid=html2wt
25476 !! html/parsoid
25477 <!--c0--><p>=a=</p>
25478
25479 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25480 !! wikitext
25481 <!--c0--><nowiki>=a=</nowiki>
25482
25483 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25484 !!end
25485
25486 !! test
25487 Headings: 6d. Heading chars in SOL context (No escaping needed)
25488 !! options
25489 parsoid=html2wt
25490 !! html/parsoid
25491 =a=<div>b</div>
25492 !! wikitext
25493 =a=<div>b</div>
25494 !!end
25495
25496 !! test
25497 Headings: 7. Insert a newline between new content and headings
25498 !! options
25499 parsoid=html2wt
25500 !! html/parsoid
25501 <h2>NEW</h2>
25502 <p>new</p>
25503 <h2 data-parsoid='{}'>A</h2>
25504 <p data-parsoid='{}'>a</p>
25505 !! wikitext
25506 == NEW ==
25507 new
25508
25509 ==A==
25510 a
25511
25512 !! end
25513
25514 !! test
25515 Headings: Used as horizontal rule
25516 !! config
25517 wgFragmentMode=[ 'html5', 'legacy' ]
25518 !! options
25519 parsoid=wt2html
25520 !! wikitext
25521 ===============
25522 !! html/php
25523 <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>
25524
25525 !! html/parsoid
25526 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25527 !! end
25528
25529 #### --------------- Lists ---------------
25530 #### 0. Outside nests (*foo, etc.)
25531 #### 1. Nested inside html <ul><li>*foo</li></ul>
25532 #### 2. Inside definition lists
25533 #### 3. Only bullets at start should be escaped
25534 #### 4. No escapes needed
25535 #### 5. No unnecessary escapes
25536 #### 6. Escape bullets in SOL position
25537 #### 7. Escape bullets in a multi-line context
25538 #### ----------------------------------------
25539
25540 !! test
25541 Lists: 0. Outside nests
25542 !! options
25543 parsoid=html2wt
25544 !! html/parsoid
25545 <p>*foo</p>
25546
25547 <p>#foo</p>
25548
25549 <p>;Foo:bar</p>
25550 !! wikitext
25551 <nowiki>*</nowiki>foo
25552
25553 <nowiki>#</nowiki>foo
25554
25555 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25556 !!end
25557
25558 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25559 ## to test wikitext escaping, and insignificant whitespace diffs
25560 ## cause PHP parser tests to barf
25561 !! test
25562 Lists: 1. Nested inside html (No unnecessary escapes)
25563 !! options
25564 parsoid=html2wt
25565 !! html/parsoid
25566 <ul>
25567 <li>*foo</li>
25568 <li>#foo</li>
25569 <li>:foo</li>
25570 <li>;foo</li>
25571 <li data-parsoid='{}'>*foo</li>
25572 <li data-parsoid='{}'>#foo</li>
25573 <li data-parsoid='{}'>:foo</li>
25574 <li data-parsoid='{}'>;foo</li>
25575 </ul>
25576
25577 <ol>
25578 <li>*foo</li>
25579 <li>#foo</li>
25580 <li>:foo</li>
25581 <li>;foo</li>
25582 <li data-parsoid='{}'>*foo</li>
25583 <li data-parsoid='{}'>#foo</li>
25584 <li data-parsoid='{}'>:foo</li>
25585 <li data-parsoid='{}'>;foo</li>
25586 </ol>
25587 !! wikitext
25588 * *foo
25589 * #foo
25590 * :foo
25591 * ;foo
25592 *<nowiki>*foo</nowiki>
25593 *<nowiki>#foo</nowiki>
25594 *<nowiki>:foo</nowiki>
25595 *<nowiki>;foo</nowiki>
25596
25597 # *foo
25598 # #foo
25599 # :foo
25600 # ;foo
25601 #<nowiki>*foo</nowiki>
25602 #<nowiki>#foo</nowiki>
25603 #<nowiki>:foo</nowiki>
25604 #<nowiki>;foo</nowiki>
25605 !!end
25606
25607 !! test
25608 Lists: 2. Inside definition lists
25609 !! options
25610 parsoid=html2wt
25611 !! html/parsoid
25612 <dl><dt>;foo</dt></dl>
25613 <dl><dt>:foo</dt></dl>
25614 <dl><dt>:foo</dt>
25615 <dd>bar</dd></dl>
25616 <dl><dd>:foo</dd></dl>
25617 !! wikitext
25618 ; ;foo
25619
25620 ; <nowiki>:foo</nowiki>
25621
25622 ; <nowiki>:foo</nowiki>
25623 : bar
25624
25625 : :foo
25626 !!end
25627
25628 !! test
25629 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25630 !! options
25631 parsoid=html2wt
25632 !! html/parsoid
25633 <ul>
25634 <li>*foo*bar</li>
25635 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25636 </ul>
25637 !! wikitext
25638 * *foo*bar
25639 *<nowiki>*foo</nowiki>''it''*bar
25640 !!end
25641
25642 !! test
25643 Lists: 4. No escapes needed
25644 !! options
25645 parsoid=html2wt
25646 !! html/parsoid
25647 <ul>
25648 <li>foo*bar
25649 </li>
25650 </ul>
25651 <ul>
25652 <li><i>foo</i>*bar
25653 </li>
25654 </ul>
25655 <ul>
25656 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25657 </li>
25658 </ul>
25659 <ul>
25660 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25661 </li>
25662 </ul>
25663 !! wikitext
25664 *foo*bar
25665
25666 *''foo''*bar
25667
25668 *[[Foo]]: bar
25669
25670 *[[Foo]]*bar
25671 !!end
25672
25673 !! test
25674 Lists: 5. No unnecessary escapes
25675 !! options
25676 parsoid=html2wt
25677 !! html/parsoid
25678 <ul><li> bar <span>[[foo]]</span></li></ul>
25679 <ul><li> =bar <span>[[foo]]</span></li></ul>
25680 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25681 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25682 <ul><li> =bar <span>foo]]</span>=</li></ul>
25683 <ul><li> <s></s>: a</li></ul>
25684 <ul><li> <i>* foo</i></li></ul>
25685
25686 !! wikitext
25687 * bar <span><nowiki>[[foo]]</nowiki></span>
25688
25689 * =bar <span><nowiki>[[foo]]</nowiki></span>
25690
25691 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25692
25693 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25694
25695 * =bar <span>foo]]</span>=
25696
25697 * <s></s>: a
25698
25699 * ''* foo''
25700 !!end
25701
25702 !! test
25703 Lists: 6. Escape bullets in SOL position
25704 !! options
25705 parsoid=html2wt
25706 !! html/parsoid
25707 <p><!--cmt-->*foo</p>
25708 !! wikitext
25709 <!--cmt--><nowiki>*</nowiki>foo
25710 !!end
25711
25712 !! test
25713 Lists: 7. Escape bullets in a multi-line context
25714 !! options
25715 parsoid=html2wt
25716 !! html/parsoid
25717 <p>a
25718 *b
25719 </p>
25720 !! wikitext
25721 a
25722 <nowiki>*</nowiki>b
25723 !!end
25724
25725 !! test
25726 Lists: 8. Escape colons only if not present in tags
25727 !! options
25728 parsoid=html2wt
25729 !! html/parsoid
25730 <dl><dt>a:b<i>c:d</i></dt></dl>
25731 !! wikitext
25732 ; <nowiki>a:b</nowiki>''c:d''
25733 !! end
25734
25735 #### --------------- HRs ---------------
25736 #### 1. Single line
25737 #### -----------------------------------
25738
25739 !! test
25740 HRs: 1. Single line
25741 !! options
25742 parsoid=html2wt
25743 !! html/parsoid
25744 <hr />----
25745 <hr />=foo=
25746 <hr />*foo
25747 !! wikitext
25748 ----<nowiki>----</nowiki>
25749 ----=foo=
25750 ----*foo
25751 !! end
25752
25753 #### --------------- Tables ---------------
25754 #### 1a. Simple example
25755 #### 1b. No escaping needed (!foo)
25756 #### 1c. No escaping needed (|foo)
25757 #### 1d. No escaping needed (|}foo)
25758 ####
25759 #### 2a. Nested in td (<td>foo|bar</td>)
25760 #### 2b. Nested in td (<td>foo||bar</td>)
25761 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25762 ####
25763 #### 3a. Nested in th (<th>foo!bar</th>)
25764 #### 3b. Nested in th (<th>foo!!bar</th>)
25765 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25766 ####
25767 #### 4a. Escape -
25768 #### 4b. Escape +
25769 #### 4c. No escaping needed
25770 #### --------------------------------------
25771
25772 !! test
25773 Tables: 1a. Simple example
25774 !! options
25775 parsoid=html2wt
25776 !! html/parsoid
25777 <p>{|
25778 |}
25779 </p>
25780 !! wikitext
25781 <nowiki>{|</nowiki>
25782 |}
25783 !! end
25784
25785 !! test
25786 Tables: 1b. No escaping needed
25787 !! options
25788 parsoid=html2wt
25789 !! html/parsoid
25790 <p>!foo
25791 </p>
25792 !! wikitext
25793 !foo
25794 !! end
25795
25796 !! test
25797 Tables: 1c. No escaping needed
25798 !! options
25799 parsoid=html2wt
25800 !! html/parsoid
25801 <p>|foo
25802 </p>
25803 !! wikitext
25804 |foo
25805 !! end
25806
25807 !! test
25808 Tables: 1d. No escaping needed
25809 !! options
25810 parsoid=html2wt
25811 !! html/parsoid
25812 <p>|}foo
25813 </p>
25814 !! wikitext
25815 |}foo
25816 !! end
25817
25818 !! test
25819 Tables: 2a. Nested in td
25820 !! options
25821 parsoid=html2wt
25822 !! html/parsoid
25823 <table><tbody><tr>
25824 <td>foo|bar</td></tr>
25825 <tr><td>x<div>a|b</div></td>
25826 </tbody></table>
25827 !! wikitext
25828 {|
25829 |<nowiki>foo|bar</nowiki>
25830 |-
25831 |x<div><nowiki>a|b</nowiki></div>
25832 |}
25833 !! html/php+tidy
25834 <table>
25835 <tbody><tr>
25836 <td>foo|bar
25837 </td></tr>
25838 <tr>
25839 <td>x<div>a|b</div>
25840 </td></tr></tbody></table>
25841 !! end
25842
25843 !! test
25844 Tables: 2b. Nested in td
25845 !! options
25846 parsoid=html2wt
25847 !! html/parsoid
25848 <table><tbody><tr>
25849 <td>foo||bar</td>
25850 <td>a<i>b||c</i></td>
25851 <td>a<i><div>b||c</div></i></td>
25852 </tr></tbody></table>
25853 !! wikitext
25854 {|
25855 |<nowiki>foo||bar</nowiki>
25856 |a''<nowiki>b||c</nowiki>''
25857 |a''<div><nowiki>b||c</nowiki></div>''
25858 |}
25859 !! html/php
25860 <table>
25861 <tr>
25862 <td>foo||bar
25863 </td>
25864 <td>a<i>b||c</i>
25865 </td>
25866 <td>a<i><div>b||c</div></i>
25867 </td></tr></table>
25868
25869 !! end
25870
25871 !! test
25872 Tables: 2c. Nested in td -- no escaping needed
25873 !! options
25874 parsoid=html2wt
25875 !! html/*
25876 <table>
25877 <tr>
25878 <td>foo!!bar
25879 </td></tr></table>
25880
25881 !! wikitext
25882 {|
25883 |foo!!bar
25884 |}
25885 !! end
25886
25887 !! test
25888 Tables: 3a. Nested in th
25889 !! options
25890 parsoid=html2wt
25891 !! html/*
25892 <table>
25893 <tr>
25894 <th>foo!bar
25895 </th></tr></table>
25896
25897 !! wikitext
25898 {|
25899 !foo!bar
25900 |}
25901 !! end
25902
25903 !! test
25904 Tables: 3b. Nested in th
25905 !! options
25906 parsoid=html2wt
25907 !! html/parsoid
25908 <table><tbody>
25909 <tr><th>foo!!bar</th>
25910 <th><i>foo|bar</i></th>
25911 <th><i>foo!!bar</i></th>
25912 <th><i><span>foo!!bar</span></i></th>
25913 </tr></tbody></table>
25914 !! wikitext
25915 {|
25916 !<nowiki>foo!!bar</nowiki>
25917 !''<nowiki>foo|bar</nowiki>''
25918 !''<nowiki>foo!!bar</nowiki>''
25919 !''<span><nowiki>foo!!bar</nowiki></span>''
25920 |}
25921 !! html/php
25922 <table>
25923 <tr>
25924 <th>foo!!bar
25925 </th>
25926 <th><i>foo|bar</i>
25927 </th>
25928 <th><i>foo!!bar</i>
25929 </th>
25930 <th><i><span>foo!!bar</span></i>
25931 </th></tr></table>
25932
25933 !! end
25934
25935 !! test
25936 Tables: 3c. Nested in th
25937 !! options
25938 parsoid=html2wt
25939 !! html/parsoid
25940 <table><tbody>
25941 <tr><th>foo||bar</th>
25942 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25943 </tr></tbody></table>
25944 !! wikitext
25945 {|
25946 !<nowiki>foo||bar</nowiki>
25947 !<nowiki>foo||bar</nowiki>
25948 |}
25949 !! html/php
25950 <table>
25951 <tr>
25952 <th>foo||bar
25953 </th>
25954 <th>foo||bar
25955 </th></tr></table>
25956
25957 !! end
25958
25959 !! test
25960 Tables: 4a. Escape -
25961 !! options
25962 parsoid=html2wt
25963 !! html/*
25964 <table>
25965 <tr>
25966 <th>-bar
25967 </th></tr>
25968 <tr>
25969 <td>-bar
25970 </td></tr></table>
25971
25972 !! wikitext
25973 {|
25974 !-bar
25975 |-
25976 |<nowiki>-bar</nowiki>
25977 |}
25978 !! end
25979
25980 !! test
25981 Tables: 4b. Escape +
25982 !! options
25983 parsoid=html2wt
25984 !! html/*
25985 <table>
25986 <tr>
25987 <th>+bar
25988 </th></tr>
25989 <tr>
25990 <td>+bar
25991 </td></tr></table>
25992
25993 !! wikitext
25994 {|
25995 !+bar
25996 |-
25997 |<nowiki>+bar</nowiki>
25998 |}
25999 !! end
26000
26001 !! test
26002 Tables: 4c. No escaping needed
26003 !! options
26004 parsoid=html2wt
26005 !! html/parsoid
26006 <table><tbody>
26007 <tr><td>foo-bar</td><td>foo+bar</td></tr>
26008 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
26009 <tr><td>foo
26010 <p>bar|baz
26011 +bar
26012 -bar</p></td></tr>
26013 <tr><td>x
26014 <div>a|b</div></td>
26015 </tbody></table>
26016 !! wikitext
26017 {|
26018 |foo-bar
26019 |foo+bar
26020 |-
26021 |''foo''-bar
26022 |''foo''+bar
26023 |-
26024 |foo
26025 bar|baz
26026 +bar
26027 -bar
26028 |-
26029 |x
26030 <div>a|b</div>
26031 |}
26032 !! html/php
26033 <table>
26034 <tr>
26035 <td>foo-bar
26036 </td>
26037 <td>foo+bar
26038 </td></tr>
26039 <tr>
26040 <td><i>foo</i>-bar
26041 </td>
26042 <td><i>foo</i>+bar
26043 </td></tr>
26044 <tr>
26045 <td>foo
26046 <p>bar|baz
26047 +bar
26048 -bar
26049 </p>
26050 </td></tr>
26051 <tr>
26052 <td>x
26053 <div>a|b</div>
26054 </td></tr></table>
26055
26056 !! end
26057
26058 !! test
26059 Tables: 4d. No escaping needed
26060 !! options
26061 parsoid=html2wt
26062 !! html/parsoid
26063 <table>
26064 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
26065 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
26066 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
26067 </tbody></table>
26068 !! wikitext
26069 {|
26070 |[[Foo]]-bar
26071 ||+1
26072 ||-2
26073 |}
26074 !! html/php
26075 <table>
26076 <tr>
26077 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
26078 </td>
26079 <td>+1
26080 </td>
26081 <td>-2
26082 </td></tr></table>
26083
26084 !! end
26085
26086 !! test
26087 Tables: 5. Empty table cells should get whitespace to avoid need for nowikis
26088 !! options
26089 parsoid=html2wt
26090 !! html/parsoid
26091 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26092
26093 <table><tr><td></td><td align="center"></td><td></td></tr></table>
26094
26095 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26096
26097 <table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table>
26098 !! wikitext
26099 {|
26100 | || align="center" | ||
26101 |}
26102
26103 {|
26104 |
26105 | align="center" |
26106 |
26107 |}
26108
26109 {|
26110 | {{!}}{{!}} align="center" | ||
26111 |}
26112
26113 {|
26114 ! !! align="center" | !!
26115 |}
26116 !! html/php+tidy
26117 <table>
26118 <tbody><tr>
26119 <td></td>
26120 <td align="center"></td>
26121 <td>
26122 </td></tr></tbody></table>
26123 <table>
26124 <tbody><tr>
26125 <td>
26126 </td>
26127 <td align="center">
26128 </td>
26129 <td>
26130 </td></tr></tbody></table>
26131 <table>
26132 <tbody><tr>
26133 <td></td>
26134 <td align="center"></td>
26135 <td>
26136 </td></tr></tbody></table>
26137 <table>
26138 <tbody><tr>
26139 <th></th>
26140 <th align="center"></th>
26141 <th>
26142 </th></tr></tbody></table>
26143 !! end
26144
26145 !! test
26146 T97430: Don't emit empty nowiki pairs around marker meta tags
26147 !! options
26148 parsoid=html2wt
26149 !! html/parsoid
26150 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26151 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
26152 !! wikitext
26153 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26154 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
26155 !! end
26156
26157 !! test
26158 Unclosed xmlish element in table line shouldn't eat end delimiters
26159 !! options
26160 parsoid=html2wt
26161 !! html/parsoid
26162 <table>
26163 <tbody><tr><td> &lt;foo</td>
26164 <td> bar></td></tr>
26165 </tbody></table>
26166 !! wikitext
26167 {|
26168 | <foo
26169 | bar>
26170 |}
26171 !! html/php
26172 <table>
26173 <tr>
26174 <td>&lt;foo
26175 </td>
26176 <td>bar&gt;
26177 </td></tr></table>
26178
26179 !! end
26180
26181 #### --------------- Links ----------------
26182 #### 1. Quote marks in link text
26183 #### 2. Wikilinks: Escapes needed
26184 #### 3. Wikilinks: No escapes needed
26185 #### 4. Extlinks: Escapes needed
26186 #### 5. Extlinks: No escapes needed
26187 #### --------------------------------------
26188 !! test
26189 Links 1. WikiLinks: No escapes needed
26190 !! options
26191 parsoid=html2wt
26192 !! html/parsoid
26193 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
26194 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
26195 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
26196 !! wikitext
26197 [[Foo|Foo''boo'']]
26198 [[Foo|[Foobar]]]
26199 [[Foo|x [Foobar] x]]
26200 !! html/php
26201 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
26202 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
26203 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
26204 </p>
26205 !! end
26206
26207 !! test
26208 Links 2. WikiLinks: Escapes needed
26209 !! options
26210 parsoid=html2wt
26211 !! html/parsoid
26212 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
26213 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
26214 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
26215 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
26216 <a href="Foo" rel="mw:WikiLink">|Bar</a>
26217 <a href="Foo" rel="mw:WikiLink">]]bar</a>
26218 <a href="Foo" rel="mw:WikiLink">[[bar</a>
26219 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
26220 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
26221 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
26222 !! wikitext
26223 [[Foo|<nowiki>Foobar]</nowiki>]]
26224 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
26225 [[Foo|<nowiki>[[Bar]]</nowiki>]]
26226 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
26227 [[Foo|<nowiki>|Bar</nowiki>]]
26228 [[Foo|<nowiki>]]bar</nowiki>]]
26229 [[Foo|<nowiki>[[bar</nowiki>]]
26230 [[Foo|<nowiki>x [[ y</nowiki>]]
26231 [[Foo|<nowiki>x ]] y</nowiki>]]
26232 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
26233 !! html/php
26234 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
26235 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
26236 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
26237 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
26238 <a href="/wiki/Foo" title="Foo">|Bar</a>
26239 <a href="/wiki/Foo" title="Foo">]]bar</a>
26240 <a href="/wiki/Foo" title="Foo">[[bar</a>
26241 <a href="/wiki/Foo" title="Foo">x [[ y</a>
26242 <a href="/wiki/Foo" title="Foo">x ]] y</a>
26243 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
26244 </p>
26245 !! end
26246
26247 !! test
26248 Links 3. WikiLinks: No escapes needed
26249 !! options
26250 parsoid=html2wt
26251 !! html/parsoid
26252 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
26253 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
26254 !! wikitext
26255 [[Foo|[Foobar]]
26256 [[Foo|foo|bar]]
26257 !! html/php
26258 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
26259 <a href="/wiki/Foo" title="Foo">foo|bar</a>
26260 </p>
26261 !! end
26262
26263 !! test
26264 Links 4. ExtLinks: Escapes needed
26265 !! options
26266 parsoid=html2wt
26267 !! html/parsoid
26268 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
26269 <a rel="mw:ExtLink" href="http://google.com">google]</a>
26270 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
26271 <p>[http://google.com]</p>
26272 <p>[http://google.com google]</p>
26273 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
26274 <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>
26275 !! wikitext
26276 [http://google.com <nowiki>[google]</nowiki>]
26277 [http://google.com <nowiki>google]</nowiki>]
26278 [http://google.com <nowiki>goog] le</nowiki>]
26279
26280 <nowiki>[http://google.com]</nowiki>
26281
26282 <nowiki>[http://google.com google]</nowiki>
26283
26284 [http://google.com<nowiki>]</nowiki>
26285
26286 [{{echo|http://google.com}}<nowiki>]</nowiki>
26287 !! html/php
26288 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
26289 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
26290 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
26291 </p><p>[http://google.com]
26292 </p><p>[http://google.com google]
26293 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26294 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26295 </p>
26296 !! end
26297
26298 !! test
26299 Links 5. ExtLinks: No escapes needed
26300 !! options
26301 parsoid=html2wt
26302 !! html/parsoid
26303 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
26304 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
26305 !! wikitext
26306 [http://google.com [google]
26307
26308 [[http://google.com]]
26309 !! html/php
26310 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
26311 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
26312 </p>
26313 !! end
26314
26315 !! test
26316 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
26317 !! options
26318 parsoid=html2wt
26319 !! html/parsoid
26320 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
26321 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
26322 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
26323 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
26324 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
26325 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
26326 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26327 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
26328 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26329 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
26330 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
26331 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
26332 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
26333 </p>
26334 !! wikitext
26335 x<nowiki/>http://example.com<nowiki/>y
26336 http://example.com<nowiki/>?x
26337 http://example.com<nowiki/>&x
26338 http://example.com<nowiki/>'x
26339 http://example.com<nowiki/>,x
26340 http://example.com<nowiki/>.x
26341 http://example.com<nowiki/>;x
26342 http://example.com<nowiki/>:x
26343 http://example.com<nowiki/>;x
26344 http://example.com<nowiki/>!x
26345 http://example.com<nowiki/>=x
26346 http://example.com<nowiki/>(x)
26347 http://example.com(x<nowiki/>)
26348 !! end
26349
26350 !! test
26351 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26352 !! options
26353 parsoid=html2wt
26354 !! html/parsoid
26355 <p>x
26356 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
26357 y
26358 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
26359 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
26360 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
26361 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
26362 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
26363 </p>
26364 !! wikitext
26365 x
26366 http://example.com
26367 y
26368 "http://example.com"
26369 (http://example.com)
26370 (http://example.com) foo
26371 http://example.com,
26372 http://example.com, foo
26373 !! html/php
26374 <p>x
26375 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
26376 y
26377 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
26378 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
26379 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
26380 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
26381 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
26382 </p>
26383 !! end
26384
26385 !! test
26386 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26387 !! options
26388 parsoid=html2wt
26389 !! html/parsoid
26390 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
26391 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
26392 !! wikitext
26393 http://example.com.,;:!?\
26394 -http://example.com:
26395 !! html/php
26396 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
26397 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
26398 </p>
26399 !! end
26400
26401 !! test
26402 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
26403 !! options
26404 parsoid=html2wt
26405 !! html/parsoid
26406 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
26407 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
26408 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
26409 !! wikitext
26410 RFC 123<nowiki/>4
26411 RFC 123<nowiki/>y
26412 X<nowiki/>RFC 123<nowiki/>y
26413 !! end
26414
26415 !! test
26416 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
26417 !! options
26418 parsoid=html2wt
26419 !! html/parsoid
26420 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
26421 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
26422 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
26423 </p>
26424 !! wikitext
26425 RFC 123?foo
26426 RFC 123&foo
26427 -RFC 123-
26428 !! html/php
26429 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
26430 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
26431 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
26432 </p>
26433 !! end
26434
26435 !! test
26436 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
26437 !! options
26438 parsoid=html2wt
26439 !! html/parsoid
26440 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
26441 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26442 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26443 !! wikitext
26444 PMID 123<nowiki/>4
26445 PMID 123<nowiki/>y
26446 X<nowiki/>PMID 123<nowiki/>y
26447 !! end
26448
26449 !! test
26450 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
26451 !! options
26452 parsoid=html2wt
26453 !! html/parsoid
26454 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
26455 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
26456 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
26457 </p>
26458 !! wikitext
26459 PMID 123?foo
26460 PMID 123&foo
26461 -PMID 123-
26462 !! html/php
26463 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
26464 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
26465 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
26466 </p>
26467 !! end
26468
26469 !! test
26470 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
26471 !! options
26472 parsoid=html2wt
26473 !! html/parsoid
26474 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
26475 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
26476 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
26477 </p>
26478 !! wikitext
26479 ISBN 1234567890<nowiki/>1
26480 ISBN 1234567890<nowiki/>x
26481 a<nowiki/>ISBN 1234567890<nowiki/>b
26482 !! end
26483
26484 !! test
26485 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
26486 !! options
26487 parsoid=html2wt
26488 !! html/parsoid
26489 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26490 !! wikitext
26491 -ISBN 1234567890's
26492 !! html/php
26493 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26494 </p>
26495 !! end
26496
26497 !! test
26498 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26499 !! options
26500 parsoid=html2wt
26501 !! html/*
26502 <p>this is not a link: http://example.com
26503 </p>
26504 !! wikitext
26505 this is not a link: <nowiki>http://example.com</nowiki>
26506 !! end
26507
26508 !! test
26509 Links 15. Link trails can't become link prefixes.
26510 !! options
26511 language=is
26512 parsoid=html2wt
26513 !! html/parsoid
26514 <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>
26515 !! wikitext
26516 [[Söfnuður]]-[[00]]
26517 !! html/php
26518 <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>
26519 </p>
26520 !! end
26521
26522 #### --------------- Quotes ---------------
26523 #### 1. Quotes inside <b> and <i>
26524 #### 2. Link fragments separated by <i> and <b> tags
26525 #### 3. Link fragments inside <i> and <b>
26526 #### 4. No escaping needed
26527 #### --------------------------------------
26528 !! test
26529 1a. Quotes inside <b> and <i>
26530 !! options
26531 parsoid=html2wt
26532 !! html/*
26533 <p><i>'foo'</i>
26534 <i>''foo''</i>
26535 <i>'''foo'''</i>
26536 <i>foo</i>'s
26537 <b>'foo'</b>
26538 <b>''foo''</b>
26539 <b>'''foo'''</b>
26540 <b>foo'<i>bar'</i>baz</b>
26541 <b>foo</b>'s
26542 '<i>foo</i>
26543 <i>foo</i>'
26544 <i>foo'</i>'
26545 '<i>foo</i>'
26546 '<b>foo</b>
26547 <b>foo</b>'
26548 '<b>foo</b>'
26549 <i>fools'<span> errand</span></i>
26550 <i><span>fool</span>'s errand</i>
26551 '<i>foo</i> bar '<i>baz</i>
26552 a|!*#-:;+-~[]{}b'<i>x</i>
26553 </p>
26554 !! wikitext
26555 ''<nowiki/>'foo'''
26556 ''<nowiki>''foo''</nowiki>''
26557 ''<nowiki>'''foo'''</nowiki>''
26558 ''foo''<nowiki/>'s
26559 '''<nowiki/>'foo''''
26560 '''<nowiki>''foo''</nowiki>'''
26561 '''<nowiki>'''foo'''</nowiki>'''
26562 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26563 '''foo'''<nowiki/>'s
26564 '''foo''
26565 ''foo''<nowiki/>'
26566 ''foo'''<nowiki/>'
26567 '''foo''<nowiki/>'
26568 ''''foo'''
26569 '''foo'''<nowiki/>'
26570 ''''foo'''<nowiki/>'
26571 ''fools'<span> errand</span>''
26572 ''<span>fool</span>'s errand''
26573 '<nowiki/>''foo'' bar '''baz''
26574 a|!*#-:;+-~[]{}b'''x''
26575 !! end
26576
26577 !! test
26578 1b. Quotes inside <b> and <i> with other tags on same line
26579 !! options
26580 parsoid=html2wt
26581 !! html/parsoid
26582 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26583 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26584 <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>
26585 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26586 '<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>
26587 '<i>foo</i> <div title="name">test</div>
26588 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26589 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26590 <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>
26591 </ol>
26592 !! wikitext
26593 '''a'' foo ''[[bar]]''
26594 ''a''' foo ''[[bar]]''
26595 ''a''' foo '''{{echo|[[bar]]}}'''
26596 [[foo]] x'''[[bar]]''
26597 '''foo'' <ref>test</ref>
26598 '''foo'' <div title="name">test</div>
26599 '''foo'' and <br> bar
26600 <references />
26601 !! end
26602
26603 !! test
26604 2. Link fragments separated by <i> and <b> tags
26605 !! options
26606 parsoid=html2wt
26607 !! html/parsoid
26608 <p>[[<i>foo</i>hello]]</p>
26609 <p>[[<b>foo</b>hello]]</p>
26610 !! wikitext
26611 [[''foo''<nowiki>hello]]</nowiki>
26612
26613 [['''foo'''<nowiki>hello]]</nowiki>
26614 !! end
26615
26616 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26617 # this is one of the shortcomings of this format
26618 !! test
26619 3. Link fragments inside <i> and <b>
26620 !! options
26621 parsoid=html2wt
26622 !! html/parsoid
26623 <p><i>[[foo</i>]]</p>
26624 <p><b>[[foo</b>]]</p>
26625 !! wikitext
26626 ''[[foo''<nowiki>]]</nowiki>
26627
26628 '''[[foo'''<nowiki>]]</nowiki>
26629 !! end
26630
26631 !! test
26632 4. No escaping needed
26633 !! options
26634 parsoid=html2wt
26635 !! html/parsoid
26636 <p>'<span><i>bar</i></span>'
26637 '<span><b>bar</b></span>'
26638 'a:b'foo
26639 </p>
26640 !! wikitext
26641 '<span>''bar''</span>'
26642 '<span>'''bar'''</span>'
26643 'a:b'foo
26644 !! end
26645
26646 #### ----------- Paragraphs ---------------
26647 #### 1. No unnecessary escapes
26648 #### --------------------------------------
26649
26650 !! test
26651 1. No unnecessary escapes
26652 !! options
26653 parsoid=html2wt
26654 !! html/parsoid
26655 <p>bar <span>[[foo]]</span>
26656 </p><p>=bar <span>[[foo]]</span>
26657 </p><p>[[bar <span>[[foo]]</span>
26658 </p><p>]]bar <span>[[foo]]</span>
26659 </p><p>=bar <span>foo]]</span>=
26660 </p>
26661 !! wikitext
26662 bar <span><nowiki>[[foo]]</nowiki></span>
26663
26664 =bar <span><nowiki>[[foo]]</nowiki></span>
26665
26666 [[bar <span><nowiki>[[foo]]</nowiki></span>
26667
26668 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26669
26670 =bar <span>foo]]</span><nowiki>=</nowiki>
26671 !!end
26672
26673 #### ----------------------- PRE --------------------------
26674 !! test
26675 1. Leading whitespace in SOL context should be escaped
26676 !! options
26677 parsoid=html2wt
26678 !! html/parsoid
26679 <p> a</p>
26680
26681 <p> a</p>
26682
26683 <p> a(tab)</p>
26684
26685 <p> a
26686 <!--cmt-->
26687 a</p>
26688
26689 <p>a
26690 b</p>
26691
26692 <p>a
26693 b</p>
26694
26695 <p>a
26696 b</p>
26697 !! wikitext
26698 <nowiki> </nowiki>a
26699
26700 <nowiki> </nowiki> a
26701
26702 a(tab)
26703
26704 <nowiki> </nowiki> a
26705 <!--cmt-->
26706 <nowiki> </nowiki>a
26707
26708 a
26709 <nowiki> </nowiki>b
26710
26711 a
26712 b
26713
26714 a
26715 b
26716 !! html/php
26717 <p> a
26718 </p><p> a
26719 </p><p> a(tab)
26720 </p><p> a
26721 a
26722 </p><p>a
26723 b
26724 </p><p>a
26725 b
26726 </p><p>a
26727 b
26728 </p>
26729 !! end
26730
26731 !! test
26732 2. Leading whitespace in non-indent-pre contexts should not be escaped
26733 !! options
26734 parsoid=html2wt
26735 !! html/parsoid
26736 <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>
26737 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26738 <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>
26739 b</span></li>
26740 </ol>
26741 !! wikitext
26742 foo <ref>''a''
26743 b</ref>
26744 <references />
26745 !! end
26746
26747 !! test
26748 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26749 !! options
26750 parsoid=html2wt
26751 !! html/parsoid
26752 <blockquote>
26753 <p>
26754 a
26755 <span>b</span>
26756 c</p>
26757 </blockquote>
26758 !! wikitext
26759 <blockquote>
26760 a
26761 <span>b</span>
26762 c
26763 </blockquote>
26764 !! end
26765
26766 !! test
26767 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26768 !! options
26769 parsoid=html2wt
26770 !! html/parsoid
26771 <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>
26772 !! wikitext
26773 [[File:Foobar.jpg|thumb|caption]]
26774 !! end
26775
26776 !! test
26777 5. Nowiki escaping should account for indent-pres
26778 !! options
26779 parsoid=html2wt
26780 !! html/parsoid
26781 <pre>==foo==</pre>
26782 !! wikitext
26783 ==foo==
26784 !! end
26785
26786 !! test
26787 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26788 !! options
26789 parsoid=html2wt
26790 !! html/parsoid
26791 <pre>
26792 * foo
26793 * bar
26794 </pre>
26795 !! wikitext
26796 * foo
26797 * bar
26798 !! end
26799
26800 !! test
26801 Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup
26802 !! options
26803 parsoid = {
26804 "modes": ["html2wt"],
26805 "scrubWikitext": true
26806 }
26807 !! html/parsoid
26808 <p> foo</p>
26809 <p> %foo</p>
26810 <p> *foo</p>
26811 <p> #foo</p>
26812 <p> =foo=</p>
26813 <p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p>
26814 <p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p>
26815 <p> <!--boo-->*foo</p>
26816 <p><!--boo--> *foo</p>
26817 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p>
26818 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p>
26819 !! wikitext
26820 foo
26821
26822 %foo
26823
26824 <nowiki/>*foo
26825
26826 <nowiki/>#foo
26827
26828 <nowiki/>=foo=
26829
26830 [[Category:Foo]]
26831 <nowiki/>*foo
26832
26833 [[Category:Foo]]
26834 <nowiki>*</nowiki>foo
26835
26836 <nowiki/><!--boo-->*foo
26837
26838 <!--boo--><nowiki/>*foo
26839
26840 <!--a--><!--b--><!--c--><!--d--><!--e-->foo
26841
26842 <!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo
26843 !! end
26844
26845 #### --------------- Behavior Switches --------------------
26846
26847 !! test
26848 1. Valid behavior switches should be escaped
26849 !! options
26850 parsoid=html2wt
26851 !! html/parsoid
26852 __TOC__
26853 <i>__TOC__</i>
26854 !! wikitext
26855 <nowiki>__TOC__</nowiki>
26856 ''<nowiki>__TOC__</nowiki>''
26857 !! end
26858
26859 !! test
26860 2. Invalid behavior switches should not be escaped
26861 !! options
26862 parsoid=html2wt
26863 !! html/parsoid
26864 __TOO__
26865 __|__
26866 !! wikitext
26867 __TOO__
26868 __|__
26869 !! end
26870
26871 # We use indent-pre as an indirect way to test for sol-transparent behavior.
26872 !! test
26873 Behavior switches should be SOL-transparent
26874 !! options
26875 parsoid=html2wt
26876 !! html/parsoid
26877 <meta property="mw:PageProp/toc" />
26878
26879 <!-- this one's bogus -->
26880 <pre>__TOO__</pre>
26881
26882 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26883
26884 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26885 !! wikitext
26886 __TOC__
26887
26888 <!-- this one's bogus -->
26889 __TOO__
26890
26891 __TOC__ foo
26892
26893 __TOC__
26894 bar
26895 !! end
26896
26897 #### --------------- HTML tags ---------------
26898 #### 1. a tags
26899 #### 2. other tags
26900 #### 3. multi-line html tag
26901 #### 4. extension tags
26902 #### -----------------------------------------
26903 !! test
26904 1. a tags
26905 !! options
26906 parsoid=html2wt
26907 !! html/parsoid
26908 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26909 !! wikitext
26910 <a href="http://google.com">google</a>
26911 !! end
26912
26913 !! test
26914 2. other tags
26915 !! options
26916 parsoid=html2wt
26917 !! html/parsoid
26918 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26919 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26920 <li> &lt;td&gt;</li></ul>
26921
26922 !! wikitext
26923 * <nowiki><div>foo</div></nowiki>
26924 * <nowiki><div style="color:red">foo</div></nowiki>
26925 * <nowiki><td></nowiki>
26926 !! end
26927
26928 !! test
26929 3. multi-line html tag
26930 !! options
26931 parsoid=html2wt
26932 !! html/parsoid
26933 <p>&lt;div
26934 &gt;foo&lt;/div
26935 &gt;
26936 </p>
26937 !! wikitext
26938 <nowiki><div
26939 >foo</div
26940 ></nowiki>
26941 !! end
26942
26943 !! test
26944 4. extension tags
26945 !! options
26946 parsoid=html2wt
26947 !! html/parsoid
26948 <p>&lt;ref&gt;foo&lt;/ref&gt;
26949 </p><p>&lt;ref&gt;bar
26950 </p><p>baz&lt;/ref&gt;
26951 </p>
26952 !! wikitext
26953 <nowiki><ref>foo</ref></nowiki>
26954
26955 <nowiki><ref>bar</nowiki>
26956
26957 baz<nowiki></ref></nowiki>
26958 !! end
26959
26960 !! test
26961 Parsoid: newline inducing block nodes don't suppress <nowiki>
26962 !! options
26963 parsoid=html2wt
26964 !! html/parsoid
26965 a<h1>foo</h1>
26966 !! wikitext
26967 <nowiki> </nowiki>a
26968
26969 = foo =
26970 !! end
26971
26972 #### --------------- Others ---------------
26973 !! test
26974 Escaping nowikis
26975 !! options
26976 parsoid=html2wt
26977 !! html/parsoid
26978 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26979 </p>
26980 !! wikitext
26981 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26982 !! end
26983
26984 ## The quote-char in the input is necessary for triggering the bug
26985 !! test
26986 (T54035) Nowiki-escaping should not get tripped by " :" in text
26987 !! options
26988 parsoid=html2wt
26989 !! html/parsoid
26990 <p>foo's bar :</p>
26991 !! wikitext
26992 foo's bar :
26993 !! end
26994
26995 #----------- End of wikitext escaping tests --------------
26996
26997 !! test
26998
26999 Tag-like HTML structures are passed through as text
27000 !! wikitext
27001 <x y>
27002
27003 <x.y>
27004
27005 <x-y>
27006
27007 1>2
27008
27009 x<y
27010
27011 a>b
27012
27013 1<d e>f
27014 !! html
27015 <p>&lt;x y&gt;
27016 </p><p>&lt;x.y&gt;
27017 </p><p>&lt;x-y&gt;
27018 </p><p>1&gt;2
27019 </p><p>x&lt;y
27020 </p><p>a&gt;b
27021 </p><p>1&lt;d e&gt;f
27022 </p>
27023 !! end
27024
27025 !! test
27026 HTML tag with necessary entities in attributes
27027 !! wikitext
27028 <span title="&amp;amp;">foo</span>
27029 !! html
27030 <p><span title="&amp;amp;">foo</span>
27031 </p>
27032 !! end
27033
27034 !! test
27035 HTML tag with 'unnecessary' entity encoding in attributes
27036 !! wikitext
27037 <span title="&amp;">foo</span>
27038 !! html
27039 <p><span title="&amp;">foo</span>
27040 </p>
27041 !! end
27042
27043 !! test
27044 HTML tag with broken attribute value quoting
27045 !! options
27046 parsoid=wt2html,html2html
27047 !! wikitext
27048 <span title="Hello world>Foo</span>
27049 !! html/php
27050 <p><span title="Hello world">Foo</span>
27051 </p>
27052 !! html/parsoid
27053 <p><span title="Hello world">Foo</span></p>
27054 !! end
27055
27056 !! test
27057 Self-closed tag with broken attribute value quoting
27058 !! options
27059 parsoid=wt2html,html2html
27060 !! wikitext
27061 <div title="Hello world />Foo
27062 !! html/php+tidy
27063 <div title="Hello world"></div><p>Foo
27064 </p>
27065 !! html/parsoid
27066 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
27067 !! end
27068
27069 !! test
27070 Table with broken attribute value quoting
27071 !! options
27072 parsoid=wt2html,html2html
27073 !! wikitext
27074 {|
27075 | title="Hello world|Foo
27076 |}
27077 !! html/php
27078 <table>
27079 <tr>
27080 <td title="Hello world">Foo
27081 </td></tr></table>
27082
27083 !! html/parsoid
27084 <table>
27085 <tr>
27086 <td title="Hello world">Foo
27087 </td></tr></table>
27088
27089 !! end
27090
27091 !! test
27092 Table with broken attribute value quoting on consecutive lines
27093 !! options
27094 parsoid=wt2html,html2html
27095 !! wikitext
27096 {|
27097 | title="Hello world|Foo
27098 | style="color:red|Bar
27099 |}
27100 !! html/php
27101 <table>
27102 <tr>
27103 <td title="Hello world">Foo
27104 </td>
27105 <td style="color:red">Bar
27106 </td></tr></table>
27107
27108 !! html/parsoid
27109 <table><tbody>
27110 <tr>
27111 <td title="Hello world">Foo
27112 </td><td style="color: red">Bar
27113 </td></tr></tbody></table>
27114
27115 !! end
27116
27117 !!test
27118 Accept empty td cell attribute
27119 !! wikitext
27120 {|
27121 | align="center" |foo|| |
27122 |}
27123 !! html
27124 <table>
27125 <tr>
27126 <td align="center">foo</td>
27127 <td>
27128 </td></tr></table>
27129
27130 !!end
27131
27132 !!test
27133 Non-empty attributes in th-cells
27134 !! wikitext
27135 {|
27136 !Foo!! style="color: red" |Bar
27137 |}
27138 !! html
27139 <table>
27140 <tr>
27141 <th>Foo</th>
27142 <th style="color: red">Bar
27143 </th></tr></table>
27144
27145 !!end
27146
27147 !!test
27148 Accept empty attributes in th-cells
27149 !! wikitext
27150 {|
27151 !|foo!!|bar
27152 |}
27153 !! html
27154 <table>
27155 <tr>
27156 <th>foo</th>
27157 <th>bar
27158 </th></tr></table>
27159
27160 !!end
27161
27162 !!test
27163 Empty table rows go away
27164 !! wikitext
27165 {|
27166 |Hello
27167 |there
27168 |- class="foo"
27169 |-
27170 |}
27171 !! html
27172 <table>
27173 <tr>
27174 <td>Hello
27175 </td>
27176 <td>there
27177 </td></tr>
27178
27179 </table>
27180
27181 !! end
27182
27183 ###
27184 ### Parsoid-centric tests for testing RTing of inter-element separators
27185 ### Edge cases not tested by existing parser tests and specific to
27186 ### Parsoid-specific serialization strategies.
27187 ###
27188
27189 !!test
27190 RT-ed inter-element separators should be valid separators
27191 !! wikitext
27192 {|
27193 |- [[foo]]
27194 |}
27195 !! html/php
27196 <table>
27197
27198 </table>
27199
27200 !! html/parsoid
27201 <table>
27202 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
27203 </tbody></table>
27204 !!end
27205
27206 # Parsoid-only test of a DOM pass
27207 !!test
27208 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
27209 !! wikitext
27210 {|
27211 |<small>foo
27212 bar
27213 |}
27214
27215 {|
27216 |<small>foo<small>
27217 |}
27218 !! html/parsoid
27219 <table>
27220 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
27221 <p>bar</p></small></td></tr>
27222 </tbody></table>
27223
27224 <table>
27225 <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>
27226 </tbody></table>
27227 !!end
27228
27229 # Note that the "style" attribute is really a template parameter here.
27230 # The = would have to be {{=}} if you wanted the literal.
27231 !!test
27232 Empty TD followed by TD with tpl-generated attribute
27233 !! wikitext
27234 {|
27235 |-
27236 |
27237 |{{echo|style='color:red'}}|foo
27238 |}
27239 !! html
27240 <table>
27241
27242 <tr>
27243 <td>
27244 </td>
27245 <td>foo
27246 </td></tr></table>
27247
27248 !!end
27249
27250 !!test
27251 Indented table with an empty td
27252 !! wikitext
27253 {|
27254 |-
27255 |
27256 |foo
27257 |}
27258 !! html
27259 <table>
27260
27261 <tr>
27262 <td>
27263 </td>
27264 <td>foo
27265 </td></tr></table>
27266
27267 !!end
27268
27269 ## We have some newline diffs RT-ing this edge case
27270 ## and it is not important enough -- we seem to be emitting
27271 ## at most 2 newlines after a </tr> and this is unrelated to
27272 ## the issue from T85627 that this is testing.
27273 !!test
27274 Indented table with blank lines in between (T85627)
27275 !! options
27276 parsoid=wt2html
27277 !! wikitext
27278 {|
27279 |foo
27280
27281
27282 |}
27283 !! html
27284 <table>
27285
27286 <tr>
27287 <td>foo
27288 </td></tr></table>
27289
27290 !!end
27291
27292 !!test
27293 Indented block & table
27294 !! wikitext
27295 <div>foo</div>
27296 {|
27297 |foo
27298 |}
27299 !! html/php
27300 <div>foo</div>
27301 <table>
27302 <tr>
27303 <td>foo
27304 </td></tr></table>
27305
27306 !! html/parsoid
27307 <div data-parsoid='{"stx":"html"}'>foo</div>
27308 <table><tbody>
27309 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
27310 </tbody></table>
27311 !!end
27312
27313 !! test
27314 Indent and comment before table row
27315 !! wikitext
27316 {|
27317 <!--hi-->|-
27318 |there
27319 |}
27320 !! html/php
27321 <table>
27322
27323 <tr>
27324 <td>there
27325 </td></tr></table>
27326
27327 !! html/parsoid
27328 <table>
27329 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
27330 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
27331 </tbody></table>
27332 !! end
27333
27334 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
27335 !!test
27336 Empty TR followed by a template-generated TR
27337 !!options
27338 parsoid
27339 !! wikitext
27340 {|
27341 |-
27342 {{echo|<tr><td>foo</td></tr>}}
27343 |}
27344 !! html
27345 <table>
27346 <tbody>
27347 <tr class='mw-empty-elt'></tr>
27348 <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}}]}'>
27349 <td>foo</td></tr>
27350 </tbody></table>
27351 !!end
27352
27353 ## PHP and parsoid output differ for this, and since this is primarily
27354 ## for testing Parsoid's serializer, marking this Parsoid only
27355 !!test
27356 Empty TR followed by mixed-ws-comment line should RT correctly
27357 !!options
27358 parsoid
27359 !! wikitext
27360 {|
27361 |-
27362 <!--c-->
27363 |-
27364 <!--c--> <!--d-->
27365 |}
27366 !! html
27367 <table>
27368 <tbody>
27369 <tr class='mw-empty-elt'></tr>
27370 <!--c-->
27371 <tr>
27372 <!--c--> </tr><!--d-->
27373 </tbody></table>
27374
27375 !!end
27376
27377 !!test
27378 Multi-line image caption generated by templates with/without trailing newlines
27379 !! wikitext
27380 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
27381 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
27382 !! html/parsoid
27383 <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>
27384 <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>
27385 !!end
27386
27387 !! test
27388 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
27389 !! options
27390 parsoid=html2wt
27391 !! html/parsoid
27392 <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>
27393
27394 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
27395 !! wikitext
27396 <includeonly>foo</includeonly>
27397 new para
27398
27399 [[Category:Foo]]
27400
27401 = new heading =
27402 !! end
27403
27404 ## PHP emits broken html for this, and since this is primarily
27405 ## a Parsoid serializer test, marking this Parsoid only
27406 !!test
27407 Improperly nested inline or quotes tags with whitespace in between
27408 !! wikitext
27409 <span> <s>x</span> </s>
27410 ''' ''x''' ''
27411 !! html/parsoid
27412 <p><span> <s>x</s></span><s> </s>
27413 <b> <i>x</i></b><i> </i>
27414 </p>
27415 !!end
27416
27417 !!test
27418 Encapsulate protected attributes from wt
27419 !! wikitext
27420 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
27421
27422 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
27423 |ok
27424 |}
27425 !! html/parsoid
27426 <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>
27427
27428 <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">
27429 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'>ok</td></tr>
27430 </tbody></table>
27431 !!end
27432
27433 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
27434 ## Having nested or stray pre tags results in the attempt to add duplicates,
27435 ## causing an assertion fail. This test tries to prevent that situation.
27436 !!test
27437 Ensure ParagraphWrapper can deal with stray closing pre tags
27438 !!options
27439 parsoid=wt2html
27440 !! wikitext
27441 plain text</pre>
27442 !! html/parsoid
27443 plain text
27444 !!end
27445
27446 !! test
27447 1. Ensure fostered text content is wrapped in element nodes
27448 !! options
27449 parsoid=wt2html
27450 !! wikitext
27451 <table>hi</table><table>ho</table>
27452 !! html/php+tidy
27453 hi<table></table>ho<table></table>
27454 !! html/parsoid
27455 <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>
27456 !! end
27457
27458 !! test
27459 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
27460 !! options
27461 parsoid=wt2html,wt2wt
27462 !! wikitext
27463 <table>
27464 <tr> || ||
27465 <td> a
27466 </table>
27467 !! html/php+tidy
27468 || ||
27469 <table>
27470 <tbody><tr><td> a
27471 </td></tr></tbody></table>
27472 !! html/parsoid
27473 <span data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||
27474 </span><table data-parsoid='{"stx":"html"}'>
27475 <tbody><tr data-parsoid='{"stx":"html","autoInsertedEnd":true}'><td data-parsoid='{"stx":"html","autoInsertedEnd":true}'> a
27476 </td></tr></tbody></table>
27477 !! end
27478
27479 !! test
27480 Encapsulation properly handles null DSR information from foster box
27481 !! options
27482 parsoid=wt2html,wt2wt
27483 !! wikitext
27484 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
27485 !! html/parsoid
27486 <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>
27487 !! end
27488
27489 !! test
27490 1. Encapsulate foster-parented transclusion content
27491 !! options
27492 parsoid=wt2wt,wt2html
27493 !! wikitext
27494 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
27495 !! html/php+tidy
27496 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
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>",{"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>
27499 !! end
27500
27501 !! test
27502 2. Encapsulate foster-parented transclusion content
27503 !! options
27504 parsoid=wt2wt,wt2html
27505 !! wikitext
27506 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
27507 !! html/parsoid
27508 <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>
27509 <table>
27510 <tbody>
27511 <tr>
27512 <td>bar</td>
27513 </tr>
27514 </tbody>
27515 </table>
27516 !! end
27517
27518 !! test
27519 3. Encapsulate foster-parented transclusion content
27520 !! options
27521 parsoid=wt2wt,wt2html
27522 !! wikitext
27523 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27524 !! html/parsoid
27525 <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;]}">
27526 <p>foo</p>
27527 </div>
27528 <table>
27529 <tbody>
27530 <tr>
27531 <td>bar</td>
27532 </tr>
27533 </tbody>
27534 </table>
27535 !! end
27536
27537 !! test
27538 4. Encapsulate foster-parented transclusion content
27539 !! options
27540 parsoid=wt2wt,wt2html
27541 !! wikitext
27542 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27543 !! html/parsoid
27544 <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;]}">
27545 <p>foo</p>
27546 </div>
27547 <table>
27548 <tbody>
27549 <tr>
27550 <td>bar</td>
27551 </tr>
27552 </tbody>
27553 </table>
27554 !! end
27555
27556 !! test
27557 5. Encapsulate foster-parented transclusion content
27558 !!options
27559 parsoid=wt2wt,wt2html
27560 !! wikitext
27561 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27562 !! html/php+tidy
27563 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
27564 !! html/parsoid
27565 <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>
27566 !! end
27567
27568 !! test
27569 6. Encapsulate foster-parented transclusion content
27570 !! options
27571 parsoid=wt2wt,wt2html
27572 !! wikitext
27573 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27574 !! html/php+tidy
27575 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
27576 !! html/parsoid
27577 <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>
27578 !! end
27579
27580 !! test
27581 7. Encapsulate foster-parented transclusion content
27582 !!options
27583 parsoid=wt2wt,wt2html
27584 !! wikitext
27585 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27586 !! html/parsoid
27587 <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>
27588 <table>
27589 <tbody>
27590 <tr>
27591 <td>bar</td>
27592 </tr>
27593 </tbody>
27594 </table>
27595 !! end
27596
27597 # Note that the wt is broken on purpose: the = should be {{=}} if you
27598 # don't want it to be a template parameter key.
27599 !! test
27600 8. Encapsulate foster-parented transclusion content
27601 !! options
27602 parsoid=wt2wt,wt2html
27603 !! wikitext
27604 {{echo|a
27605 }}{|{{echo|style='color:red'}}
27606 |-
27607 |b
27608 |}
27609 !! html/php+tidy
27610 <p>a
27611 </p>
27612 <table>
27613
27614 <tbody><tr>
27615 <td>b
27616 </td></tr></tbody></table>
27617 !! html/parsoid
27618 <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">
27619 </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">
27620 <tbody><tr>
27621 <td>b
27622 </td></tr></tbody></table>
27623 !! end
27624
27625 !! test
27626 9. Encapsulate foster-parented transclusion content
27627 !!options
27628 parsoid=wt2wt,wt2html
27629 !! wikitext
27630 <table>{{echo|hi</table>hello}}
27631 !! html/php+tidy
27632 hi<table></table><p>hello
27633 </p>
27634 !! html/parsoid
27635 <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>
27636 !! end
27637
27638 !! test
27639 Table in fosterable position
27640 !!options
27641 parsoid=wt2html
27642 !! wikitext
27643 {{OpenTable}}
27644 <div>
27645 {|
27646 |}
27647 </div>
27648 |}
27649 !! html/parsoid
27650 <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">
27651 </span>
27652 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27653
27654 <table>
27655 </table>
27656 !! end
27657
27658 # Parsoid only for T66747
27659 !! test
27660 Properly encapsulate empty-content transclusions in fosterable positions
27661 !! wikitext
27662 <table>
27663 {{#if:|
27664 <td>foo</td>
27665 }}
27666 </table>
27667 !! html/parsoid
27668 <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"}]]}'>
27669
27670 </table>
27671 !! end
27672
27673 !! test
27674 Always encapsulate foster box when template range is expanded to table
27675 !! options
27676 parsoid=wt2wt
27677 !! wikitext
27678 {|
27679 hello
27680 {{OpenTable}}
27681 |}
27682 !! html/parsoid
27683
27684 !! end
27685
27686 !! test
27687 T115289: Unclosed table
27688 !! wikitext
27689 {{echo|<table>}}<!--c-->[[Category:Two]]
27690 !! html/parsoid
27691 <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>
27692 !! end
27693
27694 !! test
27695 T115289: Don't migrate newlines out of tables with fostered content
27696 !! wikitext
27697 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27698 !! html/parsoid
27699 <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>
27700 !! end
27701
27702 !! test
27703 T73074: More fostering fun
27704 !! wikitext
27705 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27706 !! html/parsoid
27707 <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>
27708 !! end
27709
27710 !!test
27711 Support <object> element with .data attribute
27712 !!options
27713 parsoid=html2wt
27714 !! html/parsoid
27715 <object data="test.swf"></object>
27716 !! wikitext
27717 <object data="test.swf"></object>
27718 !!end
27719
27720 !! test
27721 Don't block XML namespace declaration
27722 !! wikitext
27723 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27724 !! html/php
27725 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27726 </p>
27727 !! html/parsoid
27728 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27729 !! end
27730
27731 # -----------------------------------------------------------------
27732 # The following section of tests are primarily to spec requirements
27733 # around Parsoid's serialization (old, new, edited content)
27734 #
27735 # All these tests are marked Parsoid html2wt and html2html only
27736 # ----------------------------------------------------------------
27737
27738 !! test
27739 Ignore rel attribute in a-tags during serialization to url-links
27740 !! options
27741 parsoid=html2wt
27742 !! html/parsoid
27743 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27744 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27745 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27746 !! wikitext
27747 http://en.wikipedia.org/wiki/Foobar
27748 http://en.wikipedia.org/wiki/Foobar
27749 http://en.wikipedia.org/wiki/Foobar
27750 !! end
27751
27752 # 'mi' is a localinterwiki prefix as well as a language
27753 !! test
27754 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27755 !! options
27756 parsoid=html2wt
27757 !! html/parsoid
27758 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27759 !! wikitext
27760 [[Foo]]
27761 !! end
27762
27763 !! test
27764 Parsoid should accept interwiki shortcuts
27765 !! options
27766 parsoid=html2wt
27767 !! html/parsoid
27768 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27769 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27770 <a href='./fr:Foo'>Foo</a></p>
27771 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27772 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27773 <a href='fr%3AFoo'>Foo</a></p>
27774 <p><a href='FR%3AFoo'>Foo</a>
27775 <a href='./FR:Foo'>Foo</a></p>
27776 !! wikitext
27777 [[:fr:Foo|Foo]]
27778 [[:fr:Foo|Foo]]
27779 [[:fr:Foo|Foo]]
27780
27781 [[:fr:Foo|Foo]]
27782 [[:fr:Foo|Foo]]
27783 [[:fr:Foo|Foo]]
27784
27785 [[:fr:Foo|Foo]]
27786 [[:fr:Foo|Foo]]
27787 !! end
27788
27789 !! test
27790 Parsoid should not accept invalid interwiki shortcuts
27791 !! options
27792 parsoid=html2wt
27793 !! html/parsoid
27794 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
27795 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
27796 <a href='news:Foo'>Foo</a></p>
27797 !! wikitext
27798 [news:Foo Foo]
27799 [news:Foo Foo]
27800 [news:Foo Foo]
27801 !! end
27802
27803 # See T93839
27804 !! test
27805 New wikilinks should be serialized properly
27806 !! options
27807 parsoid=html2wt
27808 !! html/parsoid
27809 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
27810 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
27811 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
27812 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
27813 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
27814 !! wikitext
27815 [[Foo]]
27816 [[Foo]]
27817 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
27818 http://en.wikipedia.org/wiki/Foo
27819 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
27820 !! end
27821
27822 !! test
27823 New wiki links (href variations)
27824 !! options
27825 parsoid=html2wt
27826 !! html/parsoid
27827 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27828 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
27829 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
27830 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
27831 !! wikitext
27832 [[Foo_bar]]
27833 [[Foo_bar]]
27834 [[Foo_bar]]
27835 [[Toxine bactérienne]]
27836 !! end
27837
27838 !! test
27839 New wiki links (content string variations)
27840 !! options
27841 parsoid=html2wt
27842 !! html/parsoid
27843 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27844 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
27845 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
27846 !! wikitext
27847 [[Foo_bar]]
27848 [[Foo bar]]
27849 [[Foo_bar|./Foo_bar]]
27850 !! end
27851
27852 !! test
27853 New category links (href variations)
27854 !! options
27855 parsoid=html2wt
27856 !! html/parsoid
27857 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
27858 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
27859 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
27860 !! wikitext
27861 [[Category:Toxine bactérienne]]
27862 [[Category:Toxine bactérienne]]
27863 [[Category:Toxine bactérienne]]
27864 !! end
27865
27866 !! test
27867 New sol transparent links don't need indent-pre nowiki protection
27868 !! options
27869 parsoid=html2wt
27870 language=de
27871 !! html/parsoid
27872 <link rel="mw:PageProp/redirect" href="./Main_Page">
27873 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27874 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27875 !! wikitext
27876 #WEITERLEITUNG [[Main Page]]
27877 <!-- this is good --> [[Category:Good]]
27878 <!-- this is great --> [[Kategorie:Great]]
27879 !! end
27880
27881 !! test
27882 New interlanguage links (href variations)
27883 !! options
27884 parsoid=html2wt
27885 !! html/parsoid
27886 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
27887 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
27888 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
27889 !! wikitext
27890 [[es:Toxine bactérienne]]
27891 [[es:Toxine_bactérienne]]
27892 [[es:Toxine_bactérienne]]
27893 !! end
27894
27895 !! test
27896 Image: Modifying size of an image (1)
27897 !! options
27898 parsoid={
27899 "modes": ["wt2wt"],
27900 "changes": [
27901 ["img[height]", "attr", "height", "22"],
27902 ["img[width]", "attr", "width", "200"]
27903 ]
27904 }
27905 !! wikitext
27906 [[Image:Foobar.jpg|230x230px]]
27907 !! wikitext/edited
27908 [[Image:Foobar.jpg|200x200px]]
27909 !!end
27910
27911 !! test
27912 Image: Modifying size of an image (2)
27913 !! options
27914 parsoid={
27915 "modes": ["wt2wt"],
27916 "changes": [
27917 ["img[height]", "attr", "height", "100"],
27918 ["img[width]", "attr", "width", "500"]
27919 ]
27920 }
27921 !! wikitext
27922 [[Image:Foobar.jpg|230x230px]]
27923 !! wikitext/edited
27924 [[Image:Foobar.jpg|500x500px]]
27925 !!end
27926
27927 # Change in size is ignored so long as class='mw-default-size'
27928 !! test
27929 Image: Modifying size of an image (3)
27930 !! options
27931 parsoid={
27932 "modes": ["wt2wt"],
27933 "changes": [
27934 ["figure[class]", "removeClass", "mw-default-size"],
27935 ["figure img", "attr", "height", "19"],
27936 ["figure img", "attr", "width", "170"]
27937 ]
27938 }
27939 !! wikitext
27940 [[Image:Foobar.jpg|thumb]]
27941 !! wikitext/edited
27942 [[Image:Foobar.jpg|thumb|170x170px]]
27943 !!end
27944
27945 !! test
27946 Image: Modifying alignment of an image (T50665)
27947 !! options
27948 parsoid={
27949 "modes": ["wt2wt"],
27950 "changes": [
27951 ["figure[class]", "removeClass", "mw-halign-right"],
27952 ["figure[class]", "addClass", "mw-halign-left"]
27953 ]
27954 }
27955 !! wikitext
27956 [[Image:Foobar.jpg|thumb|caption|right]]
27957 !! wikitext/edited
27958 [[Image:Foobar.jpg|thumb|caption|left]]
27959 !! end
27960
27961 !! test
27962 Image: Modifying mw-default-size of an frameless image (T64805)
27963 !! options
27964 parsoid={
27965 "modes": ["wt2wt"],
27966 "changes": [
27967 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27968 ]
27969 }
27970 !! wikitext
27971 [[Image:Foobar.jpg|frameless|right]]
27972 !! wikitext/edited
27973 [[Image:Foobar.jpg|frameless|right|220x220px]]
27974 !! end
27975
27976 !! test
27977 Image: Modifying valign of an image (T51221)
27978 !! options
27979 parsoid={
27980 "modes": ["wt2wt"],
27981 "changes": [
27982 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27983 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27984 ]
27985 }
27986 !! wikitext
27987 [[File:Foobar.jpg|20px|middle]]
27988 !! wikitext/edited
27989 [[File:Foobar.jpg|20px|text-top]]
27990 !! end
27991
27992 !! test
27993 Image: Modifying alt attribute of an image (T58400)
27994 !! options
27995 parsoid={
27996 "modes": ["wt2wt"],
27997 "changes": [
27998 ["img[alt]", "attr", "alt", "some alternate edited text"]
27999 ]
28000 }
28001 !! wikitext
28002 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
28003 !! wikitext/edited
28004 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
28005 !!end
28006
28007 !! test
28008 Image: Modifying caption of an image
28009 !! options
28010 parsoid={
28011 "modes": ["wt2wt"],
28012 "changes": [
28013 ["figcaption", "text", "new caption"]
28014 ]
28015 }
28016 !! wikitext
28017 [[Image:Foobar.jpg|thumb|original caption]]
28018 !! wikitext/edited
28019 [[Image:Foobar.jpg|thumb|new caption]]
28020 !!end
28021
28022 !! test
28023 Image: empty alt attribute (T50924)
28024 !! options
28025 parsoid
28026 !! wikitext
28027 [[File:Foobar.jpg|thumb|alt=|bar]]
28028 !! html
28029 <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>
28030 !! end
28031
28032 !! test
28033 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
28034 !! options
28035 parsoid=html2wt
28036 language=ar
28037 disabled
28038 !! html/parsoid
28039 <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>
28040 !! wikitext
28041 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
28042 !! end
28043
28044 !! test
28045 Image: Block level image should have \n before and after
28046 !! wikitext
28047 123
28048 [[File:Foobar.jpg|right|thumb|150x150px]]
28049 456
28050 !! html/parsoid
28051 <p>123</p>
28052 <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>
28053 <p>456</p>
28054 !! end
28055
28056 !! test
28057 Image: New block level image should have \n before and after (existing content)
28058 !! wikitext
28059 123
28060 [[File:Foobar.jpg|right|thumb|150x150px]]
28061 456
28062 !! html/parsoid
28063 <p>123</p>
28064 <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>
28065 <p>456</p>
28066 !! end
28067
28068 !! test
28069 Image: upright option (parsoid)
28070 !! wikitext
28071 [[File:Foobar.jpg|thumb|upright|caption]]
28072 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
28073 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
28074 !! html/parsoid
28075 <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>
28076 <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>
28077 <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>
28078 !! end
28079
28080 !! test
28081 Image: upright option is ignored on inline and frame images (parsoid)
28082 !! wikitext
28083 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
28084 !! html/parsoid
28085 <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>
28086 !! end
28087
28088 !! test
28089 Image: in template parameter with empty parameter
28090 !! wikitext
28091 {{echo|[[File:Foobar.jpg|link=]]}}
28092 !! html/parsoid
28093 <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>
28094 !! end
28095
28096 !! test
28097 Image: from basic HTML (1)
28098 !! options
28099 parsoid=html2wt
28100 !! html/parsoid
28101 <span typeof="mw:Image">
28102 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28103 </span>
28104 !! wikitext
28105 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28106 !! end
28107
28108 !! test
28109 Image: from basic HTML (2)
28110 !! options
28111 parsoid=html2wt
28112 !! html/parsoid
28113 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28114 !! wikitext
28115 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28116 !! end
28117
28118 !! test
28119 Image: from basic HTML (3)
28120 !! options
28121 parsoid=html2wt
28122 !! html/parsoid
28123 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
28124 !! wikitext
28125 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
28126 !! end
28127
28128 !! test
28129 Image: from basic HTML (4)
28130 !! options
28131 parsoid=html2wt
28132 !! html/parsoid
28133 <img src="./File:Foobar.jpg">
28134 !! wikitext
28135 [[File:Foobar.jpg|link=]]
28136 !! end
28137
28138 !! test
28139 Image: Invalid title as link
28140 !! wikitext
28141 [[File:Foobar.jpg|link=<]]
28142 !! html/php
28143 <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>
28144 </p>
28145 !! html/parsoid
28146 <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>
28147 !! end
28148
28149 !! test
28150 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
28151 !! options
28152 parsoid=html2wt
28153 !! html/parsoid
28154 <ul>
28155 <li><p>foo</p></li>
28156 </ul>
28157 !! wikitext
28158 * foo
28159 !! end
28160
28161 !! test
28162 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
28163 !! options
28164 parsoid=html2wt
28165 !! html/parsoid
28166 <ul> <li>foo</li></ul>
28167 !! wikitext
28168 * foo
28169 !! end
28170
28171 !! test
28172 Don't strip leading whitespace when handling indent-pre suppressing tags
28173 !! options
28174 parsoid=html2wt
28175 !! html/parsoid
28176 <table>
28177 <tr><td> indented row</td></tr>
28178 </table>
28179 <blockquote><p>
28180 <b>This is very bold of you!</b>
28181 </p>
28182 <table><tr><td>
28183 indented cell (no pre-wrapping!)
28184 </td></tr></table>
28185 </blockquote>
28186 <p>foo</p>
28187 <div>bar</div>
28188 !! wikitext
28189 {|
28190 | indented row
28191 |}
28192 <blockquote>
28193 '''This is very bold of you!'''
28194
28195 {|
28196 |
28197 indented cell (no pre-wrapping!)
28198 |}
28199 </blockquote>
28200 foo
28201 <div>bar</div>
28202 !! end
28203
28204 !! test
28205 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
28206 !! options
28207 parsoid=html2wt
28208 !! html/parsoid
28209 <p>foo</p>
28210 <span>bar</span>
28211
28212 <span>foo2
28213 </span>bar2
28214
28215 <div>foo</div>
28216 <span>bar</span>
28217
28218 <div>
28219 <span>foo</span>
28220 </div>
28221 !! wikitext
28222 foo
28223
28224 <span>bar</span>
28225
28226 <span>foo2
28227 <nowiki> </nowiki></span>bar2
28228
28229 <div>foo</div>
28230 <nowiki> </nowiki><span>bar</span>
28231
28232 <div>
28233 <nowiki> </nowiki><span>foo</span>
28234 </div>
28235 !! end
28236
28237 !! test
28238 Lists: Dont insert newlines in a serialized list item.
28239 !! options
28240 parsoid=html2wt
28241 !! html/parsoid
28242 <ul><li>a<br>b</li><li>c</li></ul>
28243 !! wikitext
28244 * a<br />b
28245 * c
28246 !! end
28247
28248 !! test
28249 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
28250 !! options
28251 parsoid={
28252 "modes": ["html2wt"],
28253 "scrubWikitext": false
28254 }
28255 !! html/parsoid
28256 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28257 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28258
28259 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28260 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28261
28262 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
28263
28264 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28265 !! wikitext
28266 == hello there [[Category:A1]] ==
28267
28268 == [[Category:A2]] hi pal ==
28269
28270 == <!--foo--> [[Category:A3]] how goes it ==
28271
28272 == it goes well [[Category:A4]] <!--bar--> ==
28273
28274 ==howdy [[Category:A5]]==
28275
28276 == __TOC__ ok ==
28277 !! end
28278
28279 !! test
28280 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
28281 !! options
28282 parsoid={
28283 "modes": ["html2wt"],
28284 "scrubWikitext": true
28285 }
28286 !! html/parsoid
28287 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28288 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28289
28290 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28291 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28292
28293 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28294 !! wikitext
28295 == hello there ==
28296 [[Category:A1]]
28297 [[Category:A2]]
28298
28299 == hi pal ==
28300
28301 <!--foo-->[[Category:A3]]
28302
28303 == how goes it ==
28304
28305 == it goes well ==
28306 [[Category:A4]] <!--bar-->
28307
28308 __TOC__
28309
28310 == ok ==
28311 !! end
28312
28313 !! test
28314 Headings: Don't hoist metas that come from templates
28315 !! options
28316 parsoid={
28317 "modes": ["html2wt"],
28318 "scrubWikitext": true
28319 }
28320 !! html/parsoid
28321 <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>
28322 !! wikitext
28323 == {{echo|foo [[Category:Foo]]}} ==
28324 !! end
28325
28326 !! test
28327 Headings: Category in ref isn't hoisted
28328 !! options
28329 parsoid={
28330 "modes": ["html2wt"],
28331 "scrubWikitext": true
28332 }
28333 !! html/parsoid
28334 <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>
28335
28336 <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>
28337 !! wikitext
28338 == foo <ref>bar
28339 [[Category:Baz]] </ref> ==
28340
28341 <references />
28342 !! end
28343
28344 !! test
28345 Parsoid: Serialize positional parameters with = in them as named parameter
28346 !! options
28347 parsoid=html2wt
28348 !! html/parsoid
28349 <p about="#mwt1" typeof="mw:Transclusion"
28350 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
28351
28352 <p about="#mwt1" typeof="mw:Transclusion"
28353 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
28354
28355 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28356 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28357 <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>
28358 !! wikitext
28359 {{echo|1=f=oo}}
28360
28361 {{echo|1=f=oo|2=bar}}
28362
28363 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28364 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28365 {{echo|<nowiki>f=oo</nowiki>|bar}}
28366 !! end
28367
28368 !! test
28369 Parsoid: Serialize positional parameters with = in extlink as named parameter
28370 !! options
28371 parsoid=html2wt
28372 !! html/parsoid
28373 <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>
28374 !! wikitext
28375 {{echo|1=http://stuff?is=ok}}
28376 !! end
28377
28378 !! test
28379 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
28380 !! options
28381 parsoid=html2wt
28382 !! html/parsoid
28383 <div>a<p>b</p></div>
28384 <div>a
28385 <p>b</p></div>
28386 <div>
28387 a
28388 <p>b</p></div>
28389 !! wikitext
28390 <div>a
28391 b
28392 </div>
28393 <div>a
28394 b
28395 </div>
28396 <div>
28397 a
28398
28399 b
28400 </div>
28401 !! end
28402
28403 !! test
28404 Substrings resembling wikitext in hrefs should not get nowiki escapes
28405 !! options
28406 parsoid=html2wt
28407 !! html/parsoid
28408 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
28409 !! wikitext
28410 [[Foo''bar''baz]]
28411 !! end
28412
28413 !! test
28414 Enforce single-line context in the serializer
28415 !! options
28416 parsoid=html2wt
28417 !! html/parsoid
28418 <h2>testing
28419 123</h2>
28420
28421 <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">
28422 </span><span about="#mwt1">you</span> </h2>
28423
28424 <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>
28425
28426 <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
28427 there</span></li></ol>
28428
28429 <ul><li>asd
28430 sdf</li></ul>
28431
28432 <ul><li>foo
28433 bar
28434 baz</li>
28435 <li>foo <b>bar</b>
28436 baz</li></ul>
28437
28438 <dl><dt>hi
28439 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
28440 ho</dd></dl>
28441
28442 <dl><dd> <table>
28443 <tbody><tr><td> ha
28444 ha
28445 ha</td></tr>
28446 </tbody></table></dd></dl>
28447 !! wikitext
28448 == testing 123 ==
28449
28450 == hi {{bogus|there
28451 you}} ==
28452
28453 == foo <ref>hello
28454 there</ref> ==
28455
28456 <references />
28457
28458 * asd sdf
28459
28460 * foo bar baz
28461 * foo '''bar''' baz
28462
28463 ; hi ho : hi ho
28464
28465 : {|
28466 | ha
28467 ha
28468 ha
28469 |}
28470 !! end
28471
28472 !! test
28473 Serialize new placeholder space without spans
28474 !! options
28475 parsoid=html2wt
28476 !! html/parsoid
28477 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
28478
28479 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
28480
28481 <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>
28482 !! wikitext
28483 foo : bar
28484
28485 foo : bar
28486
28487 <ref>foo : bar</ref>ok
28488 !! end
28489
28490
28491 #-----------------------
28492 # Tag minimization tests
28493 #-----------------------
28494
28495 !! test
28496 1. I/B quote minimization: wikitext-only tags should be combined
28497 !! options
28498 parsoid=html2wt
28499 !! html/parsoid
28500 <p><i>A</i><i>B</i></p>
28501 <p><b>A</b><b>B</b></p>
28502 <p><i>A</i><b><i>B</i></b></p>
28503 <p><b>A</b><i><b>B</b></i></p>
28504 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
28505 <p><i><b>A</b></i><i><b>B</b></i></p>
28506 <p><i><b>A</b></i><b><i>B</i></b></p>
28507 <p><b><i>A</i></b><i><b>B</b></i></p>
28508 !! wikitext
28509 ''AB''
28510
28511 '''AB'''
28512
28513 ''A'''B'''''
28514
28515 '''A''B'''''
28516
28517 '''A''BC''D'''
28518
28519 '''''AB'''''
28520
28521 '''''AB'''''
28522
28523 '''''AB'''''
28524 !! end
28525
28526 !! test
28527 2. I/B quote minimization: wikitext and html tags should not be combined
28528 !! options
28529 parsoid=html2wt
28530 !! html/parsoid
28531 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
28532 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
28533 !! wikitext
28534 ''A''<i>B</i>
28535
28536 ''A''<nowiki/>'''<i>B</i>'''
28537 !! end
28538
28539 !! test
28540 3. I/B quote minimization: templated content stops minimization
28541 !! options
28542 parsoid=html2wt
28543 !! html/parsoid
28544 <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>
28545 <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>
28546 !! wikitext
28547 ''A''{{echo|''B''}}
28548
28549 ''A''{{echo|'''''B'''''}}
28550 !! end
28551
28552 !! test
28553 4. I/B quote minimization: new content should be mimimized with adjacent old content
28554 !! options
28555 parsoid=html2wt
28556 !! html/parsoid
28557 <p><i>A</i><i>B</i></p>
28558 <p><b>A</b><b>B</b></p>
28559 <p><i>A</i><b><i>B</i></b></p>
28560 !! wikitext
28561 ''AB''
28562
28563 '''AB'''
28564
28565 ''A'''B'''''
28566 !! end
28567
28568 !! test
28569 5a. Merge adjacent quote nodes if they've been edited
28570 !! options
28571 parsoid={
28572 "modes": ["wt2wt", "selser"],
28573 "changes": [
28574 ["p", "contents", "remove", ":contains('b')"]
28575 ]
28576 }
28577 !! wikitext
28578 ''a''b''c''
28579 !! wikitext/edited
28580 ''ac''
28581 !! end
28582
28583 !! test
28584 5b. Merge adjacent quote nodes if they've been edited
28585 !! options
28586 parsoid={
28587 "modes": ["wt2wt", "selser"],
28588 "changes": [
28589 ["#x", "remove"]
28590 ]
28591 }
28592 !! wikitext
28593 ''a''<span id="x">b</span>''c''
28594 !! wikitext/edited
28595 ''ac''
28596 !! end
28597
28598 !! test
28599 1. Merge adjacent link nodes as long as at least one element is new
28600 !! options
28601 parsoid={
28602 "modes": ["html2wt"],
28603 "scrubWikitext": true
28604 }
28605 !! html/parsoid
28606 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28607 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28608 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28609 !! wikitext
28610 [[Football]]
28611 [[Football]]
28612 [[Football|Foot]][[Football|ball]]
28613 !! end
28614
28615 !! test
28616 2. Merge adjacent link nodes and enable additional normalizations
28617 !! options
28618 parsoid={
28619 "modes": ["html2wt"],
28620 "scrubWikitext": true
28621 }
28622 !! html/parsoid
28623 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28624 !! wikitext
28625 ''[[Football]]''
28626 !! end
28627
28628 !! test
28629 3. Don't merge adjacent link nodes if scrubWikitext is false
28630 !! options
28631 parsoid={
28632 "modes": ["html2wt"],
28633 "scrubWikitext": false
28634 }
28635 !! html/parsoid
28636 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28637 !! wikitext
28638 [[Football|Foot]][[Football|ball]]
28639 !! end
28640
28641 !! test
28642 1. Move format tags outside of WikiLink
28643 !! options
28644 parsoid={
28645 "modes": ["html2wt"],
28646 "scrubWikitext": true
28647 }
28648 !! html/parsoid
28649 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
28650 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
28651 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
28652 !! wikitext
28653 ''[[Football]]''
28654 '''''[[Football]]'''''
28655 <u>'''''[[Football]]'''''</u>
28656 !! end
28657
28658 !! test
28659 2. Move format tags outside of WikiLink with mergable A tags
28660 !! options
28661 parsoid={
28662 "modes": ["html2wt"],
28663 "scrubWikitext": true
28664 }
28665 !! html/parsoid
28666 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
28667 !! wikitext
28668 '''''[[Football]]'''''
28669 !! end
28670
28671 !! test
28672 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
28673 !! options
28674 parsoid={
28675 "modes": ["html2wt"],
28676 "scrubWikitext": true
28677 }
28678 !! html/parsoid
28679 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
28680 !! wikitext
28681 <font color="red"><u>'''[[Foo]]'''</u></font>
28682 !! end
28683
28684 !! test
28685 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
28686 !! options
28687 parsoid={
28688 "modes": ["html2wt"],
28689 "scrubWikitext": true
28690 }
28691 !! html/parsoid
28692 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
28693 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
28694 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
28695 !! wikitext
28696 [[Foo|<font color="red">Foo</font>]]
28697 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
28698 [[Foo|<span class="Bar">Foo</span>]]
28699 !! end
28700
28701 !! test
28702 5. T194083 Regression test: Manual edit test that also enables scrubWikitext to move format tags outside wikilinks
28703 !! options
28704 parsoid={
28705 "modes": ["selser"],
28706 "scrubWikitext": true,
28707 "changes": [
28708 ["a", "html", "<i>Foo</i>"]
28709 ]
28710 }
28711 !! wikitext
28712 [[Foo]]
28713 !! wikitext/edited
28714 ''[[Foo]]''
28715 !! end
28716
28717 !! test
28718 6. Regression test: Manual edit test to ensure diff markers are not lost
28719 !! options
28720 parsoid={
28721 "modes": ["selser"],
28722 "scrubWikitext": true,
28723 "changes": [
28724 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
28725 ]
28726 }
28727 !! wikitext
28728 ''Foo''
28729 !! wikitext/edited
28730 ''[[Foo]]''
28731 !! end
28732
28733 #------------------------------
28734 # End of tag minimization tests
28735 #------------------------------
28736
28737 !!test
28738 T56262: New entities
28739 !! options
28740 parsoid=html2wt
28741 !! html/parsoid
28742 <span typeof="mw:Entity">&nbsp;</span>
28743 !! wikitext
28744 &nbsp;
28745 !! end
28746
28747 ## Note that there is no wikitext output for 'unknownproperty' ##
28748 ## Unknown magic words are silently dropped ##
28749
28750 !! test
28751 Magic words
28752 !! options
28753 parsoid=html2wt
28754 !! html/parsoid
28755 <meta property='mw:PageProp/toc' />
28756 <meta property='mw:PageProp/notoc' />
28757 <meta property='mw:PageProp/forcetoc' />
28758 <meta property='mw:PageProp/index' />
28759 <meta property='mw:PageProp/noindex' />
28760 <meta property='mw:PageProp/nogallery' />
28761 <meta property='mw:PageProp/noeditsection' />
28762 <meta property='mw:PageProp/notitleconvert' />
28763 <meta property='mw:PageProp/nocontentconvert' />
28764 <meta property='mw:PageProp/unknownproperty' />
28765 !! wikitext
28766 __TOC__
28767 __NOTOC__
28768 __FORCETOC__
28769 __INDEX__
28770 __NOINDEX__
28771 __NOGALLERY__
28772 __NOEDITSECTION__
28773 __NOTITLECONVERT__
28774 __NOCONTENTCONVERT__
28775 !! end
28776
28777 !! test
28778 Consecutive <pre>s should not get merged
28779 !! options
28780 parsoid=html2wt,html2html
28781 !! html/parsoid
28782 <pre>a</pre><pre>b</pre>
28783
28784 <pre>c
28785 </pre><pre>
28786 d</pre>
28787
28788 <pre>e
28789
28790 </pre><pre>
28791
28792 f</pre>
28793 !! wikitext
28794 a
28795
28796 b
28797
28798 c
28799
28800 d
28801
28802 e
28803
28804
28805
28806 f
28807 !! end
28808
28809 !! test
28810 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
28811 !! options
28812 parsoid=html2wt
28813 !! html/parsoid
28814 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
28815 !! wikitext
28816 [[Special:BookSources/1234567890|ISBN 1234567895]]
28817 !! end
28818
28819 !! test
28820 Edited RFC links not serializable as RFC links should serialize as extlinks
28821 !! options
28822 parsoid=html2wt
28823 !! html/parsoid
28824 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
28825 !! wikitext
28826 [https://tools.ietf.org/html/rfc123 New RFC]
28827 !! end
28828
28829 !! test
28830 Edited PMID links not serializable as PMID links should serialize as extlinks
28831 !! options
28832 parsoid=html2wt
28833 !! html/parsoid
28834 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
28835 !! wikitext
28836 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
28837 !! end
28838
28839 !! test
28840 WTS of autolinks with trailing/surrounding context
28841 !! options
28842 parsoid=html2wt
28843 !! html/parsoid
28844 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
28845 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
28846 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
28847 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
28848 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
28849 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
28850 !! wikitext
28851 http://cscott.net'''foo'''
28852
28853 http://cscott.net<b>foo</b>
28854
28855 '''http://cscott.net'''
28856
28857 '''http://cscott.net '''
28858
28859 '''http://cscott.net<nowiki/>x'''
28860
28861 http://cscott.net<nowiki/>x
28862 !! end
28863
28864 !! test
28865 WTS of autolinks with nowikis (round-trip)
28866 !! wikitext
28867 x<nowiki/>http://cscott.net<nowiki/>x
28868 !! html/parsoid
28869 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
28870 !! end
28871
28872 # this is the "easy" test because it leaves in place all the
28873 # data-parsoid information indicating this is an autolink
28874 !! test
28875 WTS of autolinks with escapes (editing)
28876 !! options
28877 parsoid={
28878 "modes": ["wt2wt"],
28879 "changes": [
28880 [ "span", "remove" ]
28881 ]
28882 }
28883 !! wikitext
28884 x<nowiki/>http://cscott.net<nowiki/>x
28885 !! wikitext/edited
28886 x<nowiki/>http://cscott.net<nowiki/>x
28887 !! end
28888
28889 !! test
28890 WTS of edited autolink-like text (T103364)
28891 !! options
28892 parsoid={
28893 "modes": ["wt2wt"],
28894 "changes": [
28895 [ "span[typeof]", "removeAttr", "typeof" ]
28896 ]
28897 }
28898 !! wikitext
28899 Not a link: <nowiki>http://example.com</nowiki>.
28900 !! wikitext/edited
28901 Not a link: <span><nowiki>http://example.com</nowiki></span>.
28902 !! end
28903
28904 !! test
28905 WTS of newly-authored autolink-like text (T103364)
28906 !! options
28907 parsoid=html2wt
28908 !! html/parsoid
28909 <p>http://example.com is not a link.</p>
28910 !! wikitext
28911 <nowiki>http://example.com</nowiki> is not a link.
28912 !! end
28913
28914 !! test
28915 WTS of autolink-like text after an autolink (T108563)
28916 !! options
28917 parsoid=html2wt
28918 !! html/parsoid
28919 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
28920 !! wikitext
28921 http://example.com <nowiki>http://example.com</nowiki> is not a link.
28922 !! end
28923
28924 !! test
28925 Magic links inside links (not autolinked)
28926 !! wikitext
28927 [[Foo|http://example.com]]
28928 [[Foo|RFC 1234]]
28929 [[Foo|PMID 1234]]
28930 [[Foo|ISBN 123456789x]]
28931
28932 [http://foo.com http://example.com]
28933 [http://foo.com RFC 1234]
28934 [http://foo.com PMID 1234]
28935 [http://foo.com ISBN 123456789x]
28936 !! html+tidy
28937 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
28938 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
28939 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
28940 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
28941 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
28942 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
28943 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
28944 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
28945 </p>
28946 !! html/parsoid
28947 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
28948 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
28949 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
28950 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
28951
28952 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
28953 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
28954 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
28955 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
28956 !! end
28957
28958 !! test
28959 Magic links inside image captions (autolinked)
28960 !! wikitext
28961 [[File:Foobar.jpg|thumb|http://example.com]]
28962 [[File:Foobar.jpg|thumb|RFC 1234]]
28963 [[File:Foobar.jpg|thumb|PMID 1234]]
28964 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
28965 !! html+tidy
28966 <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>
28967 <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>
28968 <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>
28969 <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>
28970 !! html/parsoid
28971 <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>
28972 <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>
28973 <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>
28974 <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>
28975 !! end
28976
28977 !! test
28978 WTS of magic word text (T109371)
28979 !! options
28980 parsoid=html2wt
28981 !! html/parsoid
28982 <p>RFC 1234</p>
28983 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
28984 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28985 !! wikitext
28986 <nowiki>RFC 1234</nowiki>
28987
28988 [http://foo.com RFC 1234]
28989
28990 [[Foo|RFC 1234]]
28991 !! end
28992
28993 !! test
28994 Edited Redirect link should emit a non-piped wikitext link
28995 !! options
28996 parsoid=html2wt
28997 !! html/parsoid
28998 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28999 !! wikitext
29000 #REDIRECT [[Bar]]
29001 !! end
29002
29003 !! test
29004 T75121: Infer extension name from typeOf if data-mw is not present
29005 !! options
29006 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29007 !! html/parsoid
29008 <div typeOf="mw:Extension/foo"></div>
29009 !! wikitext
29010 <foo />
29011 !! end
29012
29013 # Note that the <p> wrapping isn't present in PHP parser output
29014 # The important thing for this test is that P-wrapping doesn't
29015 # interfere with the <nowiki> protection for leading - in <td>
29016 # (which isn't necessary for <th>).
29017 !! test
29018 T88318: p-wrapped dash in table.
29019 !! options
29020 parsoid=html2wt,wt2wt
29021 !! html/parsoid
29022 <table><tbody>
29023 <tr><th><p>-</p></th><th><p>- </p></th></tr>
29024 <tr><td><p>-</p></td><td><p>- </p></td></tr>
29025 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
29026 </tbody></table>
29027 !! wikitext
29028 {|
29029 !-
29030 !-
29031 |-
29032 |<nowiki>-</nowiki>
29033 |<nowiki>- </nowiki>
29034 |-
29035 |<small>-</small>
29036 |<br />
29037 -
29038 |<br />-
29039 |}
29040 !! html/php+tidy
29041 <table>
29042 <tbody><tr>
29043 <th>-
29044 </th>
29045 <th>-
29046 </th></tr>
29047 <tr>
29048 <td>-
29049 </td>
29050 <td>-
29051 </td></tr>
29052 <tr>
29053 <td><small>-</small>
29054 </td>
29055 <td><br />
29056 <p>-
29057 </p>
29058 </td>
29059 <td><br />-
29060 </td></tr></tbody></table>
29061 !! end
29062
29063 !! test
29064 T149209: WTS: Handle newlines in table cells properly
29065 !! options
29066 parsoid=html2wt
29067 !! html/parsoid
29068 <table>
29069 <tbody>
29070 <tr><td>a
29071 b
29072 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
29073 <tr><td><p>x</p>
29074 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
29075 </tbody></table>
29076 <table>
29077 <tbody>
29078 <tr><th>a
29079 b
29080 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
29081 <tr><th><p>x</h>
29082 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
29083 </tbody></table>
29084 !! wikitext
29085 {|
29086 |a
29087 b
29088 |c
29089 |-
29090 |x
29091 {{!}}y
29092 |}
29093 {|
29094 !a
29095 b
29096 !c
29097 |-
29098 !x
29099 !y
29100 |}
29101 !! end
29102
29103 !! test
29104 T149209: Selser: Handle newlines in table cells properly
29105 !! options
29106 parsoid={
29107 "modes": ["selser"],
29108 "changes": [
29109 [ "#h1", "html", "a\nb\n" ],
29110 [ "#h2", "html", "a\nb\n" ],
29111 [ "#c1", "html", "a\nb\n" ],
29112 [ "#c2", "html", "<p>a</p>" ],
29113 [ "#c3", "html", "<p>a</p>" ],
29114 [ "#c4", "html", "edit-me<p>a</p>" ]
29115 ]
29116 }
29117 !! wikitext
29118 {|
29119 ! id="h1" |edit-me!!1
29120 |-
29121 ! id="h2" |edit-me||2
29122 |-
29123 | id="c1" |edit-me||3
29124 |-
29125 | id="c2" |edit-me||4
29126 |-
29127 | id="c3" |edit-me||p||q||r
29128 |-
29129 | id="c4" |edit-me||p||q||r
29130 |}
29131 !! wikitext/edited
29132 {|
29133 ! id="h1" |a
29134 b
29135 !1
29136 |-
29137 ! id="h2" |a
29138 b
29139 !2
29140 |-
29141 | id="c1" |a
29142 b
29143 |3
29144 |-
29145 | id="c2" |a
29146 |4
29147 |-
29148 | id="c3" |a
29149 |p||q||r
29150 |-
29151 | id="c4" |edit-me
29152 a
29153 |p||q||r
29154 |}
29155 !! end
29156
29157 !! test
29158 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
29159 !! options
29160 parsoid=html2wt
29161 !! html/parsoid
29162 <table id='mwAb'>
29163 <td id='mwAc'>foo</td>
29164 <td id='serialize-this'>bar</td>
29165 </table>
29166 !! wikitext
29167 {|
29168 |foo
29169 | id="serialize-this" |bar
29170 |}
29171 !! end
29172
29173 !! test
29174 Parsoid-like element ids should not be serialized to wikitext unless shadowed
29175 !! options
29176 parsoid=html2wt
29177 !! html/parsoid
29178 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
29179 !! wikitext
29180 <div id="hello">ok</div>
29181 !! end
29182
29183 !! test
29184 Testing serialization after deletion in references
29185 !! options
29186 parsoid={
29187 "modes": ["wt2wt"],
29188 "changes": [
29189 ["#x", "remove"]
29190 ]
29191 }
29192 !! wikitext
29193 hi <ref><div id="x">ho</div></ref>
29194
29195 <references />
29196 !! wikitext/edited
29197 hi <ref></ref>
29198
29199 <references />
29200 !! end
29201
29202 !!test
29203 Testing serialization after deletion of table cells
29204 !!options
29205 parsoid={
29206 "modes": ["wt2wt", "selser"],
29207 "changes": [
29208 ["#x", "remove"]
29209 ]
29210 }
29211 !!wikitext
29212 {|
29213 !h1 !!h2 !!h3
29214 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
29215 |}
29216 !! wikitext/edited
29217 {|
29218 !h1!!h2!!h3
29219 |c2|||c3
29220 |}
29221 !!end
29222
29223 !! test
29224 Testing selser after addition of new row before first row (T125419)
29225 !! options
29226 parsoid={
29227 "modes": ["wt2wt", "selser"],
29228 "changes": [
29229 [ "tr", "before", "<tr><td>X</td></tr>" ]
29230 ]
29231 }
29232 !! wikitext
29233 {|
29234 |a
29235 |}
29236 !! wikitext/edited
29237 {|
29238 |X
29239 |-
29240 |a
29241 |}
29242 !! end
29243
29244 !! test
29245 Serialize new table rows in a HTML table using HTML tags
29246 !! options
29247 parsoid={
29248 "modes": ["wt2wt", "selser"],
29249 "changes": [
29250 [ "tr", "before", "<tr><td>X</td></tr>" ]
29251 ]
29252 }
29253 !! wikitext
29254 <table><tr><td>a</td></tr></table>
29255 !! wikitext/edited
29256 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
29257 !! end
29258
29259 !! test
29260 Serialize new table cells in a HTML row using HTML tags
29261 !! options
29262 parsoid={
29263 "modes": ["wt2wt", "selser"],
29264 "changes": [
29265 [ "td", "before", "<td>X</td>" ]
29266 ]
29267 }
29268 !! wikitext
29269 <table><tr><td>a</td></tr></table>
29270 !! wikitext/edited
29271 <table><tr><td>X</td><td>a</td></tr></table>
29272 !! end
29273
29274 !! test
29275 Serialize wikitext list items as HTML list items when embedded in a HTML list
29276 !! options
29277 parsoid=html2wt
29278 !! html
29279 <ul data-parsoid='{"stx": "html"}'>
29280 <li data-parsoid='{}'>a</li>
29281 <li>b</li>
29282 </ul>
29283 !! wikitext
29284 <ul>
29285 <li>a</li>
29286 <li>b</li>
29287 </ul>
29288 !! end
29289
29290 # SSS FIXME: Is this actually a good thing given the
29291 # odd nested list output that is generated by MW?
29292 # <ul><li>foo<ul>..</ul></li></ul> instead of
29293 # <ul><li>foo</li><ul>..</ul></ul>
29294 !! test
29295 Wikitext lists can be nested inside HTML lists
29296 !! options
29297 parsoid=html2wt
29298 !! html
29299 <ul data-parsoid='{"stx": "html"}'>
29300 <li data-parsoid='{"stx": "html"}'>a
29301 <ul><li>b</li></ul>
29302 </li>
29303 </ul>
29304
29305 <ul data-parsoid='{"stx": "html"}'>
29306 <li>x
29307 <ul><li>y</li></ul>
29308 </li>
29309 </ul>
29310 !! wikitext
29311 <ul>
29312 <li>a
29313 * b
29314 </li>
29315 </ul>
29316
29317 <ul>
29318 <li>x
29319 * y
29320 </li>
29321 </ul>
29322 !! end
29323
29324 !! test
29325 WTS change modes
29326 !! options
29327 parsoid={
29328 "modes": ["wt2wt"],
29329 "changes": [
29330 [ "#xyz", "before", "<b>before</b> stuff " ],
29331 [ "#xyz", "after", " stuff <i>after</i>" ],
29332 [ "#xyz", "html", "x <b>y</b> z" ]
29333 ]
29334 }
29335 !! wikitext
29336 <span id="xyz">hello</span>
29337 !! wikitext/edited
29338 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
29339 !! end
29340
29341 !! test
29342 Never serialize a-tag as html, regardless of what data-parsoid has to say
29343 !! options
29344 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29345 !! html/parsoid
29346 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
29347 !! wikitext
29348 [[Foo]]
29349 !! end
29350
29351 ## SSS FIXME: This is broken output nevertheless.
29352 ## What might be a reasonable non-broken output for this?
29353 ## This is an edge case unlikely to be seen in production
29354 ## that I am not wasting more time on this right now.
29355 !! test
29356 Never serialize a-tag as html, no matter what attributes it has
29357 !! options
29358 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29359 !! html/parsoid
29360 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
29361 !! wikitext
29362 [http://boo.org http://boohoo.org]
29363 !! end
29364
29365 # Misnested is an indication that selser can reuse the source but these have
29366 # shown to sneak through on occasion. See T101768.
29367 # The original wikitext here is: [http://test.com [[one]] two three]
29368 !! test
29369 Strip span tags added to mark misnested links
29370 !! options
29371 parsoid=html2wt
29372 !! html/parsoid
29373 <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>
29374 !! wikitext
29375 [http://test.com][[one]] two three
29376 !! end
29377
29378 !! test
29379 Catch regression when unpacking misnested links
29380 !! options
29381 parsoid=wt2html
29382 !! wikitext
29383 {{echo|hi}}[http://example.com [[ho]]]
29384 !! html/parsoid
29385 <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>
29386 !! end
29387
29388 !! test
29389 Catch regression when unpacking with trailing content
29390 !! wikitext
29391 {{echo|Foo <references/> bar}}
29392 !! html/parsoid
29393 <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>
29394 !! end
29395
29396 !! test
29397 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
29398 !! options
29399 parsoid=html2wt
29400 !! html/parsoid
29401 <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|}"]}'>
29402 <tbody><tr><td>d
29403 </td></tr>
29404 </tbody></table>
29405 !! wikitext
29406 {{echo|a}}
29407 {|{{echo|c
29408 {{!}}d
29409 }}
29410 |}
29411 !! end
29412
29413 ## This test verifies the presence and computation of this attribute indirectly
29414 ## by making an edit and ensuring that the serialization is correct (which it would be
29415 ## only if firstWikitextNode is properly set).
29416 !! test
29417 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
29418 !! options
29419 parsoid= {
29420 "modes": ["wt2wt"],
29421 "changes": [
29422 [ "div#x", "remove" ],
29423 [ "div", "before", "<div>new</div>" ]
29424 ]
29425 }
29426 !! wikitext
29427 <div id="x">foo</div>
29428 {|
29429 {{echo|<div>boo</div>
29430 {{!}}b}}
29431 |c
29432 |}
29433 !! wikitext/edited
29434
29435 <div>new</div>
29436 {|
29437 {{echo|<div>boo</div>
29438 {{!}}b}}
29439 |c
29440 |}
29441 !! end
29442
29443 # --------------------------------------------
29444 # Tests spec'ing wikitext serialization norms |
29445 # --------------------------------------------
29446
29447 !! test
29448 Serialize multi-line indent-pre starting with wikitext syntax
29449 !! options
29450 parsoid=html2wt
29451 !! html/parsoid
29452 <pre>* 1
29453 ** 2
29454 * 3</pre>
29455 !! wikitext
29456 * 1
29457 ** 2
29458 * 3
29459 !! end
29460
29461 !! test
29462 1. Categories should always be serialized on their own line
29463 !! options
29464 parsoid=html2wt
29465 !! html/parsoid
29466 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
29467 !! wikitext
29468 foo
29469 [[Category:Foo]]
29470 bar
29471 !! end
29472
29473 !! test
29474 2. Categories that are part of templates should not introduce a line break
29475 !! wikitext
29476 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
29477 !! html/parsoid
29478 <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>
29479 !! end
29480
29481 # Careful while editing these next 2 tests. There are \u200f characters
29482 # before and after the <link> tags in the HTML and following some
29483 # of the categories in wikitext
29484 # Do not remove these characters in edits.
29485 #
29486 # As part of the serialization, these bidi characters will get stripped.
29487 !! test
29488 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
29489 !! options
29490 parsoid={
29491 "modes": ["html2wt"],
29492 "scrubWikitext": true
29493 }
29494 !! html/parsoid
29495 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
29496 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
29497 !! wikitext
29498 [[קטגוריה:טקסים]]
29499 [[קטגוריה: שיטות משפט]]
29500 !! end
29501
29502 !! test
29503 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
29504 !! options
29505 parsoid={
29506 "modes": ["html2wt"],
29507 "scrubWikitext": true
29508 }
29509 !! html/parsoid
29510 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
29511 !! wikitext
29512 [[קטגוריה:טקסים]]
29513 ‏y
29514 !! end
29515
29516 !! test
29517 Lists: Add space after bullets
29518 !! options
29519 parsoid=html2wt
29520 !! html/parsoid
29521 <ul>
29522 <li>foo</li>
29523 <li> bar</li>
29524 <li><span> baz</span></li>
29525 </ul>
29526 !! wikitext
29527 * foo
29528 * bar
29529 * <span> baz</span>
29530 !! end
29531
29532 !! test
29533 1. Headings: Add space before/after == (T53744)
29534 !! options
29535 parsoid=html2wt
29536 !! html/parsoid
29537 <h2>foo</h2>
29538 <h2> bar</h2>
29539 <h2>baz </h2>
29540 <h2><span> baz</span></h2>
29541 !! wikitext
29542 == foo ==
29543
29544 == bar ==
29545
29546 == baz ==
29547
29548 == <span> baz</span> ==
29549 !! end
29550
29551 !! test
29552 2. Headings: Add space before/after == even after hoisted content
29553 !! options
29554 parsoid={
29555 "modes": ["html2wt"],
29556 "scrubWikitext": true
29557 }
29558 !! html/parsoid
29559 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
29560 !! wikitext
29561 [[Category:A2]]
29562
29563 == ok ==
29564 !! end
29565
29566 !! test
29567 1. Headings: suppress newly created empty headings
29568 !! options
29569 parsoid={
29570 "modes": ["html2wt"],
29571 "scrubWikitext": true
29572 }
29573 !! html/parsoid
29574 <h2></h2>
29575 !! wikitext
29576 !! end
29577
29578 !! test
29579 2. Headings: don't suppress empty headings if scrubWikitext is false
29580 !! options
29581 parsoid=html2wt
29582 !! html/parsoid
29583 <h2></h2>
29584 !! wikitext
29585 ==<nowiki/>==
29586 !! end
29587
29588 !! test
29589 3. Headings: suppress empty headings on edits
29590 !! options
29591 parsoid={
29592 "modes": ["selser"],
29593 "scrubWikitext": true,
29594 "changes": [
29595 [ "#x", "remove"]
29596 ]
29597 }
29598 !! wikitext
29599 ==<span id="x">foo</span>==
29600 !! wikitext/edited
29601 !! end
29602
29603 !! test
29604 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
29605 !! options
29606 parsoid={
29607 "modes": ["html2wt"],
29608 "scrubWikitext": true
29609 }
29610 !! html/parsoid
29611 <h2>foo<br/>bar</h2>
29612 <h2>foo <span><br/>bar</span> baz</h2>
29613 !! wikitext
29614 == foo bar ==
29615
29616 == foo <span> bar</span> baz ==
29617 !! end
29618
29619 !! test
29620 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
29621 !! options
29622 parsoid={
29623 "modes": ["html2wt"],
29624 "scrubWikitext": false
29625 }
29626 !! html/parsoid
29627 <h2>foo<br/>bar</h2>
29628 !! wikitext
29629 == foo<br />bar ==
29630 !! end
29631
29632 !! test
29633 1. WT Quote Tags: suppress newly created empty style tags
29634 !! options
29635 parsoid={
29636 "modes": ["html2wt"],
29637 "scrubWikitext": true
29638 }
29639 !! html/parsoid
29640 <i></i><b></b>
29641 !! wikitext
29642 !! end
29643
29644 !! test
29645 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
29646 !! options
29647 parsoid=html2wt
29648 !! html/parsoid
29649 <i></i><b></b>
29650 !! wikitext
29651 ''<nowiki/>'''''<nowiki/>'''
29652 !! end
29653
29654 !! test
29655 3. WT Quote Tags: suppress empty style tags on edits
29656 !! options
29657 parsoid={
29658 "modes": ["selser"],
29659 "scrubWikitext": true,
29660 "changes": [
29661 [ "#x", "remove"]
29662 ]
29663 }
29664 !! wikitext
29665 '''<span id="x">foo</span>'''
29666 !! wikitext/edited
29667 !! end
29668
29669 !! test
29670 1. Anchors: suppress newly created empty anchors
29671 !! options
29672 parsoid={
29673 "modes": ["html2wt"],
29674 "scrubWikitext": true
29675 }
29676 !! html/parsoid
29677 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29678 !! wikitext
29679 !! end
29680
29681 !! test
29682 2. Anchors: don't suppress empty anchors if scrubWikitext is false
29683 !! options
29684 parsoid={
29685 "modes": ["html2wt"],
29686 "scrubWikitext": false
29687 }
29688 !! html/parsoid
29689 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29690 !! wikitext
29691 [[Test|<nowiki/>]]
29692 !! end
29693
29694 !! test
29695 3. Anchors: suppress empty anchors on edits
29696 !! options
29697 parsoid={
29698 "modes": ["selser"],
29699 "scrubWikitext": true,
29700 "changes": [
29701 [ "#x", "remove"]
29702 ]
29703 }
29704 !! wikitext
29705 [[Test|<span id="x">foo</span>]]
29706 !! wikitext/edited
29707 !! end
29708
29709 !! test
29710 3a. Anchors: do not suppress numbered extlinks
29711 !! options
29712 parsoid={
29713 "modes": ["wt2wt"],
29714 "scrubWikitext": true
29715 }
29716 !! wikitext
29717 [http://foo.com]
29718 !! html/parsoid
29719 <a rel="mw:ExtLink" href="http://foo.com"></a>
29720 !! end
29721
29722 !! test
29723 3b. Anchors: do not suppress numbered extlinks
29724 !! options
29725 parsoid={
29726 "modes": ["wt2wt"],
29727 "scrubWikitext": true,
29728 "changes": [
29729 [ "#x", "remove"]
29730 ]
29731 }
29732 !! wikitext
29733 [http://foo.com <span id="x">foo</span>]
29734 !! wikitext/edited
29735 [http://foo.com]
29736 !! end
29737
29738 !!test
29739 Normalizations should be restricted to edited content
29740 !!options
29741 parsoid={
29742 "modes": ["selser"],
29743 "scrubWikitext": true,
29744 "changes": [
29745 [ "h1", "before", "<i></i>"]
29746 ]
29747 }
29748 !!wikitext
29749 a
29750 = =
29751 b
29752 !!wikitext/edited
29753 a
29754 = =
29755 b
29756 !!end
29757
29758 !! test
29759 1. Multiple normalizations (html2wt)
29760 !! options
29761 parsoid={
29762 "modes": ["html2wt"],
29763 "scrubWikitext": true
29764 }
29765 !! html
29766 <h2><i></i></h2>
29767 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
29768 </a><b><i></i></b>x</p>
29769 !! wikitext
29770
29771 [[foo]]
29772 x
29773
29774 !! end
29775
29776 !! test
29777 2. Multiple normalizations (selser)
29778 !! options
29779 parsoid={
29780 "modes": ["selser"],
29781 "scrubWikitext": true,
29782 "changes": [
29783 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
29784 ]
29785 }
29786 !! wikitext
29787 <span id="x">foo</span>
29788 !! wikitext/edited
29789 <span id="x">foo</span>
29790
29791 x
29792 !! end
29793
29794 !! test
29795 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
29796 !! options
29797 parsoid={
29798 "modes": ["html2wt"],
29799 "scrubWikitext": true
29800 }
29801 !! html/parsoid
29802 <p> hi</p>
29803 <p> hello</p>
29804 !! wikitext
29805 hi
29806
29807 hello
29808 !! end
29809
29810 !! test
29811 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
29812 !! options
29813 parsoid=html2wt
29814 !! html/parsoid
29815 <p> hi</p>
29816 <p> hello</p>
29817 !! wikitext
29818 <nowiki> </nowiki>hi
29819
29820 <nowiki> </nowiki> hello
29821 !! end
29822
29823 !! test
29824 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
29825 !! options
29826 parsoid={
29827 "modes": ["html2wt"],
29828 "scrubWikitext": true
29829 }
29830 !! html/parsoid
29831 <p>Foo
29832 bar
29833 baz</p>
29834
29835 <table><tr><td>Foo
29836 bar
29837 baz bang</td></tr></table>
29838
29839 <p><!--boo--> foo
29840 bar</p>
29841
29842 <p> foo
29843 bar<span>boo</span></p>
29844 !! wikitext
29845 Foo
29846 bar
29847 baz
29848
29849 {|
29850 |Foo
29851 bar
29852 baz bang
29853 |}
29854
29855 <!--boo-->foo
29856 bar
29857
29858 foo
29859 bar<span>boo</span>
29860 !! end
29861
29862 !! test
29863 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
29864 !! options
29865 parsoid={
29866 "modes": ["selser"],
29867 "scrubWikitext": true,
29868 "changes": [
29869 [ "p", "html", " a\n b" ]
29870 ]
29871 }
29872 !! wikitext
29873 xyz
29874 !! wikitext/edited
29875 a
29876 b
29877 !! end
29878
29879 !! test
29880 1. New links that end in spaces
29881 !! options
29882 parsoid={
29883 "modes": ["html2wt"],
29884 "scrubWikitext": false
29885 }
29886 !! html/parsoid
29887 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29888 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29889 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29890 !! wikitext
29891 [[Berlin ]]<nowiki/>is the capital of Germany.
29892
29893 [[Foo ]]'''bar'''
29894
29895 [[Boston ]] is a city.
29896 !! end
29897
29898 !! test
29899 2. New links that end in spaces
29900 !! options
29901 parsoid={
29902 "modes": ["html2wt"],
29903 "scrubWikitext": true
29904 }
29905 !! html/parsoid
29906 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29907 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29908 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29909 !! wikitext
29910 [[Berlin]] is the capital of Germany.
29911
29912 [[Foo]] '''bar'''
29913
29914 [[Boston]] is a city.
29915 !! end
29916
29917 !! test
29918 1. Table cells with escapable prefixes
29919 !! options
29920 parsoid={
29921 "modes": ["html2wt"],
29922 "scrubWikitext": false
29923 }
29924 !! html
29925 <table>
29926 <tr><td>a</td></tr>
29927 <tr><td>-</td></tr>
29928 <tr><td>+</td></tr>
29929 </table>
29930 !! wikitext
29931 {|
29932 |a
29933 |-
29934 |<nowiki>-</nowiki>
29935 |-
29936 |<nowiki>+</nowiki>
29937 |}
29938 !! end
29939
29940 !! test
29941 2. Table cells with escapable prefixes
29942 !! options
29943 parsoid={
29944 "modes": ["html2wt"],
29945 "scrubWikitext": true
29946 }
29947 !! html
29948 <table>
29949 <tr><td>a</td></tr>
29950 <tr><td>-</td></tr>
29951 <tr><td>+</td></tr>
29952 </table>
29953 !! wikitext
29954 {|
29955 |a
29956 |-
29957 | -
29958 |-
29959 | +
29960 |}
29961 !! end
29962
29963 !! test
29964 3a. Table cells with escapable prefixes after edits
29965 !! options
29966 parsoid={
29967 "modes": ["selser"],
29968 "scrubWikitext": true,
29969 "changes": [
29970 [ "table tbody tr:first-child td:first-child", "remove"]
29971 ]
29972 }
29973 !! wikitext
29974 {|
29975 |a||-
29976 |}
29977 !! wikitext/edited
29978 {|
29979 | -
29980 |}
29981 !! end
29982
29983 !! test
29984 3b. Table cells with escapable prefixes after edits
29985 !! options
29986 parsoid={
29987 "modes": ["selser"],
29988 "scrubWikitext": true,
29989 "changes": [
29990 [ "table tbody tr:first-child td:first-child", "html", "-" ],
29991 [ "#x", "remove" ]
29992 ]
29993 }
29994 !! wikitext
29995 {|
29996 |pqr
29997 |<span id="x">foo</span>+
29998 |}
29999 !! wikitext/edited
30000 {|
30001 | -
30002 | +
30003 |}
30004 !! end
30005
30006 # FIXME: This test will fail because
30007 # normalization doesn't realize that the id attribute
30008 # will eliminate the escapable scenario
30009 !! test
30010 4a. Table cells without escapable prefixes after edits
30011 !! options
30012 parsoid={
30013 "modes": ["selser"],
30014 "scrubWikitext": true,
30015 "changes": [
30016 [ "#x", "html", "-" ]
30017 ]
30018 }
30019 !! wikitext
30020 {|
30021 | id="x" |abcd
30022 |}
30023 !! wikitext/edited
30024 {|
30025 | id="x" |-
30026 |}
30027 !! end
30028
30029 ## This tests normalizer's ability to discriminate between
30030 ## cells having identical content.
30031 !! test
30032 4b. Table cells without escapable prefixes after edits
30033 !! options
30034 parsoid={
30035 "modes": ["selser"],
30036 "scrubWikitext": true,
30037 "changes": [
30038 [ "td", "html", "-" ]
30039 ]
30040 }
30041 !! wikitext
30042 {|
30043 |a||b
30044 |}
30045 !! wikitext/edited
30046 {|
30047 | -||-
30048 |}
30049 !! end
30050
30051 ## This tests normalizer's ability to not be tripped by
30052 ## comments (and whitespace)
30053 !! test
30054 4c. Table cells without escapable prefixes after edits
30055 !! options
30056 parsoid={
30057 "modes": ["selser"],
30058 "scrubWikitext": true,
30059 "changes": [
30060 [ "table tbody tr td:first-child", "remove" ]
30061 ]
30062 }
30063 !! wikitext
30064 {|
30065 |-
30066 <!--foo--> |a||-
30067 |}
30068 !! wikitext/edited
30069 {|
30070 |-
30071 <!--foo--> | -
30072 |}
30073 !! end
30074
30075 ## This tests normalizer's ability to handle HTML cells
30076 !! test
30077 4d. Table cells without escapable prefixes after edits
30078 !! options
30079 parsoid={
30080 "modes": ["selser"],
30081 "scrubWikitext": true,
30082 "changes": [
30083 [ "td", "html", "-" ]
30084 ]
30085 }
30086 !! wikitext
30087 <table>
30088 <tr><td>a</td></tr>
30089 </table>
30090 !! wikitext/edited
30091 <table>
30092 <tr><td>-</td></tr>
30093 </table>
30094 !! end
30095
30096 ## T111151 Remove font elements without attributes
30097 !! test
30098 5a. font tags without attributes should be dropped in scrubWikitext mode
30099 !! options
30100 parsoid={
30101 "modes": ["html2wt"],
30102 "scrubWikitext": true
30103 }
30104 !! html
30105 <font>foo</font>
30106 <font><font>bar</font></font>
30107 <font class="x">boo</font>
30108 !! wikitext
30109 foo
30110 bar
30111 <font class="x">boo</font>
30112 !! end
30113
30114 !! test
30115 5b. font tags should not be dropped without scrubWikitext being enabled
30116 !! options
30117 parsoid={
30118 "modes": ["html2wt"],
30119 "scrubWikitext": false
30120 }
30121 !! html
30122 <font>foo</font>
30123 !! wikitext
30124 <font>foo</font>
30125 !! end
30126
30127 !! test
30128 Escape nowiki DOM elements
30129 !! options
30130 parsoid=html2wt
30131 !! html/parsoid
30132 <nowiki><i>foo</i></nowiki>
30133 !! wikitext
30134 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
30135 !! end
30136
30137 # This is meant to be an interim fix while we go about figuring out
30138 # how to not introduce these trailing <nowiki/>s in the first place.
30139 !! test
30140 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
30141 !! options
30142 parsoid=html2wt
30143 !! html/parsoid
30144 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
30145 y</p>
30146 <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>
30147 <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>
30148 !! wikitext
30149 x
30150 y
30151
30152 {{echo|
30153 1 = <nowiki/>}}
30154
30155 {{echo|
30156 1 = <nowiki/>
30157 }}
30158 !! end
30159
30160 !! test
30161 New list is serialized on newlines
30162 !! options
30163 parsoid=html2wt
30164 !! html/parsoid
30165 <p>The quick brown fox jumps over the lazy dog.</p><ul>
30166 <li>Yesterday</li>
30167 <li>Today</li>
30168 <li>Tomorrow</li>
30169 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
30170 !! wikitext
30171 The quick brown fox jumps over the lazy dog.
30172
30173 * Yesterday
30174 * Today
30175 * Tomorrow
30176
30177 The quick onyx goblin jumps over the lazy dwarf.
30178 !! end
30179
30180 !! test
30181 New lists in formatting elements serialized w/o newlines
30182 !! options
30183 parsoid=html2wt
30184 !! html/parsoid
30185 <small>
30186
30187 <ul>
30188 <li>123</li>
30189 </ul>
30190
30191 </small>
30192
30193 <small><ul><li>hi</li></ul></small>
30194 !! wikitext
30195 <small>
30196 * 123
30197 </small>
30198
30199 <small>
30200 * hi
30201 </small>
30202 !! end
30203
30204 !! test
30205 New list in table doesn't need newlines
30206 !! options
30207 parsoid=html2wt
30208 !! html/parsoid
30209 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
30210 !! wikitext
30211 {|
30212 |
30213 * test
30214 * 123
30215 |}
30216 !! end
30217
30218 # ---------------------------------------------------
30219 # End of tests spec'ing wikitext serialization norms |
30220 # ---------------------------------------------------
30221
30222 # T104032
30223 !! test
30224 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
30225 !! options
30226 parsoid=html2wt
30227 !! html/parsoid
30228 a<p>b</p>
30229 <b>c</b><p>d</p>
30230 <table><tr>
30231 <td>a<p>b</p></td>
30232 <td><b>c</b><p>d</p></td>
30233 </tr></table>
30234 !! wikitext
30235 a
30236
30237 b
30238
30239 '''c'''
30240
30241 d
30242 {|
30243 |a
30244 b
30245 |'''c'''
30246 d
30247 |}
30248 !! end
30249
30250 !! test
30251 Anchor without href scenarios
30252 !! options
30253 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30254 !! html/parsoid
30255 <a class="bc"></a>
30256 <a class="no">dice</a>
30257 <a name="foo"></a>
30258 !! wikitext
30259
30260 dice
30261 <span name="foo"></span>
30262 !! end
30263
30264 !! test
30265 New transclusion added after a list should be serialized after the list
30266 !! options
30267 parsoid=html2wt
30268 !! html/parsoid
30269 <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>
30270 !! wikitext
30271 * a
30272 {{echo|foo}}
30273 !! end
30274
30275 # -----------------------------------------------------------------
30276 # End of section for Parsoid-only html2wt tests for serialization
30277 # of new content
30278 # -----------------------------------------------------------------
30279
30280 # -----------------------------------------------------------------
30281 # The following section of tests are primarily to spec behavior of
30282 # the selective serializer. All these tests have manual selser
30283 # changes. The automated selser changes for all tests handle the
30284 # wide variation of changes, but these tests here capture specs
30285 # deterministically.
30286 # ----------------------------------------------------------------
30287
30288 ## T90517
30289 !! test
30290 Selser: New comments should not be lost
30291 !! options
30292 parsoid={
30293 "modes": ["selser"],
30294 "changes": [
30295 [ "#a", "after", "<!--c1-->" ],
30296 [ "#b", "before", "<!--c2-->" ]
30297 ]
30298 }
30299 !! wikitext
30300 <span id="a">a</span>
30301
30302 <span id="b">b</span>
30303 !! wikitext/edited
30304 <span id="a">a</span><!--c1-->
30305
30306 <!--c2--><span id="b">b</span>
30307 !! end
30308
30309 ## T89383
30310 !! test
30311 Selser: Check for validity of DSR before using it
30312 !! options
30313 parsoid={
30314 "modes": ["selser"],
30315 "changes": [
30316 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
30317 ]
30318 }
30319 !! wikitext
30320 <span id="a">a</span>
30321 !! wikitext/edited
30322 {{DISPLAYTITLE:foo}}
30323 <span id="a">a</span>
30324 !! end
30325
30326 !! test
30327 1. DOMDiff: Changes to <ref> content should be looked up using id
30328 !! options
30329 parsoid={
30330 "modes": ["selser"],
30331 "changes": [
30332 ["#X", "after", "bar"],
30333 ["#Y", "after", "baz"]
30334 ]
30335 }
30336 !! wikitext
30337 X <ref><span id="X">foo</span></ref>
30338 Y <ref name="a" />
30339 <references>
30340 <ref name="a"><span id="Y">foo</span></ref>
30341 </references>
30342 !! wikitext/edited
30343 X <ref><span id="X">foo</span>bar</ref>
30344 Y <ref name="a" />
30345 <references>
30346 <ref name="a"><span id="Y">foo</span>baz</ref>
30347 </references>
30348 !! end
30349
30350 !! test
30351 2. DOMDiff: Changes to <ref> content should be looked up using id
30352 !! options
30353 parsoid={
30354 "modes": ["selser"],
30355 "changes": [
30356 ["#Z", "after", "bar"]
30357 ]
30358 }
30359 !! wikitext
30360 A <ref>foo bar for a</ref>
30361 B <ref group="X" name="b" />
30362
30363 <references />
30364
30365 <references group="X">
30366 <ref name="b"><span id="Z">foo</span></ref>
30367 </references>
30368 !! wikitext/edited
30369 A <ref>foo bar for a</ref>
30370 B <ref group="X" name="b" />
30371
30372 <references />
30373
30374 <references group="X">
30375 <ref name="b"><span id="Z">foo</span>bar</ref>
30376 </references>
30377 !! end
30378
30379 !! test
30380 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
30381 !! options
30382 parsoid={
30383 "modes": ["selser"],
30384 "changes": [
30385 [ "div:first-child", "text", "bar" ]
30386 ]
30387 }
30388 !! wikitext
30389 <div style="{{1x|color:red;}}%">foo</div>
30390 !! wikitext/edited
30391 <div style="{{1x|color:red;}}%">bar</div>
30392 !! end
30393
30394 !! test
30395 Empty LI (T49673)
30396 !! wikitext
30397 *a
30398 *
30399 *
30400 *b
30401 !! html+tidy
30402 <ul><li>a</li>
30403 <li class="mw-empty-elt"></li>
30404 <li class="mw-empty-elt"></li>
30405 <li>b</li></ul>
30406 !! end
30407
30408 !! test
30409 Thumbnail output
30410 !! wikitext
30411 [[File:Thumb.png|thumb]]
30412 !! html/php+tidy
30413 <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>
30414 !! html/parsoid
30415 <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>
30416 !! end
30417
30418 !! test
30419 unclosed internal link XSS (T137264)
30420 !! wikitext
30421 [[#%3Cscript%3Ealert(1)%3C/script%3E|
30422 !! html/php
30423 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
30424 </p>
30425 !! html/parsoid
30426 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
30427 !! end
30428
30429 !! test
30430 Validating that <style> isn't eaten by tidy (T167349)
30431 !! options
30432 styletag=1
30433 !! wikitext
30434 <div class="foo">
30435 <style>.foo::before { content: "<foo>"; }</style>
30436 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
30437 </div>
30438 !! html/php+tidy
30439 <div class="foo">
30440 <style>.foo::before { content: "<foo>"; }</style>
30441 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
30442 </div>
30443 !! end
30444
30445 !! test
30446 Validating that <style> isn't wrapped in a paragraph (T186965)
30447 !! options
30448 styletag=1
30449 !! wikitext
30450 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30451
30452 <style>.foo::before { content: "<foo>"; }</style>
30453
30454 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
30455
30456 But if it's on a line with other content, let it be wrapped.
30457
30458 <style>.foo::before { content: "<foo>"; }</style> bar
30459
30460 foo <style>.foo::before { content: "<foo>"; }</style>
30461
30462 foo <style>.foo::before { content: "<foo>"; }</style> bar
30463
30464 And the same if we have non-paragraph-breaking whitespace
30465
30466 foo
30467 <style>.foo::before { content: "<foo>"; }</style>
30468 bar
30469 !! html/php
30470 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30471 </p>
30472 <style>.foo::before { content: "<foo>"; }</style>
30473 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
30474 <p>But if it's on a line with other content, let it be wrapped.
30475 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
30476 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
30477 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
30478 </p><p>And the same if we have non-paragraph-breaking whitespace
30479 </p><p>foo
30480 <style>.foo::before { content: "<foo>"; }</style>
30481 bar
30482 </p>
30483 !! end
30484
30485 !! test
30486 Validating that <link> isn't wrapped in a paragraph (T186965)
30487 !! options
30488 styletag=1
30489 !! wikitext
30490 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30491
30492 <link rel="foo" href="bar"/>
30493
30494 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
30495
30496 But if it's on a line with other content, let it be wrapped.
30497
30498 <link rel="foo" href="bar"/> bar
30499
30500 foo <link rel="foo" href="bar"/>
30501
30502 foo <link rel="foo" href="bar"/> bar
30503
30504 And the same if we have non-paragraph-breaking whitespace
30505
30506 foo
30507 <link rel="foo" href="bar"/>
30508 bar
30509 !! html/php
30510 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30511 </p>
30512 <link rel="foo" href="bar"/>
30513 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
30514 <p>But if it's on a line with other content, let it be wrapped.
30515 </p><p><link rel="foo" href="bar"/> bar
30516 </p><p>foo <link rel="foo" href="bar"/>
30517 </p><p>foo <link rel="foo" href="bar"/> bar
30518 </p><p>And the same if we have non-paragraph-breaking whitespace
30519 </p><p>foo
30520 <link rel="foo" href="bar"/>
30521 bar
30522 </p>
30523 !! end
30524
30525 !! test
30526 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
30527 !! config
30528 wgFragmentMode=[ 'html5', 'legacy' ]
30529 !! wikitext
30530 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
30531 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
30532 !! html/php
30533 <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>
30534 <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>
30535 </p>
30536 !! html/parsoid
30537 <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>
30538 <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>
30539 !! end
30540
30541 !! test
30542 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
30543 !! config
30544 wgFragmentMode=[ 'legacy' ]
30545 !! wikitext
30546 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
30547 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
30548 !! html/php
30549 <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>
30550 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
30551 </p>
30552 !! end
30553
30554 !! test
30555 Decoding of HTML entities in embedded HTML tags
30556 !! wikitext
30557 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
30558 !! html/php
30559 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
30560
30561 !! html/parsoid
30562 <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>
30563 !! end
30564
30565 !! test
30566 Decoding of HTML entities in indicator names for IDs (T104196)
30567 !! options
30568 parsoid=wt2html,html2html
30569 showindicators
30570 !! wikitext
30571 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
30572 !! html/php
30573 1&2&3&amp;4&amp;amp;5=Indicator
30574
30575 !! html/parsoid
30576 <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>
30577 !! end
30578
30579 # this version of the test strips out the ambiguity so Parsoid rts cleanly
30580 !! test
30581 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
30582 !! options
30583 showindicators
30584 !! wikitext
30585 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
30586 !! html/php
30587 1&2&3&amp;4&amp;amp;5=Indicator
30588
30589 !! html/parsoid
30590 <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>
30591 !! end
30592
30593 # This fragment mode is what Parsoid supports.
30594 !! test
30595 HTML5 ids: fallback to legacy
30596 !! config
30597 wgFragmentMode=[ 'html5', 'legacy' ]
30598 !! wikitext
30599 ==Foo bar==
30600
30601 ==foo Bar==
30602
30603 ==Тест==
30604
30605 ==Тест==
30606
30607 ==тест==
30608
30609 ==Hey < # " > % : '==
30610 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30611
30612 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30613
30614 <!-- These two links should produce identical HTML -->
30615 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30616
30617 !! html/php
30618 <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>
30619 <ul>
30620 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30621 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30622 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30623 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30624 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30625 <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>
30626 </ul>
30627 </div>
30628
30629 <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>
30630 <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>
30631 <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>
30632 <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>
30633 <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>
30634 <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>
30635 <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>
30636 </p><p>💩 <span id="💩"></span>
30637 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30638 </p>
30639 !! html/parsoid
30640 <h2 id="Foo_bar">Foo bar</h2>
30641
30642 <h2 id="foo_Bar_2">foo Bar</h2>
30643
30644 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
30645
30646 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
30647
30648 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
30649
30650 <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>
30651 <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>
30652
30653 <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>
30654
30655 <!-- These two links should produce identical HTML -->
30656 <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>
30657 !! end
30658
30659 # Parsoid doesn't support this mode
30660 !! test
30661 HTML5 ids: legacy with a fallback to modern
30662 !! config
30663 wgFragmentMode=[ 'legacy', 'html5' ]
30664 !! wikitext
30665 ==Foo bar==
30666
30667 ==foo Bar==
30668
30669 ==Тест==
30670
30671 ==Тест==
30672
30673 ==тест==
30674
30675 ==Hey < # " > % : '==
30676 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30677
30678 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30679
30680 <!-- These two links should produce identical HTML -->
30681 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30682
30683 !! html/php
30684 <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>
30685 <ul>
30686 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30687 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30688 <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>
30689 <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>
30690 <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>
30691 <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>
30692 </ul>
30693 </div>
30694
30695 <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>
30696 <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>
30697 <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>
30698 <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>
30699 <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>
30700 <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>
30701 <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>
30702 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
30703 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
30704 </p>
30705 !! end
30706
30707 # Parsoid doesn't support this mode.
30708 !! test
30709 HTML5 ids: no legacy
30710 !! config
30711 wgFragmentMode=[ 'html5' ]
30712 !! wikitext
30713 ==Foo bar==
30714
30715 ==foo Bar==
30716
30717 ==Тест==
30718
30719 ==Тест==
30720
30721 ==тест==
30722
30723 ==Hey < # " > % : '==
30724 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30725
30726 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30727
30728 <!-- These two links should produce identical HTML -->
30729 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30730
30731 !! html/php
30732 <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>
30733 <ul>
30734 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30735 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30736 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30737 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30738 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30739 <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>
30740 </ul>
30741 </div>
30742
30743 <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>
30744 <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>
30745 <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>
30746 <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>
30747 <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>
30748 <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>
30749 <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>
30750 </p><p>💩 <span id="💩"></span>
30751 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30752 </p>
30753 !! end
30754
30755 !! test
30756 T90902: Normalize weird characters in section IDs
30757 !! config
30758 wgFragmentMode=[ 'html5', 'legacy' ]
30759 !! wikitext
30760 ==Foo&nbsp;bar==
30761 [[#Foo&nbsp;bar]]
30762
30763 !! html/php
30764 <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>
30765 <p><a href="#Foo_bar">#Foo&#160;bar</a>
30766 </p>
30767 !! html/parsoid
30768 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
30769 <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>
30770 !! end
30771
30772 !! test
30773 T51672: Test for brackets in attributes of elements in external link texts
30774 !! wikitext
30775 [http://example.com/ link <span title="title with [brackets]">span</span>]
30776 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
30777
30778 !! html/php
30779 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
30780 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
30781 </p>
30782 !! html/parsoid
30783 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
30784 <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>
30785 !! end
30786
30787 !! test
30788 T72875: Test for brackets in attributes of elements in internal link texts
30789 !! wikitext
30790 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
30791 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
30792
30793 !! html/php
30794 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30795 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30796 </p>
30797 !! html/parsoid
30798 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
30799 <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>
30800 !! end
30801
30802 !! test
30803 T179544: {{anchorencode:}} output should be always usable in links
30804 !! config
30805 wgFragmentMode=[ 'html5' ]
30806 !! wikitext
30807 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
30808 !! html/php
30809 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
30810 </p>
30811 !! html/parsoid
30812 <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>
30813 !! end
30814
30815 ## ------------------------------
30816 ## Parsoid section-wrapping tests
30817 ## ------------------------------
30818 !! test
30819 Section wrapping for well-nested sections (no leading content)
30820 !! options
30821 parsoid={
30822 "wrapSections": true
30823 }
30824 !! wikitext
30825 =1=
30826 a
30827
30828 =2=
30829 b
30830
30831 ==2.1==
30832 c
30833
30834 ==2.2==
30835 d
30836
30837 ===2.2.1===
30838 e
30839
30840 =3=
30841 f
30842 !! html/parsoid
30843 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30844 <p>a</p>
30845
30846 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30847 <p>b</p>
30848
30849 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30850 <p>c</p>
30851
30852 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
30853 <p>d</p>
30854
30855 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
30856 <p>e</p>
30857
30858 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
30859 <p>f</p>
30860
30861 </section>
30862 !! end
30863
30864 !! test
30865 Section wrapping for well-nested sections (with leading content)
30866 !! options
30867 parsoid={
30868 "wrapSections": true
30869 }
30870 !! wikitext
30871 Para 1.
30872
30873 Para 2 with a <div>nested in it</div>
30874
30875 Para 3.
30876
30877 =1=
30878 a
30879
30880 =2=
30881 b
30882
30883 ==2.1==
30884 c
30885 !! html/parsoid
30886 <section data-mw-section-id="0"><p>Para 1.</p>
30887
30888 <p>Para 2 with a </p><div>nested in it</div>
30889
30890 <p>Para 3.</p>
30891
30892 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30893 <p>a</p>
30894
30895 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30896 <p>b</p>
30897
30898 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30899 <p>c</p>
30900
30901 </section></section>
30902 !! end
30903
30904 !! test
30905 Section wrapping with template-generated sections (good nesting 1)
30906 !! options
30907 parsoid={
30908 "wrapSections": true
30909 }
30910 !! wikitext
30911 =1=
30912 a
30913
30914 {{echo|1=
30915 ==1.1==
30916 b
30917 }}
30918
30919 ==1.2==
30920 c
30921
30922 =2=
30923 d
30924 !! html/parsoid
30925 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30926 <p>a</p>
30927
30928 <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">
30929 </span><p about="#mwt1">b</p>
30930 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
30931 <p>c</p>
30932
30933 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
30934 <p>d</p></section>
30935 !! end
30936
30937 # In this example, the template scope is mildly expanded to incorporate the
30938 # trailing newline after the transclusion since that is part of section 1.1.1
30939 !! test
30940 Section wrapping with template-generated sections (good nesting 2)
30941 !! options
30942 parsoid={
30943 "wrapSections": true,
30944 "modes": ["wt2html", "wt2wt"]
30945 }
30946 !! wikitext
30947 =1=
30948 a
30949
30950 {{echo|1=
30951 ==1.1==
30952 b
30953 ===1.1.1===
30954 d
30955 }}
30956 =2=
30957 e
30958 !! html/parsoid
30959 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30960 <p>a</p>
30961
30962 <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">
30963 </span><p about="#mwt1">b</p><span about="#mwt1">
30964 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
30965 </span><p about="#mwt1">d</p><span about="#mwt1">
30966 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
30967 <p>e</p></section>
30968 !! end
30969
30970 # In this example, the template scope is mildly expanded to incorporate the
30971 # trailing newline after the transclusion since that is part of section 1.2.1
30972 !! test
30973 Section wrapping with template-generated sections (good nesting 3)
30974 !! options
30975 parsoid={
30976 "wrapSections": true,
30977 "modes": ["wt2html", "wt2wt"]
30978 }
30979 !! wikitext
30980 =1=
30981 a
30982
30983 {{echo|1=
30984 x
30985 ==1.1==
30986 b
30987 ==1.2==
30988 c
30989 ===1.2.1===
30990 d
30991 }}
30992 =2=
30993 e
30994 !! html/parsoid
30995 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
30996 <p>a</p>
30997
30998 <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">
30999 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
31000 </span><p about="#mwt1">b</p><span about="#mwt1">
31001 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
31002 </span><p about="#mwt1">c</p><span about="#mwt1">
31003 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
31004 </span><p about="#mwt1">d</p><span about="#mwt1">
31005 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
31006 <p>e</p></section>
31007 !! end
31008
31009 # Because of section-wrapping and template-wrapping interactions,
31010 # the scope of the template is expanded so that the template markup
31011 # is valid in the presence of <section> tags.
31012 # This exercises the s1 is null scenario in the wrapSections code
31013 !! test
31014 Section wrapping with template-generated sections (bad nesting 1)
31015 !! options
31016 parsoid={
31017 "wrapSections": true
31018 }
31019 !! wikitext
31020 <div>
31021 a
31022
31023 {{echo|
31024 =1=
31025 b
31026 }}
31027
31028 c
31029 </div>
31030 !! html/parsoid
31031 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
31032 <p>a</p>
31033
31034 <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"]}'>
31035 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
31036 </span><p about="#mwt1">b
31037 </p><span about="#mwt1">
31038
31039 </span><p about="#mwt1">c</p><span about="#mwt1">
31040 </span></section></div></section>
31041 !! end
31042
31043 # Because of section-wrapping and template-wrapping interactions,
31044 # the scope of the template is expanded so that the template markup
31045 # is valid in the presence of <section> tags.
31046 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
31047 !! test
31048 Section wrapping with template-generated sections (bad nesting 2)
31049 !! options
31050 parsoid={
31051 "wrapSections": true
31052 }
31053 !! wikitext
31054 =1=
31055 a
31056
31057 {{echo|1=
31058 =2=
31059 b
31060 ==2.1==
31061 c
31062 }}
31063
31064 d
31065
31066 =3=
31067 e
31068 !! html/parsoid
31069 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31070 <p>a</p>
31071
31072 </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">
31073 </span><p about="#mwt1">b</p><span about="#mwt1">
31074 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
31075 </span><p about="#mwt1">c</p><span about="#mwt1">
31076
31077 </span><p about="#mwt1">d</p><span about="#mwt1">
31078
31079 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
31080 <p>e</p></section>
31081 !! end
31082
31083 # Because of section-wrapping and template-wrapping interactions,
31084 # additional template wrappers are added to <section> tags
31085 # so that template wrapping semantics are valid whether section
31086 # tags are retained or stripped. But, the template scope can expand
31087 # greatly when accounting for section tags.
31088 # This exercises the s1 and s2 are in different subtrees scenario
31089 !! test
31090 Section wrapping with template-generated sections (bad nesting 3)
31091 !! options
31092 parsoid={
31093 "wrapSections": true,
31094 "modes": ["wt2html", "wt2wt"]
31095 }
31096 !! wikitext
31097 =1=
31098 a
31099
31100 {{echo|1=
31101 ==1.2==
31102 b
31103 =2=
31104 c
31105 }}
31106
31107 d
31108
31109 =3=
31110 e
31111 !! html/parsoid
31112 <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>
31113 <p>a</p>
31114
31115 <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">
31116 </span><p about="#mwt1">b</p><span about="#mwt1">
31117 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
31118 </span><p about="#mwt1">c</p>
31119
31120 <p>d</p>
31121 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
31122 <p>e</p></section>
31123 !! end
31124
31125 !! test
31126 Section wrapping with uneditable lead section + div wrapping multiple sections
31127 !! options
31128 parsoid={
31129 "wrapSections": true
31130 }
31131 !! wikitext
31132 foo
31133
31134 <div style="border:1px solid red;">
31135 =1=
31136 a
31137
31138 ==1.1==
31139 b
31140
31141 =2=
31142 c
31143 </div>
31144
31145 =3=
31146 d
31147
31148 ==3.1==
31149 e
31150 !! html/parsoid
31151 <section data-mw-section-id="-1"><p>foo</p>
31152
31153 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31154 <section data-mw-section-id="1"><h1 id="1">1</h1>
31155 <p>a</p>
31156
31157 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31158 <p>b</p>
31159
31160 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31161 <p>c</p>
31162 </section></div>
31163
31164 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31165 <p>d</p>
31166
31167 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31168 <p>e</p>
31169 </section></section>
31170 !! end
31171
31172 !! test
31173 Section wrapping with editable lead section + div overlapping multiple sections
31174 !! options
31175 parsoid={
31176 "wrapSections": true
31177 }
31178 !! wikitext
31179 foo
31180
31181 =1=
31182 a
31183 <div style="border:1px solid red;">
31184 b
31185
31186 ==1.1==
31187 c
31188
31189 =2=
31190 d
31191 </div>
31192 e
31193
31194 =3=
31195 f
31196
31197 ==3.1==
31198 g
31199 !! html/parsoid
31200 <section data-mw-section-id="0"><p>foo</p>
31201
31202 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
31203 <p>a</p>
31204 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31205 <p>b</p>
31206
31207 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31208 <p>c</p>
31209
31210 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31211 <p>d</p>
31212 </section></div>
31213 <p>e</p>
31214
31215 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31216 <p>f</p>
31217
31218 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31219 <p>g</p>
31220 </section></section>
31221 !! end
31222
31223 !! test
31224 HTML header tags should not be wrapped in section tags
31225 !! options
31226 parsoid={
31227 "wrapSections": true
31228 }
31229 !! wikitext
31230 foo
31231
31232 <h1>a</h1>
31233
31234 =b=
31235
31236 <h1>c</h1>
31237
31238 =d=
31239 !! html/parsoid
31240 <section data-mw-section-id="0"><p>foo</p>
31241
31242 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
31243
31244 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
31245
31246 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
31247
31248 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
31249 !! end
31250
31251 !! test
31252 Lead section containing only whitespace and comments.
31253 !! options
31254 parsoid={
31255 "wrapSections": true
31256 }
31257 !! wikitext
31258
31259 <!-- this is a comment, presumably significant to editors -->
31260 =1=
31261 a
31262
31263 =2=
31264 b
31265 !! html/parsoid
31266 <section data-mw-section-id="0" data-parsoid="{}">
31267 <!-- this is a comment, presumably significant to editors -->
31268 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
31269 <p>a</p>
31270
31271 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31272 <p>b</p></section>
31273 !! end
31274
31275 !! test
31276 Pseudo-sections emitted by templates should have id -2
31277 !! options
31278 parsoid={
31279 "wrapSections": true
31280 }
31281 !! wikitext
31282 foo
31283 {{echo|<div>
31284 ==a==
31285 ==b==
31286 </div>
31287 }}
31288 !! html/parsoid
31289 <section data-mw-section-id="-1"><p>foo</p>
31290 </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}}]}'>
31291 <section data-mw-section-id="-1"><h2 id="a">a</h2>
31292 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
31293 </section></div><span about="#mwt1">
31294 </span></section>
31295 !! end
31296
31297 ##########################################################################
31298 Tests demonstrating white-space insensitivity in input wikitext
31299 for wikitext headings, wikitext list items, and wikitext table captions,
31300 headings, and cells. HTML versions of the same should preserve whitespace.
31301 ##########################################################################
31302 !! test
31303 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
31304 !! options
31305 parsoid={
31306 "modes": ["wt2html"],
31307 "preserveIEW": true
31308 }
31309 !! wikitext
31310 __NOTOC__
31311 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
31312 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
31313 == <!--Headings with fallback ids--> Личная жизнь ==
31314 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
31315 ; <!--term to define--> term : <!--term's definition--> definition
31316 {|
31317 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
31318 |-
31319 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
31320 |-
31321 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31322 |-
31323 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
31324 |-
31325 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
31326 |}
31327 : {|
31328 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31329 |} foo <!--c1-->
31330 !! html/php+tidy
31331 <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>
31332 <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>
31333 <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>
31334 <ul><li>List item</li></ul>
31335 <dl><dt>term&#160;</dt>
31336 <dd>definition</dd></dl>
31337 <table>
31338 <caption>Table Caption
31339 </caption>
31340 <tbody><tr>
31341 <th>Table Heading 1</th>
31342 <th>Table Heading 2
31343 </th></tr>
31344 <tr>
31345 <td>Table Cell 1</td>
31346 <td>Table Cell 2
31347 </td></tr>
31348 <tr>
31349 <td>class="foo"</td>
31350 <td>Table Cell 3
31351 </td></tr>
31352 <tr>
31353 <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
31354 </td></tr></tbody></table>
31355 <dl><dd><table>
31356 <tbody><tr>
31357 <td>Table Cell 1</td>
31358 <td>Table Cell 2
31359 </td></tr></tbody></table> foo</dd></dl>
31360 !! html/parsoid
31361 <meta property="mw:PageProp/notoc">
31362 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
31363 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
31364 <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>
31365 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
31366 <dl><dt><!--term to define-->term&nbsp;</dt><dd><!--term's definition-->definition</dd></dl>
31367 <table>
31368 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
31369 <tbody><tr>
31370 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th>Table Heading 2<!--c5--></th></tr>
31371 <tr>
31372 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31373 <tr>
31374 <td>class="foo"</td><td><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
31375 <tr>
31376 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One">two</a> <!--c2--> | <!--c3--> some content</td></tr>
31377 </tbody></table>
31378 <dl><dd><table>
31379 <tbody><tr><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31380 </tbody></table><p> foo </p><!--c1--></dd></dl>
31381 !! end
31382
31383 # Looks like <caption> is not accepted in HTML
31384 !! test
31385 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
31386 !! options
31387 parsoid={
31388 "modes": ["wt2html"],
31389 "preserveIEW": true
31390 }
31391 !! wikitext
31392 __NOTOC__
31393 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
31394 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
31395 <table>
31396 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
31397 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
31398 </table>
31399 !! html/php+tidy
31400 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
31401 <ul><li> List item </li></ul>
31402 <table>
31403 <tbody><tr><th> Table Heading </th><th></th></tr>
31404 <tr><td> Table Cell </td><th></th></tr>
31405 </tbody></table>
31406 !! html/parsoid
31407 <meta property="mw:PageProp/notoc"/>
31408 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
31409 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
31410 <table>
31411 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
31412 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
31413 </tbody></table>
31414 !! end
31415
31416 !! test
31417 Do not trim whitespace in links and quotes
31418 !! options
31419 parsoid={
31420 "modes": ["wt2html"],
31421 "preserveIEW": true
31422 }
31423 !! wikitext
31424 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
31425 [[Foo| some text ]]
31426 !! html/php+tidy
31427 <p>foo <i> italic </i> and <b> bold </b>
31428 <a href="/wiki/Foo" title="Foo"> some text </a>
31429 </p>
31430 !! html/parsoid
31431 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
31432 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
31433 !! end
31434
31435 !! test
31436 Remove p tags surrounding a single element in a figcaption
31437 !! options
31438 parsoid=html2wt
31439 !! wikitext
31440 [[File:Foobar.jpg|right|200x200px|Caption]]
31441 !! html/parsoid
31442 <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>
31443 !! end
31444
31445 !! test
31446 Selser preserves lack of newline before list and allows newline after the list
31447 !! options
31448 parsoid={
31449 "modes": ["selser"],
31450 "scrubWikitext": true,
31451 "changes": [
31452 [ "ul", "after", "<p>footer</p>" ]
31453 ]
31454 }
31455 !! wikitext
31456 header
31457 *foo
31458 *bar
31459 !! wikitext/edited
31460 header
31461 *foo
31462 *bar
31463
31464 footer
31465 !! end
31466
31467
31468 !! test
31469 Selser does not introduce newlines between unedited paragraph preceding the list
31470 !! options
31471 parsoid={
31472 "modes": ["selser"],
31473 "changes": [
31474 [ "table tbody tr td p:last-child", "empty" ]
31475 ]
31476 }
31477 !! wikitext
31478 {|
31479 |
31480 header
31481 *foo
31482 *bar
31483 footer
31484 |}
31485 !! wikitext/edited
31486 {|
31487 |
31488 header
31489 *foo
31490 *bar
31491
31492 |}
31493 !! end
31494
31495 !! test
31496 Selser does not introduce newlines between unedited paragraph following the list
31497 !! options
31498 parsoid={
31499 "modes": ["selser"],
31500 "changes": [
31501 [ "table tbody tr td p:first-child", "empty" ]
31502 ]
31503 }
31504 !! wikitext
31505 {|
31506 |
31507 header
31508 *foo
31509 *bar
31510 footer
31511 |}
31512 !! wikitext/edited
31513 {|
31514 |
31515
31516 *foo
31517 *bar
31518 footer
31519 |}
31520 !! end
31521
31522 !! test
31523 Remove a list item but do not insert newline above list
31524 !! options
31525 parsoid={
31526 "modes": ["selser"],
31527 "changes": [
31528 [ "ul li:last-child", "remove" ]
31529 ]
31530 }
31531 !! wikitext
31532 header
31533 *foo
31534 *bar
31535 footer
31536 !! wikitext/edited
31537 header
31538 *foo
31539 footer
31540 !! end