e06a7320003c1344f26974a27301ac232eaa0798
[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 ###
2276 ### Preformatted text
2277 ###
2278
2279 !! test
2280 Preformatted text
2281 !! wikitext
2282 This is some
2283 Preformatted text
2284 With ''italic''
2285 And '''bold'''
2286 And a [[Main Page|link]]
2287 !! html
2288 <pre>This is some
2289 Preformatted text
2290 With <i>italic</i>
2291 And <b>bold</b>
2292 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2293 </pre>
2294 !! end
2295
2296 !! test
2297 Tabs don't trigger preformatted text
2298 !! wikitext
2299 This is not
2300 preformatted text.
2301 This is preformatted text.
2302 So is this.
2303 !! html/php
2304 <p> This is not
2305 preformatted text.
2306 </p>
2307 <pre>This is preformatted text.
2308 So is this.
2309 </pre>
2310 !! html/parsoid
2311 <p> This is not
2312 preformatted text.</p>
2313 <pre>This is preformatted text.
2314 So is this.</pre>
2315 !! end
2316
2317 !! test
2318 Space before tab needs nowiki pre protection
2319 !! options
2320 parsoid=html2wt
2321 !! html/parsoid
2322 <p> a</p>
2323 !! wikitext
2324 <nowiki> </nowiki> a
2325 !! end
2326
2327 !! test
2328 Ident preformatting with inline content
2329 !! wikitext
2330 a
2331 ''b''
2332 !! html
2333 <pre>a
2334 <i>b</i>
2335 </pre>
2336 !! end
2337
2338 !! test
2339 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2340 !! wikitext
2341 <pre><nowiki>
2342 <b>
2343 <cite>
2344 <em>
2345 </nowiki></pre>
2346 !! html
2347 <pre>
2348 &lt;b&gt;
2349 &lt;cite&gt;
2350 &lt;em&gt;
2351 </pre>
2352
2353 !! end
2354
2355 !! test
2356 Regression with preformatted in <center>
2357 !! wikitext
2358 <center>
2359 Blah
2360 </center>
2361 !! html
2362 <center>
2363 <pre>Blah
2364 </pre>
2365 </center>
2366
2367 !! end
2368
2369 !! test
2370 T54763: Preformatted in <blockquote>
2371 !! wikitext
2372 <blockquote>
2373 Blah
2374 {|
2375 |
2376 indented cell (no pre-wrapping!)
2377 |}
2378 </blockquote>
2379 !! html
2380 <blockquote>
2381 <p> Blah
2382 </p>
2383 <table>
2384 <tr>
2385 <td>
2386 <p> indented cell (no pre-wrapping!)
2387 </p>
2388 </td></tr></table>
2389 </blockquote>
2390
2391 !! end
2392
2393 !! test
2394 T53086: Double newlines in blockquotes should be turned into paragraphs
2395 !! wikitext
2396 <blockquote>
2397 Foo
2398
2399 Bar
2400 </blockquote>
2401 !! html
2402 <blockquote>
2403 <p>Foo
2404 </p><p>Bar
2405 </p>
2406 </blockquote>
2407
2408 !! end
2409
2410 !! test
2411 T17491: <ins>/<del> in blockquote
2412 !! wikitext
2413 <blockquote>
2414 Foo <del>bar</del> <ins>baz</ins> quux
2415 </blockquote>
2416 !! html
2417 <blockquote>
2418 <p>Foo <del>bar</del> <ins>baz</ins> quux
2419 </p>
2420 </blockquote>
2421
2422 !! end
2423
2424 !! test
2425 T17491: <ins>/<del> in blockquote (2)
2426 !! wikitext
2427 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2428 </blockquote>
2429 !! html
2430 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2431 </blockquote>
2432
2433 !! html+tidy
2434 <blockquote><p>Foo </p><del>bar</del> <ins>baz</ins><p> quux
2435 </p></blockquote>
2436 !! end
2437
2438 !! test
2439 <pre> with attributes (T5202)
2440 !! wikitext
2441 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2442 !! html
2443 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2444
2445 !! end
2446
2447 !! test
2448 <pre> with width attribute (T5202)
2449 !! wikitext
2450 <pre width="8">Narrow screen goodies</pre>
2451 !! html
2452 <pre width="8">Narrow screen goodies</pre>
2453
2454 !! end
2455
2456 !! test
2457 <pre> with forbidden attribute (T5202)
2458 !! wikitext
2459 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2460 !! html
2461 <pre width="8">Narrow screen goodies</pre>
2462
2463 !! end
2464
2465 !! test
2466 Entities inside <pre>
2467 !! wikitext
2468 <pre>&lt;</pre>
2469 !! html
2470 <pre>&lt;</pre>
2471
2472 !! end
2473
2474 !! test
2475 <pre> with forbidden attribute values (T5202)
2476 !! wikitext
2477 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2478 !! html
2479 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2480
2481 !! end
2482
2483 !! test
2484 <nowiki> inside <pre> (T15238)
2485 !! wikitext
2486 <pre>
2487 <nowiki>
2488 </pre>
2489 <pre>
2490 <nowiki></nowiki>
2491 </pre>
2492 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2493 !! html
2494 <pre>
2495 &lt;nowiki&gt;
2496 </pre>
2497 <pre>
2498
2499 </pre>
2500 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2501
2502 !! end
2503
2504 !! test
2505 <nowiki> inside of #tag:pre
2506 !! wikitext
2507 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2508 !! html/php
2509 <pre>Foo &#8594;bar</pre>
2510
2511 !! html/parsoid
2512 <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>
2513 !! end
2514
2515 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2516 ## aren't enclosed in nowikis.
2517 !! test
2518 <nowiki> and <pre> preference (first one wins)
2519 !! options
2520 parsoid=wt2html
2521 !! wikitext
2522 <pre>
2523 <nowiki>
2524 </pre>
2525 </nowiki>
2526 </pre>
2527
2528 <nowiki>
2529 <pre>
2530 <nowiki>
2531 </pre>
2532 </nowiki>
2533 </pre>
2534
2535 !! html/php
2536 <pre>
2537 &lt;nowiki&gt;
2538 </pre>
2539 <p>&lt;/nowiki&gt;
2540 &lt;/pre&gt;
2541 </p><p>
2542 &lt;pre&gt;
2543 &lt;nowiki&gt;
2544 &lt;/pre&gt;
2545
2546 &lt;/pre&gt;
2547 </p>
2548 !! html/parsoid
2549 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2550 </pre>
2551 <p>&lt;/nowiki></p>
2552
2553
2554 <p><span typeof="mw:Nowiki">
2555 &lt;pre>
2556 &lt;nowiki>
2557 &lt;/pre>
2558 </span></p>
2559 !! end
2560
2561 !! test
2562 </pre> inside nowiki
2563 !! wikitext
2564 <nowiki></pre></nowiki>
2565 !! html
2566 <p>&lt;/pre&gt;
2567 </p>
2568 !! end
2569
2570 !! test
2571 Empty pre; pre inside other HTML tags (T56946)
2572 !! wikitext
2573 a
2574
2575 <div><pre>
2576 foo
2577 </pre></div>
2578 <pre></pre>
2579 !! html/php+tidy
2580 <p>a
2581 </p>
2582 <div><pre>foo
2583 </pre></div>
2584 <pre></pre>
2585 !! html/parsoid
2586 <p>a</p>
2587
2588 <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
2589 </pre></div>
2590 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2591 !! end
2592
2593 !! test
2594 HTML pre followed by indent-pre
2595 !! wikitext
2596 <pre>foo</pre>
2597 bar
2598 !! html
2599 <pre>foo</pre>
2600 <pre>bar
2601 </pre>
2602 !! end
2603
2604 !! test
2605 Block tag pre
2606 !! wikitext
2607 <p><pre>foo</pre></p>
2608 !! html/php+tidy
2609 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2610 !! html/parsoid
2611 <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>
2612 !! end
2613
2614 !!test
2615 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2616 !! wikitext
2617 {{echo|}}
2618 !! html
2619
2620 !!end
2621
2622 !!test
2623 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2624 !! wikitext
2625 {{echo|
2626 foo}}
2627 !! html
2628 <p>foo
2629 </p>
2630 !!end
2631
2632 !! test
2633 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2634 !! wikitext
2635 {{echo|a
2636 b}}
2637 !! html
2638 <pre>a
2639 </pre>
2640 <p>b
2641 </p>
2642 !!end
2643
2644 !! test
2645 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2646 !! wikitext
2647 {{echo|a
2648 b
2649 c
2650 d
2651 e
2652 }}
2653 !! html
2654 <pre>a
2655 </pre>
2656 <p>b
2657 c
2658 </p>
2659 <pre>d
2660 </pre>
2661 <p>e
2662 </p>
2663 !!end
2664
2665 !!test
2666 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2667 !! wikitext
2668 {{echo| foo}}
2669
2670 {{echo| foo}}{{echo| bar}}
2671
2672 {{echo| foo}}
2673 {{echo| bar}}
2674
2675 {{echo|<!--cmt--> foo}}
2676
2677 <!--cmt-->{{echo| foo}}
2678
2679 {{echo|{{echo| }}bar}}
2680 !! html
2681 <pre>foo
2682 </pre>
2683 <pre>foo bar
2684 </pre>
2685 <pre>foo
2686 bar
2687 </pre>
2688 <pre>foo
2689 </pre>
2690 <pre>foo
2691 </pre>
2692 <pre>bar
2693 </pre>
2694 !!end
2695
2696 !! test
2697 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2698 !! wikitext
2699 {{echo| }}a
2700
2701 {{echo|
2702 }}a
2703
2704 {{echo|
2705 b}}
2706
2707 {{echo|a
2708 }}b
2709
2710 {{echo|a
2711 }} b
2712 !! html
2713 <pre>a
2714 </pre>
2715 <p><br />
2716 </p>
2717 <pre>a
2718 </pre>
2719 <p><br />
2720 </p>
2721 <pre>b
2722 </pre>
2723 <p>a
2724 </p>
2725 <pre>b
2726 </pre>
2727 <p>a
2728 </p>
2729 <pre>b
2730 </pre>
2731 !!end
2732
2733 ## Hmm, should Parsoid rt this?
2734 !! test
2735 Pres with newline attributes
2736 !! options
2737 parsoid=wt2html,html2html
2738 !! wikitext
2739 <pre class="one
2740 two">hi</pre>
2741 !! html/php
2742 <pre class="one two">hi</pre>
2743
2744 !! html/parsoid
2745 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2746 !! end
2747
2748 !! test
2749 Things that look like <pre> tags aren't treated as such
2750 !! wikitext
2751 Barack Obama <President> of the United States
2752 <President></President>
2753 !! html
2754 <p>Barack Obama &lt;President&gt; of the United States
2755 &lt;President&gt;&lt;/President&gt;
2756 </p>
2757 !! end
2758
2759 !! test
2760 Handle broken pre-like tags (T66025)
2761 !! options
2762 parsoid=wt2html
2763 !! wikitext
2764 {{echo|<pre <pre>x</pre>}}
2765
2766 <table><pre </table>
2767 !! html/php
2768 <pre>x</pre>
2769 <table>&lt;pre </table>
2770
2771 !! html/php+tidy
2772 <pre>x</pre>
2773 &lt;pre <table></table>
2774 !! html/parsoid
2775 <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>
2776
2777 <span data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>&lt;pre </span><table data-parsoid='{"stx":"html"}'></table>
2778 !! end
2779
2780 !! test
2781 Parsoid: handle pre with space after attribute
2782 !! options
2783 parsoid=wt2html
2784 !! wikitext
2785 <pre style="width:50%;" >{{echo|foo}}</pre>
2786 !! html/php
2787 <pre style="width:50%;">{{echo|foo}}</pre>
2788
2789 !! html/parsoid
2790 <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>
2791 !! end
2792
2793 # TODO / maybe: fix wt2wt for this
2794 !! test
2795 Parsoid: Don't paragraph-wrap fosterable content
2796 !! options
2797 parsoid=wt2html
2798 !! wikitext
2799 {|
2800 <td></td>
2801 <td></td>
2802
2803
2804
2805 |}
2806 !! html
2807 <table>
2808
2809 <tbody>
2810 <tr>
2811 <td></td>
2812
2813 <td></td></tr>
2814
2815
2816
2817 </tbody></table>
2818 !! end
2819
2820 !! test
2821 Self-closed pre
2822 !! wikitext
2823 <pre />
2824 !! html/php
2825 <pre></pre>
2826
2827 !! html/parsoid
2828 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":null}'></pre>
2829 !! end
2830
2831 !! test
2832 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2833 !! options
2834 parsoid=wt2html
2835 !! wikitext
2836 {|
2837 <td>
2838 <td>
2839 </td>
2840
2841
2842
2843 |}
2844 !! html
2845 <table>
2846
2847 <tbody>
2848 <tr>
2849 <td></td>
2850
2851 <td>
2852 </td></tr>
2853
2854
2855
2856 </tbody></table>
2857 !! end
2858
2859
2860 #--------------------------------------------------------------------
2861 # Transclusion parameter whitespace stripping tests
2862 # Behavior is different for positional and named parameters
2863 #--------------------------------------------------------------------
2864 !! test
2865 Templates: Strip leading and trailing whitespace from named-param values
2866 !! wikitext
2867 {{echo|1= a }}
2868
2869 {{echo|1= {{echo|b}} }}
2870
2871 {{echo| 1 =
2872 c }}
2873
2874 {{echo| 1 =
2875 * d
2876 }}
2877 !! html
2878 <p>a
2879 </p><p>b
2880 </p><p>c
2881 </p>
2882 <ul><li>d</li></ul>
2883
2884 !! end
2885
2886 !! test
2887 Templates: Don't strip whitespace from positional-param values
2888 !! wikitext
2889 {{echo|a }}
2890
2891 {{echo|{{echo|b}} }}
2892
2893 {{echo| c
2894 }}
2895
2896 {{echo| {{echo|d}}
2897 }}
2898
2899 {{echo|
2900 e}}
2901
2902 {{echo|
2903 *f}}
2904
2905 {{echo|
2906 }}g
2907 !! html
2908 <p>a
2909 </p><p>b
2910 </p>
2911 <pre>c
2912 </pre>
2913 <p><br />
2914 </p>
2915 <pre>d
2916 </pre>
2917 <p><br />
2918 </p>
2919 <pre>e
2920 </pre>
2921 <p><br />
2922 </p>
2923 <ul><li>f</li></ul>
2924 <p><br />
2925 </p>
2926 <pre>g
2927 </pre>
2928 !! end
2929
2930 !! test
2931 Templates: Don't recognize targets split by newlines
2932 !! options
2933 parsoid=wt2html
2934 !! wikitext
2935 {{ech
2936 o|foo}}
2937 !! html/php
2938 <p>{{ech
2939 o|foo}}
2940 </p>
2941 !! html/parsoid
2942 <p>{{ech
2943 o|foo}}</p>
2944 !! end
2945
2946 !! test
2947 Templates: Recognize targets when newlines and comments don't split the target
2948 !! options
2949 parsoid=wt2html
2950 !! wikitext
2951 {{
2952 <!--X--> ech<!--X-->o<!--X-->
2953 <!--X--> <!--X-->
2954
2955 |foo}}
2956 !! html/php
2957 <p>foo
2958 </p>
2959 !! html/parsoid
2960 <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>
2961 !! end
2962
2963 !! test
2964 Templates: Handle empty comment-and-ws-only lines correctly
2965 !! wikitext
2966 {{echo|foo
2967 <!--should be ignored-->
2968 <!--should be ignored as well-->
2969 bar}}
2970 !! html/php
2971 <p>foo
2972 bar
2973 </p>
2974 !! html/parsoid
2975 <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>
2976 !! end
2977
2978 !! test
2979 Templates: Handle comments in the target
2980 !! wikitext
2981 {{echo
2982 <!-- should be ignored -->
2983 |foo}}
2984
2985 {{echo
2986 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2987 |foo}}
2988
2989 {{echo<!-- should be ignored -->
2990 |foo}}
2991
2992 {{echo<!-- should be ignored -->|foo}}
2993
2994 {{<!-- should be ignored -->echo|foo}}
2995 !! html/php
2996 <p>foo
2997 </p><p>foo
2998 </p><p>foo
2999 </p><p>foo
3000 </p><p>foo
3001 </p>
3002 !! html/parsoid
3003 <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>
3004
3005 <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>
3006
3007 <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>
3008
3009 <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>
3010
3011 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3012 !! end
3013
3014 !! test
3015 Templates: Handle comments in parameter names (T69657)
3016 !! wikitext
3017 {{echo|1
3018 <!-- should be ignored -->
3019 =foo}}
3020
3021 {{echo|
3022 <!-- should be ignored -->
3023 1 = foo}}
3024
3025 {{echo|1<!-- should be ignored -->=foo}}
3026
3027 {{echo|<!-- should be ignored -->1=foo}}
3028 !! html/php
3029 <p>foo
3030 </p><p>foo
3031 </p><p>foo
3032 </p><p>foo
3033 </p>
3034 !! html/parsoid
3035 <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>
3036
3037 <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>
3038
3039 <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>
3040
3041 <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>
3042 !! end
3043
3044 !! test
3045 Templates: Other wikitext in parameter names (T69657)
3046 !! wikitext
3047 {{echo|''1''=foo}}
3048 !! html/php
3049 <p>{{{1}}}
3050 </p>
3051 !! html/parsoid
3052 <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>
3053 !! end
3054
3055 !! test
3056 Templates: With colons
3057 !! wikitext
3058 {{With: Colon}}
3059 !! html/php
3060 <p>Template with colon
3061 </p>
3062 !! html/parsoid
3063 <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>
3064 !! end
3065
3066 #--------------------------------------------------------------------
3067 # Transclusion parameter escaping tests
3068 #--------------------------------------------------------------------
3069
3070 !! test
3071 Templates: Parsoid parameter escaping test 1
3072 !! wikitext
3073 {{echo|[foo]|{{echo|[bar]}}}}
3074 !! html/php+tidy
3075 <p>[foo]
3076 </p>
3077 !! html/parsoid
3078 <p about="#mwt1" typeof="mw:Transclusion"
3079 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
3080 !! end
3081
3082 !! test
3083 Parsoid: Pipes in external links in template parameter
3084 !! wikitext
3085 {{echo|[{{echo|http://example.com}} link]}}
3086 !! html/php+tidy
3087 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
3088 </p>
3089 !! html/parsoid
3090 <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>
3091 !! end
3092
3093 !! test
3094 Parsoid: pipe in transclusion parameter
3095 !! wikitext
3096 {{echo|http://foo.com/a&#124;b}}
3097 !! html/php+tidy
3098 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
3099 </p>
3100 !! html/parsoid
3101 <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>
3102 !! end
3103
3104 !! test
3105 Parsoid: Pipe in external link target and content in template parameter
3106 !! options
3107 parsoid=html2wt,wt2wt
3108 !! wikitext
3109 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
3110 !! html/php+tidy
3111 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
3112 </p>
3113 !! html/parsoid
3114 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
3115 typeof="mw:Transclusion"
3116 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
3117 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
3118 !! end
3119
3120 !! test
3121 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
3122 !! options
3123 parsoid
3124 !! wikitext
3125 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
3126 !! html
3127 <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>
3128 !! end
3129
3130 !! test
3131 Templates: Don't escape already nowiki-escaped text in template parameters
3132 !! options
3133 parsoid=html2wt,wt2wt
3134 !! wikitext
3135 {{echo|foo<nowiki>|</nowiki>bar}}
3136 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3137 {{echo|<nowiki></nowiki>}}
3138 !! html/php+tidy
3139 <p>foo|bar
3140 &lt;div&gt;
3141
3142 </p>
3143 !! html/parsoid
3144 <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>
3145 <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>
3146 <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>
3147 </p>
3148 !! end
3149
3150 ## T54824
3151 !! test
3152 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3153 !! options
3154 parsoid=html2wt,wt2wt
3155 !! wikitext
3156 {{echo|{{echo|1=bar}}}}
3157 !! html/php+tidy
3158 <p>bar
3159 </p>
3160 !! html/parsoid
3161 <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>
3162 !! end
3163
3164 ## T58733
3165 !! test
3166 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3167 !! wikitext
3168 {{echo|a : b}}
3169 !! html/php+tidy
3170 <p>a&#160;: b
3171 </p>
3172 !! html/parsoid
3173 <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>
3174 !! end
3175
3176 ## T73412
3177 !! test
3178 Templates: Preserve blank parameter names
3179 !! wikitext
3180 {{echo|=foo}}
3181 !! html/php+tidy
3182 <p>{{{1}}}
3183 </p>
3184 !! html/parsoid
3185 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3186 !! end
3187
3188 !! test
3189 Templates: Preserve blank parameter names in other positions
3190 !! wikitext
3191 {{blank_param|bar|=foo}}
3192 !! html/php+tidy
3193 <p>bar
3194 foo
3195 </p>
3196 !! html/parsoid
3197 <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
3198 foo</p>
3199 !! end
3200
3201 ###
3202 ### Parsoid-centric tests for testing RT edge cases for pre
3203 ###
3204
3205 !!test
3206 1a. Indent-Pre and Comments
3207 !! wikitext
3208 a
3209 <!--a-->
3210 c
3211 !! html
3212 <pre>a
3213 </pre>
3214 <p>c
3215 </p>
3216 !!end
3217
3218 !!test
3219 1b. Indent-Pre and Comments
3220 !! wikitext
3221 a
3222 <!--a-->
3223 c
3224 !! html
3225 <pre>a
3226 </pre>
3227 <p>c
3228 </p>
3229 !!end
3230
3231 !!test
3232 1c. Indent-Pre and Comments
3233 !! wikitext
3234 <!--a--> a
3235
3236 <!--a--> a
3237 !! html
3238 <pre> a
3239 </pre>
3240 <pre> a
3241 </pre>
3242 !!end
3243
3244 !!test
3245 1d. Indent-Pre and Comments
3246 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3247 !! wikitext
3248 <!--a--> a
3249
3250 <!--b-->b
3251 !! html
3252 <pre>a
3253 </pre>
3254 <pre>b
3255 </pre>
3256 !!end
3257
3258 !!test
3259 2a. Indent-Pre and tables
3260 !! wikitext
3261 {|
3262 |-
3263 !h1!!h2
3264 |foo||bar
3265 |}
3266 !! html
3267 <table>
3268
3269 <tr>
3270 <th>h1</th>
3271 <th>h2
3272 </th>
3273 <td>foo</td>
3274 <td>bar
3275 </td></tr></table>
3276
3277 !!end
3278
3279 !!test
3280 2b. Indent-Pre and tables
3281 !! wikitext
3282 {|
3283 |-
3284 |foo
3285 |}
3286 !! html
3287 <table>
3288
3289 <tr>
3290 <td>foo
3291 </td></tr></table>
3292
3293 !!end
3294
3295 !!test
3296 2c. Indent-Pre and tables (T44252)
3297 !! wikitext
3298 {|
3299 |+foo
3300 ! |bar
3301 |}
3302 !! html
3303 <table>
3304 <caption>foo
3305 </caption>
3306 <tr>
3307 <th>bar
3308 </th></tr></table>
3309
3310 !!end
3311
3312 !!test
3313 2d. Indent-Pre and tables
3314 !! wikitext
3315 a
3316 {|
3317 |b
3318 |}
3319 !! html/php
3320 <pre>a
3321 </pre>
3322 <table>
3323 <tr>
3324 <td>b
3325 </td></tr></table>
3326
3327 !! html/parsoid
3328 <pre>a</pre>
3329 <table>
3330 <tbody><tr><td> b</td></tr>
3331 </tbody></table>
3332 !!end
3333
3334 !!test
3335 2e. Indent-Pre and table-line syntax
3336 !! wikitext
3337 a
3338 | b
3339 | c
3340 !! html/php
3341 <pre>a
3342 | b
3343 | c
3344 </pre>
3345 !!end
3346
3347 !!test
3348 2f. Indent-pre started by table-line syntax
3349 !! wikitext
3350 a
3351 | b
3352 | c
3353 !! html/php
3354 <p>a
3355 </p>
3356 <pre>| b
3357 | c
3358 </pre>
3359 !! html/parsoid
3360 <p>a</p>
3361 <pre>
3362 | b
3363 | c</pre>
3364 !!end
3365
3366 !! test
3367 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3368 !! wikitext
3369 <table>
3370 <tr>
3371 <td>
3372 Text that should be rendered preformatted
3373 </td>
3374 </tr>
3375 </table>
3376 !! html
3377 <table>
3378 <tr>
3379 <td>
3380 <pre>Text that should be rendered preformatted
3381 </pre>
3382 </td>
3383 </tr>
3384 </table>
3385
3386 !! end
3387
3388 !! test
3389 2h. Indent pre in tables
3390 !! options
3391 parsoid=wt2html,html2html
3392 !! wikitext
3393 {|
3394 !
3395 foo
3396 !
3397 bar
3398 |-
3399 |
3400 baz
3401 {{!}}
3402 bam
3403 |}
3404 !! html/php
3405 <table>
3406 <tr>
3407 <th>
3408 <pre>foo
3409 </pre>
3410 </th>
3411 <th>
3412 <pre>bar
3413 </pre>
3414 </th></tr>
3415 <tr>
3416 <td>
3417 <pre>baz
3418 </pre>
3419 </td>
3420 <td>
3421 <pre>bam
3422 </pre>
3423 </td></tr></table>
3424
3425 !! html/parsoid
3426 <table>
3427 <tbody><tr><th>
3428 <pre>foo</pre>
3429 </th><th>
3430 <pre>bar</pre>
3431 </th></tr><tr>
3432 <td>
3433 <pre>baz</pre>
3434 </td><td data-parsoid='{"startTagSrc":"{{!}}"}'>
3435 <pre>bam</pre>
3436 </td></tr></tbody></table>
3437 !! end
3438
3439 !!test
3440 3a. Indent-Pre and block tags (single-line html)
3441 !! wikitext
3442 a <p> foo </p>
3443 b <div> foo </div>
3444 c <blockquote> foo </blockquote>
3445 <span> foo </span>
3446 !! html
3447 a <p> foo </p>
3448 b <div> foo </div>
3449 c <blockquote> foo </blockquote>
3450 <pre><span> foo </span>
3451 </pre>
3452 !! html/parsoid
3453 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3454 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3455 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3456 <pre><span> foo </span>
3457 </pre>
3458 !! html/php+tidy
3459 <p> a </p><p> foo </p><p>
3460 b </p><div> foo </div><p>
3461 c </p><blockquote><p> foo </p></blockquote>
3462 <pre><span> foo </span>
3463 </pre>
3464 !! end
3465
3466 !! test
3467 3b. Indent-Pre and block tags (multi-line html)
3468 !! wikitext
3469 a <span>foo</span>
3470 <!-- comment --> b <div> foo </div>
3471 !! html/php
3472 <pre>a <span>foo</span>
3473 </pre>
3474 b <div> foo </div>
3475
3476 !! html/parsoid
3477 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3478 <!-- comment --> <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3479 !! html/php+tidy
3480 <pre>a <span>foo</span>
3481 </pre><p>
3482 b </p><div> foo </div>
3483 !! end
3484
3485 !!test
3486 3c. Indent-Pre and block tags (pre-content on separate line)
3487 !! wikitext
3488 <p>
3489 foo
3490 </p>
3491
3492 <div>
3493 foo
3494 </div>
3495
3496 <center>
3497 foo
3498 </center>
3499
3500 <blockquote>
3501 foo
3502 </blockquote>
3503
3504 <blockquote>
3505 <pre>
3506 foo
3507 </pre>
3508 </blockquote>
3509
3510 <table><tr><td>
3511 foo
3512 </td></tr></table>
3513
3514 <ul><li>
3515 foo
3516 </li></ul>
3517
3518 !! html
3519 <p>
3520 foo
3521 </p>
3522 <div>
3523 <pre>foo
3524 </pre>
3525 </div>
3526 <center>
3527 <pre>foo
3528 </pre>
3529 </center>
3530 <blockquote>
3531 <p> foo
3532 </p>
3533 </blockquote>
3534 <blockquote>
3535 <pre>
3536 foo
3537 </pre>
3538 </blockquote>
3539 <table><tr><td>
3540 <pre>foo
3541 </pre>
3542 </td></tr></table>
3543 <ul><li>
3544 foo
3545 </li></ul>
3546
3547 !!end
3548
3549 !! test
3550 4. Indent-Pre and extension tags
3551 !! wikitext
3552 a <tag />
3553 !! html/php
3554 a <pre>
3555 NULL
3556 array (
3557 )
3558 </pre>
3559
3560 !! html/parsoid
3561 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3562 !! end
3563
3564 !! test
3565 5. Indent-Pre and html pre
3566 !! wikitext
3567 <pre class="123">hi</pre>
3568 !! html/php
3569 <pre class="123">hi</pre>
3570
3571 !! html/parsoid
3572 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3573 !! end
3574
3575 !!test
3576 Render paragraphs when indent-pre is suppressed in blocklevels
3577 !! wikitext
3578 <blockquote>
3579 foo
3580
3581 bar
3582 </blockquote>
3583 !! html
3584 <blockquote>
3585 <p> foo
3586 </p><p> bar
3587 </p>
3588 </blockquote>
3589
3590 !!end
3591
3592 !!test
3593 4. Multiple spaces at start-of-line
3594 !! wikitext
3595 <p> foo </p>
3596 foo
3597 {|
3598 |foo
3599 |}
3600 !! html
3601 <p> foo </p>
3602 <pre> foo
3603 </pre>
3604 <table>
3605 <tr>
3606 <td>foo
3607 </td></tr></table>
3608
3609 !!end
3610
3611 ## NOTE: the leading white-space chars on empty line are significant
3612 !! test
3613 5a. White-space in indent-pre
3614 !! wikitext
3615 a<br />
3616
3617 b
3618 !! html
3619 <pre>a<br />
3620
3621 b
3622 </pre>
3623 !! end
3624
3625 ## NOTE: the leading white-space chars on empty line are significant
3626 !! test
3627 5b. White-space in indent-pre
3628 !! wikitext
3629 a
3630
3631 b
3632
3633
3634 c
3635 !! html
3636 <pre>a
3637
3638 b
3639
3640
3641 c
3642 </pre>
3643 !! end
3644
3645 !! test
3646 5c. White-space in indent-pre
3647 !! wikitext
3648 ''a''
3649 ''b''
3650 ''c''
3651 !! html
3652 <pre><i>a</i>
3653 <i>b</i>
3654 <i>c</i>
3655 </pre>
3656 !! end
3657
3658 !! test
3659 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3660 !! wikitext
3661 a
3662
3663 <!-- continue -->
3664 b
3665
3666 c
3667
3668 d
3669 !! html
3670 <pre>a
3671
3672 b
3673 </pre>
3674 <pre>c
3675
3676 </pre>
3677 <p>d
3678 </p>
3679 !! end
3680
3681 !! test
3682 7a. Indent-pre and category links
3683 !! options
3684 parsoid=wt2html,wt2wt
3685 !! wikitext
3686 [[Category:foo]] <!-- No pre-wrapping -->
3687 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3688 !! html/php+tidy
3689 !! html/parsoid
3690 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3691 <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 -->
3692 !! end
3693
3694 ## We used to, but no longer wt2wt this test since the default serializer
3695 ## will normalize all categories to serialize on their own line.
3696 ## This wikitext usage is going to be fairly uncommon in production and
3697 ## selser will take care of preserving formatting in those scenarios.
3698 !! test
3699 7b. Indent-pre and category links
3700 !! options
3701 parsoid=wt2html
3702 !! wikitext
3703 [[Category:foo]] a
3704 [[Category:foo]] {{echo|b}}
3705 !! html/parsoid
3706 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3707 <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>
3708 !! end
3709
3710 !! test
3711 Indent-Pre: Newlines in comments shouldn't affect sol state
3712 !! wikitext
3713 a <!--
3714 foo
3715 --> b
3716 !! html/php+tidy
3717 <p>a b
3718 </p>
3719 !! html/parsoid
3720 <p>a <!--
3721 foo
3722 --> b</p>
3723 !! end
3724
3725 ###
3726 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3727 ###
3728
3729 !!test
3730 HTML-pre: 1. embedded newlines
3731 !! wikitext
3732 <pre>foo</pre>
3733
3734 <pre>
3735 foo
3736 </pre>
3737
3738 <pre>
3739
3740 foo
3741 </pre>
3742
3743 <pre>
3744
3745
3746 foo
3747 </pre>
3748 !! html/php+tidy
3749 <pre>foo</pre>
3750 <pre>foo
3751 </pre>
3752 <pre>
3753
3754 foo
3755 </pre>
3756 <pre>
3757
3758
3759 foo
3760 </pre>
3761 !! html/parsoid
3762 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3763
3764 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3765 </pre>
3766
3767 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3768
3769 foo
3770 </pre>
3771
3772 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3773
3774
3775 foo
3776 </pre>
3777 !!end
3778
3779 !! test
3780 HTML-pre: big spaces
3781 !! wikitext
3782 <pre>
3783
3784
3785
3786
3787 haha
3788
3789
3790
3791
3792 haha
3793
3794
3795
3796
3797 </pre>
3798 !! html/php+tidy
3799 <pre>
3800
3801
3802
3803
3804 haha
3805
3806
3807
3808
3809 haha
3810
3811
3812
3813
3814 </pre>
3815 !! html/parsoid
3816 <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"}}'>
3817
3818
3819
3820
3821 haha
3822
3823
3824
3825
3826 haha
3827
3828
3829
3830
3831 </pre>
3832 !! end
3833
3834 !!test
3835 HTML-pre: 2: indented text
3836 !! wikitext
3837 <pre>
3838 foo
3839 </pre>
3840 !! html
3841 <pre>
3842 foo
3843 </pre>
3844
3845 !!end
3846
3847 !!test
3848 HTML-pre: 3: other wikitext
3849 !! wikitext
3850 <pre>
3851 * foo
3852 # bar
3853 = no-h =
3854 '' no-italic ''
3855 [[ NoLink ]]
3856 </pre>
3857 !! html/php
3858 <pre>
3859 * foo
3860 # bar
3861 = no-h =
3862 '' no-italic ''
3863 [[ NoLink ]]
3864 </pre>
3865
3866 !! html/parsoid
3867 <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
3868 # bar
3869 = no-h =
3870 '' no-italic ''
3871 [[ NoLink ]]
3872 </pre>
3873 !!end
3874
3875 ###
3876 ### Definition lists
3877 ###
3878 !! test
3879 Simple definition
3880 !! wikitext
3881 ;name :Definition
3882 !! html
3883 <dl><dt>name&#160;</dt>
3884 <dd>Definition</dd></dl>
3885
3886 !! end
3887
3888 !! test
3889 Definition list for indentation only
3890 !! wikitext
3891 :Indented text
3892 !! html
3893 <dl><dd>Indented text</dd></dl>
3894
3895 !! end
3896
3897 !! test
3898 Definition list with no space
3899 !! wikitext
3900 ;name:Definition
3901 !! html
3902 <dl><dt>name</dt>
3903 <dd>Definition</dd></dl>
3904
3905 !!end
3906
3907 !! test
3908 Definition list with URL link
3909 !! wikitext
3910 ;http://example.com/ :definition
3911 !! html
3912 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3913 <dd>definition</dd></dl>
3914
3915 !! end
3916
3917 !! test
3918 Definition list with bracketed URL link
3919 !! wikitext
3920 ;[http://www.example.com/ Example]:Something about it
3921 !! html
3922 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3923 <dd>Something about it</dd></dl>
3924
3925 !! end
3926
3927 !! test
3928 Definition list with wikilink containing colon
3929 !! wikitext
3930 ;[[Help:FAQ]]:The least-read page on Wikipedia
3931 !! html
3932 <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>
3933 <dd>The least-read page on Wikipedia</dd></dl>
3934
3935 !! end
3936
3937 # At Brion's and JeLuF's insistence... :)
3938 !! test
3939 Definition list with news link containing colon
3940 !! wikitext
3941 ;news:alt.wikipedia.rox :This isn't even a real newsgroup!
3942 !! html/php
3943 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a>&#160;</dt>
3944 <dd>This isn't even a real newsgroup!</dd></dl>
3945
3946 !! html/parsoid
3947 <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>
3948 !! end
3949
3950 !! test
3951 Malformed definition list with colon
3952 !! wikitext
3953 ;news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3954 !! html
3955 <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>
3956
3957 !! end
3958
3959 !! test
3960 Definition lists: colon in external link text
3961 !! wikitext
3962 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
3963 !! html
3964 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;:The Next Generation</a>&#160;</dt>
3965 <dd>OK, I made that up</dd></dl>
3966
3967 !! end
3968
3969 !! test
3970 Definition lists: colon in HTML attribute
3971 !! wikitext
3972 ;<b style="display: inline">bold</b>
3973 !! html
3974 <dl><dt><b style="display: inline">bold</b></dt></dl>
3975
3976 !! end
3977
3978 !! test
3979 Definition lists: self-closed tag
3980 !! wikitext
3981 ;one<br/>two :two-line fun
3982 !! html
3983 <dl><dt>one<br />two&#160;</dt>
3984 <dd>two-line fun</dd></dl>
3985
3986 !! end
3987
3988 !! test
3989 Definition lists: ignore colons inside tags
3990 !! wikitext
3991 ;one <b>two : tag <i>fun:</i>:</b>:def
3992 !! html
3993 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3994 <dd>def</dd></dl>
3995
3996 !! end
3997
3998 !! test
3999 Definition lists: excess closed tags
4000 !! wikitext
4001 ;one</b>two :bad tag fun
4002 !! html/php+tidy
4003 <dl><dt>onetwo&#160;</dt>
4004 <dd>bad tag fun</dd></dl>
4005 !! html/parsoid
4006 <dl>
4007 <dt>onetwo</dt>
4008 <dd>bad tag fun</dd>
4009 </dl>
4010 !! end
4011
4012 !! test
4013 T13748: Literal closing tags
4014 !! wikitext
4015 <dl>
4016 <dt>test 1</dt>
4017 <dd>test test test test test</dd>
4018 <dt>test 2</dt>
4019 <dd>test test test test test</dd>
4020 </dl>
4021 !! html
4022 <dl>
4023 <dt>test 1</dt>
4024 <dd>test test test test test</dd>
4025 <dt>test 2</dt>
4026 <dd>test test test test test</dd>
4027 </dl>
4028
4029 !! end
4030
4031 !! test
4032 Definition and unordered list using wiki syntax nested in unordered list using html tags.
4033 !! wikitext
4034 <ul><li>
4035 ;term :description
4036 *unordered
4037 </li></ul>
4038 !! html
4039 <ul><li>
4040 <dl><dt>term&#160;</dt>
4041 <dd>description</dd></dl>
4042 <ul><li>unordered</li></ul>
4043 </li></ul>
4044
4045 !! end
4046
4047 !! test
4048 Definition list with empty definition and following paragraph
4049 !! wikitext
4050 ;term:
4051
4052 Paragraph text
4053 !! html
4054 <dl><dt>term</dt>
4055 <dd></dd></dl>
4056 <p>Paragraph text
4057 </p>
4058 !! end
4059
4060 !! test
4061 Nested definition lists using html syntax
4062 !! wikitext
4063 <dl><dt>x</dt>
4064 <dd>a</dd>
4065 <dd>b</dd></dl>
4066 !! html
4067 <dl><dt>x</dt>
4068 <dd>a</dd>
4069 <dd>b</dd></dl>
4070
4071 !! end
4072
4073 !! test
4074 Definition Lists: No nesting: Multiple dd's
4075 !! wikitext
4076 ;x
4077 :a
4078 :b
4079 !! html
4080 <dl><dt>x</dt>
4081 <dd>a</dd>
4082 <dd>b</dd></dl>
4083
4084 !! end
4085
4086 !! test
4087 Definition Lists: Indentation: Regular
4088 !! wikitext
4089 :i1
4090 ::i2
4091 :::i3
4092 !! html
4093 <dl><dd>i1
4094 <dl><dd>i2
4095 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4096
4097 !! end
4098
4099 !! test
4100 Definition Lists: Indentation: Missing 1st level
4101 !! wikitext
4102 ::i2
4103 :::i3
4104 !! html
4105 <dl><dd><dl><dd>i2
4106 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4107
4108 !! end
4109
4110 !! test
4111 Definition Lists: Indentation: Multi-level indent
4112 !! wikitext
4113 :::i3
4114 !! html
4115 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
4116
4117 !! end
4118
4119 !! test
4120 Definition Lists: Hacky use to indent tables
4121 !! wikitext
4122 ::{|
4123 |foo
4124 |bar
4125 |}
4126 this text
4127 should be left alone
4128 !! html
4129 <dl><dd><dl><dd><table>
4130 <tr>
4131 <td>foo
4132 </td>
4133 <td>bar
4134 </td></tr></table></dd></dl></dd></dl>
4135 <p>this text
4136 should be left alone
4137 </p>
4138 !! end
4139
4140 !! test
4141 Definition Lists: Hacky use to indent tables (with content following table)
4142 !! wikitext
4143 :{|
4144 |foo
4145 |bar
4146 |} <!--c1--> this text should be part of the dl
4147 !! html/php+tidy
4148 <dl><dd><table>
4149 <tbody><tr>
4150 <td>foo
4151 </td>
4152 <td>bar
4153 </td></tr></tbody></table> this text should be part of the dl</dd></dl>
4154 !! html/parsoid
4155 <dl><dd><table>
4156 <tbody><tr>
4157 <td>foo
4158 </td>
4159 <td>bar
4160 </td></tr></tbody></table> <!--c1--> this text should be part of the dl</dd></dl>
4161 !! end
4162
4163 !! test
4164 Definition Lists: Hacky use to indent tables, with comments (T65979)
4165 !! wikitext
4166 <!-- foo -->
4167 ::{|
4168 |foo
4169 |bar
4170 |}<!-- bar -->
4171 this text
4172 should be left alone
4173 !! html/parsoid
4174 <!-- foo -->
4175 <dl><dd><dl><dd><table><tr>
4176 <td>foo</td>
4177 <td>bar</td>
4178 </tr></table><!-- bar --></dd></dl></dd></dl>
4179 <p>this text
4180 should be left alone</p>
4181 !! end
4182
4183 !! test
4184 Definition Lists: Hacky use to indent tables, with comment before table
4185 !!options
4186 parsoid=wt2html
4187 !! wikitext
4188 ::<!-- foo -->{|
4189 |foo
4190 |}
4191 !! html/parsoid
4192 <dl><dd><dl><dd><!-- foo --><table><tr>
4193 <td>foo</td>
4194 </tr></table></dd></dl></dd></dl>
4195 !! end
4196
4197 # The trailing whitespace in this test is to catch a regression in
4198 # Parsoid after T54473.
4199 !! test
4200 Definition Lists: Hacky use to indent tables (WS-insensitive)
4201 !! wikitext
4202 :{|
4203 |a
4204 |}
4205 !! html/php
4206 <dl><dd><table>
4207 <tr>
4208 <td>a
4209 </td></tr></table></dd></dl>
4210
4211 !! html/parsoid
4212 <dl><dd><table>
4213 <tbody><tr><td>a</td></tr>
4214 </tbody></table></dd></dl>
4215 !! end
4216
4217 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4218 ## as an empty dt item. It also ignores all but the last ";" when followed
4219 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4220 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4221 ## ";"s.
4222 ##
4223 ## Ex: ";;t2 ::d2" is transformed into:
4224 ##
4225 ## <dl>
4226 ## <dt>t2 </dt>
4227 ## <dd>
4228 ## <dl>
4229 ## <dt></dt>
4230 ## <dd>d2</dd>
4231 ## </dl>
4232 ## </dd>
4233 ## </dl>
4234 ##
4235 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4236 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4237 ##
4238 ## <dl>
4239 ## <dt>
4240 ## <dl>
4241 ## <dt>t2 </dt>
4242 ## <dd>:d2</dd>
4243 ## </dl>
4244 ## </dt>
4245 ## </dl>
4246 ##
4247 ## All Parsoid only definition list tests have this difference.
4248 ##
4249 ## See also: https://phabricator.wikimedia.org/T8569
4250 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4251
4252 !! test
4253 Table / list interaction: indented table with lists in table contents
4254 !! wikitext
4255 :{|
4256 |-
4257 |a
4258
4259 *b
4260 |-
4261 |c
4262
4263 *d
4264 |}
4265 !! html
4266 <dl><dd><table>
4267
4268 <tr>
4269 <td>a
4270 <ul><li>b</li></ul>
4271 </td></tr>
4272 <tr>
4273 <td>c
4274 <ul><li>d</li></ul>
4275 </td></tr></table></dd></dl>
4276
4277 !! end
4278
4279 !!test
4280 Table / list interaction: lists nested in tables nested in indented lists
4281 !! wikitext
4282 :{|
4283 |
4284 :a
4285 :b
4286 |
4287 *c
4288 *d
4289 |}
4290
4291 *e
4292 *f
4293 !! html
4294 <dl><dd><table>
4295 <tr>
4296 <td>
4297 <dl><dd>a</dd>
4298 <dd>b</dd></dl>
4299 </td>
4300 <td>
4301 <ul><li>c</li>
4302 <li>d</li></ul>
4303 </td></tr></table></dd></dl>
4304 <ul><li>e</li>
4305 <li>f</li></ul>
4306
4307 !!end
4308
4309 !! test
4310 Definition Lists: Nesting: Multi-level (Parsoid only)
4311 !! wikitext
4312 ;t1 :d1
4313 ;;t2 ::d2
4314 ;;;t3 :::d3
4315 !! html/parsoid
4316 <dl>
4317 <dt>t1 </dt>
4318 <dd>d1</dd>
4319 <dt>
4320 <dl>
4321 <dt>t2 </dt>
4322 <dd>:d2</dd>
4323 <dt>
4324 <dl>
4325 <dt>t3 </dt>
4326 <dd>::d3</dd>
4327 </dl>
4328 </dt>
4329 </dl>
4330 </dt>
4331 </dl>
4332
4333
4334 !! end
4335
4336
4337 !! test
4338 Definition Lists: Nesting: Test 2
4339 !! wikitext
4340 ;t1
4341 ::d2
4342 !! html+tidy
4343 <dl><dt>t1</dt>
4344 <dd>
4345 <dl><dd>d2</dd></dl></dd></dl>
4346 !! end
4347
4348
4349 !! test
4350 Definition Lists: Nesting: Test 3
4351 !! wikitext
4352 :;t1
4353 ::::d2
4354 !! html+tidy
4355 <dl><dd><dl><dt>t1</dt>
4356 <dd>
4357 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4358 !! end
4359
4360
4361 !! test
4362 Definition Lists: Nesting: Test 4
4363 !! wikitext
4364 ::;t3
4365 :::d3
4366 !! html
4367 <dl><dd><dl><dd><dl><dt>t3</dt>
4368 <dd>d3</dd></dl></dd></dl></dd></dl>
4369
4370 !! end
4371
4372
4373 ## The Parsoid team believes the following three test exposes a
4374 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4375 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4376 ## It also exposes a "misfeature" in tidy, which doesn't like
4377 ## <dl> tags with a single <dt> child; it converts the <dt> into
4378 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4379 !! test
4380 Definition Lists: Mixed Lists: Test 1
4381 !! wikitext
4382 :;*foo
4383 ::*bar
4384 :;baz
4385 !! html/php
4386 <dl><dd><dl><dt><ul><li>foo</li>
4387 <li>bar</li></ul></dt></dl>
4388 <dl><dt>baz</dt></dl></dd></dl>
4389
4390 !! html/php+tidy
4391 <dl><dd><dl><dt><ul><li>foo</li>
4392 <li>bar</li></ul></dt></dl>
4393 <dl><dt>baz</dt></dl></dd></dl>
4394 !! html/parsoid
4395 <dl>
4396 <dd><dl>
4397 <dt><ul>
4398 <li>foo
4399 </li>
4400 </ul></dt>
4401 <dd><ul>
4402 <li>bar
4403 </li>
4404 </ul></dd>
4405 <dt>baz</dt>
4406 </dl></dd>
4407 </dl>
4408 !! end
4409
4410 !! test
4411 Definition Lists: Mixed Lists: Test 2
4412 !! wikitext
4413 *:d1
4414 *:d2
4415 !! html
4416 <ul><li><dl><dd>d1</dd>
4417 <dd>d2</dd></dl></li></ul>
4418
4419 !! end
4420
4421
4422 !! test
4423 Definition Lists: Mixed Lists: Test 3
4424 !! wikitext
4425 *:::d1
4426 *:::d2
4427 !! html
4428 <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
4429 <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
4430
4431 !! end
4432
4433
4434 !! test
4435 Definition Lists: Mixed Lists: Test 4
4436 !! wikitext
4437 *;d1 :d2
4438 *;d3 :d4
4439 !! html
4440 <ul><li><dl><dt>d1&#160;</dt>
4441 <dd>d2</dd>
4442 <dt>d3&#160;</dt>
4443 <dd>d4</dd></dl></li></ul>
4444
4445 !! end
4446
4447
4448 !! test
4449 Definition Lists: Mixed Lists: Test 5
4450 !! wikitext
4451 *:d1
4452 *::d2
4453 !! html
4454 <ul><li><dl><dd>d1
4455 <dl><dd>d2</dd></dl></dd></dl></li></ul>
4456
4457 !! end
4458
4459
4460 !! test
4461 Definition Lists: Mixed Lists: Test 6
4462 !! wikitext
4463 #*:d1
4464 #*:::d3
4465 !! html
4466 <ol><li><ul><li><dl><dd>d1
4467 <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4468
4469 !! end
4470
4471
4472 !! test
4473 Definition Lists: Mixed Lists: Test 7
4474 !! wikitext
4475 :*d1
4476 :*d2
4477 !! html
4478 <dl><dd><ul><li>d1</li>
4479 <li>d2</li></ul></dd></dl>
4480
4481 !! end
4482
4483
4484 !! test
4485 Definition Lists: Mixed Lists: Test 8
4486 !! wikitext
4487 :*d1
4488 ::*d2
4489 !! html
4490 <dl><dd><ul><li>d1</li></ul>
4491 <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
4492
4493 !! end
4494
4495
4496 !! test
4497 Definition Lists: Mixed Lists: Test 9
4498 !! wikitext
4499 *;foo :bar
4500 !! html
4501 <ul><li><dl><dt>foo&#160;</dt>
4502 <dd>bar</dd></dl></li></ul>
4503
4504 !! end
4505
4506
4507 !! test
4508 Definition Lists: Mixed Lists: Test 10
4509 !! wikitext
4510 *#;foo :bar
4511 !! html
4512 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4513 <dd>bar</dd></dl></li></ol></li></ul>
4514
4515 !! end
4516
4517 # The Parsoid team disagrees with the PHP parser's seemingly-random
4518 # rules regarding dd/dt on the next few tests. Parsoid is more
4519 # consistent, and recognizes the shared nesting and keeps the
4520 # still-open tags around until the nesting is complete.
4521
4522 # This is a regression test for T175099
4523 !! test
4524 Definition Lists: Mixed Lists: Test 11
4525 !! wikitext
4526 ;a
4527 :*b
4528 !! html/php
4529 <dl><dt>a</dt>
4530 <dd>
4531 <ul><li>b</li></ul></dd></dl>
4532
4533 !! html/parsoid
4534 <dl><dt>a
4535 <dd><ul><li>b</li></ul></dd></dl>
4536 !! end
4537
4538 # FIXME: Maybe get rid of this test?
4539 !! test
4540 Definition Lists: Mixed Lists: Test 12
4541 !! wikitext
4542 *#*#;*;;foo :bar
4543 *#*#;boo :baz
4544 !! html/php
4545 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4546 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4547 <dl><dt>boo&#160;</dt>
4548 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4549
4550 !! html/php+tidy
4551 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4552 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4553 <dl><dt>boo&#160;</dt>
4554 <dd>baz</dd></dl></li></ol></li></ul>
4555 !! html/parsoid
4556 <ul>
4557 <li>
4558 <ol>
4559 <li>
4560 <ul>
4561 <li>
4562 <ol>
4563 <li>
4564 <dl>
4565 <dt>
4566 <ul>
4567 <li>
4568 <dl>
4569 <dt>
4570 <dl>
4571 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4572 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4573 </dl></dt>
4574 </dl></li>
4575 </ul></dt>
4576 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4577 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4578 </dl></li>
4579 </ol></li>
4580 </ul></li>
4581 </ol></li>
4582 </ul>
4583 !! end
4584
4585 # FIXME: Maybe get rid of this test?
4586 # From whitelist:
4587 # * The test is wrong, there are two colons where there should be :;
4588 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4589 !! test
4590 Definition Lists: Weird Ones: Test 1
4591 !! wikitext
4592 *#;*::;;foo :bar (who uses this?)
4593 !! html/php+tidy
4594 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4595 <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>
4596 !! html/parsoid
4597 <ul>
4598 <li>
4599 <ol>
4600 <li>
4601 <dl>
4602 <dt>
4603 <ul>
4604 <li>
4605 <dl>
4606 <dd>
4607 <dl>
4608 <dd>
4609 <dl>
4610 <dt>
4611 <dl>
4612 <dt>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4613 <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
4614 </dl></dt>
4615 </dl></dd>
4616 </dl></dd>
4617 </dl></li>
4618 </ul></dt>
4619 </dl></li>
4620 </ol></li>
4621 </ul>
4622 !! end
4623
4624 !! test
4625 Definition Lists: colons occurring in tags
4626 !! wikitext
4627 ;a:b
4628 ;'''a:b'''
4629 ;<i>a:b</i>
4630 ;<span>a:b</span>
4631 ;<div>a:b</div>
4632 ;<div>a
4633 :b</div>
4634 ;{{echo|a:b}}
4635 ;{{echo|''a:b''}}
4636 ;;;''a:b''
4637 !! html+tidy
4638 <dl><dt>a</dt>
4639 <dd>b</dd>
4640 <dt><b>a:b</b></dt>
4641 <dt><i>a:b</i></dt>
4642 <dt><span>a:b</span></dt>
4643 <dt><div>a:b</div></dt>
4644 <dt><div>a</div></dt>
4645 <dd>b</dd>
4646 <dt>a</dt>
4647 <dd>b</dd>
4648 <dt><i>a:b</i></dt></dl>
4649 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4650 !! html/parsoid
4651 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4652 <dt><b>a:b</b></dt>
4653 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4654 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4655 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4656 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4657 <dd>b</dd>
4658 <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>
4659 <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>
4660 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4661 !! end
4662
4663 # Parsoid's output differs here again because it shares
4664 # nesting between the two lists unlike the PHP parser.
4665 # Unsure which is more desirable.
4666 !! test
4667 Definition Lists: colons and tables 1
4668 !! wikitext
4669 :{|
4670 |x
4671 |}
4672 :{|
4673 |y
4674 |}
4675 !! html/php
4676 <dl><dd><table>
4677 <tr>
4678 <td>x
4679 </td></tr></table></dd></dl>
4680 <dl><dd><table>
4681 <tr>
4682 <td>y
4683 </td></tr></table></dd></dl>
4684
4685 !! html/parsoid
4686 <dl><dd><table>
4687 <tr>
4688 <td>x
4689 </td></tr></table></dd>
4690 <dd><table>
4691 <tr>
4692 <td>y
4693 </td></tr></table></dd></dl>
4694 !! end
4695
4696 # FIXME: Does this need a html/php section?
4697 !! test
4698 Definition Lists: template interaction
4699 !! wikitext
4700 ::{{definition_list}}
4701
4702 :one
4703 ::{{definition_list}}
4704 :::two
4705 :::three
4706 ::four
4707 !! html/parsoid
4708 <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">
4709 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4710
4711 <dl><dd data-parsoid='{}'>one
4712 <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">
4713 </span><dd about="#mwt2">two
4714 <dl><dd>two</dd>
4715 <dd>three</dd></dl></dd>
4716 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4717 !! end
4718
4719
4720 ###
4721 ### External links
4722 ###
4723 !! test
4724 External links: non-bracketed
4725 !! wikitext
4726 Non-bracketed: http://example.com
4727 !! html
4728 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4729 </p>
4730 !! end
4731
4732 # parsoid doesn't explicitly mark autonumbered links, see T55505
4733 !! test
4734 External links: numbered
4735 !! wikitext
4736 Numbered: [http://example.com]
4737 Numbered: [http://example.net]
4738 Numbered: [http://example.com]
4739 !! html/php
4740 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4741 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4742 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4743 </p>
4744 !! html/parsoid
4745 <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
4746 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4747 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
4748 !!end
4749
4750 !! test
4751 External links: specified text
4752 !! wikitext
4753 Specified text: [http://example.com link]
4754 !! html
4755 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4756 </p>
4757 !!end
4758
4759 !! test
4760 External links: trail
4761 !! wikitext
4762 Linktrails should not work for external links: [http://example.com link]s
4763 !! html
4764 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4765 </p>
4766 !! end
4767
4768 !! test
4769 External links: dollar sign in URL
4770 !! wikitext
4771 http://example.com/1$2345
4772 !! html
4773 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4774 </p>
4775 !! end
4776
4777 # parsoid doesn't explicitly mark autonumbered links, see T55505
4778 !! test
4779 External links: dollar sign in URL (autonumber)
4780 !! wikitext
4781 [http://example.com/1$2345]
4782 !! html/php
4783 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4784 </p>
4785 !! html/parsoid
4786 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
4787 !!end
4788
4789 !! test
4790 External links: open square bracket forbidden in URL (T6377)
4791 !! options
4792 parsoid=wt2html,wt2wt,html2html
4793 !! wikitext
4794 http://example.com/1[2345
4795 !! html/php
4796 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4797 </p>
4798 !! html/parsoid
4799 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
4800 !! end
4801
4802 !! test
4803 External links: open square bracket forbidden in URL (named) (T6377)
4804 !! options
4805 parsoid=wt2html,html2html
4806 !! wikitext
4807 [http://example.com/1[2345]
4808 !! html/php
4809 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4810 </p>
4811 !! html/parsoid
4812 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
4813 !!end
4814
4815 # parsoid adds a space before the link name
4816 !! test
4817 External links: open square bracket forbidden in URL (named) (T6377)
4818 Parsoid variant.
4819 !! wikitext
4820 [http://example.com/1 [2345]
4821 !! html
4822 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4823 </p>
4824 !!end
4825
4826 !! test
4827 External links: nowiki in URL link text (T8230)
4828 !! wikitext
4829 [http://example.com/ <nowiki>''example site''</nowiki>]
4830 !! html
4831 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4832 </p>
4833 !! end
4834
4835 !! test
4836 External links: newline forbidden in text (T8230 regression check)
4837 !! wikitext
4838 [http://example.com/ first
4839 second]
4840 !! html
4841 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4842 second]
4843 </p>
4844 !!end
4845
4846 !! test
4847 External links: Pipe char between url and text
4848 !! wikitext
4849 [http://example.com | link]
4850 !! html
4851 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4852 </p>
4853 !!end
4854
4855 !! test
4856 External links: protocol-relative URL in brackets
4857 !! wikitext
4858 [//example.com/ Test]
4859 !! html
4860 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4861 </p>
4862 !! end
4863
4864 # parsoid doesn't explicitly mark autonumbered links, see T55505
4865 !! test
4866 External links: protocol-relative URL in brackets without text
4867 !! wikitext
4868 [//example.com]
4869 !! html/php
4870 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4871 </p>
4872 !! html/parsoid
4873 <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
4874 !! end
4875
4876 !! test
4877 External links: protocol-relative URL in free text is left alone
4878 !! wikitext
4879 //example.com/Foo
4880 !! html
4881 <p>//example.com/Foo
4882 </p>
4883 !!end
4884
4885 !! test
4886 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4887 !! wikitext
4888 foo//example.com/Foo
4889 !! html
4890 <p>foo//example.com/Foo
4891 </p>
4892 !! end
4893
4894 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
4895 !! test
4896 External links: with no contents
4897 !! options
4898 parsoid=wt2html,wt2wt
4899 !! wikitext
4900 [http://en.wikipedia.org/wiki/Foo]
4901
4902 [[wikipedia:Foo|Bar]]
4903
4904 [[wikipedia:Foo|<span>Bar</span>]]
4905 !! html/php
4906 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4907 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4908 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4909 </p>
4910 !! html/parsoid
4911 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4912 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4913 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4914 !! end
4915
4916 !! test
4917 External links: Free with trailing punctuation
4918 !! wikitext
4919 http://example.com,
4920 http://example.com;
4921 http://example.com\
4922 http://example.com.
4923 http://example.com:
4924 http://example.com!
4925 http://example.com?
4926 http://example.com)
4927 http://example.com/url_with_(brackets)
4928 (http://example.com/url_without_brackets)
4929 http://example.com/url_with_entity&amp;
4930 http://example.com/url_with_entity&#x26;
4931 http://example.com/url_with_entity&#038;
4932 http://example.com/url_with_entity&nbsp;
4933 http://example.com/url_with_entity&#xA0;
4934 http://example.com/url_with_entity&#160;
4935 http://example.com/url_with_entity&lt;
4936 http://example.com/url_with_entity&#x3C;
4937 http://example.com/url_with_entity&#60;
4938 !! html/php
4939 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4940 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4941 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4942 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4943 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4944 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4945 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4946 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4947 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4948 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4949 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4950 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4951 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4952 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4953 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4954 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4955 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4956 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4957 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4958 </p>
4959 !! html/parsoid
4960 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
4961 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
4962 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
4963 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
4964 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
4965 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
4966 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
4967 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
4968 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4969 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4970 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4971 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4972 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4973 <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>
4974 <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>
4975 <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>
4976 <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>
4977 <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>
4978 <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>
4979 !! end
4980
4981 !! test
4982 External links: tricky Parsoid html2html case
4983 !! options
4984 parsoid=wt2html,wt2wt,html2html
4985 !! wikitext
4986 http://example.com/url_with_entity&amp;amp;
4987 !! html/php
4988 <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>;
4989 </p>
4990 !! html/parsoid
4991 <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>
4992 !! end
4993
4994 !! test
4995 External links: Free with trailing quotes (T113666)
4996 !! wikitext
4997 '''News:''' Stuff here
4998
4999 news:'a'b''c''d e
5000 !! html/php
5001 <p><b>News:</b> Stuff here
5002 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
5003 </p>
5004 !! html/parsoid
5005 <p><b>News:</b> Stuff here</p>
5006 <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
5007 !! end
5008
5009 !! test
5010 External links: with entity
5011 !! wikitext
5012 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
5013 !! html/php
5014 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
5015 </p>
5016 !! html/parsoid
5017 <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>
5018 !! end
5019
5020 !! test
5021 External links: Lone protocols are never linked (T105697)
5022 !! wikitext
5023 http://
5024 http://;
5025 (http://)
5026 bitcoin:
5027 bitcoin:;
5028 (bitcoin:)
5029 !! html
5030 <p>http://
5031 http://;
5032 (http://)
5033 bitcoin:
5034 bitcoin:;
5035 (bitcoin:)
5036 </p>
5037 !! end
5038
5039 !! test
5040 External links: No preceding word characters allowed (T67278)
5041 !! wikitext
5042 NOPEhttp://example.com
5043 N0http://example.com
5044 ok:http://example.com
5045 ok-http://example.com
5046 !! html
5047 <p>NOPEhttp://example.com
5048 N0http://example.com
5049 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5050 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5051 </p>
5052 !! end
5053
5054 !! test
5055 External links: nofollow domain exception
5056 !! wikitext
5057 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
5058 !! html
5059 <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>.
5060 </p>
5061 !!end
5062
5063 !! test
5064 External image
5065 !! wikitext
5066 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5067 !! html
5068 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5069 </p>
5070 !! end
5071
5072 !! test
5073 External image from https
5074 !! wikitext
5075 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5076 !! html
5077 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5078 </p>
5079 !! end
5080
5081 !! test
5082 External image (when not allowed)
5083 !! options
5084 wgAllowExternalImages=0
5085 !! wikitext
5086 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5087 !! html
5088 <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>
5089 </p>
5090 !! end
5091
5092 !! test
5093 Link to non-http image, no img tag
5094 !! wikitext
5095 Link to non-http image, no img tag: ftp://example.com/test.jpg
5096 !! html
5097 <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>
5098 </p>
5099 !! end
5100
5101 !! test
5102 External links: terminating separator
5103 !! wikitext
5104 Terminating separator: http://example.com/thing,
5105 !! html
5106 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
5107 </p>
5108 !! end
5109
5110 !! test
5111 External links: intervening separator
5112 !! wikitext
5113 Intervening separator: http://example.com/1,2,3
5114 !! html
5115 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
5116 </p>
5117 !! end
5118
5119 !! test
5120 External links: old bug with URL in query
5121 !! wikitext
5122 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
5123 !! html
5124 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
5125 </p>
5126 !! end
5127
5128 !! test
5129 External links: old URL-in-URL bug, mixed protocols
5130 !! wikitext
5131 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
5132 !! html
5133 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
5134 </p>
5135 !!end
5136
5137 # Since Parsoid is starting to emit canonical wikitext for links,
5138 # [http://example.com http://example.com] will not RT back to that
5139 # form anymore.
5140 !! test
5141 External links: URL in text
5142 !! options
5143 parsoid=wt2html
5144 !! wikitext
5145 URL in text: [http://example.com http://example.com]
5146 !! html/php
5147 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
5148 </p>
5149 !! html/parsoid
5150 <p>URL in text: <a rel="mw:ExtLink" class="external text" href="http://example.com">http://example.com</a></p>
5151 !! end
5152
5153 !! test
5154 External links: Clickable images
5155 !! wikitext
5156 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5157 !! html/php
5158 <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>
5159 </p>
5160 !! html/parsoid
5161 <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>
5162 !! end
5163
5164 !! test
5165 External links: raw ampersand
5166 !! wikitext
5167 Old &amp; use: http://x&y
5168 !! html
5169 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5170 </p>
5171 !! end
5172
5173 !! test
5174 External links: encoded ampersand
5175 !! wikitext
5176 Old &amp; use: http://x&amp;y
5177 !! html/php
5178 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5179 </p>
5180 !! html/parsoid
5181 <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>
5182 !! end
5183
5184 !! test
5185 External links: encoded equals (T8102)
5186 !! wikitext
5187 http://example.com/?foo&#61;bar
5188 !! html/php
5189 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5190 </p>
5191 !! html/parsoid
5192 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5193 !! end
5194
5195 ##
5196 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5197 ## does it number them. As discussed in T55505, we can identify
5198 ## autonumbered links via CSS.
5199 ##
5200
5201 !! test
5202 External links: [raw ampersand]
5203 !! wikitext
5204 Old &amp; use: [http://x&y]
5205 !! html/php
5206 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5207 </p>
5208 !! html/parsoid
5209 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5210 !! end
5211
5212 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5213 # mode will return the [raw ampersand] wikitext
5214 !! test
5215 External links: [encoded ampersand]
5216 !! options
5217 parsoid=wt2html,wt2wt,html2html
5218 !! wikitext
5219 Old &amp; use: [http://x&amp;y]
5220 !! html/php
5221 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5222 </p>
5223 !! html/parsoid
5224 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5225 !! end
5226
5227 !! test
5228 External links: [raw equals]
5229 !! wikitext
5230 [http://example.com/?foo=bar]
5231 !! html/php
5232 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5233 </p>
5234 !! html/parsoid
5235 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5236 !! end
5237
5238 # note that parsoid html is identical to [raw equals] case; so html2wt
5239 # mode will return the [raw equals] wikitext
5240 !! test
5241 External links: [encoded equals] (T8102)
5242 !! options
5243 parsoid=wt2html,wt2wt,html2html
5244 !! wikitext
5245 [http://example.com/?foo&#61;bar]
5246 !! html/php
5247 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5248 </p>
5249 !! html/parsoid
5250 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5251 !! end
5252
5253 # xxx parsoid strips the IDN character, so the round-trip tests will
5254 # obviously fail and are disabled. --cscott
5255 !! test
5256 External links: [IDN ignored character reference in hostname; strip it right off]
5257 !! options
5258 parsoid=wt2html,wt2wt,html2html
5259 !! wikitext
5260 [http://e&zwnj;xample.com/]
5261 !! html/php
5262 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5263 </p>
5264 !! html/parsoid
5265 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
5266 !! end
5267
5268 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5269 # Where an external link could easily circumvent the sanitization of the text of
5270 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5271 # test demands a higher standard. That's a bit strange.
5272 #
5273 # Example:
5274 #
5275 # http://e‌xample.com -> [http://example.com|http://example.com]
5276 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5277 #
5278 # The first example is sanitized, but the second is not. Any security benefits
5279 # from this production are trivial to circumvent. Either remove this test and
5280 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5281 # the test accordingly.
5282 #
5283 # All our love,
5284 # The Parsoid team.
5285 # xxx parsoid strips the IDN character, so the round-trip tests will
5286 # obviously fail and are disabled. --cscott
5287 !! test
5288 External links: IDN ignored character reference in hostname; strip it right off
5289 !! options
5290 parsoid=wt2html,html2html
5291 !! wikitext
5292 http://e&zwnj;xample.com/
5293 !! html/php
5294 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5295 </p>
5296 !! html/parsoid
5297 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
5298 !! end
5299
5300 !! test
5301 External links: www.jpeg.org (T2554)
5302 !! wikitext
5303 http://www.jpeg.org
5304 !! html
5305 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5306 </p>
5307 !! end
5308
5309 # parsoid doesn't explicitly mark autonumbered links, see T55505
5310 !! test
5311 External links: URL within URL (T2002)
5312 !! wikitext
5313 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5314 !! html/php
5315 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5316 </p>
5317 !! html/parsoid
5318 <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>
5319 !! end
5320
5321 !! test
5322 T2361: URL inside bracketed URL
5323 !! wikitext
5324 [http://www.example.com/foo http://www.example.com/bar]
5325 !! html
5326 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5327 </p>
5328 !! end
5329
5330 !! test
5331 T2361: URL within URL, not bracketed
5332 !! wikitext
5333 http://www.example.com/foo?=http://www.example.com/bar
5334 !! html
5335 <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>
5336 </p>
5337 !! end
5338
5339 !! test
5340 T2289: ">"-token in URL-tail
5341 !! wikitext
5342 http://www.example.com/<hello>
5343 !! html
5344 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5345 </p>
5346 !!end
5347
5348 !! test
5349 T2289: literal ">"-token in URL-tail
5350 !! wikitext
5351 http://www.example.com/<b>html</b>
5352 !! html/php
5353 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5354 </p>
5355 !! html/parsoid
5356 <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>
5357 !! end
5358
5359 !! test
5360 T2289: ">"-token in bracketed URL
5361 !! wikitext
5362 [http://www.example.com/<hello> stuff]
5363 !! html
5364 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5365 </p>
5366 !!end
5367
5368 !! test
5369 T2289: literal ">"-token in bracketed URL
5370 !! wikitext
5371 [http://www.example.com/<b>html</b> stuff]
5372 !! html
5373 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5374 </p>
5375 !!end
5376
5377 !! test
5378 T2289: literal double quote at end of URL
5379 !! wikitext
5380 http://www.example.com/"hello"
5381 !! html
5382 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5383 </p>
5384 !!end
5385
5386 !! test
5387 T2289: literal double quote in bracketed URL
5388 !! wikitext
5389 [http://www.example.com/"hello" stuff]
5390 !! html
5391 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5392 </p>
5393 !!end
5394
5395 !! test
5396 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5397 !! wikitext
5398 [http://www.example.com test]
5399 !! html
5400 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5401 </p>
5402 !! end
5403
5404 !! test
5405 External links: link text with spaces
5406 !! wikitext
5407 [http://www.example.com a b c]
5408 [http://www.example.com ''a'' ''b'']
5409 !! html
5410 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5411 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5412 </p>
5413 !! end
5414
5415 # Note edge case difference between PHP and Parsoid here.
5416 !! test
5417 External links: wiki links within external link (T5695)
5418 !! options
5419 parsoid=wt2html,html2html
5420 !! wikitext
5421 [http://example.com [[wikilink]] embedded in ext link]
5422
5423 [http://example.com test [[wikilink]] embedded in ext link]
5424 !! html/php
5425 <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>
5426 </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>
5427 </p>
5428 !! html/parsoid
5429 <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>
5430 <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>
5431 !! end
5432
5433 !! test
5434 T2787: Links with one slash after the url protocol are invalid
5435 !! wikitext
5436 http:/example.com
5437
5438 [http:/example.com title]
5439 !! html
5440 <p>http:/example.com
5441 </p><p>[http:/example.com title]
5442 </p>
5443 !! end
5444
5445 !! test
5446 Bracketed external links with template-generated invalid target
5447 !! wikitext
5448 [{{echo|http:/example.com}} title]
5449 !! html
5450 <p>[http:/example.com title]
5451 </p>
5452 !! end
5453
5454 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5455 !! test
5456 Broken wikilinks (but not external links) prevent templates from closing
5457 !! options
5458 parsoid=wt2html
5459 !! wikitext
5460 [http://example.com x
5461
5462 {{echo|[http://example.com x}}
5463
5464 [[Foo
5465
5466 {{echo|[[Foo}}
5467 !! html/php
5468 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5469 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5470 </p><p>[[Foo
5471 </p><p>{{echo|[[Foo}}
5472 </p>
5473 !! html/parsoid
5474 <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5475 <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>
5476 <p>[[Foo</p>
5477 <p>{{echo|[[Foo}}</p>
5478 !! end
5479
5480 !! test
5481 Wikilinks with embedded newlines are not broken
5482 !! wikitext
5483 {{echo|[[ Foo
5484 B
5485 C]]}}
5486 !! html/php
5487 <p>[[ Foo
5488 B
5489 C]]
5490 </p>
5491 !! html/parsoid
5492 <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>
5493 !! end
5494
5495 !! test
5496 Broken templates
5497 !! options
5498 parsoid=wt2html
5499 !! wikitext
5500 {{echo|[[Foo|}}]]
5501
5502 [[Foo|{{echo|]]}}
5503 !! html/php
5504 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5505 </p><p>[[Foo|]]
5506 </p>
5507 !! html/parsoid
5508 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5509 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5510 !! end
5511
5512 !! test
5513 T4702: Mismatched <i>, <b> and <a> tags are invalid
5514 !! wikitext
5515 ''[http://example.com text'']
5516 [http://example.com '''text]'''
5517 ''Something [http://example.com in italic'']
5518 ''Something [http://example.com mixed''''', even bold]'''
5519 '''''Now [http://example.com both''''']
5520 !! html
5521 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5522 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5523 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5524 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5525 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5526 </p>
5527 !! end
5528
5529
5530 !! test
5531 T6781: %26 in URL
5532 !! wikitext
5533 http://www.example.com/?title=AT%26T
5534 !! html/php
5535 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5536 </p>
5537 !! html/parsoid
5538 <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>
5539 !! end
5540
5541 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5542 # % is actually legal in HTML5. Any change in output would need testing though.
5543 !! test
5544 T6781, T7267: %25 in URL
5545 !! wikitext
5546 http://www.example.com/?title=100%25_Bran
5547 !! html/php
5548 <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>
5549 </p>
5550 !! html/parsoid
5551 <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>
5552 !! end
5553
5554 !! test
5555 T6781, T7267: %28, %29 in URL
5556 !! wikitext
5557 http://www.example.com/?title=Ben-Hur_%281959_film%29
5558 !! html/php
5559 <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>
5560 </p>
5561 !! html/parsoid
5562 <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>
5563 !! end
5564
5565
5566 !! test
5567 T6781: %26 in autonumber URL
5568 !! wikitext
5569 [http://www.example.com/?title=AT%26T]
5570 !! html/php
5571 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5572 </p>
5573 !! html/parsoid
5574 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5575 !! end
5576
5577 !! test
5578 T6781, T7267: %26 in autonumber URL
5579 !! wikitext
5580 [http://www.example.com/?title=100%25_Bran]
5581 !! html/php
5582 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5583 </p>
5584 !! html/parsoid
5585 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5586 !! end
5587
5588 !! test
5589 T6781, T7267: %28, %29 in autonumber URL
5590 !! wikitext
5591 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5592 !! html/php
5593 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5594 </p>
5595 !! html/parsoid
5596 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5597 !! end
5598
5599
5600 !! test
5601 T6781: %26 in bracketed URL
5602 !! wikitext
5603 [http://www.example.com/?title=AT%26T link]
5604 !! html/php
5605 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5606 </p>
5607 !! html/parsoid
5608 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5609 !! end
5610
5611 !! test
5612 T6781, T7267: %25 in bracketed URL
5613 !! wikitext
5614 [http://www.example.com/?title=100%25_Bran link]
5615 !! html
5616 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5617 </p>
5618 !! end
5619
5620 !! test
5621 T6781, T7267: %28, %29 in bracketed URL
5622 !! wikitext
5623 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5624 !! html/php
5625 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5626 </p>
5627 !! html/parsoid
5628 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5629 !! end
5630
5631 !! test
5632 External link containing a period in the anchor. (T65947)
5633 !! wikitext
5634 [//foo.org/bar#baz. bang]
5635
5636 [//foo.org/bar. bang]
5637 !! html/php
5638 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5639 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5640 </p>
5641 !! html/parsoid
5642 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5643 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5644 !! end
5645
5646 !! test
5647 External link containing a single quote. (T65947)
5648 !! wikitext
5649 [//foo.org/bar'baz]
5650
5651 [//foo.org/bar'baz bang]
5652 !! html/php
5653 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5654 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5655 </p>
5656 !! html/parsoid
5657 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5658 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5659 !! end
5660
5661 !! test
5662 External link containing double-single-quotes in text '' (T6598 sanity check)
5663 !! wikitext
5664 Some [http://example.com/ pretty ''italics'' and stuff]!
5665 !! html
5666 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5667 </p>
5668 !! end
5669
5670 !! test
5671 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5672 !! wikitext
5673 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5674 !! html
5675 <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>
5676 </p>
5677 !! end
5678
5679 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5680 !! test
5681 External link containing double-single-quotes with no space separating the url from text in italics
5682 !! wikitext
5683 [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]].]
5684 !! html/php+tidy
5685 <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>.
5686 </p>
5687 !! html/parsoid
5688 <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>
5689 !! end
5690
5691 !! test
5692 External link with comments in link text
5693 !! wikitext
5694 [http://www.google.com Google <!-- comment -->]
5695 !! html/php
5696 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5697 </p>
5698 !! html/parsoid
5699 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5700 !! end
5701
5702 !! test
5703 External link to bare IPv4 address
5704 !! wikitext
5705 [http://192.168.0.1 Link]
5706 !! html/php
5707 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5708 </p>
5709 !! html/parsoid
5710 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5711 !! end
5712
5713 !! test
5714 URL-encoding in URL functions (single parameter)
5715 !! wikitext
5716 {{localurl:Some page|amp=&}}
5717 !! html
5718 <p>/index.php?title=Some_page&amp;amp=&amp;
5719 </p>
5720 !! end
5721
5722 !! test
5723 URL-encoding in URL functions (multiple parameters)
5724 !! wikitext
5725 {{localurl:Some page|q=?&amp=&}}
5726 !! html
5727 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5728 </p>
5729 !! end
5730
5731 !! test
5732 Brackets in urls
5733 !! wikitext
5734 http://example.com/index.php?foozoid%5B%5D=bar
5735
5736 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5737 !! html/php
5738 <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>
5739 </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>
5740 </p>
5741 !! html/parsoid
5742 <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>
5743
5744 <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>
5745 !! end
5746
5747 !! test
5748 IPv6 urls, autolink format (T23261)
5749 !! wikitext
5750 http://[2404:130:0:1000::187:2]/index.php
5751
5752 Examples from RFC 2373, section 2.2:
5753
5754 *http://[1080::8:800:200C:417A]/unicast
5755 *http://[FF01::101]/multicast
5756 *http://[::1]/loopback
5757 *http://[::]/unspecified
5758 *http://[::13.1.68.3]/ipv4compat
5759 *http://[::FFFF:129.144.52.38]/ipv4compat
5760
5761 Examples from RFC 2732, section 2:
5762
5763 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5764 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5765 *http://[3ffe:2a00:100:7031::1]
5766 *http://[1080::8:800:200C:417A]/foo
5767 *http://[::192.9.5.5]/ipng
5768 *http://[::FFFF:129.144.52.38]:80/index.html
5769 *http://[2010:836B:4179::836B:4179]
5770 !! html/php
5771 <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>
5772 </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:
5773 </p>
5774 <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>
5775 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5776 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5777 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5778 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5779 <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>
5780 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5781 </p>
5782 <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>
5783 <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>
5784 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5785 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5786 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5787 <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>
5788 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5789
5790 !! html/parsoid
5791 <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>
5792
5793 <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>
5794 <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>
5795 <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5796 <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5797 <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5798 <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5799 <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>
5800
5801 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5802 <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>
5803 <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>
5804 <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5805 <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>
5806 <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5807 <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>
5808 <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5809 !! end
5810
5811 !! test
5812 IPv6 urls, bracketed format (T23261)
5813 !! wikitext
5814 [http://[2404:130:0:1000::187:2]/index.php test]
5815
5816 Examples from RFC 2373, section 2.2:
5817
5818 *[http://[1080::8:800:200C:417A] unicast]
5819 *[http://[FF01::101] multicast]
5820 *[http://[::1]/ loopback]
5821 *[http://[::] unspecified]
5822 *[http://[::13.1.68.3] ipv4compat]
5823 *[http://[::FFFF:129.144.52.38] ipv4compat]
5824
5825 Examples from RFC 2732, section 2:
5826
5827 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5828 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5829 *[http://[3ffe:2a00:100:7031::1] 3]
5830 *[http://[1080::8:800:200C:417A]/foo 4]
5831 *[http://[::192.9.5.5]/ipng 5]
5832 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5833 *[http://[2010:836B:4179::836B:4179] 7]
5834 !! html/php
5835 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5836 </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:
5837 </p>
5838 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5839 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5840 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5841 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5842 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5843 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5844 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5845 </p>
5846 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5847 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5848 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5849 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5850 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5851 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5852 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5853
5854 !! html/parsoid
5855 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5856
5857 <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>
5858 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5859 <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5860 <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5861 <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5862 <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5863 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5864
5865 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5866 <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>
5867 <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5868 <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5869 <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5870 <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5871 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5872 <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5873 !! end
5874
5875 !! test
5876 Non-extlinks in brackets
5877 !! wikitext
5878 [foo]
5879 [foo bar]
5880 [foo ''bar'']
5881 [fool's] errand
5882 [fool's errand]
5883 [{{echo|foo}}]
5884 [{{echo|foo}} bar]
5885 [{{echo|foo}} ''bar'']
5886 [{{echo|foo}}l's] errand
5887 [{{echo|foo}}l's errand]
5888 [url={{echo|foo}}]
5889 [url=http://example.com]
5890 [http:// bare protocols don't count]
5891 !! html/php
5892 <p>[foo]
5893 [foo bar]
5894 [foo <i>bar</i>]
5895 [fool's] errand
5896 [fool's errand]
5897 [foo]
5898 [foo bar]
5899 [foo <i>bar</i>]
5900 [fool's] errand
5901 [fool's errand]
5902 [url=foo]
5903 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5904 [http:// bare protocols don't count]
5905 </p>
5906 !! html/parsoid
5907 <p>[foo]
5908 [foo bar]
5909 [foo <i>bar</i>]
5910 [fool's] errand
5911 [fool's errand]
5912 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
5913 [<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]
5914 [<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>]
5915 [<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
5916 [<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]
5917 [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>]
5918 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
5919 [http:// bare protocols don't count]</p>
5920 !! end
5921
5922 !! test
5923 Percent encoding in external links
5924 !! wikitext
5925 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5926 !! html/php
5927 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5928 </p>
5929 !! html/parsoid
5930 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5931 !! end
5932
5933 !! test
5934 Use url link syntax for links where the content is equal the link target
5935 !! wikitext
5936 http://example.com
5937 !! html/php
5938 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5939 </p>
5940 !! html/parsoid
5941 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
5942 !! end
5943
5944 !! test
5945 Parenthesis in external links, especially URL links
5946 !! wikitext
5947 http://example.com)
5948
5949 http://example.com/test)
5950
5951 http://example.com/(test)
5952
5953 http://example.com/((test)
5954
5955 (http://example.com/(test))
5956
5957 (http://example.com/(test)))))
5958
5959 http://example.com/a)b
5960
5961 [http://example.com) foo]
5962 !! html/php
5963 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5964 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5965 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5966 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5967 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5968 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5969 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5970 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5971 </p>
5972 !! html/parsoid
5973 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
5974 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
5975 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
5976 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
5977 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
5978 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5979 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
5980 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
5981 !! end
5982
5983 !! test
5984 Parenthesis in external links, w/ transclusion or comment
5985 !! wikitext
5986 (http://example.com/{{echo|hi}})
5987
5988 (http://example.com<!-- hi -->)
5989 !! html/php
5990 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5991 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5992 </p>
5993 !! html/parsoid
5994 <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>
5995
5996 <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>
5997 !! end
5998
5999 !! test
6000 Serialize <a> tags with invalid link targets as plain text
6001 !! options
6002 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
6003 !! html/parsoid
6004 <a rel="mw:WikiLink" href="[[foo]]">text</a>
6005 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
6006 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
6007 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
6008 !! wikitext
6009 text
6010 <nowiki>*</nowiki>text
6011 <nowiki>[[foo]]</nowiki>
6012 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
6013 !! end
6014
6015 !! test
6016 mw:ExtLink -vs- mw:WikiLink (T94723)
6017 !! options
6018 parsoid=html2wt
6019 !! html/parsoid
6020 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
6021 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
6022 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6023 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6024 <p>
6025 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6026 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6027 </p>
6028 !! wikitext
6029 [[Foo|Bar]]
6030 [[Foo|Bar]]
6031 [[:en:Foo|Bar]]
6032 [[:en:Foo|Bar]]
6033
6034 [[:en:European_Robin|European Robin]]
6035 [[:en:European_Robin|European Robin]]
6036 !! end
6037
6038 !! test
6039 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
6040 !! options
6041 parsoid=wt2wt
6042 !! wikitext
6043 [http://en.wikipedia.org/wiki/European_Robin European Robin]
6044 !! html/parsoid
6045 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
6046 !! end
6047
6048
6049 ###
6050 ### Quotes
6051 ###
6052
6053 !! test
6054 Quotes
6055 !! wikitext
6056 Normal text. '''Bold text.''' Normal text. ''Italic text.''
6057
6058 Normal text. '''''Bold italic text.''''' Normal text.
6059 !! html
6060 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
6061 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
6062 </p>
6063 !! end
6064
6065
6066 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
6067 # parser strips. The wikitext contains just the first half of the bold
6068 # quote pair.
6069 !! test
6070 Unclosed and unmatched quotes
6071 !! wikitext
6072 '''''Bold italic text '''with bold deactivated''' in between.'''''
6073
6074 '''''Bold italic text ''with italic deactivated'' in between.'''''
6075
6076 '''Bold text..
6077
6078 ..spanning two paragraphs (should not work).'''
6079
6080 '''Bold tag left open
6081
6082 ''Italic tag left open
6083
6084 Normal text.
6085
6086 <!-- Unmatching number of opening, closing tags: -->
6087 '''This year''''s election ''should'' beat '''last year''''s.
6088
6089 ''Tom'''s car is bigger than ''Susan'''s.
6090
6091 Plain ''italic'''s plain
6092 !! html/php
6093 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6094 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6095 </p><p><b>Bold text..</b>
6096 </p><p>..spanning two paragraphs (should not work).
6097 </p><p><b>Bold tag left open</b>
6098 </p><p><i>Italic tag left open</i>
6099 </p><p>Normal text.
6100 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6101 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6102 </p><p>Plain <i>italic'</i>s plain
6103 </p>
6104 !! html/parsoid
6105 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6106 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6107 </p><p><b>Bold text..</b>
6108 </p><p>..spanning two paragraphs (should not work).<b></b>
6109 </p><p><b>Bold tag left open</b>
6110 </p><p><i>Italic tag left open</i>
6111 </p><p>Normal text.
6112 </p>
6113 <!-- Unmatching number of opening, closing tags: -->
6114 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6115 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6116 </p><p>Plain <i>italic'</i>s plain
6117 </p>
6118 !! end
6119
6120 ###
6121 ### Tables
6122 ###
6123 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
6124 ###
6125
6126 # This should not produce <table></table> as <table><tr><td></td></tr></table>
6127 # is the bare minimum required by the spec, see:
6128 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
6129 # Parsoid team replies: empty table tags are legal in HTML5
6130 !! test
6131 A table with no data.
6132 !! options
6133 parsoid=wt2html
6134 !! wikitext
6135 {||}
6136 !! html/php
6137
6138 !! html/parsoid
6139 <table></table>
6140
6141 !! end
6142
6143 !! test
6144 A table with stray table end tags on start tag line (wt2html)
6145 !! options
6146 parsoid=wt2html
6147 !! wikitext
6148 {|style="color: red;"|}
6149
6150 {|style="color: red;" |}
6151 |foo
6152 |}
6153
6154 {|style="color: red;"|} id="foo"
6155 |foo
6156 |}
6157
6158 {|style="color: red;" |} id="foo"
6159 |foo
6160 |}
6161 !! html
6162 <table style="color: red;"></table>
6163
6164 <table style="color: red;">
6165 <tbody><tr>
6166 <td>foo</td>
6167 </tr></tbody>
6168 </table>
6169
6170 <table style="color: red;" id="foo">
6171 <tbody><tr>
6172 <td>foo</td>
6173 </tr></tbody>
6174 </table>
6175
6176 <table style="color: red;" id="foo">
6177 <tbody><tr>
6178 <td>foo</td>
6179 </tr></tbody>
6180 </table>
6181
6182 !! end
6183
6184 !! test
6185 A table with no data (take 2)
6186 !! wikitext
6187 {|
6188 |}
6189 !! html/parsoid
6190 <table></table>
6191 !! end
6192
6193 # A table with nothing but a caption is invalid XHTML, we might want to render
6194 # this as <p>caption</p>
6195 # Parsoid team replies: table with only a caption is legal in HTML5
6196 !! test
6197 A table with nothing but a caption
6198 !! wikitext
6199 {|
6200 |+caption
6201 |}
6202 !! html/php
6203 <table>
6204 <caption>caption
6205 </caption><tr><td></td></tr></table>
6206
6207 !! html/parsoid
6208 <table><caption>caption</caption></table>
6209 !! end
6210
6211 !! test
6212 A table with caption with default-spaced attributes and a table row
6213 !! wikitext
6214 {|
6215 |+ style="color: red;" |caption1
6216 |-
6217 |foo
6218 |}
6219 !! html
6220 <table>
6221 <caption style="color: red;">caption1
6222 </caption>
6223 <tr>
6224 <td>foo
6225 </td></tr></table>
6226
6227 !! end
6228
6229 !! test
6230 A table with captions with non-default spaced attributes and a table row
6231 !! wikitext
6232 {|
6233 |+style="color: red;"|caption2
6234 |+ style="color: red;"|caption3
6235 |-
6236 |foo
6237 |}
6238 !! html
6239 <table>
6240 <caption style="color: red;">caption2
6241 </caption>
6242 <caption style="color: red;">caption3
6243 </caption>
6244 <tr>
6245 <td>foo
6246 </td></tr></table>
6247
6248 !! end
6249
6250 !! test
6251 Table td-cell syntax variations
6252 !! wikitext
6253 {|
6254 |foo bar foo|baz
6255 |foo bar foo||baz
6256 |style='color:red;'|baz
6257 |style='color:red;'||baz
6258 |}
6259 !! html
6260 <table>
6261 <tr>
6262 <td>baz
6263 </td>
6264 <td>foo bar foo</td>
6265 <td>baz
6266 </td>
6267 <td style="color:red;">baz
6268 </td>
6269 <td>style='color:red;'</td>
6270 <td>baz
6271 </td></tr></table>
6272
6273 !! end
6274
6275 !! test
6276 Simple table
6277 !! wikitext
6278 {|
6279 |1||2
6280 |-
6281 |3||4
6282 |}
6283 !! html
6284 <table>
6285 <tr>
6286 <td>1</td>
6287 <td>2
6288 </td></tr>
6289 <tr>
6290 <td>3</td>
6291 <td>4
6292 </td></tr></table>
6293
6294 !! end
6295
6296 !! test
6297 Simple table but with multiple dashes for row wikitext
6298 !! wikitext
6299 {|
6300 |foo
6301 |-----
6302 |bar
6303 |}
6304 !! html
6305 <table>
6306 <tr>
6307 <td>foo
6308 </td></tr>
6309 <tr>
6310 <td>bar
6311 </td></tr></table>
6312
6313 !! end
6314
6315 !! test
6316 Multiplication table
6317 !! wikitext
6318 {| border="1" cellpadding="2"
6319 |+Multiplication table
6320 |-
6321 !&times;!!1!!2!!3
6322 |-
6323 !1
6324 |1||2||3
6325 |-
6326 !2
6327 |2||4||6
6328 |-
6329 !3
6330 |3||6||9
6331 |-
6332 !4
6333 |4||8||12
6334 |-
6335 !5
6336 |5||10||15
6337 |}
6338 !! html
6339 <table border="1" cellpadding="2">
6340 <caption>Multiplication table
6341 </caption>
6342 <tr>
6343 <th>&#215;</th>
6344 <th>1</th>
6345 <th>2</th>
6346 <th>3
6347 </th></tr>
6348 <tr>
6349 <th>1
6350 </th>
6351 <td>1</td>
6352 <td>2</td>
6353 <td>3
6354 </td></tr>
6355 <tr>
6356 <th>2
6357 </th>
6358 <td>2</td>
6359 <td>4</td>
6360 <td>6
6361 </td></tr>
6362 <tr>
6363 <th>3
6364 </th>
6365 <td>3</td>
6366 <td>6</td>
6367 <td>9
6368 </td></tr>
6369 <tr>
6370 <th>4
6371 </th>
6372 <td>4</td>
6373 <td>8</td>
6374 <td>12
6375 </td></tr>
6376 <tr>
6377 <th>5
6378 </th>
6379 <td>5</td>
6380 <td>10</td>
6381 <td>15
6382 </td></tr></table>
6383
6384 !! end
6385
6386 !! test
6387 Accept "||" in table headings
6388 !! wikitext
6389 {|
6390 !h1||h2
6391 |}
6392 !! html
6393 <table>
6394 <tr>
6395 <th>h1</th>
6396 <th>h2
6397 </th></tr></table>
6398
6399 !! end
6400
6401 !! test
6402 Accept "!!" in table data
6403 !! wikitext
6404 {|
6405 |Foo!!||
6406 |}
6407 !! html
6408 <table>
6409 <tr>
6410 <td>Foo!!</td>
6411 <td>
6412 </td></tr></table>
6413
6414 !! html/parsoid
6415 <table>
6416 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6417 </tbody></table>
6418 !! end
6419
6420 !! test
6421 Accept "||" in indented table headings
6422 !! wikitext
6423 :{|
6424 !h1||h2
6425 |}
6426 !! html
6427 <dl><dd><table>
6428 <tr>
6429 <th>h1</th>
6430 <th>h2
6431 </th></tr></table></dd></dl>
6432
6433 !! end
6434
6435 !! test
6436 Accept "!!" in templates
6437 !! wikitext
6438 {|
6439 !a {{echo|b!!c}}
6440 |}
6441 !! html/php
6442 <table>
6443 <tr>
6444 <th>a b</th>
6445 <th>c
6446 </th></tr></table>
6447
6448 !! html/parsoid
6449 <table>
6450 <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>
6451 !! end
6452
6453 !! test
6454 Accept "!!" in table headings after newline
6455 !! wikitext
6456 {|
6457 !a
6458 b!!c
6459 |}
6460 !! html/php
6461 <table>
6462 <tr>
6463 <th>a
6464 <p>b!!c
6465 </p>
6466 </th></tr></table>
6467
6468 !! html/parsoid
6469 <table>
6470 <tbody><tr><th>a
6471 <p>b!!c</p></th></tr>
6472 </tbody></table>
6473 !! end
6474
6475 !! test
6476 Accept "!!" in table data of mixed wikitext / html syntax
6477 !! wikitext
6478 {|
6479 !a
6480 <tr><td>b!!c</td></tr>
6481 |}
6482 !! html/php+tidy
6483 <table>
6484 <tbody><tr>
6485 <th>a
6486 </th></tr><tr><td>b!!c</td></tr>
6487 </tbody></table>
6488 !! html/parsoid
6489 <table>
6490 <tbody><tr><th>a</th></tr>
6491 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6492 </tbody></table>
6493 !! end
6494
6495 !! test
6496 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6497 !! wikitext
6498 {|
6499 !|h1
6500 ||a
6501 |}
6502 !! html
6503 <table>
6504 <tr>
6505 <th>h1
6506 </th>
6507 <td>a
6508 </td></tr></table>
6509
6510 !! end
6511
6512 !!test
6513 Accept "| !" at start of line in tables (ignore !-attribute)
6514 !! wikitext
6515 {|
6516 |-
6517 |!style="color:red"|bar
6518 |}
6519 !! html
6520 <table>
6521
6522 <tr>
6523 <td>bar
6524 </td></tr></table>
6525
6526 !!end
6527
6528 !!test
6529 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 +/-
6530 !! wikitext
6531 {|
6532 |-
6533 |style='color:red;'|+1
6534 |style='color:blue;'|-1
6535 |-
6536 |1||2||3
6537 |1||+2||-3
6538 |-
6539 | +1
6540 | -1
6541 |}
6542 !! html
6543 <table>
6544
6545 <tr>
6546 <td style="color:red;">+1
6547 </td>
6548 <td style="color:blue;">-1
6549 </td></tr>
6550 <tr>
6551 <td>1</td>
6552 <td>2</td>
6553 <td>3
6554 </td>
6555 <td>1</td>
6556 <td>+2</td>
6557 <td>-3
6558 </td></tr>
6559 <tr>
6560 <td>+1
6561 </td>
6562 <td>-1
6563 </td></tr></table>
6564
6565 !!end
6566
6567 !! test
6568 Table rowspan
6569 !! wikitext
6570 {| border=1
6571 |Cell 1, row 1
6572 |rowspan=2|Cell 2, row 1 (and 2)
6573 |Cell 3, row 1
6574 |-
6575 |Cell 1, row 2
6576 |Cell 3, row 2
6577 |}
6578 !! html
6579 <table border="1">
6580 <tr>
6581 <td>Cell 1, row 1
6582 </td>
6583 <td rowspan="2">Cell 2, row 1 (and 2)
6584 </td>
6585 <td>Cell 3, row 1
6586 </td></tr>
6587 <tr>
6588 <td>Cell 1, row 2
6589 </td>
6590 <td>Cell 3, row 2
6591 </td></tr></table>
6592
6593 !! end
6594
6595 !! test
6596 Nested table
6597 !! wikitext
6598 {| border=1
6599 | &alpha;
6600 |
6601 {| bgcolor=#ABCDEF border=2
6602 |nested
6603 |-
6604 |table
6605 |}
6606 |the original table again
6607 |}
6608 !! html
6609 <table border="1">
6610 <tr>
6611 <td>&#945;
6612 </td>
6613 <td>
6614 <table bgcolor="#ABCDEF" border="2">
6615 <tr>
6616 <td>nested
6617 </td></tr>
6618 <tr>
6619 <td>table
6620 </td></tr></table>
6621 </td>
6622 <td>the original table again
6623 </td></tr></table>
6624
6625 !! end
6626
6627 !! test
6628 Invalid attributes in table cell (T3830)
6629 !! wikitext
6630 {|
6631 |Cell:|broken
6632 |}
6633 !! html
6634 <table>
6635 <tr>
6636 <td>broken
6637 </td></tr></table>
6638
6639 !! end
6640
6641 !! test
6642 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6643 !! wikitext
6644 {|
6645 |title="foo" |bar
6646 |title="foo<nowiki>|</nowiki>" |bar
6647 |title="foo<nowiki>|</nowiki>" bar
6648 |}
6649 !! html/php
6650 <table>
6651 <tr>
6652 <td title="foo">bar
6653 </td>
6654 <td title="foo&#124;">bar
6655 </td>
6656 <td>title="foo|" bar
6657 </td></tr></table>
6658
6659 !! html/parsoid
6660 <table>
6661 <tbody><tr><td title="foo">bar</td>
6662 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6663 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6664 </tbody></table>
6665 !! end
6666
6667 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6668 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6669 # *2wt modes will fail.
6670 !! test
6671 Table security: embedded pipes
6672 !! options
6673 parsoid=wt2html,html2html
6674 !! wikitext
6675 {|
6676 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6677 !! html/php
6678 <table>
6679 <tr>
6680 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6681 <td>]" onmouseover="alert(document.cookie)"&gt;test
6682 </td>
6683 </tr>
6684 </table>
6685
6686 !! html/parsoid
6687 <table><tbody>
6688 <tr>
6689 <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>
6690 !! end
6691
6692 !! test
6693 Element attributes with double ! should not be broken up by <th>
6694 !! wikitext
6695 {|
6696 !hi <div class="!!">ha</div> ho
6697 |}
6698 !! html/php
6699 <table>
6700 <tr>
6701 <th>hi <div class="!!">ha</div> ho
6702 </th></tr></table>
6703
6704 !! html/parsoid
6705 <table>
6706 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6707 </tbody></table>
6708 !! end
6709
6710 !! test
6711 ! and || in element attributes should not be parsed as <th>/<td>
6712 !! wikitext
6713 {|
6714 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6715 |}
6716 !! html/php
6717 <table>
6718 <tr>
6719 <td><div style="color: red&#32;!important;" data-contrived="put this here &#124;&#124;">hi</div>
6720 </td></tr></table>
6721
6722 !! html/parsoid
6723 <table>
6724 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6725 </tbody></table>
6726 !! end
6727
6728 # FIXME: The output seems broken. Filed as T110268.
6729 !! test
6730 ! and || in td attributes should not be parsed as <th>/<td>
6731 !! options
6732 parsoid=wt2html
6733 !! wikitext
6734 {|
6735 |style="color: red !important;" data-contrived="put this here ||"|foo
6736 |}
6737 !! html/php
6738 <table>
6739 <tr>
6740 <td>style="color: red&#160;!important;" data-contrived="put this here</td>
6741 <td>foo
6742 </td></tr></table>
6743
6744 !! html/parsoid
6745 <table>
6746 <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>
6747 </tbody></table>
6748 !! end
6749
6750 !! test
6751 Break on | in element attribute in template
6752 !! options
6753 parsoid=wt2html,html2html
6754 !! wikitext
6755 {{echo|1=<div class="hi|ho">ha</div>}}
6756 !! html/php
6757 <p>ho"&gt;ha&lt;/div&gt;
6758 </p>
6759 !! html/parsoid
6760 <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>
6761 !! end
6762
6763 !! test
6764 Break on | in element attribute name in template
6765 !! wikitext
6766 {{echo|<div cla|ss="hiho">ha</div>}}
6767 !! html/parsoid
6768 <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>
6769 !! end
6770
6771 !! test
6772 Don't break on | in extension attribute in template
6773 !! wikitext
6774 {{echo|<ref name="hi|ho">ha</ref>}}
6775
6776 <references />
6777 !! html/parsoid
6778 <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>
6779
6780 <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>
6781 !! end
6782
6783 ## We don't support roundtripping of these attributes in Parsoid.
6784 ## Selective serialization takes care of preventing dirty diffs.
6785 ## But, on edits, we dirty-diff the invalid attribute text.
6786 !! test
6787 Invalid text in table attributes should be discarded
6788 !! options
6789 parsoid=wt2html
6790 !! wikitext
6791 {| <span>boo</span> style='border:1px solid black'
6792 | <span>boo</span> style='color:blue' |1
6793 |<span>boo</span> style='color:blue'|2
6794 |}
6795 !! html/php
6796 <table style="border:1px solid black">
6797 <tr>
6798 <td style="color:blue">1
6799 </td>
6800 <td style="color:blue">2
6801 </td></tr></table>
6802
6803 !! html/parsoid
6804 <table style="border:1px solid black">
6805 <tr>
6806 <td style="color:blue">1</td>
6807 <td style="color:blue">2</td>
6808 </tr>
6809 </table>
6810 !! end
6811
6812 !! test
6813 Invalid text in table attributes should be preserved by selective serializer
6814 !! options
6815 parsoid={
6816 "modes": ["selser"],
6817 "changes": [
6818 ["td:first-child", "text", "abc"],
6819 ["td + td", "text", "xyz"]
6820 ]
6821 }
6822 !! wikitext
6823 {| <span>boo</span> style='border:1px solid black'
6824 | <span>boo</span> style='color:blue' | 1
6825 |<span>boo</span> style='color:blue'| 2
6826 |}
6827 !! wikitext/edited
6828 {| <span>boo</span> style='border:1px solid black'
6829 | <span>boo</span> style='color:blue' | abc
6830 |<span>boo</span> style='color:blue'| xyz
6831 |}
6832 !! end
6833
6834 !! test
6835 1. Template-generated table cell attributes and cell content
6836 !! wikitext
6837 {|
6838 |{{table_attribs}}
6839 | {{table_attribs}}
6840 || {{table_attribs_5}}
6841 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6842 |align=center {{table_attribs}}
6843 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6844 |}
6845 !! html
6846 <table>
6847 <tr>
6848 <td style="color:red;">Foo
6849 </td>
6850 <td style="color:red;">Foo
6851 </td>
6852 <td>style="color:red;"</td>
6853 <td>Bar
6854 </td>
6855 <td style="color:red;">Foo
6856 </td>
6857 <td align="center" style="color:red;">Foo
6858 </td>
6859 <td align="center" style="color:red;">Foo
6860 </td></tr></table>
6861
6862 !! end
6863
6864 !! test
6865 2. Template-generated table cell attributes and cell content
6866 !! wikitext
6867 {|
6868 |{{table_attribs_2}}
6869 |}
6870 !! html/php
6871 <table>
6872 <tr>
6873 <td style="color:red;">Foo
6874 </td>
6875 <td>Bar</td>
6876 <td>Baz
6877 </td></tr></table>
6878
6879 !! html/parsoid
6880 <table>
6881 <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>
6882 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6883 </tbody></table>
6884 !! end
6885
6886 !! test
6887 3. Template-generated table cell attributes and cell content
6888 !! wikitext
6889 {|
6890 !align=center {{table_header_cells}}
6891 |-
6892 |align=center {{table_cells}}
6893 |}
6894 !! html/php
6895 <table>
6896 <tr>
6897 <th align="center" style="color:red;">Foo</th>
6898 <th style="color:red;"><i>Bar</i></th>
6899 <th style="color:brown;"><i>Foo</i> and Baz
6900 </th></tr>
6901 <tr>
6902 <td align="center" style="color:red;">Foo</td>
6903 <td style="color:red;"><i>Bar</i></td>
6904 <td style="color:brown;"><i>Foo</i> and Baz
6905 </td></tr></table>
6906
6907 !! html/parsoid
6908 <table>
6909 <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>
6910 <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>
6911 </tbody></table>
6912 !! end
6913
6914 !! test
6915 4. Template-generated table cell attributes and cell content inside a templated table
6916 !! wikitext
6917 {{tbl-start}}
6918 !align=center {{table_header_cells}}
6919 |-
6920 |align=center {{table_cells}}
6921 {{tbl-end}}
6922 !! html/php
6923 <table>
6924 <tr>
6925 <th align="center" style="color:red;">Foo</th>
6926 <th style="color:red;"><i>Bar</i></th>
6927 <th style="color:brown;"><i>Foo</i> and Baz
6928 </th></tr>
6929 <tr>
6930 <td align="center" style="color:red;">Foo</td>
6931 <td style="color:red;"><i>Bar</i></td>
6932 <td style="color:brown;"><i>Foo</i> and Baz
6933 </td></tr></table>
6934
6935 !! html/parsoid
6936 <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}}]}'>
6937 <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>
6938 <tr>
6939 <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>
6940 </tbody></table>
6941 !! end
6942
6943 ## Edge case fix to prevent future regressions
6944 !! test
6945 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6946 !! wikitext
6947 {|
6948 |{{table_attribs_7}}
6949 |}
6950 <references />
6951 !! html/parsoid
6952 <table>
6953 <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>
6954 </tbody></table>
6955 <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>
6956 !! end
6957
6958 !! test
6959 Table with row followed by newlines and table heading
6960 !! options
6961 parsoid=wt2html,html2html
6962 !! wikitext
6963 {|
6964 |-
6965
6966 !foo
6967 |}
6968 !! html/*
6969 <table>
6970
6971
6972 <tr>
6973 <th>foo
6974 </th></tr></table>
6975
6976 !! end
6977
6978 !! test
6979 Table with empty line following the start tag
6980 !! options
6981 parsoid=wt2html,html2html
6982 !! wikitext
6983 {|
6984
6985 |-
6986 |foo
6987 |}
6988 !! html/*
6989 <table>
6990
6991
6992 <tr>
6993 <td>foo
6994 </td></tr></table>
6995
6996 !! end
6997
6998 !! test
6999 Table attributes with empty value
7000 !! options
7001 parsoid=wt2html,html2html
7002 !! wikitext
7003 {|
7004 | style=|hello
7005 |}
7006 !! html/php
7007 <table>
7008 <tr>
7009 <td style="">hello
7010 </td></tr></table>
7011
7012 !! html/parsoid
7013 <table>
7014 <tbody><tr><td style="">hello</td></tr>
7015 </tbody></table>
7016 !! end
7017
7018 !! test
7019 Wikitext table with a lot of comments
7020 !! wikitext
7021 {|
7022 <!-- c0 -->
7023 |foo
7024 <!-- c1 -->
7025 |-<!-- c2 -->
7026 <!-- c3 -->
7027 |<!-- c4 -->
7028 <!-- c5 -->
7029 |}
7030 !! html
7031 <table>
7032 <tr>
7033 <td>foo
7034 </td></tr>
7035 <tr>
7036 <td>
7037 </td></tr></table>
7038
7039 !! end
7040
7041 !! test
7042 Wikitext table comments represented in parsoid dom
7043 !! wikitext
7044 {|<!--c1--><!--c2-->
7045 |-<!--c3-->
7046 |x
7047 |}
7048 !! html/php+tidy
7049 <table>
7050
7051 <tbody><tr>
7052 <td>x
7053 </td></tr></tbody></table>
7054 !! html/parsoid
7055 <table><!--c1--><!--c2-->
7056 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
7057 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
7058 </tbody></table>
7059 !! end
7060
7061 !! test
7062 Wikitext table with double-line table cell
7063 !! wikitext
7064 {|
7065 |a
7066 b
7067 |}
7068 !! html
7069 <table>
7070 <tr>
7071 <td>a
7072 <p>b
7073 </p>
7074 </td></tr></table>
7075
7076 !! end
7077
7078 !! test
7079 Table cell with a single comment
7080 !! wikitext
7081 {|
7082 |<!-- c1 -->
7083 |a
7084 |}
7085 !! html
7086 <table>
7087 <tr>
7088 <td>
7089 </td>
7090 <td>a
7091 </td></tr></table>
7092
7093 !! end
7094
7095 !! test
7096 Table-cell after a comment-only-empty-line
7097 !! wikitext
7098 {|
7099 |a
7100 <!--c1-->
7101 <!--c2-->|b
7102 |}
7103 !! html
7104 <table>
7105 <tr>
7106 <td>a
7107 </td>
7108 <td>b
7109 </td></tr></table>
7110
7111 !! html/parsoid
7112 <table>
7113 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7114 <!--c1-->
7115 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
7116 </tbody></table>
7117
7118 !! end
7119
7120 !! test
7121 Build table with {{!}}
7122 !! wikitext
7123 {{{!}} class="wikitable"
7124 !header
7125 !second header
7126 {{!}}- style="color:red;"
7127 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
7128 {{!}}}
7129 !! html
7130 <table class="wikitable">
7131 <tr>
7132 <th>header
7133 </th>
7134 <th>second header
7135 </th></tr>
7136 <tr style="color:red;">
7137 <td>data</td>
7138 <td style="color:red;">second data
7139 </td></tr></table>
7140
7141 !! end
7142
7143 !! test
7144 Build table with pipe as data
7145 !! wikitext
7146 {| class="wikitable"
7147 !header
7148 !second header
7149 |- style="color:red;"
7150 |data|| style="color:red;" |second data
7151 |-
7152 | style="color:red;" |data with | || style="color:red;" | second data with |
7153 |-
7154 ||data with | |||second data with |
7155 |}
7156 !! html
7157 <table class="wikitable">
7158 <tr>
7159 <th>header
7160 </th>
7161 <th>second header
7162 </th></tr>
7163 <tr style="color:red;">
7164 <td>data</td>
7165 <td style="color:red;">second data
7166 </td></tr>
7167 <tr>
7168 <td style="color:red;">data with |</td>
7169 <td style="color:red;">second data with |
7170 </td></tr>
7171 <tr>
7172 <td>data with |</td>
7173 <td>second data with |
7174 </td></tr></table>
7175
7176 !! end
7177
7178 !! test
7179 Build table with wikilink
7180 !! wikitext
7181 {| class="wikitable"
7182 !header||second header
7183 |- style="color:red;"
7184 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
7185 |-
7186 |data||second data [[Main Page|link|text with pipe]]
7187 |}
7188 !! html
7189 <table class="wikitable">
7190 <tr>
7191 <th>header</th>
7192 <th>second header
7193 </th></tr>
7194 <tr style="color:red;">
7195 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
7196 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7197 </td></tr>
7198 <tr>
7199 <td>data</td>
7200 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7201 </td></tr></table>
7202
7203 !! end
7204
7205 # The expected HTML structure in this test is debatable. The PHP parser does
7206 # not parse this kind of table at all. The main focus for Parsoid is on
7207 # round-tripping, so this output is ok for now. TODO: revisit!
7208 !! test
7209 Wikitext table with html-syntax row
7210 !! wikitext
7211 {|
7212 |-
7213 <td>foo</td>
7214 |}
7215 !! html/parsoid
7216 <table>
7217 <tbody>
7218 <tr>
7219 <td>foo</td></tr></tbody></table>
7220 !! end
7221
7222 !! test
7223 Fostered content in tables: Plain text
7224 !! options
7225 parsoid=wt2html,html2html
7226 !! wikitext
7227 {|
7228 |-
7229 a
7230 |}
7231 !! html/php
7232 <table>
7233
7234 a
7235 </table>
7236
7237 !! html/php+tidy
7238
7239
7240 a
7241 <table></table>
7242 !! html/parsoid
7243 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
7244 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7245
7246 </tr></tbody></table>
7247 !! end
7248
7249 !! test
7250 Fostered content in tables: Lists
7251 !! options
7252 parsoid=wt2html,html2html
7253 !! wikitext
7254 {|
7255 |-
7256 *a
7257 |}
7258 !! html/php
7259 <table>
7260
7261 <ul><li>a</li></ul>
7262 </table>
7263
7264 !! html/php+tidy
7265 <ul><li>a</li></ul><table>
7266
7267
7268 </table>
7269 !! html/parsoid
7270 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7271 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7272
7273 </tr></tbody></table>
7274 !! end
7275
7276 !! test
7277 Template generated table cell with attributes
7278 !! wikitext
7279 {|
7280 |-
7281 {{table_attribs_4}} ||a||b
7282 |}
7283 !! html/php+tidy
7284 <table>
7285
7286 <tbody><tr>
7287 <td style="background-color:#DC241f;" width="10px"></td>
7288 <td>a</td>
7289 <td>b
7290 </td></tr></tbody></table>
7291 !! html/parsoid
7292 <table>
7293 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7294 <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>
7295 !! end
7296
7297 !! test
7298 Parsoid: Round-trip tables directly followed by content (T53219)
7299 !! options
7300 parsoid=wt2html,wt2wt
7301 !! wikitext
7302 {|
7303 |foo
7304 |} bar
7305
7306 {|
7307 |baz
7308 |}<b>quux</b>
7309 !! html+tidy
7310 <table>
7311 <tbody><tr>
7312 <td>foo
7313 </td></tr></tbody></table><p> bar
7314 </p><table>
7315 <tbody><tr>
7316 <td>baz
7317 </td></tr></tbody></table><p><b>quux</b>
7318 </p>
7319 !! end
7320
7321 !! test
7322 Parsoid: Default to a newline after tables in new content (T53219)
7323 !! options
7324 parsoid=html2wt
7325 !! html/parsoid
7326 <table><tbody>
7327 <tr><td>foo</td></tr></tbody></table> bar
7328 <table><tbody>
7329 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7330 !! wikitext
7331 {|
7332 |foo
7333 |}
7334 <nowiki> </nowiki>bar
7335 {|
7336 |baz
7337 |}
7338 '''quux'''
7339 !! end
7340
7341 !! test
7342 Parsoid: Row-syntax table headings followed by comment & table cells
7343 !! options
7344 parsoid=wt2html,wt2wt
7345 !! wikitext
7346 {|
7347 !foo||bar
7348 <!-- foo --> ||baz||quux
7349 |}
7350 !! html/php
7351 <table>
7352 <tr>
7353 <th>foo</th>
7354 <th>bar
7355 </th>
7356 <td>baz</td>
7357 <td>quux
7358 </td></tr></table>
7359
7360 !! html/parsoid
7361 <table>
7362 <tbody><tr><th>foo</th><th>bar
7363 <!-- foo --></th><td> baz </td><td>quux</td></tr>
7364 </tbody></table>
7365 !! end
7366
7367 !!test
7368 Parsoid: Recover better from broken table attributes
7369 !!options
7370 parsoid=wt2html
7371 !!wikitext
7372 {| class="foo
7373 | class="bar" |
7374 foo
7375 |}
7376 !!html/php+tidy
7377 <table class="foo">
7378 <tbody><tr>
7379 <td class="bar">
7380 <p>foo
7381 </p>
7382 </td></tr></tbody></table>
7383 !!html/parsoid
7384 <table class="foo">
7385 <tr>
7386 <td class="bar">
7387 <p>foo</p></td></tr>
7388 </tbody></table>
7389 !!end
7390
7391 !! test
7392 Tables: Digest broken attributes on table and tr tag
7393 !! options
7394 parsoid=wt2html
7395 !! wikitext
7396 {| || |} ++
7397 |- || || ++ --
7398 |- > [
7399 |}
7400 !! html
7401 <table>
7402 <tbody>
7403 <tr class='mw-empty-elt'></tr>
7404 <tr class='mw-empty-elt'></tr>
7405 </tbody></table>
7406 !! end
7407
7408 !! test
7409 Table with missing opening <tr> tag
7410 !! options
7411 parsoid=wt2html,wt2wt
7412 !! wikitext
7413 <table>
7414 <td>foo</td>
7415 </tr>
7416 </table>
7417 !! html+tidy
7418 <table>
7419 <tbody><tr><td>foo</td>
7420 </tr>
7421 </tbody></table>
7422 !! end
7423
7424 # T137406: Whitespace in the HTML
7425 !! test
7426 1. Generate correct wikitext for tables with thead/tbody/tfoot
7427 !! options
7428 parsoid=html2wt
7429 !! html/parsoid
7430 <table>
7431 <caption>Test</caption>
7432 <thead>
7433 <tr>
7434 <th>Month</th>
7435 <th>Savings</th>
7436 </tr>
7437 </thead>
7438 <tbody>
7439 <tr>
7440 <td>January</td>
7441 <td>$100</td>
7442 </tr>
7443 <tr>
7444 <td>February</td>
7445 <td>$80</td>
7446 </tr>
7447 </tbody>
7448 <tfoot>
7449 <tr>
7450 <td>Sum</td>
7451 <td>$180</td>
7452 </tr>
7453 </tfoot>
7454 </table>
7455 !! wikitext
7456 {|
7457 |+Test
7458 !Month
7459 !Savings
7460 |-
7461 |January
7462 |$100
7463 |-
7464 |February
7465 |$80
7466 |-
7467 |Sum
7468 |$180
7469 |}
7470 !! html/php+tidy
7471 <table>
7472 <caption>Test
7473 </caption>
7474 <tbody><tr>
7475 <th>Month
7476 </th>
7477 <th>Savings
7478 </th></tr>
7479 <tr>
7480 <td>January
7481 </td>
7482 <td>$100
7483 </td></tr>
7484 <tr>
7485 <td>February
7486 </td>
7487 <td>$80
7488 </td></tr>
7489 <tr>
7490 <td>Sum
7491 </td>
7492 <td>$180
7493 </td></tr></tbody></table>
7494 !! end
7495
7496 # T137406: No whitespace in the HTML
7497 !! test
7498 2. Generate correct wikitext for tables with thead/tbody/tfoot
7499 !! options
7500 parsoid=html2wt
7501 !! html/parsoid
7502 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7503 !! wikitext
7504 {|
7505 !heading
7506 |-
7507 |foo
7508 |}
7509 !! end
7510
7511 !! test
7512 Wikitext tables can be nested inside HTML tables
7513 !! options
7514 parsoid=html2wt
7515 !! html
7516 <table data-parsoid='{"stx":"html"}'>
7517 <tr><td>
7518 <table>
7519 <tr><td>foo</td></tr>
7520 </table>
7521 </td></tr>
7522 </table>
7523 !! wikitext
7524 <table>
7525 <tr><td>
7526 {|
7527 |foo
7528 |}
7529 </td></tr>
7530 </table>
7531 !! end
7532
7533 ###
7534 ### Internal links
7535 ###
7536 !! test
7537 Plain link, capitalized
7538 !! wikitext
7539 [[Main Page]]
7540 !! html
7541 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7542 </p>
7543 !! end
7544
7545 !! test
7546 Plain link, uncapitalized
7547 !! wikitext
7548 [[main Page]]
7549 !! html
7550 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7551 </p>
7552 !! end
7553
7554 !! test
7555 Piped link
7556 !! wikitext
7557 [[Main Page|The Main Page]]
7558 !! html
7559 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7560 </p>
7561 !! end
7562
7563 !! test
7564 Piped link with comment in link text
7565 !! wikitext
7566 [[Main Page|The Main<!--front--> Page]]
7567 !! html
7568 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7569 </p>
7570 !! end
7571
7572 !! test
7573 Piped link with multiple pipe characters in link text
7574 !! wikitext
7575 [[Main Page||The|Main|Page|]]
7576 !! html/php
7577 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7578 </p>
7579 !! html/parsoid
7580 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7581 !! end
7582
7583 !! test
7584 Piped link with no link text
7585 !! wikitext
7586 [[Thomas Bek (bishop of St David's)|]]
7587 !! html/php
7588 <p>[[Thomas Bek (bishop of St David's)|]]
7589 </p>
7590 !! html/parsoid
7591 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7592 !! end
7593
7594 !! test
7595 Piped link with empty link text
7596 !! wikitext
7597 [[Main Page|<nowiki/>]] - empty nowiki
7598 [[Main Page| ]] - empty space
7599 [[Main Page|&nbsp;]] - empty non breaking space
7600 !! html/php
7601 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7602 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7603 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7604 </p>
7605 !! html/parsoid
7606 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7607 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7608 <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>
7609 !! end
7610
7611 !! test
7612 Broken link
7613 !! wikitext
7614 [[Zigzagzogzagzig]]
7615 !! html
7616 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7617 </p>
7618 !! end
7619
7620 !! test
7621 Broken link with fragment
7622 !! wikitext
7623 [[Zigzagzogzagzig#zug]]
7624 !! html
7625 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7626 </p>
7627 !! end
7628
7629 !! test
7630 Special page link with fragment
7631 !! wikitext
7632 [[Special:Version#anchor]]
7633 !! html
7634 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7635 </p>
7636 !! end
7637
7638 !! test
7639 Nonexistent special page link with fragment
7640 !! wikitext
7641 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7642 !! html
7643 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7644 </p>
7645 !! end
7646
7647 !! test
7648 Link with prefix
7649 !! wikitext
7650 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7651 !! html
7652 <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>
7653 </p>
7654 !! end
7655
7656 !! test
7657 Link with suffix
7658 !! wikitext
7659 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7660 !! html
7661 <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>!!!
7662 </p>
7663 !! end
7664
7665 !! article
7666 prefixed article
7667 !! text
7668 Some text
7669 !! endarticle
7670
7671 !! test
7672 T45661: Piped links with identical prefixes
7673 !! wikitext
7674 [[prefixed article|prefixed articles with spaces]]
7675
7676 [[prefixed article|prefixed articlesaoeu]]
7677
7678 [[Main Page|Main Page test]]
7679 !! html
7680 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7681 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7682 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7683 </p>
7684 !! end
7685
7686
7687 !! test
7688 Link with HTML entity in suffix / tail
7689 !! wikitext
7690 [[Main Page]]&quot;, [[Main Page]]&#97;
7691 !! html/php
7692 <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;
7693 </p>
7694 !! html/parsoid
7695 <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>
7696 !! end
7697
7698 !! test
7699 Link with 3 brackets
7700 !! wikitext
7701 [[[Main Page]]]
7702 Foo [[[Main Page]]]
7703 !! html
7704 <p>[[[Main Page]]]
7705 Foo [[[Main Page]]]
7706 </p>
7707 !! end
7708
7709 !! test
7710 Link with 4 brackets
7711 !! wikitext
7712 [[[[Main Page]]]]
7713 !! html
7714 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7715 </p>
7716 !! end
7717
7718 !! test
7719 Piped link with 3 brackets
7720 !! wikitext
7721 [[[main page|the main page]]]
7722 !! html
7723 <p>[[[main page|the main page]]]
7724 </p>
7725 !! end
7726
7727 !! test
7728 Piped link with extlink-like text
7729 !! wikitext
7730 [[Main Page|[bar]]]
7731 [[Main Page|This is a [bar]]]
7732 [[Main Page|[bar]]
7733 !! html/php
7734 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7735 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7736 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7737 </p>
7738 !! html/parsoid
7739 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7740 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7741 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7742 !! end
7743
7744 !! test
7745 Link with multiple pipes
7746 !! wikitext
7747 [[Main Page|The|Main|Page]]
7748 !! html
7749 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7750 </p>
7751 !! end
7752
7753 !! test
7754 Anchor containing a #. (T65430)
7755 !! config
7756 wgFragmentMode=[ 'html5', 'legacy' ]
7757 !! wikitext
7758 [[Main Page#And#Link]]
7759 !! html/php
7760 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7761 </p>
7762 !! html/parsoid
7763 <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>
7764 !! end
7765
7766 !! test
7767 Link to namespaces
7768 !! wikitext
7769 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7770 !! html
7771 <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>
7772 </p>
7773 !! end
7774
7775 !! test
7776 Link with space in namespace
7777 !! wikitext
7778 [[User talk:Foo bar]]
7779 !! html
7780 <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>
7781 </p>
7782 !! end
7783
7784 !! article
7785 MemoryAlpha:AlphaTest
7786 !! text
7787 This is an article in the MemoryAlpha namespace
7788 (which shadows the memoryalpha interwiki link).
7789 !! endarticle
7790
7791 !! test
7792 Namespace takes precedence over interwiki link (T53680)
7793 !! wikitext
7794 [[MemoryAlpha:AlphaTest]]
7795 !! html
7796 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7797 </p>
7798 !! end
7799
7800 # The previous test doesn't work correctly in html2*, due to not recognizing the
7801 # link as an internal one. This one checks for the correct behavior.
7802 !! test
7803 Link to namespace preferred over interwiki with correct rel attribute
7804 !! options
7805 parsoid=html2wt,html2html
7806 !! html/parsoid
7807 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7808 !! wikitext
7809 [[MemoryAlpha:AlphaTest]]
7810 !! end
7811
7812 !! test
7813 Piped link to namespace
7814 !! wikitext
7815 [[Meta:Disclaimers|The disclaimers]]
7816 !! html
7817 <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>
7818 </p>
7819 !! end
7820
7821 !! test
7822 Link containing }
7823 !! wikitext
7824 [[Usually caused by a typo (oops}]]
7825 !! html
7826 <p>[[Usually caused by a typo (oops}]]
7827 </p>
7828 !! end
7829
7830 !! article
7831 7% Solution
7832 !! text
7833 Just a test of an article title containing a percent.
7834 !! endarticle
7835
7836 !! test
7837 Link containing % (not as a hex sequence)
7838 !! wikitext
7839 [[7% Solution]]
7840 [[7% Solution|7%25 Solution]]
7841 !! html/php
7842 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7843 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7844 </p>
7845 !! html/parsoid
7846 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7847 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7848 !! end
7849
7850 # note that the parsoid HTML is identical to the previous test output,
7851 # so the previous test ensures that the html2wt mode will generate the
7852 # "not as a hex sequence" wikitext.
7853 !! test
7854 Link containing % as a single hex sequence interpreted to char
7855 !! options
7856 parsoid=wt2wt,wt2html,html2html
7857 !! wikitext
7858 [[7%25 Solution]]
7859 [[7%25 Solution|7%25 Solution]]
7860 !! html/php
7861 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7862 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7863 </p>
7864 !! html/parsoid
7865 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7866 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7867 !!end
7868
7869 !! test
7870 Link containing % as a double hex sequence interpreted to hex sequence
7871 !! wikitext
7872 [[7%2525 Solution]]
7873 !! html
7874 <p>[[7%2525 Solution]]
7875 </p>
7876 !!end
7877
7878 ## Example for such a section: == < ==
7879 !! test
7880 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7881 !! config
7882 wgFragmentMode=[ 'html5', 'legacy' ]
7883 !! wikitext
7884 [[%23%3c]][[%23%3e]]
7885 !! html/php
7886 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
7887 </p>
7888 !! html/parsoid
7889 <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>
7890 !! end
7891
7892 ## Example for such a section: == < ==
7893 !! test
7894 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
7895 !! config
7896 wgFragmentMode=[ 'legacy' ]
7897 !! wikitext
7898 [[%23%3c]][[%23%3e]]
7899 !! html/php
7900 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7901 </p>
7902 !! end
7903
7904 !! test
7905 Link containing "<#" and ">#" as a hex sequences
7906 !! wikitext
7907 [[%3c%23]][[%3e%23]]
7908 !! html
7909 <p>[[%3c%23]][[%3e%23]]
7910 </p>
7911 !! end
7912
7913 !! test
7914 Link containing an equals sign
7915 !! wikitext
7916 [[Special:BookSources/isbn=4-00-026157-6]]
7917 !! html/php
7918 <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>
7919 </p>
7920 !! html/parsoid
7921 <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>
7922 !! end
7923
7924 !! article
7925 Foo~bar
7926 !! text
7927 Just a test of an article title containing a tilde.
7928 !! endarticle
7929
7930 # note that links containing signatures, like [[Foo~~~~]], are
7931 # massaged by the pre-save transform (PST) and so the tildes are never
7932 # seen by the parser.
7933 !! test
7934 Link containing a tilde
7935 !! wikitext
7936 [[Foo~bar]]
7937 !! html/php
7938 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7939 </p>
7940 !! html/parsoid
7941 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7942 !! end
7943
7944 !! test
7945 Link containing double-single-quotes '' (T6598)
7946 !! wikitext
7947 [[Lista d''e paise d''o munno]]
7948 !! html/php
7949 <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>
7950 </p>
7951 !! html/parsoid
7952 <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>
7953 !! end
7954
7955 !! test
7956 Link containing double quotes and spaces
7957 !! wikitext
7958 [[Cool "Gator"]]
7959 !! html/php
7960 <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>
7961 </p>
7962 !! html/parsoid
7963 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
7964 !! end
7965
7966 !! test
7967 File containing double quotes and spaces
7968 !! wikitext
7969 [[File:Cool "Gator".png]]
7970 !! html/parsoid
7971 <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>
7972 !! end
7973
7974 !! test
7975 Redirect containing double quotes and spaces
7976 !! wikitext
7977 #REDIRECT [[Cool "Gator"]]
7978 !! html/parsoid
7979 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
7980 !! end
7981
7982 !! test
7983 Link containing double-single-quotes '' in text (T6598 sanity check)
7984 !! wikitext
7985 Some [[Link|pretty ''italics'' and stuff]]!
7986 !! html/php
7987 <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>!
7988 </p>
7989 !! html/parsoid
7990 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7991 !! end
7992
7993 !! test
7994 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
7995 !! wikitext
7996 ''Some [[Link|pretty ''italics'' and stuff]]!''
7997 !! html
7998 <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>
7999 </p>
8000 !! end
8001
8002 !! test
8003 Link with double quotes in title part (literal) and alternate part (interpreted)
8004 !! wikitext
8005 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8006
8007 [[''Pentecoste'']]
8008
8009 [[''Pentecoste''|Pentecoste]]
8010
8011 [[''Pentecoste''|''Pentecoste'']]
8012 !! html/php
8013 <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>
8014 </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>
8015 </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>
8016 </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>
8017 </p>
8018 !! html/parsoid
8019 <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>
8020 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8021 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8022 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8023 !! end
8024
8025 !! test
8026 Broken image links with HTML captions (T41700)
8027 !! wikitext
8028 [[File:Nonexistent|<script></script>]]
8029 [[File:Nonexistent|100x100px|<script></script>]]
8030 [[File:Nonexistent|&lt;]]
8031 [[File:Nonexistent|a<i>b</i>c]]
8032 !! html/php
8033 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8034 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8035 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8036 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8037 </p>
8038 !! html/parsoid
8039 <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>
8040 <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>
8041 <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>
8042 <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>
8043 !! end
8044
8045 !! test
8046 Plain link to URL
8047 !! wikitext
8048 [[http://www.example.com]]
8049 !! html/php
8050 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8051 </p>
8052 !! html/parsoid
8053 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
8054 !! end
8055
8056 !! test
8057 Plain link to URL with link text
8058 !! wikitext
8059 [[http://www.example.com Link text]]
8060 !! html
8061 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8062 </p>
8063 !! end
8064
8065 !! test
8066 Plain link to protocol-relative URL
8067 !! wikitext
8068 [[//www.example.com]]
8069 !! html/php
8070 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8071 </p>
8072 !! html/parsoid
8073 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8074 !! end
8075
8076 !! test
8077 Plain link to protocol-relative URL with link text
8078 !! wikitext
8079 [[//www.example.com Link text]]
8080 !! html
8081 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8082 </p>
8083 !! end
8084
8085 !! test
8086 Plain link to page with question mark in title
8087 !! wikitext
8088 [[A?b]]
8089
8090 [[A?b|Baz]]
8091 !! html
8092 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8093 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8094 </p>
8095 !! end
8096
8097 # I'm fairly sure the expected result here is wrong.
8098 # We want these to be URL links, not pseudo-pages with URLs for titles....
8099 # However the current output is also pretty screwy.
8100 #
8101 # ----
8102 # I'm changing it to match the current output--it arguably makes more
8103 # sense in the light of the test above. Old expected result was:
8104 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8105 #</p>
8106 # But I think this test is bordering on "garbage in, garbage out" anyway.
8107 # -- wtm
8108 !! test
8109 Piped link to URL
8110 !! wikitext
8111 Piped link to URL: [[http://www.example.com|an example URL]]
8112 !! html/php
8113 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8114 </p>
8115 !! html/parsoid
8116 <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>
8117 !! end
8118
8119 !! test
8120 Plain link in template argument
8121 !! options
8122 parsoid=wt2html
8123 !! wikitext
8124 {{echo|[http://www.example.com |123]}}
8125
8126 {{echo|[[http://www.example.com |123]]}}
8127
8128 {{echo|[[http://www.example.com |123]}}
8129
8130 {{echo|[http://www.example.com |123]]}}
8131 !! html/php
8132 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8133 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8134 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8135 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8136 </p>
8137 !! html/parsoid
8138 <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>
8139
8140 <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>
8141
8142 <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>
8143
8144 <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>
8145 !! end
8146
8147 !! test
8148 T2002: [[page|http://url/]] should link to page, not http://url/
8149 !! wikitext
8150 [[Main Page|http://url/]]
8151 !! html/php
8152 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8153 </p>
8154 !! html/parsoid
8155 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8156 !! end
8157
8158 # Parsoid does not mark self-links, by design.
8159 !! test
8160 T2337: Escaped self-links should be bold
8161 !! options
8162 title=[[Bug462]]
8163 !! wikitext
8164 [[Bu&#103;462]] [[Bug462]]
8165 !! html/php+tidy
8166 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8167 </p>
8168 !! html/parsoid
8169 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8170 !! end
8171
8172 !! test
8173 Self-link to section should not be bold
8174 !! options
8175 title=[[Main Page]]
8176 !! wikitext
8177 [[Main Page#section]]
8178 !! html
8179 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8180 </p>
8181 !! end
8182
8183 !! article
8184 00
8185 !! text
8186 This is 00.
8187 !! endarticle
8188
8189 !!test
8190 Self-link to numeric title
8191 !!options
8192 title=[[0]]
8193 !! wikitext
8194 [[0]]
8195 !! html
8196 <p><a class="mw-selflink selflink">0</a>
8197 </p>
8198 !!end
8199
8200 !!test
8201 Link to numeric-equivalent title
8202 !!options
8203 title=[[0]]
8204 !! wikitext
8205 [[00]]
8206 !! html
8207 <p><a href="/wiki/00" title="00">00</a>
8208 </p>
8209 !!end
8210
8211 !! test
8212 <nowiki> inside a link
8213 !! wikitext
8214 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8215 !! html
8216 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8217 </p>
8218 !! end
8219
8220 !! test
8221 Non-breaking spaces in title
8222 !! wikitext
8223 [[&nbsp; Main &nbsp; Page &nbsp;]]
8224 !! html
8225 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8226 </p>
8227 !!end
8228
8229 # Add new article for the test below so that it doesn't red-link
8230 !! article
8231 Foo bar baz
8232 !! text
8233 boo
8234 !! endarticle
8235
8236 !! test
8237 Multiple spaces in titles should normalize to a single underscore
8238 !! options
8239 parsoid=wt2html,wt2wt
8240 !! wikitext
8241 [[Foo bar baz|x]]
8242 [[Foo bar baz|x]]
8243 [[Foo bar baz|x]]
8244 !! html/php
8245 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8246 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8247 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8248 </p>
8249 !! html/parsoid
8250 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8251 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8252 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8253 </p>
8254 !! end
8255
8256 !! test
8257 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8258 !! options
8259 language=ca
8260 !! wikitext
8261 '''[[Main Page]]'''
8262 !! html
8263 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8264 </p>
8265 !! end
8266
8267 !! test
8268 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8269 !! options
8270 language=ca
8271 !! wikitext
8272 ''[[Main Page]]''
8273 !! html
8274 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8275 </p>
8276 !! end
8277
8278 !! test
8279 Internal link with en linktrail: no apostrophes (T29473)
8280 !! options
8281 language=en
8282 !! wikitext
8283 [[Something]]'nice
8284 !! html
8285 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8286 </p>
8287 !! end
8288
8289 !! test
8290 Internal link with ca linktrail with apostrophes (T29473)
8291 !! options
8292 language=ca
8293 !! wikitext
8294 [[Something]]'nice
8295 !! html
8296 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8297 </p>
8298 !! end
8299
8300 !! test
8301 Internal link with kaa linktrail with apostrophes (T29473)
8302 !! options
8303 language=kaa
8304 !! wikitext
8305 [[Something]]'nice
8306 !! html
8307 <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>
8308 </p>
8309 !! end
8310
8311 !! test
8312 Link with multiple ":" in a subpage-supporting namespace (T65636)
8313 !! wikitext
8314 [[User:Foo/Test/63636:Bar|Test]]
8315 !! html/php
8316 <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>
8317 </p>
8318 !! html/parsoid
8319 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8320 !! end
8321
8322 ## Mainly a sanity check for Parsoid
8323 !! test
8324 Handle title parsing for subpages
8325 !! options
8326 title=[[/123123]]
8327 subpage
8328 !! wikitext
8329 123
8330 !! html/php
8331 <p>123
8332 </p>
8333 !! html/parsoid
8334 <p>123</p>
8335 !! end
8336
8337 !! article
8338 User:Test/123
8339 !! text
8340 test 123
8341 !! endarticle
8342
8343 !! test
8344 Link to a subpage from a namespace other than main
8345 !! options
8346 title=[[User:Test]]
8347 subpage
8348 !! wikitext
8349 [[/123]]
8350 !! html/php
8351 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8352 </p>
8353 !! html/parsoid
8354 <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>
8355 !! end
8356
8357 !! test
8358 Ensure that transclusion titles are not url-decoded
8359 !! options
8360 subpage title=[[Test]]
8361 parsoid=wt2html
8362 !! wikitext
8363 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8364 !! html/php
8365 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8366 </p>
8367 !! html/parsoid
8368 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8369 !! end
8370
8371 !! test
8372 Purely hash wikilink
8373 !! options
8374 title=[[User:Test/123]]
8375 subpage
8376 !! wikitext
8377 [[#a|b]]
8378 !! html/php
8379 <p><a href="#a">b</a>
8380 </p>
8381 !! html/parsoid
8382 <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>
8383 !! end
8384
8385 !! test
8386 Serialization of purely hash wikilink
8387 !! options
8388 title=[[User:Test/123]]
8389 subpage
8390 parsoid=html2wt
8391 !! html/parsoid
8392 <p><a href="#a">[[</a></p>
8393 !! wikitext
8394 [[#a|<nowiki>[[</nowiki>]]
8395 !! html/php
8396 <p><a href="#a">[[</a>
8397 </p>
8398 !! end
8399
8400 !! test
8401 1. Interaction of linktrail and template encapsulation
8402 !! wikitext
8403 {{echo|[[Foo]]}}l
8404 !! html/parsoid
8405 <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>
8406 !! end
8407
8408 !! test
8409 2. Interaction of linktrail and template encapsulation
8410 !! options
8411 parsoid
8412 !! wikitext
8413 {{echo|Some [[Fool]]}}s
8414 !! html
8415 <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>
8416 !! end
8417
8418 !! test
8419 3. Interaction of linktrail and template encapsulation
8420 !! options
8421 parsoid
8422 !! wikitext
8423 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8424 !! html
8425 <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>
8426 !! end
8427
8428 !! article
8429 Söfnuður
8430 !! text
8431 Test.
8432 !! endarticle
8433
8434 !! test
8435 Internal link with is link prefix
8436 !! options
8437 language=is
8438 !! wikitext
8439 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8440 !! html
8441 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8442 </p>
8443 !! end
8444
8445 !! article
8446 Mótmælendatrú
8447 !! text
8448 Test.
8449 !! endarticle
8450
8451 !! test
8452 Internal link with is link trail and link prefix
8453 !! options
8454 language=is
8455 !! wikitext
8456 [[mótmælendatrú|xxx]]ar
8457 [[mótmælendatrú]]ar
8458 mótmælenda[[söfnuður]]
8459 mótmælenda[[söfnuður|söfnuðir]]
8460 mótmælenda[[söfnuður|söfnuðir]]xxx
8461 !! html
8462 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8463 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8464 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8465 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8466 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8467 </p>
8468 !! end
8469
8470 !! test
8471 Parsoid link trail escaping
8472 !! options
8473 parsoid=html2wt,html2html
8474 !! html/parsoid
8475 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8476 !! wikitext
8477 [[apple]]<nowiki/>s
8478 !! end
8479
8480 !! test
8481 Parsoid link prefix escaping
8482 !! options
8483 language=is
8484 parsoid=html2wt,html2html
8485 !! html/parsoid
8486 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8487 !! wikitext
8488 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8489 !! end
8490
8491 !! test
8492 Parsoid link bracket escaping
8493 !! options
8494 parsoid=html2wt,html2html
8495 !! html/parsoid
8496 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8497 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8498 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8499 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8500 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8501 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8502 !! wikitext
8503 [[Test]]
8504
8505 [<nowiki/>[[Test]]]
8506
8507 [[[[Test]]]]
8508
8509 [[[<nowiki/>[[Test]]]]]
8510
8511 [[[[[[Test]]]]]]
8512
8513 [[[[[<nowiki/>[[Test]]]]]]]
8514 !! end
8515
8516 !! test
8517 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8518 !! wikitext
8519 [[Foo| bar]]
8520
8521 [[Foo| ''bar'']]
8522
8523 [http://wp.org foo]
8524
8525 [http://wp.org ''foo'']
8526 !! html
8527 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8528 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8529 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8530 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8531 </p>
8532 !! end
8533
8534 !! test
8535 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8536 !! wikitext
8537 [[Foo|{{echo|a}} b {{echo|c}}]]
8538 !! html/parsoid
8539 <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>
8540 !! end
8541
8542 !! test
8543 Link with angle bracket after anchor
8544 !! config
8545 wgFragmentMode=[ 'html5', 'legacy' ]
8546 !! wikitext
8547 [[Foo#<bar>]]
8548 !! html/php
8549 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8550 </p>
8551 !! html/parsoid
8552 <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>
8553 !! end
8554
8555 !! test
8556 Link with angle bracket after anchor (legacy)
8557 !! config
8558 wgFragmentMode=[ 'legacy' ]
8559 !! wikitext
8560 [[Foo#<bar>]]
8561 !! html/php
8562 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8563 </p>
8564 !! end
8565
8566 ###
8567 ### Interwiki links (see maintenance/interwiki.sql)
8568 ###
8569
8570 !! test
8571 Inline interwiki link
8572 !! options
8573 parsoid=wt2html,wt2wt,html2html
8574 !! wikitext
8575 [[MeatBall:SoftSecurity]]
8576 !! html/php
8577 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8578 </p>
8579 !! html/parsoid
8580 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8581 !! end
8582
8583 !! test
8584 Inline interwiki link with empty title (T4372)
8585 !! options
8586 parsoid=wt2html,wt2wt,html2html
8587 !! wikitext
8588 [[MeatBall:]]
8589 !! html/php
8590 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8591 </p>
8592 !! html/parsoid
8593 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8594 !! end
8595
8596 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8597 !! test
8598 Interwiki link encoding conversion (T3636)
8599 !! options
8600 parsoid=wt2html,wt2wt
8601 !! wikitext
8602 *[[Wikipedia:ro:Olteni&#0355;a]]
8603 *[[Wikipedia:ro:Olteni&#355;a]]
8604 !! html
8605 <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>
8606 <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>
8607
8608 !! html/php+tidy
8609 <ul>
8610 <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>
8611 <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>
8612 </ul>
8613 !! html/parsoid
8614 <ul>
8615 <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>
8616 <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>
8617 </ul>
8618 !! end
8619
8620 !! test
8621 Interwiki link with fragment (T4130)
8622 !! wikitext
8623 [[MeatBall:SoftSecurity#foo]]
8624 !! html
8625 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8626 </p>
8627 !! end
8628
8629 !! test
8630 Link scenarios with escaped fragments
8631 !! config
8632 wgFragmentMode=[ 'html5', 'legacy' ]
8633 !! wikitext
8634 [[#Is this great?]]
8635 [[Foo#Is this great?]]
8636 [[meatball:Foo#Is this great?]]
8637 !! html/php
8638 <p><a href="#Is_this_great?">#Is this great?</a>
8639 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8640 <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>
8641 </p>
8642 !! html/parsoid
8643 <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>
8644 <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>
8645 <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>
8646 !! end
8647
8648 !! test
8649 Link scenarios with escaped fragments (legacy)
8650 !! config
8651 wgFragmentMode=[ 'legacy' ]
8652 !! wikitext
8653 [[#Is this great?]]
8654 [[Foo#Is this great?]]
8655 [[meatball:Foo#Is this great?]]
8656 !! html/php
8657 <p><a href="#Is_this_great.3F">#Is this great?</a>
8658 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8659 <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>
8660 </p>
8661 !! end
8662
8663 # Ideally the wikipedia: prefix here should be proto-relative too
8664 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8665 # define the 'en' prefix, and originally the test used 'wikipedia',
8666 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8667 # article.
8668 !! test
8669 Different interwiki prefixes mapping to the same URL
8670 !! wikitext
8671 [[:en:Foo]]
8672
8673 [[:en:Foo|Foo]]
8674
8675 [[wikipedia:Foo]]
8676
8677 [[:wikipedia:Foo|Foo]]
8678
8679 [[wikipedia:en:Foo]]
8680
8681 [[:wikipedia:en:Foo]]
8682
8683 [[ wikiPEdia :Foo]]
8684 !! html/parsoid
8685 <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>
8686
8687 <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>
8688
8689 <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>
8690
8691 <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>
8692
8693 <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>
8694
8695 <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>
8696
8697 <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>
8698 !! end
8699
8700 !! test
8701 Interwiki links that cannot be represented in wiki syntax
8702 !! wikitext
8703 [[meatball:ok]]
8704 [[meatball:ok#foo|ok with fragment]]
8705 [[meatball:ok_as_well?|ok ending with ? mark]]
8706 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8707 [http://de.wikipedia.org/wiki/#foo is just fragment]
8708
8709 !! html/php
8710 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8711 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8712 <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>
8713 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8714 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8715 </p>
8716 !! html/parsoid
8717 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8718 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8719 <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>
8720 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8721 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8722 !! end
8723
8724 !! test
8725 Interwiki links: trail
8726 !! wikitext
8727 [[wikipedia:Foo|Ba]]r
8728 !! html/php
8729 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8730 </p>
8731 !! html/parsoid
8732 <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>
8733 !! end
8734
8735 !! test
8736 Local interwiki link
8737 !! options
8738 parsoid=wt2html,wt2wt,html2html
8739 !! wikitext
8740 [[local:Template:Foo]]
8741 !! html/php
8742 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8743 </p>
8744 !! html/parsoid
8745 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8746 !! end
8747
8748 # Parsoid does not mark self-links, by design.
8749 !! test
8750 Local interwiki link: self-link to current page
8751 !! options
8752 title=[[Main Page]]
8753 parsoid=wt2html,wt2wt,html2html
8754 !! wikitext
8755 [[local:Main Page]]
8756 !! html/php
8757 <p><a class="mw-selflink selflink">local:Main Page</a>
8758 </p>
8759 !! html/parsoid
8760 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8761 !! end
8762
8763 !! test
8764 Local interwiki link: prefix only (T66167)
8765 !! options
8766 parsoid=wt2html,wt2wt,html2html
8767 !! wikitext
8768 [[local:]]
8769 !! html/php
8770 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8771 </p>
8772 !! html/parsoid
8773 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8774 !! end
8775
8776 !! test
8777 Local interwiki link: with additional interwiki prefix (T63357)
8778 !! options
8779 parsoid=wt2html,wt2wt,html2html
8780 !! wikitext
8781 [[local:meatball:Hello]]
8782 !! html/php
8783 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8784 </p>
8785 !! html/parsoid
8786 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8787 !! end
8788
8789 !! test
8790 Multiple local interwiki link prefixes
8791 !! wikitext
8792 [[local:local:local:local:mi:local:Foo]]
8793 !! options
8794 parsoid=wt2html,wt2wt,html2html
8795 !! html/php
8796 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8797 </p>
8798 !! html/parsoid
8799 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8800 !! end
8801
8802 ###
8803 ### Interlanguage links
8804 ### Language links (so that searching for '### language' matches..)
8805 ###
8806
8807 !! test
8808 Interlanguage link
8809 !! wikitext
8810 Blah blah blah
8811 [[zh:Chinese]]
8812 !! html/php
8813 <p>Blah blah blah
8814 </p>
8815 !! html/parsoid
8816 <p>Blah blah blah</p>
8817 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8818 !! end
8819
8820 ## parsoid html2wt will lose the space variations
8821 !! test
8822 Interlanguage link with spacing
8823 !! options
8824 parsoid=wt2html,wt2wt,html2html
8825 !! wikitext
8826 Blah blah blah
8827 [[ zh : Chinese ]]
8828 !! html/php
8829 <p>Blah blah blah
8830 </p>
8831 !! html/parsoid
8832 <p>Blah blah blah</p>
8833 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8834 !! end
8835
8836 !! test
8837 Double interlanguage link
8838 !! wikitext
8839 Blah blah blah
8840 [[es:Spanish]]
8841 [[zh:Chinese]]
8842 !! html/php
8843 <p>Blah blah blah
8844 </p>
8845 !! html/parsoid
8846 <p>Blah blah blah</p>
8847 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8848 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8849 !! end
8850
8851 ## parsoid html2wt will lose the space variations
8852 !! test
8853 Interlanguage link variations
8854 !! options
8855 parsoid=wt2html,wt2wt,html2html
8856 !! wikitext
8857 Blah blah blah
8858 [[ es :Spanish]]
8859 [[ ZH :Chinese]]
8860 [[es:Foo_bar]]
8861 !! html/php
8862 <p>Blah blah blah
8863 </p>
8864 !! html/parsoid
8865 <p>Blah blah blah</p>
8866 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8867 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8868 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8869 !! end
8870
8871 !! test
8872 Escaping of interlanguage links (T129218, T156308)
8873 !! wikitext
8874 Blah blah blah
8875 [[:es:Spanish]]
8876 [[ : zh : Chinese ]]
8877 !! html/php
8878 <p>Blah blah blah
8879 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8880 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8881 </p>
8882 !! html/parsoid
8883 <p>Blah blah blah
8884 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8885 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8886 !! end
8887
8888 !! test
8889 Multiple colons escaping interlanguage links
8890 !! options
8891 parsoid=wt2html
8892 !! wikitext
8893 [[:es:Spanish]]
8894 [[::es:Spanish]]
8895 [[:::es:Spanish]]
8896 !! html/php
8897 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8898 [[::es:Spanish]]
8899 [[:::es:Spanish]]
8900 </p>
8901 !! html/parsoid
8902 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8903 [[::es:Spanish]]
8904 [[:::es:Spanish]]</p>
8905 !! end
8906
8907 ## parsoid html2wt will normalize the space to _
8908 !! test
8909 Space and question mark encoding in interlanguage links (T95473)
8910 !! options
8911 parsoid=wt2html,wt2wt,html2html
8912 !! wikitext
8913 Blah blah blah
8914 [[es:Foo bar?]]
8915 !! html/php
8916 <p>Blah blah blah
8917 </p>
8918 !! html/parsoid
8919 <p>Blah blah blah</p>
8920 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8921 !! end
8922
8923 !! test
8924 Interlanguage link, with prefix links
8925 !! options
8926 language=ln
8927 !! wikitext
8928 Blah blah blah
8929 [[zh:Chinese]]
8930 !! html/php
8931 <p>Blah blah blah
8932 </p>
8933 !! html/parsoid
8934 <p>Blah blah blah</p>
8935 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8936 !! end
8937
8938 !! test
8939 Double interlanguage link, with prefix links (T10897)
8940 !! options
8941 language=ln
8942 !! wikitext
8943 Blah blah blah
8944 [[es:Spanish]]
8945 [[zh:Chinese]]
8946 !! html/php
8947 <p>Blah blah blah
8948 </p>
8949 !! html/parsoid
8950 <p>Blah blah blah</p>
8951 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8952 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8953 !! end
8954
8955 !! test
8956 "Extra" interlanguage links (T34189 / gerrit 111390)
8957 !! wikitext
8958 Blah blah blah
8959 [[mul:Article]]
8960 !! html/php
8961 <p>Blah blah blah
8962 </p>
8963 !! html/parsoid
8964 <p>Blah blah blah</p>
8965 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8966 !! end
8967
8968 ## PHP parser tests script needs an update
8969 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8970 !! test
8971 Language links render as inline links if $wgInterwikiMagic=false
8972 !! options
8973 wgInterwikiMagic=false
8974 parsoid=wt2html,wt2wt,html2html
8975 !! wikitext
8976 Blah blah blah
8977 [[zh:Chinese]]
8978 !! html/parsoid
8979 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8980 !! end
8981
8982 ## PHP parser tests script needs an update
8983 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8984 !! test
8985 Language links render as inline links in the Talk namespace
8986 !! options
8987 title=Talk:Foo
8988 parsoid=wt2html,wt2wt,html2html
8989 !! wikitext
8990 Blah blah blah
8991 [[zh:Chinese]]
8992 !! html/parsoid
8993 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8994 !! end
8995
8996 !! test
8997 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8998 !! options
8999 language=ln
9000 !! wikitext
9001 [[WW&nbsp;II]]
9002 !! html
9003 <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>
9004 </p>
9005 !! end
9006
9007 !! test
9008 Parsoid T55221: Wikilinks should be properly entity-escaped
9009 !! options
9010 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
9011 !! html/parsoid
9012 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9013 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9014 !! wikitext
9015 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
9016
9017 He&amp;nbsp;llo He&amp;nbsp;llo
9018 !! html/php
9019 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
9020 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
9021 </p>
9022 !! end
9023
9024 # html2wt will fail because of title normalization without data-parsoid
9025 !! test
9026 Parsoid: handle constructor well
9027 !! options
9028 parsoid=wt2html,wt2wt
9029 !! wikitext
9030 [[constructor]]
9031
9032 [[constructor:foo]]
9033 !! html/php
9034 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9035 </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>
9036 </p>
9037 !! html/parsoid
9038 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9039
9040 <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>
9041 !! end
9042
9043 !! test
9044 Template parameter named "constructor"
9045 !! wikitext
9046 {{echo| constructor = |hi}}
9047 !! html/parsoid
9048 <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>
9049 !! end
9050
9051 !! article
9052 ko:
9053 !! text
9054 Test.
9055 !! endarticle
9056
9057 # Note that `ko` isn't a known interlanguage prefix
9058 !! test
9059 Parsoid: recognize interlanguage links without a target page
9060 !! options
9061 ill
9062 !! wikitext
9063 [[es:]]
9064
9065 [[ko:]]
9066 !! html/php
9067 es:
9068 !! html/parsoid
9069 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9070
9071 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9072 !! end
9073
9074 # Note that `ko` isn't a known interwiki prefix
9075 !! test
9076 Parsoid: recognize interwiki links without a target page
9077 !! options
9078 parsoid=wt2html,wt2wt,html2html
9079 !! wikitext
9080 [[:es:]]
9081
9082 [[:ko:]]
9083 !! html/php
9084 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9085 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9086 </p>
9087 !! html/parsoid
9088 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9089 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9090 !! end
9091
9092 !! test
9093 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9094 !! wikitext
9095 [[mi:Foo]]
9096 !! html/php
9097 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9098 </p>
9099 !! html/parsoid
9100 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9101 !! end
9102
9103 !! test
9104 Interlanguage link with preceding local interwiki link (T70085)
9105 !! options
9106 parsoid=wt2html,wt2wt,html2html
9107 !! wikitext
9108 Blah blah blah
9109 [[local:es:Spanish]]
9110 !! html/php
9111 <p>Blah blah blah
9112 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9113 </p>
9114 !! html/parsoid
9115 <p>Blah blah blah
9116 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9117 !! end
9118
9119 !! test
9120 Looks like an interlanguage link, but is actually a local interwiki
9121 !! options
9122 parsoid=wt2html,wt2wt,html2html
9123 !! wikitext
9124 Blah blah blah
9125 [[mi:Template:Foo]]
9126 !! html/php
9127 <p>Blah blah blah
9128 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9129 </p>
9130 !! html/parsoid
9131 <p>Blah blah blah
9132 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9133 !! end
9134
9135 ###
9136 ### Redirects, Parsoid-only
9137 ###
9138
9139 !! test
9140 1. Simple redirect to page
9141 !! wikitext
9142 #REDIRECT [[Main Page]]
9143 !! html/parsoid
9144 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9145 !! end
9146
9147 !! test
9148 2. Other redirect variants
9149 !! wikitext
9150 #REDIRECT [[Main_Page]]
9151 !! html/parsoid
9152 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9153 !! end
9154
9155 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9156 # This tests the Parsoid bail-out code.
9157 !! test
9158 3. Other redirect variants
9159 !! options
9160 parsoid=wt2html
9161 !! wikitext
9162 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9163 !! html/parsoid
9164 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9165 !! end
9166
9167 !! test
9168 4. Redirect to a templated destination
9169 !! wikitext
9170 #REDIRECT [[{{echo|Foo}}bar]]
9171 !! html/parsoid
9172 <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"}]]}'/>
9173 !! end
9174
9175 !! test
9176 Empty redirect
9177 !! options
9178 parsoid=wt2html,wt2wt
9179 !! wikitext
9180 #REDIRECT [[]]
9181 !! html/parsoid
9182 <ol>
9183 <li>REDIRECT [[]]</li></ol>
9184 !! end
9185
9186 !! test
9187 Optional colon in #REDIRECT
9188 !! options
9189 # the colon is archaic syntax. we support it for wt2html, but we
9190 # don't care that it roundtrips back to the modern syntax.
9191 parsoid=wt2html,html2html
9192 !! wikitext
9193 #REDIRECT:[[Main Page]]
9194 !! html/parsoid
9195 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9196 !! end
9197
9198 !! test
9199 Whitespace in #REDIRECT with optional colon
9200 !! options
9201 # the colon and gratuitous whitespace is archaic syntax. we support
9202 # it for wt2html, but we don't care that it roundtrips back to the
9203 # modern syntax (without extra whitespace)
9204 parsoid=wt2html,html2html
9205 !! wikitext
9206
9207 #REDIRECT
9208 :
9209 [[Main Page]]
9210 !! html/parsoid
9211 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9212 !! end
9213
9214 !! test
9215 Piped link in #REDIRECT
9216 !! options
9217 # content after piped link is ignored. we support this syntax,
9218 # but don't care that the piped link is lost when we roundtrip this.
9219 parsoid=wt2html
9220 !! wikitext
9221 #REDIRECT [[Main Page|bar]]
9222 !! html/parsoid
9223 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9224 !! end
9225
9226 !! test
9227 Redirect to category (T104502)
9228 !! options
9229 parsoid=wt2html,wt2wt
9230 !! wikitext
9231 #REDIRECT [[Category:Foo]]
9232 !! html/parsoid
9233 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9234 !! end
9235
9236 !! test
9237 Redirect to category with URL encoding (T104502)
9238 !! options
9239 parsoid=wt2html
9240 !! wikitext
9241 #REDIRECT [[Category%3AFoo]]
9242 !! html/parsoid
9243 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9244 !! end
9245
9246 !! test
9247 Redirect to category page
9248 !! wikitext
9249 #REDIRECT [[:Category:Foo]]
9250 !! html/parsoid
9251 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9252 !! end
9253
9254 !! test
9255 Redirect to image page (1)
9256 !! wikitext
9257 #REDIRECT [[File:Wiki.png]]
9258 !! html/parsoid
9259 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9260 !! end
9261
9262 !! test
9263 Redirect to image page (2)
9264 !! wikitext
9265 #REDIRECT [[Image:Wiki.png]]
9266 !! html/parsoid
9267 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9268 !! end
9269
9270 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9271 # Next test confirms this.
9272 !! test
9273 Redirect to language (1) (T104918)
9274 !! options
9275 parsoid=wt2html,wt2wt,html2html
9276 !! wikitext
9277 #REDIRECT [[en:File:Wiki.png]]
9278 !! html/parsoid
9279 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9280 !! end
9281
9282 !! test
9283 Redirect to language (2) (T104918)
9284 !! wikitext
9285 #REDIRECT [[:en:File:Wiki.png]]
9286 !! html/parsoid
9287 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9288 !! end
9289
9290 !! test
9291 Redirect to interwiki (T104918)
9292 !! wikitext
9293 #REDIRECT [[meatball:File:Wiki.png]]
9294 !! html/parsoid
9295 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9296 !! end
9297
9298 !! test
9299 Non-English #REDIRECT
9300 !! options
9301 language=is
9302 !! wikitext
9303 #TILVÍSUN [[Main Page]]
9304 !! html/parsoid
9305 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9306 !! end
9307
9308 !! test
9309 Redirect syntax under text isn't considered a redirect
9310 !! wikitext
9311 some text
9312
9313 #redirect [[Main Page]]
9314 !! html/parsoid
9315 <p>some text</p>
9316 <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>
9317 !! end
9318
9319 !! test
9320 New redirect
9321 !! options
9322 parsoid=html2wt
9323 !! html/parsoid
9324 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9325 !! wikitext
9326 #REDIRECT [[Foo]]
9327 Foo
9328 !! end
9329
9330 !! test
9331 Redirect followed by block on the same line
9332 !! options
9333 parsoid=wt2html
9334 !! wikitext
9335 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9336 !! html/parsoid
9337 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9338 !! end
9339
9340 !! test
9341 Redirect followed by a newline
9342 !! wikitext
9343 #REDIRECT [[Main Page]]
9344 A newline
9345 !! html/parsoid
9346 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9347 <p>A newline</p>
9348 !! end
9349
9350 !! test
9351 Redirect followed by multiple newlines
9352 !! wikitext
9353 #REDIRECT [[Main Page]]
9354
9355
9356 A newline
9357 !! html/parsoid
9358 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9359
9360 <p><br/>
9361 A newline</p>
9362 !! end
9363
9364 !! test
9365 Drop duplicate redirects
9366 !! options
9367 parsoid=html2wt
9368 !! html/parsoid
9369 <link rel="mw:PageProp/redirect" href="./Foo"/>
9370 <link rel="mw:PageProp/redirect" href="./Bar"/>
9371 <link rel="mw:PageProp/redirect" href="./Baz"/>
9372 !! wikitext
9373 #REDIRECT [[Foo]]
9374 !! end
9375
9376 ##
9377 ## XHTML tidiness
9378 ###
9379
9380 !! test
9381 <br> to <br />
9382 !! wikitext
9383 1<br>2<br />3
9384 !! html
9385 <p>1<br />2<br />3
9386 </p>
9387 !! end
9388
9389 !! test
9390 Broken br tag sanitization
9391 !! wikitext
9392 </br>
9393 !! html/php
9394 <p>&lt;/br&gt;
9395 </p>
9396 !! end
9397
9398 # TODO: Fix html2html mode (T53055)!
9399 !! test
9400 Parsoid: Broken br tag recognition
9401 !! options
9402 parsoid=wt2html
9403 !! wikitext
9404 </br>
9405
9406 <br/ >
9407 !! html+tidy
9408 <p><br />
9409 </p><p><br />
9410 </p>
9411 !! end
9412
9413 !! test
9414 Incorrecly removing closing slashes from correctly formed XHTML
9415 !! wikitext
9416 <br style="clear:both;" />
9417 !! html
9418 <p><br style="clear:both;" />
9419 </p>
9420 !! end
9421
9422 !! test
9423 Failing to transform badly formed HTML into correct XHTML
9424 !! wikitext
9425 <br style="clear: left;">
9426 <br style="clear: right;">
9427 <br style="clear: both;">
9428 !! html
9429 <p><br style="clear: left;" />
9430 <br style="clear: right;" />
9431 <br style="clear: both;" />
9432 </p>
9433 !!end
9434
9435 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9436 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9437 !! test
9438 Handling html with a div self-closing tag
9439 !! wikitext
9440 <div title />
9441 <div title/>
9442 <div title/ >
9443 <div title=bar />
9444 <div title=bar/>
9445 <div title=bar/ >
9446 !! html/php
9447 <p>&lt;div title /&gt;
9448 &lt;div title/&gt;
9449 </p>
9450 <div>
9451 <p>&lt;div title=bar /&gt;
9452 &lt;div title=bar/&gt;
9453 </p>
9454 <div title="bar/"></div>
9455 </div>
9456
9457 !! html/parsoid
9458 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9459 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9460 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9461 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9462 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9463 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9464 !! end
9465
9466 !! test
9467 Handling html with a br self-closing tag
9468 !! wikitext
9469 <br title />
9470 <br title/>
9471 <br title/ >
9472 <br title=bar />
9473 <br title=bar/>
9474 <br title=bar/ >
9475 !! html/php
9476 <p><br title="" />
9477 <br title="" />
9478 <br />
9479 <br title="bar" />
9480 <br title="bar" />
9481 <br title="bar/" />
9482 </p>
9483 !! html/parsoid
9484 <p><br title="" />
9485 <br title="" />
9486 <br title="" />
9487 <br title="bar" />
9488 <br title="bar" />
9489 <br title="bar/" />
9490 </p>
9491 !! end
9492
9493 !! test
9494 Horizontal ruler (should it add that extra space?)
9495 !! wikitext
9496 <hr>
9497 <hr >
9498 foo <hr
9499 > bar
9500 !! html+tidy
9501 <hr />
9502 <hr /><p>
9503 foo </p><hr /><p> bar
9504 </p>
9505 !! end
9506
9507 !! test
9508 Horizontal ruler -- 4+ dashes render hr
9509 !! wikitext
9510 ----
9511 !! html
9512 <hr />
9513
9514 !! end
9515
9516 !! test
9517 Horizontal ruler -- eats additional dashes on the same line
9518 !! wikitext
9519 ---------
9520 !! html
9521 <hr />
9522
9523 !! end
9524
9525 !! test
9526 Horizontal ruler -- does not collapse dashes on consecutive lines
9527 !! wikitext
9528 ----
9529 ----
9530 !! html
9531 <hr />
9532 <hr />
9533
9534 !! end
9535
9536 !! test
9537 Horizontal ruler -- <4 dashes render as plain text
9538 !! wikitext
9539 ---
9540 !! html
9541 <p>---
9542 </p>
9543 !! end
9544
9545 !! test
9546 Horizontal ruler -- Supports content following dashes on same line
9547 !! wikitext
9548 ---- Foo
9549 !! html
9550 <hr /> Foo
9551
9552 !! html+tidy
9553 <hr /><p> Foo
9554 </p>
9555 !! end
9556
9557 ###
9558 ### Block-level elements
9559 ###
9560 !! test
9561 Common list
9562 !! wikitext
9563 *Common list
9564 *item 2
9565 *item 3
9566 !! html
9567 <ul><li>Common list</li>
9568 <li>item 2</li>
9569 <li>item 3</li></ul>
9570
9571 !! end
9572
9573 !! test
9574 Numbered list
9575 !! wikitext
9576 #Numbered list
9577 #item 2
9578 #item 3
9579 !! html
9580 <ol><li>Numbered list</li>
9581 <li>item 2</li>
9582 <li>item 3</li></ol>
9583
9584 !! end
9585
9586 # the switch from level 3 to ordered should not introduce a newline between
9587 !! test
9588 Mixed list
9589 !! wikitext
9590 *Mixed list
9591 *#with numbers
9592 **and bullets
9593 *#and numbers
9594 *bullets again
9595 **bullet level 2
9596 ***bullet level 3
9597 ***#Number on level 4
9598 **bullet level 2
9599 **#Number on level 3
9600 **#Number on level 3
9601 *#number level 2
9602 *Level 1
9603 ***Level 3
9604 #**Level 3, but ordered
9605 !! html
9606 <ul><li>Mixed list
9607 <ol><li>with numbers</li></ol>
9608 <ul><li>and bullets</li></ul>
9609 <ol><li>and numbers</li></ol></li>
9610 <li>bullets again
9611 <ul><li>bullet level 2
9612 <ul><li>bullet level 3
9613 <ol><li>Number on level 4</li></ol></li></ul></li>
9614 <li>bullet level 2
9615 <ol><li>Number on level 3</li>
9616 <li>Number on level 3</li></ol></li></ul>
9617 <ol><li>number level 2</li></ol></li>
9618 <li>Level 1
9619 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9620 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9621
9622 !! end
9623
9624 !! test
9625 1. Nested mixed wikitext and html list
9626 !! wikitext
9627 *hi
9628 *<ul><li>ho</li></ul>
9629 *hi
9630 **ho
9631 !! html/php
9632 <ul><li>hi</li>
9633 <li><ul><li>ho</li></ul></li>
9634 <li>hi
9635 <ul><li>ho</li></ul></li></ul>
9636
9637 !! html/parsoid
9638 <ul><li>hi</li>
9639 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9640 <li>hi
9641 <ul><li>ho</li></ul></li></ul>
9642 !! end
9643
9644 !! test
9645 2. Nested mixed wikitext and html list (incompatible)
9646 !! wikitext
9647 ;hi
9648 :{{echo|<li>ho</li>}}
9649 !! html/php
9650 <dl><dt>hi</dt>
9651 <dd><li>ho</li></dd></dl>
9652
9653 !! html/parsoid
9654 <dl><dt>hi</dt>
9655 <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>
9656 !! end
9657
9658 !! test
9659 Nested lists 1
9660 !! wikitext
9661 *foo
9662 **bar
9663 !! html
9664 <ul><li>foo
9665 <ul><li>bar</li></ul></li></ul>
9666
9667 !! end
9668
9669 !! test
9670 Nested lists 2
9671 !! wikitext
9672 **foo
9673 *bar
9674 !! html
9675 <ul><li><ul><li>foo</li></ul></li>
9676 <li>bar</li></ul>
9677
9678 !! end
9679
9680 !! test
9681 Nested lists 3 (first element empty)
9682 !! wikitext
9683 *
9684 **bar
9685 !! html
9686 <ul><li>
9687 <ul><li>bar</li></ul></li></ul>
9688
9689 !! end
9690
9691 !! test
9692 Nested lists 4 (first element empty)
9693 !! wikitext
9694 **
9695 *bar
9696 !! html
9697 <ul><li><ul><li></li></ul></li>
9698 <li>bar</li></ul>
9699
9700 !! end
9701
9702 !! test
9703 Nested lists 5 (both elements empty)
9704 !! wikitext
9705 **
9706 *
9707 !! html
9708 <ul><li><ul><li></li></ul></li>
9709 <li></li></ul>
9710
9711 !! end
9712
9713 !! test
9714 Nested lists 6 (both elements empty)
9715 !! wikitext
9716 *
9717 **
9718 !! html
9719 <ul><li>
9720 <ul><li></li></ul></li></ul>
9721
9722 !! end
9723
9724 !! test
9725 Nested lists 7 (skip initial nesting levels)
9726 !! wikitext
9727 ***foo
9728 !! html
9729 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9730
9731 !! end
9732
9733 !! test
9734 Nested lists 8 (multiple nesting transitions)
9735 !! wikitext
9736 *foo
9737 ***bar
9738 **baz
9739 *boo
9740 !! html
9741 <ul><li>foo
9742 <ul><li><ul><li>bar</li></ul></li>
9743 <li>baz</li></ul></li>
9744 <li>boo</li></ul>
9745
9746 !! end
9747
9748 !! test
9749 Nested lists 9 (extension interaction)
9750 !! options
9751 parsoid
9752 !! wikitext
9753 *<references />
9754 !! html/parsoid
9755 <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>
9756 !! end
9757
9758 !! test
9759 1. Lists with start-of-line-transparent tokens before bullets: Comments
9760 !! wikitext
9761 *foo
9762 *<!--cmt-->bar
9763 <!--cmt-->*baz
9764 !! html
9765 <ul><li>foo</li>
9766 <li>bar</li>
9767 <li>baz</li></ul>
9768
9769 !! end
9770
9771 !! test
9772 Nested lists 10 (list and span siblings: wt2wt regression)
9773 !! wikitext
9774 *a <span>x</span>
9775 **b <span>y</span>
9776 !! html/parsoid
9777 <ul><li>a <span>x</span>
9778 <ul><li>b <span>y</span></li></ul></li></ul>
9779 !! end
9780
9781 !! test
9782 2. Lists with start-of-line-transparent tokens before bullets: Template close
9783 !! wikitext
9784 *foo {{echo|bar
9785 }}*baz
9786 !! html
9787 <ul><li>foo bar</li>
9788 <li>baz</li></ul>
9789
9790 !! end
9791
9792 !! test
9793 List items are not parsed correctly following a <pre> block (T2785)
9794 !! wikitext
9795 *<pre>foo</pre>
9796 *<pre>bar</pre>
9797 *zar
9798 !! html/php
9799 <ul><li><pre>foo</pre></li>
9800 <li><pre>bar</pre></li>
9801 <li>zar</li></ul>
9802
9803 !! html/parsoid
9804 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9805 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9806 <li>zar</li></ul>
9807 !! end
9808
9809 # FIXME: Might benefit from a html/parsoid since this has a template
9810 !! test
9811 List items from template
9812 !! wikitext
9813
9814 {{inner list}}
9815 *item 2
9816
9817 *item 0
9818 {{inner list}}
9819 *item 2
9820
9821 *item 0
9822 *notSOL{{inner list}}
9823 *item 2
9824 !! html
9825 <ul><li>item 1</li>
9826 <li>item 2</li></ul>
9827 <ul><li>item 0</li>
9828 <li>item 1</li>
9829 <li>item 2</li></ul>
9830 <ul><li>item 0</li>
9831 <li>notSOL</li>
9832 <li>item 1</li>
9833 <li>item 2</li></ul>
9834
9835 !! end
9836
9837 !! test
9838 List interrupted by empty line or heading
9839 !! wikitext
9840 *foo
9841
9842 **bar
9843 ==A heading==
9844 *Another list item
9845 !! html
9846 <ul><li>foo</li></ul>
9847 <ul><li><ul><li>bar</li></ul></li></ul>
9848 <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>
9849 <ul><li>Another list item</li></ul>
9850
9851 !!end
9852
9853 !!test
9854 Multiple list tags generated by templates
9855 !! wikitext
9856 {{echo|<li>}}a
9857 {{echo|<li>}}b
9858 {{echo|<li>}}c
9859 !! html
9860 <li>a
9861 <li>b
9862 <li>c</li>
9863 </li>
9864 </li>
9865
9866 !! html+tidy
9867 <li>a
9868 </li><li>b
9869 </li><li>c
9870 </li>
9871 !! html/parsoid
9872 <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
9873 </li><li about="#mwt1">b
9874 </li><li about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[null,44,null,0]}'>c</li>
9875 !!end
9876
9877 !!test
9878 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9879 !! wikitext
9880 *a
9881 <!--This line will NOT split the list-->
9882 *b
9883 <!--This line will NOT split the list either-->
9884 *c
9885 <!--foo--> <!----> <!--This line NOT split the list either-->
9886 *d
9887 !! html
9888 <ul><li>a</li>
9889 <li>b</li>
9890 <li>c</li>
9891 <li>d</li></ul>
9892
9893 !!end
9894
9895 !!test
9896 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9897 !! wikitext
9898 *a
9899 <!--This line will NOT split the list-->
9900 *b
9901 <!--This line will NOT split the list either-->
9902 *c
9903 <!--foo--> <!----> <!--This line NOT split the list
9904 either-->
9905 *d
9906 !! html
9907 <ul><li>a</li>
9908 <li>b</li>
9909 <li>c</li>
9910 <li>d</li></ul>
9911
9912 !!end
9913
9914 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
9915 # That pass could possibly be removed.
9916 !!test
9917 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
9918 !!options
9919 parsoid=wt2html,wt2wt
9920 !! wikitext
9921 *foo
9922 *<li>li-hack
9923 *{{echo|<li>templated li-hack}}
9924 *<!--foo--><li> unsupported li-hack with preceding comments
9925
9926 <ul>
9927 <li><li>not a li-hack
9928 </li>
9929 </ul>
9930 !! html+tidy
9931 <ul><li>foo</li>
9932 <li class="mw-empty-elt"></li><li>li-hack</li>
9933 <li class="mw-empty-elt"></li><li>templated li-hack</li>
9934 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
9935 <ul>
9936 <li class="mw-empty-elt"></li><li>not a li-hack
9937 </li>
9938 </ul>
9939 !! html/parsoid
9940 <ul><li> foo</li>
9941 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
9942 <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>
9943 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
9944
9945 <ul data-parsoid='{"stx":"html"}'>
9946 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
9947 </li>
9948 </ul>
9949
9950 !!end
9951
9952 !! test
9953 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9954 !! options
9955 parsoid
9956 !! wikitext
9957 #foo
9958 ##bar
9959
9960 *foo
9961 **bar
9962
9963 :foo
9964 ::bar
9965 !! html
9966 <ol>
9967 <li>foo<ol>
9968 <li>bar</li>
9969 </ol></li>
9970 </ol><ul>
9971 <li>foo<ul>
9972 <li>bar</li>
9973 </ul></li>
9974 </ul><dl>
9975 <dd>foo<dl>
9976 <dd>bar</dd>
9977 </dl></dd>
9978 </dl>
9979 !! end
9980
9981 !! test
9982 Parsoid: Test of whitespace serialization with Templated bullets
9983 !! options
9984 parsoid=wt2html
9985 !! wikitext
9986 * {{bullet}}
9987 !! html/parsoid
9988 <ul>
9989 <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>
9990 </ul>
9991 !! end
9992
9993 # ------------------------------------------------------------------------
9994 # The next set of tests are about Parsoid's ability to handle badly nested
9995 # tags (parse, minimize scope of fixup, and roundtrip back)
9996 # ------------------------------------------------------------------------
9997
9998 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
9999 # Parsoid's list handling is more aware of block structure.
10000 !! test
10001 Unbalanced closing block tags break a list
10002 !! wikitext
10003 <div>
10004 *a</div><div>
10005 *b</div>
10006 !! html+tidy
10007 <div>
10008 <ul><li>a</li></ul></div><div>
10009 <li>b</li></div>
10010 !! html/parsoid
10011 <div><ul>
10012 <li>a</li>
10013 </ul></div>
10014 <div><ul>
10015 <li>b</li>
10016 </ul></div>
10017 !! end
10018
10019 !! test
10020 Unbalanced closing non-block tags don't break a list
10021 !! wikitext
10022 <span>
10023 *a</span><span>
10024 *b</span>
10025 !! html/php+tidy
10026 <p><span>
10027 </span></p>
10028 <ul><li>a<span></span></li>
10029 <li>b</li></ul>
10030 !! html/parsoid
10031 <span>
10032 <ul>
10033 <li>a<span></span></li>
10034 <li>b</li>
10035 </ul>
10036 </span>
10037 !! end
10038
10039 # Parsoid does some post-dom-building cleanup
10040 # which is why its output differs from Remex.
10041 !! test
10042 Unclosed formatting tags that straddle lists are closed and reopened
10043 !! options
10044 parsoid=wt2html,wt2wt,html2html
10045 !! wikitext
10046 #<s> a
10047 #b </s>
10048 !! html/php+tidy
10049 <ol><li><s> a</s></li><s>
10050 </s><li><s>b </s></li></ol>
10051 !! html/parsoid
10052 <ol><li><s> a</s></li>
10053 <li><s>b </s></li></ol>
10054 !! end
10055
10056 # Output is ugly because of all the misnested tag fixups.
10057 # Remex is wrapping p-tags around empty elements.
10058 # Parsoid has special-case handling of this pattern of
10059 # wrapping lists in formatting tags.
10060 # FIXME: Should we remove this code from Parsoid? Or add
10061 # special support in Remex? If the latter, maybe just wait
10062 # for Parsoid to become the default parser.
10063 # See T70395.
10064 !!test
10065 1. List embedded in a formatting tag
10066 !! wikitext
10067 <small>
10068 *foo
10069 </small>
10070 !! html/php+tidy
10071 <p><small>
10072 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10073 </p>
10074 !! html/parsoid
10075 <small>
10076 <ul>
10077 <li>foo</li>
10078 </ul>
10079 </small>
10080 !!end
10081
10082 # Output is ugly because of all the misnested tag fixups
10083 # Remex is wrapping p-tags around empty elements.
10084 # Parsoid has code that strips useless p-tags.
10085 !!test
10086 2. List embedded in a formatting tag in a misnested way
10087 !! wikitext
10088 <small>
10089 *a
10090 *b</small>
10091 !! html/php+tidy
10092 <p><small>
10093 </small></p><small></small><ul><small><li>a</li>
10094 </small><li><small>b</small></li></ul>
10095 !! html/parsoid
10096 <small></small>
10097 <ul><small>
10098 <li>a</li>
10099 </small>
10100 <li><small>b</small></li>
10101 </ul>
10102 !!end
10103
10104 ###
10105 ### Magic Words
10106 ###
10107
10108 # Note that the current date is hard-coded as
10109 # 1970-01-01T00:02:03Z (a Thursday)
10110 # when running parser tests. The timezone is also fixed to GMT, so
10111 # local date will be identical to current date.
10112
10113 !! test
10114 Magic Word: {{CURRENTDAY}}
10115 !! wikitext
10116 {{CURRENTDAY}}
10117 !! html
10118 <p>1
10119 </p>
10120 !! end
10121
10122 !! test
10123 Magic Word: {{CURRENTDAY2}}
10124 !! wikitext
10125 {{CURRENTDAY2}}
10126 !! html
10127 <p>01
10128 </p>
10129 !! end
10130
10131 !! test
10132 Magic Word: {{CURRENTDAYNAME}}
10133 !! wikitext
10134 {{CURRENTDAYNAME}}
10135 !! html
10136 <p>Thursday
10137 </p>
10138 !! end
10139
10140 !! test
10141 Magic Word: {{CURRENTDOW}}
10142 !! wikitext
10143 {{CURRENTDOW}}
10144 !! html
10145 <p>4
10146 </p>
10147 !! end
10148
10149 !! test
10150 Magic Word: {{CURRENTMONTH}}
10151 !! wikitext
10152 {{CURRENTMONTH}}
10153 !! html
10154 <p>01
10155 </p>
10156 !! end
10157
10158 !! test
10159 Magic Word: {{CURRENTMONTH1}}
10160 !! wikitext
10161 {{CURRENTMONTH1}}
10162 !! html
10163 <p>1
10164 </p>
10165 !! end
10166
10167 !! test
10168 Magic Word: {{CURRENTMONTHABBREV}}
10169 !! wikitext
10170 {{CURRENTMONTHABBREV}}
10171 !! html
10172 <p>Jan
10173 </p>
10174 !! end
10175
10176 !! test
10177 Magic Word: {{CURRENTMONTHNAME}}
10178 !! wikitext
10179 {{CURRENTMONTHNAME}}
10180 !! html
10181 <p>January
10182 </p>
10183 !! end
10184
10185 !! test
10186 Magic Word: {{CURRENTMONTHNAMEGEN}}
10187 !! wikitext
10188 {{CURRENTMONTHNAMEGEN}}
10189 !! html
10190 <p>January
10191 </p>
10192 !! end
10193
10194 !! test
10195 Magic Word: {{CURRENTTIME}}
10196 !! wikitext
10197 {{CURRENTTIME}}
10198 !! html
10199 <p>00:02
10200 </p>
10201 !! end
10202
10203 !! test
10204 Magic Word: {{CURRENTHOUR}}
10205 !! wikitext
10206 {{CURRENTHOUR}}
10207 !! html
10208 <p>00
10209 </p>
10210 !! end
10211
10212 !! test
10213 Magic Word: {{CURRENTWEEK}} (T6594)
10214 !! wikitext
10215 {{CURRENTWEEK}}
10216 !! html
10217 <p>1
10218 </p>
10219 !! end
10220
10221 !! test
10222 Magic Word: {{CURRENTYEAR}}
10223 !! wikitext
10224 {{CURRENTYEAR}}
10225 !! html
10226 <p>1970
10227 </p>
10228 !! end
10229
10230 !! test
10231 Magic Word: {{CURRENTTIMESTAMP}}
10232 !! wikitext
10233 {{CURRENTTIMESTAMP}}
10234 !! html
10235 <p>19700101000203
10236 </p>
10237 !! end
10238
10239 !! test
10240 Magic Words LOCAL (UTC)
10241 !! wikitext
10242 *{{LOCALMONTH}}
10243 *{{LOCALMONTH1}}
10244 *{{LOCALMONTHNAME}}
10245 *{{LOCALMONTHNAMEGEN}}
10246 *{{LOCALMONTHABBREV}}
10247 *{{LOCALDAY}}
10248 *{{LOCALDAY2}}
10249 *{{LOCALDAYNAME}}
10250 *{{LOCALYEAR}}
10251 *{{LOCALTIME}}
10252 *{{LOCALHOUR}}
10253 *{{LOCALWEEK}}
10254 *{{LOCALDOW}}
10255 *{{LOCALTIMESTAMP}}
10256 !! html
10257 <ul><li>01</li>
10258 <li>1</li>
10259 <li>January</li>
10260 <li>January</li>
10261 <li>Jan</li>
10262 <li>1</li>
10263 <li>01</li>
10264 <li>Thursday</li>
10265 <li>1970</li>
10266 <li>00:02</li>
10267 <li>00</li>
10268 <li>1</li>
10269 <li>4</li>
10270 <li>19700101000203</li></ul>
10271
10272 !! end
10273
10274 !! test
10275 Magic Word: {{FULLPAGENAME}}
10276 !! options
10277 title=[[User:Ævar Arnfjörð Bjarmason]]
10278 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10279 !! wikitext
10280 {{FULLPAGENAME}}
10281 !! html/*
10282 <p>User:Ævar Arnfjörð Bjarmason
10283 </p>
10284 !! end
10285
10286 !! test
10287 Magic Word: {{FULLPAGENAMEE}}
10288 !! options
10289 title=[[User:Ævar Arnfjörð Bjarmason]]
10290 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10291 !! wikitext
10292 {{FULLPAGENAMEE}}
10293 !! html/*
10294 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10295 </p>
10296 !! end
10297
10298 !! test
10299 Magic Word: {{TALKSPACE}}
10300 !! options
10301 title=[[User:Ævar Arnfjörð Bjarmason]]
10302 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10303 !! wikitext
10304 {{TALKSPACE}}
10305 !! html/*
10306 <p>User talk
10307 </p>
10308 !! end
10309
10310 !! test
10311 Magic Word: {{TALKSPACE}}, same namespace
10312 !! options
10313 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10314 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10315 !! wikitext
10316 {{TALKSPACE}}
10317 !! html/*
10318 <p>User talk
10319 </p>
10320 !! end
10321
10322 !! test
10323 Magic Word: {{TALKSPACE}}, main namespace
10324 !! options
10325 title=[[Parser Test]]
10326 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10327 !! wikitext
10328 {{TALKSPACE}}
10329 !! html/*
10330 <p>Talk
10331 </p>
10332 !! end
10333
10334 !! test
10335 Magic Word: {{TALKSPACEE}}
10336 !! options
10337 title=[[User:Ævar Arnfjörð Bjarmason]]
10338 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10339 !! wikitext
10340 {{TALKSPACEE}}
10341 !! html/*
10342 <p>User_talk
10343 </p>
10344 !! end
10345
10346 !! test
10347 Magic Word: {{SUBJECTSPACE}}
10348 !! options
10349 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10350 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10351 !! wikitext
10352 {{SUBJECTSPACE}}
10353 !! html/*
10354 <p>User
10355 </p>
10356 !! end
10357
10358 !! test
10359 Magic Word: {{SUBJECTSPACE}}, same namespace
10360 !! options
10361 title=[[User:Ævar Arnfjörð Bjarmason]]
10362 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10363 !! wikitext
10364 {{SUBJECTSPACE}}
10365 !! html/*
10366 <p>User
10367 </p>
10368 !! end
10369
10370 !! test
10371 Magic Word: {{SUBJECTSPACE}}, main namespace
10372 !! options
10373 title=[[Parser Test]]
10374 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10375 !! wikitext
10376 {{SUBJECTSPACE}}
10377 !! html/*
10378
10379 !! end
10380
10381 !! test
10382 Magic Word: {{SUBJECTSPACEE}}
10383 !! options
10384 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10385 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10386 !! wikitext
10387 {{SUBJECTSPACEE}}
10388 !! html/*
10389 <p>User
10390 </p>
10391 !! end
10392
10393 !! test
10394 Magic Word: {{NAMESPACE}}
10395 !! options
10396 title=[[User:Ævar Arnfjörð Bjarmason]]
10397 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10398 !! wikitext
10399 {{NAMESPACE}}
10400 !! html/*
10401 <p>User
10402 </p>
10403 !! end
10404
10405 !! test
10406 Magic Word: {{NAMESPACEE}}
10407 !! options
10408 title=[[User:Ævar Arnfjörð Bjarmason]]
10409 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10410 !! wikitext
10411 {{NAMESPACEE}}
10412 !! html/*
10413 <p>User
10414 </p>
10415 !! end
10416
10417 !! test
10418 Magic Word: {{NAMESPACENUMBER}}
10419 !! options
10420 title=[[User:Ævar Arnfjörð Bjarmason]]
10421 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10422 !! wikitext
10423 {{NAMESPACENUMBER}}
10424 !! html/*
10425 <p>2
10426 </p>
10427 !! end
10428
10429 !! test
10430 Magic Word: {{SUBPAGENAME}}
10431 !! options
10432 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10433 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10434 !! wikitext
10435 {{SUBPAGENAME}}
10436 !! html/*
10437 <p>sub ö
10438 </p>
10439 !! end
10440
10441 !! test
10442 Magic Word: {{SUBPAGENAMEE}}
10443 !! options
10444 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10445 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10446 !! wikitext
10447 {{SUBPAGENAMEE}}
10448 !! html/*
10449 <p>sub_%C3%B6
10450 </p>
10451 !! end
10452
10453 !! test
10454 Magic Word: {{ROOTPAGENAME}}
10455 !! options
10456 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10457 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10458 !! wikitext
10459 {{ROOTPAGENAME}}
10460 !! html/*
10461 <p>Ævar Arnfjörð Bjarmason
10462 </p>
10463 !! end
10464
10465 !! test
10466 Magic Word: {{ROOTPAGENAMEE}}
10467 !! options
10468 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10469 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10470 !! wikitext
10471 {{ROOTPAGENAMEE}}
10472 !! html/*
10473 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10474 </p>
10475 !! end
10476
10477 !! test
10478 Magic Word: {{BASEPAGENAME}}
10479 !! options
10480 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10481 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10482 !! wikitext
10483 {{BASEPAGENAME}}
10484 !! html/*
10485 <p>Ævar Arnfjörð Bjarmason
10486 </p>
10487 !! end
10488
10489 !! test
10490 Magic Word: {{BASEPAGENAMEE}}
10491 !! options
10492 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10493 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10494 !! wikitext
10495 {{BASEPAGENAMEE}}
10496 !! html/*
10497 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10498 </p>
10499 !! end
10500
10501 !! test
10502 Magic Word: {{TALKPAGENAME}}
10503 !! options
10504 title=[[User:Ævar Arnfjörð Bjarmason]]
10505 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10506 !! wikitext
10507 {{TALKPAGENAME}}
10508 !! html/*
10509 <p>User talk:Ævar Arnfjörð Bjarmason
10510 </p>
10511 !! end
10512
10513 !! test
10514 Magic Word: {{TALKPAGENAMEE}}
10515 !! options
10516 title=[[User:Ævar Arnfjörð Bjarmason]]
10517 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10518 !! wikitext
10519 {{TALKPAGENAMEE}}
10520 !! html/*
10521 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10522 </p>
10523 !! end
10524
10525 !! test
10526 Magic Word: {{SUBJECTPAGENAME}}
10527 !! options
10528 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10529 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10530 !! wikitext
10531 {{SUBJECTPAGENAME}}
10532 !! html/*
10533 <p>User:Ævar Arnfjörð Bjarmason
10534 </p>
10535 !! end
10536
10537 !! test
10538 Magic Word: {{SUBJECTPAGENAMEE}}
10539 !! options
10540 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10541 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10542 !! wikitext
10543 {{SUBJECTPAGENAMEE}}
10544 !! html/*
10545 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10546 </p>
10547 !! end
10548
10549 !! test
10550 Magic Word: {{NUMBEROFFILES}}
10551 !! options
10552 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10553 !! wikitext
10554 {{NUMBEROFFILES}}
10555 !! html/*
10556 <p>7
10557 </p>
10558 !! end
10559
10560 !! test
10561 Magic Word: {{PAGENAME}}
10562 !! options
10563 title=[[User:Ævar Arnfjörð Bjarmason]]
10564 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10565 !! wikitext
10566 {{PAGENAME}}
10567 !! html/*
10568 <p>Ævar Arnfjörð Bjarmason
10569 </p>
10570 !! end
10571
10572 !! test
10573 Magic Word: {{PAGENAME}} with metacharacters
10574 !! options
10575 title=[['foo & bar = baz']]
10576 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10577 !! wikitext
10578 ''{{PAGENAME}}''
10579 !! html+tidy
10580 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10581 </p>
10582 !! end
10583
10584 !! test
10585 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10586 !! options
10587 title=[[*RFC 1234 http://example.com/]]
10588 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10589 !! wikitext
10590 {{PAGENAME}}
10591 !! html+tidy
10592 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10593 </p>
10594 !! end
10595
10596 !! test
10597 Magic Word: {{PAGENAMEE}}
10598 !! options
10599 title=[[User:Ævar Arnfjörð Bjarmason]]
10600 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10601 !! wikitext
10602 {{PAGENAMEE}}
10603 !! html/*
10604 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10605 </p>
10606 !! end
10607
10608 !! test
10609 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10610 !! options
10611 title=[[*RFC 1234 http://example.com/]]
10612 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10613 !! wikitext
10614 {{PAGENAMEE}}
10615 !! html+tidy
10616 <p>&#42;RFC_1234_http&#58;//example.com/
10617 </p>
10618 !! end
10619
10620 !! test
10621 Magic Word: {{REVISIONID}}
10622 !! options
10623 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10624 showflags
10625 !! wikitext
10626 {{REVISIONID}}
10627 !! html/*
10628 <p>1337
10629 </p>
10630 flags=vary-revision-id
10631 !! end
10632
10633 !! test
10634 Magic Word: {{SCRIPTPATH}}
10635 !! options
10636 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10637 !! wikitext
10638 {{SCRIPTPATH}}
10639 !! html/*
10640
10641 !! end
10642
10643 !! test
10644 Magic Word: {{STYLEPATH}}
10645 !! options
10646 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10647 !! wikitext
10648 {{STYLEPATH}}
10649 !! html/*
10650 <p>/skins
10651 </p>
10652 !! end
10653
10654 !! test
10655 Magic Word: {{SERVER}}
10656 !! options
10657 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10658 !! wikitext
10659 {{SERVER}}
10660 !! html/*
10661 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10662 </p>
10663 !! end
10664
10665 !! test
10666 Magic Word: {{SERVERNAME}}
10667 !! options
10668 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10669 !! wikitext
10670 {{SERVERNAME}}
10671 !! html/*
10672 <p>example.org
10673 </p>
10674 !! end
10675
10676 !! test
10677 Magic Word: {{SITENAME}}
10678 !! options
10679 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10680 !! wikitext
10681 {{SITENAME}}
10682 !! html/*
10683 <p>MediaWiki
10684 </p>
10685 !! end
10686
10687 !! test
10688 Magic Word: {{PAGELANGUAGE}}
10689 !! options
10690 language=fr
10691 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10692 !! wikitext
10693 {{PAGELANGUAGE}}
10694 !! html/*
10695 <p>fr
10696 </p>
10697 !! end
10698
10699 !! test
10700 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10701 !! options
10702 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10703 !! wikitext
10704 {{PAGELANGUAGE}}
10705 !! html/*
10706 <p>en
10707 </p>
10708 !! end
10709
10710 !! test
10711 Case-sensitive magic words, when cased differently, should just be template transclusions
10712 !! wikitext
10713 {{CurrentMonth}}
10714 {{currentday}}
10715 {{cURreNTweEK}}
10716 {{currentHour}}
10717 !! html
10718 <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>
10719 <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>
10720 <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>
10721 <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>
10722 </p>
10723 !! end
10724
10725 !! test
10726 Case-insensitive magic words should still work with weird casing.
10727 !! wikitext
10728 {{sErVeRNaMe}}
10729 {{LCFirst:AOEU}}
10730 {{ucFIRST:aoeu}}
10731 {{SERver}}
10732 !! html
10733 <p>example.org
10734 aOEU
10735 Aoeu
10736 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10737 </p>
10738 !! end
10739
10740 # From plwiki:PLOS_ONE
10741 !! test
10742 Parsoid: Page property magic word with magic word contents
10743 !! wikitext
10744 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10745 !! html/parsoid
10746 <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>"}]]}'/>
10747 !! end
10748
10749 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10750 # But, this is a limitation of our representation and is documented in
10751 # TemplateHandler.js in processSpecialMagicWord
10752 !! test
10753 Parsoid: Template-generated DISPLAYTITLE
10754 !! wikitext
10755 {{{{echo|DISPLAYTITLE}}:Foo}}
10756 !! options
10757 showtitle
10758 !! config
10759 wgAllowDisplayTitle=true
10760 wgRestrictDisplayTitle=false
10761 !! html/php
10762 Foo
10763
10764 !! html/parsoid
10765 <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"}]]}'/>
10766 !! end
10767
10768 !! test
10769 Namespace 1 {{ns:1}}
10770 !! wikitext
10771 {{ns:1}}
10772 !! html
10773 <p>Talk
10774 </p>
10775 !! end
10776
10777 !! test
10778 Namespace 1 {{ns:01}}
10779 !! wikitext
10780 {{ns:01}}
10781 !! html
10782 <p>Talk
10783 </p>
10784 !! end
10785
10786 !! test
10787 Namespace 0 {{ns:0}} (T6783)
10788 !! wikitext
10789 {{ns:0}}
10790 !! html
10791
10792 !! end
10793
10794 !! test
10795 Namespace 0 {{ns:00}} (T6783)
10796 !! wikitext
10797 {{ns:00}}
10798 !! html
10799
10800 !! end
10801
10802 !! test
10803 Namespace -1 {{ns:-1}}
10804 !! wikitext
10805 {{ns:-1}}
10806 !! html
10807 <p>Special
10808 </p>
10809 !! end
10810
10811 !! test
10812 Namespace User {{ns:User}}
10813 !! wikitext
10814 {{ns:User}}
10815 !! html
10816 <p>User
10817 </p>
10818 !! end
10819
10820 !! test
10821 Namespace User talk {{ns:User_talk}}
10822 !! wikitext
10823 {{ns:User_talk}}
10824 !! html
10825 <p>User talk
10826 </p>
10827 !! end
10828
10829 !! test
10830 Namespace User talk {{ns:uSeR tAlK}}
10831 !! wikitext
10832 {{ns:uSeR tAlK}}
10833 !! html
10834 <p>User talk
10835 </p>
10836 !! end
10837
10838 !! test
10839 Namespace File {{ns:File}}
10840 !! wikitext
10841 {{ns:File}}
10842 !! html
10843 <p>File
10844 </p>
10845 !! end
10846
10847 !! test
10848 Namespace File {{ns:Image}}
10849 !! wikitext
10850 {{ns:Image}}
10851 !! html
10852 <p>File
10853 </p>
10854 !! end
10855
10856 !! test
10857 Namespace (lang=de) Benutzer {{ns:User}}
10858 !! options
10859 language=de
10860 !! wikitext
10861 {{ns:User}}
10862 !! html
10863 <p>Benutzer
10864 </p>
10865 !! end
10866
10867 !! test
10868 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10869 !! options
10870 language=de
10871 !! wikitext
10872 {{ns:3}}
10873 !! html
10874 <p>Benutzer Diskussion
10875 </p>
10876 !! end
10877
10878 !! test
10879 Urlencode
10880 !! wikitext
10881 {{urlencode:hi world?!}}
10882 {{urlencode:hi world?!|WIKI}}
10883 {{urlencode:hi world?!|PATH}}
10884 {{urlencode:hi world?!|QUERY}}
10885 !! html/php
10886 <p>hi+world%3F%21
10887 hi_world%3F!
10888 hi%20world%3F%21
10889 hi+world%3F%21
10890 </p>
10891 !! end
10892
10893 !! test
10894 Magic Word: prioritize type info over data-parsoid
10895 !! options
10896 parsoid=html2wt
10897 !! html/parsoid
10898 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10899 !! wikitext
10900 __FORCETOC__
10901 !! end
10902
10903 !! test
10904 Magic Word: serialize on separate line (parsoid)
10905 !! options
10906 parsoid=wt2wt,html2wt
10907 !! wikitext
10908 foo
10909 __NOTOC__
10910 bar
10911 !! html/parsoid
10912 foo<meta property="mw:PageProp/notoc"/>bar
10913 !! end
10914
10915 !! test
10916 Magic Word: rt non-english wikis
10917 !! options
10918 parsoid=wt2wt
10919 language=de
10920 !! wikitext
10921 __NOEDITSECTION__
10922 !! html/parsoid
10923 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10924 !! end
10925
10926 !!test
10927 __proto__ is treated as normal wikitext (T105997)
10928 !!wikitext
10929 __proto__
10930 !!html
10931 <p>__proto__
10932 </p>
10933 !!end
10934
10935 ###
10936 ### Magic links
10937 ###
10938 !! test
10939 Magic links: internal link to RFC (T2479)
10940 !! wikitext
10941 [[RFC 123]]
10942 !! html/php
10943 <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>
10944 </p>
10945 !! html/parsoid
10946 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10947 !! end
10948
10949 !! test
10950 Magic links: RFC (T2479)
10951 !! wikitext
10952 RFC 822
10953 !! html/php
10954 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
10955 </p>
10956 !! html/parsoid
10957 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
10958 !! end
10959
10960 !! test
10961 Magic links: RFC (T67278)
10962 !! wikitext
10963 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10964 !! html/php
10965 <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.
10966 </p>
10967 !! html/parsoid
10968 <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>
10969 !! end
10970
10971 !! test
10972 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10973 !! wikitext
10974 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10975 RFC
10976 822
10977 !! html/php
10978 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
10979 RFC
10980 822
10981 </p>
10982 !! html/parsoid
10983 <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>
10984 RFC
10985 822</p>
10986 !! end
10987
10988 !! test
10989 Magic links: ISBN (T3937)
10990 !! wikitext
10991 ISBN 0-306-40615-2
10992 !! html/php
10993 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10994 </p>
10995 !! html/parsoid
10996 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10997 !! end
10998
10999 !! test
11000 Magic links: ISBN (T67278)
11001 !! wikitext
11002 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11003 !! html/php
11004 <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.
11005 </p>
11006 !! html/parsoid
11007 <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>
11008 !! end
11009
11010 !! test
11011 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
11012 !! wikitext
11013 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
11014 ISBN
11015 9780316098113
11016 ISBN 978
11017 0316098113
11018 !! html/php
11019 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11020 ISBN
11021 9780316098113
11022 ISBN 978
11023 0316098113
11024 </p>
11025 !! html/parsoid
11026 <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>
11027 ISBN
11028 9780316098113
11029 ISBN 978
11030 0316098113</p>
11031 !! end
11032
11033 !! test
11034 Magic links: PMID incorrectly converts space to underscore
11035 !! wikitext
11036 PMID 1234
11037 !! html/php
11038 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11039 </p>
11040 !! html/parsoid
11041 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
11042 !! end
11043
11044 !! test
11045 Magic links: PMID (T67278)
11046 !! wikitext
11047 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11048 !! html/php
11049 <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.
11050 </p>
11051 !! html/parsoid
11052 <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>
11053 !! end
11054
11055 !! test
11056 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11057 !! wikitext
11058 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11059 PMID
11060 1234
11061 !! html/php
11062 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11063 PMID
11064 1234
11065 </p>
11066 !! html/parsoid
11067 <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>
11068 PMID
11069 1234</p>
11070 !! end
11071
11072 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11073 # since these are ExtLinkText, not MagicLinkText
11074 !! test
11075 Magic links: use appropriate serialization for "almost" magic links.
11076 !! wikitext
11077 X[[Special:BookSources/0978739256|foo]]
11078
11079 X[https://tools.ietf.org/html/rfc1234 foo]
11080 !! html/php
11081 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11082 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11083 </p>
11084 !! html/parsoid
11085 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11086 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11087 !! end
11088
11089 !! test
11090 Magic links: All disabled (T47942)
11091 !! options
11092 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11093 !! wikitext
11094 ISBN 0-306-40615-2
11095 PMID 1234
11096 RFC 4321
11097 !! html/php
11098 <p>ISBN 0-306-40615-2
11099 PMID 1234
11100 RFC 4321
11101 </p>
11102 !! end
11103
11104 ###
11105 ### Templates
11106 ####
11107
11108 !! test
11109 Nonexistent template
11110 !! wikitext
11111 {{thistemplatedoesnotexist}}
11112 !! html
11113 <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>
11114 </p>
11115 !! end
11116
11117 !! test
11118 Template with invalid target containing tags
11119 !! wikitext
11120 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11121 !! html
11122 <p>{{a<b>b</b>|foo|a=b|a = b}}
11123 </p>
11124 !! end
11125
11126 !! test
11127 Template with invalid target containing unclosed tag
11128 !! wikitext
11129 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11130 !! html
11131 <p>{{a<b>|foo|a=b|a = b}}</b>
11132 </p>
11133 !! end
11134
11135 !! test
11136 Template with invalid target containing wikilink
11137 !! wikitext
11138 {{[[Main Page]]}}
11139 !! html/php
11140 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11141 </p>
11142 !! html/parsoid
11143 <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>
11144 !! end
11145
11146 !! test
11147 Template with just whitespace in it, T70421
11148 !! wikitext
11149 {{echo|{{ }}}}
11150 !! html/parsoid
11151 <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>
11152 !! end
11153
11154 !! article
11155 Template:test
11156 !! text
11157 This is a test template
11158 !! endarticle
11159
11160 !! test
11161 Simple template
11162 !! wikitext
11163 {{test}}
11164 !! html
11165 <p>This is a test template
11166 </p>
11167 !! end
11168
11169 !! test
11170 Template with explicit namespace
11171 !! wikitext
11172 {{Template:test}}
11173 !! html
11174 <p>This is a test template
11175 </p>
11176 !! end
11177
11178
11179 !! article
11180 Template:paramtest
11181 !! text
11182 This is a test template with parameter {{{param}}}
11183 !! endarticle
11184
11185 !! test
11186 Template parameter
11187 !! wikitext
11188 {{paramtest|param=foo}}
11189 !! html
11190 <p>This is a test template with parameter foo
11191 </p>
11192 !! end
11193
11194 !! article
11195 Template:paramtestnum
11196 !! text
11197 [[{{{1}}}|{{{2}}}]]
11198 !! endarticle
11199
11200 !! test
11201 Template unnamed parameter
11202 !! wikitext
11203 {{paramtestnum|Main Page|the main page}}
11204 !! html
11205 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11206 </p>
11207 !! end
11208
11209 !! article
11210 Template:templatesimple
11211 !! text
11212 (test)
11213 !! endarticle
11214
11215 !! article
11216 Template:templateredirect
11217 !! text
11218 #redirect [[Template:templatesimple]]
11219 !! endarticle
11220
11221 !! article
11222 Template:templateasargtestnum
11223 !! text
11224 {{{{{1}}}}}
11225 !! endarticle
11226
11227 !! article
11228 Template:templateasargtest
11229 !! text
11230 {{template{{{templ}}}}}
11231 !! endarticle
11232
11233 !! article
11234 Template:templateasargtest2
11235 !! text
11236 {{{{{templ}}}}}
11237 !! endarticle
11238
11239 !! test
11240 Template with template name as unnamed argument
11241 !! wikitext
11242 {{templateasargtestnum|templatesimple}}
11243 !! html
11244 <p>(test)
11245 </p>
11246 !! end
11247
11248 !! test
11249 Template with template name as argument
11250 !! wikitext
11251 {{templateasargtest|templ=simple}}
11252 !! html
11253 <p>(test)
11254 </p>
11255 !! end
11256
11257 !! test
11258 Template with template name as argument (2)
11259 !! wikitext
11260 {{templateasargtest2|templ=templatesimple}}
11261 !! html
11262 <p>(test)
11263 </p>
11264 !! end
11265
11266 !! article
11267 Template:templateasargtestdefault
11268 !! text
11269 {{{{{templ|templatesimple}}}}}
11270 !! endarticle
11271
11272 !! article
11273 Template:templa
11274 !! text
11275 '''templ'''
11276 !! endarticle
11277
11278 !! test
11279 Template with default value
11280 !! wikitext
11281 {{templateasargtestdefault}}
11282 !! html
11283 <p>(test)
11284 </p>
11285 !! end
11286
11287 !! test
11288 Template with default value (value set)
11289 !! wikitext
11290 {{templateasargtestdefault|templ=templa}}
11291 !! html
11292 <p><b>templ</b>
11293 </p>
11294 !! end
11295
11296 !! test
11297 Template redirect
11298 !! wikitext
11299 {{templateredirect}}
11300 !! html/php
11301 <p>(test)
11302 </p>
11303 !! html/parsoid
11304 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11305 !! end
11306
11307 !! test
11308 Template with argument in separate line
11309 !! wikitext
11310 {{ templateasargtest |
11311 templ = simple }}
11312 !! html
11313 <p>(test)
11314 </p>
11315 !! end
11316
11317 !! test
11318 Template with complex template as argument
11319 !! wikitext
11320 {{paramtest|
11321 param ={{ templateasargtest |
11322 templ = simple }}}}
11323 !! html
11324 <p>This is a test template with parameter (test)
11325 </p>
11326 !! end
11327
11328 !! test
11329 Templates with templated name
11330 !! wikitext
11331 {{{{echo|echo}}|foo}}
11332 {{{{echo|inner list}} }}
11333 !! html
11334 <p>foo
11335 </p>
11336 <ul><li>item 1</li></ul>
11337
11338 !! html/parsoid
11339 <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>
11340 <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>
11341 !! end
11342
11343 ## Regression test; the output here isn't really that interesting.
11344 !! test
11345 Templates with templated name and top level template args
11346 !! wikitext
11347 {{1{{2{{{3}}}|4=5}}}}
11348 !! html/parsoid
11349 <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>
11350 !! end
11351
11352 # Parsoid markup is deliberate "broken". This is an edge case.
11353 # See long comment in TemplateHandler.js:convertAttribsToString.
11354 !! test
11355 Templates with invalid templated targets
11356 !! wikitext
11357 {{echo
11358 {{echo|foo}}
11359 }}
11360 !! html/php
11361 <p>{{echo
11362 foo
11363 }}
11364 </p>
11365 !! html/parsoid
11366 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11367 foo }}</p>
11368 !! end
11369
11370 !! test
11371 Template with thumb image (with link in description)
11372 !! wikitext
11373 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11374 !! html/php
11375 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>
11376
11377 !! html+tidy
11378 <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>
11379 !! html/parsoid
11380 <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>
11381 !! end
11382
11383 !! article
11384 Template:complextemplate
11385 !! text
11386 {{{1}}} {{paramtest|
11387 param ={{{param}}}}}
11388 !! endarticle
11389
11390 !! test
11391 Template with complex arguments
11392 !! wikitext
11393 {{complextemplate|
11394 param ={{ templateasargtest |
11395 templ = simple }}|[[Template:complextemplate|link]]}}
11396 !! html
11397 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11398 </p>
11399 !! end
11400
11401 !! test
11402 T2553: link with two variables in a piped link
11403 !! wikitext
11404 {|
11405 |[[{{{1}}}|{{{2}}}]]
11406 |}
11407 !! html/php
11408 <table>
11409 <tr>
11410 <td>[[{{{1}}}|{{{2}}}]]
11411 </td></tr></table>
11412
11413 !! html/parsoid
11414 <table>
11415 <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>
11416 </tbody></table>
11417 !! end
11418
11419 # See: T2553
11420 !! test
11421 Abort table cell attribute parsing on wikilink
11422 !! wikitext
11423 {|
11424 |testing [[one|two]] |three||four
11425 |testing one two |three||four
11426 |testing="[[one|two]]" |three||four
11427 |}
11428 !! html/php
11429 <table>
11430 <tr>
11431 <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>
11432 <td>four
11433 </td>
11434 <td>three</td>
11435 <td>four
11436 </td>
11437 <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>
11438 <td>four
11439 </td></tr></table>
11440
11441 !! html/parsoid
11442 <table>
11443 <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>
11444 <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>
11445 <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>
11446 </tbody></table>
11447 !! end
11448
11449 !! test
11450 Don't abort table cell attribute parsing if wikilink is found in template arg
11451 !! wikitext
11452 {|
11453 |Test {{#tag:ref|One two "[[three]]" four}}
11454 |}
11455 !! html/parsoid
11456 <table>
11457 <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>
11458 </tbody></table>
11459 !! end
11460
11461 !! test
11462 Magic variable as template parameter
11463 !! wikitext
11464 {{paramtest|param={{SITENAME}}}}
11465 !! html
11466 <p>This is a test template with parameter MediaWiki
11467 </p>
11468 !! end
11469
11470 !! article
11471 Template:linktest
11472 !! text
11473 [[{{{param}}}|link]]
11474 !! endarticle
11475
11476 !! test
11477 Template parameter as link source
11478 !! wikitext
11479 {{linktest|param=Main Page}}
11480 !! html
11481 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11482 </p>
11483 !! end
11484
11485 !!article
11486 Template:paramtest2
11487 !! text
11488 including another template, {{paramtest|param={{{arg}}}}}
11489 !! endarticle
11490
11491 !! test
11492 Template passing argument to another template
11493 !! wikitext
11494 {{paramtest2|arg='hmm'}}
11495 !! html
11496 <p>including another template, This is a test template with parameter 'hmm'
11497 </p>
11498 !! end
11499
11500 !! article
11501 Template:Linktest2
11502 !! text
11503 Main Page
11504 !! endarticle
11505
11506 !! test
11507 Template as link source
11508 !! wikitext
11509 [[{{linktest2}}]]
11510
11511 [[{{linktest2}}|Main Page]]
11512
11513 [[{{linktest2}}]]Page
11514 !! html
11515 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11516 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11517 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11518 </p>
11519 !! end
11520
11521
11522 !! article
11523 Template:loop1
11524 !! text
11525 {{loop2}}
11526 !! endarticle
11527
11528 !! article
11529 Template:loop2
11530 !! text
11531 {{loop1}}
11532 !! endarticle
11533
11534 !! test
11535 Template infinite loop
11536 !! wikitext
11537 {{loop1}}
11538 !! html
11539 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11540 </p>
11541 !! end
11542
11543 !! test
11544 Template from main namespace
11545 !! wikitext
11546 {{:Main Page}}
11547 !! html
11548 <p>blah blah
11549 </p>
11550 !! end
11551
11552 !! test
11553 Template from non-includable namespace
11554 !! options
11555 wgNonincludableNamespaces=10
11556 !! wikitext
11557 {{echo|uh oh!}}
11558 !! html
11559 <p><a href="/wiki/Template:Echo" title="Template:Echo">Template:Echo</a>
11560 </p>
11561 !! end
11562
11563 !! article
11564 Template:table
11565 !! text
11566 {|
11567 | 1 || 2
11568 |-
11569 | 3 || 4
11570 |}
11571 !! endarticle
11572
11573 !! test
11574 T2529: Template with table, not included at beginning of line
11575 !! wikitext
11576 foo {{table}}
11577 !! html
11578 <p>foo
11579 </p>
11580 <table>
11581 <tr>
11582 <td>1</td>
11583 <td>2
11584 </td></tr>
11585 <tr>
11586 <td>3</td>
11587 <td>4
11588 </td></tr></table>
11589
11590 !! end
11591
11592 !! test
11593 T2523: Template shouldn't eat newline (or add an extra one before table)
11594 !! wikitext
11595 foo
11596 {{table}}
11597 !! html
11598 <p>foo
11599 </p>
11600 <table>
11601 <tr>
11602 <td>1</td>
11603 <td>2
11604 </td></tr>
11605 <tr>
11606 <td>3</td>
11607 <td>4
11608 </td></tr></table>
11609
11610 !! end
11611
11612 !! test
11613 T2041: Template parameters shown as broken links
11614 !! wikitext
11615 {{{parameter}}}
11616 !! html
11617 <p>{{{parameter}}}
11618 </p>
11619 !! end
11620
11621 !! test
11622 Template with targets containing wikilinks
11623 !! options
11624 parsoid=wt2html
11625 !! wikitext
11626 {{[[foo]]}}
11627
11628 {{[[{{echo|foo}}]]}}
11629
11630 {{{{echo|[[foo}}]]}}
11631 !! html/php
11632 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11633 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11634 </p><p>{{[[foo}}]]
11635 </p>
11636 !! html/parsoid
11637 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11638 <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>
11639 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11640 !! end
11641
11642 !! article
11643 Template:''
11644 !! text
11645 bar
11646 !! endarticle
11647
11648 !! test
11649 Templates: Double quotes as template target
11650 !! wikitext
11651 foo {{''}} baz
11652 !! html/php
11653 <p>foo bar baz
11654 </p>
11655 !! html/parsoid
11656 <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
11657 </p>
11658 !! end
11659
11660 ## This test is about making sure Parsoid's data-mw is well formed in the
11661 ## face of multiple templates with intersecting and overlapping ranges. The
11662 ## wikitext itself is wretched.
11663 !! test
11664 Templates with intersecting and overlapping ranges
11665 !! wikitext
11666 {|{{echo|
11667 <p>ha</p>}}
11668 {|{{echo|
11669 <p>ho</p>}}
11670 {{echo|{{!}}hi}}
11671 |}
11672 !! html/php+tidy
11673 <p>ha</p><table>
11674
11675 </table><p>ho</p><table>
11676
11677 <tbody><tr>
11678 <td>hi
11679 </td></tr></tbody></table>
11680 !! html/parsoid
11681 <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":""}]]}'>
11682
11683 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11684
11685 <tbody><tr><td>hi</td></tr>
11686 </tbody></table>
11687 !! end
11688
11689 !! article
11690 Template:MSGNW test
11691 !! text
11692 ''None'' of '''this''' should be
11693 * interpreted
11694 but rather passed unmodified
11695 {{test}}
11696 <gallery>
11697 File:Foobar.jpg
11698 </gallery>
11699 <!-- comment -->
11700 !! endarticle
11701
11702 # hmm, fix this or just deprecate msgnw and document its behavior?
11703 !! test
11704 msgnw keyword
11705 !! wikitext
11706 {{msgnw:MSGNW test}}
11707 !! html/php
11708 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11709 &#42; interpreted
11710 &#32;but rather passed unmodified
11711 &#123;&#123;test&#125;&#125;
11712 &#60;gallery&#62;
11713 File:Foobar.jpg
11714 &#60;/gallery&#62;
11715 &#60;!-- comment --&#62;
11716 </p>
11717 !! end
11718
11719 !! test
11720 int keyword
11721 !! wikitext
11722 {{int:youhavenewmessages|lots of money|not!}}
11723 !! html
11724 <p>You have lots of money (not!).
11725 </p>
11726 !! end
11727
11728 !! test
11729 int keyword - non-existing message
11730 !! wikitext
11731 {{int:var}}
11732 !! html
11733 <p>⧼var⧽
11734 </p>
11735 !! end
11736
11737 !! article
11738 Template:Includes
11739 !! text
11740 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11741 !! endarticle
11742
11743 !! test
11744 <includeonly> and <noinclude> being included
11745 !! wikitext
11746 {{Includes}}
11747 !! html
11748 <p>Foobar
11749 </p>
11750 !! end
11751
11752 !! article
11753 Template:Includes2
11754 !! text
11755 <onlyinclude>Foo</onlyinclude>bar
11756 !! endarticle
11757
11758 !! test
11759 <onlyinclude> being included
11760 !! wikitext
11761 {{Includes2}}
11762 !! html
11763 <p>Foo
11764 </p>
11765 !! end
11766
11767
11768 !! article
11769 Template:Includes3
11770 !! text
11771 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11772 !! endarticle
11773
11774 !! test
11775 <onlyinclude> and <includeonly> being included
11776 !! wikitext
11777 {{Includes3}}
11778 !! html
11779 <p>Foo
11780 </p>
11781 !! end
11782
11783 !! test
11784 <includeonly> and <noinclude> on a page
11785 !! wikitext
11786 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11787 !! html
11788 <p>Foozar
11789 </p>
11790 !! end
11791
11792 !! test
11793 Un-closed <noinclude>
11794 !! wikitext
11795 <noinclude>
11796 !! html
11797 !! end
11798
11799 !! test
11800 <onlyinclude> on a page
11801 !! wikitext
11802 <onlyinclude>Foo</onlyinclude>bar
11803 !! html
11804 <p>Foobar
11805 </p>
11806 !! end
11807
11808 !! test
11809 Un-closed <onlyinclude>
11810 !! wikitext
11811 <onlyinclude>
11812 !! html
11813 !! end
11814
11815 !!test
11816 Self-closed noinclude, includeonly, onlyinclude tags
11817 !! wikitext
11818 <noinclude />
11819 <includeonly />
11820 <onlyinclude />
11821 !! html
11822 <p><br />
11823 </p>
11824 !!end
11825
11826 !!test
11827 Unbalanced includeonly and noinclude tags
11828 !! wikitext
11829 {|
11830 |a</noinclude>
11831 |b</noinclude></noinclude>
11832 |c</noinclude></includeonly>
11833 |d</includeonly></includeonly>
11834 |}
11835 !! html
11836 <table>
11837 <tr>
11838 <td>a
11839 </td>
11840 <td>b
11841 </td>
11842 <td>c&lt;/includeonly&gt;
11843 </td>
11844 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11845 </td></tr></table>
11846
11847 !!end
11848
11849 !! article
11850 Template:Includeonly section
11851 !! text
11852 <includeonly>
11853 ==Includeonly section==
11854 </includeonly>
11855 ==Section T-1==
11856 !!endarticle
11857
11858 !! test
11859 T8563: Edit link generation for section shown by <includeonly>
11860 !! wikitext
11861 {{includeonly section}}
11862 !! html
11863 <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>
11864 <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>
11865
11866 !! end
11867
11868 # Uses same input as the contents of [[Template:Includeonly section]]
11869 !! test
11870 T8563: Section extraction for section shown by <includeonly>
11871 !! options
11872 section=T-2
11873 !! wikitext
11874 <includeonly>
11875 ==Includeonly section==
11876 </includeonly>
11877 ==Section T-2==
11878 !! html
11879 ==Section T-2==
11880 !! end
11881
11882 !! test
11883 T8563: Edit link generation for section suppressed by <includeonly>
11884 !! wikitext
11885 <includeonly>
11886 ==Includeonly section==
11887 </includeonly>
11888 ==Section 1==
11889 !! html
11890 <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>
11891
11892 !! end
11893
11894 !! test
11895 T8563: Section extraction for section suppressed by <includeonly>
11896 !! options
11897 section=1
11898 !! wikitext
11899 <includeonly>
11900 ==Includeonly section==
11901 </includeonly>
11902 ==Section 1==
11903 !! html
11904 ==Section 1==
11905 !! end
11906
11907 !! test
11908 Un-closed <includeonly>
11909 !! wikitext
11910 <includeonly>
11911 !! html/php
11912 !! html/parsoid
11913 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11914 !! end
11915
11916 ## We used to, but no longer wt2wt this test since the default serializer
11917 ## will normalize the include directives to serialize on their own line.
11918 ## Selser will take care of preserving formatting in scenarios where they
11919 ## intermingled with other wikitext.
11920 !! test
11921 Includes and comments at SOL
11922 !! options
11923 parsoid=wt2html,html2html
11924 !! wikitext
11925 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
11926
11927 <noinclude>
11928 some
11929 </noinclude>*stuff
11930 *here
11931
11932 <includeonly>can have stuff</includeonly>===here===
11933
11934 !! html/php
11935 <h2><span class="mw-headline" id="hu">hu</span></h2>
11936 <p>some
11937 </p>
11938 <ul><li>stuff</li>
11939 <li>here</li></ul>
11940 <h3><span class="mw-headline" id="here">here</span></h3>
11941
11942 !! html/parsoid
11943 <!-- 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>
11944
11945 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11946 <p>some</p>
11947 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
11948 <li>here</li></ul>
11949
11950 <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>
11951
11952 !! end
11953
11954 # TODO: test with DOM fragment reuse!
11955 !! test
11956 Parsoid: DOM fragment reuse
11957 !! options
11958 parsoid=wt2wt,wt2html
11959 !! wikitext
11960 a{{echo|b<table></table>c}}d
11961
11962 a{{echo|b
11963 <table></table>
11964 c}}d
11965
11966 {{echo|a
11967
11968 <table></table>
11969
11970 b}}
11971 !! html
11972 <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>
11973
11974 <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">
11975 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11976 </span><p about="#mwt2">cd</p>
11977
11978 <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">
11979
11980 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11981
11982 </span><p about="#mwt3">b</p>
11983 !! end
11984
11985 !! test
11986 Parsoid: Merge double tds (T52603)
11987 !! options
11988 parsoid
11989 !! wikitext
11990 {|
11991 |{{echo|{{!}} foo}}
11992 |}
11993 !! html
11994 <table><tbody>
11995 <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>
11996 </tbody></table>
11997 !! end
11998
11999 !! test
12000 Parsoid: Merge double tds in nested transclusion content (T52603)
12001 !! options
12002 parsoid
12003 !! wikitext
12004 {{echo|<div>}}
12005 {|
12006 |{{echo|{{!}} foo}}
12007 |}
12008 {{echo|</div>}}
12009 !! html
12010 <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}}]}'>
12011 <table><tbody>
12012 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
12013 </tbody></table>
12014 </div>
12015 !! end
12016
12017 ###
12018 ### <includeonly> and <noinclude> in attributes
12019 ###
12020 !!test
12021 0. includeonly around the entire attribute
12022 !! wikitext
12023 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12024 !! html
12025 <p><span id="v2">bar</span>
12026 </p>
12027 !!end
12028
12029 !!test
12030 1. includeonly in html attr key
12031 !! wikitext
12032 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12033 !! html
12034 <p><span id="foo">bar</span>
12035 </p>
12036 !!end
12037
12038 !!test
12039 2. includeonly in html attr value
12040 !! wikitext
12041 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12042 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12043 !! html
12044 <p><span id="v1">bar</span>
12045 <span id="v1">bar</span>
12046 </p>
12047 !!end
12048
12049 !!test
12050 3. includeonly in part of an attr value
12051 !! wikitext
12052 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12053 !! html
12054 <p><span style="color:red;">bar</span>
12055 </p>
12056 !!end
12057
12058 !!test
12059 4. includeonly in table attributes
12060 !! wikitext
12061 {|
12062 |- <noinclude>
12063 |-
12064 |a
12065 </noinclude>
12066 |- <includeonly>
12067 |-
12068 |b
12069 </includeonly>
12070 |}
12071 !! html
12072 <table>
12073
12074
12075 <tr>
12076 <td>a
12077 </td></tr>
12078 </table>
12079
12080 !!end
12081
12082 ###
12083 ### Preprocessor precedence tests
12084 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12085 ###
12086 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12087 !! test
12088 Preprocessor precedence 1: link is rightmost opening
12089 !! options
12090 parsoid=wt2html
12091 !! wikitext
12092 {{[[Foo|bar}}]]
12093
12094 But close-brace is not a valid character in a link title:
12095 {{[[Foo}}|bar]]
12096
12097 However, we can still tell this was handled as a link in the preprocessor:
12098 {{echo|[[Foo}}|bar]]|bat}}
12099 !! html/php
12100 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12101 </p><p>But close-brace is not a valid character in a link title:
12102 {{[[Foo}}|bar]]
12103 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12104 [[Foo}}|bar]]
12105 </p>
12106 !! html/parsoid
12107 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12108 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12109 <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>
12110 !! end
12111
12112 !! test
12113 Preprocessor precedence 2: template is rightmost opening
12114 !! options
12115 language=zh
12116 !! wikitext
12117 -{{echo|foo}-}}-
12118 !! html/php
12119 <p>-foo}--
12120 </p>
12121 !! html/parsoid
12122 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12123 !! end
12124
12125 !! test
12126 Preprocessor precedence 3: language converter is rightmost opening
12127 !! options
12128 language=zh
12129 parsoid=wt2html
12130 !! wikitext
12131 {{echo|hi}}
12132
12133 {{-{R|echo|hi}}}-
12134
12135 [[-{R|raw]]}-
12136 !! html/php
12137 <p>hi
12138 </p><p>{{echo|hi}}
12139 </p><p>[[raw]]
12140 </p>
12141 !! html/parsoid
12142 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12143 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12144 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12145 !! end
12146
12147 !! test
12148 Preprocessor precedence 4: left-most angle bracket
12149 !! options
12150 language=zh
12151 !! wikitext
12152 <!--{raw}-->
12153 !! html/php
12154 !! html/parsoid
12155 <!--{raw}-->
12156 !! end
12157
12158 !! article
12159 Template:Precedence5
12160 !! text
12161 {{{{{1}}}}}
12162 !! endarticle
12163
12164 !! test
12165 Preprocessor precedence 5: tplarg takes precedence over template
12166 !! wikitext
12167 {{Precedence5|Bullet}}
12168 !! html/php
12169 <ul><li>Bar</li></ul>
12170
12171 !! html/parsoid
12172 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12173 !! end
12174
12175 !! test
12176 Preprocessor precedence 6: broken link is rightmost opening
12177 !! options
12178 parsoid=wt2html
12179 !! wikitext
12180 {{echo|[[Foo}}
12181
12182 {{echo|[[Foo|bar|bat=baz}}
12183 !! html/php
12184 <p>{{echo|[[Foo}}
12185 </p><p>{{echo|[[Foo|bar|bat=baz}}
12186 </p>
12187 !! html/parsoid
12188 <p>{{echo|[[Foo}}</p>
12189 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12190 !! end
12191
12192 # This next test exposes a difference between PHP and Parsoid:
12193 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12194 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12195 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12196 # outer `[[Foo` extends until the `y]]`
12197 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12198 # intermediate result (after template expansion), and link processing
12199 # happens on this intermediate result, which moves the wikilink
12200 # boundary leftward to `[[Foo|Bar]]`
12201 # 2b) Parsoid works in a single step, so it's going to keep the
12202 # wikilink as extending to the `y]]`
12203 # 3a) Then PHP does linktrail processing which slurps up the trailing
12204 # `xy` inside the link.
12205 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12206 # `z` inside the link.
12207 # This is "correct" behavior. Parsoid's basic worldview is that the
12208 # `]]` inside the template shouldn't be allowed to leak out to affect
12209 # the surrounding wikilink. PHP may match Parsoid (in the future)
12210 # if you use {{#balance}} (T114445).
12211
12212 !! test
12213 Preprocessor precedence 7: broken template is rightmost opening
12214 !! options
12215 parsoid=wt2html
12216 !! wikitext
12217 [[Foo|{{echo|Bar]]
12218
12219 [[Foo|{{echo|Bar]]-x}}-y]]-z
12220
12221 Careful: linktrails can move the end of the wikilink:
12222 [[Foo|{{echo|y']]a}}l]]l
12223 !! html/php
12224 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12225 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12226 </p><p>Careful: linktrails can move the end of the wikilink:
12227 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12228 </p>
12229 !! html/parsoid
12230 <p>[[Foo|{{echo|Bar]]</p>
12231 <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>
12232 <p>Careful: linktrails can move the end of the wikilink:
12233 <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>
12234 !! end
12235
12236 !! test
12237 Preprocessor precedence 8: broken language converter is rightmost opening
12238 !! options
12239 language=zh
12240 !! wikitext
12241 [[Foo-{R|raw]]
12242 !! html
12243 <p>[[Foo-{R|raw]]
12244 </p>
12245 !! end
12246
12247 !! article
12248 Template:Preprocessor_precedence_9
12249 !! text
12250 ;4: {{{{1}}}}
12251 ;5: {{{{{2}}}}}
12252 ;6: {{{{{{3}}}}}}
12253 ;7: {{{{{{{4}}}}}}}
12254 !! endarticle
12255
12256 !! test
12257 Preprocessor precedence 9: groups of braces
12258 !! wikitext
12259 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12260 !! html/php
12261 <dl><dt>4</dt>
12262 <dd>{Four}</dd>
12263 <dt>5</dt>
12264 <dd></dd></dl>
12265 <ul><li>Bar</li></ul>
12266 <dl><dt>6</dt>
12267 <dd>Four</dd>
12268 <dt>7</dt>
12269 <dd>{Bullet}</dd></dl>
12270
12271 !! html/parsoid
12272 <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}}]}'>
12273 <dt>4</dt>
12274 <dd>{Four}</dd>
12275 <dt>5</dt>
12276 <dd></dd>
12277 </dl><ul about="#mwt1">
12278 <li>Bar</li>
12279 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12280 <dt>6</dt>
12281 <dd>Four</dd>
12282 <dt>7</dt>
12283 <dd>{Bullet}</dd>
12284 </dl>
12285 !! end
12286
12287 !! article
12288 Template:Preprocessor_precedence_10
12289 !! text
12290 ;1: -{R|raw}-
12291 ;2: -{{Bullet}}-
12292 ;3: -{{{1}}}-
12293 ;4: -{{{{2}}}}-
12294 ;5: -{{{{{3}}}}}-
12295 ;6: -{{{{{{4}}}}}}-
12296 ;7: -{{{{{{{5}}}}}}}-
12297 !! endarticle
12298
12299 !! test
12300 Preprocessor precedence 10: groups of braces with leading dash
12301 !! options
12302 language=zh
12303 !! wikitext
12304 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12305 !! html/php
12306 <dl><dt>1</dt>
12307 <dd>raw</dd>
12308 <dt>2</dt>
12309 <dd>-</dd></dl>
12310 <ul><li>Bar-</li></ul>
12311 <dl><dt>3</dt>
12312 <dd>-Three-</dd>
12313 <dt>4</dt>
12314 <dd>raw2</dd>
12315 <dt>5</dt>
12316 <dd>-</dd></dl>
12317 <ul><li>Bar-</li></ul>
12318 <dl><dt>6</dt>
12319 <dd>-Three-</dd>
12320 <dt>7</dt>
12321 <dd>raw2</dd></dl>
12322
12323 !! html/parsoid
12324 <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}}]}'>
12325 <dt>1</dt>
12326 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12327 <dt>2</dt>
12328 <dd>-</dd>
12329 </dl><ul about="#mwt1">
12330 <li>Bar-</li>
12331 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12332 <dt>3</dt>
12333 <dd>-Three-</dd>
12334 <dt>4</dt>
12335 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12336 <dt>5</dt>
12337 <dd>-</dd>
12338 </dl><ul about="#mwt1">
12339 <li>Bar-</li>
12340 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12341 <dt>6</dt>
12342 <dd>-Three-</dd>
12343 <dt>7</dt>
12344 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12345 </dl>
12346 !! end
12347
12348 !! test
12349 Preprocessor precedence 11: found during visual diff testing
12350 !! wikitext
12351 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12352
12353 {{echo|-{{echo|-{{echo|x}}}}}}
12354
12355 {{echo|-{{echo|x}}}}
12356 !! html/php
12357 <p><span>-<span>-x</span></span>
12358 </p><p>--x
12359 </p><p>-x
12360 </p>
12361 !! html/parsoid
12362 <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>
12363
12364 <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>
12365
12366 <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>
12367 !! end
12368
12369 !! test
12370 Preprocessor precedence 12: broken language converter closed by brace.
12371 !! options
12372 parsoid=wt2html
12373 !! wikitext
12374 This form breaks the template, which is unfortunate:
12375 *{{echo|foo-{bar}bat}}
12376
12377 But if the broken language converter markup is inside an extension
12378 tag, nothing bad happens:
12379 *<nowiki>foo-{bar}bat</nowiki>
12380 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12381 *<pre>foo-{bar}bat</pre>
12382 *{{echo|<pre>foo-{bar}bat</pre>}}
12383
12384 <tag>foo-{bar}bat</tag>
12385 {{echo|<tag>foo-{bar}bat</tag>}}
12386
12387 !! html/php+tidy
12388 <p>This form breaks the template, which is unfortunate:
12389 </p>
12390 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12391 <p>But if the broken language converter markup is inside an extension
12392 tag, nothing bad happens:
12393 </p>
12394 <ul><li>foo-&#123;bar}bat</li>
12395 <li>foo-&#123;bar}bat</li>
12396 <li><pre>foo-{bar}bat</pre></li>
12397 <li><pre>foo-{bar}bat</pre></li></ul>
12398 <pre>'foo-{bar}bat'
12399 array (
12400 )
12401 </pre>
12402 <pre>'foo-{bar}bat'
12403 array (
12404 )
12405 </pre>
12406 !! html/parsoid
12407 <p>This form breaks the template, which is unfortunate:</p>
12408 <ul>
12409 <li>{{echo|foo-{bar}bat}}</li>
12410 </ul>
12411 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12412 <ul>
12413 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12414 <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>
12415 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12416 <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>
12417 </ul>
12418 <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>
12419 !! end
12420
12421 !! test
12422 Preprocessor precedence 13: broken language converter in external link
12423 !! options
12424 parsoid=wt2html
12425 !! wikitext
12426 *[http://example.com/-{foo Example in URL]
12427 *[http://example.com Example in -{link} description]
12428 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12429 !! html/php+tidy
12430 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12431 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12432 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12433 !! html/parsoid
12434 <ul>
12435 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12436 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12437 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12438 </ul>
12439 !! end
12440
12441 !! test
12442 Preprocessor precedence 14: broken language converter in comment
12443 !! wikitext
12444 *<!--{{foo}}-->...should be ok
12445 *<!---{{foo}}-->...extra dashes
12446 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12447 !! html/php+tidy
12448 <ul><li>...should be ok</li>
12449 <li>...extra dashes</li>
12450 <li>foobat...should be ok</li></ul>
12451 !! html/parsoid
12452 <ul>
12453 <li><!--{{foo}}-->...should be ok</li>
12454 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12455 <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>
12456 </ul>
12457 !! end
12458
12459 !! test
12460 Preprocessor precedence 15: broken brace markup in headings
12461 !! config
12462 wgFragmentMode=[ 'html5', 'legacy' ]
12463 !! options
12464 parsoid=wt2html
12465 !! wikitext
12466 __NOTOC__ __NOEDITSECTION__
12467 ===1 foo[bar 1===
12468 1
12469 ===2 foo[[bar 2===
12470 2
12471 ===3 foo{bar 3===
12472 3
12473 ===4 foo{{bar 4===
12474 4
12475 ===5 foo{{{bar 5===
12476 5
12477 ===6 foo-{bar 6===
12478 6
12479 !! html/php+tidy
12480 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12481 <p>1
12482 </p>
12483 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12484 <p>2
12485 </p>
12486 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12487 <p>3
12488 </p>
12489 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12490 <p>4
12491 </p>
12492 <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>
12493 <p>5
12494 </p>
12495 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12496 <p>6
12497 </p>
12498 !! html/parsoid
12499 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12500 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12501 <p>1</p>
12502 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12503 <p>2</p>
12504 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12505 <p>3</p>
12506 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12507 <p>4</p>
12508 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12509 <p>5</p>
12510 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12511 <p>6</p>
12512 !! end
12513
12514 !! test
12515 Preprocessor precedence 16: matching closing braces to opening braces
12516 !! options
12517 language=zh
12518 parsoid=wt2html
12519 !! wikitext
12520 -{{{echo|foo}}bar}-
12521 !! html/php
12522 <p>foobar
12523 </p>
12524 !! html/parsoid
12525 <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>
12526 !! end
12527
12528 !! test
12529 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12530 !! options
12531 parsoid=wt2html
12532 !! wikitext
12533 {{echo|hi {{}}}}
12534 !! html/php
12535 <p>hi {{}}
12536 </p>
12537 !! html/parsoid
12538 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12539 !! end
12540
12541 !! test
12542 Preprocessor precedence 18: another rightmost wins scenario
12543 !! options
12544 parsoid=wt2html
12545 !! wikitext
12546 {{ -{{{{1|tplarg}}} }} }-
12547 !! html/php
12548 <p>{{ -{tplarg }} }-
12549 </p>
12550 !! html/parsoid
12551 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12552 !! end
12553
12554 !! test
12555 Preprocessor precedence 19: break syntax
12556 !! options
12557 parsoid=wt2html
12558 !! wikitext
12559 -{{
12560 !! html/php
12561 <p>-{{
12562 </p>
12563 !! html/parsoid
12564 <p>-{{</p>
12565 !! end
12566
12567 ###
12568 ### Token Stream Patcher tests
12569 ###
12570 ### These tests won't always pass wt2wt and other modes because
12571 ### on serialization, the table will be output on a new line.
12572 ### For now, we are blacklisting them, and using this to test selser.
12573 ###
12574
12575 !!test
12576 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12577 !!options
12578 parsoid=wt2html,wt2wt
12579 !!wikitext
12580 {{echo|}}{| width = '100%'
12581 |foo
12582 |}
12583 !!html/parsoid
12584 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12585 <tbody><tr><td>foo</td></tr>
12586 </tbody></table>
12587 !!end
12588
12589 ## We used to, but no longer wt2wt this test since the default serializer
12590 ## will normalize the include directives to serialize on their own line.
12591 ## Selser will take care of preserving formatting in scenarios where they
12592 ## intermingled with other wikitext.
12593 !!test
12594 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12595 !!options
12596 parsoid=wt2html
12597 !!wikitext
12598 <includeonly>a</includeonly>{| {{{b}}}
12599 |c
12600 |}
12601 !!html/parsoid
12602 <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":""}]]}'>
12603 <tbody><tr><td>c</td></tr>
12604 </tbody></table>
12605 !!end
12606
12607 !! test
12608 Table wikitext syntax outside wiki-tables
12609 !! wikitext
12610 a
12611 |+ not a caption
12612 ! not a table heading
12613 |- not a table row
12614 | not a table cell
12615 | class="foo bar" | baz
12616 b
12617 |}
12618 |-
12619 c
12620 !! html
12621 <p>a
12622 |+ not a caption
12623 ! not a table heading
12624 |- not a table row
12625 | not a table cell
12626 | class="foo bar" | baz
12627 b
12628 |}
12629 |-
12630 c
12631 </p>
12632 !! end
12633
12634 ###
12635 ### Testing parsing of templates where a template arg
12636 ### has the same name as the template itself.
12637 ###
12638
12639 !! article
12640 Template:quote
12641 !! text
12642 {{{quote|{{{1}}}}}}
12643 !! endarticle
12644
12645 !!test
12646 Templates: Template Name/Arg clash: 1. Use of positional param
12647 !! wikitext
12648 {{quote|foo}}
12649 !! html
12650 <p>foo
12651 </p>
12652 !!end
12653
12654 !!test
12655 Templates: Template Name/Arg clash: 2. Use of named param
12656 !! wikitext
12657 {{quote|quote=foo}}
12658 !! html
12659 <p>foo
12660 </p>
12661 !!end
12662
12663 !!test
12664 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12665 !! wikitext
12666 {{quote|quote}}
12667 !! html
12668 <p>quote
12669 </p>
12670 !!end
12671
12672 ###
12673 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12674 ###
12675
12676 !!test
12677 Templates: 1. Simple use
12678 !! wikitext
12679 {{echo|Foo}}
12680 !! html
12681 <p>Foo
12682 </p>
12683 !!end
12684
12685 !!test
12686 Templates: 2. Inside a block tag
12687 !! wikitext
12688 <div>{{echo|Foo}}</div>
12689 <blockquote>{{echo|Foo}}</blockquote>
12690 !! html
12691 <div>Foo</div>
12692 <blockquote>Foo</blockquote>
12693
12694 !! html+tidy
12695 <div>Foo</div>
12696 <blockquote><p>Foo</p></blockquote>
12697 !!end
12698
12699 !!test
12700 Templates: P-wrapping: 1a. Templates on consecutive lines
12701 !! wikitext
12702 {{echo|Foo}}
12703 {{echo|bar}}
12704 !! html
12705 <p>Foo
12706 bar
12707 </p>
12708 !!end
12709
12710 !!test
12711 Templates: P-wrapping: 1b. Templates on consecutive lines
12712 !! wikitext
12713 Foo
12714
12715 {{echo|bar}}
12716 {{echo|baz}}
12717 !! html
12718 <p>Foo
12719 </p><p>bar
12720 baz
12721 </p>
12722 !!end
12723
12724 !!test
12725 Templates: P-wrapping: 1c. Templates on consecutive lines
12726 !! wikitext
12727 {{echo|Foo}}
12728 {{echo|bar}} <div>baz</div>
12729 !! html
12730 <p>Foo
12731 </p>
12732 bar <div>baz</div>
12733
12734 !! html+tidy
12735 <p>Foo
12736 </p><p>
12737 bar </p><div>baz</div>
12738 !! end
12739
12740 !!test
12741 Templates: P-wrapping: 1d. Template preceded by comment-only line
12742 !!options
12743 parsoid
12744 !! wikitext
12745 <!-- foo -->
12746 {{echo|Bar}}
12747 !! html
12748 <!-- foo -->
12749
12750 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12751 !!end
12752
12753 !!test
12754 Templates: Inline Text: 1. Multiple template uses
12755 !! wikitext
12756 {{echo|Foo}}bar{{echo|baz}}
12757 !! html
12758 <p>Foobarbaz
12759 </p>
12760 !!end
12761
12762 !!test
12763 Templates: Inline Text: 2. Back-to-back template uses
12764 !! wikitext
12765 {{echo|Foo}}{{echo|bar}}
12766 !! html
12767 <p>Foobar
12768 </p>
12769 !!end
12770
12771 !!test
12772 Templates: Block Tags: 1. Multiple template uses
12773 !! wikitext
12774 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12775 !! html
12776 <div>Foo</div><div>bar</div><div>baz</div>
12777
12778 !!end
12779
12780 !!test
12781 Templates: Block Tags: 2. Back-to-back template uses
12782 !! wikitext
12783 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12784 !! html
12785 <div>Foo</div><div>bar</div>
12786
12787 !!end
12788
12789 # This is an edge case relating to paragraph wrapping.
12790 !!test
12791 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12792 !! wikitext
12793 {{echo|a
12794 b</p>}}
12795 !! html/parsoid
12796 <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
12797 b</p>
12798 !!end
12799
12800 !!test
12801 Templates: Links: 1. Simple example
12802 !! wikitext
12803 {{echo|[[Foo|bar]]}}
12804 !! html
12805 <p><a href="/wiki/Foo" title="Foo">bar</a>
12806 </p>
12807 !!end
12808
12809 !!test
12810 Templates: Links: 2. Generation of link href
12811 !! wikitext
12812 [[{{echo|Foo}}|bar]]
12813 !! html
12814 <p><a href="/wiki/Foo" title="Foo">bar</a>
12815 </p>
12816 !!end
12817
12818 !!test
12819 Templates: Links: 3. Generation of part of a link href
12820 !! wikitext
12821 [[Fo{{echo|o}}|bar]]
12822
12823 [[Foo{{echo|bar}}]]
12824
12825 [[Foo{{echo|bar}}baz]]
12826
12827 [[Foo{{echo|bar}}|bar]]
12828
12829 [[:Foo{{echo|bar}}]]
12830
12831 [[:Foo{{echo|bar}}|bar]]
12832 !! html
12833 <p><a href="/wiki/Foo" title="Foo">bar</a>
12834 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12835 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12836 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12837 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12838 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12839 </p>
12840 !!end
12841
12842 !!test
12843 Templates: Links: 4. Multiple templates generating link href
12844 !! wikitext
12845 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12846 !! html
12847 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12848 </p>
12849 !!end
12850
12851 !!test
12852 Templates: Links: 5. Generation of link text
12853 !! wikitext
12854 [[Foo|{{echo|bar}}]]
12855 !! html
12856 <p><a href="/wiki/Foo" title="Foo">bar</a>
12857 </p>
12858 !!end
12859
12860 !!test
12861 Templates: Links: 5. Nested templates (only outermost template should be marked)
12862 !! wikitext
12863 {{echo|[[{{echo|Foo}}|bar]]}}
12864 !! html
12865 <p><a href="/wiki/Foo" title="Foo">bar</a>
12866 </p>
12867 !!end
12868
12869 !!test
12870 Templates: HTML Tag: 1. Generation of HTML attr. key
12871 !! wikitext
12872 <div {{echo|style}}="color:red;">foo</div>
12873 !! html
12874 <div style="color:red;">foo</div>
12875
12876 !!end
12877
12878 !!test
12879 Templates: HTML Tag: 2. Generation of HTML attr. value
12880 !! wikitext
12881 <div style={{echo|'color:red;'}}>foo</div>
12882 !! html
12883 <div style="color:red;">foo</div>
12884
12885 !!end
12886
12887 !!test
12888 Templates: HTML Tag: 3. Generation of HTML attr key and value
12889 !! wikitext
12890 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12891 !! html
12892 <div style="color:red;">foo</div>
12893
12894 !!end
12895
12896 !!test
12897 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12898 !! wikitext
12899 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12900 !! html
12901 <div title="This is a long title with just one piece templated">foo</div>
12902
12903 !!end
12904
12905 !!test
12906 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12907 !! wikitext
12908 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12909 !! html
12910 <div title="This is a long title with just one piece templated">foo</div>
12911
12912 !!end
12913
12914 !!test
12915 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12916 !! wikitext
12917 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12918 !! html
12919 <div title="This is a long title with just one piece templated">foo</div>
12920
12921 !!end
12922
12923 # SSS FIXME: While it is great we added support for all this,
12924 # do we want to make this part of the spec? Maybe we want to
12925 # deprecate this kind of usage in the future?
12926 !!test
12927 Templates: HTML Tag: 7. Generation of partial attribute key string
12928 !! wikitext
12929 <div st{{echo|yle}}="color:red;">foo</div>
12930 !! html
12931 <div style="color:red;">foo</div>
12932
12933 !!end
12934
12935 !! test
12936 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12937 !! wikitext
12938 <div {{echo|1=id="v1"}}>bar</div>
12939 !! html
12940 <div id="v1">bar</div>
12941
12942 !!end
12943
12944 !! test
12945 Templates: HTML Tag: 9. Multiple template-generated attributes
12946 !! wikitext
12947 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12948 !! html
12949 <div id="v1" title="foo">bar</div>
12950
12951 !!end
12952
12953 !! test
12954 Templates: Support for templates generating attributes and content
12955 !! wikitext
12956 {| {{mixed_attr_content_template}}
12957 |-
12958 |bar
12959 |}
12960 !! html/php
12961 <table style="color:red;" title="T48811">
12962
12963 <tr>
12964 <td>foo
12965 </td></tr>
12966 <tr>
12967 <td>bar
12968 </td></tr></table>
12969
12970 !! html/parsoid
12971 <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|}"]}'>
12972 <tbody><tr>
12973 <td>foo</td></tr>
12974 <tr>
12975 <td>bar</td></tr>
12976 </tbody></table>
12977 !!end
12978
12979 !! article
12980 Template:attribute_from_template
12981 !! text
12982 class="123"
12983 !! endarticle
12984
12985 !! test
12986 Table cell with attribute before expanded attribute
12987 !! wikitext
12988 {|
12989 | align="center" {{attribute_from_template}} |456
12990 |}
12991 !! html/parsoid
12992 <table>
12993 <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>
12994 </tbody></table>
12995 !! end
12996
12997 !! test
12998 1. Entities and nowikis inside templated attributes should be handled correctly
12999 !! wikitext
13000 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
13001 !! html/php
13002 <div style="background:#f9f9f9;">foo</div>
13003
13004 !! html/parsoid
13005 <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>
13006 !! end
13007
13008 !! test
13009 2. Entities and nowikis inside templated attributes should be handled correctly
13010 !! wikitext
13011 {|
13012 |{{table_attribs_3}}
13013 |}
13014 !! html/php
13015 <table>
13016 <tr>
13017 <td style="background:#f9f9f9;">Foo
13018 </td></tr></table>
13019
13020 !! html/parsoid
13021 <table>
13022 <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>
13023 </tbody></table>
13024 !! end
13025
13026 !! test
13027 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13028 !! wikitext
13029 {{tbl-start}}
13030 |{{table_attribs_3}}
13031 {{tbl-end}}
13032 !! html/php
13033 <table>
13034 <tr>
13035 <td style="background:#f9f9f9;">Foo
13036 </td></tr></table>
13037
13038 !! html/parsoid
13039 <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}}]}'>
13040 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
13041 </tbody></table>
13042 !! end
13043
13044 # T107622
13045 !! test
13046 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13047 !! wikitext
13048 {|
13049 |{{table_attribs_6}} hi
13050 |}
13051 !! html/php
13052 <table>
13053 <tr>
13054 <td style="background: red;">hi
13055 </td></tr></table>
13056
13057 !! html/parsoid
13058 <table>
13059 <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>
13060 </tbody></table>
13061 !! end
13062
13063 !!test
13064 Templates: HTML Tables: 1. Generating start of a HTML table
13065 !! wikitext
13066 {{echo|<table><tr><td>foo</td>}}</tr></table>
13067 !! html
13068 <table><tr><td>foo</td></tr></table>
13069
13070 !!end
13071
13072 !!test
13073 Templates: HTML Tables: 2a. Generating middle of a HTML table
13074 !! wikitext
13075 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13076 !! html
13077 <table><tr><td>foo</td></tr></table>
13078
13079 !!end
13080
13081 !!test
13082 Templates: HTML Tables: 2b. Generating middle of a HTML table
13083 !! wikitext
13084 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13085 !! html
13086 <table><tr><td>foo</td></tr></table>
13087
13088 !!end
13089
13090 !!test
13091 Templates: HTML Tables: 3. Generating end of a HTML table
13092 !! wikitext
13093 <table><tr>{{echo|<td>foo</td></tr></table>}}
13094 !! html
13095 <table><tr><td>foo</td></tr></table>
13096
13097 !!end
13098
13099 !!test
13100 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13101 !! wikitext
13102 {{echo|<table>}}<tr><td>foo</td></tr></table>
13103 !! html
13104 <table><tr><td>foo</td></tr></table>
13105
13106 !!end
13107
13108 !!test
13109 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13110 !! wikitext
13111 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13112 !! html
13113 <table><tr><td>foo</td></tr></table>
13114
13115 !!end
13116
13117 !!test
13118 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13119 !! wikitext
13120 <table><tr>{{echo|<td>}}foo</td></tr></table>
13121 !! html
13122 <table><tr><td>foo</td></tr></table>
13123
13124 !!end
13125
13126 !!test
13127 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13128 !! wikitext
13129 <table><tr><td>foo{{echo|</td>}}</tr></table>
13130 !! html
13131 <table><tr><td>foo</td></tr></table>
13132
13133 !!end
13134
13135 !!test
13136 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13137 !! wikitext
13138 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13139 !! html
13140 <table><tr><td>foo</td></tr></table>
13141
13142 !!end
13143
13144 !!test
13145 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13146 !! wikitext
13147 <table><tr><td>foo</td></tr>{{echo|</table>}}
13148 !! html
13149 <table><tr><td>foo</td></tr></table>
13150
13151 !!end
13152
13153 !!test
13154 Templates: HTML Tables: 5. Proper fostering of categories from inside
13155 !!options
13156 parsoid=wt2html,wt2wt
13157 !! wikitext
13158 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13159 <!--Two categories (T52330)-->
13160 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13161 !! html
13162 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13163 <!--Two categories (T52330)-->
13164 <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>
13165 !!end
13166
13167 !!test
13168 Templates: Wiki Tables: 1a. Fostering of entire template content
13169 !! wikitext
13170 {|
13171 {{echo|a}}
13172 |}
13173 !! html
13174 <table>
13175 a
13176 <tr><td></td></tr></table>
13177
13178 !! html/php+tidy
13179
13180 a
13181 <table><tbody><tr><td></td></tr></tbody></table>
13182 !! html/parsoid
13183 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}},"\n|}"]}'>a</p><table about="#mwt2">
13184
13185 </table>
13186 !! end
13187
13188 !!test
13189 Templates: Wiki Tables: 1b. Fostering of entire template content
13190 !! wikitext
13191 {|
13192 {{echo|<div>}}
13193 foo
13194 {{echo|</div>}}
13195 |}
13196 !! html
13197 <table>
13198 <div>
13199 <p>foo
13200 </p>
13201 </div>
13202 <tr><td></td></tr></table>
13203
13204 !! html/php+tidy
13205 <div>
13206 <p>foo
13207 </p>
13208 </div><table>
13209
13210 <tbody><tr><td></td></tr></tbody></table>
13211 !! html/parsoid
13212 <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|}"]}'>
13213 <p>foo</p>
13214 </div><table about="#mwt3">
13215
13216 </table>
13217 !! end
13218
13219 !!test
13220 Templates: Wiki Tables: 2. Fostering of partial template content
13221 !! wikitext
13222 {|
13223 {{echo|a
13224 <div>b</div>}}
13225 |}
13226 !! html
13227 <table>
13228 a
13229 <div>b</div>
13230 <tr><td></td></tr></table>
13231
13232 !! html/php+tidy
13233
13234 a
13235 <div>b</div><table>
13236 <tbody><tr><td></td></tr></tbody></table>
13237 !! html/parsoid
13238 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n&lt;div>b&lt;/div>"}},"i":0}},"\n|}"]}'>a</p><div about="#mwt2">b</div><table about="#mwt2">
13239
13240
13241 </table>
13242 !! end
13243
13244 !!test
13245 Templates: Wiki Tables: 3. td-content via multiple templates
13246 !! wikitext
13247 {|
13248 {{echo|{{pipe}}a}}{{echo|b}}
13249 |}
13250 !! html
13251 <table>
13252 <tr>
13253 <td>ab
13254 </td></tr></table>
13255
13256 !!end
13257
13258 !!test
13259 Templates: Wiki Tables: 4. Templated tags, no content
13260 !! wikitext
13261 {{tbl-start}}
13262 {{tbl-end}}
13263 !! html
13264 <table>
13265 <tr><td></td></tr></table>
13266
13267 !!end
13268
13269 !!test
13270 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13271 !! wikitext
13272 {{tbl-start}}
13273 |foo
13274 {{tbl-end}}
13275 !! html
13276 <table>
13277 <tr>
13278 <td>foo
13279 </td></tr></table>
13280
13281 !!end
13282
13283 !!test
13284 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13285 !! wikitext
13286 {{tbl-start}}
13287 {{!}}foo
13288 {{tbl-end}}
13289 !! html
13290 <table>
13291 <tr>
13292 <td>foo
13293 </td></tr></table>
13294
13295 !!end
13296
13297 ## This test case is very specific to Parsoid's internals
13298 ## and is hence only tested for Parsoid's code. Parsoid uses
13299 ## a <meta> marker tag for <ref> tags and they are expanded
13300 ## much later. We are verifying that this <meta> tag usage
13301 ## doesn't prevent foster parenting.
13302 !!test
13303 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13304 !!wikitext
13305 {{PartialTable}}<ref>foo</ref>
13306 |}
13307
13308 <references />
13309 !!html/parsoid
13310 <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">
13311 <tbody>
13312 </tbody></table>
13313
13314 <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>
13315 !!end
13316
13317 !! test
13318 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13319 !! wikitext
13320 {{echo|
13321 {{{!}}
13322 {{!}}-}}
13323 <onlyinclude>
13324 |foo
13325 </onlyinclude>
13326 {{!}}}
13327 !! html/parsoid
13328 <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{{!}}}"]}'>
13329 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13330 <tbody><tr>
13331
13332 <td>foo
13333 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13334 </tbody></table>
13335 !! end
13336
13337 !!test
13338 Templates: Lists: Multi-line list-items via templates
13339 !! wikitext
13340 *{{echo|a {{nonexistent|
13341 unused}}}}
13342 *{{echo|b {{nonexistent|
13343 unused}}}}
13344 !! html
13345 <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>
13346 <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>
13347
13348 !!end
13349
13350 !!test
13351 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13352 !! wikitext
13353 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13354 !! html
13355 <p><i>ab</i>c<i>d</i>e
13356 </p>
13357 !!end
13358
13359 !!test
13360 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13361 (PHP parser generates misnested html)
13362 !! wikitext
13363 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13364 !! html/parsoid
13365 <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>
13366 !!end
13367
13368 !!test
13369 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13370 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13371 !! options
13372 parsoid=wt2html,wt2wt
13373 !! wikitext
13374 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13375 !! html
13376 <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>
13377 <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>
13378 <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>
13379 !!end
13380
13381 !!test
13382 Templates: Ugly nesting: 4. Divs opened/closed across templates
13383 !! wikitext
13384 a<div>b{{echo|c</div>d}}e
13385 !! html
13386 a<div>bc</div>de
13387
13388 !! html+tidy
13389 <p>a</p><div>bc</div><p>de
13390 </p>
13391 !! end
13392
13393 !! test
13394 Templates: Ugly templates: 3. newline-only template parameter
13395 !! wikitext
13396 foo {{echo|
13397 }}
13398 !! html
13399 <p>foo
13400 </p>
13401 !! end
13402
13403 # This looks like a bug: a single newline triggers p/br for some reason.
13404 !! test
13405 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13406 !! wikitext
13407 {{echo|
13408 }}
13409 !! html
13410 <p><br />
13411 </p>
13412 !! end
13413
13414 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13415 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13416 !! test
13417 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13418 !! wikitext
13419 {{echo|<table>}}
13420 {{echo|<div>foo}}
13421 {{echo|</table>}}
13422 !! html/parsoid
13423 <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
13424 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13425 </table>
13426 !! end
13427
13428 # T66017 -- ugly wikitext with fostered content generates two template ranges
13429 # that are "identical" and generate nesting cycles in the algorithm
13430 !! test
13431 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13432 !! wikitext
13433 {{echo|<table><tr><td><table>}}
13434 {{echo|<div>}}
13435 {{echo|</div>}}
13436 !! html/parsoid
13437 <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"}'>
13438 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13439 </table></td></tr></tbody></table>
13440 !! end
13441
13442 !! test
13443 Templates: Parameters substituted at the top-level
13444 !! wikitext
13445 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13446
13447 {{{foo|bar|baz}}}
13448 !! html/php
13449 <p><i>who</i> me? <b>never!</b>
13450 </p><p>bar
13451 </p>
13452 !! html/parsoid
13453 <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>
13454
13455 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13456 !! end
13457
13458 !! test
13459 Templates: Param with empty arg in the final position
13460 !! wikitext
13461 {{{hi|}}}
13462 !! html/parsoid
13463 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13464 !! end
13465
13466 !!test
13467 Parser Functions: 1. Simple example
13468 !! wikitext
13469 {{uc:foo}}
13470 !! html
13471 <p>FOO
13472 </p>
13473 !!end
13474
13475 !!test
13476 Parser Functions: 2. Nested use (only outermost should be marked up)
13477 !! wikitext
13478 {{uc:{{lc:FOO}}}}
13479 !! html
13480 <p>FOO
13481 </p>
13482 !!end
13483
13484 ## Note that the templates inside the references are not wrapped
13485 !! test
13486 Template nested in extension tag in template
13487 !! wikitext
13488 {{echo|hi<ref>[[ho|{{echo|hi}}]]</ref>}}
13489 {{echo|hi<ref>[http://test.com?q={{echo|ho}}]</ref>}}
13490 <references />
13491 !! html/parsoid
13492 <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>
13493 <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>
13494 <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>
13495 !! end
13496
13497 ###
13498 ### Pre-save transform tests
13499 ###
13500 !! test
13501 pre-save transform: subst:
13502 !! options
13503 pst
13504 !! wikitext
13505 {{subst:test}}
13506 !! html/php
13507 This is a test template
13508 !! end
13509
13510 !! test
13511 pre-save transform: normal template
13512 !! options
13513 pst
13514 !! wikitext
13515 {{test}}
13516 !! html/php
13517 {{test}}
13518 !! end
13519
13520 !! test
13521 pre-save transform: nonexistent template
13522 !! options
13523 pst
13524 !! wikitext
13525 {{thistemplatedoesnotexist}}
13526 !! html/php
13527 {{thistemplatedoesnotexist}}
13528 !! end
13529
13530 !! test
13531 pre-save transform: subst magic variables
13532 !! options
13533 pst
13534 !! wikitext
13535 {{subst:SITENAME}}
13536 !! html/php
13537 MediaWiki
13538 !! end
13539
13540 # This is T2089, which I fixed. -- wtm
13541 !! test
13542 pre-save transform: subst: templates with parameters
13543 !! options
13544 pst
13545 !! wikitext
13546 {{subst:paramtest|param="something else"}}
13547 !! html/php
13548 This is a test template with parameter "something else"
13549 !! end
13550
13551 !! article
13552 Template:nowikitest
13553 !! text
13554 <nowiki>'''not wiki'''</nowiki>
13555 !! endarticle
13556
13557 !! test
13558 pre-save transform: nowiki in subst (T3188)
13559 !! options
13560 pst
13561 !! wikitext
13562 {{subst:nowikitest}}
13563 !! html/php
13564 <nowiki>'''not wiki'''</nowiki>
13565 !! end
13566
13567 !! article
13568 Template:commenttest
13569 !! text
13570 This template has <!-- a comment --> in it.
13571 !! endarticle
13572
13573 !! test
13574 pre-save transform: comment in subst (T3936)
13575 !! options
13576 pst
13577 !! wikitext
13578 {{subst:commenttest}}
13579 !! html/php
13580 This template has <!-- a comment --> in it.
13581 !! end
13582
13583 !! test
13584 pre-save transform: unclosed tag
13585 !! options
13586 pst
13587 !! wikitext
13588 <nowiki>'''not wiki'''
13589 !! html/php
13590 <nowiki>'''not wiki'''
13591 !! end
13592
13593 !! test
13594 pre-save transform: mixed tag case
13595 !! options
13596 pst
13597 !! wikitext
13598 <NOwiki>'''not wiki'''</noWIKI>
13599 !! html/php
13600 <NOwiki>'''not wiki'''</noWIKI>
13601 !! end
13602
13603 !! test
13604 pre-save transform: unclosed comment in <nowiki>
13605 !! options
13606 pst
13607 !! wikitext
13608 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13609 !! html/php
13610 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13611 !!end
13612
13613 # Leading @ in this template definition works around a limitation
13614 # in parsoid's parserTests which otherwise strips the <span> from the
13615 # result (confusing it for a template wrapper)
13616 !! article
13617 Template:dangerous
13618 !!text
13619 @<span onmouseover="alert('crap')">Oh no</span>
13620 !!endarticle
13621
13622 !!test
13623 (confirming safety of fix for subst T3936)
13624 !! wikitext
13625 {{Template:dangerous}}
13626 !! html
13627 <p>@<span>Oh no</span>
13628 </p>
13629 !! end
13630
13631 !! test
13632 pre-save transform: comment containing gallery (T7024)
13633 !! options
13634 pst
13635 !! wikitext
13636 <!-- <gallery>data</gallery> -->
13637 !! html/php
13638 <!-- <gallery>data</gallery> -->
13639 !!end
13640
13641 !! test
13642 pre-save transform: comment containing extension
13643 !! options
13644 pst
13645 !! wikitext
13646 <!-- <tag>data</tag> -->
13647 !! html/php
13648 <!-- <tag>data</tag> -->
13649 !!end
13650
13651 !! test
13652 pre-save transform: comment containing nowiki
13653 !! options
13654 pst
13655 !! wikitext
13656 <!-- <nowiki>data</nowiki> -->
13657 !! html/php
13658 <!-- <nowiki>data</nowiki> -->
13659 !!end
13660
13661 !! test
13662 pre-save transform: <noinclude> in subst (T5298)
13663 !! options
13664 pst
13665 !! wikitext
13666 {{subst:Includes}}
13667 !! html/php
13668 Foobar
13669 !! end
13670
13671 !! test
13672 pre-save transform: <onlyinclude> in subst (T5298)
13673 !! options
13674 pst
13675 !! wikitext
13676 {{subst:Includes2}}
13677 !! html/php
13678 Foo
13679 !! end
13680
13681 !! article
13682 Template:SubstTest
13683 !!text
13684 {{<includeonly>subst:</includeonly>Includes}}
13685 !! endarticle
13686
13687 !! article
13688 Template:SafeSubstTest
13689 !! text
13690 {{<includeonly>safesubst:</includeonly>Includes}}
13691 !! endarticle
13692
13693 !! test
13694 T24297: safesubst: works during PST
13695 !! options
13696 pst
13697 !! wikitext
13698 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13699 !! html/php
13700 FoobarFoobar
13701 !! end
13702
13703 !! test
13704 T24297: safesubst: works during normal parse
13705 !! wikitext
13706 {{SafeSubstTest}}
13707 !! html
13708 <p>Foobar
13709 </p>
13710 !! end
13711
13712 !! test
13713 subst: does not work during normal parse
13714 !! wikitext
13715 {{SubstTest}}
13716 !! html
13717 <p>{{subst:Includes}}
13718 </p>
13719 !! end
13720
13721 !! test
13722 pre-save transform: context links ("pipe trick")
13723 !! options
13724 pst
13725 !! wikitext
13726 [[Article (context)|]]
13727 [[Bar:Article|]]
13728 [[:Bar:Article|]]
13729 [[Bar:Article (context)|]]
13730 [[:Bar:Article (context)|]]
13731 [[|Article]]
13732 [[|Article (context)]]
13733 [[Bar:X (Y) Z|]]
13734 [[:Bar:X (Y) Z|]]
13735 !! html/php
13736 [[Article (context)|Article]]
13737 [[Bar:Article|Article]]
13738 [[:Bar:Article|Article]]
13739 [[Bar:Article (context)|Article]]
13740 [[:Bar:Article (context)|Article]]
13741 [[Article]]
13742 [[Article (context)]]
13743 [[Bar:X (Y) Z|X (Y) Z]]
13744 [[:Bar:X (Y) Z|X (Y) Z]]
13745 !! end
13746
13747 !! test
13748 pre-save transform: context links ("pipe trick") with interwiki prefix
13749 !! options
13750 pst
13751 !! wikitext
13752 [[interwiki:Article|]]
13753 [[:interwiki:Article|]]
13754 [[interwiki:Bar:Article|]]
13755 [[:interwiki:Bar:Article|]]
13756 !! html/php
13757 [[interwiki:Article|Article]]
13758 [[:interwiki:Article|Article]]
13759 [[interwiki:Bar:Article|Bar:Article]]
13760 [[:interwiki:Bar:Article|Bar:Article]]
13761 !! end
13762
13763 !! test
13764 pre-save transform: context links ("pipe trick") with parens in title
13765 !! options
13766 pst title=[[Somearticle (context)]]
13767 !! wikitext
13768 [[|Article]]
13769 !! html/php
13770 [[Article (context)|Article]]
13771 !! end
13772
13773 !! test
13774 pre-save transform: context links ("pipe trick") with comma in title
13775 !! options
13776 pst title=[[Someplace, Somewhere]]
13777 !! wikitext
13778 [[|Otherplace]]
13779 [[Otherplace, Elsewhere|]]
13780 [[Otherplace, Elsewhere, Anywhere|]]
13781 !! html/php
13782 [[Otherplace, Somewhere|Otherplace]]
13783 [[Otherplace, Elsewhere|Otherplace]]
13784 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13785 !! end
13786
13787 !! test
13788 pre-save transform: context links ("pipe trick") with parens and comma
13789 !! options
13790 pst title=[[Someplace (IGNORED), Somewhere]]
13791 !! wikitext
13792 [[|Otherplace]]
13793 [[Otherplace (place), Elsewhere|]]
13794 !! html/php
13795 [[Otherplace, Somewhere|Otherplace]]
13796 [[Otherplace (place), Elsewhere|Otherplace]]
13797 !! end
13798
13799 !! test
13800 pre-save transform: context links ("pipe trick") with comma and parens
13801 !! options
13802 pst title=[[Who, me? (context)]]
13803 !! wikitext
13804 [[|Yes, you.]]
13805 [[Me, Myself, and I (1937 song)|]]
13806 !! html/php
13807 [[Yes, you. (context)|Yes, you.]]
13808 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13809 !! end
13810
13811 !! test
13812 pre-save transform: context links ("pipe trick") with namespace
13813 !! options
13814 pst title=[[Ns:Somearticle]]
13815 !! wikitext
13816 [[|Article]]
13817 !! html/php
13818 [[Ns:Article|Article]]
13819 !! end
13820
13821 !! test
13822 pre-save transform: context links ("pipe trick") with namespace and parens
13823 !! options
13824 pst title=[[Ns:Somearticle (context)]]
13825 !! wikitext
13826 [[|Article]]
13827 !! html/php
13828 [[Ns:Article (context)|Article]]
13829 !! end
13830
13831 !! test
13832 pre-save transform: context links ("pipe trick") with namespace and comma
13833 !! options
13834 pst title=[[Ns:Somearticle, Context, Whatever]]
13835 !! wikitext
13836 [[|Article]]
13837 !! html/php
13838 [[Ns:Article, Context, Whatever|Article]]
13839 !! end
13840
13841 !! test
13842 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13843 !! options
13844 pst title=[[Ns:Somearticle, Context (context)]]
13845 !! wikitext
13846 [[|Article]]
13847 !! html/php
13848 [[Ns:Article (context)|Article]]
13849 !! end
13850
13851 !! test
13852 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13853 !! options
13854 pst title=[[Ns:Somearticle (IGNORED), Context]]
13855 !! wikitext
13856 [[|Article]]
13857 !! html/php
13858 [[Ns:Article, Context|Article]]
13859 !! end
13860
13861 !! test
13862 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13863 !! options
13864 pst
13865 !! wikitext
13866 [[Article(context)|]]
13867 [[Bar:Article(context)|]]
13868 [[:Bar:Article(context)|]]
13869 [[|Article(context)]]
13870 [[Bar:X(Y)Z|]]
13871 [[:Bar:X(Y)Z|]]
13872 !! html/php
13873 [[Article(context)|Article]]
13874 [[Bar:Article(context)|Article]]
13875 [[:Bar:Article(context)|Article]]
13876 [[Article(context)]]
13877 [[Bar:X(Y)Z|X(Y)Z]]
13878 [[:Bar:X(Y)Z|X(Y)Z]]
13879 !! end
13880
13881 !! test
13882 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13883 !! options
13884 pst
13885 !! wikitext
13886 [[Article (context)|]]
13887 [[Bar:Article (context)|]]
13888 [[:Bar:Article (context)|]]
13889 [[|Article (context)]]
13890 [[Bar:X (Y) Z|]]
13891 [[:Bar:X (Y) Z|]]
13892 !! html/php
13893 [[Article (context)|Article]]
13894 [[Bar:Article (context)|Article]]
13895 [[:Bar:Article (context)|Article]]
13896 [[Article (context)]]
13897 [[Bar:X (Y) Z|X (Y) Z]]
13898 [[:Bar:X (Y) Z|X (Y) Z]]
13899 !! end
13900
13901 !! test
13902 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13903 !! options
13904 pst
13905 !! wikitext
13906 [[Article(context)|]]
13907 [[Bar:Article(context)|]]
13908 [[:Bar:Article(context)|]]
13909 [[|Article(context)]]
13910 [[Bar:X(Y)Z|]]
13911 [[:Bar:X(Y)Z|]]
13912 !! html/php
13913 [[Article(context)|Article]]
13914 [[Bar:Article(context)|Article]]
13915 [[:Bar:Article(context)|Article]]
13916 [[Article(context)]]
13917 [[Bar:X(Y)Z|X(Y)Z]]
13918 [[:Bar:X(Y)Z|X(Y)Z]]
13919 !! end
13920
13921 !! test
13922 pre-save transform: context links ("pipe trick") with commas (T23660)
13923 !! options
13924 pst
13925 !! wikitext
13926 [[Article (context), context|]]
13927 [[Article (context),context|]]
13928 [[Bar:Article (context), context|]]
13929 [[Bar:Article (context),context|]]
13930 [[:Bar:Article (context), context|]]
13931 [[:Bar:Article (context),context|]]
13932 !! html/php
13933 [[Article (context), context|Article]]
13934 [[Article (context),context|Article]]
13935 [[Bar:Article (context), context|Article]]
13936 [[Bar:Article (context),context|Article]]
13937 [[:Bar:Article (context), context|Article]]
13938 [[:Bar:Article (context),context|Article]]
13939 !! end
13940
13941 !! test
13942 Parsoid: backwards pipe trick
13943 !! wikitext
13944 [[|'''bar''']]
13945 !! html/php
13946 <p>[[|<b>bar</b>]]
13947 </p>
13948 !! html/parsoid
13949 <p>[[|<b>bar</b>]]</p>
13950 !! end
13951
13952 !! test
13953 pre-save transform: trim trailing empty lines
13954 !! options
13955 pst
13956 !! wikitext
13957 Empty lines are trimmed
13958
13959
13960
13961
13962 !! html/php
13963 Empty lines are trimmed
13964 !! end
13965
13966 !! test
13967 pre-save transform: Signature expansion
13968 !! options
13969 pst
13970 !! wikitext
13971 * ~~~
13972 * ~~~~
13973 * ~~~~~
13974 * <noinclude>~~~</noinclude>
13975 * <includeonly>~~~</includeonly>
13976 * <onlyinclude>~~~</onlyinclude>
13977 !! html/php
13978 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13979 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13980 * 00:02, 1 January 1970 (UTC)
13981 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13982 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13983 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13984 !! end
13985
13986
13987 !! test
13988 ParserOutput flags from signature expansion (T84843)
13989 !! options
13990 pst
13991 showflags
13992 !! wikitext
13993 ~~~~
13994 !! html/php
13995 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13996 flags=user-signature
13997 !! end
13998
13999
14000 !! test
14001 pre-save transform: Signature expansion in nowiki tags (T2093)
14002 !! options
14003 pst disabled
14004 !! wikitext
14005 Shall not expand:
14006
14007 <nowiki>~~~~</nowiki>
14008
14009 <includeonly><nowiki>~~~~</nowiki></includeonly>
14010
14011 <noinclude><nowiki>~~~~</nowiki></noinclude>
14012
14013 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14014
14015 {{subst:Foo}} shall be converted to FOO
14016
14017 As well as inside noinclude/onlyinclude
14018 <noinclude>{{subst:Foo}}</noinclude>
14019 <onlyinclude>{{subst:Foo}}</onlyinclude>
14020
14021 But not inside includeonly
14022 <includeonly>{{subst:Foo}}</includeonly>
14023 !! html/php
14024 Shall not expand:
14025
14026 <nowiki>~~~~</nowiki>
14027
14028 <includeonly><nowiki>~~~~</nowiki></includeonly>
14029
14030 <noinclude><nowiki>~~~~</nowiki></noinclude>
14031
14032 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14033
14034 FOO shall be converted to FOO
14035
14036 As well as inside noinclude/onlyinclude
14037 <noinclude>FOO</noinclude>
14038 <onlyinclude>FOO</onlyinclude>
14039
14040 But not inside includeonly
14041 <includeonly>{{subst:Foo}}</includeonly>
14042 !! end
14043
14044 !! test
14045 Parsoid: Recognize nowiki with trailing space in tags
14046 !! options
14047 parsoid=wt2html
14048 !! wikitext
14049 <nowiki ><div>[[foo]]</nowiki >
14050
14051 a<nowiki / >b
14052
14053 c<nowiki />d
14054
14055 e<nowiki/ >f
14056 !! html
14057 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14058 <p>ab</p>
14059 <p>cd</p>
14060 <p>ef</p>
14061 !! end
14062
14063 !! test
14064 Parsoid: Recognize nowiki with odd capitalization
14065 !! options
14066 parsoid=wt2html
14067 !! wikitext
14068 <noWikI ><div>[[foo]]</Nowiki >
14069 !! html
14070 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14071 !! end
14072
14073
14074 !! test
14075 Parsoid: Escape nowiki with trailing space in tags
14076 !! options
14077 parsoid=html2wt
14078 !! html/parsoid
14079 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14080 <p>a&lt;nowiki /&gt;b</p>
14081 <p>c&lt;nowiki/ &gt;d</p>
14082 !! wikitext
14083 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14084
14085 a&lt;nowiki /&gt;b
14086
14087 c&lt;nowiki/ &gt;d
14088 !! end
14089
14090 !! test
14091 Parsoid: Escape weird noWikI capitalizations
14092 !! options
14093 parsoid=html2wt
14094 !! html/parsoid
14095 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14096 !! wikitext
14097 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14098 !! end
14099
14100 ###
14101 ### Message transform tests
14102 ###
14103 !! test
14104 message transform: magic variables
14105 !! options
14106 msg
14107 !! wikitext
14108 {{SITENAME}}
14109 !! html
14110 MediaWiki
14111 !! end
14112
14113 !! test
14114 message transform: should not transform wiki markup
14115 !! options
14116 msg
14117 !! wikitext
14118 ''test''
14119 !! html
14120 ''test''
14121 !! end
14122
14123 !! test
14124 message transform: <noinclude> in transcluded template (T6926)
14125 !! options
14126 msg
14127 !! wikitext
14128 {{Includes}}
14129 !! html
14130 Foobar
14131 !! end
14132
14133 !! test
14134 message transform: <onlyinclude> in transcluded template (T6926)
14135 !! options
14136 msg
14137 !! wikitext
14138 {{Includes2}}
14139 !! html
14140 Foo
14141 !! end
14142
14143 !! test
14144 {{#special:}} page name, known
14145 !! options
14146 msg
14147 !! wikitext
14148 {{#special:Recentchanges}}
14149 !! html
14150 Special:RecentChanges
14151 !! end
14152
14153 !! test
14154 {{#special:}} page name with subpage, known
14155 !! options
14156 msg
14157 !! wikitext
14158 {{#special:Recentchanges/param}}
14159 !! html
14160 Special:RecentChanges/param
14161 !! end
14162
14163 !! test
14164 {{#special:}} page name, unknown
14165 !! options
14166 msg
14167 !! wikitext
14168 {{#special:foobar nonexistent}}
14169 !! html
14170 Special:Foobar nonexistent
14171 !! end
14172
14173 !! test
14174 {{#speciale:}} page name, known
14175 !! options
14176 msg
14177 !! wikitext
14178 {{#speciale:Recentchanges}}
14179 !! html
14180 Special:RecentChanges
14181 !! end
14182
14183 !! test
14184 {{#speciale:}} page name with subpage, known
14185 !! options
14186 msg
14187 !! wikitext
14188 {{#speciale:Recentchanges/param}}
14189 !! html
14190 Special:RecentChanges/param
14191 !! end
14192
14193 !! test
14194 {{#speciale:}} page name, unknown
14195 !! options
14196 msg
14197 !! wikitext
14198 {{#speciale:foobar nonexistent}}
14199 !! html
14200 Special:Foobar_nonexistent
14201 !! end
14202
14203 ###
14204 ### Images
14205 ###
14206 ### For Parsoid-specific tests, see
14207 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14208
14209 !! test
14210 Simple image
14211 !! options
14212 parsoid=wt2html,wt2wt,html2html
14213 !! wikitext
14214 [[Image:foobar.jpg]]
14215 !! html/php
14216 <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>
14217 </p>
14218 !! html/parsoid
14219 <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>
14220 !! end
14221
14222 !! test
14223 Serialize simple image with span wrapper
14224 !! options
14225 parsoid=html2wt
14226 !! html/parsoid
14227 <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>
14228 !! wikitext
14229 [[File:Foobar.jpg]]
14230 !! end
14231
14232 !! test
14233 Simple image (using File: namespace, now canonical)
14234 !! wikitext
14235 [[File:Foobar.jpg]]
14236 !! html/php
14237 <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>
14238 </p>
14239 !! html/parsoid
14240 <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>
14241 !! end
14242
14243 !! test
14244 Right-aligned image
14245 !! wikitext
14246 [[File:Foobar.jpg|right]]
14247 !! html/php
14248 <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>
14249
14250 !! html/parsoid
14251 <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>
14252 !! end
14253
14254 !! test
14255 Image with caption
14256 !! wikitext
14257 [[File:Foobar.jpg|right|Caption text]]
14258 !! html/php
14259 <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>
14260
14261 !! html/parsoid
14262 <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>
14263 !! end
14264
14265 !! test
14266 Image with caption, T55312 #1
14267 !! wikitext
14268 [[File:Foobar.jpg|right|Caption page stuff]]
14269 !! html/php
14270 <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>
14271
14272 !! html/parsoid
14273 <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>
14274 !! end
14275
14276 !! test
14277 Image with caption, T55312 #2
14278 !! wikitext
14279 [[File:Foobar.jpg|right|Caption page=]]
14280 !! html/php
14281 <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>
14282
14283 !! html/parsoid
14284 <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>
14285 !! end
14286
14287 !! test
14288 Image with caption, T55312 #3
14289 !! wikitext
14290 [[File:Foobar.jpg|right|Caption page=stuff]]
14291 !! html/php
14292 <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>
14293
14294 !! html/parsoid
14295 <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>
14296 !! end
14297
14298 !! test
14299 Image caption with pipe entity
14300 !! wikitext
14301 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14302 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14303 !! html/php
14304 <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>
14305 <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>
14306
14307 !! html/parsoid
14308 <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>
14309 <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>
14310 !! end
14311
14312 !! test
14313 Allow empty links in image captions (T62753)
14314 !! options
14315 thumbsize=220
14316 !! wikitext
14317 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14318 [[]]
14319 [[Link2]]
14320 ]]
14321 !! html/php
14322 <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>
14323
14324 !! html/parsoid
14325 <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>
14326 [[]]
14327 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14328 </figcaption></figure>
14329 !! end
14330
14331 !! test
14332 Titles in unlinked images (T23454)
14333 !! wikitext
14334 [[File:Foobar.jpg|link=|stuff]]
14335 !! html/php
14336 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14337 </p>
14338 !! html/parsoid
14339 <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>
14340 !! end
14341
14342 !! test
14343 Link with empty target
14344 !! wikitext
14345 [[]]
14346 !! html
14347 <p>[[]]
14348 </p>
14349 !! end
14350
14351 !! test
14352 Image with link trail
14353 !! wikitext
14354 Linktrails should not work for images: [[File:Foobar.jpg]]s
14355 !! html/php
14356 <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
14357 </p>
14358 !! html/parsoid
14359 <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>
14360 !! end
14361
14362 !! test
14363 Image with empty attribute
14364 !! options
14365 parsoid=wt2html,wt2wt,html2html
14366 !! wikitext
14367 [[File:Foobar.jpg|right||Caption text]]
14368 !! html/php
14369 <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>
14370
14371 !! html/parsoid
14372 <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>
14373 !! end
14374
14375 !! test
14376 1. Block image with individual attributes from templates
14377 !! wikitext
14378 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14379 !! html/php
14380 <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>
14381
14382 !! html/parsoid
14383 <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>
14384 !! end
14385
14386 !! test
14387 2. Block Image with individual attributes from templates
14388 !! wikitext
14389 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14390 !! html/php
14391 <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>
14392
14393 !! html/parsoid
14394 <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>
14395 !! end
14396
14397 !! test
14398 3. Inline image with individual attributes from templates
14399 !! wikitext
14400 [[File:Foobar.jpg|{{echo|50px}}]]
14401 !! html/php
14402 <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>
14403 </p>
14404 !! html/parsoid
14405 <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>
14406 !! end
14407
14408 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14409 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14410 !! test
14411 Image with multiple attributes from the same template
14412 !! wikitext
14413 [[File:Foobar.jpg|{{image_attribs}}]]
14414 !! html/php
14415 <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>
14416
14417 !! html/parsoid
14418 <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>
14419 !! end
14420
14421 !! test
14422 Image with link tails
14423 !! options
14424 thumbsize=220
14425 !! wikitext
14426 123[[File:Foobar.jpg]]456
14427 123[[File:Foobar.jpg|right]]456
14428 123[[File:Foobar.jpg|thumb]]456
14429 !! html/php
14430 <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
14431 </p>
14432 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
14433 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
14434
14435 !! html/php+tidy
14436 <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
14437 </p><p>
14438 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
14439 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
14440 </p>
14441 !! html/parsoid
14442 <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>
14443 <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>
14444 <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>
14445 !! end
14446
14447 !! test
14448 Image with multiple captions -- only last one is accepted
14449 !! wikitext
14450 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14451 !! html/php
14452 <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>
14453
14454 !! html/parsoid
14455 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption3 - accepted</figcaption></figure>
14456 !! end
14457
14458 !! test
14459 Image with multiple widths -- use last
14460 !! wikitext
14461 [[File:Foobar.jpg|200px|300px|caption]]
14462 !! html/php
14463 <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>
14464 </p>
14465 !! html/parsoid
14466 <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>
14467 !! end
14468
14469 !! test
14470 Image with multiple alignments -- use first (T50664)
14471 !! options
14472 thumbsize=220
14473 !! wikitext
14474 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14475
14476 [[File:Foobar.jpg|middle|text-top|caption]]
14477 !! html/php
14478 <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>
14479 <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>
14480 </p>
14481 !! html/parsoid
14482 <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>
14483 <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>
14484 !! end
14485
14486 !! test
14487 Image with width attribute at different positions
14488 !! wikitext
14489 [[File:Foobar.jpg|200px|right|Caption]]
14490 [[File:Foobar.jpg|right|200px|Caption]]
14491 [[File:Foobar.jpg|right|Caption|200px]]
14492 !! html/php
14493 <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>
14494 <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>
14495 <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>
14496
14497 !! html/parsoid
14498 <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>
14499 <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>
14500 <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>
14501 !! end
14502
14503 # a sad bit of backward-compatibility
14504 !! test
14505 Image with size specified with pxpx (T15500, T53628)
14506 !! options
14507 parsoid=wt2html,wt2wt,html2html
14508 !! wikitext
14509 [[File:Foobar.jpg|20pxpx]]
14510 [[File:Foobar.jpg|200x20pxpx]]
14511 !! html/php
14512 <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>
14513 <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>
14514 </p>
14515 !! html/parsoid
14516 <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>
14517 !! end
14518
14519 !! test
14520 Image with link parameter, wiki target
14521 !! wikitext
14522 [[File:Foobar.jpg|link=Main Page]]
14523 !! html/php
14524 <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>
14525 </p>
14526 !! html/parsoid
14527 <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>
14528 !! end
14529
14530 # parsoid T51293 (part 1)
14531 !! test
14532 Image with link parameter, URL target
14533 !! wikitext
14534 [[File:Foobar.jpg|link=http://example.com/]]
14535 !! html/php
14536 <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>
14537 </p>
14538 !! html/parsoid
14539 <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>
14540 !! end
14541
14542 # parsoid T51293 (part 2)
14543 !! test
14544 Image with link parameter, protocol-less URL target
14545 !! wikitext
14546 [[File:Foobar.jpg|link=//example.com/]]
14547 !! html/php
14548 <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>
14549 </p>
14550 !! html/parsoid
14551 <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>
14552 !! end
14553
14554 !! test
14555 Escaping non-block captions (T107435)
14556 !! options
14557 parsoid={
14558 "modes": ["wt2wt"],
14559 "changes": [
14560 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14561 ]
14562 }
14563 !! wikitext
14564 [[Image:Foobar.jpg|caption]]
14565 !! wikitext/edited
14566 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14567 !! end
14568
14569 # wgExternalLinkTarget not supported by Parsoid
14570 !! test
14571 Image with link parameter, wgExternalLinkTarget
14572 !! wikitext
14573 [[Image:foobar.jpg|link=http://example.com/]]
14574 !! config
14575 wgExternalLinkTarget='foobar'
14576 !! html/php
14577 <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>
14578 </p>
14579 !! end
14580
14581 !! test
14582 Image with link parameter, wgNoFollowLinks set to false
14583 !! wikitext
14584 [[Image:foobar.jpg|link=http://example.com/]]
14585 !! config
14586 wgNoFollowLinks=false
14587 !! html/php
14588 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14589 </p>
14590 !! end
14591
14592 !! test
14593 Image with link parameter, wgNoFollowDomainExceptions
14594 !! wikitext
14595 [[Image:foobar.jpg|link=http://example.com/]]
14596 !! config
14597 wgNoFollowDomainExceptions='example.com'
14598 !! html/php
14599 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14600 </p>
14601 !! end
14602
14603 # wgExternalLinkTarget not supported by Parsoid
14604 !! test
14605 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14606 !! wikitext
14607 [[Image:foobar.jpg|link=http://example.com/|Title]]
14608 !! config
14609 wgExternalLinkTarget='foobar'
14610 !! html/php
14611 <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>
14612 </p>
14613 !! end
14614
14615 !! test
14616 Image with empty link parameter
14617 !! wikitext
14618 [[File:Foobar.jpg|link=]]
14619 !! html/php
14620 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14621 </p>
14622 !! html/parsoid
14623 <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>
14624 !! end
14625
14626 !! test
14627 Image with link parameter (wiki target) and unnamed parameter
14628 !! wikitext
14629 [[File:Foobar.jpg|link=Main_Page|Title]]
14630 !! html/php
14631 <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>
14632 </p>
14633 !! html/parsoid
14634 <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>
14635 !! end
14636
14637 !! test
14638 Image with link parameter (URL target) and unnamed parameter
14639 !! wikitext
14640 [[File:Foobar.jpg|link=http://example.com/|Title]]
14641 !! html/php
14642 <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>
14643 </p>
14644 !! html/parsoid
14645 <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>
14646 !! end
14647
14648 !! test
14649 Thumbnail image with link parameter
14650 !! options
14651 thumbsize=220
14652 parsoid=wt2html,wt2wt,html2html
14653 !! wikitext
14654 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14655 !! html/php
14656 <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>
14657
14658 !! html/parsoid
14659 <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>
14660 !! end
14661
14662 !! test
14663 Manually-specified thumbnail image
14664 !! options
14665 thumbsize=220
14666 !! wikitext
14667 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14668 !! html/php
14669 <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>
14670
14671 !! html/parsoid
14672 <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>
14673 !! end
14674
14675 !! test
14676 Manually-specified thumbnail image with explicit link to wiki page
14677 !! options
14678 thumbsize=220
14679 parsoid=wt2html,wt2wt,html2html
14680 !! wikitext
14681 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14682 !! html/php
14683 <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>
14684
14685 !! html/parsoid
14686 <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>
14687 !! end
14688
14689 !! test
14690 Manually-specified thumbnail image with explicit link to url
14691 !! options
14692 thumbsize=220
14693 parsoid=wt2html,wt2wt,html2html
14694 !! wikitext
14695 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14696 !! html/php
14697 <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>
14698
14699 !! html/parsoid
14700 <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>
14701 !! end
14702
14703 !! test
14704 Manually-specified thumbnail image with explicit no link
14705 !! options
14706 thumbsize=220
14707 parsoid=wt2html,wt2wt,html2html
14708 !! wikitext
14709 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14710 !! html/php
14711 <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>
14712
14713 !! html/parsoid
14714 <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>
14715 !! end
14716
14717 !! test
14718 Manually-specified thumbnail image with explicit link and alt text
14719 !! options
14720 thumbsize=220
14721 parsoid=wt2html,wt2wt,html2html
14722 !! wikitext
14723 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14724 !! html/php
14725 <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>
14726
14727 !! html/parsoid
14728 <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>
14729 !! end
14730
14731 !! test
14732 Image with frame and link
14733 !! options
14734 parsoid=wt2html,wt2wt,html2html
14735 !! wikitext
14736 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14737 !! html/php
14738 <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>
14739
14740 !! html/parsoid
14741 <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>
14742 !! end
14743
14744 !! test
14745 Image with frame and link and explicit alt
14746 !! options
14747 parsoid=wt2html,wt2wt,html2html
14748 !! wikitext
14749 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14750 !! html/php
14751 <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>
14752
14753 !! html/parsoid
14754 <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>
14755 !! end
14756
14757 !! test
14758 Image with wiki markup in implicit alt
14759 !! wikitext
14760 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14761
14762 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14763 !! html/php
14764 <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>
14765 </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>
14766 </p>
14767 !! html/parsoid
14768 <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>
14769
14770 <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>
14771 !! end
14772
14773 !! test
14774 Alt image option should handle most kinds of wikitext without barfing
14775 !! wikitext
14776 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14777 !! html/php
14778 <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>
14779
14780 !! html/parsoid
14781 <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>
14782 !! end
14783
14784 !! test
14785 Image with table with attributes in caption
14786 !! options
14787 parsoid=wt2html,html2html
14788 !! wikitext
14789 [[File:Foobar.jpg|thumb|
14790 {| class="123" |
14791 |- class="456" |
14792 | ha
14793 |}
14794 ]]
14795 !! html/parsoid
14796 <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>
14797 <table class="123">
14798 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
14799 <td> ha</td></tr>
14800 </tbody></table>
14801 </figcaption></figure>
14802 !! end
14803
14804 !! test
14805 Image with table with rows from templates in caption
14806 !! wikitext
14807 [[File:Foobar.jpg|thumb|
14808 {|
14809 {{echo|{{!}} hi}}
14810 |}
14811 ]]
14812 !! html/parsoid
14813 <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>
14814 <table>
14815 <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>
14816 </tbody></table>
14817 </figcaption></figure>
14818 !! end
14819
14820 !! test
14821 Image with nested tables in caption
14822 !! wikitext
14823 [[File:Foobar.jpg|thumb|Foo<br />
14824 {|
14825 |
14826 {|
14827 |z
14828 |}
14829 |}
14830 ]]
14831 !! html/parsoid
14832 <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}'/>
14833 <table>
14834 <tbody><tr><td>
14835 <table>
14836 <tbody><tr><td>z</td></tr>
14837 </tbody></table></td></tr>
14838 </tbody></table>
14839 </figcaption></figure>
14840 !! end
14841
14842 !! test
14843 Image with heading and horizontal rule in caption
14844 !! wikitext
14845 [[File:Foobar.jpg|thumb|
14846 ===Testing===
14847 123
14848 --------------
14849 ]]
14850 !! html/php
14851 <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>
14852
14853 !! html/parsoid
14854 <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>
14855 <h3 id="Testing">Testing</h3>
14856 123
14857 <hr data-parsoid='{"extra_dashes":10}'/>
14858 </figcaption></figure>
14859 !! end
14860
14861 ###################
14862 # Conflicting image format options.
14863 # First option specified should 'win'.
14864 # All three cases in each test should be identical.
14865
14866 !! test
14867 Image with 'frameless' first.
14868 !! options
14869 parsoid=wt2html,wt2wt,html2html
14870 !! wikitext
14871 [[File:Foobar.jpg|frameless|caption]]
14872
14873 [[File:Foobar.jpg|frameless|frame|caption]]
14874
14875 [[File:Foobar.jpg|frameless|thumb|caption]]
14876 !! html/php
14877 <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>
14878 </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>
14879 </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>
14880 </p>
14881 !! html/parsoid
14882 <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>
14883 <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>
14884 <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>
14885 !! end
14886
14887 !! test
14888 Image with 'frame' first.
14889 !! options
14890 parsoid=wt2html,wt2wt,html2html
14891 !! wikitext
14892 [[File:Foobar.jpg|frame|caption]]
14893 [[File:Foobar.jpg|frame|frameless|caption]]
14894 [[File:Foobar.jpg|frame|thumb|caption]]
14895 !! html/php
14896 <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>
14897 <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>
14898 <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>
14899
14900 !! html/parsoid
14901 <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>
14902 <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>
14903 <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>
14904 !! end
14905
14906 !! test
14907 Image with 'thumb' first.
14908 !! options
14909 parsoid=wt2html,wt2wt,html2html
14910 !! wikitext
14911 [[File:Foobar.jpg|thumb|caption]]
14912 [[File:Foobar.jpg|thumb|frameless|caption]]
14913 [[File:Foobar.jpg|thumb|frame|caption]]
14914 !! html/php
14915 <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>
14916 <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>
14917 <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>
14918
14919 !! html/parsoid
14920 <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>
14921 <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>
14922 <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>
14923 !! end
14924
14925 ###################
14926 # Image sizing.
14927 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14928 # and https://phabricator.wikimedia.org/T64258
14929 # Foobar has actual size of 1941x220
14930 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14931 # a scalable format.
14932 # 2. Framed images always ignore size options; always render at default size.
14933 # 3. "Unspecified format" and border are the only types which can be
14934 # enlarged.
14935
14936 !! test
14937 Image: unspecified format and border enlarge
14938 !! options
14939 parsoid=wt2html,wt2wt,html2html
14940 !! wikitext
14941 [[File:Foobar.jpg|2000px]]
14942
14943 [[File:Foobar.jpg|border|2000px]]
14944 !! html/php
14945 <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>
14946 </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>
14947 </p>
14948 !! html/parsoid
14949 <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>
14950 <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>
14951 !! end
14952
14953 !! test
14954 Image: "unspecified format" and border reduce
14955 !! options
14956 parsoid=wt2html,wt2wt,html2html
14957 !! wikitext
14958 [[File:Foobar.jpg|1000px]]
14959
14960 [[File:Foobar.jpg|border|1000px]]
14961 !! html/php
14962 <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>
14963 </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>
14964 </p>
14965 !! html/parsoid
14966 <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>
14967 <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>
14968 !! end
14969
14970 !! test
14971 Image: thumbs reduce
14972 !! options
14973 parsoid=wt2html,wt2wt,html2html
14974 !! wikitext
14975 [[File:Foobar.jpg|thumb|50px]]
14976 !! html/php
14977 <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>
14978
14979 !! html/parsoid
14980 <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>
14981 !! end
14982
14983 !! test
14984 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14985 !! options
14986 parsoid=wt2html,wt2wt,html2html
14987 !! wikitext
14988 [[File:Foobar.jpg|thumb|2000px]]
14989
14990 [[File:Foobar.svg|thumb|2000px]]
14991 !! html/php
14992 <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>
14993 <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>
14994
14995 !! html/parsoid
14996 <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>
14997 <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>
14998 !! end
14999
15000 !! test
15001 Image: frameless can reduce in size
15002 !! options
15003 parsoid=wt2html,wt2wt,html2html
15004 !! wikitext
15005 [[File:Foobar.jpg|frameless|50px]]
15006 !! html/php
15007 <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>
15008 </p>
15009 !! html/parsoid
15010 <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>
15011 !! end
15012
15013 !! test
15014 Image: bitmap frameless can't be enlarged past original size, but vector can
15015 !! options
15016 parsoid=wt2html,wt2wt,html2html
15017 !! wikitext
15018 [[File:Foobar.jpg|frameless|2000px]]
15019
15020 [[File:Foobar.svg|frameless|2000px]]
15021 !! html/php
15022 <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>
15023 </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>
15024 </p>
15025 !! html/parsoid
15026 <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>
15027 <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>
15028 !! end
15029
15030 !! test
15031 Image: framed images are always unscaled.
15032 !! options
15033 parsoid=wt2html,wt2wt,html2html
15034 !! wikitext
15035 [[File:Foobar.jpg|frame]]
15036
15037 [[File:Foobar.jpg|frame|50px]]
15038
15039 [[File:Foobar.jpg|frame|50x50px]]
15040
15041 [[File:Foobar.jpg|frame|2000px]]
15042 !! html/php
15043 <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>
15044 <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>
15045 <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>
15046 <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>
15047
15048 !! html/parsoid
15049 <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>
15050 <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>
15051 <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>
15052 <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>
15053 !! end
15054
15055 ###################
15056
15057 !! test
15058 Link to image page- image page normally doesn't exists, hence edit link
15059 Add test with existing image page
15060 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
15061 !! wikitext
15062 [[:Image:test]]
15063 !! html
15064 <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>
15065 </p>
15066 !! end
15067
15068 !! test
15069 T20784 Link to non-existent image page with caption should use caption as link text
15070 !! wikitext
15071 [[:Image:test|caption]]
15072 !! html
15073 <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>
15074 </p>
15075 !! end
15076
15077 !! test
15078 Frameless image caption with a free URL
15079 !! wikitext
15080 [[File:Foobar.jpg|http://example.com]]
15081 !! html/php
15082 <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>
15083 </p>
15084 !! html/parsoid
15085 <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>
15086 !! end
15087
15088 !! test
15089 Thumbnail image caption with a free URL
15090 !! options
15091 thumbsize=220
15092 !! wikitext
15093 [[File:Foobar.jpg|thumb|http://example.com]]
15094 !! html/php
15095 <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>
15096
15097 !! html/parsoid
15098 <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>
15099 !! end
15100
15101 !! test
15102 Thumbnail image caption with a free URL and explicit alt
15103 !! options
15104 thumbsize=220
15105 parsoid=wt2html,wt2wt,html2html
15106 !! wikitext
15107 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15108 !! html/php
15109 <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>
15110
15111 !! html/parsoid
15112 <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>
15113 !! end
15114
15115 !! test
15116 SVG thumbnails with no language set
15117 !! options
15118 !! wikitext
15119 [[File:Foobar.svg|thumb|caption]]
15120 !! html/php
15121 <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>
15122
15123 !! html/parsoid
15124 <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>
15125 !! end
15126
15127 !! test
15128 SVG thumbnails with language de
15129 !! options
15130 parsoid=wt2html,wt2wt,html2html
15131 !! wikitext
15132 [[File:Foobar.svg|thumb|caption|lang=de]]
15133 !! html/php
15134 <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>
15135
15136 !! html/parsoid
15137 <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>
15138 !! end
15139
15140 !! test
15141 SVG thumbnails with invalid language code
15142 !! options
15143 parsoid=wt2html,wt2wt,html2html
15144 !! wikitext
15145 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15146 !! html/php
15147 <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>
15148
15149 !! html/parsoid
15150 <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>
15151 !! end
15152
15153 !! test
15154 T3887: A ISBN with a thumbnail
15155 !! wikitext
15156 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15157 !! html/php
15158 <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>
15159
15160 !! html/parsoid
15161 <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>
15162 !! end
15163
15164 !! test
15165 T3887: A RFC with a thumbnail
15166 !! wikitext
15167 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15168 !! html/php
15169 <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>
15170
15171 !! html/parsoid
15172 <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>
15173 !! end
15174
15175 !! test
15176 T3887: A mailto link with a thumbnail
15177 !! wikitext
15178 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15179 !! html/php
15180 <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>
15181
15182 !! html/parsoid
15183 <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>
15184 !! end
15185
15186 # Pending resolution to T2368
15187 !! test
15188 T2648: Frameless image caption with a link
15189 !! wikitext
15190 [[File:Foobar.jpg|text with a [[link]] in it]]
15191 !! html/php
15192 <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>
15193 </p>
15194 !! html/parsoid
15195 <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>
15196 !! end
15197
15198 !! test
15199 T2648: Frameless image caption with a link (suffix)
15200 !! wikitext
15201 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15202 !! html/php
15203 <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>
15204 </p>
15205 !! html/parsoid
15206 <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>
15207 !! end
15208
15209 !! test
15210 T2648: Frameless image caption with an interwiki link
15211 !! wikitext
15212 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15213 !! html/php
15214 <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>
15215 </p>
15216 !! html/parsoid
15217 <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>
15218 !! end
15219
15220 !! test
15221 T2648: Frameless image caption with a piped interwiki link
15222 !! wikitext
15223 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15224 !! html/php
15225 <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>
15226 </p>
15227 !! html/parsoid
15228 <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>
15229 !! end
15230
15231 !! test
15232 T107474: Frameless image caption with <nowiki>
15233 !! wikitext
15234 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15235 !! html/parsoid
15236 <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>
15237 !! end
15238
15239 !! test
15240 Escape HTML special chars in image alt text
15241 !! wikitext
15242 [[File:Foobar.jpg|& < > "]]
15243 !! html/php
15244 <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>
15245 </p>
15246 !! html/parsoid
15247 <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>
15248 !! end
15249
15250 !! test
15251 Escape HTML special chars in image alt text with LanguageConverter
15252 !! options
15253 language=zh
15254 !! wikitext
15255 [[File:Foobar.jpg|& < > "]]
15256 !! html/php
15257 <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>
15258 </p>
15259 !! html/parsoid
15260 <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>
15261 !! end
15262
15263 !! test
15264 Entities in file name and attributes
15265 !! wikitext
15266 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15267 !! html/php
15268 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15269 </p>
15270 !! html/parsoid
15271 <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>
15272 !! end
15273
15274 !! test
15275 T2499: Alt text should have &#1234;, not &amp;1234;
15276 !! wikitext
15277 [[File:Foobar.jpg|&#9792;]]
15278 !! html/php
15279 <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>
15280 </p>
15281 !! html/parsoid
15282 <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>
15283 !! end
15284
15285 !! test
15286 Broken image caption with link
15287 !! options
15288 parsoid=wt2html,wt2wt,html2html
15289 !! wikitext
15290 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15291 !! html/php
15292 <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.
15293 </p>
15294 !! html/parsoid
15295 <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>
15296 !! end
15297
15298 !! test
15299 Image caption containing another image
15300 !! wikitext
15301 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15302 !! html/php
15303 <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>
15304
15305 !! html/parsoid
15306 <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>
15307 !! end
15308
15309 !! test
15310 Image: caption containing a newline
15311 !! wikitext
15312 [[File:Foobar.jpg|This
15313 *is some text]]
15314 !! html/php
15315 <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>
15316 </p>
15317 !! html/parsoid
15318 <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>
15319 !!end
15320
15321 !!test
15322 Image: caption containing leading space
15323 (The leading space should not trigger nowiki escaping in wt2wt mode)
15324 !! wikitext
15325 [[File:Foobar.jpg|thumb| bar]]
15326 !! html/php
15327 <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>
15328
15329 !! html/parsoid
15330 <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>
15331 !!end
15332
15333 # html/php output not have newlines after table, td, th, etc. because
15334 # Linker::makeThumbLink2() replaces the newlines with spaces since
15335 # the table is inside a caption.
15336 # FIXME: Verify if that circa 2004 fix is still required.
15337 !! test
15338 Image: caption containing a table
15339 !! options
15340 parsoid=wt2html,wt2wt,html2html
15341 !! wikitext
15342 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15343 {|
15344 !Foo!!Bar
15345 |-
15346 |Foo1||Bar1
15347 |}
15348 and some more text.]]
15349 !! html/php
15350 <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>
15351
15352 !! html/parsoid
15353 <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
15354 <table>
15355 <tbody>
15356 <tr><th>Foo</th><th>Bar</th></tr>
15357 <tr>
15358 <td>Foo1</td>
15359 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15360 !! end
15361
15362 !! test
15363 T5090: External links other than http: in image captions
15364 !! wikitext
15365 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15366 !! html/php
15367 <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>
15368
15369 !! html/parsoid
15370 <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>
15371 !! end
15372
15373 !! test
15374 Custom class
15375 !! options
15376 parsoid=wt2html,wt2wt,html2html
15377 !! wikitext
15378 [[Image:foobar.jpg|a|class=b]]
15379 !! html/php
15380 <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>
15381 </p>
15382 !! html/parsoid
15383 <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>
15384 !! end
15385
15386 !! test
15387 Localized image handling (1).
15388 !! options
15389 parsoid=wt2html,wt2wt,html2html
15390 language=es
15391 !! wikitext
15392 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15393 !! html/php
15394 <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>
15395
15396 !! html/parsoid
15397 <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>
15398 !! end
15399
15400 !! test
15401 Localized image handling (2).
15402 !! options
15403 thumbsize=220
15404 parsoid=wt2html,wt2wt,html2html
15405 language=es
15406 !! wikitext
15407 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15408 !! html/php
15409 <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>
15410
15411 !! html/parsoid
15412 <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>
15413 !! end
15414
15415 !! test
15416 Localized image handling (3).
15417 !! options
15418 language=fa
15419 parsoid=html2wt
15420 !! html/parsoid
15421 <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>
15422 !! wikitext
15423 [[File:Foobar.jpg|بندانگشتی]]
15424 !! end
15425
15426 !! test
15427 "border", "frameless" and "class" attributes on an image.
15428 !! options
15429 thumbsize=220
15430 parsoid=wt2html,wt2wt,html2html
15431 !! wikitext
15432 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15433 !! html/php
15434 <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>
15435 </p>
15436 !! html/parsoid
15437 <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>
15438 !! end
15439
15440 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15441 !! test
15442 Invalid image attributes (T64500)
15443 !! options
15444 thumbsize=220
15445 parsoid=wt2html,wt2wt,html2html
15446 !! wikitext
15447 [[File:Foobar.jpg|thumb|float|left|caption]]
15448
15449 [[File:Foobar.jpg|thumb|righ|caption]]
15450
15451 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15452 !! html/php
15453 <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>
15454 <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>
15455 <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>
15456
15457 !! html/parsoid
15458 <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>
15459 <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>
15460 <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>
15461 !! end
15462
15463 !! article
15464 File:Barfoo.jpg
15465 !! text
15466 #REDIRECT [[File:Barfoo.jpg]]
15467 !! endarticle
15468
15469 # FIXME: Parsoid should run this test -- but we'd need to teach the
15470 # mockAPI about the redirected Barfoo.jpg image.
15471 !! test
15472 Redirected image
15473 !! wikitext
15474 [[Image:Barfoo.jpg]]
15475 !! html/php
15476 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15477 </p>
15478 !! end
15479
15480 !! test
15481 Missing image with uploads disabled
15482 !! options
15483 wgEnableUploads=0
15484 !! wikitext
15485 [[File:Foobaz.jpg]]
15486 !! html/php
15487 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15488 </p>
15489 !! html/parsoid
15490 <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>
15491 !! end
15492
15493 # Parsoid-specific testing for images
15494 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15495 # Currently imperfect due to a flaw in the Parsoid testrunner
15496 # Work in progress
15497 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15498 # image tests.
15499
15500 !! test
15501 Parsoid-specific image handling - simple image with size and middle alignment
15502 !! wikitext
15503 [[File:Foobar.jpg|middle|50px]]
15504 !! html/parsoid
15505 <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>
15506 !! end
15507
15508 !! test
15509 Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
15510 !! options
15511 parsoid=wt2wt,wt2html,html2html
15512 !! wikitext
15513 [[Image:Foobar.jpg|middle|50px]]
15514 !! html/parsoid
15515 <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>
15516 !! end
15517
15518 !! test
15519 Parsoid-specific image handling - simple image with size and middle alignment (existing content)
15520 !! wikitext
15521 [[File:Foobar.jpg|50px|middle]]
15522 !! html/parsoid
15523 <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>
15524 !! end
15525
15526 !! test
15527 Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
15528 !! options
15529 parsoid=wt2html,wt2wt,html2html
15530 !! wikitext
15531 [[Image:Foobar.jpg|50px|middle]]
15532 !! html/parsoid
15533 <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>
15534 !! end
15535
15536 !! test
15537 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15538 !! wikitext
15539 [[File:Foobar.jpg|500x10px|baseline|caption]]
15540 !! html/parsoid
15541 <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>
15542 !! end
15543
15544 !! test
15545 Parsoid-specific image handling - simple image with border and size spec
15546 !! wikitext
15547 [[File:Foobar.jpg|50px|border|caption]]
15548 !! html/parsoid
15549 <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>
15550 !! end
15551
15552 !! test
15553 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15554 !! options
15555 parsoid=wt2html,html2html
15556 !! wikitext
15557 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15558 !! html/parsoid
15559 <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>
15560 !! end
15561
15562 !! test
15563 Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
15564 !! options
15565 parsoid=wt2html,html2html
15566 !! wikitext
15567 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15568 !! html/parsoid
15569 <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>
15570 !! end
15571
15572 !! test
15573 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15574 !! options
15575 parsoid=wt2html,html2html
15576 !! wikitext
15577 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15578 !! html/parsoid
15579 <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>
15580 !! end
15581
15582 !! test
15583 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
15584 !! options
15585 parsoid=wt2html,html2html
15586 !! wikitext
15587 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15588 !! html/parsoid
15589 <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>
15590 !! end
15591
15592 !! test
15593 Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
15594 !! options
15595 parsoid=wt2html,wt2wt,html2html
15596 !! wikitext
15597 [[File:Foobar.jpg|frame|500x50px|caption]]
15598 !! html/parsoid
15599 <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>
15600 !! end
15601
15602 !! test
15603 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
15604 !! options
15605 parsoid=wt2html,html2html
15606 !! wikitext
15607 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15608 !! html/parsoid
15609 <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>
15610 !! end
15611
15612 !! test
15613 Parsoid-specific image handling - frameless image with specific size, border, and caption
15614 !! wikitext
15615 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15616 !! html/parsoid
15617 <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>
15618 !! end
15619
15620 !! test
15621 Parsoid-specific image handling - simple image with a formatted caption
15622 !! wikitext
15623 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15624 !! html/parsoid
15625 <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>
15626 !! end
15627
15628 !! test
15629 Parsoid-specific image handling - caption with a template in it
15630 !! wikitext
15631 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15632 !! html/parsoid
15633 <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>
15634 !! end
15635
15636 !! test
15637 Parsoid-specific image handling - caption with unbalanced tags in it
15638 !! options
15639 parsoid=wt2html,wt2wt,html2html
15640 !! wikitext
15641 foo
15642 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15643 bar
15644 !! html/parsoid
15645 <p>foo</p>
15646 <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>
15647 <p>bar</p>
15648 !! end
15649
15650 !! test
15651 Parsoid-specific image handling - empty caption (1)
15652 !! options
15653 parsoid=wt2html,wt2wt
15654 !! wikitext
15655 [[File:Foobar.jpg|thumb|]]
15656 !! html/parsoid
15657 <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>
15658 !! end
15659
15660 # empty captions don't get serialized unless we're in the "round trip" case
15661 !! test
15662 Parsoid-specific image handling - empty caption (2)
15663 !! options
15664 parsoid=html2wt
15665 !! html/parsoid
15666 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15667 <a href="./File:Foobar.jpg">
15668 <img resource="./File:Foobar.jpg"
15669 src="//example.com/images/3/3a/Foobar.jpg"
15670 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15671 height="25" width="220"/>
15672 </a>
15673 <figcaption></figcaption>
15674 </figure>
15675 !! wikitext
15676 [[File:Foobar.jpg|thumb]]
15677 !! end
15678
15679 !! test
15680 Parsoid-specific image handling - whitespace caption
15681 !! wikitext
15682 [[File:Foobar.jpg|thumb| ]]
15683 !! html/parsoid
15684 <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>
15685 !! end
15686
15687 !! test
15688 Parsoid-specific image handling - lang option
15689 !! wikitext
15690 foo
15691 [[File:Foobar.svg|lang=de|caption]]
15692 bar
15693 !! html/parsoid
15694 <p>foo
15695 <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>
15696 bar</p>
15697 !! end
15698
15699 ## Edge case bugs in Parsoid from T93580
15700 !! test
15701 T93580: 1. Templated <ref> inside block images
15702 !! wikitext
15703 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15704
15705 <references />
15706 !! html/parsoid
15707 <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>
15708
15709 <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>
15710 !! end
15711
15712 !! test
15713 T93580: 2. <ref> inside inline images
15714 !! wikitext
15715 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15716
15717 <references />
15718 !! html/parsoid
15719 <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>
15720
15721 <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>
15722 !! end
15723
15724 !! test
15725 T93580: 3. Templated <ref> inside inline images
15726 !! wikitext
15727 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15728
15729 <references />
15730 !! html/parsoid
15731 <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>
15732
15733 <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>
15734 !! end
15735
15736 ###
15737 ### Subpages
15738 ###
15739 !! article
15740 Subpage test/subpage
15741 !! text
15742 foo
15743 !! endarticle
15744
15745 !! test
15746 Subpage link
15747 !! options
15748 subpage title=[[Subpage test]]
15749 !! wikitext
15750 [[/subpage]]
15751 !! html
15752 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15753 </p>
15754 !! end
15755
15756 !! test
15757 Subpage noslash link
15758 !! options
15759 subpage title=[[Subpage test]]
15760 !! wikitext
15761 [[/subpage/]]
15762 !! html
15763 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15764 </p>
15765 !! end
15766
15767 !! article
15768 Subpage test/1/2/subpage
15769 !! text
15770 blah
15771 !! endarticle
15772
15773 !! test
15774 Relative subpage noslash link
15775 !! options
15776 parsoid=wt2wt,wt2html,html2html
15777 subpage title=[[Subpage test/1/2/3/4]]
15778 !! wikitext
15779 [[../../subpage/]]
15780
15781 [[../../subpage]]
15782 !! html/php
15783 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15784 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15785 </p>
15786 !! html/parsoid
15787 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15788 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15789 !! end
15790
15791 !! test
15792 Parsoid: dot-slash prefixed wikilinks
15793 !! wikitext
15794 [[./foo]]
15795
15796 [[././bar]]
15797
15798 [[././baz/]]
15799 !! html/php
15800 <p>[[./foo]]
15801 </p><p>[[././bar]]
15802 </p><p>[[././baz/]]
15803 </p>
15804 !! html/parsoid
15805 <p>[[./foo]]
15806 </p><p>[[././bar]]
15807 </p><p>[[././baz/]]
15808 </p>
15809 !! end
15810
15811 !! test
15812 Render invalid page names as plain text (T53090)
15813 !! wikitext
15814 [[./../foo|bar]]
15815 [[foo�|bar]]
15816 [[foo/.|bar]]
15817 [[foo/..|bar]]
15818 [[foo~~~bar]]
15819 [[foo>bar]]
15820 [[foo[bar]]
15821 [[.]]
15822 [[..]]
15823 [[foo././bar]]
15824 [[foo[http://example.com]xyz]]
15825
15826 [[{{echo|./../foo}}|bar]]
15827 [[{{echo|foo/.}}|bar]]
15828 [[{{echo|foo/..}}|bar]]
15829 [[{{echo|foo~~~~bar}}]]
15830 [[{{echo|foo>bar}}]]
15831 [[{{echo|foo././bar}}]]
15832 [[{{echo|foo{bar}}]]
15833 [[{{echo|foo}bar}}]]
15834 [[{{echo|foo[bar}}]]
15835 [[{{echo|foo]bar}}]]
15836 [[{{echo|foo<bar}}]]
15837 !!html/php
15838 <p>[[./../foo|bar]]
15839 [[foo�|bar]]
15840 [[foo/.|bar]]
15841 [[foo/..|bar]]
15842 [[foo~~~bar]]
15843 [[foo&gt;bar]]
15844 [[foo[bar]]
15845 [[.]]
15846 [[..]]
15847 [[foo././bar]]
15848 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15849 </p><p>[[./../foo|bar]]
15850 [[foo/.|bar]]
15851 [[foo/..|bar]]
15852 [[foo~~~~bar]]
15853 [[foo&gt;bar]]
15854 [[foo././bar]]
15855 [[foo{bar]]
15856 [[foo}bar]]
15857 [[foo[bar]]
15858 [[foo]bar]]
15859 [[foo&lt;bar]]
15860 </p>
15861 !!html/parsoid
15862 <p>[[./../foo|bar]]
15863 [[foo�|bar]]
15864 [[foo/.|bar]]
15865 [[foo/..|bar]]
15866 [[foo~~~bar]]
15867 [[foo>bar]]
15868 [[foo[bar]]
15869 [[.]]
15870 [[..]]
15871 [[foo././bar]]
15872 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
15873
15874 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15875 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15876 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15877 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15878 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15879 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15880 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15881 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15882 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15883 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15884 [[<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>
15885 !!end
15886
15887 !! test
15888 Disabled subpages
15889 !! wikitext
15890 [[/subpage]]
15891 !! html
15892 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15893 </p>
15894 !! end
15895
15896 !! test
15897 T2561: {{/Subpage}}
15898 !! options
15899 subpage title=[[Page]]
15900 !! wikitext
15901 {{/Subpage}}
15902 !! html
15903 <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>
15904 </p>
15905 !! end
15906
15907 ###
15908 ### Categories
15909 ###
15910 !! article
15911 Category:MediaWiki User's Guide
15912 !! text
15913 blah
15914 !! endarticle
15915
15916 !! test
15917 Link to category
15918 !! wikitext
15919 [[:Category:MediaWiki User's Guide]]
15920 !! html
15921 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
15922 </p>
15923 !! end
15924
15925 !! test
15926 Simple category
15927 !! options
15928 cat
15929 !! wikitext
15930 [[Category:MediaWiki User's Guide]]
15931 !! html/php
15932 cat=MediaWiki_User's_Guide sort=
15933 !! html/parsoid
15934 <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"}}'/>
15935 !! end
15936
15937 !! test
15938 PAGESINCATEGORY invalid title fatal (r33546 fix)
15939 !! wikitext
15940 {{PAGESINCATEGORY:<bogus>}}
15941 !! html
15942 <p>0
15943 </p>
15944 !! end
15945
15946 !! test
15947 Category with different sort key
15948 !! options
15949 cat
15950 !! wikitext
15951 [[Category:MediaWiki User's Guide|Foo]]
15952 !! html/php
15953 cat=MediaWiki_User's_Guide sort=Foo
15954 !! html/parsoid
15955 <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"}}'/>
15956 !! end
15957
15958 !! test
15959 Category with identical sort key
15960 !! options
15961 cat
15962 !! wikitext
15963 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15964 !! html/php
15965 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15966 !! html/parsoid
15967 <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"}}'/>
15968 !! end
15969
15970 !! test
15971 Category with empty sort key
15972 !! options
15973 cat
15974 pst
15975 !! wikitext
15976 [[Category:MediaWiki User's Guide|]]
15977 !! html/php
15978 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15979 !! end
15980
15981 !! test
15982 Category with empty sort key and parentheses
15983 !! options
15984 cat
15985 pst
15986 !! wikitext
15987 [[Category:Foo (bar)|]]
15988 !! html/php
15989 [[Category:Foo (bar)|Foo]]
15990 !! end
15991
15992 !! test
15993 Category with link tail
15994 !! options
15995 cat
15996 pst
15997 !! wikitext
15998 123[[Category:Foo]]456
15999 !! html/php
16000 123[[Category:Foo]]456
16001 !! end
16002
16003 !! test
16004 Category with template
16005 !! options
16006 cat
16007 pst
16008 !! wikitext
16009 [[Category:{{echo|Foo}}]]
16010 !! html/php
16011 [[Category:{{echo|Foo}}]]
16012 !! end
16013
16014 !! test
16015 Category with template in sort key
16016 !! options
16017 cat
16018 pst
16019 !! wikitext
16020 [[Category:Foo|{{echo|Bar}}]]
16021 !! html/php
16022 [[Category:Foo|{{echo|Bar}}]]
16023 !! end
16024
16025 !! test
16026 Category with template in sort key and title
16027 !! options
16028 cat
16029 pst
16030 !! wikitext
16031 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16032 !! html/php
16033 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16034 !! end
16035
16036 ## We used to, but no longer wt2wt this test since the default serializer
16037 ## will normalize all categories to serialize on their own line.
16038 ## This wikitext usage is going to be fairly uncommon in production and
16039 ## selser will take care of preserving formatting in those scenarios.
16040 !! test
16041 Category / paragraph interactions
16042 !! options
16043 parsoid=wt2html
16044 !! wikitext
16045 Foo [[Category:Baz]] Bar
16046
16047 Foo [[Category:Baz]]
16048 Bar
16049
16050 Foo
16051 [[Category:Baz]]
16052 Bar
16053
16054 Foo
16055 [[Category:Baz]] Bar
16056
16057 Foo
16058 [[Category:Baz]]
16059 [[Category:Baz]]
16060 [[Category:Baz]]
16061 Bar
16062
16063 [[Category:Baz]]
16064 [[Category:Baz]]
16065 [[Category:Baz]]
16066
16067 [[Category:Baz]]
16068 {{echo|[[Category:Baz]]}}
16069 [[Category:Baz]]
16070 !! html/php
16071 <p>Foo Bar
16072 </p><p>Foo
16073 Bar
16074 </p><p>Foo
16075 Bar
16076 </p><p>Foo Bar
16077 </p><p>Foo
16078 Bar
16079 </p>
16080 !! html/parsoid
16081 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16082 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16083 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16084 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16085 <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>
16086 <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}}]}'/>
16087 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16088 !! end
16089
16090 ## We used to, but no longer wt2wt this test since the default serializer
16091 ## will normalize all categories to serialize on their own line.
16092 ## This wikitext usage is going to be fairly uncommon in production and
16093 ## selser will take care of preserving formatting in those scenarios.
16094 ##
16095 ## The whitespace on the empty line is part of the test. Please do not delete
16096 !! test
16097 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16098 !! options
16099 parsoid=wt2html
16100 !! wikitext
16101 This
16102
16103 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16104
16105 {{echo|[[Category:Foo]] and so should this!}}
16106 !! html/php
16107 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16108 </p>
16109 !! html/parsoid
16110 <p>This
16111
16112 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16113
16114 <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>
16115 !! end
16116
16117 ## Parsoid will not try to wt2wt this while preserving newlines because
16118 ## it suppresses excess newlines within list items -- and we don't want to
16119 ## introduce a special case just for categories, which is, in reality somewhat
16120 ## odd behavior -- categories are unlikely to be used in list items like this
16121 ## in top-level pages and are only likely to show up in template-generated
16122 ## list items where this RT-ing is a non-issue.
16123 ##
16124 ## The whitespace on the empty line is part of the test. Please do not delete
16125 !! test
16126 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16127 !! options
16128 parsoid=wt2html
16129 !! wikitext
16130 * This
16131
16132 [[Category:Foo]] and this should be part of the same list item
16133 * So should this
16134
16135 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16136 !! html
16137 <ul><li>This and this should be part of the same list item</li>
16138 <li>So should this and this should be part of the same list item</li></ul>
16139 !! html/parsoid
16140 <ul>
16141 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16142 <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>
16143 </ul>
16144 !! end
16145
16146 ## Newlines and categories that follow the last item of a list
16147 ## are treated differently because this (list followed by categories)
16148 ## is an extremely common pattern on wikis.
16149 !! test
16150 3. Categories and newlines: newline suppression for last list item should RT properly
16151 !! wikitext
16152 *a
16153 *b
16154
16155 [[Category:Foo]]
16156
16157 [[Category:Bar]]
16158 [[Category:Baz]]
16159
16160 :c
16161
16162 [[Category:C]]
16163
16164 ;d
16165
16166 [[Category:D]]
16167 !! html/parsoid
16168 <ul><li>a</li>
16169 <li>b</li></ul>
16170
16171 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16172
16173 <link rel="mw:PageProp/Category" href="./Category:Bar"/>
16174 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16175
16176 <dl><dd>c</dd></dl>
16177
16178 <link rel="mw:PageProp/Category" href="./Category:C"/>
16179
16180 <dl><dt>d</dt></dl>
16181
16182 <link rel="mw:PageProp/Category" href="./Category:D"/>
16183 !! end
16184
16185 !! test
16186 4. Categories and newlines: newline suppression for last list item should RT properly
16187 !! wikitext
16188 *a
16189 ****b
16190
16191 [[Category:Foo]]
16192 !! html/parsoid
16193 <ul><li>a
16194 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
16195
16196 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16197 !! end
16198
16199 ## only wt2html for this to make sure the algo only applies to the rightmost path
16200 !! test
16201 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16202 !! options
16203 parsoid=wt2html
16204 !! wikitext
16205 *a
16206 **b
16207 [[Category:Foo]]
16208 *c
16209 **d
16210 [[Category:Foo]]
16211 !! html/parsoid
16212 <ul><li>a
16213 <ul><li>b
16214 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16215 <li>c
16216 <ul><li>d</li></ul></li></ul>
16217 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16218 !! end
16219
16220 ## We used to, but no longer wt2wt this test since the default serializer
16221 ## will normalize all categories to serialize on their own line.
16222 ## This wikitext usage is going to be fairly uncommon in production and
16223 ## selser will take care of preserving formatting in those scenarios.
16224 !! test
16225 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16226 !! options
16227 parsoid=wt2html
16228 !! wikitext
16229 *a [[Category:Foo]]
16230 !! html/parsoid
16231 <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>
16232 !! end
16233
16234 # This test also demonstrates because of newline+category tunneling
16235 # through the list hander, template wrapping doesn't expand to the
16236 # containing list when the list item swallows the category.
16237 !! test
16238 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16239 !! wikitext
16240 *{{echo|a
16241 [[Category:Foo]]}}
16242 !! html/parsoid
16243 <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
16244 </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>
16245 !! end
16246
16247 !! test
16248 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16249 !! wikitext
16250 *a
16251
16252 {{echo|[[Category:Foo]]
16253 [[Category:Bar]]}}
16254 [[Category:Baz]]
16255 !! html/parsoid
16256 <ul><li>a</li></ul>
16257
16258 <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">
16259 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16260 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16261 !! end
16262
16263 !! test
16264 Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
16265 !! wikitext
16266 *a
16267
16268 [[Category:Bar]]<!--boo1--> <!--boo2-->
16269 [[Category:Baz]]<!--boo3--> <!--boo4-->
16270 !! html/parsoid
16271 <ul><li>a</li></ul>
16272
16273 <link rel="mw:PageProp/Category" href="./Category:Bar"/><!--boo1--> <!--boo2-->
16274 <link rel="mw:PageProp/Category" href="./Category:Baz"/><!--boo3--> <!--boo4-->
16275 !! end
16276
16277 !! test
16278 Categories and newlines: should behave properly with linkprefix (T87753)
16279 !! options
16280 language=ar
16281 !! wikitext
16282 foo bar
16283 foo bar
16284 [[تصنيف:Foo]]
16285 [[تصنيف:Bar]]
16286 !! html/php
16287 <p>foo bar
16288 foo bar
16289 </p>
16290 !! html/parsoid
16291 <p>foo bar
16292 foo bar</p>
16293 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16294 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16295 !! end
16296
16297 !! test
16298 No regressions on internal links following category (T174639)
16299 !! options
16300 parsoid=wt2html,html2html
16301 !! wikitext
16302 [[Category:Foo]]<div>a
16303
16304 [[Foo]]</div>
16305 !! html/php
16306 <div>a
16307 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16308
16309 !! html/parsoid
16310 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16311
16312 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16313 !! end
16314
16315 # Note that Parsoid differs slightly from PHP due to T175421
16316 !! test
16317 11. Special case where only newlines separate links (T175416)
16318 !! options
16319 parsoid=wt2html,html2html
16320 !! wikitext
16321 [[Category:Foo]]
16322
16323 [[Foo]][[es:Alimento]]
16324
16325 [[Foo]]
16326 !! html/php
16327 <p><br />
16328 <a href="/wiki/Foo" title="Foo">Foo</a>
16329 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16330 </p>
16331 !! html/parsoid
16332 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16333
16334 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16335
16336 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16337 !! end
16338
16339 !! test
16340 Category links with multiple namespaces
16341 !! wikitext
16342 [[Category:Project:Foo]]
16343 !! html/parsoid
16344 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16345 !! end
16346
16347 !! test
16348 Parsoid: Serialize link to category page with colon escape
16349 !! options
16350 parsoid
16351 !! wikitext
16352
16353 [[:Category:Foo]]
16354 [[:Category:Foo|Bar]]
16355 !! html
16356 <p>
16357 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16358 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16359 </p>
16360 !! end
16361
16362 # We used to, but no longer wt2wt this test since the default serializer
16363 # will normalize all categories to serialize on their own line.
16364 # This wikitext usage is going to be fairly uncommon in production and
16365 # selser will take care of preventing whitespace insertion if this
16366 # occurs in an article.
16367 #
16368 # html2html disabled for the same reason (whitespace insertion between
16369 # x and y).
16370 #
16371 # html2wt disabled because it localizes the "Category" namespace.
16372 !! test
16373 Link prefix/suffixes aren't applied to category links
16374 !! options
16375 parsoid=wt2html
16376 language=is
16377 !! wikitext
16378 x[[Category:Foo]]y
16379 !! html/php
16380 <p>xy
16381 </p>
16382 !! html/parsoid
16383 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16384 !! end
16385
16386 !! test
16387 Link prefix/suffixes aren't applied to language links
16388 !! options
16389 parsoid=wt2html
16390 language=is
16391 !! wikitext
16392 x[[es:Foo]]y
16393 !! html/php
16394 <p>xy
16395 </p>
16396 !! html/parsoid
16397 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16398 !! end
16399
16400 !! test
16401 Parsoid: Serialize link to file page with colon escape
16402 !! options
16403 parsoid
16404 !! wikitext
16405
16406 [[:File:Foo.png]]
16407 [[:File:Foo.png|Bar]]
16408 !! html
16409 <p>
16410 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16411 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16412 </p>
16413 !! end
16414
16415 !! test
16416 Parsoid: Serialize a genuine category link without colon escape
16417 !! options
16418 parsoid
16419 !! wikitext
16420 [[Category:Foo]]
16421 [[Category:Foo|Bar]]
16422 !! html
16423 <link rel="mw:PageProp/Category" href="./Category:Foo">
16424 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16425 !! end
16426
16427 !! test
16428 Normalize hrefs properly before testing for invalid link targets (T72894)
16429 !! options
16430 parsoid=html2wt
16431 !! html/parsoid
16432 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16433 !! wikitext
16434 [[Category:Toxine bactérienne]]
16435 !! end
16436
16437 !! test
16438 Parsoid: Defaultsort
16439 !! wikitext
16440 {{DEFAULTSORT:Foo}}
16441 !! html/parsoid
16442 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16443 !! end
16444
16445 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16446 # But, this is a limitation of our representation and is documented in
16447 # TemplateHandler.js in processSpecialMagicWord
16448 !! test
16449 Parsoid: Defaultsort (template-generated)
16450 !! wikitext
16451 {{{{echo|DEFAULTSORT}}:Foo}}
16452 !! html/parsoid
16453 <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"}]]}'/>
16454 !! end
16455
16456 ###
16457 ### Inter-language links
16458 ###
16459 !! test
16460 Interlanguage links
16461 !! options
16462 ill
16463 !! wikitext
16464 [[es:Alimento]]
16465 [[fr:Nourriture]]
16466 [[zh:食品]]
16467 !! html/php
16468 es:Alimento fr:Nourriture zh:食品
16469 !! html/parsoid
16470 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16471 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16472 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16473 !! end
16474
16475 !! test
16476 Duplicate interlanguage links (T26502)
16477 !! options
16478 ill
16479 !! wikitext
16480 [[es:1]]
16481 [[es:2]]
16482 [[fr:1]]
16483 [[fr:2]]
16484 !! html/php
16485 es:1 fr:1
16486 !! html/parsoid
16487 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16488 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16489 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16490 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16491 !! end
16492
16493 ###
16494 ### Sections
16495 ###
16496 !! test
16497 Basic section headings
16498 !! wikitext
16499 ==Headline 1==
16500 Some text
16501
16502 ==Headline 2==
16503 More
16504 ===Smaller headline===
16505 Blah blah
16506 !! html
16507 <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>
16508 <p>Some text
16509 </p>
16510 <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>
16511 <p>More
16512 </p>
16513 <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>
16514 <p>Blah blah
16515 </p>
16516 !! end
16517
16518 !! test
16519 Section headings with TOC
16520 !! wikitext
16521 ==Headline 1==
16522 ===Subheadline 1===
16523 =====Skipping a level=====
16524 ======Skipping a level======
16525
16526 ==Headline 2==
16527 Some text
16528 ===Another headline===
16529 !! html
16530 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16531 <ul>
16532 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16533 <ul>
16534 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16535 <ul>
16536 <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>
16537 <ul>
16538 <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>
16539 </ul>
16540 </li>
16541 </ul>
16542 </li>
16543 </ul>
16544 </li>
16545 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16546 <ul>
16547 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16548 </ul>
16549 </li>
16550 </ul>
16551 </div>
16552
16553 <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>
16554 <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>
16555 <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>
16556 <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>
16557 <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>
16558 <p>Some text
16559 </p>
16560 <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>
16561
16562 !! end
16563
16564 !! test
16565 TOC anchors don't collide
16566 !! wikitext
16567 __FORCETOC__
16568 ==Headline 2==
16569 ==Headline==
16570 ==Headline 2==
16571 ==Headline==
16572 !! html/php
16573 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16574 <ul>
16575 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16576 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16577 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16578 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16579 </ul>
16580 </div>
16581
16582 <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>
16583 <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>
16584 <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>
16585 <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>
16586
16587 !! end
16588
16589 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16590 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
16591 !! test
16592 Handling of sections up to level 6 and beyond
16593 !! options
16594 parsoid=wt2html
16595 !! wikitext
16596 =Level 1 Heading=
16597 ==Level 2 Heading==
16598 ===Level 3 Heading===
16599 ====Level 4 Heading====
16600 =====Level 5 Heading=====
16601 ======Level 6 Heading======
16602 =======Level 7 Heading=======
16603 ========Level 8 Heading========
16604 =========Level 9 Heading=========
16605 ==========Level 10 Heading==========
16606 !! html/php
16607 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16608 <ul>
16609 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16610 <ul>
16611 <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>
16612 <ul>
16613 <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>
16614 <ul>
16615 <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>
16616 <ul>
16617 <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>
16618 <ul>
16619 <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>
16620 <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>
16621 <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>
16622 <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>
16623 <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>
16624 </ul>
16625 </li>
16626 </ul>
16627 </li>
16628 </ul>
16629 </li>
16630 </ul>
16631 </li>
16632 </ul>
16633 </li>
16634 </ul>
16635 </div>
16636
16637 <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>
16638 <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>
16639 <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>
16640 <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>
16641 <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>
16642 <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>
16643 <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>
16644 <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>
16645 <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>
16646 <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>
16647
16648 !! html/parsoid
16649 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
16650 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
16651 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
16652 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
16653 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
16654 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
16655 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
16656 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
16657 <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>
16658 <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>
16659 !! end
16660
16661 !! test
16662 TOC regression (T11764)
16663 !! wikitext
16664 ==title 1==
16665 ===title 1.1===
16666 ====title 1.1.1====
16667 ===title 1.2===
16668 ==title 2==
16669 ===title 2.1===
16670 !! html
16671 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16672 <ul>
16673 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16674 <ul>
16675 <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>
16676 <ul>
16677 <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>
16678 </ul>
16679 </li>
16680 <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>
16681 </ul>
16682 </li>
16683 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16684 <ul>
16685 <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>
16686 </ul>
16687 </li>
16688 </ul>
16689 </div>
16690
16691 <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>
16692 <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>
16693 <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>
16694 <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>
16695 <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>
16696 <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>
16697
16698 !! end
16699
16700 !! test
16701 TOC for heading containing <span id="..."></span> (T96153)
16702 !! wikitext
16703 __FORCETOC__
16704 ==<span id="old-anchor"></span>New title==
16705 !! html/php
16706 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16707 <ul>
16708 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16709 </ul>
16710 </div>
16711
16712 <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>
16713
16714 !! end
16715
16716 !! test
16717 TOC with wgMaxTocLevel=3 (T8204)
16718 !! options
16719 wgMaxTocLevel=3
16720 !! wikitext
16721 ==title 1==
16722 ===title 1.1===
16723 ====title 1.1.1====
16724 ===title 1.2===
16725 ==title 2==
16726 ===title 2.1===
16727 !! html
16728 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16729 <ul>
16730 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16731 <ul>
16732 <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>
16733 <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>
16734 </ul>
16735 </li>
16736 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16737 <ul>
16738 <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>
16739 </ul>
16740 </li>
16741 </ul>
16742 </div>
16743
16744 <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>
16745 <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>
16746 <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>
16747 <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>
16748 <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>
16749 <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>
16750
16751 !! end
16752
16753 !! test
16754 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16755 !! options
16756 wgMaxTocLevel=3
16757 !! wikitext
16758 ==Section 1==
16759 ===Section 1.1===
16760 ====Section 1.1.1====
16761 ====Section 1.1.1.1====
16762 ==Section 2==
16763 !! html
16764 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16765 <ul>
16766 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16767 <ul>
16768 <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>
16769 </ul>
16770 </li>
16771 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16772 </ul>
16773 </div>
16774
16775 <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>
16776 <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>
16777 <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>
16778 <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>
16779 <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>
16780
16781 !! end
16782
16783
16784 !! test
16785 Resolving duplicate section names
16786 !! wikitext
16787 ==Foo bar==
16788 ==Foo bar==
16789 !! html
16790 <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>
16791 <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>
16792
16793 !! end
16794
16795 !! test
16796 Resolving duplicate section names with differing case (T12721)
16797 !! wikitext
16798 ==Foo bar==
16799 ==Foo Bar==
16800 !! html
16801 <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>
16802 <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>
16803
16804 !! end
16805
16806 !! article
16807 Template:sections
16808 !! text
16809 ===Section 1===
16810 ==Section 2==
16811 !! endarticle
16812
16813 !! test
16814 Template with sections, __NOTOC__
16815 !! wikitext
16816 __NOTOC__
16817 ==Section 0==
16818 {{sections}}
16819 ==Section 4==
16820 !! html
16821 <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>
16822 <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>
16823 <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>
16824 <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>
16825
16826 !! end
16827
16828 !! test
16829 __NOEDITSECTION__ keyword
16830 !! wikitext
16831 __NOEDITSECTION__
16832 ==Section 1==
16833 ==Section 2==
16834 !! html
16835 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16836 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16837
16838 !! end
16839
16840 !! test
16841 Link inside a section heading
16842 !! wikitext
16843 ==Section with a [[Main Page|link]] in it==
16844 !! html
16845 <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>
16846
16847 !! end
16848
16849 !! test
16850 TOC regression (T14077)
16851 !! wikitext
16852 __TOC__
16853 ==title 1==
16854 ===title 1.1===
16855 ==title 2==
16856 !! html
16857 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16858 <ul>
16859 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16860 <ul>
16861 <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>
16862 </ul>
16863 </li>
16864 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16865 </ul>
16866 </div>
16867
16868 <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>
16869 <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>
16870 <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>
16871
16872 !! end
16873
16874 !! test
16875 T3219 URL next to image (good)
16876 !! wikitext
16877 http://example.com [[File:Foobar.jpg]]
16878 !! html/php
16879 <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>
16880 </p>
16881 !! html/parsoid
16882 <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>
16883 !!end
16884
16885 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
16886 !! test
16887 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16888 !! options
16889 parsoid=wt2html,html2html
16890 !! wikitext
16891 ===
16892 The line above must have a trailing space!
16893 === <!--
16894 --> <!-- -->
16895 But just in case it doesn't...
16896 !! html/php
16897 <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>
16898 <p>The line above must have a trailing space!
16899 </p>
16900 <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>
16901 <p>But just in case it doesn't...
16902 </p>
16903 !! html/parsoid
16904 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
16905 <p>The line above must have a trailing space!</p>
16906 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
16907 --> <!-- -->
16908 <p>But just in case it doesn't...</p>
16909 !! end
16910
16911 !! test
16912 Header with special characters (T27462)
16913 !! wikitext
16914 The tooltips shall not show entities to the user (ie. be double escaped)
16915
16916 ==text > text==
16917 section 1
16918
16919 ==text < text==
16920 section 2
16921
16922 ==text & text==
16923 section 3
16924
16925 ==text ' text==
16926 section 4
16927
16928 ==text " text==
16929 section 5
16930 !! html/php
16931 <p>The tooltips shall not show entities to the user (ie. be double escaped)
16932 </p>
16933 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16934 <ul>
16935 <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>
16936 <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>
16937 <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>
16938 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
16939 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
16940 </ul>
16941 </div>
16942
16943 <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>
16944 <p>section 1
16945 </p>
16946 <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>
16947 <p>section 2
16948 </p>
16949 <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>
16950 <p>section 3
16951 </p>
16952 <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>
16953 <p>section 4
16954 </p>
16955 <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>
16956 <p>section 5
16957 </p>
16958 !! html/parsoid
16959 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
16960
16961 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
16962 <p>section 1</p>
16963
16964 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
16965 <p>section 2</p>
16966
16967 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
16968 <p>section 3</p>
16969
16970 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
16971 <p>section 4</p>
16972
16973 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
16974 <p>section 5</p>
16975 !! end
16976
16977 !! test
16978 Header with space, plus and underscore as entity
16979 !! wikitext
16980 Id should not contain + for spaces
16981
16982 ==Space between Text==
16983 section 1
16984
16985 ==Space-Entity&#32;between&#32;Text==
16986 section 2
16987
16988 ==Plus+between+Text==
16989 section 3
16990
16991 ==Plus-Entity&#43;between&#43;Text==
16992 section 4
16993
16994 ==Underscore_between_Text==
16995 section 5
16996
16997 ==Underscore-Entity&#95;between&#95;Text==
16998 section 6
16999
17000 [[#Space between Text]]
17001 [[#Space-Entity&#32;between&#32;Text]]
17002 [[#Plus+between+Text]]
17003 [[#Plus-Entity&#43;between&#43;Text]]
17004 [[#Underscore_between_Text]]
17005 [[#Underscore-Entity&#95;between&#95;Text]]
17006 !! html/php
17007 <p>Id should not contain + for spaces
17008 </p>
17009 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
17010 <ul>
17011 <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>
17012 <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>
17013 <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>
17014 <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>
17015 <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>
17016 <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>
17017 </ul>
17018 </div>
17019
17020 <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>
17021 <p>section 1
17022 </p>
17023 <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>
17024 <p>section 2
17025 </p>
17026 <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>
17027 <p>section 3
17028 </p>
17029 <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>
17030 <p>section 4
17031 </p>
17032 <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>
17033 <p>section 5
17034 </p>
17035 <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>
17036 <p>section 6
17037 </p><p><a href="#Space_between_Text">#Space between Text</a>
17038 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
17039 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
17040 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
17041 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17042 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17043 </p>
17044 !! html/parsoid
17045 <p>Id should not contain + for spaces</p>
17046
17047 <h2 id="Space_between_Text">Space between Text</h2>
17048 <p>section 1</p>
17049
17050 <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>
17051 <p>section 2</p>
17052
17053 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
17054 <p>section 3</p>
17055
17056 <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>
17057 <p>section 4</p>
17058
17059 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
17060 <p>section 5</p>
17061
17062 <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>
17063 <p>section 6</p>
17064
17065 <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>
17066 <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>
17067 <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>
17068 <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>
17069 <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>
17070 <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>
17071 !! end
17072
17073 # Parsoid html2wt disabled because it adds padding spaces around =
17074 !! test
17075 Headers with excess '=' characters
17076 (Are similar tests necessary beyond the 1st level?)
17077 !! options
17078 parsoid=wt2html,wt2wt,html2html
17079 !! wikitext
17080 =foo==
17081 ==foo=
17082 =''italic'' heading==
17083 ==''italic'' heading=
17084 !! html/php
17085 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
17086 <ul>
17087 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17088 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17089 <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>
17090 <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>
17091 </ul>
17092 </div>
17093
17094 <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>
17095 <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>
17096 <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>
17097 <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>
17098
17099 !! html/parsoid
17100 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
17101 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
17102 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
17103 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
17104 !! end
17105
17106 !! test
17107 HTML headers vs TOC (T25393)
17108 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17109 !! wikitext
17110 <h1>Header 1</h1>
17111 ==Header 1.1==
17112 ==Header 1.2==
17113
17114 <h1>Header 2
17115 </h1>
17116 ==Header 2.1==
17117 ==Header 2.2==
17118 __NOEDITSECTION__
17119 !! html/php
17120 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
17121 <ul>
17122 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17123 <ul>
17124 <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>
17125 <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>
17126 </ul>
17127 </li>
17128 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
17129 <ul>
17130 <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>
17131 <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>
17132 </ul>
17133 </li>
17134 </ul>
17135 </div>
17136
17137 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17138 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17139 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17140 <h1><span class="mw-headline" id="Header_2">Header 2
17141 </span></h1>
17142 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17143 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17144
17145 !! html/parsoid
17146 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17147 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17148 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17149
17150 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17151 </h1>
17152 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17153 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17154 <meta property="mw:PageProp/noeditsection"/>
17155 !! end
17156
17157 !! test
17158 Single-line or multiline-comments can follow headings
17159 !! options
17160 parsoid=wt2html,wt2wt
17161 !! wikitext
17162 ==foo==<!---->
17163 ==bar==<!--c1-->
17164 ==baz==<!--
17165 c2
17166 c3-->
17167 !! html/php
17168 <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>
17169 <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>
17170 <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>
17171
17172 !! html/parsoid
17173 <h2 id="foo">foo</h2><!---->
17174 <h2 id="bar">bar</h2><!--c1-->
17175 <h2 id="baz">baz</h2><!--
17176 c2
17177 c3-->
17178 !! end
17179
17180 !! test
17181 T3219 URL next to image (broken)
17182 !! wikitext
17183 http://example.com[[File:Foobar.jpg]]
17184 !! html/php
17185 <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>
17186 </p>
17187 !! html/parsoid
17188 <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>
17189 !!end
17190
17191 !! test
17192 T3186 news: in the middle of text
17193 !! wikitext
17194 http://en.wikinews.org/wiki/Wikinews:Workplace
17195 !! html
17196 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17197 </p>
17198 !!end
17199
17200
17201 !! test
17202 Namespaced link must have a title
17203 !! wikitext
17204 [[Project:]]
17205 !! html
17206 <p>[[Project:]]
17207 </p>
17208 !!end
17209
17210 !! test
17211 Namespaced link must have a title (bad fragment version)
17212 !! wikitext
17213 [[Project:#fragment]]
17214 !! html
17215 <p>[[Project:#fragment]]
17216 </p>
17217 !!end
17218
17219
17220 ###
17221 ### HTML tags and HTML attributes
17222 ###
17223
17224 !! test
17225 div with no attributes
17226 !! wikitext
17227 <div>HTML rocks</div>
17228 !! html
17229 <div>HTML rocks</div>
17230
17231 !! end
17232
17233 !! test
17234 div with double-quoted attribute
17235 !! wikitext
17236 <div id="rock">HTML rocks</div>
17237 !! html
17238 <div id="rock">HTML rocks</div>
17239
17240 !! end
17241
17242 !! test
17243 div with single-quoted attribute
17244 !! wikitext
17245 <div id='rock'>HTML rocks</div>
17246 !! html
17247 <div id="rock">HTML rocks</div>
17248
17249 !! end
17250
17251 !! test
17252 div with unquoted attribute
17253 !! wikitext
17254 <div id=rock>HTML rocks</div>
17255 !! html
17256 <div id="rock">HTML rocks</div>
17257
17258 !! end
17259
17260 !! test
17261 div with illegal double attributes
17262 !! wikitext
17263 <div id="a" id="b">HTML rocks</div>
17264 !! html
17265 <div id="b">HTML rocks</div>
17266
17267 !!end
17268
17269 !! test
17270 div with empty attribute value, space before equals
17271 !! options
17272 parsoid=wt2html,html2html
17273 !! wikitext
17274 <div class =>HTML rocks</div>
17275 !! html/php
17276 <div class="">HTML rocks</div>
17277
17278 !! html/parsoid
17279 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17280 !! end
17281
17282 !! test
17283 div with multiple empty attribute values
17284 !! config
17285 wgFragmentMode=[ 'html5', 'legacy' ]
17286 !! options
17287 parsoid=wt2html,html2html
17288 !! wikitext
17289 <div id= title=>HTML rocks</div>
17290 !! html/php
17291 <div id="title=">HTML rocks</div>
17292
17293 !! html/parsoid
17294 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17295 !! end
17296
17297 # FIXME Parsoid doesn't actually match PHP here.
17298 # Probably we should use the synthetic <foo /> or <indicator>
17299 # extensions for this test, which are enabled when running parser tests.
17300 !! test
17301 Extension tag in attribute value
17302 !! wikitext
17303 <span title="<translate>123</translate>">ok</span>
17304 !! html/php+disabled
17305 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17306 </p>
17307 !! html/parsoid
17308 <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>
17309 !! end
17310
17311 !! test
17312 table with multiple empty attribute values
17313 !! options
17314 parsoid=wt2html,html2html
17315 !! wikitext
17316 {| title= id=
17317 |hi
17318 |}
17319 !! html/php
17320 <table title="id=">
17321 <tr>
17322 <td>hi
17323 </td></tr></table>
17324
17325 !! html/parsoid
17326 <table title="id=">
17327 <tbody><tr><td>hi</td></tr>
17328 </tbody></table>
17329 !! end
17330
17331 !! test
17332 div with braces in attribute value
17333 !! wikitext
17334 <div title="{}">Foo</div>
17335 !! html/php
17336 <div title="&#123;&#125;">Foo</div>
17337
17338 !! html/parsoid
17339 <div title="{}">Foo</div>
17340 !! end
17341
17342 !! test
17343 div with empty attribute value, no space before equals
17344 !! options
17345 parsoid=wt2html,html2html
17346 !! wikitext
17347 <div class=>HTML rocks</div>
17348 !! html/php
17349 <div class="">HTML rocks</div>
17350
17351 !! html/parsoid
17352 <div class="">HTML rocks</div>
17353 !! end
17354
17355 !! test
17356 HTML multiple attributes correction
17357 !! wikitext
17358 <p class="error" class="awesome">Awesome!</p>
17359 !! html
17360 <p class="awesome">Awesome!</p>
17361
17362 !!end
17363
17364 !! test
17365 Table multiple attributes correction
17366 !! wikitext
17367 {|
17368 !+ class="error" class="awesome"|status
17369 |}
17370 !! html
17371 <table>
17372 <tr>
17373 <th class="awesome">status
17374 </th></tr></table>
17375
17376 !!end
17377
17378 !! test
17379 DIV IN UPPERCASE
17380 !! wikitext
17381 <DIV ID="x">HTML ROCKS</DIV>
17382 !! html
17383 <div id="x">HTML ROCKS</div>
17384
17385 !!end
17386
17387 !! test
17388 Non-ASCII pseudo-tags are rendered as text
17389 !! wikitext
17390 <khyô>
17391 !! html
17392 <p>&lt;khyô&gt;
17393 </p>
17394 !! end
17395
17396 !! test
17397 Pseudo-tag with URL 'name' renders as url link
17398 !! wikitext
17399 <http://example.com/>
17400 !! html
17401 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17402 </p>
17403 !! end
17404
17405 !! test
17406 text with amp in the middle of nowhere
17407 !! wikitext
17408 Remember AT&T?
17409 !! html
17410 <p>Remember AT&amp;T?
17411 </p>
17412 !! end
17413
17414 !! test
17415 text with character entity: eacute
17416 !! wikitext
17417 I always thought &eacute; was a cute letter.
17418 !! html+tidy
17419 <p>I always thought &#233; was a cute letter.
17420 </p>
17421 !! end
17422
17423 !! test
17424 text with entity-escaped character entity-like string: eacute
17425 !! wikitext
17426 I always thought &amp;eacute; was a cute letter.
17427 !! html
17428 <p>I always thought &amp;eacute; was a cute letter.
17429 </p>
17430 !! end
17431
17432 !! test
17433 text with undefined character entity: xacute
17434 !! wikitext
17435 I always thought &xacute; was a cute letter.
17436 !! html
17437 <p>I always thought &amp;xacute; was a cute letter.
17438 </p>
17439 !! end
17440
17441 !! test
17442 HTML5 tags
17443 !! wikitext
17444 <data value="5">five</data>
17445 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17446 <mark>This highlighted text</mark>
17447 !! html
17448 <p><data value="5">five</data>
17449 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17450 <mark>This highlighted text</mark>
17451 </p>
17452 !! end
17453
17454 !! test
17455 HTML tag with leading space is parsed as text
17456 !! wikitext
17457 < div>foo< /div>
17458 !! html
17459 <p>&lt; div&gt;foo&lt; /div&gt;
17460 </p>
17461 !! end
17462
17463 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17464 ## the HTML5 parsing spec.
17465 !! test
17466 Element with broken attribute syntax
17467 !! options
17468 parsoid=wt2html
17469 !! wikitext
17470 <div style=" style="123">hi</div>
17471 <div =>ho</div>
17472 !! html/php
17473 <div style="123">hi</div>
17474 <div>ho</div>
17475
17476 !! html/parsoid
17477 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17478 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17479 !! end
17480
17481 ###
17482 ### Nesting tests (see T43545, T52604, T53081)
17483 ###
17484
17485 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17486 # Note that html2wt is considerably more difficult if we use <b> in
17487 # the test case, instead of <small>
17488 !! test
17489 Ensure that HTML adoption agency algorithm is properly implemented.
17490 !! wikitext
17491 <small>X<small>Y</small>Z</small>
17492 !! html
17493 <p><small>X<small>Y</small>Z</small>
17494 </p>
17495 !! end
17496
17497 # This was T43545 in the PHP parser.
17498 !! test
17499 Nesting of <kbd>
17500 !! wikitext
17501 <kbd>X<kbd>Y</kbd>Z</kbd>
17502 !! html+tidy
17503 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17504 </p>
17505 !! end
17506
17507 # The following cases were T53081 in the PHP parser.
17508 # Note that there are some other nestable tags (b, i, etc) which are
17509 # not covered; see T53081 for discussion.
17510
17511 !! test
17512 Nesting of <em>
17513 !! wikitext
17514 <em>X<em>Y</em>Z</em>
17515 !! html+tidy
17516 <p><em>X<em>Y</em>Z</em>
17517 </p>
17518 !! end
17519
17520 !! test
17521 Nesting of <strong>
17522 !! wikitext
17523 <strong>X<strong>Y</strong>Z</strong>
17524 !! html+tidy
17525 <p><strong>X<strong>Y</strong>Z</strong>
17526 </p>
17527 !! end
17528
17529 !! test
17530 Nesting of <q>
17531 !! wikitext
17532 <q>X<q>Y</q>Z</q>
17533 !! html+tidy
17534 <p><q>X<q>Y</q>Z</q>
17535 </p>
17536 !! end
17537
17538 !! test
17539 Nesting of <ruby>
17540 !! wikitext
17541 <ruby>X<ruby>Y</ruby>Z</ruby>
17542 !! html
17543 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17544 </p>
17545 !! end
17546
17547 !! test
17548 Nesting of <bdo>
17549 !! wikitext
17550 <bdo>X<bdo>Y</bdo>Z</bdo>
17551 !! html
17552 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17553 </p>
17554 !! end
17555
17556
17557 ###
17558 ### Media links
17559 ###
17560
17561 !! test
17562 Media link
17563 !! wikitext
17564 [[Media:Foobar.jpg]]
17565 [[Media:Video.ogv]]
17566 [[:Media:Video.ogv]]
17567 !! html/php
17568 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17569 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17570 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17571 </p>
17572 !! html/parsoid
17573 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17574 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17575 <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>
17576 !! end
17577
17578 !! test
17579 Media link with text
17580 !! wikitext
17581 [[Media:Foobar.jpg|A neat file to look at]]
17582 !! html/php
17583 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17584 </p>
17585 !! html/parsoid
17586 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17587 !! end
17588
17589 # FIXME: this is still bad HTML tag nesting
17590 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17591 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
17592 !! test
17593 Media link with nasty text
17594 !! wikitext
17595 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17596 !! html/php
17597 <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>
17598
17599 !! html/php+tidy
17600 <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>
17601 !! html/parsoid
17602 <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>
17603
17604 !! end
17605
17606 !! test
17607 Media link to nonexistent file (T3702)
17608 !! wikitext
17609 [[Media:No such.jpg]]
17610 [[Media:No_such file.jpg]]
17611 !! html/php
17612 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17613 <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>
17614 </p>
17615 !! html/parsoid
17616 <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>
17617 <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>
17618 !! end
17619
17620 !! test
17621 Image link to nonexistent file (T3850 - good)
17622 !! wikitext
17623 [[File:No_such.jpg]]
17624 !! html/php
17625 <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>
17626 </p>
17627 !! html/parsoid
17628 <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>
17629 !! end
17630
17631 !! test
17632 :Image link to nonexistent file (T3850 - bad)
17633 !! wikitext
17634 [[:Image:No such.jpg]]
17635 !! html/php
17636 <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>
17637 </p>
17638 !! html/parsoid
17639 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17640 !! end
17641
17642 !! test
17643 Character reference normalization in link text (T3938)
17644 !! wikitext
17645 [[Main Page|this&that]]
17646 !! html
17647 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17648 </p>
17649 !!end
17650
17651 !! article
17652 אַ
17653 !! text
17654 Test for unicode normalization
17655
17656 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17657 !! endarticle
17658
17659 !! test
17660 (T21451) Links should refer to the normalized form.
17661 !! wikitext
17662 [[&#xFB2E;]]
17663 [[&#x5d0;&#x5b7;]]
17664 [[&#x5d0;ַ]]
17665 [[א&#x5b7;]]
17666 [[אַ]]
17667 !! html
17668 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17669 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17670 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17671 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17672 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17673 </p>
17674 !! end
17675
17676 !! test
17677 Empty attribute crash test (T4067)
17678 !! wikitext
17679 <font color="">foo</font>
17680 !! html
17681 <p><font color="">foo</font>
17682 </p>
17683 !! end
17684
17685 !! test
17686 Empty attribute crash test single-quotes (T4067)
17687 !! wikitext
17688 <font color=''>foo</font>
17689 !! html
17690 <p><font color="">foo</font>
17691 </p>
17692 !! end
17693
17694 !! test
17695 Attribute test: equals, then nothing
17696 !! options
17697 parsoid=wt2html,html2html
17698 !! wikitext
17699 <font color=>foo</font>
17700 !! html/php
17701 <p><font color="">foo</font>
17702 </p>
17703 !! html/parsoid
17704 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17705 !! end
17706
17707 !! test
17708 Attribute test: unquoted value
17709 !! options
17710 parsoid=wt2html,html2html
17711 !! wikitext
17712 <font color=x>foo</font>
17713 !! html/php
17714 <p><font color="x">foo</font>
17715 </p>
17716 !! html/parsoid
17717 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17718 !! end
17719
17720 !! test
17721 Attribute test: unquoted but illegal value (hash)
17722 !! wikitext
17723 <font color=#x>foo</font>
17724 !! html
17725 <p><font color="#x">foo</font>
17726 </p>
17727 !! end
17728
17729 # Parsoid does not serialize to empty attribute syntax,
17730 # so wt2wt and html2wt cases are skipped
17731 !! test
17732 Attribute test: no value (T54330)
17733 !! options
17734 parsoid=wt2html,html2html
17735 !! wikitext
17736 <font color>foo</font>
17737 !! html/php
17738 <p><font color="">foo</font>
17739 </p>
17740 !! html/parsoid
17741 <p><font color="">foo</font></p>
17742 !! end
17743
17744 !! test
17745 T4095: link with three closing brackets
17746 !! wikitext
17747 [[Main Page]]]
17748 !! html/php
17749 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17750 </p>
17751 !! html/parsoid
17752 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17753 !! end
17754
17755 !! test
17756 T4095: link with pipe and three closing brackets
17757 !! wikitext
17758 [[Main Page|link]]]
17759 !! html/php
17760 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17761 </p>
17762 !! html/parsoid
17763 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17764 !! end
17765
17766 !! test
17767 T4095: link with pipe and three closing brackets, version 2
17768 !! wikitext
17769 [[Main Page|[http://example.com/]]]
17770 !! html/php
17771 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17772 </p>
17773 !! html/parsoid
17774 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17775 !! end
17776
17777
17778 ###
17779 ### Safety
17780 ###
17781
17782 !! article
17783 Template:Dangerous attribute
17784 !! text
17785 " onmouseover="alert(document.cookie)
17786 !! endarticle
17787
17788 !! article
17789 Template:Dangerous style attribute
17790 !! text
17791 border-size: expression(alert(document.cookie))
17792 !! endarticle
17793
17794 !! article
17795 Template:Div style
17796 !! text
17797 <div style="float: right; {{{1}}}">Magic div</div>
17798 !! endarticle
17799
17800 !! test
17801 T4304: HTML attribute safety (safe template; regression T4309)
17802 !! wikitext
17803 <div title="{{test}}"></div>
17804 !! html/php
17805 <div title="This is a test template"></div>
17806
17807 !! html/parsoid
17808 <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>
17809 !! end
17810
17811 # Parsoid has enough context to handle this case
17812 !! test
17813 T4304: HTML attribute safety (dangerous template; 2309)
17814 !! wikitext
17815 <div title="{{dangerous attribute}}"></div>
17816 !! html/php
17817 <div title=""></div>
17818
17819 !! html/parsoid
17820 <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>
17821 !! end
17822
17823 !! test
17824 T4304: HTML attribute safety (dangerous style template; 2309)
17825 !! wikitext
17826 <div style="{{dangerous style attribute}}"></div>
17827 !! html/php
17828 <div style="/* insecure input */"></div>
17829
17830 !! html/parsoid
17831 <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>
17832 !! end
17833
17834 !! test
17835 T4304: HTML attribute safety (safe parameter; 2309)
17836 !! wikitext
17837 {{div style|width: 200px}}
17838 !! html/php
17839 <div style="float: right; width: 200px">Magic div</div>
17840
17841 !! html/parsoid
17842 <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>
17843 !! end
17844
17845 !! test
17846 T4304: HTML attribute safety (unsafe parameter; 2309)
17847 !! wikitext
17848 {{div style|width: expression(alert(document.cookie))}}
17849 !! html/php
17850 <div style="/* insecure input */">Magic div</div>
17851
17852 !! html/parsoid
17853 <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>
17854 !! end
17855
17856 ## Parsoid output here differs; needs investigation.
17857 !! test
17858 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17859 !! wikitext
17860 {{div style|"><script>alert(document.cookie)</script>}}
17861 !! html
17862 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17863
17864 !! end
17865
17866 ## Parsoid output here differs; needs investigation.
17867 !! test
17868 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17869 !! wikitext
17870 {{div style|" ><script>alert(document.cookie)</script>}}
17871 !! html
17872 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17873
17874 !! end
17875
17876 !! test
17877 T4304: HTML attribute safety (link)
17878 !! wikitext
17879 <div title="[[Main Page]]"></div>
17880 !! html/php
17881 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
17882
17883 !! html/parsoid
17884 <div title="[[Main Page]]"></div>
17885 !! end
17886
17887 !! test
17888 T4304: HTML attribute safety (italics)
17889 !! wikitext
17890 <div title="''foobar''"></div>
17891 !! html
17892 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17893
17894 !! end
17895
17896 !! test
17897 T4304: HTML attribute safety (bold)
17898 !! wikitext
17899 <div title="'''foobar'''"></div>
17900 !! html
17901 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17902
17903 !! end
17904
17905 !! test
17906 T4304: HTML attribute safety (ISBN)
17907 !! wikitext
17908 <div title="ISBN 1234567890"></div>
17909 !! html
17910 <div title="&#73;SBN 1234567890"></div>
17911
17912 !! end
17913
17914 !! test
17915 T4304: HTML attribute safety (RFC)
17916 !! wikitext
17917 <div title="RFC 1234"></div>
17918 !! html
17919 <div title="&#82;FC 1234"></div>
17920
17921 !! end
17922
17923 !! test
17924 T4304: HTML attribute safety (PMID)
17925 !! wikitext
17926 <div title="PMID 1234567890"></div>
17927 !! html
17928 <div title="&#80;MID 1234567890"></div>
17929
17930 !! end
17931
17932 !! test
17933 T4304: HTML attribute safety (web link)
17934 !! wikitext
17935 <div title="http://example.com/"></div>
17936 !! html
17937 <div title="http&#58;//example.com/"></div>
17938
17939 !! end
17940
17941 !! test
17942 T4304: HTML attribute safety (named web link)
17943 !! wikitext
17944 <div title="[http://example.com/ link]"></div>
17945 !! html/php
17946 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
17947
17948 !! html/parsoid
17949 <div title="[http://example.com/ link]"></div>
17950 !! end
17951
17952 !! test
17953 T5244: HTML attribute safety (extension; safe)
17954 !! wikitext
17955 <div style="<nowiki>background:blue</nowiki>"></div>
17956 !! html/php
17957 <div style="background:blue"></div>
17958
17959 !! html/parsoid
17960 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17961 !! end
17962
17963 !! test
17964 T5244: HTML attribute safety (extension; unsafe)
17965 !! wikitext
17966 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17967 !! html/php
17968 <div style="/* insecure input */"></div>
17969
17970 !! html/parsoid
17971 <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>
17972 !! end
17973
17974 # More MSIE fun discovered by Tom Gilder
17975
17976 !! test
17977 MSIE CSS safety test: spurious slash
17978 !! wikitext
17979 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17980 !! html/php
17981 <div style="/* insecure input */">evil</div>
17982
17983 !! html/parsoid
17984 <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>
17985 !! end
17986
17987 !! test
17988 MSIE CSS safety test: hex code
17989 !! wikitext
17990 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17991 !! html/php
17992 <div style="/* insecure input */">evil</div>
17993
17994 !! html/parsoid
17995 <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>
17996 !! end
17997
17998 !! test
17999 MSIE CSS safety test: comment in url
18000 !! wikitext
18001 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
18002 !! html/php
18003 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
18004
18005 !! html/parsoid
18006 <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>
18007 !! end
18008
18009 !! test
18010 MSIE CSS safety test: comment in expression
18011 !! wikitext
18012 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
18013 !! html/php
18014 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
18015
18016 !! html/parsoid
18017 <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>
18018 !! end
18019
18020 !! test
18021 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
18022 !! wikitext
18023 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
18024 !! html/php
18025 <p style="/* invalid control char */">A</p>
18026
18027 !! html/parsoid
18028 <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>
18029 !! end
18030
18031 !! test
18032 MSIE 6 CSS safety test: Fullwidth (T57332)
18033 !! wikitext
18034 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
18035 <div style="top:EXPRESSION(alert())">B</div>
18036 !! html/php
18037 <p style="/* insecure input */">A</p>
18038 <div style="/* insecure input */">B</div>
18039
18040 !! html/parsoid
18041 <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>
18042 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
18043 !! end
18044
18045 !! test
18046 MSIE 6 CSS safety test: IPA extensions (T57332)
18047 !! wikitext
18048 <div style="background-image:uʀʟ(javascript:alert())">A</div>
18049 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
18050 !! html/php
18051 <div style="/* insecure input */">A</div>
18052 <p style="/* insecure input */">B</p>
18053
18054 !! html/parsoid
18055 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
18056 <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>
18057 !! end
18058
18059 !! test
18060 MSIE 6 CSS safety test: sup/sub script (T57332)
18061 !! wikitext
18062 <div style="background-image:url⁽javascript:alert())">A</div>
18063 <div style="background-image:url₍javascript:alert())">B</div>
18064 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
18065 !! html/php
18066 <div style="/* insecure input */">A</div>
18067 <div style="/* insecure input */">B</div>
18068 <p style="/* insecure input */">C</p>
18069
18070 !! html/parsoid
18071 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
18072 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
18073 <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>
18074 !! end
18075
18076 !! test
18077 Opera -o-link CSS
18078 !! options
18079 parsoid=wt2html,html2html
18080 !! wikitext
18081 <div
18082 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;"
18083 style="-o-link:attr(title);-o-link-source:current">X</div>
18084 !! html/php
18085 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
18086
18087 !! html/parsoid
18088 <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>
18089 !! end
18090
18091 !! test
18092 MSIE 6 CSS safety test: Repetition markers (T57332)
18093 !! wikitext
18094 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
18095 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
18096 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
18097 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
18098 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
18099 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
18100 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
18101 !! html/php
18102 <p style="/* insecure input */">A</p>
18103 <p style="/* insecure input */">B</p>
18104 <p style="/* insecure input */">C</p>
18105 <p style="/* insecure input */">D</p>
18106 <p style="/* insecure input */">E</p>
18107 <p style="/* insecure input */">F</p>
18108 <p style="/* insecure input */">G</p>
18109
18110 !! html/parsoid
18111 <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>
18112 <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>
18113 <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>
18114 <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>
18115 <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>
18116 <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>
18117 <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>
18118 !! end
18119
18120 !! test
18121 Table attribute legitimate extension
18122 !! wikitext
18123 {|
18124 !+ style="<nowiki>color:blue</nowiki>"|status
18125 |}
18126 !! html
18127 <table>
18128 <tr>
18129 <th style="color:blue">status
18130 </th></tr></table>
18131
18132 !!end
18133
18134 !! test
18135 Table attribute safety
18136 !! wikitext
18137 {|
18138 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18139 |}
18140 !! html
18141 <table>
18142 <tr>
18143 <th style="/* insecure input */">status
18144 </th></tr></table>
18145
18146 !! end
18147
18148 !! test
18149 CSS line continuation 1
18150 !! wikitext
18151 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18152 !! html
18153 <div style="/* insecure input */"></div>
18154
18155 !! end
18156
18157 !! test
18158 CSS line continuation 2
18159 !! wikitext
18160 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18161 !! html
18162 <div style="/* invalid control char */"></div>
18163
18164 !! end
18165
18166 !! article
18167 Template:Identity
18168 !! text
18169 {{{1}}}
18170 !! endarticle
18171
18172 !! test
18173 Expansion of multi-line templates in attribute values (T8255)
18174 !! wikitext
18175 <div style="background: {{identity|#00FF00}}">-</div>
18176 !! html
18177 <div style="background: #00FF00">-</div>
18178
18179 !! end
18180
18181 !! test
18182 Expansion of multi-line templates in attribute values (T8255 sanity check)
18183 !! wikitext
18184 <div style="background:
18185 #00FF00">-</div>
18186 !! html/php
18187 <div style="background: #00FF00">-</div>
18188
18189 !! html/parsoid
18190 <div style="background:
18191 #00FF00">-</div>
18192 !! end
18193
18194 !! test
18195 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18196 !! wikitext
18197 <div style="background: &#10;#00FF00">-</div>
18198 !! html
18199 <div style="background: &#10;#00FF00">-</div>
18200
18201 !! end
18202
18203 !! test
18204 Tags which are hidden from tidiers cannot pass through the Sanitizer
18205 !! wikitext
18206 <mw:toc><script>alert();</script></mw:toc>
18207 !! html+tidy
18208 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18209 </p>
18210 !! end
18211
18212 ###
18213 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18214 ###
18215
18216 !! test
18217 Parser hook: empty input
18218 !! wikitext
18219 <tag></tag>
18220 !! html/php
18221 <pre>
18222 ''
18223 array (
18224 )
18225 </pre>
18226
18227 !! html/parsoid
18228 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18229 !! end
18230
18231 ## Don't expect parsoid to rt this form.
18232 !! test
18233 Parser hook: empty input using terminated empty elements
18234 !! options
18235 parsoid=wt2html,html2html
18236 !! wikitext
18237 <tag/>
18238 !! html/php
18239 <pre>
18240 NULL
18241 array (
18242 )
18243 </pre>
18244
18245 !! html/parsoid
18246 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18247 !! end
18248
18249 !! test
18250 Parser hook: empty input using terminated empty elements (space before)
18251 !! wikitext
18252 <tag />
18253 !! html/php
18254 <pre>
18255 NULL
18256 array (
18257 )
18258 </pre>
18259
18260 !! html/parsoid
18261 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18262 !! end
18263
18264 !! test
18265 Parser hook: basic input
18266 !! wikitext
18267 <tag>input</tag>
18268 !! html/php
18269 <pre>
18270 'input'
18271 array (
18272 )
18273 </pre>
18274
18275 !! html/parsoid
18276 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18277 !! end
18278
18279 ## Don't expect parsoid to rt this form.
18280 !! test
18281 Parser hook: case insensitive
18282 !! options
18283 parsoid=wt2html,html2html
18284 !! wikitext
18285 <TAG>input</TAG>
18286 !! html/php
18287 <pre>
18288 'input'
18289 array (
18290 )
18291 </pre>
18292
18293 !! html/parsoid
18294 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18295 !! end
18296
18297 ## Don't expect parsoid to rt this form.
18298 !! test
18299 Parser hook: case insensitive, redux
18300 !! options
18301 parsoid=wt2html,html2html
18302 !! wikitext
18303 <TaG>input</TAg>
18304 !! html/php
18305 <pre>
18306 'input'
18307 array (
18308 )
18309 </pre>
18310
18311 !! html/parsoid
18312 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18313 !! end
18314
18315 !! test
18316 Parser hook: nested tags
18317 !! wikitext
18318 <tag><tag></tag></tag>
18319 !! html/php
18320 <pre>
18321 '<tag>'
18322 array (
18323 )
18324 </pre>&lt;/tag&gt;
18325
18326 !! html/parsoid
18327 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
18328 !! end
18329
18330 !! test
18331 Parser hook: basic arguments
18332 !! wikitext
18333 <tag width="200" height="100" depth="50" square=""></tag>
18334 !! html/php
18335 <pre>
18336 ''
18337 array (
18338 'width' => '200',
18339 'height' => '100',
18340 'depth' => '50',
18341 'square' => '',
18342 )
18343 </pre>
18344
18345 !! html/parsoid
18346 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18347 !! end
18348
18349 ## Don't expect parsoid to rt this form.
18350 !! test
18351 Parser hook: basic arguments, variations
18352 !! options
18353 parsoid=wt2html,html2html
18354 !! wikitext
18355 <tag width=200 height = "100" depth = '50' square></tag>
18356 !! html/php
18357 <pre>
18358 ''
18359 array (
18360 'width' => '200',
18361 'height' => '100',
18362 'depth' => '50',
18363 'square' => '',
18364 )
18365 </pre>
18366
18367 !! html/parsoid
18368 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18369 !! end
18370
18371 !! test
18372 Parser hook: argument containing a forward slash (T7344)
18373 !! wikitext
18374 <tag filename="/tmp/bla"></tag>
18375 !! html/php
18376 <pre>
18377 ''
18378 array (
18379 'filename' => '/tmp/bla',
18380 )
18381 </pre>
18382
18383 !! html/parsoid
18384 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18385 !! end
18386
18387 ## Don't expect parsoid to rt this form.
18388 !! test
18389 Parser hook: empty input using terminated empty elements (T4374)
18390 !! options
18391 parsoid=wt2html,html2html
18392 !! wikitext
18393 <tag foo=bar/>text
18394 !! html/php
18395 <pre>
18396 NULL
18397 array (
18398 'foo' => 'bar',
18399 )
18400 </pre>text
18401
18402 !! html/parsoid
18403 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
18404 !! end
18405
18406 ## </tag> should be output literally since there is no matching tag that begins it
18407 ## Don't expect parsoid to rt this form.
18408 !! test
18409 Parser hook: basic arguments using terminated empty elements (T4374)
18410 !! options
18411 parsoid=wt2html
18412 !! wikitext
18413 <tag width=200 height = "100" depth = '50' square/>
18414 other stuff
18415 </tag>
18416 !! html/php
18417 <pre>
18418 NULL
18419 array (
18420 'width' => '200',
18421 'height' => '100',
18422 'depth' => '50',
18423 'square' => '',
18424 )
18425 </pre>
18426 <p>other stuff
18427 &lt;/tag&gt;
18428 </p>
18429 !! html/parsoid
18430 <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
18431 &lt;/tag></p>
18432 !! end
18433
18434 ## Don't expect parsoid to rt this form.
18435 !! test
18436 Parser hook: Don't allow unclosed extension tags
18437 !! options
18438 parsoid=wt2html
18439 !! wikitext
18440 test <tag>123
18441
18442 this is a '''test'''
18443 !! html/php
18444 <p>test &lt;tag&gt;123
18445 </p><p>this is a <b>test</b>
18446 </p>
18447 !! html/parsoid
18448 <p>test &lt;tag>123</p>
18449
18450 <p>this is a <b>test</b></p>
18451 !! end
18452
18453 !! test
18454 Parser hook: horizontal rule inside extension tag that outputs <pre>
18455 !! wikitext
18456 <tag>
18457 Hello
18458 <hr/>
18459 Goodbye
18460 </tag>
18461 !! html/php
18462 <pre>
18463 '
18464 Hello
18465 <hr/>
18466 Goodbye
18467 '
18468 array (
18469 )
18470 </pre>
18471
18472 !! end
18473
18474 ###
18475 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18476 ###
18477
18478 !! test
18479 Parser hook: static parser hook not inside a comment
18480 !! wikitext
18481 <statictag>hello, world</statictag>
18482
18483 <statictag action="flush" />
18484 !! html/php
18485 <p><br />
18486 hello, world
18487 </p>
18488 !! html/parsoid
18489 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18490 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18491 !! end
18492
18493 !! test
18494 Parser hook: static parser hook inside a comment
18495 !! wikitext
18496 <!-- <statictag>hello, world</statictag> -->
18497 <statictag action="flush" />
18498 !! html/php
18499 <p><br />
18500 </p>
18501 !! html/parsoid
18502 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18503 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18504 !! end
18505
18506 # Nested template calls; this case was broken by Parser.php rev 1.506,
18507 # since reverted.
18508
18509 !! article
18510 Template:One-parameter
18511 !! text
18512 (My parameter is: {{{1}}})
18513 !! endarticle
18514
18515 !! article
18516 Template:Map-one-parameter
18517 !! text
18518 {{{{{1}}}|{{{2}}}}}
18519 !! endarticle
18520
18521 !! test
18522 Nested template calls
18523 !! wikitext
18524 {{Map-one-parameter|One-parameter|param}}
18525 !! html
18526 <p>(My parameter is: param)
18527 </p>
18528 !! end
18529
18530
18531 ###
18532 ### Sanitizer
18533 ###
18534
18535 # Remex wraps empty tag runs with p-tags.
18536 # Parsoid strips them out during p-wrapping.
18537 !! test
18538 Sanitizer: Closing of open tags
18539 !! wikitext
18540 <s></s><table></table>
18541 !! html/php+tidy
18542 <p><s></s></p><table></table>
18543 !! html/parsoid
18544 <s></s><table></table>
18545 !! end
18546
18547 !! test
18548 Sanitizer: Closing of open but not closed tags
18549 !! wikitext
18550 <s>foo
18551 !! html
18552 <p><s>foo</s>
18553 </p>
18554 !! end
18555
18556 !! test
18557 Sanitizer: Closing of closed but not open tags
18558 !! options
18559 parsoid=wt2html
18560 !! wikitext
18561 </s>
18562 !! html/php+tidy
18563 <p class="mw-empty-elt">
18564 </p>
18565 !! html/parsoid
18566 !! end
18567
18568 !! test
18569 Sanitizer: Closing of closed but not open table tags
18570 !! options
18571 parsoid=wt2html
18572 !! wikitext
18573 Table not started</td></tr></table>
18574 !! html+tidy
18575 <p>Table not started
18576 </p>
18577 !! end
18578
18579 !! test
18580 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18581 !! config
18582 wgFragmentMode=[ 'html5', 'legacy' ]
18583 !! wikitext
18584 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18585 !! html/php
18586 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18587 </p>
18588 !! html/parsoid
18589 <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>
18590 !! end
18591
18592 !! test
18593 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18594 !! config
18595 wgFragmentMode=[ 'legacy' ]
18596 !! wikitext
18597 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18598 !! html/php
18599 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18600 </p>
18601 !! end
18602
18603 # In HTML5, the restrictions are that id must contain at least one character,
18604 # and must not contain any space characters.
18605 !! test
18606 Sanitizer: Validating the contents of the id attribute (T6515)
18607 !! options
18608 disabled
18609 !! wikitext
18610 <br id="" /><br id="a space" />
18611 !! html
18612 Something ...
18613 !! end
18614
18615 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18616 !! test
18617 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18618 !! options
18619 disabled
18620 !! wikitext
18621 <br id="foo" /><br id="foo" />
18622 !! html
18623 Something need to be done. foo-2 ?
18624 !! end
18625
18626 !! test
18627 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18628 !! wikitext
18629 <div itemscope>
18630 <meta itemprop="hello" content="world">
18631 <meta http-equiv="refresh" content="5">
18632 <meta itemprop="hello" http-equiv="refresh" content="5">
18633 <link itemprop="hello" href="{{SERVER}}">
18634 <link rel="stylesheet" href="{{SERVER}}">
18635 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18636 </div>
18637 !! html
18638 <div itemscope="">
18639 <p> <meta itemprop="hello" content="world" />
18640 &lt;meta http-equiv="refresh" content="5"&gt;
18641 <meta itemprop="hello" content="5" />
18642 <link itemprop="hello" href="http&#58;//example.org" />
18643 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18644 <link itemprop="hello" href="http&#58;//example.org" />
18645 </p>
18646 </div>
18647
18648 !! end
18649
18650 !! test
18651 Sanitizer: Strip comments from CSS attributes
18652 !! options
18653 parsoid=wt2html,wt2wt
18654 !! wikitext
18655 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18656 !! html/php
18657 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18658 </p>
18659 !! html/parsoid
18660 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18661 !! end
18662
18663 !! test
18664 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18665 !! wikitext
18666 [[meatball:Soft"Security]]
18667 !! html/php
18668 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18669 </p>
18670 !! html/parsoid
18671 <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>
18672 !! end
18673
18674 !! test
18675 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18676 !! wikitext
18677 [[meatball:Foo<Bar]]
18678 [[meatball:Foo>Bar]]
18679 [[meatball:Foo&lt;bar]]
18680 [[meatball:Foo&gt;bar]]
18681 !! html/php
18682 <p>[[meatball:Foo&lt;Bar]]
18683 [[meatball:Foo&gt;Bar]]
18684 [[meatball:Foo&lt;bar]]
18685 [[meatball:Foo&gt;bar]]
18686 </p>
18687 !! html/parsoid
18688 <p>[[meatball:Foo&lt;Bar]]
18689 [[meatball:Foo>Bar]]
18690 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
18691 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
18692 !! end
18693
18694 !! test
18695 Language converter: output gets cut off unexpectedly (T7757)
18696 !! options
18697 language=zh
18698 !! wikitext
18699 this bit is safe: }-
18700
18701 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18702
18703 then we get cut off here: }-
18704
18705 all additional text is vanished
18706 !! html/php
18707 <p>this bit is safe: }-
18708 </p><p>but if we add a conversion instance: xxx
18709 </p><p>then we get cut off here: }-
18710 </p><p>all additional text is vanished
18711 </p>
18712 !! html/parsoid
18713 <p>this bit is safe: }-</p>
18714 <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>
18715 <p>then we get cut off here: }-</p>
18716 <p>all additional text is vanished</p>
18717 !! end
18718
18719 !! test
18720 Language converter glossary rules inside attributes (T119158)
18721 !! options
18722 language=sr variant=sr-el
18723 !! wikitext
18724 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
18725
18726 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
18727 !! html/php
18728 <p>
18729 </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>
18730 </p>
18731 !! html/parsoid
18732 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
18733
18734 <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>
18735 !! end
18736
18737 !! test
18738 Self closed html pairs (T7487)
18739 !! wikitext
18740 <center><font id="bug" />Centered text</center>
18741 <div><font id="bug2" />In div text</div>
18742 !! html+tidy
18743 <center><font id="bug"></font>Centered text</center>
18744 <div><font id="bug2"></font>In div text</div>
18745 !! end
18746
18747 !! test
18748 Punctuation: nbsp before exclamation
18749 !! wikitext
18750 C'est grave !
18751 !! html
18752 <p>C'est grave&#160;!
18753 </p>
18754 !! end
18755
18756 !! test
18757 Punctuation: CSS !important (T13874)
18758 !! wikitext
18759 <div style="width:50% !important">important</div>
18760 !! html
18761 <div style="width:50%&#32;!important">important</div>
18762
18763 !!end
18764
18765 !! test
18766 Punctuation: CSS ! important (T13874; with space after)
18767 !! wikitext
18768 <div style="width:50% ! important">important</div>
18769 !! html
18770 <div style="width:50%&#32;! important">important</div>
18771
18772 !!end
18773
18774 !! test
18775 HTML bullet list, closed tags (T7497)
18776 !! wikitext
18777 <ul>
18778 <li>One</li>
18779 <li>Two</li>
18780 </ul>
18781 !! html/php
18782 <ul>
18783 <li>One</li>
18784 <li>Two</li>
18785 </ul>
18786
18787 !! html/parsoid
18788 <ul data-parsoid='{"stx":"html"}'>
18789 <li data-parsoid='{"stx":"html"}'>One</li>
18790 <li data-parsoid='{"stx":"html"}'>Two</li>
18791 </ul>
18792
18793 !! end
18794
18795 !! test
18796 HTML bullet list, unclosed tags (T7497)
18797 !! wikitext
18798 <ul>
18799 <li>One
18800 <li>Two
18801 </ul>
18802 !! html/php+tidy
18803 <ul>
18804 <li>One
18805 </li><li>Two
18806 </li></ul>
18807 !! html/parsoid
18808 <ul data-parsoid='{"stx":"html"}'>
18809 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18810 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18811 </ul>
18812
18813 !! end
18814
18815 !! test
18816 HTML ordered list, closed tags (T7497)
18817 !! wikitext
18818 <ol>
18819 <li>One</li>
18820 <li>Two</li>
18821 </ol>
18822 !! html/php
18823 <ol>
18824 <li>One</li>
18825 <li>Two</li>
18826 </ol>
18827
18828 !! html/parsoid
18829 <ol data-parsoid='{"stx":"html"}'>
18830 <li data-parsoid='{"stx":"html"}'>One</li>
18831 <li data-parsoid='{"stx":"html"}'>Two</li>
18832 </ol>
18833
18834 !! end
18835
18836 !! test
18837 HTML ordered list, unclosed tags (T7497)
18838 !! options
18839 !! wikitext
18840 <ol>
18841 <li>One
18842 <li>Two
18843 </ol>
18844 !! html/php+tidy
18845 <ol>
18846 <li>One
18847 </li><li>Two
18848 </li></ol>
18849 !! html/parsoid
18850 <ol data-parsoid='{"stx":"html"}'>
18851 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18852 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18853 </ol>
18854
18855 !! end
18856
18857 !! test
18858 HTML nested bullet list, closed tags (T7497)
18859 !! wikitext
18860 <ul>
18861 <li>One</li>
18862 <li>Two:
18863 <ul>
18864 <li>Sub-one</li>
18865 <li>Sub-two</li>
18866 </ul>
18867 </li>
18868 </ul>
18869 !! html/php
18870 <ul>
18871 <li>One</li>
18872 <li>Two:
18873 <ul>
18874 <li>Sub-one</li>
18875 <li>Sub-two</li>
18876 </ul>
18877 </li>
18878 </ul>
18879
18880 !! html/parsoid
18881 <ul data-parsoid='{"stx":"html"}'>
18882 <li data-parsoid='{"stx":"html"}'>One</li>
18883 <li data-parsoid='{"stx":"html"}'>Two:
18884 <ul data-parsoid='{"stx":"html"}'>
18885 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18886 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18887 </ul>
18888 </li>
18889 </ul>
18890 !! end
18891
18892 !! test
18893 HTML nested bullet list, open tags (T7497)
18894 !! wikitext
18895 <ul>
18896 <li>One
18897 <li>Two:
18898 <ul>
18899 <li>Sub-one
18900 <li>Sub-two
18901 </ul>
18902 </ul>
18903 !! html+tidy
18904 <ul>
18905 <li>One
18906 </li><li>Two:
18907 <ul>
18908 <li>Sub-one
18909 </li><li>Sub-two
18910 </li></ul>
18911 </li></ul>
18912 !! end
18913
18914 !! test
18915 HTML nested ordered list, closed tags (T7497)
18916 !! wikitext
18917 <ol>
18918 <li>One</li>
18919 <li>Two:
18920 <ol>
18921 <li>Sub-one</li>
18922 <li>Sub-two</li>
18923 </ol>
18924 </li>
18925 </ol>
18926 !! html
18927 <ol>
18928 <li>One</li>
18929 <li>Two:
18930 <ol>
18931 <li>Sub-one</li>
18932 <li>Sub-two</li>
18933 </ol>
18934 </li>
18935 </ol>
18936
18937 !! end
18938
18939 !! test
18940 HTML nested ordered list, open tags (T7497)
18941 !! wikitext
18942 <ol>
18943 <li>One
18944 <li>Two:
18945 <ol>
18946 <li>Sub-one
18947 <li>Sub-two
18948 </ol>
18949 </ol>
18950 !! html/php
18951 <ol>
18952 <li>One
18953 <li>Two:
18954 <ol>
18955 <li>Sub-one
18956 <li>Sub-two
18957 </ol>
18958 </ol>
18959
18960 !! html/parsoid
18961 <ol>
18962 <li>One
18963 </li>
18964 <li>Two:
18965 <ol>
18966 <li>Sub-one
18967 </li>
18968 <li>Sub-two
18969 </li>
18970 </ol>
18971 </li>
18972 </ol>
18973
18974 !! end
18975
18976 !! test
18977 HTML ordered list item with parameters oddity
18978 !! wikitext
18979 <ol><li id="fragment">One</li>
18980 </ol>
18981 !! html
18982 <ol><li id="fragment">One</li>
18983 </ol>
18984
18985 !! end
18986
18987 # parsoid doesn't explicitly mark autonumbered links, see T55505
18988 !!test
18989 T7918: autonumbering
18990 !! wikitext
18991 [http://first/] [http://second] [ftp://ftp]
18992
18993 ftp://inlineftp
18994
18995 [mailto:enclosed@mail.tld With target]
18996
18997 [mailto:enclosed@mail.tld]
18998
18999 mailto:inline@mail.tld
19000 !! html/php
19001 <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>
19002 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
19003 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
19004 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
19005 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
19006 </p>
19007 !! html/parsoid
19008 <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>
19009 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
19010 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
19011 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
19012 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
19013 !! end
19014
19015
19016 #
19017 # Security and HTML correctness
19018 # From Nick Jenkins' fuzz testing
19019 #
19020
19021 !! test
19022 Fuzz testing: Parser13
19023 !! wikitext
19024 {|
19025 | http://a|
19026 !! html
19027 <table>
19028 <tr>
19029 <td>
19030 </td>
19031 </tr>
19032 </table>
19033
19034 !! end
19035
19036 # Note that Parsoid output differs from the PHP parser here: the PHP
19037 # parser breaks the URL for the magic word, while in Parsoid the URL
19038 # production takes precedence.
19039 !! test
19040 Fuzz testing: Parser14
19041 !! wikitext
19042 ==onmouseover===
19043 http://__TOC__
19044 !! html/php
19045 <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>
19046 http://<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
19047 <ul>
19048 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19049 </ul>
19050 </div>
19051
19052
19053 !! html/php+tidy
19054 <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>
19055 http://</p><div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
19056 <ul>
19057 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19058 </ul>
19059 </div>
19060 !! html/parsoid
19061 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
19062 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
19063 !! end
19064
19065 !! test
19066 Fuzz testing: Parser14-table
19067 !! options
19068 parsoid=wt2html,html2html
19069 !! wikitext
19070 ==a==
19071 {| STYLE=__TOC__
19072 !! html
19073 <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>
19074 <table style="&#95;_TOC&#95;_">
19075 <tr><td></td></tr>
19076 </table>
19077
19078 !! html+tidy
19079 <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>
19080 <table style="__TOC__">
19081 <tr>
19082 <td></td>
19083 </tr>
19084 </table>
19085 !! html/parsoid
19086 <h2 id="a">a</h2>
19087 <table style="__TOC__"></table>
19088 !! end
19089
19090 # Known to produce bogus xml (extra </td>)
19091 # Don't add the html/php section since it generates broken HTML
19092 !! test
19093 Fuzz testing: Parser16
19094 !! wikitext
19095 {|
19096 !https://||||||
19097 !! html+tidy
19098 <table>
19099 <tbody><tr>
19100 <th>https://</th>
19101 <th></th>
19102 <th></th>
19103 <th>
19104
19105 </th></tr>
19106 </tbody></table>
19107 !! end
19108
19109 !! test
19110 Fuzz testing: Parser21
19111 !! wikitext
19112 {|
19113 !irc://{{ftp://a" onmouseover="alert('hello world');"
19114 |
19115 !! html
19116 <table>
19117 <tr>
19118 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
19119 </th>
19120 <td>
19121 </td>
19122 </tr>
19123 </table>
19124
19125 !! end
19126
19127 !! test
19128 Fuzz testing: Parser22
19129 !! wikitext
19130 http://===r:::https://b
19131
19132 {|
19133 !! html
19134 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
19135 </p>
19136 <table>
19137 <tr><td></td></tr>
19138 </table>
19139
19140 !! end
19141
19142 # Known to produce bad XML for now
19143 !! test
19144 Fuzz testing: Parser24
19145 !! options
19146 parsoid=wt2html
19147 !! wikitext
19148 {|
19149 {{{|
19150 <u CLASS=
19151 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19152 <br style="onmouseover='alert(document.cookie);' " />
19153
19154 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19155 |
19156 !! html/php
19157 <table>
19158 {{{|
19159 <u class="&#124;">}}}} &gt;
19160 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19161
19162 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19163 <tr>
19164 <td></u>
19165 </td>
19166 </tr>
19167 </table>
19168
19169 !! html/parsoid
19170 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
19171 <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>"}'/>}}}} >
19172 <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}'>
19173
19174
19175
19176 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
19177 !! end
19178
19179 # Note: the current result listed for this is not what the original one was,
19180 # but the original bug was JavaScript injection, which is fixed in any case.
19181 # It's not clear that the original result listed was any more correct than the
19182 # current one. Original result:
19183 # <p>{{{|
19184 # </p>
19185 # <li class="&#124;&#124;">
19186 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19187 !!test
19188 Fuzz testing: Parser25 (T8055)
19189 !! wikitext
19190 {{{
19191 |
19192 <LI CLASS=||
19193 >
19194 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19195 !! html/php
19196 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19197 </p>
19198 !! html/parsoid
19199 <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"]}'>
19200 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19201 !! end
19202
19203 !!test
19204 Fuzz testing: URL adjacent extension (with space, clean)
19205 !! wikitext
19206 http://example.com <nowiki>junk</nowiki>
19207 !! html/php
19208 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19209 </p>
19210 !! html/parsoid
19211 <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>
19212 !! end
19213
19214 !!test
19215 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19216 !! wikitext
19217 http://example.com<nowiki>junk</nowiki>
19218 !! html/php
19219 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19220 </p>
19221 !! html/parsoid
19222 <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>
19223 !! end
19224
19225 !! test
19226 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19227 !! wikitext
19228 http://example.com<pre>junk</pre>
19229 !! html/php
19230 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19231
19232 !! html/php+tidy
19233 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19234 !! html/parsoid
19235 <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>
19236 !! end
19237
19238 !! test
19239 Fuzz testing: image with bogus manual thumbnail
19240 !! wikitext
19241 [[Image:foobar.jpg|thumbnail= ]]
19242 !! html/php
19243 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19244
19245 !! html/parsoid
19246 <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>
19247 !! end
19248
19249 # Parsoid will emit the newline literally in wt2wt; see next test case.
19250 !! test
19251 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19252 !! options
19253 parsoid=wt2html
19254 !! wikitext
19255 <pre dir="&#10;"></pre>
19256 !! html/php
19257 <pre dir="&#10;"></pre>
19258
19259 !! html/parsoid
19260 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19261 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19262 !! end
19263
19264 !! test
19265 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19266 !! options
19267 parsoid=html2wt
19268 !! html/parsoid
19269 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19270 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19271 !! wikitext
19272 <pre dir="
19273 "></pre>
19274 !! html/php
19275 <pre dir=""></pre>
19276
19277 !! end
19278
19279 !! test
19280 Templates in extension attributes are not expanded
19281 !! wikitext
19282 <pre dir="{{echo|ltr}}"></pre>
19283 !! html/php
19284 <pre dir="{{echo|ltr}}"></pre>
19285
19286 !! html/parsoid
19287 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19288 !! end
19289
19290 !! test
19291 Parsing optional HTML elements (T8171)
19292 !! options
19293 !! wikitext
19294 <table>
19295 <tr>
19296 <td> Some tabular data</td>
19297 <td> More tabular data ...
19298 <td> And yet som tabular data</td>
19299 </tr>
19300 </table>
19301 !! html
19302 <table>
19303 <tr>
19304 <td> Some tabular data</td>
19305 <td> More tabular data ...
19306 </td><td> And yet som tabular data</td>
19307 </tr>
19308 </table>
19309
19310 !! end
19311
19312 !! test
19313 Correct handling of <td>, <tr> (T8171)
19314 !! options
19315 !! wikitext
19316 <table>
19317 <tr>
19318 <td> Some tabular data</td>
19319 <td> More tabular data ...</td>
19320 <td> And yet som tabular data</td>
19321 </tr>
19322 </table>
19323 !! html
19324 <table>
19325 <tr>
19326 <td> Some tabular data</td>
19327 <td> More tabular data ...</td>
19328 <td> And yet som tabular data</td>
19329 </tr>
19330 </table>
19331
19332 !! end
19333
19334
19335 !! test
19336 Parsing crashing regression (fr:JavaScript)
19337 !! wikitext
19338 </body></x>
19339 !! html
19340 <p>&lt;/body&gt;&lt;/x&gt;
19341 </p>
19342 !! end
19343
19344 !! test
19345 Inline wiki vs wiki block nesting
19346 !! wikitext
19347 '''Bold paragraph
19348
19349 New wiki paragraph
19350 !! html
19351 <p><b>Bold paragraph</b>
19352 </p><p>New wiki paragraph
19353 </p>
19354 !! end
19355
19356 # FIXME: The current php output is documented
19357 # and desired output is the parsoid target.
19358 !! test
19359 Inline HTML vs wiki block nesting
19360 !! wikitext
19361 <b>Bold paragraph
19362
19363 New wiki paragraph
19364 !! html/php
19365 <p><b>Bold paragraph
19366 </p><p>New wiki paragraph</b>
19367 </p>
19368 !! html/parsoid
19369 <p><b>Bold paragraph</b>
19370 </p><p>New wiki paragraph
19371 </p>
19372 !! end
19373
19374 # Original result was this:
19375 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19376 # </p>
19377 # While that might be marginally more intuitive, maybe, the six-apostrophe
19378 # construct is clearly pathological and the result stated here (which is what
19379 # the parser actually does) is about as reasonable as anything.
19380 !!test
19381 Mixing markup for italics and bold
19382 !! options
19383 !! wikitext
19384 '''bold''''''bold''bolditalics'''''
19385 !! html
19386 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19387 </p>
19388 !! end
19389
19390
19391 !! article
19392 Xyzzyx
19393 !! text
19394 Article for special page transclusion test
19395 !! endarticle
19396
19397 !! test
19398 Special page transclusion
19399 !! options
19400 !! wikitext
19401 {{Special:Prefixindex/Xyzzyx}}
19402 !! html
19403 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19404 </ul>
19405
19406 !! end
19407
19408 !! test
19409 Special page transclusion twice (T7021)
19410 !! options
19411 !! wikitext
19412 {{Special:Prefixindex/Xyzzyx}}
19413 {{Special:Prefixindex/Xyzzyx}}
19414 !! html
19415 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19416 </ul>
19417 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19418 </ul>
19419
19420 !! end
19421
19422 !! test
19423 Transclusion of default MediaWiki message
19424 !! wikitext
19425 {{MediaWiki:Mainpage}}
19426 !! html
19427 <p>Main Page
19428 </p>
19429 !! end
19430
19431 !! test
19432 Transclusion of nonexistent MediaWiki message
19433 !! wikitext
19434 {{MediaWiki:Mainpagexxx}}
19435 !! html
19436 <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>
19437 </p>
19438 !! end
19439
19440 !! test
19441 Transclusion of MediaWiki message with underscore
19442 !! wikitext
19443 {{MediaWiki:history_short}}
19444 !! html
19445 <p>History
19446 </p>
19447 !! end
19448
19449 !! test
19450 Transclusion of MediaWiki message with space
19451 !! wikitext
19452 {{MediaWiki:history short}}
19453 !! html
19454 <p>History
19455 </p>
19456 !! end
19457
19458 !! test
19459 Invalid header with following text
19460 !! wikitext
19461 = x = y
19462 !! html
19463 <p>= x = y
19464 </p>
19465 !! end
19466
19467
19468 !! test
19469 Section extraction test (section 0)
19470 !! options
19471 section=0
19472 !! wikitext
19473 start
19474 ==a==
19475 ===aa===
19476 ====aaa====
19477 ==b==
19478 ===ba===
19479 ===bb===
19480 ====bba====
19481 ===bc===
19482 ==c==
19483 ===ca===
19484 !! html/php
19485 start
19486 !! end
19487
19488 !! test
19489 Section extraction test (section 1)
19490 !! options
19491 section=1
19492 !! wikitext
19493 start
19494 ==a==
19495 ===aa===
19496 ====aaa====
19497 ==b==
19498 ===ba===
19499 ===bb===
19500 ====bba====
19501 ===bc===
19502 ==c==
19503 ===ca===
19504 !! html/php
19505 ==a==
19506 ===aa===
19507 ====aaa====
19508 !! end
19509
19510 !! test
19511 Section extraction test (section 2)
19512 !! options
19513 section=2
19514 !! wikitext
19515 start
19516 ==a==
19517 ===aa===
19518 ====aaa====
19519 ==b==
19520 ===ba===
19521 ===bb===
19522 ====bba====
19523 ===bc===
19524 ==c==
19525 ===ca===
19526 !! html/php
19527 ===aa===
19528 ====aaa====
19529 !! end
19530
19531 !! test
19532 Section extraction test (section 3)
19533 !! options
19534 section=3
19535 !! wikitext
19536 start
19537 ==a==
19538 ===aa===
19539 ====aaa====
19540 ==b==
19541 ===ba===
19542 ===bb===
19543 ====bba====
19544 ===bc===
19545 ==c==
19546 ===ca===
19547 !! html/php
19548 ====aaa====
19549 !! end
19550
19551 !! test
19552 Section extraction test (section 4)
19553 !! options
19554 section=4
19555 !! wikitext
19556 start
19557 ==a==
19558 ===aa===
19559 ====aaa====
19560 ==b==
19561 ===ba===
19562 ===bb===
19563 ====bba====
19564 ===bc===
19565 ==c==
19566 ===ca===
19567 !! html/php
19568 ==b==
19569 ===ba===
19570 ===bb===
19571 ====bba====
19572 ===bc===
19573 !! end
19574
19575 !! test
19576 Section extraction test (section 5)
19577 !! options
19578 section=5
19579 !! wikitext
19580 start
19581 ==a==
19582 ===aa===
19583 ====aaa====
19584 ==b==
19585 ===ba===
19586 ===bb===
19587 ====bba====
19588 ===bc===
19589 ==c==
19590 ===ca===
19591 !! html/php
19592 ===ba===
19593 !! end
19594
19595 !! test
19596 Section extraction test (section 6)
19597 !! options
19598 section=6
19599 !! wikitext
19600 start
19601 ==a==
19602 ===aa===
19603 ====aaa====
19604 ==b==
19605 ===ba===
19606 ===bb===
19607 ====bba====
19608 ===bc===
19609 ==c==
19610 ===ca===
19611 !! html/php
19612 ===bb===
19613 ====bba====
19614 !! end
19615
19616 !! test
19617 Section extraction test (section 7)
19618 !! options
19619 section=7
19620 !! wikitext
19621 start
19622 ==a==
19623 ===aa===
19624 ====aaa====
19625 ==b==
19626 ===ba===
19627 ===bb===
19628 ====bba====
19629 ===bc===
19630 ==c==
19631 ===ca===
19632 !! html/php
19633 ====bba====
19634 !! end
19635
19636 !! test
19637 Section extraction test (section 8)
19638 !! options
19639 section=8
19640 !! wikitext
19641 start
19642 ==a==
19643 ===aa===
19644 ====aaa====
19645 ==b==
19646 ===ba===
19647 ===bb===
19648 ====bba====
19649 ===bc===
19650 ==c==
19651 ===ca===
19652 !! html/php
19653 ===bc===
19654 !! end
19655
19656 !! test
19657 Section extraction test (section 9)
19658 !! options
19659 section=9
19660 !! wikitext
19661 start
19662 ==a==
19663 ===aa===
19664 ====aaa====
19665 ==b==
19666 ===ba===
19667 ===bb===
19668 ====bba====
19669 ===bc===
19670 ==c==
19671 ===ca===
19672 !! html/php
19673 ==c==
19674 ===ca===
19675 !! end
19676
19677 !! test
19678 Section extraction test (section 10)
19679 !! options
19680 section=10
19681 !! wikitext
19682 start
19683 ==a==
19684 ===aa===
19685 ====aaa====
19686 ==b==
19687 ===ba===
19688 ===bb===
19689 ====bba====
19690 ===bc===
19691 ==c==
19692 ===ca===
19693 !! html/php
19694 ===ca===
19695 !! end
19696
19697 !! test
19698 Section extraction test (nonexistent section 11)
19699 !! options
19700 section=11
19701 !! wikitext
19702 start
19703 ==a==
19704 ===aa===
19705 ====aaa====
19706 ==b==
19707 ===ba===
19708 ===bb===
19709 ====bba====
19710 ===bc===
19711 ==c==
19712 ===ca===
19713 !! html/php
19714 !! end
19715
19716 !! test
19717 Section extraction test with bogus heading (section 1)
19718 !! options
19719 section=1
19720 !! wikitext
19721 ==a==
19722 ==bogus== not a legal section
19723 ==b==
19724 !! html/php
19725 ==a==
19726 ==bogus== not a legal section
19727 !! end
19728
19729 !! test
19730 Section extraction test with bogus heading (section 2)
19731 !! options
19732 section=2
19733 !! wikitext
19734 ==a==
19735 ==bogus== not a legal section
19736 ==b==
19737 !! html/php
19738 ==b==
19739 !! end
19740
19741 !! test
19742 Section extraction test with comment after heading (section 1)
19743 !! options
19744 section=1
19745 !! wikitext
19746 ==a==
19747 ==b== <!-- -->
19748 ==c==
19749 !! html/php
19750 ==a==
19751 !! end
19752
19753 !! test
19754 Section extraction test with comment after heading (section 2)
19755 !! options
19756 section=2
19757 !! wikitext
19758 ==a==
19759 ==b== <!-- -->
19760 ==c==
19761 !! html/php
19762 ==b== <!-- -->
19763 !! end
19764
19765 !! test
19766 Section extraction test with bogus <nowiki> heading (section 1)
19767 !! options
19768 section=1
19769 !! wikitext
19770 ==a==
19771 ==bogus== <nowiki>not a legal section</nowiki>
19772 ==b==
19773 !! html/php
19774 ==a==
19775 ==bogus== <nowiki>not a legal section</nowiki>
19776 !! end
19777
19778 !! test
19779 Section extraction test with bogus <nowiki> heading (section 2)
19780 !! options
19781 section=2
19782 !! wikitext
19783 ==a==
19784 ==bogus== <nowiki>not a legal section</nowiki>
19785 ==b==
19786 !! html/php
19787 ==b==
19788 !! end
19789
19790 # Formerly testing for T4587, now resolved by the use of unmarked sections
19791 # instead of respecting commented sections
19792 !! test
19793 Section extraction prefixed by comment (section 1)
19794 !! options
19795 section=1
19796 !! wikitext
19797 <!-- -->==sec1==
19798 ==sec2==
19799 !! html/php
19800 ==sec2==
19801 !!end
19802
19803 !! test
19804 Section extraction prefixed by comment (section 2)
19805 !! options
19806 section=2
19807 !! wikitext
19808 <!-- -->==sec1==
19809 ==sec2==
19810 !! html/php
19811
19812 !!end
19813
19814 # Formerly testing for T4607, now resolved by the use of unmarked sections
19815 # instead of respecting HTML-style headings
19816 !! test
19817 Section extraction, mixed wiki and html (section 1)
19818 !! options
19819 section=1
19820 !! wikitext
19821 <h2>unmarked</h2>
19822 unmarked
19823 ==1==
19824 one
19825 ==2==
19826 two
19827 !! html/php
19828 ==1==
19829 one
19830 !! end
19831
19832 !! test
19833 Section extraction, mixed wiki and html (section 2)
19834 !! options
19835 section=2
19836 !! wikitext
19837 <h2>unmarked</h2>
19838 unmarked
19839 ==1==
19840 one
19841 ==2==
19842 two
19843 !! html/php
19844 ==2==
19845 two
19846 !! end
19847
19848
19849 # Formerly testing for T5342
19850 !! test
19851 Section extraction, heading surrounded by <noinclude>
19852 !! options
19853 section=1
19854 !! wikitext
19855 <noinclude>==unmarked==</noinclude>
19856 ==marked==
19857 !! html/php
19858 ==marked==
19859 !!end
19860
19861 # Test behavior of T21910
19862 !! test
19863 Sectiion with all-equals
19864 !! options
19865 section=2
19866 !! wikitext
19867 ===
19868 The line above must have a trailing space
19869 === <!--
19870 --> <!-- -->
19871 But just in case it doesn't...
19872 !! html/php
19873 === <!--
19874 --> <!-- -->
19875 But just in case it doesn't...
19876 !! end
19877
19878 !! test
19879 Section replacement test (section 0)
19880 !! options
19881 replace=0,"xxx"
19882 !! wikitext
19883 start
19884 ==a==
19885 ===aa===
19886 ====aaa====
19887 ==b==
19888 ===ba===
19889 ===bb===
19890 ====bba====
19891 ===bc===
19892 ==c==
19893 ===ca===
19894 !! html/php
19895 xxx
19896
19897 ==a==
19898 ===aa===
19899 ====aaa====
19900 ==b==
19901 ===ba===
19902 ===bb===
19903 ====bba====
19904 ===bc===
19905 ==c==
19906 ===ca===
19907 !! end
19908
19909 !! test
19910 Section replacement test (section 1)
19911 !! options
19912 replace=1,"xxx"
19913 !! wikitext
19914 start
19915 ==a==
19916 ===aa===
19917 ====aaa====
19918 ==b==
19919 ===ba===
19920 ===bb===
19921 ====bba====
19922 ===bc===
19923 ==c==
19924 ===ca===
19925 !! html/php
19926 start
19927 xxx
19928
19929 ==b==
19930 ===ba===
19931 ===bb===
19932 ====bba====
19933 ===bc===
19934 ==c==
19935 ===ca===
19936 !! end
19937
19938 !! test
19939 Section replacement test (section 2)
19940 !! options
19941 replace=2,"xxx"
19942 !! wikitext
19943 start
19944 ==a==
19945 ===aa===
19946 ====aaa====
19947 ==b==
19948 ===ba===
19949 ===bb===
19950 ====bba====
19951 ===bc===
19952 ==c==
19953 ===ca===
19954 !! html/php
19955 start
19956 ==a==
19957 xxx
19958
19959 ==b==
19960 ===ba===
19961 ===bb===
19962 ====bba====
19963 ===bc===
19964 ==c==
19965 ===ca===
19966 !! end
19967
19968 !! test
19969 Section replacement test (section 3)
19970 !! options
19971 replace=3,"xxx"
19972 !! wikitext
19973 start
19974 ==a==
19975 ===aa===
19976 ====aaa====
19977 ==b==
19978 ===ba===
19979 ===bb===
19980 ====bba====
19981 ===bc===
19982 ==c==
19983 ===ca===
19984 !! html/php
19985 start
19986 ==a==
19987 ===aa===
19988 xxx
19989
19990 ==b==
19991 ===ba===
19992 ===bb===
19993 ====bba====
19994 ===bc===
19995 ==c==
19996 ===ca===
19997 !! end
19998
19999 !! test
20000 Section replacement test (section 4)
20001 !! options
20002 replace=4,"xxx"
20003 !! wikitext
20004 start
20005 ==a==
20006 ===aa===
20007 ====aaa====
20008 ==b==
20009 ===ba===
20010 ===bb===
20011 ====bba====
20012 ===bc===
20013 ==c==
20014 ===ca===
20015 !! html/php
20016 start
20017 ==a==
20018 ===aa===
20019 ====aaa====
20020 xxx
20021
20022 ==c==
20023 ===ca===
20024 !! end
20025
20026 !! test
20027 Section replacement test (section 5)
20028 !! options
20029 replace=5,"xxx"
20030 !! wikitext
20031 start
20032 ==a==
20033 ===aa===
20034 ====aaa====
20035 ==b==
20036 ===ba===
20037 ===bb===
20038 ====bba====
20039 ===bc===
20040 ==c==
20041 ===ca===
20042 !! html/php
20043 start
20044 ==a==
20045 ===aa===
20046 ====aaa====
20047 ==b==
20048 xxx
20049
20050 ===bb===
20051 ====bba====
20052 ===bc===
20053 ==c==
20054 ===ca===
20055 !! end
20056
20057 !! test
20058 Section replacement test (section 6)
20059 !! options
20060 replace=6,"xxx"
20061 !! wikitext
20062 start
20063 ==a==
20064 ===aa===
20065 ====aaa====
20066 ==b==
20067 ===ba===
20068 ===bb===
20069 ====bba====
20070 ===bc===
20071 ==c==
20072 ===ca===
20073 !! html/php
20074 start
20075 ==a==
20076 ===aa===
20077 ====aaa====
20078 ==b==
20079 ===ba===
20080 xxx
20081
20082 ===bc===
20083 ==c==
20084 ===ca===
20085 !! end
20086
20087 !! test
20088 Section replacement test (section 7)
20089 !! options
20090 replace=7,"xxx"
20091 !! wikitext
20092 start
20093 ==a==
20094 ===aa===
20095 ====aaa====
20096 ==b==
20097 ===ba===
20098 ===bb===
20099 ====bba====
20100 ===bc===
20101 ==c==
20102 ===ca===
20103 !! html/php
20104 start
20105 ==a==
20106 ===aa===
20107 ====aaa====
20108 ==b==
20109 ===ba===
20110 ===bb===
20111 xxx
20112
20113 ===bc===
20114 ==c==
20115 ===ca===
20116 !! end
20117
20118 !! test
20119 Section replacement test (section 8)
20120 !! options
20121 replace=8,"xxx"
20122 !! wikitext
20123 start
20124 ==a==
20125 ===aa===
20126 ====aaa====
20127 ==b==
20128 ===ba===
20129 ===bb===
20130 ====bba====
20131 ===bc===
20132 ==c==
20133 ===ca===
20134 !! html/php
20135 start
20136 ==a==
20137 ===aa===
20138 ====aaa====
20139 ==b==
20140 ===ba===
20141 ===bb===
20142 ====bba====
20143 xxx
20144
20145 ==c==
20146 ===ca===
20147 !!end
20148
20149 !! test
20150 Section replacement test (section 9)
20151 !! options
20152 replace=9,"xxx"
20153 !! wikitext
20154 start
20155 ==a==
20156 ===aa===
20157 ====aaa====
20158 ==b==
20159 ===ba===
20160 ===bb===
20161 ====bba====
20162 ===bc===
20163 ==c==
20164 ===ca===
20165 !! html/php
20166 start
20167 ==a==
20168 ===aa===
20169 ====aaa====
20170 ==b==
20171 ===ba===
20172 ===bb===
20173 ====bba====
20174 ===bc===
20175 xxx
20176 !! end
20177
20178 !! test
20179 Section replacement test (section 10)
20180 !! options
20181 replace=10,"xxx"
20182 !! wikitext
20183 start
20184 ==a==
20185 ===aa===
20186 ====aaa====
20187 ==b==
20188 ===ba===
20189 ===bb===
20190 ====bba====
20191 ===bc===
20192 ==c==
20193 ===ca===
20194 !! html/php
20195 start
20196 ==a==
20197 ===aa===
20198 ====aaa====
20199 ==b==
20200 ===ba===
20201 ===bb===
20202 ====bba====
20203 ===bc===
20204 ==c==
20205 xxx
20206 !! end
20207
20208 !! test
20209 Section replacement test with initial whitespace (T15728)
20210 !! options
20211 replace=2,"xxx"
20212 !! wikitext
20213 Preformatted initial line
20214 ==a==
20215 ===a===
20216 !! html/php
20217 Preformatted initial line
20218 ==a==
20219 xxx
20220 !! end
20221
20222
20223 !! test
20224 Section extraction, heading followed by pre with 20 spaces (T8398)
20225 !! options
20226 section=1
20227 !! wikitext
20228 ==a==
20229 a
20230 !! html/php
20231 ==a==
20232 a
20233 !! end
20234
20235 !! test
20236 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20237 !! options
20238 section=1
20239 !! wikitext
20240 ==a==
20241 a
20242 !! html/php
20243 ==a==
20244 a
20245 !! end
20246
20247
20248 !! test
20249 Section extraction, <pre> around bogus header (T12309)
20250 !! options
20251 section=2
20252 !! wikitext
20253 == Section One ==
20254 <pre>
20255 =======
20256 </pre>
20257
20258 == Section Two ==
20259 stuff
20260 !! html/php
20261 == Section Two ==
20262 stuff
20263 !! end
20264
20265 !! test
20266 Section replacement, <pre> around bogus header (T12309)
20267 !! options
20268 replace=2,"xxx"
20269 !! wikitext
20270 == Section One ==
20271 <pre>
20272 =======
20273 </pre>
20274
20275 == Section Two ==
20276 stuff
20277 !! html/php
20278 == Section One ==
20279 <pre>
20280 =======
20281 </pre>
20282
20283 xxx
20284 !! end
20285
20286 !! test
20287 Handling of &#x0A; in URLs
20288 !! wikitext
20289 *irc://&#x0A;a
20290 !! html/php
20291 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20292
20293 !! html/parsoid
20294 <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>
20295 !! end
20296
20297 !! test
20298 Handling of %0A in URLs
20299 !! wikitext
20300 *irc://%0Aa
20301 !! html/php
20302 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20303
20304 !! html/parsoid
20305 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20306 !! end
20307
20308 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20309 !! test
20310 5 quotes, code coverage +1 line
20311 !! options
20312 parsoid=wt2html
20313 !! wikitext
20314 '''''
20315 !! html/php
20316 !! html/parsoid
20317 <b><i></i></b>
20318 !! end
20319
20320 # same html as previous, but wikitext adjusted to match parsoid html2wt
20321 # note that wt2html and html2html will put the <i> before the <b>
20322 !! test
20323 5 quotes, code coverage +1 line w/ nowiki (1)
20324 !! options
20325 parsoid=wt2wt,html2wt
20326 !! wikitext
20327 '''''<nowiki/>'''''
20328 !! html/php
20329 <p><i></i>
20330 </p>
20331 !! html/parsoid
20332 <p><b><i></i></b></p>
20333 !! end
20334
20335 # same as previous, just swapping the <i> and <b>
20336 !! test
20337 5 quotes, code coverage +1 line w/ nowiki (2)
20338 !! wikitext
20339 '''''<nowiki/>'''''
20340 !! html/php
20341 <p><i></i>
20342 </p>
20343 !! html/parsoid
20344 <p><i><b></b></i></p>
20345 !! end
20346
20347 !! test
20348 Special:Search page linking.
20349 !! wikitext
20350 {{Special:search}}
20351 !! html
20352 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20353 </p>
20354 !! end
20355
20356 !! test
20357 {{!}} is a magic word
20358 !! wikitext
20359 {{!}} is a magic word there and {{!}} is still a magic word here
20360 | is not a magic word here but {{!}} is still a magic word here
20361 !! html/php
20362 <p>| is a magic word there and | is still a magic word here
20363 | is not a magic word here but | is still a magic word here
20364 </p>
20365 !! html/parsoid
20366 <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
20367 | 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>
20368 !! end
20369
20370 !! test
20371 Say the magic word
20372 !! options
20373 title=[[Parser test]]
20374 !! wikitext
20375 *{{PAGENAME}}
20376 *{{PAGENAMEE}}
20377 *{{FULLPAGENAME}}
20378 *{{FULLPAGENAMEE}}
20379 *{{BASEPAGENAME}}
20380 *{{BASEPAGENAMEE}}
20381 *{{SUBPAGENAME}}
20382 *{{SUBPAGENAMEE}}
20383 *{{ROOTPAGENAME}}
20384 *{{ROOTPAGENAMEE}}
20385 *{{TALKPAGENAME}}
20386 *{{TALKPAGENAMEE}}
20387 *{{SUBJECTPAGENAME}}
20388 *{{SUBJECTPAGENAMEE}}
20389 *{{NAMESPACEE}}
20390 *{{NAMESPACE}}
20391 *{{NAMESPACENUMBER}}
20392 *{{TALKSPACE}}
20393 *{{TALKSPACEE}}
20394 *{{SUBJECTSPACE}}
20395 *{{SUBJECTSPACEE}}
20396 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20397 !! html
20398 <ul><li>Parser test</li>
20399 <li>Parser_test</li>
20400 <li>Parser test</li>
20401 <li>Parser_test</li>
20402 <li>Parser test</li>
20403 <li>Parser_test</li>
20404 <li>Parser test</li>
20405 <li>Parser_test</li>
20406 <li>Parser test</li>
20407 <li>Parser_test</li>
20408 <li>Talk:Parser test</li>
20409 <li>Talk:Parser_test</li>
20410 <li>Parser test</li>
20411 <li>Parser_test</li>
20412 <li></li>
20413 <li></li>
20414 <li>0</li>
20415 <li>Talk</li>
20416 <li>Talk</li>
20417 <li></li>
20418 <li></li>
20419 <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>
20420
20421 !! end
20422 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20423
20424 !! test
20425 Gallery with valid attributes
20426 !! wikitext
20427 <gallery type="123" summary="345">
20428 File:File:Foobar.jpg
20429 </gallery>
20430 !! html/php
20431 <ul class="gallery mw-gallery-traditional" type="123">
20432 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20433 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20434 <div class="gallerytext">
20435 </div>
20436 </div></li>
20437 </ul>
20438
20439 !! html/parsoid
20440 <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"}}'>
20441 <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>
20442 </ul>
20443 !! end
20444
20445 ## Parsoid thinks the "centre" here is a property, not a caption.
20446 !! test
20447 Gallery
20448 !! options
20449 parsoid={
20450 "modes": ["wt2html"],
20451 "nativeGallery": true
20452 }
20453 !! wikitext
20454 <gallery>
20455 image1.png |
20456 image2.gif|||||
20457
20458 image3|
20459 image4 |300px| centre
20460 image5.svg| http://///////
20461 [[x|xx]]]]
20462 * image6
20463 </gallery>
20464 !! html/php
20465 <ul class="gallery mw-gallery-traditional">
20466 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20467 <div class="thumb" style="height: 150px;">Image1.png</div>
20468 <div class="gallerytext">
20469 </div>
20470 </div></li>
20471 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20472 <div class="thumb" style="height: 150px;">Image2.gif</div>
20473 <div class="gallerytext">
20474 </div>
20475 </div></li>
20476 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20477 <div class="thumb" style="height: 150px;">Image3</div>
20478 <div class="gallerytext">
20479 </div>
20480 </div></li>
20481 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20482 <div class="thumb" style="height: 150px;">Image4</div>
20483 <div class="gallerytext">
20484 <pre>centre
20485 </pre>
20486 </div>
20487 </div></li>
20488 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20489 <div class="thumb" style="height: 150px;">Image5.svg</div>
20490 <div class="gallerytext">
20491 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20492 </p>
20493 </div>
20494 </div></li>
20495 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20496 <div class="thumb" style="height: 150px;">* image6</div>
20497 <div class="gallerytext">
20498 </div>
20499 </div></li>
20500 </ul>
20501
20502 !! html/parsoid
20503 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20504 <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>
20505 <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>
20506 <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>
20507 <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>
20508 <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>
20509 <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>
20510 </ul>
20511 !! end
20512
20513 !! test
20514 Gallery (with options, html)
20515 !! options
20516 parsoid={
20517 "modes": ["wt2html", "html2html"],
20518 "nativeGallery": true
20519 }
20520 !! wikitext
20521 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20522 File:Nonexistent.jpg|caption
20523 File:Nonexistent.jpg
20524 image:foobar.jpg|some '''caption''' [[Main Page]]
20525 image:foobar.jpg
20526 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20527 </gallery>
20528 !! html/php
20529 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20530 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20531 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20532 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20533 <div class="gallerytext">
20534 <p>caption
20535 </p>
20536 </div>
20537 </div></li>
20538 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20539 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20540 <div class="gallerytext">
20541 </div>
20542 </div></li>
20543 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20544 <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>
20545 <div class="gallerytext">
20546 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20547 </p>
20548 </div>
20549 </div></li>
20550 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20551 <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>
20552 <div class="gallerytext">
20553 </div>
20554 </div></li>
20555 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20556 <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>
20557 <div class="gallerytext">
20558 <p>blabla.
20559 </p>
20560 </div>
20561 </div></li>
20562 </ul>
20563
20564 !! html/parsoid
20565 <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":{}}'>
20566 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20567 <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>
20568 <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>
20569 <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>
20570 <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>
20571 <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>
20572 </ul>
20573 !! end
20574
20575 !! test
20576 Gallery (with options, extsrc)
20577 !! options
20578 parsoid={
20579 "nativeGallery": false
20580 }
20581 !! wikitext
20582 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20583 File:Nonexistent.jpg|caption
20584 File:Nonexistent.jpg
20585 image:foobar.jpg|some '''caption''' [[Main Page]]
20586 image:foobar.jpg
20587 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20588 </gallery>
20589 !! html/php
20590 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20591 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20592 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20593 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20594 <div class="gallerytext">
20595 <p>caption
20596 </p>
20597 </div>
20598 </div></li>
20599 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20600 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20601 <div class="gallerytext">
20602 </div>
20603 </div></li>
20604 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20605 <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>
20606 <div class="gallerytext">
20607 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20608 </p>
20609 </div>
20610 </div></li>
20611 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20612 <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>
20613 <div class="gallerytext">
20614 </div>
20615 </div></li>
20616 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20617 <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>
20618 <div class="gallerytext">
20619 <p>blabla.
20620 </p>
20621 </div>
20622 </div></li>
20623 </ul>
20624
20625 !! html/parsoid
20626 <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"}}'>
20627 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20628 <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>
20629 <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>
20630 <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>
20631 <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>
20632 <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>
20633 </ul>
20634 !! end
20635
20636 !! test
20637 Gallery (without px units)
20638 !! wikitext
20639 <gallery widths="70" heights="40">
20640 File:Foobar.jpg
20641 </gallery>
20642 !! html/php
20643 <ul class="gallery mw-gallery-traditional">
20644 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20645 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="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>
20646 <div class="gallerytext">
20647 </div>
20648 </div></li>
20649 </ul>
20650
20651 !! html/parsoid
20652 <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"}}'>
20653 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
20654 </ul>
20655 !! end
20656
20657 !! test
20658 Gallery (with invalid units)
20659 !! wikitext
20660 <gallery widths="70em" heights="40em">
20661 File:Foobar.jpg
20662 </gallery>
20663 !! html/php
20664 <ul class="gallery mw-gallery-traditional">
20665 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20666 <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>
20667 <div class="gallerytext">
20668 </div>
20669 </div></li>
20670 </ul>
20671
20672 !! html/parsoid
20673 <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"}}'>
20674 <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>
20675 </ul>
20676 !! end
20677
20678 !! test
20679 Gallery with link that has fragment
20680 !! options
20681 parsoid={
20682 "modes": ["wt2html", "html2html"],
20683 "nativeGallery": true
20684 }
20685 !! wikitext
20686 <gallery>
20687 image:foobar.jpg|link=Main_Page
20688 image:foobar.jpg|link=Main_Page#section
20689 image:foobar.jpg|link=Main Page#section|caption
20690 </gallery>
20691 !! html/php
20692 <ul class="gallery mw-gallery-traditional">
20693 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20694 <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>
20695 <div class="gallerytext">
20696 </div>
20697 </div></li>
20698 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20699 <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>
20700 <div class="gallerytext">
20701 </div>
20702 </div></li>
20703 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20704 <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>
20705 <div class="gallerytext">
20706 <p>caption
20707 </p>
20708 </div>
20709 </div></li>
20710 </ul>
20711
20712 !! html/parsoid
20713 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20714 <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>
20715 <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>
20716 <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>
20717 </ul>
20718 !! end
20719
20720 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20721 !! test
20722 Gallery with template inside caption
20723 !! options
20724 parsoid={
20725 "nativeGallery": true
20726 }
20727 !! wikitext
20728 <gallery caption="{{echo|hi}}">
20729 File:Foobar.jpg|{{echo|ho}}
20730 </gallery>
20731 !! html/php
20732 <ul class="gallery mw-gallery-traditional">
20733 <li class='gallerycaption'>{{echo|hi}}</li>
20734 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20735 <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>
20736 <div class="gallerytext">
20737 <p>ho
20738 </p>
20739 </div>
20740 </div></li>
20741 </ul>
20742
20743 !! html/parsoid
20744 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20745 <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>
20746 <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>
20747 </ul>
20748 !! end
20749
20750 !! test
20751 Gallery with wikitext inside caption
20752 !! options
20753 parsoid={
20754 "nativeGallery": true
20755 }
20756 !! wikitext
20757 <gallery>
20758 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20759 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20760 </gallery>
20761 !! html/php
20762 <ul class="gallery mw-gallery-traditional">
20763 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20764 <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>
20765 <div class="gallerytext">
20766 <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>
20767 </p>
20768 </div>
20769 </div></li>
20770 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20771 <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>
20772 <div class="gallerytext">
20773 <p>This is a test template
20774 </p>
20775 </div>
20776 </div></li>
20777 </ul>
20778
20779 !! html/parsoid
20780 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20781 <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>
20782 <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>
20783 </ul>
20784 !! end
20785
20786 !! test
20787 Gallery (with showfilename option)
20788 !! options
20789 parsoid={
20790 "nativeGallery": true
20791 }
20792 !! wikitext
20793 <gallery showfilename="">
20794 File:Nonexistent.jpg|caption
20795 File:Nonexistent.jpg
20796 File:Foobar.jpg|some '''caption''' [[Main Page]]
20797 File:Foobar.jpg
20798 </gallery>
20799 !! html/php
20800 <ul class="gallery mw-gallery-traditional">
20801 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20802 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20803 <div class="gallerytext">
20804 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20805 caption
20806 </p>
20807 </div>
20808 </div></li>
20809 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20810 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20811 <div class="gallerytext">
20812 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20813 </p>
20814 </div>
20815 </div></li>
20816 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20817 <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>
20818 <div class="gallerytext">
20819 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20820 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20821 </p>
20822 </div>
20823 </div></li>
20824 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20825 <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>
20826 <div class="gallerytext">
20827 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20828 </p>
20829 </div>
20830 </div></li>
20831 </ul>
20832
20833 !! html/parsoid
20834 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20835 <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>
20836 <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>
20837 <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>
20838 <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>
20839 </ul>
20840 !! end
20841
20842 ## Should Parsoid be preserving these variations? See T151367
20843 !! test
20844 Gallery (with namespace-less filenames)
20845 !! options
20846 parsoid={
20847 "modes": ["wt2html", "html2html"],
20848 "nativeGallery": true
20849 }
20850 !! wikitext
20851 <gallery>
20852 File:Nonexistent.jpg
20853 Nonexistent.jpg
20854 image:foobar.jpg
20855 foobar.jpg
20856 </gallery>
20857 !! html/php
20858 <ul class="gallery mw-gallery-traditional">
20859 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20860 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20861 <div class="gallerytext">
20862 </div>
20863 </div></li>
20864 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20865 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20866 <div class="gallerytext">
20867 </div>
20868 </div></li>
20869 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20870 <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>
20871 <div class="gallerytext">
20872 </div>
20873 </div></li>
20874 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20875 <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>
20876 <div class="gallerytext">
20877 </div>
20878 </div></li>
20879 </ul>
20880
20881 !! html/parsoid
20882 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20883 <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>
20884 <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>
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"></div></li>
20886 <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>
20887 </ul>
20888 !! end
20889
20890 !! test
20891 Gallery override link with wikilink (T36852)
20892 !! options
20893 parsoid={
20894 "nativeGallery": true
20895 }
20896 !! wikitext
20897 <gallery>
20898 File:Foobar.jpg|alt=galleryalt|link=Wikilink
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/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>
20904 <div class="gallerytext">
20905 </div>
20906 </div></li>
20907 </ul>
20908
20909 !! html/parsoid
20910 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20911 <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>
20912 </ul>
20913 !! end
20914
20915 !! test
20916 Gallery override link with absolute external link (T36852)
20917 !! options
20918 parsoid={
20919 "nativeGallery": true
20920 }
20921 !! wikitext
20922 <gallery>
20923 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20924 </gallery>
20925 !! html/php
20926 <ul class="gallery mw-gallery-traditional">
20927 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20928 <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>
20929 <div class="gallerytext">
20930 </div>
20931 </div></li>
20932 </ul>
20933
20934 !! html/parsoid
20935 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20936 <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>
20937 </ul>
20938 !! end
20939
20940 !! test
20941 Gallery override link with absolute external link with LanguageConverter
20942 !! options
20943 language=zh
20944 !! wikitext
20945 <gallery>
20946 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20947 </gallery>
20948 !! html/php
20949 <ul class="gallery mw-gallery-traditional">
20950 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20951 <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>
20952 <div class="gallerytext">
20953 <p>caption
20954 </p>
20955 </div>
20956 </div></li>
20957 </ul>
20958
20959 !! html/parsoid
20960 <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"}}'>
20961 <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>
20962 </ul>
20963 !! end
20964
20965 !! test
20966 Gallery override link with malicious javascript (T36852)
20967 !! options
20968 parsoid={
20969 "modes": ["wt2html", "html2html"],
20970 "nativeGallery": true
20971 }
20972 !! wikitext
20973 <gallery>
20974 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20975 </gallery>
20976 !! html/php
20977 <ul class="gallery mw-gallery-traditional">
20978 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20979 <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>
20980 <div class="gallerytext">
20981 </div>
20982 </div></li>
20983 </ul>
20984
20985 !! html/parsoid
20986 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20987 <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>
20988 </ul>
20989 !! end
20990
20991 # Note that parsoid uses the invalid link as a caption, PHP does not.
20992 !! test
20993 Gallery with invalid title as link (T45964)
20994 !! options
20995 parsoid={
20996 "modes": ["wt2html", "html2html"],
20997 "nativeGallery": true
20998 }
20999 !! wikitext
21000 <gallery>
21001 File:Foobar.jpg|link=<
21002 </gallery>
21003 !! html/php
21004 <ul class="gallery mw-gallery-traditional">
21005 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21006 <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>
21007 <div class="gallerytext">
21008 </div>
21009 </div></li>
21010 </ul>
21011
21012 !! html/parsoid
21013 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21014 <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>
21015 </ul>
21016 !! end
21017
21018 !! test
21019 Serialize gallery without attrs in data-mw
21020 !! options
21021 parsoid={
21022 "modes": ["html2wt"],
21023 "nativeGallery": true
21024 }
21025 !! html/parsoid
21026 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
21027 <li class="gallerycaption">123</li>
21028 <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>
21029 </ul>
21030 !! wikitext
21031 <gallery caption="123">
21032 File:Test.png
21033 </gallery>
21034 !! end
21035
21036 !! test
21037 Gallery with class and style attributes
21038 !! options
21039 parsoid={
21040 "nativeGallery": true
21041 }
21042 !! wikitext
21043 <gallery class="center" style="text-align: center;">
21044 File:Foobar.jpg
21045 </gallery>
21046 !! html/php
21047 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
21048 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21049 <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>
21050 <div class="gallerytext">
21051 </div>
21052 </div></li>
21053 </ul>
21054
21055 !! html/parsoid
21056 <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":{}}'>
21057 <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>
21058 </ul>
21059 !! end
21060
21061 !! test
21062 Gallery in slideshow mode
21063 !! options
21064 parsoid={
21065 "nativeGallery": true
21066 }
21067 !! wikitext
21068 <gallery mode="slideshow" showthumbnails="">
21069 File:Foobar.jpg
21070 </gallery>
21071 !! html/php
21072 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
21073 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21074 <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>
21075 <div class="gallerytext">
21076 </div>
21077 </div></li>
21078 </ul>
21079
21080 !! html/parsoid
21081 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
21082 <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>
21083 </ul>
21084 !! end
21085
21086 !! test
21087 Serialize gallery image captions on a line
21088 !! options
21089 parsoid={
21090 "modes": ["html2wt"],
21091 "nativeGallery": true
21092 }
21093 !! html/parsoid
21094 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21095 <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>
21096 <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>
21097 </ul>
21098 !! wikitext
21099 <gallery>
21100 File:Foobar.jpg| hi ho
21101 File:Foobar.jpg|hi<br />ho
21102 </gallery>
21103 !! end
21104
21105 !! test
21106 HTML Hex character encoding (spells the word "JavaScript")
21107 !! options
21108 parsoid=wt2html,wt2wt,html2html
21109 !! wikitext
21110 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
21111 !! html/php
21112 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
21113 </p>
21114 !! html/parsoid
21115 <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>
21116 !! end
21117
21118 !! test
21119 HTML Hex character encoding bogus encoding (T28437 regression check)
21120 !! wikitext
21121 &#xsee;&#XSEE;
21122 !! html
21123 <p>&amp;#xsee;&amp;#XSEE;
21124 </p>
21125 !! end
21126
21127 !! test
21128 HTML Hex character encoding mixed case
21129 !! options
21130 parsoid=wt2html,wt2wt,html2html
21131 !! wikitext
21132 &#xEE;&#Xee;
21133 !! html/php
21134 <p>&#xee;&#xee;
21135 </p>
21136 !! html/parsoid
21137 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
21138 !! end
21139
21140 # See: https://www.w3.org/TR/html5/syntax.html#character-references
21141 # Note that U+000C (form feed) is not a valid XML character, so
21142 # it is banned even though allowed in HTML5.
21143 !! test
21144 Illegal character references (T106578)
21145 !! wikitext
21146 ; Null: &#00;
21147 ; FF: &#xC;
21148 ; CR: &#xD;
21149 ; Control (low): &#8;
21150 ; Control (high): &#x7F; &#x9F;
21151 ; Surrogate: &#xD83D;&#xDCA9;
21152 ; This is an okay astral character: &#x1F4A9;
21153 !! html+tidy
21154 <dl><dt>Null</dt>
21155 <dd>&amp;#00;</dd>
21156 <dt>FF</dt>
21157 <dd>&amp;#xC;</dd>
21158 <dt>CR</dt>
21159 <dd>&amp;#xD;</dd>
21160 <dt>Control (low)</dt>
21161 <dd>&amp;#8;</dd>
21162 <dt>Control (high)</dt>
21163 <dd>&amp;#x7F; &amp;#x9F;</dd>
21164 <dt>Surrogate</dt>
21165 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
21166 <dt>This is an okay astral character</dt>
21167 <dd>&#x1f4a9;</dd></dl>
21168 !! end
21169
21170 !! test
21171 __FORCETOC__ override
21172 !! wikitext
21173 __NEWSECTIONLINK__
21174 __FORCETOC__
21175 !! html/php
21176 <p><br />
21177 </p>
21178 !! end
21179
21180 !! test
21181 ISBN code coverage
21182 !! wikitext
21183 ISBN 978-0-1234-56&#x20;789
21184 !! html/php
21185 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21186 </p>
21187 !! html/parsoid
21188 <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>
21189 !! end
21190
21191 !! test
21192 ISBN followed by 5 spaces
21193 !! wikitext
21194 ISBN
21195 !! html
21196 <p>ISBN
21197 </p>
21198 !! end
21199
21200 !! test
21201 Double ISBN
21202 !! wikitext
21203 ISBN ISBN 1234567890
21204 !! html/php
21205 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21206 </p>
21207 !! html/parsoid
21208 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21209 !! end
21210
21211 # Uppercase X and lowercase x as well
21212 !! test
21213 ISBN with an X
21214 !! wikitext
21215 ISBN 3-462-04561-X
21216 ISBN 3-462-04561-x
21217 ISBN 080442957X
21218 ISBN 080442957x
21219 ISBN 978080442957X
21220 ISBN 978080442957x
21221 !! html/php
21222 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21223 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21224 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21225 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21226 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21227 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21228 </p>
21229 !! html/parsoid
21230 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21231 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21232 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21233 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21234 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21235 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21236 !! end
21237
21238 !! test
21239 ISBN with empty prefix (parsoid test)
21240 !! wikitext
21241 ISBN 1234567890
21242 !! html/php
21243 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21244 </p>
21245 !! html/parsoid
21246 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21247 !! end
21248
21249 !! test
21250 T24905: <abbr> followed by ISBN followed by </a>
21251 !! wikitext
21252 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21253 !! html/php
21254 <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>
21255 </p>
21256 !! html/parsoid
21257 <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>
21258 !! end
21259
21260 !! test
21261 Double RFC
21262 !! wikitext
21263 RFC RFC 1234
21264 !! html/php
21265 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21266 </p>
21267 !! html/parsoid
21268 <p>RFC <a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
21269 !! end
21270
21271 !! test
21272 Double RFC with a wiki link
21273 !! wikitext
21274 RFC [[RFC 1234]]
21275 !! html/php
21276 <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>
21277 </p>
21278 !! html/parsoid
21279 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234" title="RFC 1234">RFC 1234</a></p>
21280 !! end
21281
21282 !! test
21283 RFC code coverage
21284 !! wikitext
21285 RFC 983&#x20;987
21286 !! html/php
21287 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21288 </p>
21289 !! html/parsoid
21290 <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>
21291 !! end
21292
21293 !! test
21294 Centre-aligned image
21295 !! wikitext
21296 [[Image:foobar.jpg|centre]]
21297 !! html/php
21298 <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>
21299
21300 !! html/parsoid
21301 <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>
21302 !! end
21303
21304 !! test
21305 None-aligned image
21306 !! wikitext
21307 [[Image:foobar.jpg|none]]
21308 !! html/php
21309 <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>
21310
21311 !! html/parsoid
21312 <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>
21313 !! end
21314
21315 !! test
21316 Width + Height sized image (using px) (height is ignored)
21317 !! wikitext
21318 [[Image:foobar.jpg|640x480px]]
21319 !! html/php
21320 <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>
21321 </p>
21322 !! html/parsoid
21323 <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>
21324 !! end
21325
21326 !! test
21327 Width-sized image (using px, no following whitespace)
21328 !! wikitext
21329 [[Image:foobar.jpg|640px]]
21330 !! html/php
21331 <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>
21332 </p>
21333 !! html/parsoid
21334 <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>
21335 !! end
21336
21337 !! test
21338 Width-sized image (using px, with following whitespace - test regression from r39467)
21339 !! wikitext
21340 [[Image:foobar.jpg|640px ]]
21341 !! html/php
21342 <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>
21343 </p>
21344 !! html/parsoid
21345 <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>
21346 !!end
21347
21348 !! test
21349 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21350 !! wikitext
21351 [[Image:foobar.jpg| 640px]]
21352 !! html/php
21353 <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>
21354 </p>
21355 !! html/parsoid
21356 <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>
21357 !! end
21358
21359 !! test
21360 Image with page parameter
21361 !! options
21362 djvu
21363 !! wikitext
21364 [[File:LoremIpsum.djvu|page=2]]
21365 !! html/php
21366 <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>
21367 </p>
21368 !! html/parsoid
21369 <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>
21370 !! end
21371
21372 !! test
21373 Another italics / bold test
21374 !! wikitext
21375 ''' ''x'
21376 !! html
21377 <pre>'<i> </i>x'
21378 </pre>
21379 !!end
21380
21381 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21382 !! test
21383 dt/dd/dl test
21384 !! wikitext
21385 :;;;::
21386 !! html/php
21387 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21388
21389 !! html/parsoid
21390 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21391
21392 !!end
21393
21394 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21395 !! test
21396 Images with the "|" character in the comment
21397 !! wikitext
21398 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21399 !! html/php
21400 <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>
21401
21402 !! html/parsoid
21403 <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>
21404 !! end
21405
21406 !! test
21407 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21408 !! wikitext
21409 <html><script>alert(1);</script></html>
21410 !! html
21411 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21412 </p>
21413 !! end
21414
21415 !! test
21416 HTML with raw HTML ($wgRawHtml==true)
21417 !! options
21418 wgRawHtml=1
21419 !! wikitext
21420 <html><script>alert(1);</script></html>
21421 !! html/php
21422 <p><script>alert(1);</script>
21423 </p>
21424 !! end
21425
21426 !! test
21427 Parents of subpages, one level up
21428 !! options
21429 subpage title=[[Subpage test/L1/L2/L3]]
21430 !! wikitext
21431 [[../|L2]]
21432 !! html
21433 <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>
21434 </p>
21435 !! end
21436
21437
21438 !! test
21439 Parents of subpages, one level up, not named
21440 !! options
21441 subpage title=[[Subpage test/L1/L2/L3]]
21442 !! wikitext
21443 [[../]]
21444 !! html
21445 <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>
21446 </p>
21447 !! end
21448
21449
21450
21451 !! test
21452 Parents of subpages, two levels up
21453 !! options
21454 subpage title=[[Subpage test/L1/L2/L3]]
21455 !! wikitext
21456 [[../../|L1]]2
21457
21458 [[../../|L1]]l
21459 !! html
21460 <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
21461 </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>
21462 </p>
21463 !! end
21464
21465 !! test
21466 Parents of subpages, two levels up, without trailing slash or name.
21467 !! options
21468 subpage title=[[Subpage test/L1/L2/L3]]
21469 !! wikitext
21470 [[../..]]
21471 !! html
21472 <p>[[../..]]
21473 </p>
21474 !! end
21475
21476 !! test
21477 Parents of subpages, two levels up, with lots of extra trailing slashes.
21478 !! options
21479 subpage title=[[Subpage test/L1/L2/L3]]
21480 !! wikitext
21481 [[../../////]]
21482 !! html
21483 <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>
21484 </p>
21485 !! end
21486
21487 !! article
21488 Subpage test/L1/L2/L3Sibling
21489 !! text
21490 Sibling article
21491 !! endarticle
21492
21493 !! test
21494 Transclusion of a sibling page (one level up)
21495 !! options
21496 subpage title=[[Subpage test/L1/L2/L3]]
21497 !! wikitext
21498 {{../L3Sibling}}
21499 !! html
21500 <p>Sibling article
21501 </p>
21502 !! end
21503
21504 !! test
21505 Transclusion of a child page
21506 !! options
21507 subpage title=[[Subpage test/L1/L2]]
21508 !! wikitext
21509 {{/L3Sibling}}
21510 !! html
21511 <p>Sibling article
21512 </p>
21513 !! end
21514
21515 # This is wt2html only in Parsoid because we add <nowiki>
21516 # because of {{..}} and we don't expect to fix that to
21517 # eliminate the nowikis selective for {{..}} markup.
21518 !! test
21519 Non-transclusion because of too many up levels
21520 !! options
21521 subpage title=[[Subpage test/L1/L2/L3]]
21522 parsoid=wt2html
21523 !! wikitext
21524 {{../../../../More than parent}}
21525 !! html/php
21526 <p>{{../../../../More than parent}}
21527 </p>
21528 !! html/parsoid
21529 <p>{{../../../../More than parent}}</p>
21530 !! end
21531
21532 !! test
21533 Definition list code coverage
21534 !! wikitext
21535 ;title :def
21536 ;title :def
21537 ;title:def
21538 !! html/php
21539 <dl><dt>title &#160;</dt>
21540 <dd>def</dd>
21541 <dt>title&#160;</dt>
21542 <dd>def</dd>
21543 <dt>title</dt>
21544 <dd>def</dd></dl>
21545
21546 !! html/parsoid
21547 <dl><dt>title <span typeof="mw:Placeholder"> </span></dt><dd>def</dd>
21548 <dt>title<span typeof="mw:Placeholder"> </span></dt><dd>def</dd>
21549 <dt>title</dt><dd>def</dd></dl>
21550 !! end
21551
21552 !! test
21553 Don't fall for the self-closing div
21554 !! wikitext
21555 <div>hello world</div/>
21556 !! html
21557 <div>hello world</div>
21558
21559 !! end
21560
21561 !! test
21562 MSGNW magic word
21563 !! wikitext
21564 {{MSGNW:msg}}
21565 !! html/php
21566 <p>&#91;&#91;:Template:Msg&#93;&#93;
21567 </p>
21568 !! end
21569
21570 !! test
21571 RAW magic word
21572 !! wikitext
21573 {{RAW:QUERTY}}
21574 !! html
21575 <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>
21576 </p>
21577 !! end
21578
21579 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21580 !! test
21581 Always escape literal '>' in output, not just after '<'
21582 !! wikitext
21583 ><>
21584 !! html
21585 <p>&gt;&lt;&gt;
21586 </p>
21587 !! end
21588
21589 !! test
21590 Template caching
21591 !! wikitext
21592 {{Test}}
21593 {{Test}}
21594 !! html
21595 <p>This is a test template
21596 This is a test template
21597 </p>
21598 !! end
21599
21600
21601 !! article
21602 MediaWiki:Fake
21603 !! text
21604 ==header==
21605 !! endarticle
21606
21607 !! test
21608 Inclusion of !userCanEdit() content
21609 !! wikitext
21610 {{MediaWiki:Fake}}
21611 !! html
21612 <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>
21613
21614 !! end
21615
21616
21617 !! test
21618 Out-of-order TOC heading levels
21619 !! wikitext
21620 ==2==
21621 ======6======
21622 ===3===
21623 =1=
21624 =====5=====
21625 ==2==
21626 !! html
21627 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
21628 <ul>
21629 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21630 <ul>
21631 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21632 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21633 </ul>
21634 </li>
21635 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21636 <ul>
21637 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21638 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21639 </ul>
21640 </li>
21641 </ul>
21642 </div>
21643
21644 <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>
21645 <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>
21646 <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>
21647 <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>
21648 <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>
21649 <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>
21650
21651 !! end
21652
21653
21654 !! test
21655 ISBN with a dummy number
21656 !! wikitext
21657 ISBN ---
21658 !! html
21659 <p>ISBN ---
21660 </p>
21661 !! end
21662
21663
21664 !! test
21665 ISBN with space-delimited number
21666 !! wikitext
21667 ISBN 92 9017 032 8
21668 !! html/php
21669 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21670 </p>
21671 !! html/parsoid
21672 <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>
21673 !! end
21674
21675
21676 !! test
21677 ISBN with multiple spaces, no number
21678 !! wikitext
21679 ISBN foo
21680 !! html
21681 <p>ISBN foo
21682 </p>
21683 !! end
21684
21685
21686 !! test
21687 ISBN length
21688 !! wikitext
21689 ISBN 123456789
21690
21691 ISBN 1234567890
21692
21693 ISBN 12345678901
21694 !! html/php
21695 <p>ISBN 123456789
21696 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21697 </p><p>ISBN 12345678901
21698 </p>
21699 !! html/parsoid
21700 <p>ISBN 123456789</p>
21701
21702 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21703
21704 <p>ISBN 12345678901</p>
21705 !! end
21706
21707
21708 !! test
21709 ISBN with trailing year (T9110)
21710 !! wikitext
21711 ISBN 1-234-56789-0 - 2006
21712
21713 ISBN 1 234 56789 0 - 2006
21714 !! html/php
21715 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21716 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21717 </p>
21718 !! html/parsoid
21719 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21720
21721 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21722 !! end
21723
21724
21725 !! test
21726 anchorencode
21727 !! config
21728 wgFragmentMode=[ 'html5', 'legacy' ]
21729 !! wikitext
21730 {{anchorencode:foo bar©#%n}}
21731 !! html/php
21732 <p>foo_bar©#%n
21733 </p>
21734 !! html/parsoid
21735 <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>
21736 !! end
21737
21738 !! test
21739 anchorencode (legacy)
21740 !! config
21741 wgFragmentMode=[ 'legacy' ]
21742 !! wikitext
21743 {{anchorencode:foo bar©#%n}}
21744 !! html/php
21745 <p>foo_bar.C2.A9.23.25n
21746 </p>
21747 !! end
21748
21749 !! test
21750 anchorencode trims spaces
21751 !! config
21752 wgFragmentMode=[ 'html5', 'legacy' ]
21753 !! wikitext
21754 {{anchorencode: __pretty__please__}}
21755 !! html/php
21756 <p>pretty_please
21757 </p>
21758 !! html/parsoid
21759 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
21760 !! end
21761
21762 !! test
21763 anchorencode deals with links
21764 !! config
21765 wgFragmentMode=[ 'html5', 'legacy' ]
21766 !! wikitext
21767 {{anchorencode: [[hello|world]] [[hi]]}}
21768 !! html/php
21769 <p>world_hi
21770 </p>
21771 !! html/parsoid
21772 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
21773 !! end
21774
21775 !! test
21776 anchorencode deals with templates
21777 !! config
21778 wgFragmentMode=[ 'html5', 'legacy' ]
21779 !! wikitext
21780 {{anchorencode: {{Foo}} x}}
21781 !! html/php
21782 <p>FOO_x
21783 </p>
21784 !! html/parsoid
21785 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
21786 !! end
21787
21788 !! test
21789 anchorencode encodes like the TOC generator: (T20431)
21790 !! config
21791 wgFragmentMode=[ 'html5', 'legacy' ]
21792 !! wikitext
21793 ===_ +:.3A%3A _ &&amp;]] x===
21794 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
21795 __NOEDITSECTION__
21796 !! html/php
21797 <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>
21798 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
21799 </p>
21800 !! html/parsoid
21801 <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>
21802 <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>
21803 <meta property="mw:PageProp/noeditsection"/>
21804 !! end
21805
21806 !! test
21807 anchorencode encodes like the TOC generator: (T20431) (legacy)
21808 !! config
21809 wgFragmentMode=[ 'legacy' ]
21810 !! wikitext
21811 ===_ +:.3A%3A&&amp;]]===
21812 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21813 __NOEDITSECTION__
21814 !! html/php
21815 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21816 <p>.2B:.3A.253A.26.26.5D.5D
21817 </p>
21818 !! end
21819
21820 !! test
21821 T8200: blockquotes and paragraph formatting
21822 !! wikitext
21823 <blockquote>
21824 foo
21825 </blockquote>
21826
21827 bar
21828
21829 baz
21830 !! html
21831 <blockquote>
21832 <p>foo
21833 </p>
21834 </blockquote>
21835 <p>bar
21836 </p>
21837 <pre>baz
21838 </pre>
21839 !! end
21840
21841 !! test
21842 T10293: Use of center tag ruins paragraph formatting
21843 !! wikitext
21844 <center>
21845 foo
21846 </center>
21847
21848 bar
21849
21850 baz
21851 !! html
21852 <center>
21853 <p>foo
21854 </p>
21855 </center>
21856 <p>bar
21857 </p>
21858 <pre>baz
21859 </pre>
21860 !! end
21861
21862 !!test
21863 Parsing of overlapping (improperly nested) inline html tags
21864 !! wikitext
21865 <span><s>x</span></s>
21866 !! html/php
21867 <p><span><s>x&lt;/span&gt;</s></span>
21868 </p>
21869 !! html/parsoid
21870 <p><span><s>x</s></span>
21871 </p>
21872 !!end
21873
21874 ###
21875 ### Language variants related tests
21876 ###
21877
21878 # Parsoid does not mark self-links.
21879 # Parsoid does not convert links; PHP will do any necessary redirects.
21880
21881 !! test
21882 Self-link in language variants
21883 !! options
21884 title=[[Dunav]] language=sr
21885 !! wikitext
21886 Both [[Dunav]] and [[Дунав]] are names for this river.
21887 !! html/php
21888 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21889 </p>
21890 !! html/parsoid
21891 <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>
21892 !! end
21893
21894 !! article
21895 Дуна
21896 !! text
21897 content
21898 !! endarticle
21899
21900 !! test
21901 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21902 !! options
21903 title=[[Duna]] language=sr
21904 !! wikitext
21905 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21906 !! html/php
21907 <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.
21908 </p>
21909 !! html/parsoid
21910 <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>
21911 !! end
21912
21913 !! test
21914 Link to a section of a variant of this title shouldn't be parsed as self-link
21915 !! options
21916 title=[[Duna]] language=sr
21917 !! wikitext
21918 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21919 !! html/php
21920 <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.
21921 </p>
21922 !! html/parsoid
21923 <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>
21924 !! end
21925
21926 !! test
21927 Link to pages in language variants
21928 !! options
21929 language=sr
21930 !! wikitext
21931 Main Page can be written as [[Маин Паге]]
21932 !! html/php
21933 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21934 </p>
21935 !! html/parsoid
21936 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
21937 !! end
21938
21939
21940 !! test
21941 Multiple links to pages in language variants
21942 !! options
21943 language=sr
21944 !! wikitext
21945 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21946 !! html/php
21947 <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>.
21948 </p>
21949 !! html/parsoid
21950 <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>
21951 !! end
21952
21953
21954 !! test
21955 Simple template in language variants
21956 !! options
21957 language=sr
21958 !! wikitext
21959 {{тест}}
21960 !! html/php
21961 <p>This is a test template
21962 </p>
21963 !! end
21964
21965
21966 !! test
21967 Template with explicit namespace in language variants
21968 !! options
21969 language=sr
21970 !! wikitext
21971 {{Template:тест}}
21972 !! html/php
21973 <p>This is a test template
21974 </p>
21975 !! end
21976
21977
21978 !! test
21979 Basic test for template parameter in language variants
21980 !! options
21981 language=sr
21982 !! wikitext
21983 {{парамтест|param=foo}}
21984 !! html/php
21985 <p>This is a test template with parameter foo
21986 </p>
21987 !! end
21988
21989 !! test
21990 Simple category in language variants
21991 !! options
21992 language=sr cat
21993 !! wikitext
21994 [[Category:МедиаWики Усер'с Гуиде]]
21995 !! html/php
21996 cat=МедиаWики_Усер'с_Гуиде sort=
21997 !! html/parsoid
21998 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21999 !! end
22000
22001 !! article
22002 Category:分类
22003 !! text
22004 blah
22005 !! endarticle
22006
22007 !! article
22008 Category:分類
22009 !! text
22010 blah
22011 !! endarticle
22012
22013 ## We used to, but no longer wt2wt this test since the default serializer
22014 ## will normalize all categories to serialize on their own line.
22015 ## This wikitext usage is going to be fairly uncommon in production and
22016 ## selser will take care of preserving formatting in those scenarios.
22017 !! test
22018 Don't convert blue categorylinks to another variant (T35210)
22019 !! options
22020 cat
22021 language=zh
22022 parsoid=wt2html
22023 !! wikitext
22024 [[A]][[Category:分类]]
22025 !! html/php
22026 cat=分类 sort=
22027 !! html/parsoid
22028 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
22029 <link rel="mw:PageProp/Category" href="./Category:分类"/>
22030 !! end
22031
22032 !! test
22033 Stripping -{}- tags (language variants)
22034 !! options
22035 language=sr
22036 !! wikitext
22037 Latin proverb: -{Ne nuntium necare}-
22038 !! html/php
22039 <p>Latin proverb: Ne nuntium necare
22040 </p>
22041 !! html/parsoid
22042 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22043 !! end
22044
22045
22046 !! test
22047 Prevent conversion with -{}- tags (language variants)
22048 !! options
22049 language=sr variant=sr-ec
22050 !! wikitext
22051 Latinski: -{Ne nuntium necare}-
22052 !! html/php
22053 <p>Латински: Ne nuntium necare
22054 </p>
22055 !! html/parsoid
22056 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22057 !! end
22058
22059
22060 !! test
22061 Prevent conversion of text with -{}- tags (language variants)
22062 !! options
22063 language=sr variant=sr-ec
22064 !! wikitext
22065 Latinski: -{Ne nuntium necare}-
22066 !! html/php
22067 <p>Латински: Ne nuntium necare
22068 </p>
22069 !! html/parsoid
22070 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22071 !! end
22072
22073
22074 !! test
22075 Prevent conversion of links with -{}- tags (language variants)
22076 !! options
22077 language=sr variant=sr-ec
22078 !! wikitext
22079 -{[[Main Page]]}-
22080 !! html/php
22081 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22082 </p>
22083 !! html/parsoid
22084 <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>
22085 !! end
22086
22087
22088 !! test
22089 -{}- tags within headlines (within html for parserConvert())
22090 !! config
22091 wgFragmentMode=[ 'html5', 'legacy' ]
22092 !! options
22093 language=sr variant=sr-ec
22094 !! wikitext
22095 ==-{Naslov}-==
22096
22097 Note that even an unprotected headline ID is not affected by language
22098 conversion:
22099
22100 ==Latinski==
22101 !! html/php
22102 <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>
22103 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
22104 цонверсион:
22105 </p>
22106 <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>
22107
22108 !! html/parsoid
22109 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
22110
22111 <p>Note that even an unprotected headline ID is not affected by language
22112 conversion:</p>
22113
22114 <h2 id="Latinski">Latinski</h2>
22115 !! end
22116
22117 !! test
22118 Explicit definition of language variant alternatives
22119 !! options
22120 language=zh variant=zh-tw
22121 !! wikitext
22122 -{zh:China;zh-tw:Taiwan}-, not China
22123 !! html/php
22124 <p>Taiwan, not China
22125 </p>
22126 !! html/parsoid
22127 <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>
22128 !! end
22129
22130 !! test
22131 Filter syntax for language variants
22132 !! options
22133 language=zh variant=zh-tw
22134 !! wikitext
22135 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
22136 !! html/php
22137 <p>fooblog, WEBJOURNAL, WEBLOGquux
22138 </p>
22139 !! html/parsoid
22140 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
22141 !! end
22142
22143 # Note that Parsoid post-processing for language variants needs to
22144 # update the `title` attribute here, based on the mw:ExpandedAttrs property
22145 !! test
22146 Conversion around HTML tags
22147 !! options
22148 language=sr variant=sr-ec
22149 !! wikitext
22150 -{H|span=>sr-ec:script;title=>sr-ec:src}-
22151 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
22152 !! html/php
22153 <p>
22154 <span title="ЛаCтин">ски</span>
22155 </p>
22156 !! html/parsoid
22157 <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"}]}'/>
22158 <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>
22159 !! end
22160
22161 !! test
22162 Explicit session-wise two-way language variant mapping (A flag and - flag)
22163 !! options
22164 language=zh variant=zh-tw
22165 !! wikitext
22166 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
22167
22168 Taiwan is not China.
22169
22170 But -{A|zh:China; zh-tw:Taiwan}- is China,
22171
22172 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
22173
22174 and -{China}- is China.
22175 !! html/php
22176 <p>This is Taiwan, but we'll forget that now.
22177 </p><p>Taiwan is not China.
22178 </p><p>But Taiwan is Taiwan,
22179 </p><p>(This should be stripped!)
22180 </p><p>and China is China.
22181 </p>
22182 !! html/parsoid
22183 <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>
22184 <p>Taiwan is not China.</p>
22185 <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>
22186 <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>
22187 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22188 !! end
22189
22190 !! test
22191 Explicit session-wise one-way language variant mapping (A flag and - flag)
22192 !! options
22193 language=zh variant=zh-tw
22194 !! wikitext
22195 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
22196
22197 COUNTRY is China or Taiwan.
22198
22199 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
22200
22201 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22202
22203 and -{COUNTRY}- is COUNTRY.
22204 !! html/php
22205 <p>This is Taiwan, but we'll forget that now.
22206 </p><p>COUNTRY is China or Taiwan.
22207 </p><p>But Taiwan is Taiwan,
22208 </p><p>(This should be stripped!)
22209 </p><p>and COUNTRY is COUNTRY.
22210 </p>
22211 !! html/parsoid
22212 <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>
22213 <p>COUNTRY is China or Taiwan.</p>
22214 <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>
22215 <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>
22216 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22217 !! end
22218
22219 !! test
22220 Explicit session-wise two-way language variant mapping (H flag for hide)
22221 !! options
22222 language=zh variant=zh-tw
22223 !! wikitext
22224 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22225
22226 Taiwan is China.
22227 !! html/php
22228 <p>(This should be stripped!)
22229 </p><p>Taiwan is Taiwan.
22230 </p>
22231 !! html/parsoid
22232 <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>
22233 <p>Taiwan is China.</p>
22234 !! end
22235
22236 !! test
22237 Explicit session-wise one-way language variant mapping (H flag for hide)
22238 !! options
22239 language=zh variant=zh-tw
22240 !! wikitext
22241 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22242
22243 COUNTRY is Taiwan or China.
22244 !! html/php
22245 <p>(This should be stripped!)
22246 </p><p>Taiwan is Taiwan or China.
22247 </p>
22248 !! html/parsoid
22249 <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>
22250 <p>COUNTRY is Taiwan or China.</p>
22251 !! end
22252
22253 ## Note that parsoid test runner does not support 'showtitle' option.
22254 !! test
22255 Adding explicit conversion rule for title (T flag)
22256 !! options
22257 language=zh variant=zh-tw showtitle
22258 !! wikitext
22259 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22260
22261 Taiwan is China.
22262 !! html/php
22263 Taiwan
22264 <p>Should be stripped!
22265 </p><p>Taiwan is China.
22266 </p>
22267 !! html/parsoid
22268 <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>
22269 <p>Taiwan is China.</p>
22270 !! end
22271
22272 !! test
22273 Code coverage: T combined with H flag
22274 !! options
22275 language=zh variant=zh-tw showtitle
22276 !! wikitext
22277 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22278
22279 Taiwan is China.
22280 !! html/php
22281 Taiwan
22282 <p>Should be stripped!
22283 </p><p>Taiwan is Taiwan.
22284 </p>
22285 !! html/parsoid
22286 <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>
22287 <p>Taiwan is China.</p>
22288 !! end
22289
22290 !! test
22291 Code coverage: T with no variants
22292 !! options
22293 language=zh variant=zh-tw showtitle
22294 !! wikitext
22295 -{H|zh:China; zh-tw:Taiwan}-
22296 Taiwan is China.-{T|Taiwan is China}-
22297 !! html/php
22298 Taiwan is China
22299 <p>
22300 Taiwan is Taiwan.
22301 </p>
22302 !! html/parsoid
22303 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22304 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22305 !! end
22306
22307 !! test
22308 Code coverage: rules with no variants
22309 !! options
22310 language=zh variant=zh-tw
22311 !! wikitext
22312 -{H|zh:China; zh-tw:Taiwan}-
22313 Taiwan is China.
22314 -{H|China}-
22315 Taiwan is China.
22316 !! html/php
22317 <p>
22318 Taiwan is Taiwan.
22319
22320 Taiwan is China.
22321 </p>
22322 !! html/parsoid
22323 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22324 Taiwan is China.
22325 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22326 Taiwan is China.</p>
22327 !! end
22328
22329
22330 !! test
22331 Code coverage: D flag for conversion rule
22332 !! options
22333 language=zh variant=zh-tw
22334 !! wikitext
22335 -{D|zh-cn:XA; zh-tw:YA}-
22336 -{A;D|zh-cn:XB; zh-tw:YB}-
22337 -{D;H|zh-cn:XC; zh-tw:YC}-
22338
22339 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22340
22341 -{D|0=>zh-tw:1}-
22342 -{A;D|2=>zh-tw:3}-
22343 -{D;H|4=>zh-tw:5}-
22344
22345 XA XB XC YA YB YC FOO BAR BAT 012345
22346 !! html/php
22347 <p>大陆:XA;台灣:YA;
22348
22349 大陆:XC;台灣:YC;
22350 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22351 </p><p>0⇒台灣:1;
22352
22353 4⇒台灣:5;
22354 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22355 </p>
22356 !! html/parsoid
22357 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22358 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22359 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22360 <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>
22361 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22362 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22363 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22364 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22365 !! end
22366
22367 !! test
22368 Code coverage: N flag for conversion rule
22369 !! options
22370 language=zh variant=zh-cn
22371 !! wikitext
22372 -{N|zh-cn}-
22373
22374 -{N|zh-tw}-
22375
22376 -{N|sr-ec}-
22377 !! html/php
22378 <p>大陆
22379 </p><p>台灣
22380 </p><p>српски (ћирилица)‎
22381 </p>
22382 !! html/parsoid
22383 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22384 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22385 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22386 !! end
22387
22388 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22389 !! test
22390 Code coverage: N flag for conversion rule (wt2html only)
22391 !! options
22392 language=zh variant=zh-cn
22393 parsoid=wt2html,html2html
22394 !! wikitext
22395 -{D;N|en}-
22396 !! html/php
22397 <p>English
22398 </p>
22399 !! html/parsoid
22400 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22401 !! end
22402
22403 !! test
22404 Testing that changing the language variant here in the tests actually works
22405 !! options
22406 language=zh variant=zh showtitle
22407 !! wikitext
22408 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22409 !! html/php
22410 China
22411 <p>Should be stripped!
22412 </p>
22413 !! html/parsoid
22414 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22415 !! end
22416
22417 !! test
22418 Recursive conversion of alt and title attrs shouldn't clear converter state
22419 !! options
22420 language=zh variant=zh-cn
22421 showtitle
22422 !! wikitext
22423 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22424 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22425 !! html/php
22426 China
22427 <p>
22428 Should be stripped<span title="Exclamation">!</span>
22429 </p>
22430 !! html/parsoid
22431 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22432 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>
22433 !! end
22434
22435 !! test
22436 T26072: more test on conversion rule for title
22437 !! options
22438 language=zh variant=zh-tw showtitle
22439 !! wikitext
22440 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22441
22442 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22443 !! html/php
22444 Taiwan
22445 <p>This should be stripped!
22446 </p><p>This won't take interferes with the title rule.
22447 </p>
22448 !! html/parsoid
22449 <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>
22450 <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>
22451 !! end
22452
22453 !! test
22454 Partly disable title conversion if variant == main language code
22455 !! options
22456 language=zh variant=zh title=[[ZH]] showtitle
22457 !! wikitext
22458 -{T|zh-cn:CN;zh-tw:TW}-
22459 !! html/php
22460 ZH
22461 <p>
22462 </p>
22463 !! html/parsoid
22464 <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>
22465 !! end
22466
22467 !! test
22468 Partly disable title conversion if variant == main language code, more
22469 !! options
22470 language=zh variant=zh title=[[ZH]] showtitle
22471 !! wikitext
22472 -{T|TW}-
22473 !! html/php
22474 ZH
22475 <p>
22476 </p>
22477 !! html/parsoid
22478 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22479 !! end
22480
22481 !! test
22482 Raw output of variant escape tags (R flag)
22483 !! options
22484 language=zh variant=zh-tw
22485 !! wikitext
22486 Raw: -{R|zh:China;zh-tw:Taiwan}-
22487 !! html/php
22488 <p>Raw: zh:China;zh-tw:Taiwan
22489 </p>
22490 !! html/parsoid
22491 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22492 !! end
22493
22494 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22495 !! test
22496 Raw output of variant escape tags (R flag) (wt2html only)
22497 !! options
22498 language=zh variant=zh-tw
22499 parsoid=wt2html,html2html
22500 !! wikitext
22501 -{Variant}- -{D|syntax}- -{D;R|options}-
22502 !! html/php
22503 <p>Variant syntax options
22504 </p>
22505 !! html/parsoid
22506 <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>
22507 !! end
22508
22509 !! test
22510 Nested markup inside raw output of variant escape tags (R flag)
22511 !! options
22512 language=zh variant=zh-tw
22513 !! wikitext
22514 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22515 !! html/php
22516 <p>Nested raw: nested Taiwan nested
22517 </p>
22518 !! html/parsoid
22519 <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>
22520 !! end
22521
22522 !! test
22523 Nested markup and spaces inside raw output of variant escape tags (R flag)
22524 !! options
22525 language=zh variant=zh-tw
22526 !! wikitext
22527 X-{ outer -{ inner }- outer }-X
22528 !! html/php
22529 <p>X outer inner outer X
22530 </p>
22531 !! html/parsoid
22532 <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>
22533 !! end
22534
22535 !! test
22536 Templates inside raw output of variant escape tags (R flag)
22537 !! options
22538 language=zh variant=zh-tw
22539 !! wikitext
22540 Nested raw: -{R|nested {{echo|hi}} templates}-
22541 !! html/php
22542 <p>Nested raw: nested hi templates
22543 </p>
22544 !! html/parsoid
22545 <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>
22546 !! end
22547
22548 !! test
22549 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22550 !! options
22551 language=zh variant=zh-cn
22552 !! wikitext
22553 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22554 !! html/php
22555 <p>0
22556 </p>
22557 !! html/parsoid
22558 <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>
22559 !! end
22560
22561 !! test
22562 Conversion rules from [numeric-only string] to [something else] (T48634)
22563 !! options
22564 language=zh variant=zh-cn
22565 !! wikitext
22566 -{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
22567 !! html/php
22568 <p>D12345EE12345
22569 </p>
22570 !! html/parsoid
22571 <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>
22572 !! end
22573
22574 !! test
22575 Two-way converter rule entries with an empty value should be ignored (T53551)
22576 !! options
22577 language=zh variant=zh-cn
22578 !! wikitext
22579 -{H|zh-cn:foo;zh-tw:;}-foobar
22580 !! html/php
22581 <p>foobar
22582 </p>
22583 !! html/parsoid
22584 <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>
22585 !! end
22586
22587 !! test
22588 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22589 !! options
22590 language=zh variant=zh-cn
22591 !! wikitext
22592 -{H|=>zh-cn:foo;}-foobar
22593 !! html/php
22594 <p>foobar
22595 </p>
22596 !! html/parsoid
22597 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22598 !! end
22599
22600 !! test
22601 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22602 !! options
22603 language=zh variant=zh-cn
22604 !! wikitext
22605 -{H|}-foobar
22606 !! html/php
22607 <p>foobar
22608 </p>
22609 !! html/parsoid
22610 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22611 !! end
22612
22613 !! test
22614 Nested using of manual convert syntax
22615 !! options
22616 language=zh variant=zh-hk
22617 !! wikitext
22618 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22619 !! html/php
22620 <p>Nested: Hello Hong Kong!
22621 </p>
22622 !! html/parsoid
22623 <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>
22624 !! end
22625
22626 !! test
22627 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22628 !! options
22629 language=zh variant=zh-cn
22630 !! wikitext
22631 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22632 !! html/php
22633 <p><span title="X">A</span>
22634 </p>
22635 !! html/parsoid
22636 <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>
22637 !! end
22638
22639 !! test
22640 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22641 !! options
22642 language=zh variant=zh-cn
22643 !! wikitext
22644 -{<span title="-{X}-">A</span>}-
22645 !! html/php+disabled
22646 <p><span title="X">A</span>
22647 </p>
22648 !! html/parsoid
22649 <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>
22650 !! end
22651
22652 # Parsoid and PHP disagree on how to parse this example: Parsoid
22653 # insists that the content of a language converter element be a valid
22654 # DOM fragment or attribute string
22655 !! test
22656 Language converter markup with block content
22657 !! options
22658 language=zh variant=zh-cn
22659 !! wikitext
22660 <span>a-{b<div>c}-d
22661
22662 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22663
22664 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22665 !! html/php+tidy
22666 <span>ab<div>cd
22667 <span>ab<div>cd
22668 <span>ad
22669 </span></div></span></div></span>
22670 !! html/parsoid
22671 <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>
22672
22673 <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>
22674
22675 <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>
22676 !! end
22677
22678 !! test
22679 LanguageConverter selser (1)
22680 !! options
22681 language=zh variant=zh-cn
22682 parsoid={
22683 "modes": ["wt2wt", "selser"],
22684 "changes": [
22685 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22686 ]
22687 }
22688 !! wikitext
22689 -{raw}-
22690 !! wikitext/edited
22691 -{edited}-
22692 !! end
22693
22694 !! test
22695 LanguageConverter selser (2)
22696 !! options
22697 language=zh variant=zh-cn
22698 parsoid={
22699 "modes": ["wt2wt", "selser"],
22700 "changes": [
22701 ["span[class='x']", "contents", "text", "-{foo}-"],
22702 ["a", "contents", "text", "-{"],
22703 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22704 ]
22705 }
22706 !! wikitext
22707 <span class="x">TEXT1</span>
22708 [http://example.com TEXT2]
22709 [[Foo|TEXT3]]
22710 {{echo|TEXT4}}
22711 !! wikitext/edited
22712 <span class="x"><nowiki>-{foo}-</nowiki></span>
22713 [http://example.com -{]
22714 [[Foo|<nowiki>-{</nowiki>]]
22715 {{1x|<nowiki>-{</nowiki>}}
22716 !! end
22717
22718 # Tests LanguageVariantText in ConstrainedText
22719 !! test
22720 LanguageConverter selser (3)
22721 !! options
22722 language=zh variant=zh-cn
22723 parsoid={
22724 "modes": ["wt2wt", "selser"],
22725 "changes": [
22726 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22727 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22728 ]
22729 }
22730 !! wikitext
22731 {|
22732 |-
22733 |<span>Foo</span>
22734 |}
22735 !! wikitext/edited
22736 {|
22737 |-
22738 |<nowiki/>-{edited}-
22739 |}
22740 !! end
22741
22742 # Tests LanguageVariantText._fromSelSer
22743 !! test
22744 LanguageConverter selser (4)
22745 !! options
22746 language=zh variant=zh-cn
22747 parsoid={
22748 "modes": ["wt2wt", "selser"],
22749 "changes": [
22750 ["td > span.x", "remove"]
22751 ]
22752 }
22753 !! wikitext
22754 {|
22755 |-
22756 |<span class="x">Foo</span>-{Bar}-
22757 ||<span class="x">Foo</span>-{Bar}-
22758 |}
22759 !! wikitext/edited
22760 {|
22761 |-
22762 |<nowiki/>-{Bar}-
22763 ||-{Bar}-
22764 |}
22765 !! end
22766
22767 # Since Parsoid is starting to emit canonical wikitext for links,
22768 # [http://example.com http://example.com] will not RT back to that
22769 # form anymore.
22770 # Parsoid does not language-convert links (it is done in a
22771 # post-processing step)
22772 !! test
22773 Proper conversion of text in external links
22774 !! options
22775 language=sr variant=sr-ec
22776 parsoid=wt2html
22777 !! wikitext
22778 http://www.google.com
22779 gopher://www.google.com
22780 [http://www.google.com http://www.google.com]
22781 [gopher://www.google.com gopher://www.google.com]
22782 [https://www.google.com irc://www.google.com]
22783 [ftp://www.google.com www.google.com/ftp://dir]
22784 [//www.google.com www.google.com]
22785 !! html/php
22786 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22787 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22788 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
22789 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22790 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22791 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22792 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22793 </p>
22794 !! html/parsoid
22795 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22796 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22797 <a rel="mw:ExtLink" class="external text" href="http://www.google.com">http://www.google.com</a>
22798 <a rel="mw:ExtLink" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22799 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
22800 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22801 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
22802 !! end
22803
22804 !! test
22805 Do not convert roman numbers to language variants
22806 !! options
22807 language=sr variant=sr-ec
22808 !! wikitext
22809 Fridrih IV je car.
22810 !! html/php
22811 <p>Фридрих IV је цар.
22812 </p>
22813 !! html/parsoid
22814 <p>Fridrih IV je car.</p>
22815 !! end
22816
22817 !! test
22818 Unclosed language converter markup "-{"
22819 !! options
22820 language=sr
22821 !! wikitext
22822 -{T|hello
22823 !! html
22824 <p>-{T|hello
22825 </p>
22826 !! end
22827
22828 !! test
22829 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22830 !! options
22831 language=sr
22832 !! wikitext
22833 -{R|=&gt;}-
22834 !! html/php
22835 <p>=&gt;
22836 </p>
22837 !! html/parsoid
22838 <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>
22839 !!end
22840
22841 !! test
22842 Don't break link parsing if language converter markup is in the caption.
22843 !! options
22844 language=sr variant=sr-ec
22845 !! wikitext
22846 [[Main Page|-{R|main page}-]]
22847 !! html/php
22848 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22849 </p>
22850 !! html/parsoid
22851 <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>
22852 !! end
22853
22854 !! test
22855 T146304: Don't break template parsing if language converter markup is in the parameter.
22856 !! options
22857 language=sr variant=sr-ec
22858 !! wikitext
22859 {{echo|-{R|foo}-}}
22860 !! html/php
22861 <p>foo
22862 </p>
22863 !! html/parsoid
22864 <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>
22865 !! end
22866
22867 !! test
22868 T146305: Don't break image parsing if language converter markup is in the caption.
22869 !! options
22870 language=sr
22871 !! wikitext
22872 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
22873 !! html/php
22874 <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>
22875
22876 !! html/parsoid
22877 <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>
22878 !! end
22879
22880 !! test
22881 T146305: Don't break image parsing if nested language converter markup is in the caption.
22882 !! options
22883 language=zh variant=zh-cn
22884 !! wikitext
22885 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
22886 !! html/php
22887 <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>
22888
22889 !! html/parsoid
22890 <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>
22891 !! end
22892
22893 # XXX html2wt disabled because rich markup in alt is not preserved.
22894 !! test
22895 Don't break gallery if language converter markup is inside.
22896 !! options
22897 language=zh
22898 !! wikitext
22899 <gallery>
22900 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
22901 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
22902 </gallery>
22903 !! html/php
22904 <ul class="gallery mw-gallery-traditional">
22905 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22906 <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>
22907 <div class="gallerytext">
22908 <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>
22909 </p>
22910 </div>
22911 </div></li>
22912 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22913 <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>
22914 <div class="gallerytext">
22915 <p>This is a test template
22916 </p>
22917 </div>
22918 </div></li>
22919 </ul>
22920
22921 !! html/parsoid
22922 <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"}}'>
22923 <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>
22924 <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>
22925 </ul>
22926 !! end
22927
22928 !! test
22929 T153135: Don't break list handling if language converter markup is in the item.
22930 !! options
22931 language=zh variant=zh-cn
22932 !! wikitext
22933 ;-{zh-cn:AAA;zh-tw:BBB}-
22934 ;-{R|foo:bar}-
22935 !! html/php
22936 <dl><dt>AAA</dt>
22937 <dt>foo:bar</dt></dl>
22938
22939 !! html/parsoid
22940 <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>
22941 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
22942 </dl>
22943 !! end
22944
22945 // Note that parsoid does not protect colons unless language converter
22946 // markup is properly nested, because it is a backtracking parser.
22947 !! test
22948 T153135: Unclosed markup in definition list (code coverage)
22949 !! options
22950 language=zh variant=zh-cn
22951 !! wikitext
22952 ;<b>foo:bar
22953 ;-{zh-cn:AAA
22954 !! html/php+tidy
22955 <dl><dt><b>foo:bar</b></dt><b>
22956 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
22957 </b></p>
22958 !! html/parsoid
22959 <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}'>
22960 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
22961 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
22962 </b></dl>
22963 !! end
22964
22965 !! test
22966 T153135: Nested language converter markup in definition list (code coverage)
22967 !! options
22968 language=zh variant=zh-cn
22969 !! wikitext
22970 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
22971 !! html/php
22972 <dl><dt>AAA foo:bar bat:baz</dt>
22973 <dd>def</dd></dl>
22974
22975 !! html/parsoid
22976 <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>
22977 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
22978 </dl>
22979 !! end
22980
22981 # html2wt mode disabled due to <nowiki> insertion.
22982 !! test
22983 T153140: Don't break table handling if language converter markup is in the cell.
22984 !! options
22985 language=sr variant=sr-ec
22986 parsoid=wt2html,wt2wt,html2html
22987 !! wikitext
22988 {|
22989 |-
22990 | -{R|B}-
22991 |}
22992 !! html/php
22993 <table>
22994
22995 <tr>
22996 <td>B
22997 </td></tr></table>
22998
22999 !! html/parsoid
23000 <table>
23001 <tbody>
23002 <tr>
23003 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
23004 </tr>
23005 </tbody>
23006 </table>
23007 !! end
23008
23009 !! test
23010 Language converter tricky html2wt cases (1)
23011 !! options
23012 language=sr
23013 parsoid=html2wt,wt2wt
23014 !! html/parsoid
23015 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
23016 !! wikitext
23017 -{<nowiki>}-</nowiki>}-
23018 !! html/php
23019 <p>&#125;-
23020 </p>
23021 !! end
23022
23023 !! test
23024 Language converter tricky html2wt cases (2)
23025 !! options
23026 language=sr
23027 parsoid=html2wt,wt2wt
23028 !! html/parsoid
23029 <p>-{foo}-</p>
23030 !! wikitext
23031 <nowiki>-{foo}-</nowiki>
23032 !! html/php
23033 <p>-&#123;foo&#125;-
23034 </p>
23035 !! end
23036
23037 !! test
23038 Language converter tricky html2wt cases (3)
23039 !! options
23040 language=sr
23041 parsoid=html2wt,wt2wt
23042 !! html/parsoid
23043 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
23044 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
23045 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
23046 !! wikitext
23047 -{R||}-
23048
23049 -{R|R|raw}-
23050
23051 -{<nowiki>-{foo}-</nowiki>}-
23052 !! html/php
23053 <p>|
23054 </p><p>R|raw
23055 </p><p>-&#123;foo&#125;-
23056 </p>
23057 !! end
23058
23059 !! test
23060 Language converter tricky html2wt cases (4)
23061 !! options
23062 language=sr
23063 parsoid=html2wt,wt2wt
23064 !! html/parsoid
23065 <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>
23066 !! wikitext
23067 -{R|{{echo|hey}}}-
23068 !! html/php
23069 <p>hey
23070 </p>
23071 !! end
23072
23073 # Note that the <nowiki> escaping added by parsoid for source text,
23074 # destination text, and language names only works on the PHP side
23075 # for *destination text*. (HTML entity escaping wouldn't work
23076 # any better.) This is probably a bug, at least for source texts.
23077 # (For language names PHP uses a precise regexp based on the languages
23078 # it currently knows have variants, which is fragile since this set
23079 # can grow/shrink over time.)
23080 !! test
23081 Language converter tricky html2wt cases (5)
23082 !! options
23083 language=zh variant=zh-cn
23084 !! html/parsoid
23085 <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>
23086 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
23087 <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>
23088 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
23089 <p>a:b=>c xyz</p>
23090 !! wikitext
23091 -{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
23092
23093 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
23094
23095 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
23096
23097 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
23098
23099 a:b=>c xyz
23100 !! html/php+disabled
23101 <p>foobat;xyz=&gt;zh-cn:abc
23102 </p><p>A
23103 </p><p>0;zh-tw:bar
23104 </p><p>abc
23105 </p><p>a:b=&gt;c 0;zh-tw:bar
23106 </p>
23107 !! end
23108
23109 !! test
23110 T179579: Nowiki and lc interaction
23111 !! options
23112 parsoid=wt2html
23113 language=sr
23114 !! wikitext
23115 -{</nowiki>123}-
23116
23117 -{123<nowiki>|</nowiki>456}-
23118 !! html/parsoid
23119 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
23120
23121 <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>
23122 !! end
23123
23124 !! test
23125 T2529: Uncovered bullet
23126 !! wikitext
23127 *Foo {{bullet}}
23128 !! html
23129 <ul><li>Foo</li>
23130 <li>Bar</li></ul>
23131
23132 !! end
23133
23134 !! test
23135 T2529: Uncovered bullet in a deeply nested list
23136 !! wikitext
23137 *******Foo {{bullet}}
23138 !! html
23139 <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>
23140 <li>Bar</li></ul>
23141
23142 !! end
23143
23144 !! test
23145 T2529: Uncovered table already at line-start
23146 !! wikitext
23147 x
23148
23149 {{table}}
23150 y
23151 !! html
23152 <p>x
23153 </p>
23154 <table>
23155 <tr>
23156 <td>1</td>
23157 <td>2
23158 </td></tr>
23159 <tr>
23160 <td>3</td>
23161 <td>4
23162 </td></tr></table>
23163 <p>y
23164 </p>
23165 !! end
23166
23167 !! test
23168 T2529: Uncovered bullet in parser function result
23169 !! wikitext
23170 *Foo {{lc:{{bullet}} }}
23171 !! html
23172 <ul><li>Foo</li>
23173 <li>bar</li></ul>
23174
23175 !! end
23176
23177 !! test
23178 T7678: Double-parsed template argument
23179 !! wikitext
23180 {{lc:{{{1}}}|hello}}
23181 !! html
23182 <p>{{{1}}}
23183 </p>
23184 !! end
23185
23186 !! test
23187 T7678: Double-parsed template invocation
23188 !! wikitext
23189 {{lc:{{paramtest {{!}} param = hello }} }}
23190 !! html
23191 <p>{{paramtest | param = hello }}
23192 </p>
23193 !! end
23194
23195 !! test
23196 Case insensitivity of parser functions for non-ASCII characters (T10143)
23197 !! options
23198 language=cs
23199 title=[[Main Page]]
23200 !! wikitext
23201 {{PRVNÍVELKÉ:ěščř}}
23202 {{prvnívelké:ěščř}}
23203 {{PRVNÍMALÉ:ěščř}}
23204 {{prvnímalé:ěščř}}
23205 {{MALÁ:ěščř}}
23206 {{malá:ěščř}}
23207 {{VELKÁ:ěščř}}
23208 {{velká:ěščř}}
23209 !! html
23210 <p>Ěščř
23211 Ěščř
23212 ěščř
23213 ěščř
23214 ěščř
23215 ěščř
23216 ĚŠČŘ
23217 ĚŠČŘ
23218 </p>
23219 !! end
23220
23221 !! test
23222 Morwen/13: Unclosed link followed by heading
23223 !! wikitext
23224 [[link
23225 ==heading==
23226 !! html
23227 <p>[[link
23228 </p>
23229 <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>
23230
23231 !! end
23232
23233 !! test
23234 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23235 !! wikitext
23236 {{foo|
23237 =heading=
23238 !! html
23239 <p>{{foo|
23240 </p>
23241 <h1><span class="mw-headline" id="heading">heading</span></h1>
23242
23243 !! end
23244
23245 !! test
23246 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23247 !! wikitext
23248 {{foo|
23249 ==heading==
23250 !! html
23251 <p>{{foo|
23252 </p>
23253 <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>
23254
23255 !! end
23256
23257 !! test
23258 Tildes in comments
23259 !! options
23260 pst
23261 !! wikitext
23262 <!-- ~~~~ -->
23263 !! html/php
23264 <!-- ~~~~ -->
23265 !! end
23266
23267 !! test
23268 Paragraphs inside divs (no extra line breaks)
23269 !! wikitext
23270 <div>Line one
23271
23272 Line two</div>
23273 !! html
23274 <div>Line one
23275 Line two</div>
23276
23277 !! end
23278
23279 !! test
23280 Paragraphs inside divs (extra line break on open)
23281 !! wikitext
23282 <div>
23283 Line one
23284
23285 Line two</div>
23286 !! html
23287 <div>
23288 <p>Line one
23289 </p>
23290 Line two</div>
23291
23292 !! end
23293
23294 !! test
23295 Paragraphs inside divs (extra line break on close)
23296 !! wikitext
23297 <div>Line one
23298
23299 Line two
23300 </div>
23301 !! html
23302 <div>Line one
23303 <p>Line two
23304 </p>
23305 </div>
23306
23307 !! end
23308
23309 !! test
23310 Paragraphs inside divs (extra line break on open and close)
23311 !! wikitext
23312 <div>
23313 Line one
23314
23315 Line two
23316 </div>
23317 !! html
23318 <div>
23319 <p>Line one
23320 </p><p>Line two
23321 </p>
23322 </div>
23323
23324 !! end
23325
23326 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23327 # Parsoid seems to do a better job here since its p-wrapper is probably smarter.
23328 !! test
23329 Nesting tags, paragraphs on lines which begin with <div>
23330 !! wikitext
23331 <div></div><strong>A
23332 B</strong>
23333 !! html/php+tidy
23334 <div></div><p><strong>A
23335 </strong></p><strong></strong><p><strong>B</strong>
23336 </p>
23337 !! html/parsoid
23338 <div></div>
23339 <p><strong>A
23340 B</strong>
23341 </p>
23342 !! end
23343
23344 # T8200: <blockquote> should behave like <div> with respect to line breaks
23345 !! test
23346 T8200: paragraphs inside blockquotes (no extra line breaks)
23347 !! wikitext
23348 <blockquote>Line one
23349
23350 Line two</blockquote>
23351 !! html
23352 <blockquote>Line one
23353 Line two</blockquote>
23354
23355 !! html+tidy
23356 <blockquote><p>Line one
23357 Line two</p></blockquote>
23358 !! end
23359
23360 !! test
23361 T8200: paragraphs inside blockquotes (extra line break on open)
23362 !! wikitext
23363 <blockquote>
23364 Line one
23365
23366 Line two</blockquote>
23367 !! html
23368 <blockquote>
23369 <p>Line one
23370 </p>
23371 Line two</blockquote>
23372
23373 !! html+tidy
23374 <blockquote>
23375 <p>Line one
23376 </p><p>
23377 Line two</p></blockquote>
23378 !! end
23379
23380 # Parsoid's output is broken on this because of Tidy-compatibility cruft
23381 !! test
23382 T8200: paragraphs inside blockquotes (extra line break on close)
23383 !! wikitext
23384 <blockquote>Line one
23385
23386 Line two
23387 </blockquote>
23388 !! html
23389 <blockquote>Line one
23390 <p>Line two
23391 </p>
23392 </blockquote>
23393
23394 !! html+tidy
23395 <blockquote><p>Line one
23396 </p><p>Line two
23397 </p>
23398 </blockquote>
23399 !! end
23400
23401 !! test
23402 T8200: paragraphs inside blockquotes (extra line break on open and close)
23403 !! wikitext
23404 <blockquote>
23405 Line one
23406
23407 Line two
23408 </blockquote>
23409 !! html
23410 <blockquote>
23411 <p>Line one
23412 </p><p>Line two
23413 </p>
23414 </blockquote>
23415
23416 !! end
23417
23418 # FIXME: Why does/should the blockquote+div combo suppress p-wrapping here?
23419 !! test
23420 Paragraphs inside blockquotes/divs (no extra line breaks)
23421 !! wikitext
23422 <blockquote><div>Line one
23423
23424 Line two</div></blockquote>
23425 !! html
23426 <blockquote><div>Line one
23427 Line two</div></blockquote>
23428
23429 !! end
23430
23431 !! test
23432 Paragraphs inside blockquotes/divs (extra line break on open)
23433 !! wikitext
23434 <blockquote><div>
23435 Line one
23436
23437 Line two</div></blockquote>
23438 !! html
23439 <blockquote><div>
23440 <p>Line one
23441 </p>
23442 Line two</div></blockquote>
23443
23444 !! end
23445
23446 !! test
23447 Paragraphs inside blockquotes/divs (extra line break on close)
23448 !! wikitext
23449 <blockquote><div>Line one
23450
23451 Line two
23452 </div></blockquote>
23453 !! html
23454 <blockquote><div>Line one
23455 <p>Line two
23456 </p>
23457 </div></blockquote>
23458
23459 !! end
23460
23461 !! test
23462 Paragraphs inside blockquotes/divs (extra line break on open and close)
23463 !! wikitext
23464 <blockquote><div>
23465 Line one
23466
23467 Line two
23468 </div></blockquote>
23469 !! html
23470 <blockquote><div>
23471 <p>Line one
23472 </p><p>Line two
23473 </p>
23474 </div></blockquote>
23475
23476 !! end
23477
23478 !! test
23479 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23480 !! options
23481 wgLinkHolderBatchSize=0
23482 !! wikitext
23483 [[meatball:1]]
23484 [[meatball:2]]
23485 [[meatball:3]]
23486 !! html
23487 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23488 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23489 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23490 </p>
23491 !! end
23492
23493 !! test
23494 Free external link invading image caption
23495 !! wikitext
23496 [[Image:Foobar.jpg|thumb|http://x|hello]]
23497 !! html/php
23498 <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>
23499
23500 !! html/parsoid
23501 <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>
23502 !! end
23503
23504 !! test
23505 T17196: localised external link numbers
23506 !! options
23507 language=fa
23508 !! wikitext
23509 [http://en.wikipedia.org/]
23510 !! html/php
23511 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23512 </p>
23513 !! html/parsoid
23514 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23515 !! end
23516
23517 !! test
23518 Multibyte character in padleft
23519 !! wikitext
23520 {{padleft:-Hello|7|Æ}}
23521 !! html/php
23522 <p>Æ-Hello
23523 </p>
23524 !! html/parsoid
23525 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23526 !! end
23527
23528 !! test
23529 Multibyte character in padright
23530 !! wikitext
23531 {{padright:Hello-|7|Æ}}
23532 !! html/php
23533 <p>Hello-Æ
23534 </p>
23535 !! html/parsoid
23536 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23537 !! end
23538
23539 !!test
23540 formatdate parser function
23541 !! wikitext
23542 {{#formatdate:2009-03-24}}
23543 !! html
23544 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23545 </p>
23546 !! end
23547
23548 !!test
23549 formatdate parser function, with default format
23550 !! wikitext
23551 {{#formatdate:2009-03-24|mdy}}
23552 !! html
23553 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23554 </p>
23555 !! end
23556
23557 !! test
23558 Spacing of numbers in formatted dates
23559 !! wikitext
23560 {{#formatdate:January 15}}
23561 !! html
23562 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23563 </p>
23564 !! end
23565
23566 !! test
23567 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
23568 !! options
23569 language=nl title=[[MediaWiki:Common.css]]
23570 !! wikitext
23571 {{#formatdate:2009-03-24|dmy}}
23572 !! html
23573 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23574 </p>
23575 !! end
23576
23577 #
23578 #
23579 #
23580
23581 #
23582 # Edit comments
23583 #
23584
23585 !! test
23586 Edit comment with link
23587 !! options
23588 comment
23589 !! wikitext
23590 I like the [[Main Page]] a lot
23591 !! html/php
23592 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23593 !!end
23594
23595 !! test
23596 Edit comment with link and link text
23597 !! options
23598 comment
23599 !! wikitext
23600 I like the [[Main Page|best pages]] a lot
23601 !! html/php
23602 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23603 !!end
23604
23605 !! test
23606 Edit comment with link and link text with suffix
23607 !! options
23608 comment
23609 !! wikitext
23610 I like the [[Main Page|best page]]s a lot
23611 !! html/php
23612 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23613 !!end
23614
23615 !! test
23616 Edit comment with section link (non-local, eg in history list)
23617 !! options
23618 comment title=[[Main Page]]
23619 !! wikitext
23620 /* External links */ removed bogus entries
23621 !! html/php
23622 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23623 !!end
23624
23625 !! test
23626 Edit comment with section link and text before it (non-local, eg in history list)
23627 !! options
23628 comment title=[[Main Page]]
23629 !! wikitext
23630 pre-comment text /* External links */ removed bogus entries
23631 !! html/php
23632 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>
23633 !!end
23634
23635 !! test
23636 Edit comment with section link (local, eg in diff view)
23637 !! options
23638 comment local title=[[Main Page]]
23639 !! wikitext
23640 /* External links */ removed bogus entries
23641 !! html/php
23642 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23643 !!end
23644
23645 !! test
23646 Edit comment with subpage link (T16080)
23647 !! options
23648 comment
23649 subpage
23650 title=[[Subpage test]]
23651 !! wikitext
23652 Poked at a [[/subpage]] here...
23653 !! html/php
23654 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23655 !!end
23656
23657 !! test
23658 Edit comment with subpage link and link text (T16080)
23659 !! options
23660 comment
23661 subpage
23662 title=[[Subpage test]]
23663 !! wikitext
23664 Poked at a [[/subpage|neat little page]] here...
23665 !! html/php
23666 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23667 !!end
23668
23669 !! test
23670 Edit comment with bogus subpage link in non-subpage NS (T16080)
23671 !! options
23672 comment
23673 title=[[Subpage test]]
23674 !! wikitext
23675 Poked at a [[/subpage]] here...
23676 !! html/php
23677 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...
23678 !!end
23679
23680 !! test
23681 Edit comment with bare anchor link (local, as on diff)
23682 !! options
23683 comment
23684 local
23685 title=[[Main Page]]
23686 !! wikitext
23687 [[#section]]
23688 !! html/php
23689 <a href="#section">#section</a>
23690 !! end
23691
23692 !! test
23693 Edit comment with bare anchor link (non-local, as on history)
23694 !! options
23695 comment
23696 title=[[Main Page]]
23697 !! wikitext
23698 [[#section]]
23699 !! html/php
23700 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23701 !! end
23702
23703 !! test
23704 Anchor starting with underscore
23705 !! options
23706 title=[[Foo]]
23707 !! wikitext
23708 [[#_ref|One]]
23709 !! html/php
23710 <p><a href="#_ref">One</a>
23711 </p>
23712 !! html/parsoid
23713 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23714 !! end
23715
23716 !! test
23717 Id starting with underscore
23718 !! wikitext
23719 <div id="_ref"></div>
23720 !! html/*
23721 <div id="_ref"></div>
23722
23723 !! end
23724
23725 !! test
23726 Edit comment with link with more than one pipe (T99346)
23727 !! options
23728 comment
23729 !! wikitext
23730 [[Main Page|Many|pipes]]
23731 !! html/php
23732 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23733 !! end
23734
23735 !! test
23736 Complex edit comment with link with more than one pipe (T99346)
23737 !! options
23738 comment
23739 !! wikitext
23740 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23741 !! html/php
23742 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;
23743 !! end
23744
23745 !! test
23746 Space normalisation on autocomment (T24784)
23747 !! options
23748 comment
23749 title=[[Main Page]]
23750 !! wikitext
23751 /* __hello__world__ */
23752 !! html/php
23753 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23754 !! end
23755
23756 !! test
23757 percent-encoding and + signs in comments (T28410)
23758 !! options
23759 comment
23760 !! wikitext
23761 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23762 !! html/php
23763 <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>
23764 !! end
23765
23766 # Parsoid doesn't support this yet: see T75581
23767 # but it *should* omit the 'src' attribute if the image is bad.
23768 # PHP side of tests was disabled in
23769 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23770 # because of issues in the PHP parserTests infrastructure
23771 # (but the output below is indeed what the PHP side emits)
23772 !! test
23773 Bad images - basic functionality
23774 !! wikitext
23775 [[File:Bad.jpg]]
23776 !! html/php+disabled
23777 !! html/parsoid
23778 <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>
23779 !! end
23780
23781 !! test
23782 Bad images - T18039: text after bad image disappears
23783 !! wikitext
23784 Foo bar
23785 [[File:Bad.jpg]]
23786 Bar foo
23787 !! html/php+disabled
23788 <p>Foo bar
23789 </p><p>Bar foo
23790 </p>
23791 !! html/parsoid
23792 <p>Foo bar
23793 <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>
23794 Bar foo</p>
23795 !! end
23796
23797 !! test
23798 Verify that displaytitle works (T24501) no displaytitle
23799 !! options
23800 showtitle
23801 !! config
23802 wgAllowDisplayTitle=true
23803 wgRestrictDisplayTitle=false
23804 !! wikitext
23805 this is not the the title
23806 !! html/php
23807 Parser test
23808 <p>this is not the the title
23809 </p>
23810 !! end
23811
23812 !! test
23813 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23814 !! options
23815 showtitle
23816 title=[[Screen]]
23817 !! config
23818 wgAllowDisplayTitle=true
23819 wgRestrictDisplayTitle=false
23820 !! wikitext
23821 this is not the the title
23822 {{DISPLAYTITLE:whatever}}
23823 !! html/php
23824 whatever
23825 <p>this is not the the title
23826 </p>
23827 !! end
23828
23829 !! test
23830 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23831 !! options
23832 showtitle
23833 title=[[Screen]]
23834 !! config
23835 wgAllowDisplayTitle=true
23836 wgRestrictDisplayTitle=true
23837 !! wikitext
23838 this is not the the title
23839 {{DISPLAYTITLE:whatever}}
23840 !! html/php
23841 Screen
23842 <p>this is not the the title
23843 </p>
23844 !! end
23845
23846 !! test
23847 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23848 !! options
23849 showtitle
23850 title=[[Screen]]
23851 !! config
23852 wgAllowDisplayTitle=true
23853 wgRestrictDisplayTitle=true
23854 !! wikitext
23855 this is not the the title
23856 {{DISPLAYTITLE:screen}}
23857 !! html/php
23858 screen
23859 <p>this is not the the title
23860 </p>
23861 !! end
23862
23863 !! test
23864 Verify that displaytitle works (T24501) AllowDisplayTitle=false
23865 !! options
23866 showtitle
23867 title=[[Screen]]
23868 !! config
23869 wgAllowDisplayTitle=false
23870 !! wikitext
23871 this is not the the title
23872 {{DISPLAYTITLE:screen}}
23873 !! html/php
23874 Screen
23875 <p>this is not the the title
23876 <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>
23877 </p>
23878 !! end
23879
23880 !! test
23881 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
23882 !! options
23883 showtitle
23884 title=[[Screen]]
23885 !! config
23886 wgAllowDisplayTitle=false
23887 !! wikitext
23888 this is not the the title
23889 !! html/php
23890 Screen
23891 <p>this is not the the title
23892 </p>
23893 !! end
23894
23895 !! test
23896 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
23897 !! options
23898 showtitle
23899 title=[[Screen]]
23900 !! config
23901 wgAllowDisplayTitle=true
23902 wgRestrictDisplayTitle=true
23903 !! wikitext
23904 this is not the the title
23905 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
23906 !! html/php
23907 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
23908 <p>this is not the the title
23909 </p>
23910 !! end
23911
23912 !! test
23913 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
23914 !! options
23915 showtitle
23916 title=[[Screen]]
23917 !! config
23918 wgAllowDisplayTitle=true
23919 wgRestrictDisplayTitle=true
23920 !! wikitext
23921 this is not the the title
23922 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
23923 !! html/php
23924 <span style="color: red;">s</span>creen
23925 <p>this is not the the title
23926 </p>
23927 !! end
23928
23929 !! test
23930 Page status indicators: Empty name is invalid
23931 !! options
23932 showindicators
23933 !! wikitext
23934 <indicator name=" "></indicator>
23935 <indicator></indicator>
23936 !! html/php
23937 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23938 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23939 </p>
23940 !! end
23941
23942 !! test
23943 Page status indicators: Weird syntaxes that are okay
23944 !! options
23945 showindicators
23946 !! wikitext
23947 <indicator name="empty" />
23948 <indicator name="name"></indicator>
23949 !! html/php
23950 empty=
23951 name=
23952 <p><br />
23953 </p>
23954 !! end
23955
23956 !! test
23957 Page status indicators: Torture test
23958 !! options
23959 showindicators
23960 !! wikitext
23961 <indicator name="01">hello world</indicator>
23962 <indicator name="02">[[Main Page]]</indicator>
23963 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
23964 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
23965 <indicator name="05">*foo
23966 *bar</indicator>
23967 <indicator name="06"><nowiki>foo</nowiki></indicator>
23968 <indicator name="07"> Preformatted</indicator>
23969 <indicator name="08"><div>Broken tag</indicator>
23970 <indicator name="09">{| class=wikitable
23971 |cell
23972 |}</indicator>
23973 <indicator name="10">Two
23974
23975 paragraphs</indicator>
23976 !! html/php
23977 01=hello world
23978 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
23979 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" />
23980 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>
23981 05=<ul><li>foo</li>
23982 <li>bar</li></ul>
23983
23984 06=foo
23985 07=<pre>Preformatted
23986 </pre>
23987 08=<div>Broken tag</div>
23988
23989 09=<table class="wikitable">
23990 <tr>
23991 <td>cell
23992 </td></tr></table>
23993
23994 10=<p>Two
23995 </p><p>paragraphs
23996 </p>
23997 <p><br />
23998 </p><p><br />
23999 </p><p><br />
24000 </p><p><br />
24001 </p><p><br />
24002 </p>
24003 !! end
24004
24005 !! test
24006 preload: check <noinclude> and <includeonly>
24007 !! options
24008 preload
24009 !! wikitext
24010 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
24011 !! html/php
24012 Hello kind world.
24013 !! end
24014
24015 !! test
24016 preload: check <onlyinclude>
24017 !! options
24018 preload
24019 !! wikitext
24020 Goodbye <onlyinclude>Hello world</onlyinclude>
24021 !! html/php
24022 Hello world
24023 !! end
24024
24025 !! test
24026 preload: can pass tags through if we want to
24027 !! options
24028 preload
24029 !! wikitext
24030 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
24031 !! html/php
24032 <includeonly>Hello world</includeonly>
24033 !! end
24034
24035 !! test
24036 preload: check that it doesn't try to do tricks
24037 !! options
24038 preload
24039 !! wikitext
24040 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24041 !! html/php
24042 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24043 !! end
24044
24045 !! test
24046 Play a bit with r67090 and T5158
24047 !! wikitext
24048 <div style="width:50% !important">&nbsp;</div>
24049 <div style="width:50%&nbsp;!important">&nbsp;</div>
24050 <div style="width:50%&#160;!important">&nbsp;</div>
24051 <div style="border : solid;">&nbsp;</div>
24052 !! html/php
24053 <div style="width:50%&#32;!important">&#160;</div>
24054 <div style="width:50% !important">&#160;</div>
24055 <div style="width:50% !important">&#160;</div>
24056 <div style="border&#32;: solid;">&#160;</div>
24057
24058 !! html/parsoid
24059 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24060 <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>
24061 <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>
24062 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24063
24064 !! end
24065
24066 !! test
24067 T5158: Test for French spaces in attributes
24068 !! wikitext
24069 <br style=" clear : both ; " />
24070 !! html/php
24071 <p><br style="clear&#32;: both&#32;;" />
24072 </p>
24073 !! end
24074
24075 !! test
24076 HTML5 data attributes
24077 !! wikitext
24078 <span data-foo="bar">Baz</span>
24079 <p data-abc-def_hij="">Quuz</p>
24080 !! html/php
24081 <p><span data-foo="bar">Baz</span>
24082 </p>
24083 <p data-abc-def_hij="">Quuz</p>
24084
24085 !! html/parsoid
24086 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
24087 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
24088 !! end
24089
24090 !! test
24091 Strip reserved data attributes
24092 !! wikitext
24093 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
24094 !! html/php
24095 <div data-ok="fred">d</div>
24096
24097 !! html/parsoid
24098 <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>
24099 !! end
24100
24101 !! test
24102 percent-encoding and + signs in internal links (T28410)
24103 !! wikitext
24104 [[User:+%]] [[Page+title%]]
24105 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
24106 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
24107 [[%33%45]] [[%33%45+]]
24108 !! html/php
24109 <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>
24110 <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>
24111 <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>
24112 <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>
24113 </p>
24114 !! html/parsoid
24115 <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>
24116 <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>
24117 <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>
24118 <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>
24119 !! end
24120
24121 !! test
24122 Special characters in embedded file links (T29679)
24123 !! wikitext
24124 [[File:Contains & ampersand.jpg]]
24125 [[File:Does not exist.jpg|Title with & ampersand]]
24126 !! html/php
24127 <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>
24128 <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>
24129 </p>
24130 !! html/parsoid
24131 <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>
24132 <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>
24133 !! end
24134
24135 !! test
24136 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
24137 !! wikitext
24138 Text&apos;s been normalized?
24139 !! html
24140 <p>Text&#39;s been normalized?
24141 </p>
24142 !! end
24143
24144 !! test
24145 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
24146 !! wikitext
24147 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
24148 !! html
24149 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
24150 </p>
24151 !! end
24152
24153 !! test
24154 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
24155 !! wikitext
24156 [http://www.example.org/ ideograms]
24157 !! html
24158 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
24159 </p>
24160 !! end
24161
24162 !! test
24163 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
24164 !! wikitext
24165 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
24166 !! html
24167 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
24168 </p>
24169 !! end
24170
24171 !! article
24172 Mediawiki:loop1
24173 !! text
24174 {{Identical|A}}
24175 !! endarticle
24176
24177 !! article
24178 Mediawiki:loop2
24179 !! text
24180 {{Identical|B}}
24181 !! endarticle
24182
24183 !! article
24184 Template:Identical
24185 !! text
24186 {{int:loop1}}
24187 {{int:loop2}}
24188 !! endarticle
24189
24190 !! test
24191 T33098 Template which includes system messages which includes the template
24192 !! wikitext
24193 {{Identical}}
24194 !! html
24195 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24196 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24197 </p>
24198 !! end
24199
24200 !! test
24201 T33490 Turkish: ucfirst 'blah'
24202 !! options
24203 language=tr
24204 !! wikitext
24205 {{ucfirst:blah}}
24206 !! html
24207 <p>Blah
24208 </p>
24209 !! end
24210
24211 !! test
24212 T33490 Turkish: ucfirst 'ix'
24213 !! options
24214 language=tr
24215 !! wikitext
24216 {{ucfirst:ix}}
24217 !! html
24218 <p>İx
24219 </p>
24220 !! end
24221
24222 !! test
24223 T33490 Turkish: lcfirst 'BLAH'
24224 !! options
24225 language=tr
24226 !! wikitext
24227 {{lcfirst:BLAH}}
24228 !! html
24229 <p>bLAH
24230 </p>
24231 !! end
24232
24233 !! test
24234 T33490 Turkish: ucfırst (with a dotless i)
24235 !! options
24236 language=tr
24237 !! wikitext
24238 {{ucfırst:blah}}
24239 !! html
24240 <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>
24241 </p>
24242 !! end
24243
24244 !! test
24245 T33490 ucfırst (with a dotless i) with English language
24246 !! options
24247 language=en
24248 !! wikitext
24249 {{ucfırst:blah}}
24250 !! html
24251 <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>
24252 </p>
24253 !! end
24254
24255 # Note that Parsoid doesn't emit an explicit TOC.
24256 # Note also that the html2wt direction tends to emit an extra newline
24257 # between the __TOC__ magicword and the first heading unless *both*
24258 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24259 # it's "{}").
24260
24261 !! test
24262 T28375: TOC with italics
24263 !! options
24264 title=[[Main Page]]
24265 !! wikitext
24266 __TOC__
24267 ==''Lost'' episodes==
24268 !! html/php
24269 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24270 <ul>
24271 <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>
24272 </ul>
24273 </div>
24274
24275 <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>
24276
24277 !! html/parsoid
24278 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24279 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24280 !! end
24281
24282 !! test
24283 T28375: TOC with bold
24284 !! options
24285 title=[[Main Page]]
24286 !! wikitext
24287 __TOC__
24288 =='''should be bold''' then normal text==
24289 !! html/php
24290 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24291 <ul>
24292 <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>
24293 </ul>
24294 </div>
24295
24296 <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>
24297
24298 !! html/parsoid
24299 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24300 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24301 !! end
24302
24303 !! test
24304 T35845: Headings become cursive in TOC when they contain an image
24305 !! options
24306 title=[[Main Page]]
24307 !! wikitext
24308 __TOC__
24309 ==Image [[Image:foobar.jpg]]==
24310 !! html/php
24311 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24312 <ul>
24313 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24314 </ul>
24315 </div>
24316
24317 <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>
24318
24319 !! html/parsoid
24320 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24321 <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>
24322 !! end
24323
24324 !! test
24325 T35845 (2): Headings become bold in TOC when they contain a blockquote
24326 !! options
24327 title=[[Main Page]]
24328 !! wikitext
24329 __TOC__
24330 ==<blockquote>Quote</blockquote>==
24331 !! html/php
24332 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24333 <ul>
24334 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24335 </ul>
24336 </div>
24337
24338 <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>
24339
24340 !! html/php+tidy
24341 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24342 <ul>
24343 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24344 </ul>
24345 </div>
24346
24347 <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>
24348 !! html/parsoid
24349 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24350 <h2 id="Quote" data-parsoid='{}'><blockquote>Quote</blockquote></h2>
24351 !! end
24352
24353 !! test
24354 Unclosed tags in TOC
24355 !! config
24356 wgFragmentMode=[ 'html5', 'legacy' ]
24357 !! options
24358 title=[[Main Page]]
24359 !! wikitext
24360 __TOC__
24361 ==Proof: 2 < 3==
24362 <small>Hanc marginis exiguitas non caperet.</small>
24363 QED
24364 !! html/php
24365 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24366 <ul>
24367 <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>
24368 </ul>
24369 </div>
24370
24371 <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>
24372 <p><small>Hanc marginis exiguitas non caperet.</small>
24373 QED
24374 </p>
24375 !! html/parsoid
24376 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24377 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24378 <p><small>Hanc marginis exiguitas non caperet.</small>
24379 QED</p>
24380 !! end
24381
24382 !! test
24383 Multiple tags in TOC
24384 !! wikitext
24385 __TOC__
24386 ==<i>Foo</i> <b>Bar</b>==
24387
24388 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24389 !! html/php
24390 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24391 <ul>
24392 <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>
24393 <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>
24394 </ul>
24395 </div>
24396
24397 <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>
24398 <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>
24399
24400 !! html/php+tidy
24401 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24402 <ul>
24403 <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>
24404 <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>
24405 </ul>
24406 </div>
24407
24408 <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>
24409 <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>
24410 !! html/parsoid
24411 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24412 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
24413
24414 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote></h2>
24415 !! end
24416
24417 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24418 # html5 tag parsing.
24419 !! test
24420 Tags with parameters in TOC
24421 !! options
24422 parsoid=wt2html
24423 !! wikitext
24424 __TOC__
24425 ==<sup class="in-h2">Hello</sup>==
24426
24427 ==<sup class="a > b">Evilbye</sup>==
24428 !! html/php
24429 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24430 <ul>
24431 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24432 <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>
24433 </ul>
24434 </div>
24435
24436 <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>
24437 <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>
24438
24439 !! html/parsoid
24440 <meta property="mw:PageProp/toc" />
24441 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
24442
24443 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
24444 !! end
24445
24446 !! test
24447 span tags with directionality in TOC
24448 !! wikitext
24449 __TOC__
24450 ==<span dir="ltr">C++</span>==
24451
24452 ==<span dir="rtl">זבנג!</span>==
24453
24454 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
24455
24456 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
24457
24458 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
24459 !! html/php
24460 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24461 <ul>
24462 <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>
24463 <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>
24464 <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>
24465 <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>
24466 <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>
24467 </ul>
24468 </div>
24469
24470 <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>
24471 <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>
24472 <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>
24473 <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>
24474 <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>
24475
24476 !! html/parsoid
24477 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24478 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
24479 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
24480 <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>
24481 <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>
24482 <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>
24483 !! end
24484
24485 !! test
24486 T74884: bdi element in ToC
24487 !! wikitext
24488 __TOC__
24489 ==<bdi>test</bdi>==
24490 !! html/php
24491 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24492 <ul>
24493 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24494 </ul>
24495 </div>
24496
24497 <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>
24498
24499 !! html/parsoid
24500 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24501 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
24502 !! end
24503
24504 !! test
24505 T35715: s/strike element in ToC
24506 !! wikitext
24507 __TOC__
24508 ==<s>test</s> test <strike>test</strike>==
24509 !! html/php
24510 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24511 <ul>
24512 <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>
24513 </ul>
24514 </div>
24515
24516 <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>
24517
24518 !! html/parsoid
24519 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24520 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
24521 !! end
24522
24523 !! test
24524 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24525 !! wikitext
24526 __TOC__
24527 ==x==
24528 !! html/php
24529 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24530 <ul>
24531 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24532 </ul>
24533 </div>
24534
24535 <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>
24536
24537 !! html/parsoid
24538 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24539 <h2 id="x" data-parsoid='{}'>x</h2>
24540 !! end
24541
24542 !! article
24543 MediaWiki:T34057
24544 !! text
24545 == {{int:headline_sample}} ==
24546 !! endarticle
24547
24548 !! test
24549 T34057: Title needed when expanding <h> nodes.
24550 !! options
24551 title=[[Main Page]]
24552 !! wikitext
24553 {{int:T34057}}
24554 !! html
24555 <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>
24556
24557 !! end
24558
24559 !! test
24560 Strip marker in urlencode
24561 !! wikitext
24562 {{urlencode:x<nowiki/>y}}
24563 {{urlencode:x<nowiki/>y|wiki}}
24564 {{urlencode:x<nowiki/>y|path}}
24565 {{urlencode:x<pre id="one">two</pre>y}}
24566 !! html/php
24567 <p>xy
24568 xy
24569 xy
24570 xy
24571 </p>
24572 !! end
24573
24574 !! test
24575 Strip marker in lc
24576 !! wikitext
24577 {{lc:x<nowiki/>y}}
24578 !! html
24579 <p>xy
24580 </p>
24581 !! end
24582
24583 !! test
24584 Strip marker in uc
24585 !! wikitext
24586 {{uc:x<nowiki/>y}}
24587 !! html
24588 <p>XY
24589 </p>
24590 !! end
24591
24592 !! test
24593 Strip marker in formatNum
24594 !! wikitext
24595 {{formatnum:1<nowiki/>2}}
24596 {{formatnum:1<nowiki/>2|R}}
24597 !! html
24598 <p>12
24599 12
24600 </p>
24601 !! end
24602
24603 !! test
24604 Check noCommafy in formatNum
24605 !! options
24606 language=be-tarask
24607 !! wikitext
24608 {{formatnum:123456.78}}
24609 {{formatnum:123456.78|NOSEP}}
24610 !! html
24611 <p>123 456,78
24612 123456.78
24613 </p>
24614 !! end
24615
24616 !! test
24617 Wrong option for formatNum (T58199)
24618 !! wikitext
24619 {{formatnum:1,234.56|Random}}
24620 {{formatnum:1,234.56|EVERYTHING}}
24621 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24622 !! html
24623 <p>1,234.56
24624 1,234.56
24625 1,234.56
24626 </p>
24627 !! end
24628
24629 !! test
24630 Strip marker in grammar
24631 !! options
24632 language=fi
24633 !! wikitext
24634 {{grammar:elative|foo<nowiki/>bar}}
24635 !! html
24636 <p>foobarista
24637 </p>
24638 !! end
24639
24640 !! test
24641 Strip marker in padleft
24642 !! wikitext
24643 {{padleft:|2|x<nowiki/>y}}
24644 !! html
24645 <p>xy
24646 </p>
24647 !! end
24648
24649 !! test
24650 Strip marker in padright
24651 !! wikitext
24652 {{padright:|2|x<nowiki/>y}}
24653 !! html
24654 <p>xy
24655 </p>
24656 !! end
24657
24658 !! test
24659 Strip marker in anchorencode
24660 !! wikitext
24661 {{anchorencode:x<nowiki/>y}}
24662 !! html/php
24663 <p>xy
24664 </p>
24665 !! html/parsoid
24666 <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>
24667 !! end
24668
24669 !! test
24670 nowiki inside link inside heading (T20295)
24671 !! wikitext
24672 ==[[foo|x<nowiki>y</nowiki>z]]==
24673 !! html
24674 <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>
24675
24676 !! end
24677
24678 !! test
24679 new support for bdi element (T33817)
24680 !! wikitext
24681 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24682 !! html
24683 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24684
24685 !!end
24686
24687 !! test
24688 Ignore pipe between table row attributes
24689 !! wikitext
24690 {|
24691 |quux
24692 |- id=foo | style='color: red'
24693 |bar
24694 |}
24695 !! html
24696 <table>
24697 <tr>
24698 <td>quux
24699 </td></tr>
24700 <tr id="foo" style="color: red">
24701 <td>bar
24702 </td></tr></table>
24703
24704 !! end
24705
24706 !!test
24707 Language parser function
24708 !! wikitext
24709 {{#language:ar}}
24710 !! html
24711 <p>العربية
24712 </p>
24713 !! end
24714
24715 !!test
24716 Padleft and padright (default 0-padding)
24717 !! wikitext
24718 {{padleft:xyz|5}}
24719 {{padright:xyz|5}}
24720 !! html/php
24721 <p>00xyz
24722 xyz00
24723 </p>
24724 !! html/parsoid
24725 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
24726 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
24727 !! end
24728
24729 !!test
24730 Padleft and padright (partial fill)
24731 !! wikitext
24732 {{padleft:xyz|6|ab}}
24733 {{padright:xyz|6|ab}}
24734 !! html/php
24735 <p>abaxyz
24736 xyzaba
24737 </p>
24738 !! html/parsoid
24739 <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>
24740 <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>
24741 !! end
24742
24743 !!test
24744 Padleft and padright as substr
24745 !! wikitext
24746 {{padleft:|3|abcde}}
24747 {{padright:|3|abcde}}
24748 !! html/php
24749 <p>abc
24750 abc
24751 </p>
24752 !! html/parsoid
24753 <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>
24754 <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>
24755 !! end
24756
24757 !! test
24758 Padleft and padright with non-numerical length (T180403)
24759 !! wikitext
24760 {{padleft:abcdef|junk}}
24761 {{padright:abcdef|junk}}
24762 !! html/php
24763 <p>abcdef
24764 abcdef
24765 </p>
24766 !! end
24767
24768 !!test
24769 Special parser function
24770 !! wikitext
24771 {{#special:RandomPage}}
24772 {{#special:BaDtItLe}}
24773 {{#special:Foobar}}
24774 !! html
24775 <p>Special:Random
24776 Special:Badtitle
24777 Special:Foobar
24778 </p>
24779 !! end
24780
24781 !!test
24782 T36939 - Case insensitive link parsing ([HttP://])
24783 !! wikitext
24784 [HttP://MediaWiki.Org/]
24785 !! html/php
24786 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24787 </p>
24788 !! html/parsoid
24789 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
24790 !! end
24791
24792 !!test
24793 T36939 - Case insensitive link parsing ([HttP:// title])
24794 !! wikitext
24795 [HttP://MediaWiki.Org/ MediaWiki]
24796 !! html
24797 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24798 </p>
24799 !! end
24800
24801 !!test
24802 T36939 - Case insensitive link parsing (HttP://)
24803 !! wikitext
24804 HttP://MediaWiki.Org/
24805 !! html/php
24806 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24807 </p>
24808 !! html/parsoid
24809 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24810 !! end
24811
24812 !!test
24813 Disable TOC
24814 !! options
24815 notoc
24816 !! wikitext
24817 Lead
24818 ==Section 1==
24819 ==Section 2==
24820 ==Section 3==
24821 ==Section 4==
24822 ==Section 5==
24823 !! html
24824 <p>Lead
24825 </p>
24826
24827 <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>
24828 <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>
24829 <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>
24830 <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>
24831 <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>
24832
24833 !! end
24834
24835
24836 ###
24837 ### Parsoid-specific tests
24838 ### Parsoid-PHP parser incompatibilities
24839 ###
24840 !!test
24841 1. SOL-sensitive wikitext tokens as template-args
24842 !!options
24843 parsoid=wt2html,wt2wt
24844 !! wikitext
24845 {{echo|*a}}
24846 {{echo|#a}}
24847 {{echo|:a}}
24848 !! html
24849 <span about="#mwt1" typeof="mw:Transclusion">
24850 </span><ul about="#mwt1"><li>a</li>
24851 </ul>
24852 <span about="#mwt2" typeof="mw:Transclusion">
24853 </span><ol about="#mwt2"><li>a</li>
24854 </ol>
24855 <span about="#mwt3" typeof="mw:Transclusion">
24856 </span><dl about="#mwt3"><dd>a</dd>
24857 </dl>
24858 !!end
24859
24860 #### -----------------------------------------------------------------
24861 #### Parsoid-specific functionality tests
24862 #### -----------------------------------------------------------------
24863
24864 # T65642/T68749: Formatting elt fixup around images is cleaned up.
24865 # We know wt2wt will fail, but we expect selser to pass.
24866 # Due to the nature of our testing, wt2wt and selser tests will enter the
24867 # blacklist and we'll catch selser regressions based on changes to the
24868 # blacklist entries for selser tests.
24869 !! test
24870 1. Bad treebuilder fixup of formatting elt is cleaned up
24871 !! options
24872 parsoid=wt2html,wt2wt
24873 !! wikitext
24874 {|
24875 |
24876 <small>
24877 [[Image:Foobar.jpg|right|Test]]
24878 </small>
24879 |}
24880 !! html/parsoid
24881 <table>
24882 <tbody><tr><td>
24883 <small>
24884 <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>
24885 </small>
24886 </td></tr>
24887 </tbody></table>
24888 !! end
24889
24890 !! test
24891 2. Bad treebuilder fixup of formatting elt is cleaned up
24892 !! options
24893 parsoid=wt2html,wt2wt
24894 !! wikitext
24895 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
24896
24897 <small>[[Image:Foobar.jpg|right|300px]]</small>
24898 !! html/parsoid
24899
24900 <p><b>foo</b></p>
24901 <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>
24902 <p><b>bar</b></p>
24903 <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>
24904 !! end
24905
24906 !! test
24907 3. Bad treebuilder fixup of formatting elt is cleaned up
24908 !! options
24909 parsoid=wt2html,wt2wt
24910 !! wikitext
24911 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
24912 !! html/parsoid
24913 <p><small><b>foo</b></small></p>
24914 <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>
24915 <p><small><b>bar</b></small></p>
24916 !! end
24917
24918 !! test
24919 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
24920 !! options
24921 parsoid=wt2html,wt2wt
24922 !! wikitext
24923 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
24924 !! html/parsoid
24925 <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>
24926 !! end
24927
24928 #### ----------------------------------------------------------------
24929 #### Parsoid-only testing of Parsoid's impl of LST
24930 #### Not implemented yet, see
24931 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
24932 #### ----------------------------------------------------------------
24933
24934 ## We still need to support serializing the older format while content is stored.
24935 !! test
24936 LST Sections: Backwards compatibility
24937 !! options
24938 parsoid={
24939 "suppressErrors": true,
24940 "modes": ["html2wt"]
24941 }
24942 !! wikitext
24943 <section begin="2011-05-16" />
24944 <section end="2014-04-10 (MW 1.23wmf22)" />
24945 !! html/parsoid
24946 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
24947 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
24948 !! end
24949
24950 !! test
24951 LST Sections: Newfangled approach
24952 !! wikitext
24953 <section begin="2011-05-16" />
24954 <section end="2014-04-10 (MW 1.23wmf22)" />
24955 !! html/parsoid
24956 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
24957 </span>
24958 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
24959 </span></p>
24960 !! end
24961
24962 #--------- Test stripping of empty nodes in template content ----------
24963
24964 !! test
24965 Empty LI and TR nodes should be stripped from template content
24966 !! wikitext
24967 {{EmptyLITest}}
24968 {{EmptyTRTest}}
24969 !! html/parsoid
24970 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
24971 <li>a</li>
24972 <li>b</li>
24973 </ul>
24974 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
24975 <tbody>
24976 <tr>
24977 <td>foo</td>
24978 </tr>
24979 <tr>
24980 <td>bar</td>
24981 </tr>
24982 </tbody>
24983 </table>
24984 !! end
24985
24986 !! test
24987 Empty LI and TR nodes should not be stripped from top-level content
24988 !! wikitext
24989 *a
24990 *
24991 *b
24992
24993 {|
24994 |-
24995 |-
24996 |foo
24997 |}
24998 !! html/parsoid
24999 <ul>
25000 <li>a</li>
25001 <li class='mw-empty-elt'></li>
25002 <li>b</li>
25003 </ul>
25004 <table>
25005 <tbody>
25006 <tr class='mw-empty-elt'></tr>
25007 <tr>
25008 <td>foo</td>
25009 </tr>
25010 </tbody>
25011 </table>
25012 !! end
25013
25014 !! test
25015 Empty TR nodes should not be stripped if they have any attributes set
25016 !! wikitext
25017 {{EmptyTRWithHTMLAttrTest}}
25018 !! html/parsoid
25019 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
25020 <tr align='center'></tr>
25021 <tr><td>foo</td></tr>
25022 <tr align='center'></tr>
25023 <tr><td>bar</td></tr>
25024 </table>
25025 !! end
25026
25027 #### ----------------------------------------------------------------
25028 #### The following section of tests are primarily to test
25029 #### wikitext escaping capabilities of Parsoid. Given that
25030 #### escaping can be done any number of ways, the wikitext (input)
25031 #### is always adjusted to reflect how Parsoid adds nowiki
25032 #### escape tags.
25033 ####
25034 #### We are marking several tests as parsoid-only since the
25035 #### HTML in the result section is different from what the
25036 #### PHP parser generates for it.
25037 #### ----------------------------------------------------------------
25038
25039
25040 #### --------------- Headings ---------------
25041 #### 0. Unnested
25042 #### 1. Nested inside html <h1>=foo=</h1>
25043 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
25044 #### 3. Nested inside html with wikitext split by html tags
25045 #### 4. No escape needed
25046 #### 5. Empty headings <h1></h1>
25047 #### 6. Heading chars in SOL context
25048 #### ----------------------------------------
25049 !! test
25050 Headings: 0. Unnested
25051 !! options
25052 parsoid=html2wt
25053 !! html/parsoid
25054 <p>=foo=</p>
25055
25056 <p> =foo=
25057 <!--cmt-->
25058 =foo=</p>
25059
25060 <p>=foo<i>a</i>=</p>
25061 !! wikitext
25062 <nowiki>=foo=</nowiki>
25063
25064 <nowiki> </nowiki>=foo=
25065 <!--cmt-->
25066 <nowiki>=foo=</nowiki>
25067
25068 =foo''a''<nowiki>=</nowiki>
25069 !!end
25070
25071 # New headings and existing headings are handled differently
25072 !! test
25073 Headings: 1. Nested inside html
25074 !! options
25075 parsoid=html2wt
25076 !! html/parsoid
25077 <h1>=foo=</h1>
25078 <h2>=foo=</h2>
25079 <h3>=foo=</h3>
25080
25081 <h1 data-parsoid=''>=foo=</h1>
25082 <h2 data-parsoid=''>=foo=</h2>
25083 <h3 data-parsoid=''>=foo=</h3>
25084 <h4 data-parsoid=''>=foo=</h4>
25085 <h5 data-parsoid=''>=foo=</h5>
25086 <h6 data-parsoid=''>=foo=</h6>
25087 !! wikitext
25088 = =foo= =
25089
25090 == =foo= ==
25091
25092 === =foo= ===
25093
25094 =<nowiki>=foo=</nowiki>=
25095 ==<nowiki>=foo=</nowiki>==
25096 ===<nowiki>=foo=</nowiki>===
25097 ====<nowiki>=foo=</nowiki>====
25098 =====<nowiki>=foo=</nowiki>=====
25099 ======<nowiki>=foo=</nowiki>======
25100
25101 !!end
25102
25103 !! test
25104 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
25105 !! options
25106 parsoid=html2wt
25107 !! html/parsoid
25108 <h1>foo</h1>*bar
25109 <h1>foo</h1>=bar
25110 <h1>foo</h1>=bar=
25111 !! wikitext
25112 = foo =
25113 <nowiki>*</nowiki>bar
25114
25115 = foo =
25116 =bar
25117
25118 = foo =
25119 <nowiki>=bar=</nowiki>
25120 !!end
25121
25122 !! test
25123 Headings: 3. Nested inside html with wikitext split by html tags
25124 !! options
25125 parsoid=html2wt
25126 !! html/parsoid
25127 <h1>=<b>bold</b>foo=</h1>
25128 !! wikitext
25129 = ='''bold'''foo= =
25130 !!end
25131
25132 !! test
25133 Headings: 4a. No escaping needed (testing just h1 and h2)
25134 !! options
25135 parsoid=html2wt
25136 !! html/parsoid
25137 <h1>=foo</h1>
25138 <h1>foo=</h1>
25139 <h1> =foo= </h1>
25140 <h1>=foo= bar</h1>
25141 <h2>=foo</h2>
25142 <h2>foo=</h2>
25143 <h1>=</h1>
25144 <h1><i>=</i>foo=</h1>
25145 !! wikitext
25146 = =foo =
25147
25148 = foo= =
25149
25150 = =foo= =
25151
25152 = =foo= bar =
25153
25154 == =foo ==
25155
25156 == foo= ==
25157
25158 = = =
25159
25160 = ''=''foo= =
25161 !!end
25162
25163 !! test
25164 Headings: 4b. No escaping needed (inside p-tags)
25165 !! options
25166 parsoid=html2wt
25167 !! html/parsoid
25168 <p>=foo= x
25169 =foo= <s></s>
25170 </p>
25171 !! wikitext
25172 =foo= x
25173 =foo= <s></s>
25174 !! html/php
25175 <p>=foo= x
25176 =foo= <s></s>
25177 </p>
25178 !!end
25179
25180 !! test
25181 Headings: 4c. Short headings (1)
25182 !! options
25183 parsoid=html2wt
25184 !! html/parsoid
25185 <p>===
25186 </p>
25187 !! wikitext
25188 <nowiki>===</nowiki>
25189 !! html/php
25190 <p>===
25191 </p>
25192 !! end
25193
25194 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
25195 !! test
25196 Headings: 4d. Short headings (2)
25197 !! options
25198 parsoid=wt2html,html2html
25199 !! wikitext
25200 =
25201 ==
25202 ===
25203 ====
25204 =====
25205 !! html/php
25206 <p>=
25207 ==
25208 </p>
25209 <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>
25210 <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>
25211 <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>
25212
25213 !! html/parsoid
25214 <p>=
25215 ==</p>
25216 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
25217 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
25218 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
25219 !! end
25220
25221 !! test
25222 Headings: 5. Empty headings
25223 !! options
25224 parsoid=html2wt
25225 !! html/parsoid
25226 <h1 data-parsoid='{}'></h1>
25227
25228 <h2 data-parsoid='{}'></h2>
25229
25230 <h3 data-parsoid='{}'></h3>
25231
25232 <h4 data-parsoid='{}'></h4>
25233
25234 <h5 data-parsoid='{}'></h5>
25235
25236 <h6 data-parsoid='{}'></h6>
25237 !! wikitext
25238 =<nowiki/>=
25239
25240 ==<nowiki/>==
25241
25242 ===<nowiki/>===
25243
25244 ====<nowiki/>====
25245
25246 =====<nowiki/>=====
25247
25248 ======<nowiki/>======
25249 !!end
25250
25251 !! test
25252 Headings: 6a. Heading chars in SOL context (with trailing spaces)
25253 !! options
25254 parsoid=html2wt
25255 !! html/parsoid
25256 <p>=a=</p>
25257
25258 <p>=a=</p>
25259
25260 <p>=a=</p>
25261 !! wikitext
25262 <nowiki>=a=</nowiki>
25263
25264 <nowiki>=a=</nowiki>
25265
25266 <nowiki>=a=</nowiki>
25267 !!end
25268
25269 !! test
25270 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25271 !! options
25272 parsoid=html2wt
25273 !! html/parsoid
25274 <p>=a=
25275 b</p>
25276
25277 <p>=a=
25278 b</p>
25279
25280 <p>=a=
25281 b</p>
25282 !! wikitext
25283 <nowiki>=a=</nowiki>
25284 b
25285
25286 <nowiki>=a=</nowiki>
25287 b
25288
25289 <nowiki>=a=</nowiki>
25290 b
25291 !!end
25292
25293 !! test
25294 Headings: 6c. Heading chars in SOL context (leading newline break)
25295 !! options
25296 parsoid=html2wt
25297 !! html/parsoid
25298 <p>a
25299 =b=</p>
25300 !! wikitext
25301 a
25302 <nowiki>=b=</nowiki>
25303 !!end
25304
25305 !! test
25306 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25307 !! options
25308 parsoid=html2wt
25309 !! html/parsoid
25310 <!--c0--><p>=a=</p>
25311
25312 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25313 !! wikitext
25314 <!--c0--><nowiki>=a=</nowiki>
25315
25316 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25317 !!end
25318
25319 !! test
25320 Headings: 6d. Heading chars in SOL context (No escaping needed)
25321 !! options
25322 parsoid=html2wt
25323 !! html/parsoid
25324 =a=<div>b</div>
25325 !! wikitext
25326 =a=<div>b</div>
25327 !!end
25328
25329 !! test
25330 Headings: 7. Insert a newline between new content and headings
25331 !! options
25332 parsoid=html2wt
25333 !! html/parsoid
25334 <h2>NEW</h2>
25335 <p>new</p>
25336 <h2 data-parsoid='{}'>A</h2>
25337 <p data-parsoid='{}'>a</p>
25338 !! wikitext
25339 == NEW ==
25340 new
25341
25342 ==A==
25343 a
25344
25345 !! end
25346
25347 !! test
25348 Headings: Used as horizontal rule
25349 !! config
25350 wgFragmentMode=[ 'html5', 'legacy' ]
25351 !! options
25352 parsoid=wt2html
25353 !! wikitext
25354 ===============
25355 !! html/php
25356 <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>
25357
25358 !! html/parsoid
25359 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25360 !! end
25361
25362 #### --------------- Lists ---------------
25363 #### 0. Outside nests (*foo, etc.)
25364 #### 1. Nested inside html <ul><li>*foo</li></ul>
25365 #### 2. Inside definition lists
25366 #### 3. Only bullets at start should be escaped
25367 #### 4. No escapes needed
25368 #### 5. No unnecessary escapes
25369 #### 6. Escape bullets in SOL position
25370 #### 7. Escape bullets in a multi-line context
25371 #### ----------------------------------------
25372
25373 !! test
25374 Lists: 0. Outside nests
25375 !! options
25376 parsoid=html2wt
25377 !! html/parsoid
25378 <p>*foo</p>
25379
25380 <p>#foo</p>
25381
25382 <p>;Foo:bar</p>
25383 !! wikitext
25384 <nowiki>*</nowiki>foo
25385
25386 <nowiki>#</nowiki>foo
25387
25388 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25389 !!end
25390
25391 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25392 ## to test wikitext escaping, and insignificant whitespace diffs
25393 ## cause PHP parser tests to barf
25394 !! test
25395 Lists: 1. Nested inside html (No unnecessary escapes)
25396 !! options
25397 parsoid=html2wt
25398 !! html/parsoid
25399 <ul>
25400 <li>*foo</li>
25401 <li>#foo</li>
25402 <li>:foo</li>
25403 <li>;foo</li>
25404 <li data-parsoid='{}'>*foo</li>
25405 <li data-parsoid='{}'>#foo</li>
25406 <li data-parsoid='{}'>:foo</li>
25407 <li data-parsoid='{}'>;foo</li>
25408 </ul>
25409
25410 <ol>
25411 <li>*foo</li>
25412 <li>#foo</li>
25413 <li>:foo</li>
25414 <li>;foo</li>
25415 <li data-parsoid='{}'>*foo</li>
25416 <li data-parsoid='{}'>#foo</li>
25417 <li data-parsoid='{}'>:foo</li>
25418 <li data-parsoid='{}'>;foo</li>
25419 </ol>
25420 !! wikitext
25421 * *foo
25422 * #foo
25423 * :foo
25424 * ;foo
25425 *<nowiki>*foo</nowiki>
25426 *<nowiki>#foo</nowiki>
25427 *<nowiki>:foo</nowiki>
25428 *<nowiki>;foo</nowiki>
25429
25430 # *foo
25431 # #foo
25432 # :foo
25433 # ;foo
25434 #<nowiki>*foo</nowiki>
25435 #<nowiki>#foo</nowiki>
25436 #<nowiki>:foo</nowiki>
25437 #<nowiki>;foo</nowiki>
25438 !!end
25439
25440 !! test
25441 Lists: 2. Inside definition lists
25442 !! options
25443 parsoid=html2wt
25444 !! html/parsoid
25445 <dl><dt>;foo</dt></dl>
25446 <dl><dt>:foo</dt></dl>
25447 <dl><dt>:foo</dt>
25448 <dd>bar</dd></dl>
25449 <dl><dd>:foo</dd></dl>
25450 !! wikitext
25451 ; ;foo
25452
25453 ; <nowiki>:foo</nowiki>
25454
25455 ; <nowiki>:foo</nowiki>
25456 : bar
25457
25458 : :foo
25459 !!end
25460
25461 !! test
25462 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25463 !! options
25464 parsoid=html2wt
25465 !! html/parsoid
25466 <ul>
25467 <li>*foo*bar</li>
25468 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25469 </ul>
25470 !! wikitext
25471 * *foo*bar
25472 *<nowiki>*foo</nowiki>''it''*bar
25473 !!end
25474
25475 !! test
25476 Lists: 4. No escapes needed
25477 !! options
25478 parsoid=html2wt
25479 !! html/parsoid
25480 <ul>
25481 <li>foo*bar
25482 </li>
25483 </ul>
25484 <ul>
25485 <li><i>foo</i>*bar
25486 </li>
25487 </ul>
25488 <ul>
25489 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25490 </li>
25491 </ul>
25492 <ul>
25493 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25494 </li>
25495 </ul>
25496 !! wikitext
25497 *foo*bar
25498
25499 *''foo''*bar
25500
25501 *[[Foo]]: bar
25502
25503 *[[Foo]]*bar
25504 !!end
25505
25506 !! test
25507 Lists: 5. No unnecessary escapes
25508 !! options
25509 parsoid=html2wt
25510 !! html/parsoid
25511 <ul><li> bar <span>[[foo]]</span></li></ul>
25512 <ul><li> =bar <span>[[foo]]</span></li></ul>
25513 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25514 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25515 <ul><li> =bar <span>foo]]</span>=</li></ul>
25516 <ul><li> <s></s>: a</li></ul>
25517 <ul><li> <i>* foo</i></li></ul>
25518
25519 !! wikitext
25520 * bar <span><nowiki>[[foo]]</nowiki></span>
25521
25522 * =bar <span><nowiki>[[foo]]</nowiki></span>
25523
25524 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25525
25526 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25527
25528 * =bar <span>foo]]</span>=
25529
25530 * <s></s>: a
25531
25532 * ''* foo''
25533 !!end
25534
25535 !! test
25536 Lists: 6. Escape bullets in SOL position
25537 !! options
25538 parsoid=html2wt
25539 !! html/parsoid
25540 <p><!--cmt-->*foo</p>
25541 !! wikitext
25542 <!--cmt--><nowiki>*</nowiki>foo
25543 !!end
25544
25545 !! test
25546 Lists: 7. Escape bullets in a multi-line context
25547 !! options
25548 parsoid=html2wt
25549 !! html/parsoid
25550 <p>a
25551 *b
25552 </p>
25553 !! wikitext
25554 a
25555 <nowiki>*</nowiki>b
25556 !!end
25557
25558 !! test
25559 Lists: 8. Escape colons only if not present in tags
25560 !! options
25561 parsoid=html2wt
25562 !! html/parsoid
25563 <dl><dt>a:b<i>c:d</i></dt></dl>
25564 !! wikitext
25565 ; <nowiki>a:b</nowiki>''c:d''
25566 !! end
25567
25568 #### --------------- HRs ---------------
25569 #### 1. Single line
25570 #### -----------------------------------
25571
25572 !! test
25573 HRs: 1. Single line
25574 !! options
25575 parsoid=html2wt
25576 !! html/parsoid
25577 <hr />----
25578 <hr />=foo=
25579 <hr />*foo
25580 !! wikitext
25581 ----<nowiki>----</nowiki>
25582 ----=foo=
25583 ----*foo
25584 !! end
25585
25586 #### --------------- Tables ---------------
25587 #### 1a. Simple example
25588 #### 1b. No escaping needed (!foo)
25589 #### 1c. No escaping needed (|foo)
25590 #### 1d. No escaping needed (|}foo)
25591 ####
25592 #### 2a. Nested in td (<td>foo|bar</td>)
25593 #### 2b. Nested in td (<td>foo||bar</td>)
25594 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25595 ####
25596 #### 3a. Nested in th (<th>foo!bar</th>)
25597 #### 3b. Nested in th (<th>foo!!bar</th>)
25598 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25599 ####
25600 #### 4a. Escape -
25601 #### 4b. Escape +
25602 #### 4c. No escaping needed
25603 #### --------------------------------------
25604
25605 !! test
25606 Tables: 1a. Simple example
25607 !! options
25608 parsoid=html2wt
25609 !! html/parsoid
25610 <p>{|
25611 |}
25612 </p>
25613 !! wikitext
25614 <nowiki>{|</nowiki>
25615 |}
25616 !! end
25617
25618 !! test
25619 Tables: 1b. No escaping needed
25620 !! options
25621 parsoid=html2wt
25622 !! html/parsoid
25623 <p>!foo
25624 </p>
25625 !! wikitext
25626 !foo
25627 !! end
25628
25629 !! test
25630 Tables: 1c. No escaping needed
25631 !! options
25632 parsoid=html2wt
25633 !! html/parsoid
25634 <p>|foo
25635 </p>
25636 !! wikitext
25637 |foo
25638 !! end
25639
25640 !! test
25641 Tables: 1d. No escaping needed
25642 !! options
25643 parsoid=html2wt
25644 !! html/parsoid
25645 <p>|}foo
25646 </p>
25647 !! wikitext
25648 |}foo
25649 !! end
25650
25651 !! test
25652 Tables: 2a. Nested in td
25653 !! options
25654 parsoid=html2wt
25655 !! html/parsoid
25656 <table><tbody><tr>
25657 <td>foo|bar</td></tr>
25658 <tr><td>x<div>a|b</div></td>
25659 </tbody></table>
25660 !! wikitext
25661 {|
25662 |<nowiki>foo|bar</nowiki>
25663 |-
25664 |x<div><nowiki>a|b</nowiki></div>
25665 |}
25666 !! html/php+tidy
25667 <table>
25668 <tbody><tr>
25669 <td>foo|bar
25670 </td></tr>
25671 <tr>
25672 <td>x<div>a|b</div>
25673 </td></tr></tbody></table>
25674 !! end
25675
25676 !! test
25677 Tables: 2b. Nested in td
25678 !! options
25679 parsoid=html2wt
25680 !! html/parsoid
25681 <table><tbody><tr>
25682 <td>foo||bar</td>
25683 <td>a<i>b||c</i></td>
25684 <td>a<i><div>b||c</div></i></td>
25685 </tr></tbody></table>
25686 !! wikitext
25687 {|
25688 |<nowiki>foo||bar</nowiki>
25689 |a''<nowiki>b||c</nowiki>''
25690 |a''<div><nowiki>b||c</nowiki></div>''
25691 |}
25692 !! html/php
25693 <table>
25694 <tr>
25695 <td>foo||bar
25696 </td>
25697 <td>a<i>b||c</i>
25698 </td>
25699 <td>a<i><div>b||c</div></i>
25700 </td></tr></table>
25701
25702 !! end
25703
25704 !! test
25705 Tables: 2c. Nested in td -- no escaping needed
25706 !! options
25707 parsoid=html2wt
25708 !! html/*
25709 <table>
25710 <tr>
25711 <td>foo!!bar
25712 </td></tr></table>
25713
25714 !! wikitext
25715 {|
25716 |foo!!bar
25717 |}
25718 !! end
25719
25720 !! test
25721 Tables: 3a. Nested in th
25722 !! options
25723 parsoid=html2wt
25724 !! html/*
25725 <table>
25726 <tr>
25727 <th>foo!bar
25728 </th></tr></table>
25729
25730 !! wikitext
25731 {|
25732 !foo!bar
25733 |}
25734 !! end
25735
25736 !! test
25737 Tables: 3b. Nested in th
25738 !! options
25739 parsoid=html2wt
25740 !! html/parsoid
25741 <table><tbody>
25742 <tr><th>foo!!bar</th>
25743 <th><i>foo|bar</i></th>
25744 <th><i>foo!!bar</i></th>
25745 <th><i><span>foo!!bar</span></i></th>
25746 </tr></tbody></table>
25747 !! wikitext
25748 {|
25749 !<nowiki>foo!!bar</nowiki>
25750 !''<nowiki>foo|bar</nowiki>''
25751 !''<nowiki>foo!!bar</nowiki>''
25752 !''<span><nowiki>foo!!bar</nowiki></span>''
25753 |}
25754 !! html/php
25755 <table>
25756 <tr>
25757 <th>foo!!bar
25758 </th>
25759 <th><i>foo|bar</i>
25760 </th>
25761 <th><i>foo!!bar</i>
25762 </th>
25763 <th><i><span>foo!!bar</span></i>
25764 </th></tr></table>
25765
25766 !! end
25767
25768 !! test
25769 Tables: 3c. Nested in th
25770 !! options
25771 parsoid=html2wt
25772 !! html/parsoid
25773 <table><tbody>
25774 <tr><th>foo||bar</th>
25775 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25776 </tr></tbody></table>
25777 !! wikitext
25778 {|
25779 !<nowiki>foo||bar</nowiki>
25780 !<nowiki>foo||bar</nowiki>
25781 |}
25782 !! html/php
25783 <table>
25784 <tr>
25785 <th>foo||bar
25786 </th>
25787 <th>foo||bar
25788 </th></tr></table>
25789
25790 !! end
25791
25792 !! test
25793 Tables: 4a. Escape -
25794 !! options
25795 parsoid=html2wt
25796 !! html/*
25797 <table>
25798 <tr>
25799 <th>-bar
25800 </th></tr>
25801 <tr>
25802 <td>-bar
25803 </td></tr></table>
25804
25805 !! wikitext
25806 {|
25807 !-bar
25808 |-
25809 |<nowiki>-bar</nowiki>
25810 |}
25811 !! end
25812
25813 !! test
25814 Tables: 4b. Escape +
25815 !! options
25816 parsoid=html2wt
25817 !! html/*
25818 <table>
25819 <tr>
25820 <th>+bar
25821 </th></tr>
25822 <tr>
25823 <td>+bar
25824 </td></tr></table>
25825
25826 !! wikitext
25827 {|
25828 !+bar
25829 |-
25830 |<nowiki>+bar</nowiki>
25831 |}
25832 !! end
25833
25834 !! test
25835 Tables: 4c. No escaping needed
25836 !! options
25837 parsoid=html2wt
25838 !! html/parsoid
25839 <table><tbody>
25840 <tr><td>foo-bar</td><td>foo+bar</td></tr>
25841 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
25842 <tr><td>foo
25843 <p>bar|baz
25844 +bar
25845 -bar</p></td></tr>
25846 <tr><td>x
25847 <div>a|b</div></td>
25848 </tbody></table>
25849 !! wikitext
25850 {|
25851 |foo-bar
25852 |foo+bar
25853 |-
25854 |''foo''-bar
25855 |''foo''+bar
25856 |-
25857 |foo
25858 bar|baz
25859 +bar
25860 -bar
25861 |-
25862 |x
25863 <div>a|b</div>
25864 |}
25865 !! html/php
25866 <table>
25867 <tr>
25868 <td>foo-bar
25869 </td>
25870 <td>foo+bar
25871 </td></tr>
25872 <tr>
25873 <td><i>foo</i>-bar
25874 </td>
25875 <td><i>foo</i>+bar
25876 </td></tr>
25877 <tr>
25878 <td>foo
25879 <p>bar|baz
25880 +bar
25881 -bar
25882 </p>
25883 </td></tr>
25884 <tr>
25885 <td>x
25886 <div>a|b</div>
25887 </td></tr></table>
25888
25889 !! end
25890
25891 !! test
25892 Tables: 4d. No escaping needed
25893 !! options
25894 parsoid=html2wt
25895 !! html/parsoid
25896 <table>
25897 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
25898 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
25899 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
25900 </tbody></table>
25901 !! wikitext
25902 {|
25903 |[[Foo]]-bar
25904 ||+1
25905 ||-2
25906 |}
25907 !! html/php
25908 <table>
25909 <tr>
25910 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
25911 </td>
25912 <td>+1
25913 </td>
25914 <td>-2
25915 </td></tr></table>
25916
25917 !! end
25918
25919 !! test
25920 Tables: 5. Empty table cells should get whitespace to avoid need for nowikis
25921 !! options
25922 parsoid=html2wt
25923 !! html/parsoid
25924 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
25925
25926 <table><tr><td></td><td align="center"></td><td></td></tr></table>
25927
25928 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
25929
25930 <table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table>
25931 !! wikitext
25932 {|
25933 | || align="center" | ||
25934 |}
25935
25936 {|
25937 |
25938 | align="center" |
25939 |
25940 |}
25941
25942 {|
25943 | {{!}}{{!}} align="center" | ||
25944 |}
25945
25946 {|
25947 ! !! align="center" | !!
25948 |}
25949 !! html/php+tidy
25950 <table>
25951 <tbody><tr>
25952 <td></td>
25953 <td align="center"></td>
25954 <td>
25955 </td></tr></tbody></table>
25956 <table>
25957 <tbody><tr>
25958 <td>
25959 </td>
25960 <td align="center">
25961 </td>
25962 <td>
25963 </td></tr></tbody></table>
25964 <table>
25965 <tbody><tr>
25966 <td></td>
25967 <td align="center"></td>
25968 <td>
25969 </td></tr></tbody></table>
25970 <table>
25971 <tbody><tr>
25972 <th></th>
25973 <th align="center"></th>
25974 <th>
25975 </th></tr></tbody></table>
25976 !! end
25977
25978 !! test
25979 T97430: Don't emit empty nowiki pairs around marker meta tags
25980 !! options
25981 parsoid=html2wt
25982 !! html/parsoid
25983 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25984 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
25985 !! wikitext
25986 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25987 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
25988 !! end
25989
25990 !! test
25991 Unclosed xmlish element in table line shouldn't eat end delimiters
25992 !! options
25993 parsoid=html2wt
25994 !! html/parsoid
25995 <table>
25996 <tbody><tr><td> &lt;foo</td>
25997 <td> bar></td></tr>
25998 </tbody></table>
25999 !! wikitext
26000 {|
26001 | <foo
26002 | bar>
26003 |}
26004 !! html/php
26005 <table>
26006 <tr>
26007 <td>&lt;foo
26008 </td>
26009 <td>bar&gt;
26010 </td></tr></table>
26011
26012 !! end
26013
26014 #### --------------- Links ----------------
26015 #### 1. Quote marks in link text
26016 #### 2. Wikilinks: Escapes needed
26017 #### 3. Wikilinks: No escapes needed
26018 #### 4. Extlinks: Escapes needed
26019 #### 5. Extlinks: No escapes needed
26020 #### --------------------------------------
26021 !! test
26022 Links 1. WikiLinks: No escapes needed
26023 !! options
26024 parsoid=html2wt
26025 !! html/parsoid
26026 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
26027 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
26028 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
26029 !! wikitext
26030 [[Foo|Foo''boo'']]
26031 [[Foo|[Foobar]]]
26032 [[Foo|x [Foobar] x]]
26033 !! html/php
26034 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
26035 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
26036 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
26037 </p>
26038 !! end
26039
26040 !! test
26041 Links 2. WikiLinks: Escapes needed
26042 !! options
26043 parsoid=html2wt
26044 !! html/parsoid
26045 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
26046 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
26047 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
26048 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
26049 <a href="Foo" rel="mw:WikiLink">|Bar</a>
26050 <a href="Foo" rel="mw:WikiLink">]]bar</a>
26051 <a href="Foo" rel="mw:WikiLink">[[bar</a>
26052 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
26053 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
26054 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
26055 !! wikitext
26056 [[Foo|<nowiki>Foobar]</nowiki>]]
26057 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
26058 [[Foo|<nowiki>[[Bar]]</nowiki>]]
26059 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
26060 [[Foo|<nowiki>|Bar</nowiki>]]
26061 [[Foo|<nowiki>]]bar</nowiki>]]
26062 [[Foo|<nowiki>[[bar</nowiki>]]
26063 [[Foo|<nowiki>x [[ y</nowiki>]]
26064 [[Foo|<nowiki>x ]] y</nowiki>]]
26065 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
26066 !! html/php
26067 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
26068 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
26069 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
26070 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
26071 <a href="/wiki/Foo" title="Foo">|Bar</a>
26072 <a href="/wiki/Foo" title="Foo">]]bar</a>
26073 <a href="/wiki/Foo" title="Foo">[[bar</a>
26074 <a href="/wiki/Foo" title="Foo">x [[ y</a>
26075 <a href="/wiki/Foo" title="Foo">x ]] y</a>
26076 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
26077 </p>
26078 !! end
26079
26080 !! test
26081 Links 3. WikiLinks: No escapes needed
26082 !! options
26083 parsoid=html2wt
26084 !! html/parsoid
26085 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
26086 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
26087 !! wikitext
26088 [[Foo|[Foobar]]
26089 [[Foo|foo|bar]]
26090 !! html/php
26091 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
26092 <a href="/wiki/Foo" title="Foo">foo|bar</a>
26093 </p>
26094 !! end
26095
26096 !! test
26097 Links 4. ExtLinks: Escapes needed
26098 !! options
26099 parsoid=html2wt
26100 !! html/parsoid
26101 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
26102 <a rel="mw:ExtLink" href="http://google.com">google]</a>
26103 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
26104 <p>[http://google.com]</p>
26105 <p>[http://google.com google]</p>
26106 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
26107 <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>
26108 !! wikitext
26109 [http://google.com <nowiki>[google]</nowiki>]
26110 [http://google.com <nowiki>google]</nowiki>]
26111 [http://google.com <nowiki>goog] le</nowiki>]
26112
26113 <nowiki>[http://google.com]</nowiki>
26114
26115 <nowiki>[http://google.com google]</nowiki>
26116
26117 [http://google.com<nowiki>]</nowiki>
26118
26119 [{{echo|http://google.com}}<nowiki>]</nowiki>
26120 !! html/php
26121 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
26122 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
26123 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
26124 </p><p>[http://google.com]
26125 </p><p>[http://google.com google]
26126 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26127 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26128 </p>
26129 !! end
26130
26131 !! test
26132 Links 5. ExtLinks: No escapes needed
26133 !! options
26134 parsoid=html2wt
26135 !! html/parsoid
26136 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
26137 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
26138 !! wikitext
26139 [http://google.com [google]
26140
26141 [[http://google.com]]
26142 !! html/php
26143 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
26144 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
26145 </p>
26146 !! end
26147
26148 !! test
26149 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
26150 !! options
26151 parsoid=html2wt
26152 !! html/parsoid
26153 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
26154 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
26155 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
26156 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
26157 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
26158 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
26159 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26160 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
26161 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26162 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
26163 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
26164 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
26165 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
26166 </p>
26167 !! wikitext
26168 x<nowiki/>http://example.com<nowiki/>y
26169 http://example.com<nowiki/>?x
26170 http://example.com<nowiki/>&x
26171 http://example.com<nowiki/>'x
26172 http://example.com<nowiki/>,x
26173 http://example.com<nowiki/>.x
26174 http://example.com<nowiki/>;x
26175 http://example.com<nowiki/>:x
26176 http://example.com<nowiki/>;x
26177 http://example.com<nowiki/>!x
26178 http://example.com<nowiki/>=x
26179 http://example.com<nowiki/>(x)
26180 http://example.com(x<nowiki/>)
26181 !! end
26182
26183 !! test
26184 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26185 !! options
26186 parsoid=html2wt
26187 !! html/parsoid
26188 <p>x
26189 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
26190 y
26191 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
26192 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
26193 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
26194 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
26195 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
26196 </p>
26197 !! wikitext
26198 x
26199 http://example.com
26200 y
26201 "http://example.com"
26202 (http://example.com)
26203 (http://example.com) foo
26204 http://example.com,
26205 http://example.com, foo
26206 !! html/php
26207 <p>x
26208 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
26209 y
26210 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
26211 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
26212 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
26213 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
26214 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
26215 </p>
26216 !! end
26217
26218 !! test
26219 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26220 !! options
26221 parsoid=html2wt
26222 !! html/parsoid
26223 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
26224 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
26225 !! wikitext
26226 http://example.com.,;:!?\
26227 -http://example.com:
26228 !! html/php
26229 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
26230 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
26231 </p>
26232 !! end
26233
26234 !! test
26235 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
26236 !! options
26237 parsoid=html2wt
26238 !! html/parsoid
26239 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
26240 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
26241 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
26242 !! wikitext
26243 RFC 123<nowiki/>4
26244 RFC 123<nowiki/>y
26245 X<nowiki/>RFC 123<nowiki/>y
26246 !! end
26247
26248 !! test
26249 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
26250 !! options
26251 parsoid=html2wt
26252 !! html/parsoid
26253 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
26254 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
26255 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
26256 </p>
26257 !! wikitext
26258 RFC 123?foo
26259 RFC 123&foo
26260 -RFC 123-
26261 !! html/php
26262 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
26263 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
26264 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
26265 </p>
26266 !! end
26267
26268 !! test
26269 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
26270 !! options
26271 parsoid=html2wt
26272 !! html/parsoid
26273 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
26274 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26275 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26276 !! wikitext
26277 PMID 123<nowiki/>4
26278 PMID 123<nowiki/>y
26279 X<nowiki/>PMID 123<nowiki/>y
26280 !! end
26281
26282 !! test
26283 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
26284 !! options
26285 parsoid=html2wt
26286 !! html/parsoid
26287 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
26288 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
26289 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
26290 </p>
26291 !! wikitext
26292 PMID 123?foo
26293 PMID 123&foo
26294 -PMID 123-
26295 !! html/php
26296 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
26297 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
26298 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
26299 </p>
26300 !! end
26301
26302 !! test
26303 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
26304 !! options
26305 parsoid=html2wt
26306 !! html/parsoid
26307 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
26308 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
26309 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
26310 </p>
26311 !! wikitext
26312 ISBN 1234567890<nowiki/>1
26313 ISBN 1234567890<nowiki/>x
26314 a<nowiki/>ISBN 1234567890<nowiki/>b
26315 !! end
26316
26317 !! test
26318 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
26319 !! options
26320 parsoid=html2wt
26321 !! html/parsoid
26322 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26323 !! wikitext
26324 -ISBN 1234567890's
26325 !! html/php
26326 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26327 </p>
26328 !! end
26329
26330 !! test
26331 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26332 !! options
26333 parsoid=html2wt
26334 !! html/*
26335 <p>this is not a link: http://example.com
26336 </p>
26337 !! wikitext
26338 this is not a link: <nowiki>http://example.com</nowiki>
26339 !! end
26340
26341 !! test
26342 Links 15. Link trails can't become link prefixes.
26343 !! options
26344 language=is
26345 parsoid=html2wt
26346 !! html/parsoid
26347 <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>
26348 !! wikitext
26349 [[Söfnuður]]-[[00]]
26350 !! html/php
26351 <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>
26352 </p>
26353 !! end
26354
26355 #### --------------- Quotes ---------------
26356 #### 1. Quotes inside <b> and <i>
26357 #### 2. Link fragments separated by <i> and <b> tags
26358 #### 3. Link fragments inside <i> and <b>
26359 #### 4. No escaping needed
26360 #### --------------------------------------
26361 !! test
26362 1a. Quotes inside <b> and <i>
26363 !! options
26364 parsoid=html2wt
26365 !! html/*
26366 <p><i>'foo'</i>
26367 <i>''foo''</i>
26368 <i>'''foo'''</i>
26369 <i>foo</i>'s
26370 <b>'foo'</b>
26371 <b>''foo''</b>
26372 <b>'''foo'''</b>
26373 <b>foo'<i>bar'</i>baz</b>
26374 <b>foo</b>'s
26375 '<i>foo</i>
26376 <i>foo</i>'
26377 <i>foo'</i>'
26378 '<i>foo</i>'
26379 '<b>foo</b>
26380 <b>foo</b>'
26381 '<b>foo</b>'
26382 <i>fools'<span> errand</span></i>
26383 <i><span>fool</span>'s errand</i>
26384 '<i>foo</i> bar '<i>baz</i>
26385 a|!*#-:;+-~[]{}b'<i>x</i>
26386 </p>
26387 !! wikitext
26388 ''<nowiki/>'foo'''
26389 ''<nowiki>''foo''</nowiki>''
26390 ''<nowiki>'''foo'''</nowiki>''
26391 ''foo''<nowiki/>'s
26392 '''<nowiki/>'foo''''
26393 '''<nowiki>''foo''</nowiki>'''
26394 '''<nowiki>'''foo'''</nowiki>'''
26395 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26396 '''foo'''<nowiki/>'s
26397 '''foo''
26398 ''foo''<nowiki/>'
26399 ''foo'''<nowiki/>'
26400 '''foo''<nowiki/>'
26401 ''''foo'''
26402 '''foo'''<nowiki/>'
26403 ''''foo'''<nowiki/>'
26404 ''fools'<span> errand</span>''
26405 ''<span>fool</span>'s errand''
26406 '<nowiki/>''foo'' bar '''baz''
26407 a|!*#-:;+-~[]{}b'''x''
26408 !! end
26409
26410 !! test
26411 1b. Quotes inside <b> and <i> with other tags on same line
26412 !! options
26413 parsoid=html2wt
26414 !! html/parsoid
26415 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26416 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26417 <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>
26418 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26419 '<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>
26420 '<i>foo</i> <div title="name">test</div>
26421 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26422 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26423 <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>
26424 </ol>
26425 !! wikitext
26426 '''a'' foo ''[[bar]]''
26427 ''a''' foo ''[[bar]]''
26428 ''a''' foo '''{{echo|[[bar]]}}'''
26429 [[foo]] x'''[[bar]]''
26430 '''foo'' <ref>test</ref>
26431 '''foo'' <div title="name">test</div>
26432 '''foo'' and <br> bar
26433 <references />
26434 !! end
26435
26436 !! test
26437 2. Link fragments separated by <i> and <b> tags
26438 !! options
26439 parsoid=html2wt
26440 !! html/parsoid
26441 <p>[[<i>foo</i>hello]]</p>
26442 <p>[[<b>foo</b>hello]]</p>
26443 !! wikitext
26444 [[''foo''<nowiki>hello]]</nowiki>
26445
26446 [['''foo'''<nowiki>hello]]</nowiki>
26447 !! end
26448
26449 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26450 # this is one of the shortcomings of this format
26451 !! test
26452 3. Link fragments inside <i> and <b>
26453 !! options
26454 parsoid=html2wt
26455 !! html/parsoid
26456 <p><i>[[foo</i>]]</p>
26457 <p><b>[[foo</b>]]</p>
26458 !! wikitext
26459 ''[[foo''<nowiki>]]</nowiki>
26460
26461 '''[[foo'''<nowiki>]]</nowiki>
26462 !! end
26463
26464 !! test
26465 4. No escaping needed
26466 !! options
26467 parsoid=html2wt
26468 !! html/parsoid
26469 <p>'<span><i>bar</i></span>'
26470 '<span><b>bar</b></span>'
26471 'a:b'foo
26472 </p>
26473 !! wikitext
26474 '<span>''bar''</span>'
26475 '<span>'''bar'''</span>'
26476 'a:b'foo
26477 !! end
26478
26479 #### ----------- Paragraphs ---------------
26480 #### 1. No unnecessary escapes
26481 #### --------------------------------------
26482
26483 !! test
26484 1. No unnecessary escapes
26485 !! options
26486 parsoid=html2wt
26487 !! html/parsoid
26488 <p>bar <span>[[foo]]</span>
26489 </p><p>=bar <span>[[foo]]</span>
26490 </p><p>[[bar <span>[[foo]]</span>
26491 </p><p>]]bar <span>[[foo]]</span>
26492 </p><p>=bar <span>foo]]</span>=
26493 </p>
26494 !! wikitext
26495 bar <span><nowiki>[[foo]]</nowiki></span>
26496
26497 =bar <span><nowiki>[[foo]]</nowiki></span>
26498
26499 [[bar <span><nowiki>[[foo]]</nowiki></span>
26500
26501 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26502
26503 =bar <span>foo]]</span><nowiki>=</nowiki>
26504 !!end
26505
26506 #### ----------------------- PRE --------------------------
26507 !! test
26508 1. Leading whitespace in SOL context should be escaped
26509 !! options
26510 parsoid=html2wt
26511 !! html/parsoid
26512 <p> a</p>
26513
26514 <p> a</p>
26515
26516 <p> a(tab)</p>
26517
26518 <p> a
26519 <!--cmt-->
26520 a</p>
26521
26522 <p>a
26523 b</p>
26524
26525 <p>a
26526 b</p>
26527
26528 <p>a
26529 b</p>
26530 !! wikitext
26531 <nowiki> </nowiki>a
26532
26533 <nowiki> </nowiki> a
26534
26535 a(tab)
26536
26537 <nowiki> </nowiki> a
26538 <!--cmt-->
26539 <nowiki> </nowiki>a
26540
26541 a
26542 <nowiki> </nowiki>b
26543
26544 a
26545 b
26546
26547 a
26548 b
26549 !! html/php
26550 <p> a
26551 </p><p> a
26552 </p><p> a(tab)
26553 </p><p> a
26554 a
26555 </p><p>a
26556 b
26557 </p><p>a
26558 b
26559 </p><p>a
26560 b
26561 </p>
26562 !! end
26563
26564 !! test
26565 2. Leading whitespace in non-indent-pre contexts should not be escaped
26566 !! options
26567 parsoid=html2wt
26568 !! html/parsoid
26569 <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>
26570 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26571 <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>
26572 b</span></li>
26573 </ol>
26574 !! wikitext
26575 foo <ref>''a''
26576 b</ref>
26577 <references />
26578 !! end
26579
26580 !! test
26581 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26582 !! options
26583 parsoid=html2wt
26584 !! html/parsoid
26585 <blockquote>
26586 <p>
26587 a
26588 <span>b</span>
26589 c</p>
26590 </blockquote>
26591 !! wikitext
26592 <blockquote>
26593 a
26594 <span>b</span>
26595 c
26596 </blockquote>
26597 !! end
26598
26599 !! test
26600 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26601 !! options
26602 parsoid=html2wt
26603 !! html/parsoid
26604 <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>
26605 !! wikitext
26606 [[File:Foobar.jpg|thumb|caption]]
26607 !! end
26608
26609 !! test
26610 5. Nowiki escaping should account for indent-pres
26611 !! options
26612 parsoid=html2wt
26613 !! html/parsoid
26614 <pre>==foo==</pre>
26615 !! wikitext
26616 ==foo==
26617 !! end
26618
26619 !! test
26620 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26621 !! options
26622 parsoid=html2wt
26623 !! html/parsoid
26624 <pre>
26625 * foo
26626 * bar
26627 </pre>
26628 !! wikitext
26629 * foo
26630 * bar
26631 !! end
26632
26633 !! test
26634 Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup
26635 !! options
26636 parsoid = {
26637 "modes": ["html2wt"],
26638 "scrubWikitext": true
26639 }
26640 !! html/parsoid
26641 <p> foo</p>
26642 <p> %foo</p>
26643 <p> *foo</p>
26644 <p> #foo</p>
26645 <p> =foo=</p>
26646 <p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p>
26647 <p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p>
26648 <p> <!--boo-->*foo</p>
26649 <p><!--boo--> *foo</p>
26650 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p>
26651 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p>
26652 !! wikitext
26653 foo
26654
26655 %foo
26656
26657 <nowiki/>*foo
26658
26659 <nowiki/>#foo
26660
26661 <nowiki/>=foo=
26662
26663 [[Category:Foo]]
26664 <nowiki/>*foo
26665
26666 [[Category:Foo]]
26667 <nowiki>*</nowiki>foo
26668
26669 <nowiki/><!--boo-->*foo
26670
26671 <!--boo--><nowiki/>*foo
26672
26673 <!--a--><!--b--><!--c--><!--d--><!--e-->foo
26674
26675 <!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo
26676 !! end
26677
26678 #### --------------- Behavior Switches --------------------
26679
26680 !! test
26681 1. Valid behavior switches should be escaped
26682 !! options
26683 parsoid=html2wt
26684 !! html/parsoid
26685 __TOC__
26686 <i>__TOC__</i>
26687 !! wikitext
26688 <nowiki>__TOC__</nowiki>
26689 ''<nowiki>__TOC__</nowiki>''
26690 !! end
26691
26692 !! test
26693 2. Invalid behavior switches should not be escaped
26694 !! options
26695 parsoid=html2wt
26696 !! html/parsoid
26697 __TOO__
26698 __|__
26699 !! wikitext
26700 __TOO__
26701 __|__
26702 !! end
26703
26704 # We use indent-pre as an indirect way to test for sol-transparent behavior.
26705 !! test
26706 Behavior switches should be SOL-transparent
26707 !! options
26708 parsoid=html2wt
26709 !! html/parsoid
26710 <meta property="mw:PageProp/toc" />
26711
26712 <!-- this one's bogus -->
26713 <pre>__TOO__</pre>
26714
26715 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26716
26717 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26718 !! wikitext
26719 __TOC__
26720
26721 <!-- this one's bogus -->
26722 __TOO__
26723
26724 __TOC__ foo
26725
26726 __TOC__
26727 bar
26728 !! end
26729
26730 #### --------------- HTML tags ---------------
26731 #### 1. a tags
26732 #### 2. other tags
26733 #### 3. multi-line html tag
26734 #### 4. extension tags
26735 #### -----------------------------------------
26736 !! test
26737 1. a tags
26738 !! options
26739 parsoid=html2wt
26740 !! html/parsoid
26741 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26742 !! wikitext
26743 <a href="http://google.com">google</a>
26744 !! end
26745
26746 !! test
26747 2. other tags
26748 !! options
26749 parsoid=html2wt
26750 !! html/parsoid
26751 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26752 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26753 <li> &lt;td&gt;</li></ul>
26754
26755 !! wikitext
26756 * <nowiki><div>foo</div></nowiki>
26757 * <nowiki><div style="color:red">foo</div></nowiki>
26758 * <nowiki><td></nowiki>
26759 !! end
26760
26761 !! test
26762 3. multi-line html tag
26763 !! options
26764 parsoid=html2wt
26765 !! html/parsoid
26766 <p>&lt;div
26767 &gt;foo&lt;/div
26768 &gt;
26769 </p>
26770 !! wikitext
26771 <nowiki><div
26772 >foo</div
26773 ></nowiki>
26774 !! end
26775
26776 !! test
26777 4. extension tags
26778 !! options
26779 parsoid=html2wt
26780 !! html/parsoid
26781 <p>&lt;ref&gt;foo&lt;/ref&gt;
26782 </p><p>&lt;ref&gt;bar
26783 </p><p>baz&lt;/ref&gt;
26784 </p>
26785 !! wikitext
26786 <nowiki><ref>foo</ref></nowiki>
26787
26788 <nowiki><ref>bar</nowiki>
26789
26790 baz<nowiki></ref></nowiki>
26791 !! end
26792
26793 !! test
26794 Parsoid: newline inducing block nodes don't suppress <nowiki>
26795 !! options
26796 parsoid=html2wt
26797 !! html/parsoid
26798 a<h1>foo</h1>
26799 !! wikitext
26800 <nowiki> </nowiki>a
26801
26802 = foo =
26803 !! end
26804
26805 #### --------------- Others ---------------
26806 !! test
26807 Escaping nowikis
26808 !! options
26809 parsoid=html2wt
26810 !! html/parsoid
26811 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26812 </p>
26813 !! wikitext
26814 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26815 !! end
26816
26817 ## The quote-char in the input is necessary for triggering the bug
26818 !! test
26819 (T54035) Nowiki-escaping should not get tripped by " :" in text
26820 !! options
26821 parsoid=html2wt
26822 !! html/parsoid
26823 <p>foo's bar :</p>
26824 !! wikitext
26825 foo's bar :
26826 !! end
26827
26828 #----------- End of wikitext escaping tests --------------
26829
26830 !! test
26831
26832 Tag-like HTML structures are passed through as text
26833 !! wikitext
26834 <x y>
26835
26836 <x.y>
26837
26838 <x-y>
26839
26840 1>2
26841
26842 x<y
26843
26844 a>b
26845
26846 1<d e>f
26847 !! html
26848 <p>&lt;x y&gt;
26849 </p><p>&lt;x.y&gt;
26850 </p><p>&lt;x-y&gt;
26851 </p><p>1&gt;2
26852 </p><p>x&lt;y
26853 </p><p>a&gt;b
26854 </p><p>1&lt;d e&gt;f
26855 </p>
26856 !! end
26857
26858 !! test
26859 HTML tag with necessary entities in attributes
26860 !! wikitext
26861 <span title="&amp;amp;">foo</span>
26862 !! html
26863 <p><span title="&amp;amp;">foo</span>
26864 </p>
26865 !! end
26866
26867 !! test
26868 HTML tag with 'unnecessary' entity encoding in attributes
26869 !! wikitext
26870 <span title="&amp;">foo</span>
26871 !! html
26872 <p><span title="&amp;">foo</span>
26873 </p>
26874 !! end
26875
26876 !! test
26877 HTML tag with broken attribute value quoting
26878 !! options
26879 parsoid=wt2html,html2html
26880 !! wikitext
26881 <span title="Hello world>Foo</span>
26882 !! html/php
26883 <p><span title="Hello world">Foo</span>
26884 </p>
26885 !! html/parsoid
26886 <p><span title="Hello world">Foo</span></p>
26887 !! end
26888
26889 !! test
26890 Self-closed tag with broken attribute value quoting
26891 !! options
26892 parsoid=wt2html,html2html
26893 !! wikitext
26894 <div title="Hello world />Foo
26895 !! html/php+tidy
26896 <div title="Hello world"></div><p>Foo
26897 </p>
26898 !! html/parsoid
26899 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
26900 !! end
26901
26902 !! test
26903 Table with broken attribute value quoting
26904 !! options
26905 parsoid=wt2html,html2html
26906 !! wikitext
26907 {|
26908 | title="Hello world|Foo
26909 |}
26910 !! html/php
26911 <table>
26912 <tr>
26913 <td title="Hello world">Foo
26914 </td></tr></table>
26915
26916 !! html/parsoid
26917 <table>
26918 <tr>
26919 <td title="Hello world">Foo
26920 </td></tr></table>
26921
26922 !! end
26923
26924 !! test
26925 Table with broken attribute value quoting on consecutive lines
26926 !! options
26927 parsoid=wt2html,html2html
26928 !! wikitext
26929 {|
26930 | title="Hello world|Foo
26931 | style="color:red|Bar
26932 |}
26933 !! html/php
26934 <table>
26935 <tr>
26936 <td title="Hello world">Foo
26937 </td>
26938 <td style="color:red">Bar
26939 </td></tr></table>
26940
26941 !! html/parsoid
26942 <table><tbody>
26943 <tr>
26944 <td title="Hello world">Foo
26945 </td><td style="color: red">Bar
26946 </td></tr></tbody></table>
26947
26948 !! end
26949
26950 !!test
26951 Accept empty td cell attribute
26952 !! wikitext
26953 {|
26954 | align="center" |foo|| |
26955 |}
26956 !! html
26957 <table>
26958 <tr>
26959 <td align="center">foo</td>
26960 <td>
26961 </td></tr></table>
26962
26963 !!end
26964
26965 !!test
26966 Non-empty attributes in th-cells
26967 !! wikitext
26968 {|
26969 !Foo!! style="color: red" |Bar
26970 |}
26971 !! html
26972 <table>
26973 <tr>
26974 <th>Foo</th>
26975 <th style="color: red">Bar
26976 </th></tr></table>
26977
26978 !!end
26979
26980 !!test
26981 Accept empty attributes in th-cells
26982 !! wikitext
26983 {|
26984 !|foo!!|bar
26985 |}
26986 !! html
26987 <table>
26988 <tr>
26989 <th>foo</th>
26990 <th>bar
26991 </th></tr></table>
26992
26993 !!end
26994
26995 !!test
26996 Empty table rows go away
26997 !! wikitext
26998 {|
26999 |Hello
27000 |there
27001 |- class="foo"
27002 |-
27003 |}
27004 !! html
27005 <table>
27006 <tr>
27007 <td>Hello
27008 </td>
27009 <td>there
27010 </td></tr>
27011
27012 </table>
27013
27014 !! end
27015
27016 ###
27017 ### Parsoid-centric tests for testing RTing of inter-element separators
27018 ### Edge cases not tested by existing parser tests and specific to
27019 ### Parsoid-specific serialization strategies.
27020 ###
27021
27022 !!test
27023 RT-ed inter-element separators should be valid separators
27024 !! wikitext
27025 {|
27026 |- [[foo]]
27027 |}
27028 !! html/php
27029 <table>
27030
27031 </table>
27032
27033 !! html/parsoid
27034 <table>
27035 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
27036 </tbody></table>
27037 !!end
27038
27039 # Parsoid-only test of a DOM pass
27040 !!test
27041 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
27042 !! wikitext
27043 {|
27044 |<small>foo
27045 bar
27046 |}
27047
27048 {|
27049 |<small>foo<small>
27050 |}
27051 !! html/parsoid
27052 <table>
27053 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
27054 <p>bar</p></small></td></tr>
27055 </tbody></table>
27056
27057 <table>
27058 <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>
27059 </tbody></table>
27060 !!end
27061
27062 # Note that the "style" attribute is really a template parameter here.
27063 # The = would have to be {{=}} if you wanted the literal.
27064 !!test
27065 Empty TD followed by TD with tpl-generated attribute
27066 !! wikitext
27067 {|
27068 |-
27069 |
27070 |{{echo|style='color:red'}}|foo
27071 |}
27072 !! html
27073 <table>
27074
27075 <tr>
27076 <td>
27077 </td>
27078 <td>foo
27079 </td></tr></table>
27080
27081 !!end
27082
27083 !!test
27084 Indented table with an empty td
27085 !! wikitext
27086 {|
27087 |-
27088 |
27089 |foo
27090 |}
27091 !! html
27092 <table>
27093
27094 <tr>
27095 <td>
27096 </td>
27097 <td>foo
27098 </td></tr></table>
27099
27100 !!end
27101
27102 ## We have some newline diffs RT-ing this edge case
27103 ## and it is not important enough -- we seem to be emitting
27104 ## at most 2 newlines after a </tr> and this is unrelated to
27105 ## the issue from T85627 that this is testing.
27106 !!test
27107 Indented table with blank lines in between (T85627)
27108 !! options
27109 parsoid=wt2html
27110 !! wikitext
27111 {|
27112 |foo
27113
27114
27115 |}
27116 !! html
27117 <table>
27118
27119 <tr>
27120 <td>foo
27121 </td></tr></table>
27122
27123 !!end
27124
27125 !!test
27126 Indented block & table
27127 !! wikitext
27128 <div>foo</div>
27129 {|
27130 |foo
27131 |}
27132 !! html/php
27133 <div>foo</div>
27134 <table>
27135 <tr>
27136 <td>foo
27137 </td></tr></table>
27138
27139 !! html/parsoid
27140 <div data-parsoid='{"stx":"html"}'>foo</div>
27141 <table><tbody>
27142 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
27143 </tbody></table>
27144 !!end
27145
27146 !! test
27147 Indent and comment before table row
27148 !! wikitext
27149 {|
27150 <!--hi-->|-
27151 |there
27152 |}
27153 !! html/php
27154 <table>
27155
27156 <tr>
27157 <td>there
27158 </td></tr></table>
27159
27160 !! html/parsoid
27161 <table>
27162 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
27163 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
27164 </tbody></table>
27165 !! end
27166
27167 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
27168 !!test
27169 Empty TR followed by a template-generated TR
27170 !!options
27171 parsoid
27172 !! wikitext
27173 {|
27174 |-
27175 {{echo|<tr><td>foo</td></tr>}}
27176 |}
27177 !! html
27178 <table>
27179 <tbody>
27180 <tr class='mw-empty-elt'></tr>
27181 <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}}]}'>
27182 <td>foo</td></tr>
27183 </tbody></table>
27184 !!end
27185
27186 ## PHP and parsoid output differ for this, and since this is primarily
27187 ## for testing Parsoid's serializer, marking this Parsoid only
27188 !!test
27189 Empty TR followed by mixed-ws-comment line should RT correctly
27190 !!options
27191 parsoid
27192 !! wikitext
27193 {|
27194 |-
27195 <!--c-->
27196 |-
27197 <!--c--> <!--d-->
27198 |}
27199 !! html
27200 <table>
27201 <tbody>
27202 <tr class='mw-empty-elt'></tr>
27203 <!--c-->
27204 <tr>
27205 <!--c--> </tr><!--d-->
27206 </tbody></table>
27207
27208 !!end
27209
27210 !!test
27211 Multi-line image caption generated by templates with/without trailing newlines
27212 !! wikitext
27213 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
27214 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
27215 !! html/parsoid
27216 <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>
27217 <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>
27218 !!end
27219
27220 !! test
27221 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
27222 !! options
27223 parsoid=html2wt
27224 !! html/parsoid
27225 <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>
27226
27227 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
27228 !! wikitext
27229 <includeonly>foo</includeonly>
27230 new para
27231
27232 [[Category:Foo]]
27233
27234 = new heading =
27235 !! end
27236
27237 ## PHP emits broken html for this, and since this is primarily
27238 ## a Parsoid serializer test, marking this Parsoid only
27239 !!test
27240 Improperly nested inline or quotes tags with whitespace in between
27241 !! wikitext
27242 <span> <s>x</span> </s>
27243 ''' ''x''' ''
27244 !! html/parsoid
27245 <p><span> <s>x</s></span><s> </s>
27246 <b> <i>x</i></b><i> </i>
27247 </p>
27248 !!end
27249
27250 !!test
27251 Encapsulate protected attributes from wt
27252 !! wikitext
27253 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
27254
27255 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
27256 |ok
27257 |}
27258 !! html/parsoid
27259 <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>
27260
27261 <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">
27262 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'>ok</td></tr>
27263 </tbody></table>
27264 !!end
27265
27266 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
27267 ## Having nested or stray pre tags results in the attempt to add duplicates,
27268 ## causing an assertion fail. This test tries to prevent that situation.
27269 !!test
27270 Ensure ParagraphWrapper can deal with stray closing pre tags
27271 !!options
27272 parsoid=wt2html
27273 !! wikitext
27274 plain text</pre>
27275 !! html/parsoid
27276 plain text
27277 !!end
27278
27279 !! test
27280 1. Ensure fostered text content is wrapped in element nodes
27281 !! options
27282 parsoid=wt2html
27283 !! wikitext
27284 <table>hi</table><table>ho</table>
27285 !! html/php+tidy
27286 hi<table></table>ho<table></table>
27287 !! html/parsoid
27288 <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>
27289 !! end
27290
27291 !! test
27292 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
27293 !! options
27294 parsoid=wt2html,wt2wt
27295 !! wikitext
27296 <table>
27297 <tr> || ||
27298 <td> a
27299 </table>
27300 !! html/php+tidy
27301 || ||
27302 <table>
27303 <tbody><tr><td> a
27304 </td></tr></tbody></table>
27305 !! html/parsoid
27306 <span data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||
27307 </span><table data-parsoid='{"stx":"html"}'>
27308 <tbody><tr data-parsoid='{"stx":"html","autoInsertedEnd":true}'><td data-parsoid='{"stx":"html","autoInsertedEnd":true}'> a
27309 </td></tr></tbody></table>
27310 !! end
27311
27312 !! test
27313 Encapsulation properly handles null DSR information from foster box
27314 !! options
27315 parsoid=wt2html,wt2wt
27316 !! wikitext
27317 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
27318 !! html/parsoid
27319 <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>
27320 !! end
27321
27322 !! test
27323 1. Encapsulate foster-parented transclusion content
27324 !! options
27325 parsoid=wt2wt,wt2html
27326 !! wikitext
27327 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
27328 !! html/php+tidy
27329 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
27330 !! html/parsoid
27331 <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>
27332 !! end
27333
27334 !! test
27335 2. Encapsulate foster-parented transclusion content
27336 !! options
27337 parsoid=wt2wt,wt2html
27338 !! wikitext
27339 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
27340 !! html/parsoid
27341 <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>
27342 <table>
27343 <tbody>
27344 <tr>
27345 <td>bar</td>
27346 </tr>
27347 </tbody>
27348 </table>
27349 !! end
27350
27351 !! test
27352 3. Encapsulate foster-parented transclusion content
27353 !! options
27354 parsoid=wt2wt,wt2html
27355 !! wikitext
27356 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27357 !! html/parsoid
27358 <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;]}">
27359 <p>foo</p>
27360 </div>
27361 <table>
27362 <tbody>
27363 <tr>
27364 <td>bar</td>
27365 </tr>
27366 </tbody>
27367 </table>
27368 !! end
27369
27370 !! test
27371 4. Encapsulate foster-parented transclusion content
27372 !! options
27373 parsoid=wt2wt,wt2html
27374 !! wikitext
27375 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27376 !! html/parsoid
27377 <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;]}">
27378 <p>foo</p>
27379 </div>
27380 <table>
27381 <tbody>
27382 <tr>
27383 <td>bar</td>
27384 </tr>
27385 </tbody>
27386 </table>
27387 !! end
27388
27389 !! test
27390 5. Encapsulate foster-parented transclusion content
27391 !!options
27392 parsoid=wt2wt,wt2html
27393 !! wikitext
27394 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27395 !! html/php+tidy
27396 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
27397 !! html/parsoid
27398 <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>
27399 !! end
27400
27401 !! test
27402 6. Encapsulate foster-parented transclusion content
27403 !! options
27404 parsoid=wt2wt,wt2html
27405 !! wikitext
27406 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27407 !! html/php+tidy
27408 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
27409 !! html/parsoid
27410 <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>
27411 !! end
27412
27413 !! test
27414 7. Encapsulate foster-parented transclusion content
27415 !!options
27416 parsoid=wt2wt,wt2html
27417 !! wikitext
27418 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27419 !! html/parsoid
27420 <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>
27421 <table>
27422 <tbody>
27423 <tr>
27424 <td>bar</td>
27425 </tr>
27426 </tbody>
27427 </table>
27428 !! end
27429
27430 # Note that the wt is broken on purpose: the = should be {{=}} if you
27431 # don't want it to be a template parameter key.
27432 !! test
27433 8. Encapsulate foster-parented transclusion content
27434 !! options
27435 parsoid=wt2wt,wt2html
27436 !! wikitext
27437 {{echo|a
27438 }}{|{{echo|style='color:red'}}
27439 |-
27440 |b
27441 |}
27442 !! html/php+tidy
27443 <p>a
27444 </p>
27445 <table>
27446
27447 <tbody><tr>
27448 <td>b
27449 </td></tr></tbody></table>
27450 !! html/parsoid
27451 <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">
27452 </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">
27453 <tbody><tr>
27454 <td>b
27455 </td></tr></tbody></table>
27456 !! end
27457
27458 !! test
27459 9. Encapsulate foster-parented transclusion content
27460 !!options
27461 parsoid=wt2wt,wt2html
27462 !! wikitext
27463 <table>{{echo|hi</table>hello}}
27464 !! html/php+tidy
27465 hi<table></table><p>hello
27466 </p>
27467 !! html/parsoid
27468 <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>
27469 !! end
27470
27471 !! test
27472 Table in fosterable position
27473 !!options
27474 parsoid=wt2html
27475 !! wikitext
27476 {{OpenTable}}
27477 <div>
27478 {|
27479 |}
27480 </div>
27481 |}
27482 !! html/parsoid
27483 <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">
27484 </span>
27485 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27486
27487 <table>
27488 </table>
27489 !! end
27490
27491 # Parsoid only for T66747
27492 !! test
27493 Properly encapsulate empty-content transclusions in fosterable positions
27494 !! wikitext
27495 <table>
27496 {{#if:|
27497 <td>foo</td>
27498 }}
27499 </table>
27500 !! html/parsoid
27501 <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"}]]}'>
27502
27503 </table>
27504 !! end
27505
27506 !! test
27507 Always encapsulate foster box when template range is expanded to table
27508 !! options
27509 parsoid=wt2wt
27510 !! wikitext
27511 {|
27512 hello
27513 {{OpenTable}}
27514 |}
27515 !! html/parsoid
27516
27517 !! end
27518
27519 !! test
27520 T115289: Unclosed table
27521 !! wikitext
27522 {{echo|<table>}}<!--c-->[[Category:Two]]
27523 !! html/parsoid
27524 <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>
27525 !! end
27526
27527 !! test
27528 T115289: Don't migrate newlines out of tables with fostered content
27529 !! wikitext
27530 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27531 !! html/parsoid
27532 <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>
27533 !! end
27534
27535 !! test
27536 T73074: More fostering fun
27537 !! wikitext
27538 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27539 !! html/parsoid
27540 <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>
27541 !! end
27542
27543 !!test
27544 Support <object> element with .data attribute
27545 !!options
27546 parsoid=html2wt
27547 !! html/parsoid
27548 <object data="test.swf"></object>
27549 !! wikitext
27550 <object data="test.swf"></object>
27551 !!end
27552
27553 !! test
27554 Don't block XML namespace declaration
27555 !! wikitext
27556 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27557 !! html/php
27558 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27559 </p>
27560 !! html/parsoid
27561 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27562 !! end
27563
27564 # -----------------------------------------------------------------
27565 # The following section of tests are primarily to spec requirements
27566 # around Parsoid's serialization (old, new, edited content)
27567 #
27568 # All these tests are marked Parsoid html2wt and html2html only
27569 # ----------------------------------------------------------------
27570
27571 !! test
27572 Ignore rel attribute in a-tags during serialization to url-links
27573 !! options
27574 parsoid=html2wt
27575 !! html/parsoid
27576 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27577 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27578 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27579 !! wikitext
27580 http://en.wikipedia.org/wiki/Foobar
27581 http://en.wikipedia.org/wiki/Foobar
27582 http://en.wikipedia.org/wiki/Foobar
27583 !! end
27584
27585 # 'mi' is a localinterwiki prefix as well as a language
27586 !! test
27587 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27588 !! options
27589 parsoid=html2wt
27590 !! html/parsoid
27591 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27592 !! wikitext
27593 [[Foo]]
27594 !! end
27595
27596 !! test
27597 Parsoid should accept interwiki shortcuts
27598 !! options
27599 parsoid=html2wt
27600 !! html/parsoid
27601 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27602 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27603 <a href='./fr:Foo'>Foo</a></p>
27604 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27605 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27606 <a href='fr%3AFoo'>Foo</a></p>
27607 <p><a href='FR%3AFoo'>Foo</a>
27608 <a href='./FR:Foo'>Foo</a></p>
27609 !! wikitext
27610 [[:fr:Foo|Foo]]
27611 [[:fr:Foo|Foo]]
27612 [[:fr:Foo|Foo]]
27613
27614 [[:fr:Foo|Foo]]
27615 [[:fr:Foo|Foo]]
27616 [[:fr:Foo|Foo]]
27617
27618 [[:fr:Foo|Foo]]
27619 [[:fr:Foo|Foo]]
27620 !! end
27621
27622 !! test
27623 Parsoid should not accept invalid interwiki shortcuts
27624 !! options
27625 parsoid=html2wt
27626 !! html/parsoid
27627 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
27628 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
27629 <a href='news:Foo'>Foo</a></p>
27630 !! wikitext
27631 [news:Foo Foo]
27632 [news:Foo Foo]
27633 [news:Foo Foo]
27634 !! end
27635
27636 # See T93839
27637 !! test
27638 New wikilinks should be serialized properly
27639 !! options
27640 parsoid=html2wt
27641 !! html/parsoid
27642 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
27643 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
27644 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
27645 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
27646 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
27647 !! wikitext
27648 [[Foo]]
27649 [[Foo]]
27650 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
27651 http://en.wikipedia.org/wiki/Foo
27652 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
27653 !! end
27654
27655 !! test
27656 New wiki links (href variations)
27657 !! options
27658 parsoid=html2wt
27659 !! html/parsoid
27660 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27661 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
27662 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
27663 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
27664 !! wikitext
27665 [[Foo_bar]]
27666 [[Foo_bar]]
27667 [[Foo_bar]]
27668 [[Toxine bactérienne]]
27669 !! end
27670
27671 !! test
27672 New wiki links (content string variations)
27673 !! options
27674 parsoid=html2wt
27675 !! html/parsoid
27676 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27677 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
27678 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
27679 !! wikitext
27680 [[Foo_bar]]
27681 [[Foo bar]]
27682 [[Foo_bar|./Foo_bar]]
27683 !! end
27684
27685 !! test
27686 New category links (href variations)
27687 !! options
27688 parsoid=html2wt
27689 !! html/parsoid
27690 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
27691 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
27692 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
27693 !! wikitext
27694 [[Category:Toxine bactérienne]]
27695 [[Category:Toxine bactérienne]]
27696 [[Category:Toxine bactérienne]]
27697 !! end
27698
27699 !! test
27700 New sol transparent links don't need indent-pre nowiki protection
27701 !! options
27702 parsoid=html2wt
27703 language=de
27704 !! html/parsoid
27705 <link rel="mw:PageProp/redirect" href="./Main_Page">
27706 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27707 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27708 !! wikitext
27709 #WEITERLEITUNG [[Main Page]]
27710 <!-- this is good --> [[Category:Good]]
27711 <!-- this is great --> [[Kategorie:Great]]
27712 !! end
27713
27714 !! test
27715 New interlanguage links (href variations)
27716 !! options
27717 parsoid=html2wt
27718 !! html/parsoid
27719 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
27720 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
27721 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
27722 !! wikitext
27723 [[es:Toxine bactérienne]]
27724 [[es:Toxine_bactérienne]]
27725 [[es:Toxine_bactérienne]]
27726 !! end
27727
27728 !! test
27729 Image: Modifying size of an image (1)
27730 !! options
27731 parsoid={
27732 "modes": ["wt2wt"],
27733 "changes": [
27734 ["img[height]", "attr", "height", "22"],
27735 ["img[width]", "attr", "width", "200"]
27736 ]
27737 }
27738 !! wikitext
27739 [[Image:Foobar.jpg|230x230px]]
27740 !! wikitext/edited
27741 [[Image:Foobar.jpg|200x200px]]
27742 !!end
27743
27744 !! test
27745 Image: Modifying size of an image (2)
27746 !! options
27747 parsoid={
27748 "modes": ["wt2wt"],
27749 "changes": [
27750 ["img[height]", "attr", "height", "100"],
27751 ["img[width]", "attr", "width", "500"]
27752 ]
27753 }
27754 !! wikitext
27755 [[Image:Foobar.jpg|230x230px]]
27756 !! wikitext/edited
27757 [[Image:Foobar.jpg|500x500px]]
27758 !!end
27759
27760 # Change in size is ignored so long as class='mw-default-size'
27761 !! test
27762 Image: Modifying size of an image (3)
27763 !! options
27764 parsoid={
27765 "modes": ["wt2wt"],
27766 "changes": [
27767 ["figure[class]", "removeClass", "mw-default-size"],
27768 ["figure img", "attr", "height", "19"],
27769 ["figure img", "attr", "width", "170"]
27770 ]
27771 }
27772 !! wikitext
27773 [[Image:Foobar.jpg|thumb]]
27774 !! wikitext/edited
27775 [[Image:Foobar.jpg|thumb|170x170px]]
27776 !!end
27777
27778 !! test
27779 Image: Modifying alignment of an image (T50665)
27780 !! options
27781 parsoid={
27782 "modes": ["wt2wt"],
27783 "changes": [
27784 ["figure[class]", "removeClass", "mw-halign-right"],
27785 ["figure[class]", "addClass", "mw-halign-left"]
27786 ]
27787 }
27788 !! wikitext
27789 [[Image:Foobar.jpg|thumb|caption|right]]
27790 !! wikitext/edited
27791 [[Image:Foobar.jpg|thumb|caption|left]]
27792 !! end
27793
27794 !! test
27795 Image: Modifying mw-default-size of an frameless image (T64805)
27796 !! options
27797 parsoid={
27798 "modes": ["wt2wt"],
27799 "changes": [
27800 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27801 ]
27802 }
27803 !! wikitext
27804 [[Image:Foobar.jpg|frameless|right]]
27805 !! wikitext/edited
27806 [[Image:Foobar.jpg|frameless|right|220x220px]]
27807 !! end
27808
27809 !! test
27810 Image: Modifying valign of an image (T51221)
27811 !! options
27812 parsoid={
27813 "modes": ["wt2wt"],
27814 "changes": [
27815 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27816 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27817 ]
27818 }
27819 !! wikitext
27820 [[File:Foobar.jpg|20px|middle]]
27821 !! wikitext/edited
27822 [[File:Foobar.jpg|20px|text-top]]
27823 !! end
27824
27825 !! test
27826 Image: Modifying alt attribute of an image (T58400)
27827 !! options
27828 parsoid={
27829 "modes": ["wt2wt"],
27830 "changes": [
27831 ["img[alt]", "attr", "alt", "some alternate edited text"]
27832 ]
27833 }
27834 !! wikitext
27835 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
27836 !! wikitext/edited
27837 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
27838 !!end
27839
27840 !! test
27841 Image: Modifying caption of an image
27842 !! options
27843 parsoid={
27844 "modes": ["wt2wt"],
27845 "changes": [
27846 ["figcaption", "text", "new caption"]
27847 ]
27848 }
27849 !! wikitext
27850 [[Image:Foobar.jpg|thumb|original caption]]
27851 !! wikitext/edited
27852 [[Image:Foobar.jpg|thumb|new caption]]
27853 !!end
27854
27855 !! test
27856 Image: empty alt attribute (T50924)
27857 !! options
27858 parsoid
27859 !! wikitext
27860 [[File:Foobar.jpg|thumb|alt=|bar]]
27861 !! html
27862 <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>
27863 !! end
27864
27865 !! test
27866 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
27867 !! options
27868 parsoid=html2wt
27869 language=ar
27870 disabled
27871 !! html/parsoid
27872 <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>
27873 !! wikitext
27874 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
27875 !! end
27876
27877 !! test
27878 Image: Block level image should have \n before and after
27879 !! wikitext
27880 123
27881 [[File:Foobar.jpg|right|thumb|150x150px]]
27882 456
27883 !! html/parsoid
27884 <p>123</p>
27885 <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>
27886 <p>456</p>
27887 !! end
27888
27889 !! test
27890 Image: New block level image should have \n before and after (existing content)
27891 !! wikitext
27892 123
27893 [[File:Foobar.jpg|right|thumb|150x150px]]
27894 456
27895 !! html/parsoid
27896 <p>123</p>
27897 <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>
27898 <p>456</p>
27899 !! end
27900
27901 !! test
27902 Image: upright option (parsoid)
27903 !! wikitext
27904 [[File:Foobar.jpg|thumb|upright|caption]]
27905 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
27906 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
27907 !! html/parsoid
27908 <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>
27909 <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>
27910 <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>
27911 !! end
27912
27913 !! test
27914 Image: upright option is ignored on inline and frame images (parsoid)
27915 !! wikitext
27916 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
27917 !! html/parsoid
27918 <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>
27919 !! end
27920
27921 !! test
27922 Image: in template parameter with empty parameter
27923 !! wikitext
27924 {{echo|[[File:Foobar.jpg|link=]]}}
27925 !! html/parsoid
27926 <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>
27927 !! end
27928
27929 !! test
27930 Image: from basic HTML (1)
27931 !! options
27932 parsoid=html2wt
27933 !! html/parsoid
27934 <span typeof="mw:Image">
27935 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27936 </span>
27937 !! wikitext
27938 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27939 !! end
27940
27941 !! test
27942 Image: from basic HTML (2)
27943 !! options
27944 parsoid=html2wt
27945 !! html/parsoid
27946 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27947 !! wikitext
27948 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27949 !! end
27950
27951 !! test
27952 Image: from basic HTML (3)
27953 !! options
27954 parsoid=html2wt
27955 !! html/parsoid
27956 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
27957 !! wikitext
27958 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
27959 !! end
27960
27961 !! test
27962 Image: from basic HTML (4)
27963 !! options
27964 parsoid=html2wt
27965 !! html/parsoid
27966 <img src="./File:Foobar.jpg">
27967 !! wikitext
27968 [[File:Foobar.jpg|link=]]
27969 !! end
27970
27971 !! test
27972 Image: Invalid title as link
27973 !! wikitext
27974 [[File:Foobar.jpg|link=<]]
27975 !! html/php
27976 <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>
27977 </p>
27978 !! html/parsoid
27979 <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>
27980 !! end
27981
27982 !! test
27983 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
27984 !! options
27985 parsoid=html2wt
27986 !! html/parsoid
27987 <ul>
27988 <li><p>foo</p></li>
27989 </ul>
27990 !! wikitext
27991 * foo
27992 !! end
27993
27994 !! test
27995 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
27996 !! options
27997 parsoid=html2wt
27998 !! html/parsoid
27999 <ul> <li>foo</li></ul>
28000 !! wikitext
28001 * foo
28002 !! end
28003
28004 !! test
28005 Don't strip leading whitespace when handling indent-pre suppressing tags
28006 !! options
28007 parsoid=html2wt
28008 !! html/parsoid
28009 <table>
28010 <tr><td> indented row</td></tr>
28011 </table>
28012 <blockquote><p>
28013 <b>This is very bold of you!</b>
28014 </p>
28015 <table><tr><td>
28016 indented cell (no pre-wrapping!)
28017 </td></tr></table>
28018 </blockquote>
28019 <p>foo</p>
28020 <div>bar</div>
28021 !! wikitext
28022 {|
28023 | indented row
28024 |}
28025 <blockquote>
28026 '''This is very bold of you!'''
28027
28028 {|
28029 |
28030 indented cell (no pre-wrapping!)
28031 |}
28032 </blockquote>
28033 foo
28034 <div>bar</div>
28035 !! end
28036
28037 !! test
28038 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
28039 !! options
28040 parsoid=html2wt
28041 !! html/parsoid
28042 <p>foo</p>
28043 <span>bar</span>
28044
28045 <span>foo2
28046 </span>bar2
28047
28048 <div>foo</div>
28049 <span>bar</span>
28050
28051 <div>
28052 <span>foo</span>
28053 </div>
28054 !! wikitext
28055 foo
28056
28057 <span>bar</span>
28058
28059 <span>foo2
28060 <nowiki> </nowiki></span>bar2
28061
28062 <div>foo</div>
28063 <nowiki> </nowiki><span>bar</span>
28064
28065 <div>
28066 <nowiki> </nowiki><span>foo</span>
28067 </div>
28068 !! end
28069
28070 !! test
28071 Lists: Dont insert newlines in a serialized list item.
28072 !! options
28073 parsoid=html2wt
28074 !! html/parsoid
28075 <ul><li>a<br>b</li><li>c</li></ul>
28076 !! wikitext
28077 * a<br />b
28078 * c
28079 !! end
28080
28081 !! test
28082 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
28083 !! options
28084 parsoid={
28085 "modes": ["html2wt"],
28086 "scrubWikitext": false
28087 }
28088 !! html/parsoid
28089 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28090 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28091
28092 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28093 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28094
28095 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
28096
28097 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28098 !! wikitext
28099 == hello there [[Category:A1]] ==
28100
28101 == [[Category:A2]] hi pal ==
28102
28103 == <!--foo--> [[Category:A3]] how goes it ==
28104
28105 == it goes well [[Category:A4]] <!--bar--> ==
28106
28107 ==howdy [[Category:A5]]==
28108
28109 == __TOC__ ok ==
28110 !! end
28111
28112 !! test
28113 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
28114 !! options
28115 parsoid={
28116 "modes": ["html2wt"],
28117 "scrubWikitext": true
28118 }
28119 !! html/parsoid
28120 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28121 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28122
28123 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28124 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28125
28126 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28127 !! wikitext
28128 == hello there ==
28129 [[Category:A1]]
28130 [[Category:A2]]
28131
28132 == hi pal ==
28133
28134 <!--foo-->[[Category:A3]]
28135
28136 == how goes it ==
28137
28138 == it goes well ==
28139 [[Category:A4]] <!--bar-->
28140
28141 __TOC__
28142
28143 == ok ==
28144 !! end
28145
28146 !! test
28147 Headings: Don't hoist metas that come from templates
28148 !! options
28149 parsoid={
28150 "modes": ["html2wt"],
28151 "scrubWikitext": true
28152 }
28153 !! html/parsoid
28154 <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>
28155 !! wikitext
28156 == {{echo|foo [[Category:Foo]]}} ==
28157 !! end
28158
28159 !! test
28160 Headings: Category in ref isn't hoisted
28161 !! options
28162 parsoid={
28163 "modes": ["html2wt"],
28164 "scrubWikitext": true
28165 }
28166 !! html/parsoid
28167 <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>
28168
28169 <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>
28170 !! wikitext
28171 == foo <ref>bar
28172 [[Category:Baz]] </ref> ==
28173
28174 <references />
28175 !! end
28176
28177 !! test
28178 Parsoid: Serialize positional parameters with = in them as named parameter
28179 !! options
28180 parsoid=html2wt
28181 !! html/parsoid
28182 <p about="#mwt1" typeof="mw:Transclusion"
28183 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
28184
28185 <p about="#mwt1" typeof="mw:Transclusion"
28186 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
28187
28188 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28189 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28190 <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>
28191 !! wikitext
28192 {{echo|1=f=oo}}
28193
28194 {{echo|1=f=oo|2=bar}}
28195
28196 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28197 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28198 {{echo|<nowiki>f=oo</nowiki>|bar}}
28199 !! end
28200
28201 !! test
28202 Parsoid: Serialize positional parameters with = in extlink as named parameter
28203 !! options
28204 parsoid=html2wt
28205 !! html/parsoid
28206 <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>
28207 !! wikitext
28208 {{echo|1=http://stuff?is=ok}}
28209 !! end
28210
28211 !! test
28212 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
28213 !! options
28214 parsoid=html2wt
28215 !! html/parsoid
28216 <div>a<p>b</p></div>
28217 <div>a
28218 <p>b</p></div>
28219 <div>
28220 a
28221 <p>b</p></div>
28222 !! wikitext
28223 <div>a
28224 b
28225 </div>
28226 <div>a
28227 b
28228 </div>
28229 <div>
28230 a
28231
28232 b
28233 </div>
28234 !! end
28235
28236 !! test
28237 Substrings resembling wikitext in hrefs should not get nowiki escapes
28238 !! options
28239 parsoid=html2wt
28240 !! html/parsoid
28241 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
28242 !! wikitext
28243 [[Foo''bar''baz]]
28244 !! end
28245
28246 !! test
28247 Enforce single-line context in the serializer
28248 !! options
28249 parsoid=html2wt
28250 !! html/parsoid
28251 <h2>testing
28252 123</h2>
28253
28254 <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">
28255 </span><span about="#mwt1">you</span> </h2>
28256
28257 <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>
28258
28259 <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
28260 there</span></li></ol>
28261
28262 <ul><li>asd
28263 sdf</li></ul>
28264
28265 <ul><li>foo
28266 bar
28267 baz</li>
28268 <li>foo <b>bar</b>
28269 baz</li></ul>
28270
28271 <dl><dt>hi
28272 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
28273 ho</dd></dl>
28274
28275 <dl><dd> <table>
28276 <tbody><tr><td> ha
28277 ha
28278 ha</td></tr>
28279 </tbody></table></dd></dl>
28280 !! wikitext
28281 == testing 123 ==
28282
28283 == hi {{bogus|there
28284 you}} ==
28285
28286 == foo <ref>hello
28287 there</ref> ==
28288
28289 <references />
28290
28291 * asd sdf
28292
28293 * foo bar baz
28294 * foo '''bar''' baz
28295
28296 ; hi ho : hi ho
28297
28298 : {|
28299 | ha
28300 ha
28301 ha
28302 |}
28303 !! end
28304
28305 !! test
28306 Serialize new placeholder space without spans
28307 !! options
28308 parsoid=html2wt
28309 !! html/parsoid
28310 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
28311
28312 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
28313
28314 <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>
28315 !! wikitext
28316 foo : bar
28317
28318 foo : bar
28319
28320 <ref>foo : bar</ref>ok
28321 !! end
28322
28323
28324 #-----------------------
28325 # Tag minimization tests
28326 #-----------------------
28327
28328 !! test
28329 1. I/B quote minimization: wikitext-only tags should be combined
28330 !! options
28331 parsoid=html2wt
28332 !! html/parsoid
28333 <p><i>A</i><i>B</i></p>
28334 <p><b>A</b><b>B</b></p>
28335 <p><i>A</i><b><i>B</i></b></p>
28336 <p><b>A</b><i><b>B</b></i></p>
28337 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
28338 <p><i><b>A</b></i><i><b>B</b></i></p>
28339 <p><i><b>A</b></i><b><i>B</i></b></p>
28340 <p><b><i>A</i></b><i><b>B</b></i></p>
28341 !! wikitext
28342 ''AB''
28343
28344 '''AB'''
28345
28346 ''A'''B'''''
28347
28348 '''A''B'''''
28349
28350 '''A''BC''D'''
28351
28352 '''''AB'''''
28353
28354 '''''AB'''''
28355
28356 '''''AB'''''
28357 !! end
28358
28359 !! test
28360 2. I/B quote minimization: wikitext and html tags should not be combined
28361 !! options
28362 parsoid=html2wt
28363 !! html/parsoid
28364 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
28365 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
28366 !! wikitext
28367 ''A''<i>B</i>
28368
28369 ''A''<nowiki/>'''<i>B</i>'''
28370 !! end
28371
28372 !! test
28373 3. I/B quote minimization: templated content stops minimization
28374 !! options
28375 parsoid=html2wt
28376 !! html/parsoid
28377 <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>
28378 <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>
28379 !! wikitext
28380 ''A''{{echo|''B''}}
28381
28382 ''A''{{echo|'''''B'''''}}
28383 !! end
28384
28385 !! test
28386 4. I/B quote minimization: new content should be mimimized with adjacent old content
28387 !! options
28388 parsoid=html2wt
28389 !! html/parsoid
28390 <p><i>A</i><i>B</i></p>
28391 <p><b>A</b><b>B</b></p>
28392 <p><i>A</i><b><i>B</i></b></p>
28393 !! wikitext
28394 ''AB''
28395
28396 '''AB'''
28397
28398 ''A'''B'''''
28399 !! end
28400
28401 !! test
28402 5a. Merge adjacent quote nodes if they've been edited
28403 !! options
28404 parsoid={
28405 "modes": ["wt2wt", "selser"],
28406 "changes": [
28407 ["p", "contents", "remove", ":contains('b')"]
28408 ]
28409 }
28410 !! wikitext
28411 ''a''b''c''
28412 !! wikitext/edited
28413 ''ac''
28414 !! end
28415
28416 !! test
28417 5b. Merge adjacent quote nodes if they've been edited
28418 !! options
28419 parsoid={
28420 "modes": ["wt2wt", "selser"],
28421 "changes": [
28422 ["#x", "remove"]
28423 ]
28424 }
28425 !! wikitext
28426 ''a''<span id="x">b</span>''c''
28427 !! wikitext/edited
28428 ''ac''
28429 !! end
28430
28431 !! test
28432 1. Merge adjacent link nodes as long as at least one element is new
28433 !! options
28434 parsoid={
28435 "modes": ["html2wt"],
28436 "scrubWikitext": true
28437 }
28438 !! html/parsoid
28439 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28440 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28441 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28442 !! wikitext
28443 [[Football]]
28444 [[Football]]
28445 [[Football|Foot]][[Football|ball]]
28446 !! end
28447
28448 !! test
28449 2. Merge adjacent link nodes and enable additional normalizations
28450 !! options
28451 parsoid={
28452 "modes": ["html2wt"],
28453 "scrubWikitext": true
28454 }
28455 !! html/parsoid
28456 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28457 !! wikitext
28458 ''[[Football]]''
28459 !! end
28460
28461 !! test
28462 3. Don't merge adjacent link nodes if scrubWikitext is false
28463 !! options
28464 parsoid={
28465 "modes": ["html2wt"],
28466 "scrubWikitext": false
28467 }
28468 !! html/parsoid
28469 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28470 !! wikitext
28471 [[Football|Foot]][[Football|ball]]
28472 !! end
28473
28474 !! test
28475 1. Move format tags outside of WikiLink
28476 !! options
28477 parsoid={
28478 "modes": ["html2wt"],
28479 "scrubWikitext": true
28480 }
28481 !! html/parsoid
28482 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
28483 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
28484 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
28485 !! wikitext
28486 ''[[Football]]''
28487 '''''[[Football]]'''''
28488 <u>'''''[[Football]]'''''</u>
28489 !! end
28490
28491 !! test
28492 2. Move format tags outside of WikiLink with mergable A tags
28493 !! options
28494 parsoid={
28495 "modes": ["html2wt"],
28496 "scrubWikitext": true
28497 }
28498 !! html/parsoid
28499 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
28500 !! wikitext
28501 '''''[[Football]]'''''
28502 !! end
28503
28504 !! test
28505 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
28506 !! options
28507 parsoid={
28508 "modes": ["html2wt"],
28509 "scrubWikitext": true
28510 }
28511 !! html/parsoid
28512 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
28513 !! wikitext
28514 <font color="red"><u>'''[[Foo]]'''</u></font>
28515 !! end
28516
28517 !! test
28518 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
28519 !! options
28520 parsoid={
28521 "modes": ["html2wt"],
28522 "scrubWikitext": true
28523 }
28524 !! html/parsoid
28525 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
28526 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
28527 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
28528 !! wikitext
28529 [[Foo|<font color="red">Foo</font>]]
28530 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
28531 [[Foo|<span class="Bar">Foo</span>]]
28532 !! end
28533
28534 !! test
28535 5. T194083 Regression test: Manual edit test that also enables scrubWikitext to move format tags outside wikilinks
28536 !! options
28537 parsoid={
28538 "modes": ["selser"],
28539 "scrubWikitext": true,
28540 "changes": [
28541 ["a", "html", "<i>Foo</i>"]
28542 ]
28543 }
28544 !! wikitext
28545 [[Foo]]
28546 !! wikitext/edited
28547 ''[[Foo]]''
28548 !! end
28549
28550 !! test
28551 6. Regression test: Manual edit test to ensure diff markers are not lost
28552 !! options
28553 parsoid={
28554 "modes": ["selser"],
28555 "scrubWikitext": true,
28556 "changes": [
28557 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
28558 ]
28559 }
28560 !! wikitext
28561 ''Foo''
28562 !! wikitext/edited
28563 ''[[Foo]]''
28564 !! end
28565
28566 #------------------------------
28567 # End of tag minimization tests
28568 #------------------------------
28569
28570 !!test
28571 T56262: New entities
28572 !! options
28573 parsoid=html2wt
28574 !! html/parsoid
28575 <span typeof="mw:Entity">&nbsp;</span>
28576 !! wikitext
28577 &nbsp;
28578 !! end
28579
28580 ## Note that there is no wikitext output for 'unknownproperty' ##
28581 ## Unknown magic words are silently dropped ##
28582
28583 !! test
28584 Magic words
28585 !! options
28586 parsoid=html2wt
28587 !! html/parsoid
28588 <meta property='mw:PageProp/toc' />
28589 <meta property='mw:PageProp/notoc' />
28590 <meta property='mw:PageProp/forcetoc' />
28591 <meta property='mw:PageProp/index' />
28592 <meta property='mw:PageProp/noindex' />
28593 <meta property='mw:PageProp/nogallery' />
28594 <meta property='mw:PageProp/noeditsection' />
28595 <meta property='mw:PageProp/notitleconvert' />
28596 <meta property='mw:PageProp/nocontentconvert' />
28597 <meta property='mw:PageProp/unknownproperty' />
28598 !! wikitext
28599 __TOC__
28600 __NOTOC__
28601 __FORCETOC__
28602 __INDEX__
28603 __NOINDEX__
28604 __NOGALLERY__
28605 __NOEDITSECTION__
28606 __NOTITLECONVERT__
28607 __NOCONTENTCONVERT__
28608 !! end
28609
28610 !! test
28611 Consecutive <pre>s should not get merged
28612 !! options
28613 parsoid=html2wt,html2html
28614 !! html/parsoid
28615 <pre>a</pre><pre>b</pre>
28616
28617 <pre>c
28618 </pre><pre>
28619 d</pre>
28620
28621 <pre>e
28622
28623 </pre><pre>
28624
28625 f</pre>
28626 !! wikitext
28627 a
28628
28629 b
28630
28631 c
28632
28633 d
28634
28635 e
28636
28637
28638
28639 f
28640 !! end
28641
28642 !! test
28643 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
28644 !! options
28645 parsoid=html2wt
28646 !! html/parsoid
28647 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
28648 !! wikitext
28649 [[Special:BookSources/1234567890|ISBN 1234567895]]
28650 !! end
28651
28652 !! test
28653 Edited RFC links not serializable as RFC links should serialize as extlinks
28654 !! options
28655 parsoid=html2wt
28656 !! html/parsoid
28657 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
28658 !! wikitext
28659 [https://tools.ietf.org/html/rfc123 New RFC]
28660 !! end
28661
28662 !! test
28663 Edited PMID links not serializable as PMID links should serialize as extlinks
28664 !! options
28665 parsoid=html2wt
28666 !! html/parsoid
28667 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
28668 !! wikitext
28669 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
28670 !! end
28671
28672 !! test
28673 WTS of autolinks with trailing/surrounding context
28674 !! options
28675 parsoid=html2wt
28676 !! html/parsoid
28677 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
28678 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
28679 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
28680 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
28681 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
28682 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
28683 !! wikitext
28684 http://cscott.net'''foo'''
28685
28686 http://cscott.net<b>foo</b>
28687
28688 '''http://cscott.net'''
28689
28690 '''http://cscott.net '''
28691
28692 '''http://cscott.net<nowiki/>x'''
28693
28694 http://cscott.net<nowiki/>x
28695 !! end
28696
28697 !! test
28698 WTS of autolinks with nowikis (round-trip)
28699 !! wikitext
28700 x<nowiki/>http://cscott.net<nowiki/>x
28701 !! html/parsoid
28702 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
28703 !! end
28704
28705 # this is the "easy" test because it leaves in place all the
28706 # data-parsoid information indicating this is an autolink
28707 !! test
28708 WTS of autolinks with escapes (editing)
28709 !! options
28710 parsoid={
28711 "modes": ["wt2wt"],
28712 "changes": [
28713 [ "span", "remove" ]
28714 ]
28715 }
28716 !! wikitext
28717 x<nowiki/>http://cscott.net<nowiki/>x
28718 !! wikitext/edited
28719 x<nowiki/>http://cscott.net<nowiki/>x
28720 !! end
28721
28722 !! test
28723 WTS of edited autolink-like text (T103364)
28724 !! options
28725 parsoid={
28726 "modes": ["wt2wt"],
28727 "changes": [
28728 [ "span[typeof]", "removeAttr", "typeof" ]
28729 ]
28730 }
28731 !! wikitext
28732 Not a link: <nowiki>http://example.com</nowiki>.
28733 !! wikitext/edited
28734 Not a link: <span><nowiki>http://example.com</nowiki></span>.
28735 !! end
28736
28737 !! test
28738 WTS of newly-authored autolink-like text (T103364)
28739 !! options
28740 parsoid=html2wt
28741 !! html/parsoid
28742 <p>http://example.com is not a link.</p>
28743 !! wikitext
28744 <nowiki>http://example.com</nowiki> is not a link.
28745 !! end
28746
28747 !! test
28748 WTS of autolink-like text after an autolink (T108563)
28749 !! options
28750 parsoid=html2wt
28751 !! html/parsoid
28752 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
28753 !! wikitext
28754 http://example.com <nowiki>http://example.com</nowiki> is not a link.
28755 !! end
28756
28757 !! test
28758 Magic links inside links (not autolinked)
28759 !! wikitext
28760 [[Foo|http://example.com]]
28761 [[Foo|RFC 1234]]
28762 [[Foo|PMID 1234]]
28763 [[Foo|ISBN 123456789x]]
28764
28765 [http://foo.com http://example.com]
28766 [http://foo.com RFC 1234]
28767 [http://foo.com PMID 1234]
28768 [http://foo.com ISBN 123456789x]
28769 !! html+tidy
28770 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
28771 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
28772 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
28773 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
28774 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
28775 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
28776 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
28777 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
28778 </p>
28779 !! html/parsoid
28780 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
28781 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
28782 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
28783 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
28784
28785 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
28786 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
28787 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
28788 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
28789 !! end
28790
28791 !! test
28792 Magic links inside image captions (autolinked)
28793 !! wikitext
28794 [[File:Foobar.jpg|thumb|http://example.com]]
28795 [[File:Foobar.jpg|thumb|RFC 1234]]
28796 [[File:Foobar.jpg|thumb|PMID 1234]]
28797 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
28798 !! html+tidy
28799 <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>
28800 <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>
28801 <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>
28802 <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>
28803 !! html/parsoid
28804 <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>
28805 <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>
28806 <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>
28807 <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>
28808 !! end
28809
28810 !! test
28811 WTS of magic word text (T109371)
28812 !! options
28813 parsoid=html2wt
28814 !! html/parsoid
28815 <p>RFC 1234</p>
28816 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
28817 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28818 !! wikitext
28819 <nowiki>RFC 1234</nowiki>
28820
28821 [http://foo.com RFC 1234]
28822
28823 [[Foo|RFC 1234]]
28824 !! end
28825
28826 !! test
28827 Edited Redirect link should emit a non-piped wikitext link
28828 !! options
28829 parsoid=html2wt
28830 !! html/parsoid
28831 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28832 !! wikitext
28833 #REDIRECT [[Bar]]
28834 !! end
28835
28836 !! test
28837 T75121: Infer extension name from typeOf if data-mw is not present
28838 !! options
28839 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28840 !! html/parsoid
28841 <div typeOf="mw:Extension/foo"></div>
28842 !! wikitext
28843 <foo />
28844 !! end
28845
28846 # Note that the <p> wrapping isn't present in PHP parser output
28847 # The important thing for this test is that P-wrapping doesn't
28848 # interfere with the <nowiki> protection for leading - in <td>
28849 # (which isn't necessary for <th>).
28850 !! test
28851 T88318: p-wrapped dash in table.
28852 !! options
28853 parsoid=html2wt,wt2wt
28854 !! html/parsoid
28855 <table><tbody>
28856 <tr><th><p>-</p></th><th><p>- </p></th></tr>
28857 <tr><td><p>-</p></td><td><p>- </p></td></tr>
28858 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
28859 </tbody></table>
28860 !! wikitext
28861 {|
28862 !-
28863 !-
28864 |-
28865 |<nowiki>-</nowiki>
28866 |<nowiki>- </nowiki>
28867 |-
28868 |<small>-</small>
28869 |<br />
28870 -
28871 |<br />-
28872 |}
28873 !! html/php+tidy
28874 <table>
28875 <tbody><tr>
28876 <th>-
28877 </th>
28878 <th>-
28879 </th></tr>
28880 <tr>
28881 <td>-
28882 </td>
28883 <td>-
28884 </td></tr>
28885 <tr>
28886 <td><small>-</small>
28887 </td>
28888 <td><br />
28889 <p>-
28890 </p>
28891 </td>
28892 <td><br />-
28893 </td></tr></tbody></table>
28894 !! end
28895
28896 !! test
28897 T149209: WTS: Handle newlines in table cells properly
28898 !! options
28899 parsoid=html2wt
28900 !! html/parsoid
28901 <table>
28902 <tbody>
28903 <tr><td>a
28904 b
28905 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
28906 <tr><td><p>x</p>
28907 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
28908 </tbody></table>
28909 <table>
28910 <tbody>
28911 <tr><th>a
28912 b
28913 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
28914 <tr><th><p>x</h>
28915 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
28916 </tbody></table>
28917 !! wikitext
28918 {|
28919 |a
28920 b
28921 |c
28922 |-
28923 |x
28924 {{!}}y
28925 |}
28926 {|
28927 !a
28928 b
28929 !c
28930 |-
28931 !x
28932 !y
28933 |}
28934 !! end
28935
28936 !! test
28937 T149209: Selser: Handle newlines in table cells properly
28938 !! options
28939 parsoid={
28940 "modes": ["selser"],
28941 "changes": [
28942 [ "#h1", "html", "a\nb\n" ],
28943 [ "#h2", "html", "a\nb\n" ],
28944 [ "#c1", "html", "a\nb\n" ],
28945 [ "#c2", "html", "<p>a</p>" ],
28946 [ "#c3", "html", "<p>a</p>" ],
28947 [ "#c4", "html", "edit-me<p>a</p>" ]
28948 ]
28949 }
28950 !! wikitext
28951 {|
28952 ! id="h1" |edit-me!!1
28953 |-
28954 ! id="h2" |edit-me||2
28955 |-
28956 | id="c1" |edit-me||3
28957 |-
28958 | id="c2" |edit-me||4
28959 |-
28960 | id="c3" |edit-me||p||q||r
28961 |-
28962 | id="c4" |edit-me||p||q||r
28963 |}
28964 !! wikitext/edited
28965 {|
28966 ! id="h1" |a
28967 b
28968 !1
28969 |-
28970 ! id="h2" |a
28971 b
28972 !2
28973 |-
28974 | id="c1" |a
28975 b
28976 |3
28977 |-
28978 | id="c2" |a
28979 |4
28980 |-
28981 | id="c3" |a
28982 |p||q||r
28983 |-
28984 | id="c4" |edit-me
28985 a
28986 |p||q||r
28987 |}
28988 !! end
28989
28990 !! test
28991 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
28992 !! options
28993 parsoid=html2wt
28994 !! html/parsoid
28995 <table id='mwAb'>
28996 <td id='mwAc'>foo</td>
28997 <td id='serialize-this'>bar</td>
28998 </table>
28999 !! wikitext
29000 {|
29001 |foo
29002 | id="serialize-this" |bar
29003 |}
29004 !! end
29005
29006 !! test
29007 Parsoid-like element ids should not be serialized to wikitext unless shadowed
29008 !! options
29009 parsoid=html2wt
29010 !! html/parsoid
29011 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
29012 !! wikitext
29013 <div id="hello">ok</div>
29014 !! end
29015
29016 !! test
29017 Testing serialization after deletion in references
29018 !! options
29019 parsoid={
29020 "modes": ["wt2wt"],
29021 "changes": [
29022 ["#x", "remove"]
29023 ]
29024 }
29025 !! wikitext
29026 hi <ref><div id="x">ho</div></ref>
29027
29028 <references />
29029 !! wikitext/edited
29030 hi <ref></ref>
29031
29032 <references />
29033 !! end
29034
29035 !!test
29036 Testing serialization after deletion of table cells
29037 !!options
29038 parsoid={
29039 "modes": ["wt2wt", "selser"],
29040 "changes": [
29041 ["#x", "remove"]
29042 ]
29043 }
29044 !!wikitext
29045 {|
29046 !h1 !!h2 !!h3
29047 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
29048 |}
29049 !! wikitext/edited
29050 {|
29051 !h1!!h2!!h3
29052 |c2|||c3
29053 |}
29054 !!end
29055
29056 !! test
29057 Testing selser after addition of new row before first row (T125419)
29058 !! options
29059 parsoid={
29060 "modes": ["wt2wt", "selser"],
29061 "changes": [
29062 [ "tr", "before", "<tr><td>X</td></tr>" ]
29063 ]
29064 }
29065 !! wikitext
29066 {|
29067 |a
29068 |}
29069 !! wikitext/edited
29070 {|
29071 |X
29072 |-
29073 |a
29074 |}
29075 !! end
29076
29077 !! test
29078 Serialize new table rows in a HTML table using HTML tags
29079 !! options
29080 parsoid={
29081 "modes": ["wt2wt", "selser"],
29082 "changes": [
29083 [ "tr", "before", "<tr><td>X</td></tr>" ]
29084 ]
29085 }
29086 !! wikitext
29087 <table><tr><td>a</td></tr></table>
29088 !! wikitext/edited
29089 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
29090 !! end
29091
29092 !! test
29093 Serialize new table cells in a HTML row using HTML tags
29094 !! options
29095 parsoid={
29096 "modes": ["wt2wt", "selser"],
29097 "changes": [
29098 [ "td", "before", "<td>X</td>" ]
29099 ]
29100 }
29101 !! wikitext
29102 <table><tr><td>a</td></tr></table>
29103 !! wikitext/edited
29104 <table><tr><td>X</td><td>a</td></tr></table>
29105 !! end
29106
29107 !! test
29108 Serialize wikitext list items as HTML list items when embedded in a HTML list
29109 !! options
29110 parsoid=html2wt
29111 !! html
29112 <ul data-parsoid='{"stx": "html"}'>
29113 <li data-parsoid='{}'>a</li>
29114 <li>b</li>
29115 </ul>
29116 !! wikitext
29117 <ul>
29118 <li>a</li>
29119 <li>b</li>
29120 </ul>
29121 !! end
29122
29123 # SSS FIXME: Is this actually a good thing given the
29124 # odd nested list output that is generated by MW?
29125 # <ul><li>foo<ul>..</ul></li></ul> instead of
29126 # <ul><li>foo</li><ul>..</ul></ul>
29127 !! test
29128 Wikitext lists can be nested inside HTML lists
29129 !! options
29130 parsoid=html2wt
29131 !! html
29132 <ul data-parsoid='{"stx": "html"}'>
29133 <li data-parsoid='{"stx": "html"}'>a
29134 <ul><li>b</li></ul>
29135 </li>
29136 </ul>
29137
29138 <ul data-parsoid='{"stx": "html"}'>
29139 <li>x
29140 <ul><li>y</li></ul>
29141 </li>
29142 </ul>
29143 !! wikitext
29144 <ul>
29145 <li>a
29146 * b
29147 </li>
29148 </ul>
29149
29150 <ul>
29151 <li>x
29152 * y
29153 </li>
29154 </ul>
29155 !! end
29156
29157 !! test
29158 WTS change modes
29159 !! options
29160 parsoid={
29161 "modes": ["wt2wt"],
29162 "changes": [
29163 [ "#xyz", "before", "<b>before</b> stuff " ],
29164 [ "#xyz", "after", " stuff <i>after</i>" ],
29165 [ "#xyz", "html", "x <b>y</b> z" ]
29166 ]
29167 }
29168 !! wikitext
29169 <span id="xyz">hello</span>
29170 !! wikitext/edited
29171 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
29172 !! end
29173
29174 !! test
29175 Never serialize a-tag as html, regardless of what data-parsoid has to say
29176 !! options
29177 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29178 !! html/parsoid
29179 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
29180 !! wikitext
29181 [[Foo]]
29182 !! end
29183
29184 ## SSS FIXME: This is broken output nevertheless.
29185 ## What might be a reasonable non-broken output for this?
29186 ## This is an edge case unlikely to be seen in production
29187 ## that I am not wasting more time on this right now.
29188 !! test
29189 Never serialize a-tag as html, no matter what attributes it has
29190 !! options
29191 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29192 !! html/parsoid
29193 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
29194 !! wikitext
29195 [http://boo.org http://boohoo.org]
29196 !! end
29197
29198 # Misnested is an indication that selser can reuse the source but these have
29199 # shown to sneak through on occasion. See T101768.
29200 # The original wikitext here is: [http://test.com [[one]] two three]
29201 !! test
29202 Strip span tags added to mark misnested links
29203 !! options
29204 parsoid=html2wt
29205 !! html/parsoid
29206 <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>
29207 !! wikitext
29208 [http://test.com][[one]] two three
29209 !! end
29210
29211 !! test
29212 Catch regression when unpacking misnested links
29213 !! options
29214 parsoid=wt2html
29215 !! wikitext
29216 {{echo|hi}}[http://example.com [[ho]]]
29217 !! html/parsoid
29218 <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>
29219 !! end
29220
29221 !! test
29222 Catch regression when unpacking with trailing content
29223 !! wikitext
29224 {{echo|Foo <references/> bar}}
29225 !! html/parsoid
29226 <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>
29227 !! end
29228
29229 !! test
29230 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
29231 !! options
29232 parsoid=html2wt
29233 !! html/parsoid
29234 <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|}"]}'>
29235 <tbody><tr><td>d
29236 </td></tr>
29237 </tbody></table>
29238 !! wikitext
29239 {{echo|a}}
29240 {|{{echo|c
29241 {{!}}d
29242 }}
29243 |}
29244 !! end
29245
29246 ## This test verifies the presence and computation of this attribute indirectly
29247 ## by making an edit and ensuring that the serialization is correct (which it would be
29248 ## only if firstWikitextNode is properly set).
29249 !! test
29250 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
29251 !! options
29252 parsoid= {
29253 "modes": ["wt2wt"],
29254 "changes": [
29255 [ "div#x", "remove" ],
29256 [ "div", "before", "<div>new</div>" ]
29257 ]
29258 }
29259 !! wikitext
29260 <div id="x">foo</div>
29261 {|
29262 {{echo|<div>boo</div>
29263 {{!}}b}}
29264 |c
29265 |}
29266 !! wikitext/edited
29267
29268 <div>new</div>
29269 {|
29270 {{echo|<div>boo</div>
29271 {{!}}b}}
29272 |c
29273 |}
29274 !! end
29275
29276 # --------------------------------------------
29277 # Tests spec'ing wikitext serialization norms |
29278 # --------------------------------------------
29279
29280 !! test
29281 Serialize multi-line indent-pre starting with wikitext syntax
29282 !! options
29283 parsoid=html2wt
29284 !! html/parsoid
29285 <pre>* 1
29286 ** 2
29287 * 3</pre>
29288 !! wikitext
29289 * 1
29290 ** 2
29291 * 3
29292 !! end
29293
29294 !! test
29295 1. Categories should always be serialized on their own line
29296 !! options
29297 parsoid=html2wt
29298 !! html/parsoid
29299 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
29300 !! wikitext
29301 foo
29302 [[Category:Foo]]
29303 bar
29304 !! end
29305
29306 !! test
29307 2. Categories that are part of templates should not introduce a line break
29308 !! wikitext
29309 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
29310 !! html/parsoid
29311 <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>
29312 !! end
29313
29314 # Careful while editing these next 2 tests. There are \u200f characters
29315 # before and after the <link> tags in the HTML and following some
29316 # of the categories in wikitext
29317 # Do not remove these characters in edits.
29318 #
29319 # As part of the serialization, these bidi characters will get stripped.
29320 !! test
29321 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
29322 !! options
29323 parsoid={
29324 "modes": ["html2wt"],
29325 "scrubWikitext": true
29326 }
29327 !! html/parsoid
29328 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
29329 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
29330 !! wikitext
29331 [[קטגוריה:טקסים]]
29332 [[קטגוריה: שיטות משפט]]
29333 !! end
29334
29335 !! test
29336 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
29337 !! options
29338 parsoid={
29339 "modes": ["html2wt"],
29340 "scrubWikitext": true
29341 }
29342 !! html/parsoid
29343 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
29344 !! wikitext
29345 [[קטגוריה:טקסים]]
29346 ‏y
29347 !! end
29348
29349 !! test
29350 Lists: Add space after bullets
29351 !! options
29352 parsoid=html2wt
29353 !! html/parsoid
29354 <ul>
29355 <li>foo</li>
29356 <li> bar</li>
29357 <li><span> baz</span></li>
29358 </ul>
29359 !! wikitext
29360 * foo
29361 * bar
29362 * <span> baz</span>
29363 !! end
29364
29365 !! test
29366 1. Headings: Add space before/after == (T53744)
29367 !! options
29368 parsoid=html2wt
29369 !! html/parsoid
29370 <h2>foo</h2>
29371 <h2> bar</h2>
29372 <h2>baz </h2>
29373 <h2><span> baz</span></h2>
29374 !! wikitext
29375 == foo ==
29376
29377 == bar ==
29378
29379 == baz ==
29380
29381 == <span> baz</span> ==
29382 !! end
29383
29384 !! test
29385 2. Headings: Add space before/after == even after hoisted content
29386 !! options
29387 parsoid={
29388 "modes": ["html2wt"],
29389 "scrubWikitext": true
29390 }
29391 !! html/parsoid
29392 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
29393 !! wikitext
29394 [[Category:A2]]
29395
29396 == ok ==
29397 !! end
29398
29399 !! test
29400 1. Headings: suppress newly created empty headings
29401 !! options
29402 parsoid={
29403 "modes": ["html2wt"],
29404 "scrubWikitext": true
29405 }
29406 !! html/parsoid
29407 <h2></h2>
29408 !! wikitext
29409 !! end
29410
29411 !! test
29412 2. Headings: don't suppress empty headings if scrubWikitext is false
29413 !! options
29414 parsoid=html2wt
29415 !! html/parsoid
29416 <h2></h2>
29417 !! wikitext
29418 ==<nowiki/>==
29419 !! end
29420
29421 !! test
29422 3. Headings: suppress empty headings on edits
29423 !! options
29424 parsoid={
29425 "modes": ["selser"],
29426 "scrubWikitext": true,
29427 "changes": [
29428 [ "#x", "remove"]
29429 ]
29430 }
29431 !! wikitext
29432 ==<span id="x">foo</span>==
29433 !! wikitext/edited
29434 !! end
29435
29436 !! test
29437 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
29438 !! options
29439 parsoid={
29440 "modes": ["html2wt"],
29441 "scrubWikitext": true
29442 }
29443 !! html/parsoid
29444 <h2>foo<br/>bar</h2>
29445 <h2>foo <span><br/>bar</span> baz</h2>
29446 !! wikitext
29447 == foo bar ==
29448
29449 == foo <span> bar</span> baz ==
29450 !! end
29451
29452 !! test
29453 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
29454 !! options
29455 parsoid={
29456 "modes": ["html2wt"],
29457 "scrubWikitext": false
29458 }
29459 !! html/parsoid
29460 <h2>foo<br/>bar</h2>
29461 !! wikitext
29462 == foo<br />bar ==
29463 !! end
29464
29465 !! test
29466 1. WT Quote Tags: suppress newly created empty style tags
29467 !! options
29468 parsoid={
29469 "modes": ["html2wt"],
29470 "scrubWikitext": true
29471 }
29472 !! html/parsoid
29473 <i></i><b></b>
29474 !! wikitext
29475 !! end
29476
29477 !! test
29478 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
29479 !! options
29480 parsoid=html2wt
29481 !! html/parsoid
29482 <i></i><b></b>
29483 !! wikitext
29484 ''<nowiki/>'''''<nowiki/>'''
29485 !! end
29486
29487 !! test
29488 3. WT Quote Tags: suppress empty style tags on edits
29489 !! options
29490 parsoid={
29491 "modes": ["selser"],
29492 "scrubWikitext": true,
29493 "changes": [
29494 [ "#x", "remove"]
29495 ]
29496 }
29497 !! wikitext
29498 '''<span id="x">foo</span>'''
29499 !! wikitext/edited
29500 !! end
29501
29502 !! test
29503 1. Anchors: suppress newly created empty anchors
29504 !! options
29505 parsoid={
29506 "modes": ["html2wt"],
29507 "scrubWikitext": true
29508 }
29509 !! html/parsoid
29510 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29511 !! wikitext
29512 !! end
29513
29514 !! test
29515 2. Anchors: don't suppress empty anchors if scrubWikitext is false
29516 !! options
29517 parsoid={
29518 "modes": ["html2wt"],
29519 "scrubWikitext": false
29520 }
29521 !! html/parsoid
29522 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29523 !! wikitext
29524 [[Test|<nowiki/>]]
29525 !! end
29526
29527 !! test
29528 3. Anchors: suppress empty anchors on edits
29529 !! options
29530 parsoid={
29531 "modes": ["selser"],
29532 "scrubWikitext": true,
29533 "changes": [
29534 [ "#x", "remove"]
29535 ]
29536 }
29537 !! wikitext
29538 [[Test|<span id="x">foo</span>]]
29539 !! wikitext/edited
29540 !! end
29541
29542 !! test
29543 3a. Anchors: do not suppress numbered extlinks
29544 !! options
29545 parsoid={
29546 "modes": ["wt2wt"],
29547 "scrubWikitext": true
29548 }
29549 !! wikitext
29550 [http://foo.com]
29551 !! html/parsoid
29552 <a rel="mw:ExtLink" href="http://foo.com"></a>
29553 !! end
29554
29555 !! test
29556 3b. Anchors: do not suppress numbered extlinks
29557 !! options
29558 parsoid={
29559 "modes": ["wt2wt"],
29560 "scrubWikitext": true,
29561 "changes": [
29562 [ "#x", "remove"]
29563 ]
29564 }
29565 !! wikitext
29566 [http://foo.com <span id="x">foo</span>]
29567 !! wikitext/edited
29568 [http://foo.com]
29569 !! end
29570
29571 !!test
29572 Normalizations should be restricted to edited content
29573 !!options
29574 parsoid={
29575 "modes": ["selser"],
29576 "scrubWikitext": true,
29577 "changes": [
29578 [ "h1", "before", "<i></i>"]
29579 ]
29580 }
29581 !!wikitext
29582 a
29583 = =
29584 b
29585 !!wikitext/edited
29586 a
29587 = =
29588 b
29589 !!end
29590
29591 !! test
29592 1. Multiple normalizations (html2wt)
29593 !! options
29594 parsoid={
29595 "modes": ["html2wt"],
29596 "scrubWikitext": true
29597 }
29598 !! html
29599 <h2><i></i></h2>
29600 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
29601 </a><b><i></i></b>x</p>
29602 !! wikitext
29603
29604 [[foo]]
29605 x
29606
29607 !! end
29608
29609 !! test
29610 2. Multiple normalizations (selser)
29611 !! options
29612 parsoid={
29613 "modes": ["selser"],
29614 "scrubWikitext": true,
29615 "changes": [
29616 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
29617 ]
29618 }
29619 !! wikitext
29620 <span id="x">foo</span>
29621 !! wikitext/edited
29622 <span id="x">foo</span>
29623
29624 x
29625 !! end
29626
29627 !! test
29628 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
29629 !! options
29630 parsoid={
29631 "modes": ["html2wt"],
29632 "scrubWikitext": true
29633 }
29634 !! html/parsoid
29635 <p> hi</p>
29636 <p> hello</p>
29637 !! wikitext
29638 hi
29639
29640 hello
29641 !! end
29642
29643 !! test
29644 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
29645 !! options
29646 parsoid=html2wt
29647 !! html/parsoid
29648 <p> hi</p>
29649 <p> hello</p>
29650 !! wikitext
29651 <nowiki> </nowiki>hi
29652
29653 <nowiki> </nowiki> hello
29654 !! end
29655
29656 !! test
29657 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
29658 !! options
29659 parsoid={
29660 "modes": ["html2wt"],
29661 "scrubWikitext": true
29662 }
29663 !! html/parsoid
29664 <p>Foo
29665 bar
29666 baz</p>
29667
29668 <table><tr><td>Foo
29669 bar
29670 baz bang</td></tr></table>
29671
29672 <p><!--boo--> foo
29673 bar</p>
29674
29675 <p> foo
29676 bar<span>boo</span></p>
29677 !! wikitext
29678 Foo
29679 bar
29680 baz
29681
29682 {|
29683 |Foo
29684 bar
29685 baz bang
29686 |}
29687
29688 <!--boo-->foo
29689 bar
29690
29691 foo
29692 bar<span>boo</span>
29693 !! end
29694
29695 !! test
29696 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
29697 !! options
29698 parsoid={
29699 "modes": ["selser"],
29700 "scrubWikitext": true,
29701 "changes": [
29702 [ "p", "html", " a\n b" ]
29703 ]
29704 }
29705 !! wikitext
29706 xyz
29707 !! wikitext/edited
29708 a
29709 b
29710 !! end
29711
29712 !! test
29713 1. New links that end in spaces
29714 !! options
29715 parsoid={
29716 "modes": ["html2wt"],
29717 "scrubWikitext": false
29718 }
29719 !! html/parsoid
29720 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29721 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29722 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29723 !! wikitext
29724 [[Berlin ]]<nowiki/>is the capital of Germany.
29725
29726 [[Foo ]]'''bar'''
29727
29728 [[Boston ]] is a city.
29729 !! end
29730
29731 !! test
29732 2. New links that end in spaces
29733 !! options
29734 parsoid={
29735 "modes": ["html2wt"],
29736 "scrubWikitext": true
29737 }
29738 !! html/parsoid
29739 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29740 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29741 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29742 !! wikitext
29743 [[Berlin]] is the capital of Germany.
29744
29745 [[Foo]] '''bar'''
29746
29747 [[Boston]] is a city.
29748 !! end
29749
29750 !! test
29751 1. Table cells with escapable prefixes
29752 !! options
29753 parsoid={
29754 "modes": ["html2wt"],
29755 "scrubWikitext": false
29756 }
29757 !! html
29758 <table>
29759 <tr><td>a</td></tr>
29760 <tr><td>-</td></tr>
29761 <tr><td>+</td></tr>
29762 </table>
29763 !! wikitext
29764 {|
29765 |a
29766 |-
29767 |<nowiki>-</nowiki>
29768 |-
29769 |<nowiki>+</nowiki>
29770 |}
29771 !! end
29772
29773 !! test
29774 2. Table cells with escapable prefixes
29775 !! options
29776 parsoid={
29777 "modes": ["html2wt"],
29778 "scrubWikitext": true
29779 }
29780 !! html
29781 <table>
29782 <tr><td>a</td></tr>
29783 <tr><td>-</td></tr>
29784 <tr><td>+</td></tr>
29785 </table>
29786 !! wikitext
29787 {|
29788 |a
29789 |-
29790 | -
29791 |-
29792 | +
29793 |}
29794 !! end
29795
29796 !! test
29797 3a. Table cells with escapable prefixes after edits
29798 !! options
29799 parsoid={
29800 "modes": ["selser"],
29801 "scrubWikitext": true,
29802 "changes": [
29803 [ "table tbody tr:first-child td:first-child", "remove"]
29804 ]
29805 }
29806 !! wikitext
29807 {|
29808 |a||-
29809 |}
29810 !! wikitext/edited
29811 {|
29812 | -
29813 |}
29814 !! end
29815
29816 !! test
29817 3b. Table cells with escapable prefixes after edits
29818 !! options
29819 parsoid={
29820 "modes": ["selser"],
29821 "scrubWikitext": true,
29822 "changes": [
29823 [ "table tbody tr:first-child td:first-child", "html", "-" ],
29824 [ "#x", "remove" ]
29825 ]
29826 }
29827 !! wikitext
29828 {|
29829 |pqr
29830 |<span id="x">foo</span>+
29831 |}
29832 !! wikitext/edited
29833 {|
29834 | -
29835 | +
29836 |}
29837 !! end
29838
29839 # FIXME: This test will fail because
29840 # normalization doesn't realize that the id attribute
29841 # will eliminate the escapable scenario
29842 !! test
29843 4a. Table cells without escapable prefixes after edits
29844 !! options
29845 parsoid={
29846 "modes": ["selser"],
29847 "scrubWikitext": true,
29848 "changes": [
29849 [ "#x", "html", "-" ]
29850 ]
29851 }
29852 !! wikitext
29853 {|
29854 | id="x" |abcd
29855 |}
29856 !! wikitext/edited
29857 {|
29858 | id="x" |-
29859 |}
29860 !! end
29861
29862 ## This tests normalizer's ability to discriminate between
29863 ## cells having identical content.
29864 !! test
29865 4b. Table cells without escapable prefixes after edits
29866 !! options
29867 parsoid={
29868 "modes": ["selser"],
29869 "scrubWikitext": true,
29870 "changes": [
29871 [ "td", "html", "-" ]
29872 ]
29873 }
29874 !! wikitext
29875 {|
29876 |a||b
29877 |}
29878 !! wikitext/edited
29879 {|
29880 | -||-
29881 |}
29882 !! end
29883
29884 ## This tests normalizer's ability to not be tripped by
29885 ## comments (and whitespace)
29886 !! test
29887 4c. Table cells without escapable prefixes after edits
29888 !! options
29889 parsoid={
29890 "modes": ["selser"],
29891 "scrubWikitext": true,
29892 "changes": [
29893 [ "table tbody tr td:first-child", "remove" ]
29894 ]
29895 }
29896 !! wikitext
29897 {|
29898 |-
29899 <!--foo--> |a||-
29900 |}
29901 !! wikitext/edited
29902 {|
29903 |-
29904 <!--foo--> | -
29905 |}
29906 !! end
29907
29908 ## This tests normalizer's ability to handle HTML cells
29909 !! test
29910 4d. Table cells without escapable prefixes after edits
29911 !! options
29912 parsoid={
29913 "modes": ["selser"],
29914 "scrubWikitext": true,
29915 "changes": [
29916 [ "td", "html", "-" ]
29917 ]
29918 }
29919 !! wikitext
29920 <table>
29921 <tr><td>a</td></tr>
29922 </table>
29923 !! wikitext/edited
29924 <table>
29925 <tr><td>-</td></tr>
29926 </table>
29927 !! end
29928
29929 ## T111151 Remove font elements without attributes
29930 !! test
29931 5a. font tags without attributes should be dropped in scrubWikitext mode
29932 !! options
29933 parsoid={
29934 "modes": ["html2wt"],
29935 "scrubWikitext": true
29936 }
29937 !! html
29938 <font>foo</font>
29939 <font><font>bar</font></font>
29940 <font class="x">boo</font>
29941 !! wikitext
29942 foo
29943 bar
29944 <font class="x">boo</font>
29945 !! end
29946
29947 !! test
29948 5b. font tags should not be dropped without scrubWikitext being enabled
29949 !! options
29950 parsoid={
29951 "modes": ["html2wt"],
29952 "scrubWikitext": false
29953 }
29954 !! html
29955 <font>foo</font>
29956 !! wikitext
29957 <font>foo</font>
29958 !! end
29959
29960 !! test
29961 Escape nowiki DOM elements
29962 !! options
29963 parsoid=html2wt
29964 !! html/parsoid
29965 <nowiki><i>foo</i></nowiki>
29966 !! wikitext
29967 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
29968 !! end
29969
29970 # This is meant to be an interim fix while we go about figuring out
29971 # how to not introduce these trailing <nowiki/>s in the first place.
29972 !! test
29973 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
29974 !! options
29975 parsoid=html2wt
29976 !! html/parsoid
29977 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
29978 y</p>
29979 <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>
29980 <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>
29981 !! wikitext
29982 x
29983 y
29984
29985 {{echo|
29986 1 = <nowiki/>}}
29987
29988 {{echo|
29989 1 = <nowiki/>
29990 }}
29991 !! end
29992
29993 !! test
29994 New list is serialized on newlines
29995 !! options
29996 parsoid=html2wt
29997 !! html/parsoid
29998 <p>The quick brown fox jumps over the lazy dog.</p><ul>
29999 <li>Yesterday</li>
30000 <li>Today</li>
30001 <li>Tomorrow</li>
30002 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
30003 !! wikitext
30004 The quick brown fox jumps over the lazy dog.
30005
30006 * Yesterday
30007 * Today
30008 * Tomorrow
30009
30010 The quick onyx goblin jumps over the lazy dwarf.
30011 !! end
30012
30013 !! test
30014 New lists in formatting elements serialized w/o newlines
30015 !! options
30016 parsoid=html2wt
30017 !! html/parsoid
30018 <small>
30019
30020 <ul>
30021 <li>123</li>
30022 </ul>
30023
30024 </small>
30025
30026 <small><ul><li>hi</li></ul></small>
30027 !! wikitext
30028 <small>
30029 * 123
30030 </small>
30031
30032 <small>
30033 * hi
30034 </small>
30035 !! end
30036
30037 !! test
30038 New list in table doesn't need newlines
30039 !! options
30040 parsoid=html2wt
30041 !! html/parsoid
30042 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
30043 !! wikitext
30044 {|
30045 |
30046 * test
30047 * 123
30048 |}
30049 !! end
30050
30051 # ---------------------------------------------------
30052 # End of tests spec'ing wikitext serialization norms |
30053 # ---------------------------------------------------
30054
30055 # T104032
30056 !! test
30057 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
30058 !! options
30059 parsoid=html2wt
30060 !! html/parsoid
30061 a<p>b</p>
30062 <b>c</b><p>d</p>
30063 <table><tr>
30064 <td>a<p>b</p></td>
30065 <td><b>c</b><p>d</p></td>
30066 </tr></table>
30067 !! wikitext
30068 a
30069
30070 b
30071
30072 '''c'''
30073
30074 d
30075 {|
30076 |a
30077 b
30078 |'''c'''
30079 d
30080 |}
30081 !! end
30082
30083 !! test
30084 Anchor without href scenarios
30085 !! options
30086 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30087 !! html/parsoid
30088 <a class="bc"></a>
30089 <a class="no">dice</a>
30090 <a name="foo"></a>
30091 !! wikitext
30092
30093 dice
30094 <span name="foo"></span>
30095 !! end
30096
30097 !! test
30098 New transclusion added after a list should be serialized after the list
30099 !! options
30100 parsoid=html2wt
30101 !! html/parsoid
30102 <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>
30103 !! wikitext
30104 * a
30105 {{echo|foo}}
30106 !! end
30107
30108 # -----------------------------------------------------------------
30109 # End of section for Parsoid-only html2wt tests for serialization
30110 # of new content
30111 # -----------------------------------------------------------------
30112
30113 # -----------------------------------------------------------------
30114 # The following section of tests are primarily to spec behavior of
30115 # the selective serializer. All these tests have manual selser
30116 # changes. The automated selser changes for all tests handle the
30117 # wide variation of changes, but these tests here capture specs
30118 # deterministically.
30119 # ----------------------------------------------------------------
30120
30121 ## T90517
30122 !! test
30123 Selser: New comments should not be lost
30124 !! options
30125 parsoid={
30126 "modes": ["selser"],
30127 "changes": [
30128 [ "#a", "after", "<!--c1-->" ],
30129 [ "#b", "before", "<!--c2-->" ]
30130 ]
30131 }
30132 !! wikitext
30133 <span id="a">a</span>
30134
30135 <span id="b">b</span>
30136 !! wikitext/edited
30137 <span id="a">a</span><!--c1-->
30138
30139 <!--c2--><span id="b">b</span>
30140 !! end
30141
30142 ## T89383
30143 !! test
30144 Selser: Check for validity of DSR before using it
30145 !! options
30146 parsoid={
30147 "modes": ["selser"],
30148 "changes": [
30149 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
30150 ]
30151 }
30152 !! wikitext
30153 <span id="a">a</span>
30154 !! wikitext/edited
30155 {{DISPLAYTITLE:foo}}
30156 <span id="a">a</span>
30157 !! end
30158
30159 !! test
30160 1. DOMDiff: Changes to <ref> content should be looked up using id
30161 !! options
30162 parsoid={
30163 "modes": ["selser"],
30164 "changes": [
30165 ["#X", "after", "bar"],
30166 ["#Y", "after", "baz"]
30167 ]
30168 }
30169 !! wikitext
30170 X <ref><span id="X">foo</span></ref>
30171 Y <ref name="a" />
30172 <references>
30173 <ref name="a"><span id="Y">foo</span></ref>
30174 </references>
30175 !! wikitext/edited
30176 X <ref><span id="X">foo</span>bar</ref>
30177 Y <ref name="a" />
30178 <references>
30179 <ref name="a"><span id="Y">foo</span>baz</ref>
30180 </references>
30181 !! end
30182
30183 !! test
30184 2. DOMDiff: Changes to <ref> content should be looked up using id
30185 !! options
30186 parsoid={
30187 "modes": ["selser"],
30188 "changes": [
30189 ["#Z", "after", "bar"]
30190 ]
30191 }
30192 !! wikitext
30193 A <ref>foo bar for a</ref>
30194 B <ref group="X" name="b" />
30195
30196 <references />
30197
30198 <references group="X">
30199 <ref name="b"><span id="Z">foo</span></ref>
30200 </references>
30201 !! wikitext/edited
30202 A <ref>foo bar for a</ref>
30203 B <ref group="X" name="b" />
30204
30205 <references />
30206
30207 <references group="X">
30208 <ref name="b"><span id="Z">foo</span>bar</ref>
30209 </references>
30210 !! end
30211
30212 !! test
30213 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
30214 !! options
30215 parsoid={
30216 "modes": ["selser"],
30217 "changes": [
30218 [ "div:first-child", "text", "bar" ]
30219 ]
30220 }
30221 !! wikitext
30222 <div style="{{1x|color:red;}}%">foo</div>
30223 !! wikitext/edited
30224 <div style="{{1x|color:red;}}%">bar</div>
30225 !! end
30226
30227 !! test
30228 Empty LI (T49673)
30229 !! wikitext
30230 *a
30231 *
30232 *
30233 *b
30234 !! html+tidy
30235 <ul><li>a</li>
30236 <li class="mw-empty-elt"></li>
30237 <li class="mw-empty-elt"></li>
30238 <li>b</li></ul>
30239 !! end
30240
30241 !! test
30242 Thumbnail output
30243 !! wikitext
30244 [[File:Thumb.png|thumb]]
30245 !! html/php+tidy
30246 <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>
30247 !! html/parsoid
30248 <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>
30249 !! end
30250
30251 !! test
30252 unclosed internal link XSS (T137264)
30253 !! wikitext
30254 [[#%3Cscript%3Ealert(1)%3C/script%3E|
30255 !! html/php
30256 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
30257 </p>
30258 !! html/parsoid
30259 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
30260 !! end
30261
30262 !! test
30263 Validating that <style> isn't eaten by tidy (T167349)
30264 !! options
30265 styletag=1
30266 !! wikitext
30267 <div class="foo">
30268 <style>.foo::before { content: "<foo>"; }</style>
30269 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
30270 </div>
30271 !! html/php+tidy
30272 <div class="foo">
30273 <style>.foo::before { content: "<foo>"; }</style>
30274 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
30275 </div>
30276 !! end
30277
30278 !! test
30279 Validating that <style> isn't wrapped in a paragraph (T186965)
30280 !! options
30281 styletag=1
30282 !! wikitext
30283 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30284
30285 <style>.foo::before { content: "<foo>"; }</style>
30286
30287 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
30288
30289 But if it's on a line with other content, let it be wrapped.
30290
30291 <style>.foo::before { content: "<foo>"; }</style> bar
30292
30293 foo <style>.foo::before { content: "<foo>"; }</style>
30294
30295 foo <style>.foo::before { content: "<foo>"; }</style> bar
30296
30297 And the same if we have non-paragraph-breaking whitespace
30298
30299 foo
30300 <style>.foo::before { content: "<foo>"; }</style>
30301 bar
30302 !! html/php
30303 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30304 </p>
30305 <style>.foo::before { content: "<foo>"; }</style>
30306 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
30307 <p>But if it's on a line with other content, let it be wrapped.
30308 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
30309 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
30310 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
30311 </p><p>And the same if we have non-paragraph-breaking whitespace
30312 </p><p>foo
30313 <style>.foo::before { content: "<foo>"; }</style>
30314 bar
30315 </p>
30316 !! end
30317
30318 !! test
30319 Validating that <link> isn't wrapped in a paragraph (T186965)
30320 !! options
30321 styletag=1
30322 !! wikitext
30323 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30324
30325 <link rel="foo" href="bar"/>
30326
30327 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
30328
30329 But if it's on a line with other content, let it be wrapped.
30330
30331 <link rel="foo" href="bar"/> bar
30332
30333 foo <link rel="foo" href="bar"/>
30334
30335 foo <link rel="foo" href="bar"/> bar
30336
30337 And the same if we have non-paragraph-breaking whitespace
30338
30339 foo
30340 <link rel="foo" href="bar"/>
30341 bar
30342 !! html/php
30343 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30344 </p>
30345 <link rel="foo" href="bar"/>
30346 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
30347 <p>But if it's on a line with other content, let it be wrapped.
30348 </p><p><link rel="foo" href="bar"/> bar
30349 </p><p>foo <link rel="foo" href="bar"/>
30350 </p><p>foo <link rel="foo" href="bar"/> bar
30351 </p><p>And the same if we have non-paragraph-breaking whitespace
30352 </p><p>foo
30353 <link rel="foo" href="bar"/>
30354 bar
30355 </p>
30356 !! end
30357
30358 !! test
30359 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
30360 !! config
30361 wgFragmentMode=[ 'html5', 'legacy' ]
30362 !! wikitext
30363 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
30364 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
30365 !! html/php
30366 <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>
30367 <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>
30368 </p>
30369 !! html/parsoid
30370 <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>
30371 <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>
30372 !! end
30373
30374 !! test
30375 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
30376 !! config
30377 wgFragmentMode=[ 'legacy' ]
30378 !! wikitext
30379 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
30380 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
30381 !! html/php
30382 <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>
30383 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
30384 </p>
30385 !! end
30386
30387 !! test
30388 Decoding of HTML entities in embedded HTML tags
30389 !! wikitext
30390 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
30391 !! html/php
30392 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
30393
30394 !! html/parsoid
30395 <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>
30396 !! end
30397
30398 !! test
30399 Decoding of HTML entities in indicator names for IDs (T104196)
30400 !! options
30401 parsoid=wt2html,html2html
30402 showindicators
30403 !! wikitext
30404 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
30405 !! html/php
30406 1&2&3&amp;4&amp;amp;5=Indicator
30407
30408 !! html/parsoid
30409 <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>
30410 !! end
30411
30412 # this version of the test strips out the ambiguity so Parsoid rts cleanly
30413 !! test
30414 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
30415 !! options
30416 showindicators
30417 !! wikitext
30418 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
30419 !! html/php
30420 1&2&3&amp;4&amp;amp;5=Indicator
30421
30422 !! html/parsoid
30423 <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>
30424 !! end
30425
30426 # This fragment mode is what Parsoid supports.
30427 !! test
30428 HTML5 ids: fallback to legacy
30429 !! config
30430 wgFragmentMode=[ 'html5', 'legacy' ]
30431 !! wikitext
30432 ==Foo bar==
30433
30434 ==foo Bar==
30435
30436 ==Тест==
30437
30438 ==Тест==
30439
30440 ==тест==
30441
30442 ==Hey < # " > % : '==
30443 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30444
30445 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30446
30447 <!-- These two links should produce identical HTML -->
30448 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30449
30450 !! html/php
30451 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
30452 <ul>
30453 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30454 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30455 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30456 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30457 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30458 <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>
30459 </ul>
30460 </div>
30461
30462 <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>
30463 <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>
30464 <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>
30465 <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>
30466 <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>
30467 <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>
30468 <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>
30469 </p><p>💩 <span id="💩"></span>
30470 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30471 </p>
30472 !! html/parsoid
30473 <h2 id="Foo_bar">Foo bar</h2>
30474
30475 <h2 id="foo_Bar_2">foo Bar</h2>
30476
30477 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
30478
30479 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
30480
30481 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
30482
30483 <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>
30484 <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>
30485
30486 <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>
30487
30488 <!-- These two links should produce identical HTML -->
30489 <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>
30490 !! end
30491
30492 # Parsoid doesn't support this mode
30493 !! test
30494 HTML5 ids: legacy with a fallback to modern
30495 !! config
30496 wgFragmentMode=[ 'legacy', 'html5' ]
30497 !! wikitext
30498 ==Foo bar==
30499
30500 ==foo Bar==
30501
30502 ==Тест==
30503
30504 ==Тест==
30505
30506 ==тест==
30507
30508 ==Hey < # " > % : '==
30509 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30510
30511 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30512
30513 <!-- These two links should produce identical HTML -->
30514 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30515
30516 !! html/php
30517 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
30518 <ul>
30519 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30520 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30521 <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>
30522 <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>
30523 <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>
30524 <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>
30525 </ul>
30526 </div>
30527
30528 <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>
30529 <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>
30530 <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>
30531 <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>
30532 <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>
30533 <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>
30534 <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>
30535 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
30536 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
30537 </p>
30538 !! end
30539
30540 # Parsoid doesn't support this mode.
30541 !! test
30542 HTML5 ids: no legacy
30543 !! config
30544 wgFragmentMode=[ 'html5' ]
30545 !! wikitext
30546 ==Foo bar==
30547
30548 ==foo Bar==
30549
30550 ==Тест==
30551
30552 ==Тест==
30553
30554 ==тест==
30555
30556 ==Hey < # " > % : '==
30557 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30558
30559 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30560
30561 <!-- These two links should produce identical HTML -->
30562 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30563
30564 !! html/php
30565 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
30566 <ul>
30567 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30568 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30569 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30570 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30571 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30572 <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>
30573 </ul>
30574 </div>
30575
30576 <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>
30577 <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>
30578 <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>
30579 <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>
30580 <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>
30581 <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>
30582 <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>
30583 </p><p>💩 <span id="💩"></span>
30584 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30585 </p>
30586 !! end
30587
30588 !! test
30589 T90902: Normalize weird characters in section IDs
30590 !! config
30591 wgFragmentMode=[ 'html5', 'legacy' ]
30592 !! wikitext
30593 ==Foo&nbsp;bar==
30594 [[#Foo&nbsp;bar]]
30595
30596 !! html/php
30597 <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>
30598 <p><a href="#Foo_bar">#Foo&#160;bar</a>
30599 </p>
30600 !! html/parsoid
30601 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
30602 <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>
30603 !! end
30604
30605 !! test
30606 T51672: Test for brackets in attributes of elements in external link texts
30607 !! wikitext
30608 [http://example.com/ link <span title="title with [brackets]">span</span>]
30609 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
30610
30611 !! html/php
30612 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
30613 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
30614 </p>
30615 !! html/parsoid
30616 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
30617 <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>
30618 !! end
30619
30620 !! test
30621 T72875: Test for brackets in attributes of elements in internal link texts
30622 !! wikitext
30623 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
30624 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
30625
30626 !! html/php
30627 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30628 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30629 </p>
30630 !! html/parsoid
30631 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
30632 <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>
30633 !! end
30634
30635 !! test
30636 T179544: {{anchorencode:}} output should be always usable in links
30637 !! config
30638 wgFragmentMode=[ 'html5' ]
30639 !! wikitext
30640 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
30641 !! html/php
30642 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
30643 </p>
30644 !! html/parsoid
30645 <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>
30646 !! end
30647
30648 ## ------------------------------
30649 ## Parsoid section-wrapping tests
30650 ## ------------------------------
30651 !! test
30652 Section wrapping for well-nested sections (no leading content)
30653 !! options
30654 parsoid={
30655 "wrapSections": true
30656 }
30657 !! wikitext
30658 =1=
30659 a
30660
30661 =2=
30662 b
30663
30664 ==2.1==
30665 c
30666
30667 ==2.2==
30668 d
30669
30670 ===2.2.1===
30671 e
30672
30673 =3=
30674 f
30675 !! html/parsoid
30676 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30677 <p>a</p>
30678
30679 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30680 <p>b</p>
30681
30682 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30683 <p>c</p>
30684
30685 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
30686 <p>d</p>
30687
30688 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
30689 <p>e</p>
30690
30691 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
30692 <p>f</p>
30693
30694 </section>
30695 !! end
30696
30697 !! test
30698 Section wrapping for well-nested sections (with leading content)
30699 !! options
30700 parsoid={
30701 "wrapSections": true
30702 }
30703 !! wikitext
30704 Para 1.
30705
30706 Para 2 with a <div>nested in it</div>
30707
30708 Para 3.
30709
30710 =1=
30711 a
30712
30713 =2=
30714 b
30715
30716 ==2.1==
30717 c
30718 !! html/parsoid
30719 <section data-mw-section-id="0"><p>Para 1.</p>
30720
30721 <p>Para 2 with a </p><div>nested in it</div>
30722
30723 <p>Para 3.</p>
30724
30725 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30726 <p>a</p>
30727
30728 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30729 <p>b</p>
30730
30731 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30732 <p>c</p>
30733
30734 </section></section>
30735 !! end
30736
30737 !! test
30738 Section wrapping with template-generated sections (good nesting 1)
30739 !! options
30740 parsoid={
30741 "wrapSections": true
30742 }
30743 !! wikitext
30744 =1=
30745 a
30746
30747 {{echo|1=
30748 ==1.1==
30749 b
30750 }}
30751
30752 ==1.2==
30753 c
30754
30755 =2=
30756 d
30757 !! html/parsoid
30758 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30759 <p>a</p>
30760
30761 <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">
30762 </span><p about="#mwt1">b</p>
30763 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
30764 <p>c</p>
30765
30766 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
30767 <p>d</p></section>
30768 !! end
30769
30770 # In this example, the template scope is mildly expanded to incorporate the
30771 # trailing newline after the transclusion since that is part of section 1.1.1
30772 !! test
30773 Section wrapping with template-generated sections (good nesting 2)
30774 !! options
30775 parsoid={
30776 "wrapSections": true,
30777 "modes": ["wt2html", "wt2wt"]
30778 }
30779 !! wikitext
30780 =1=
30781 a
30782
30783 {{echo|1=
30784 ==1.1==
30785 b
30786 ===1.1.1===
30787 d
30788 }}
30789 =2=
30790 e
30791 !! html/parsoid
30792 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30793 <p>a</p>
30794
30795 <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">
30796 </span><p about="#mwt1">b</p><span about="#mwt1">
30797 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
30798 </span><p about="#mwt1">d</p><span about="#mwt1">
30799 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
30800 <p>e</p></section>
30801 !! end
30802
30803 # In this example, the template scope is mildly expanded to incorporate the
30804 # trailing newline after the transclusion since that is part of section 1.2.1
30805 !! test
30806 Section wrapping with template-generated sections (good nesting 3)
30807 !! options
30808 parsoid={
30809 "wrapSections": true,
30810 "modes": ["wt2html", "wt2wt"]
30811 }
30812 !! wikitext
30813 =1=
30814 a
30815
30816 {{echo|1=
30817 x
30818 ==1.1==
30819 b
30820 ==1.2==
30821 c
30822 ===1.2.1===
30823 d
30824 }}
30825 =2=
30826 e
30827 !! html/parsoid
30828 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
30829 <p>a</p>
30830
30831 <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">
30832 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
30833 </span><p about="#mwt1">b</p><span about="#mwt1">
30834 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
30835 </span><p about="#mwt1">c</p><span about="#mwt1">
30836 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
30837 </span><p about="#mwt1">d</p><span about="#mwt1">
30838 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
30839 <p>e</p></section>
30840 !! end
30841
30842 # Because of section-wrapping and template-wrapping interactions,
30843 # the scope of the template is expanded so that the template markup
30844 # is valid in the presence of <section> tags.
30845 # This exercises the s1 is null scenario in the wrapSections code
30846 !! test
30847 Section wrapping with template-generated sections (bad nesting 1)
30848 !! options
30849 parsoid={
30850 "wrapSections": true
30851 }
30852 !! wikitext
30853 <div>
30854 a
30855
30856 {{echo|
30857 =1=
30858 b
30859 }}
30860
30861 c
30862 </div>
30863 !! html/parsoid
30864 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
30865 <p>a</p>
30866
30867 <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"]}'>
30868 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
30869 </span><p about="#mwt1">b
30870 </p><span about="#mwt1">
30871
30872 </span><p about="#mwt1">c</p><span about="#mwt1">
30873 </span></section></div></section>
30874 !! end
30875
30876 # Because of section-wrapping and template-wrapping interactions,
30877 # the scope of the template is expanded so that the template markup
30878 # is valid in the presence of <section> tags.
30879 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
30880 !! test
30881 Section wrapping with template-generated sections (bad nesting 2)
30882 !! options
30883 parsoid={
30884 "wrapSections": true
30885 }
30886 !! wikitext
30887 =1=
30888 a
30889
30890 {{echo|1=
30891 =2=
30892 b
30893 ==2.1==
30894 c
30895 }}
30896
30897 d
30898
30899 =3=
30900 e
30901 !! html/parsoid
30902 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30903 <p>a</p>
30904
30905 </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">
30906 </span><p about="#mwt1">b</p><span about="#mwt1">
30907 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
30908 </span><p about="#mwt1">c</p><span about="#mwt1">
30909
30910 </span><p about="#mwt1">d</p><span about="#mwt1">
30911
30912 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
30913 <p>e</p></section>
30914 !! end
30915
30916 # Because of section-wrapping and template-wrapping interactions,
30917 # additional template wrappers are added to <section> tags
30918 # so that template wrapping semantics are valid whether section
30919 # tags are retained or stripped. But, the template scope can expand
30920 # greatly when accounting for section tags.
30921 # This exercises the s1 and s2 are in different subtrees scenario
30922 !! test
30923 Section wrapping with template-generated sections (bad nesting 3)
30924 !! options
30925 parsoid={
30926 "wrapSections": true,
30927 "modes": ["wt2html", "wt2wt"]
30928 }
30929 !! wikitext
30930 =1=
30931 a
30932
30933 {{echo|1=
30934 ==1.2==
30935 b
30936 =2=
30937 c
30938 }}
30939
30940 d
30941
30942 =3=
30943 e
30944 !! html/parsoid
30945 <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>
30946 <p>a</p>
30947
30948 <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">
30949 </span><p about="#mwt1">b</p><span about="#mwt1">
30950 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
30951 </span><p about="#mwt1">c</p>
30952
30953 <p>d</p>
30954 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
30955 <p>e</p></section>
30956 !! end
30957
30958 !! test
30959 Section wrapping with uneditable lead section + div wrapping multiple sections
30960 !! options
30961 parsoid={
30962 "wrapSections": true
30963 }
30964 !! wikitext
30965 foo
30966
30967 <div style="border:1px solid red;">
30968 =1=
30969 a
30970
30971 ==1.1==
30972 b
30973
30974 =2=
30975 c
30976 </div>
30977
30978 =3=
30979 d
30980
30981 ==3.1==
30982 e
30983 !! html/parsoid
30984 <section data-mw-section-id="-1"><p>foo</p>
30985
30986 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30987 <section data-mw-section-id="1"><h1 id="1">1</h1>
30988 <p>a</p>
30989
30990 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
30991 <p>b</p>
30992
30993 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
30994 <p>c</p>
30995 </section></div>
30996
30997 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
30998 <p>d</p>
30999
31000 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31001 <p>e</p>
31002 </section></section>
31003 !! end
31004
31005 !! test
31006 Section wrapping with editable lead section + div overlapping multiple sections
31007 !! options
31008 parsoid={
31009 "wrapSections": true
31010 }
31011 !! wikitext
31012 foo
31013
31014 =1=
31015 a
31016 <div style="border:1px solid red;">
31017 b
31018
31019 ==1.1==
31020 c
31021
31022 =2=
31023 d
31024 </div>
31025 e
31026
31027 =3=
31028 f
31029
31030 ==3.1==
31031 g
31032 !! html/parsoid
31033 <section data-mw-section-id="0"><p>foo</p>
31034
31035 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
31036 <p>a</p>
31037 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31038 <p>b</p>
31039
31040 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31041 <p>c</p>
31042
31043 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31044 <p>d</p>
31045 </section></div>
31046 <p>e</p>
31047
31048 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31049 <p>f</p>
31050
31051 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31052 <p>g</p>
31053 </section></section>
31054 !! end
31055
31056 !! test
31057 HTML header tags should not be wrapped in section tags
31058 !! options
31059 parsoid={
31060 "wrapSections": true
31061 }
31062 !! wikitext
31063 foo
31064
31065 <h1>a</h1>
31066
31067 =b=
31068
31069 <h1>c</h1>
31070
31071 =d=
31072 !! html/parsoid
31073 <section data-mw-section-id="0"><p>foo</p>
31074
31075 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
31076
31077 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
31078
31079 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
31080
31081 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
31082 !! end
31083
31084 !! test
31085 Lead section containing only whitespace and comments.
31086 !! options
31087 parsoid={
31088 "wrapSections": true
31089 }
31090 !! wikitext
31091
31092 <!-- this is a comment, presumably significant to editors -->
31093 =1=
31094 a
31095
31096 =2=
31097 b
31098 !! html/parsoid
31099 <section data-mw-section-id="0" data-parsoid="{}">
31100 <!-- this is a comment, presumably significant to editors -->
31101 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
31102 <p>a</p>
31103
31104 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31105 <p>b</p></section>
31106 !! end
31107
31108 !! test
31109 Pseudo-sections emitted by templates should have id -2
31110 !! options
31111 parsoid={
31112 "wrapSections": true
31113 }
31114 !! wikitext
31115 foo
31116 {{echo|<div>
31117 ==a==
31118 ==b==
31119 </div>
31120 }}
31121 !! html/parsoid
31122 <section data-mw-section-id="-1"><p>foo</p>
31123 </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}}]}'>
31124 <section data-mw-section-id="-1"><h2 id="a">a</h2>
31125 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
31126 </section></div><span about="#mwt1">
31127 </span></section>
31128 !! end
31129
31130 ##########################################################################
31131 Tests demonstrating white-space insensitivity in input wikitext
31132 for wikitext headings, wikitext list items, and wikitext table captions,
31133 headings, and cells. HTML versions of the same should preserve whitespace.
31134 ##########################################################################
31135 !! test
31136 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
31137 !! options
31138 parsoid={
31139 "modes": ["wt2html"],
31140 "preserveIEW": true
31141 }
31142 !! wikitext
31143 __NOTOC__
31144 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
31145 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
31146 == <!--Headings with fallback ids--> Личная жизнь ==
31147 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
31148 ; <!--term to define--> term : <!--term's definition--> definition
31149 {|
31150 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
31151 |-
31152 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
31153 |-
31154 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31155 |-
31156 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
31157 |-
31158 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
31159 |}
31160 : {|
31161 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31162 |} foo <!--c1-->
31163 !! html/php+tidy
31164 <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>
31165 <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>
31166 <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>
31167 <ul><li>List item</li></ul>
31168 <dl><dt>term&#160;</dt>
31169 <dd>definition</dd></dl>
31170 <table>
31171 <caption>Table Caption
31172 </caption>
31173 <tbody><tr>
31174 <th>Table Heading 1</th>
31175 <th>Table Heading 2
31176 </th></tr>
31177 <tr>
31178 <td>Table Cell 1</td>
31179 <td>Table Cell 2
31180 </td></tr>
31181 <tr>
31182 <td>class="foo"</td>
31183 <td>Table Cell 3
31184 </td></tr>
31185 <tr>
31186 <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
31187 </td></tr></tbody></table>
31188 <dl><dd><table>
31189 <tbody><tr>
31190 <td>Table Cell 1</td>
31191 <td>Table Cell 2
31192 </td></tr></tbody></table> foo</dd></dl>
31193 !! html/parsoid
31194 <meta property="mw:PageProp/notoc">
31195 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
31196 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
31197 <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>
31198 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
31199 <dl><dt><!--term to define-->term&nbsp;</dt><dd><!--term's definition-->definition</dd></dl>
31200 <table>
31201 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
31202 <tbody><tr>
31203 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th>Table Heading 2<!--c5--></th></tr>
31204 <tr>
31205 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31206 <tr>
31207 <td>class="foo"</td><td><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
31208 <tr>
31209 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One">two</a> <!--c2--> | <!--c3--> some content</td></tr>
31210 </tbody></table>
31211 <dl><dd><table>
31212 <tbody><tr><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31213 </tbody></table><p> foo </p><!--c1--></dd></dl>
31214 !! end
31215
31216 # Looks like <caption> is not accepted in HTML
31217 !! test
31218 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
31219 !! options
31220 parsoid={
31221 "modes": ["wt2html"],
31222 "preserveIEW": true
31223 }
31224 !! wikitext
31225 __NOTOC__
31226 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
31227 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
31228 <table>
31229 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
31230 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
31231 </table>
31232 !! html/php+tidy
31233 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
31234 <ul><li> List item </li></ul>
31235 <table>
31236 <tbody><tr><th> Table Heading </th><th></th></tr>
31237 <tr><td> Table Cell </td><th></th></tr>
31238 </tbody></table>
31239 !! html/parsoid
31240 <meta property="mw:PageProp/notoc"/>
31241 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
31242 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
31243 <table>
31244 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
31245 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
31246 </tbody></table>
31247 !! end
31248
31249 !! test
31250 Do not trim whitespace in links and quotes
31251 !! options
31252 parsoid={
31253 "modes": ["wt2html"],
31254 "preserveIEW": true
31255 }
31256 !! wikitext
31257 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
31258 [[Foo| some text ]]
31259 !! html/php+tidy
31260 <p>foo <i> italic </i> and <b> bold </b>
31261 <a href="/wiki/Foo" title="Foo"> some text </a>
31262 </p>
31263 !! html/parsoid
31264 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
31265 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
31266 !! end
31267
31268 !! test
31269 Remove p tags surrounding a single element in a figcaption
31270 !! options
31271 parsoid=html2wt
31272 !! wikitext
31273 [[File:Foobar.jpg|right|200x200px|Caption]]
31274 !! html/parsoid
31275 <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>
31276 !! end
31277
31278 !! test
31279 Selser preserves lack of newline before list and allows newline after the list
31280 !! options
31281 parsoid={
31282 "modes": ["selser"],
31283 "scrubWikitext": true,
31284 "changes": [
31285 [ "ul", "after", "<p>footer</p>" ]
31286 ]
31287 }
31288 !! wikitext
31289 header
31290 *foo
31291 *bar
31292 !! wikitext/edited
31293 header
31294 *foo
31295 *bar
31296
31297 footer
31298 !! end
31299
31300
31301 !! test
31302 Selser does not introduce newlines between unedited paragraph preceding the list
31303 !! options
31304 parsoid={
31305 "modes": ["selser"],
31306 "changes": [
31307 [ "table tbody tr td p:last-child", "empty" ]
31308 ]
31309 }
31310 !! wikitext
31311 {|
31312 |
31313 header
31314 *foo
31315 *bar
31316 footer
31317 |}
31318 !! wikitext/edited
31319 {|
31320 |
31321 header
31322 *foo
31323 *bar
31324
31325 |}
31326 !! end
31327
31328 !! test
31329 Selser does not introduce newlines between unedited paragraph following the list
31330 !! options
31331 parsoid={
31332 "modes": ["selser"],
31333 "changes": [
31334 [ "table tbody tr td p:first-child", "empty" ]
31335 ]
31336 }
31337 !! wikitext
31338 {|
31339 |
31340 header
31341 *foo
31342 *bar
31343 footer
31344 |}
31345 !! wikitext/edited
31346 {|
31347 |
31348
31349 *foo
31350 *bar
31351 footer
31352 |}
31353 !! end
31354
31355 !! test
31356 Remove a list item but do not insert newline above list
31357 !! options
31358 parsoid={
31359 "modes": ["selser"],
31360 "changes": [
31361 [ "ul li:last-child", "remove" ]
31362 ]
31363 }
31364 !! wikitext
31365 header
31366 *foo
31367 *bar
31368 footer
31369 !! wikitext/edited
31370 header
31371 *foo
31372 footer
31373 !! end