Collapse some unnecessary else conditions
[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/php
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+tidy
1461 <p class="mw-empty-elt">
1462 </p><p>&lt;s.foo&gt;s
1463 </p>
1464 !! end
1465
1466 ###
1467 ### Special characters
1468 ###
1469
1470 !! test
1471 Bare pipe character (T54363)
1472 !! wikitext
1473 |
1474 !! html
1475 <p>|
1476 </p>
1477 !! end
1478
1479 !! test
1480 Bare pipe character from a template (T54363)
1481 !! wikitext
1482 {{pipe}}
1483 !! html
1484 <p>|
1485 </p>
1486 !! end
1487
1488 ###
1489 ### <nowiki> test cases
1490 ###
1491
1492 !! test
1493 <nowiki> unordered list
1494 !! wikitext
1495 <nowiki>* This is not an unordered list item.</nowiki>
1496 !! html/php
1497 <p>* This is not an unordered list item.
1498 </p>
1499 !! html/parsoid
1500 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1501 !! end
1502
1503 !! test
1504 <nowiki> spacing
1505 !! wikitext
1506 <nowiki>Lorem ipsum dolor
1507
1508 sed abit.
1509 sed nullum.
1510
1511 :and a colon
1512 </nowiki>
1513 !! html/php
1514 <p>Lorem ipsum dolor
1515
1516 sed abit.
1517 sed nullum.
1518
1519 :and a colon
1520
1521 </p>
1522 !! html/parsoid
1523 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1524
1525 sed abit.
1526 sed nullum.
1527
1528 :and a colon
1529 </span></p>
1530 !! end
1531
1532 !! test
1533 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1534 !! wikitext
1535 <nowiki><span class="error"></nowiki>
1536 !! html/php
1537 <p>&lt;span class="error"&gt;
1538 </p>
1539 !! html/parsoid
1540 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1541 !! end
1542
1543 !! test
1544 nowiki 3
1545 !! wikitext
1546 :There is not nowiki.
1547 :There is <nowiki>nowiki</nowiki>.
1548
1549 #There is not nowiki.
1550 #There is <nowiki>nowiki</nowiki>.
1551
1552 *There is not nowiki.
1553 *There is <nowiki>nowiki</nowiki>.
1554 !! html/php
1555 <dl><dd>There is not nowiki.</dd>
1556 <dd>There is nowiki.</dd></dl>
1557 <ol><li>There is not nowiki.</li>
1558 <li>There is nowiki.</li></ol>
1559 <ul><li>There is not nowiki.</li>
1560 <li>There is nowiki.</li></ul>
1561
1562 !! html/parsoid
1563 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1564 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1565
1566 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1567 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1568
1569 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1570 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1571 !! end
1572
1573 !! test
1574 Entities inside <nowiki>
1575 !! wikitext
1576 <nowiki>&lt;</nowiki>
1577 !! html/php
1578 <p>&lt;
1579 </p>
1580 !! html/parsoid
1581 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1582 !! end
1583
1584 !! test
1585 Entities inside template parameters
1586 !! wikitext
1587 {{echo|&ndash;}}
1588 !! html/php+tidy
1589 <p>&#8211;
1590 </p>
1591 !! html/parsoid
1592 <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>
1593 !! end
1594
1595 !! test
1596 Properly escape nowiki when combined with other wiki markup
1597 !! options
1598 parsoid=html2wt
1599 !! html/parsoid
1600 <p>* &lt;/nowiki&gt; tag</p>
1601 !! wikitext
1602 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1603 !! end
1604
1605 !! test
1606 T93824: Put escaped HTML tags inside nowiki
1607 !! options
1608 parsoid=html2wt
1609 !! html/parsoid
1610 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1611 !! wikitext
1612 <nowiki><h2>foo</h2></nowiki>
1613 !! end
1614
1615 !! test
1616 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1617 !! options
1618 parsoid=html2wt
1619 !! html/parsoid
1620 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1621 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1622 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1623 !! wikitext
1624 This text: L'[[Foo]]
1625 This text: L<nowiki>''</nowiki>[[Foo]]
1626 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1627 !! end
1628
1629 # This test fails because wikitext whitespace is not normalized before comparing.
1630 !! test
1631 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1632 !! options
1633 parsoid=html2wt
1634 !! html/parsoid
1635 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1636 </p>
1637 !! wikitext
1638 This text : L<nowiki>''</nowiki>[[Foo]]
1639 !! end
1640
1641 # This test and the next one are html2wt only as they test that incorrect wikitext
1642 # passed in template arguments gets escaped or wrapped in nowikis where required.
1643 !! test
1644 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1645 !! options
1646 parsoid=html2wt
1647 !! html/parsoid
1648 <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>
1649 <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>
1650 !! wikitext
1651 {{echo|foo{{!}}bar}}
1652 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1653 !! end
1654
1655 !! test
1656 T53961: Output correct nowikis in template arguments
1657 !! options
1658 parsoid=html2wt
1659 !! html/parsoid
1660 <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>
1661 <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>
1662 <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>
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 | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></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 }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1665 !! wikitext
1666 {{echo|a [ b}}
1667 {{echo|<nowiki>a }} b</nowiki>}}
1668 {{echo|<nowiki>a [[ b</nowiki>}}
1669 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1670 {{echo|a <nowiki>}</nowiki>}}
1671 !! end
1672
1673 !! test
1674 Cases where "!!" needs nowiki protection
1675 !! options
1676 parsoid=html2wt
1677 !! html/parsoid
1678 <table>
1679 <tr><th>this needs protection !! here</th></tr>
1680 </table>
1681
1682 <table>
1683 <tr><th>this does not need
1684 protection !! here</th></tr>
1685 </table>
1686 !! wikitext
1687 {|
1688 !<nowiki>this needs protection !! here</nowiki>
1689 |}
1690
1691 {|
1692 !this does not need
1693 protection !! here
1694 |}
1695 !! end
1696
1697 ###
1698 ### Comments
1699 ###
1700 !! test
1701 Comments and Indent-Pre
1702 !! wikitext
1703 <!-- comment 1 --> asdf
1704
1705 <!-- comment 1 --> asdf
1706 <!-- comment 2 -->
1707
1708 <!-- comment 1 --> asdf
1709 <!-- comment 2 -->xyz
1710
1711 <!-- comment 1 --> asdf
1712 <!-- comment 2 --> xyz
1713 !! html
1714 <pre>asdf
1715 </pre>
1716 <pre>asdf
1717 </pre>
1718 <pre>asdf
1719 </pre>
1720 <p>xyz
1721 </p>
1722 <pre>asdf
1723 xyz
1724 </pre>
1725 !! end
1726
1727 !! test
1728 Comment test 2a
1729 !! wikitext
1730 asdf
1731 <!-- comment 1 -->
1732 jkl
1733 !! html
1734 <p>asdf
1735 jkl
1736 </p>
1737 !! end
1738
1739 !! test
1740 Comment test 2b
1741 !! wikitext
1742 asdf
1743 <!-- comment 1 -->
1744
1745 jkl
1746 !! html
1747 <p>asdf
1748 </p><p>jkl
1749 </p>
1750 !! end
1751
1752 !! test
1753 Comment test 3
1754 !! wikitext
1755 asdf
1756 <!-- comment 1 -->
1757 <!-- comment 2 -->
1758 jkl
1759 !! html
1760 <p>asdf
1761 jkl
1762 </p>
1763 !! end
1764
1765 !! test
1766 Comment test 4
1767 !! wikitext
1768 asdf<!-- comment 1 -->jkl
1769 !! html
1770 <p>asdfjkl
1771 </p>
1772 !! end
1773
1774 !! test
1775 Comment spacing
1776 !! wikitext
1777 a
1778 <!-- foo --> b <!-- bar -->
1779 c
1780 !! html
1781 <p>a
1782 </p>
1783 <pre> b
1784 </pre>
1785 <p>c
1786 </p>
1787 !! end
1788
1789 !! test
1790 Comment whitespace
1791 !! wikitext
1792 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1793 !! html
1794
1795 !! end
1796
1797 !! test
1798 Comment semantics and delimiters
1799 !! wikitext
1800 <!-- --><!----><!-----><!------>
1801 !! html/php
1802
1803 !! html/parsoid
1804 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1805 !! end
1806
1807 !! test
1808 Comment semantics and delimiters, redux
1809 !! wikitext
1810 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1811 -- foo -- funky huh? ... -->
1812 !! html/php
1813
1814 !! html/parsoid
1815 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1816 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1817 !! end
1818
1819 !! test
1820 Comment semantics and delimiters: directors cut
1821 !! wikitext
1822 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1823 everything starting with < followed by !-- until the first -- and > we see,
1824 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1825 -->-->
1826 !! html/php
1827 <p>--&gt;
1828 </p>
1829 !! html/parsoid
1830 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1831 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1832 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1833 --><p>--></p>
1834 !! end
1835
1836 !! test
1837 Comment semantics: nesting
1838 !! wikitext
1839 <!--<!-- no, we're not going to do anything fancy here -->-->
1840 !! html/php
1841 <p>--&gt;
1842 </p>
1843 !! html/parsoid
1844 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1845 !! end
1846
1847 # Parsoid closes the unclosed comment, even if it means a slight
1848 # round-trip diff.
1849 !! test
1850 Comment semantics: unclosed comment at end
1851 !! options
1852 parsoid=wt2html,html2html
1853 !! wikitext
1854 <!--This comment will run out to the end of the document
1855 !! html/php
1856
1857 !! html/parsoid
1858 <!--This comment will run out to the end of the document-->
1859 !! end
1860
1861 !! test
1862 Comment semantics: normalize comments to play nice with XML and browsers
1863 !! wikitext
1864 <!-- Browsers --!> think this is closed -->
1865 <!--> This would normally be text -->
1866 <!---> As would this -->
1867 <!-- XML doesn't like trailing dashes -------->
1868 <!-- Nor doubled hyphens -- anywhere in the data -->
1869 But this is not a comment.
1870 !! html/php
1871 <p>But this is not a comment.
1872 </p>
1873 !! html/parsoid
1874 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1875 <!--&#x3E; This would normally be text -->
1876 <!--&#x2D;&#x3E; As would this -->
1877 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1878 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1879 <p>But this is not a comment.</p>
1880 !! end
1881
1882 !! test
1883 Comment semantics: round-trip even text which contains encoded -->
1884 !! wikitext
1885 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1886 !! html/parsoid
1887 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1888 !! end
1889
1890 !! test
1891 Comment in template title
1892 !! wikitext
1893 {{f<!---->oo}}
1894 !! html
1895 <p>FOO
1896 </p>
1897 !! end
1898
1899 !! test
1900 Comment on its own line post-expand
1901 !! wikitext
1902 a
1903 {{blank}}<!---->
1904 b
1905 !! html
1906 <p>a
1907 </p><p>b
1908 </p>
1909 !! end
1910
1911 !! test
1912 Comment on its own line post-expand with non-significant whitespace
1913 !! wikitext
1914 a
1915 {{blank}} <!---->
1916 b
1917 !! html
1918 <p>a
1919 </p><p>b
1920 </p>
1921 !! end
1922
1923 !! test
1924 post-expand include size being exceeded
1925 !! options
1926 maxincludesize=20
1927 !! wikitext
1928 {{echo3|1234567890}}
1929 !! html
1930 <p><a href="/wiki/Template:Echo3" title="Template:Echo3">Template:Echo3</a><!-- WARNING: template omitted, post-expand include size too large -->
1931 </p>
1932 !! end
1933
1934 !! test
1935 max template depth being reached
1936 !! options
1937 maxtemplatedepth=1
1938 !! wikitext
1939 {{echo with depth|too deep!}}
1940 !! html
1941 <p><span class="error">Template recursion depth limit exceeded (1)</span>
1942 </p>
1943 !! end
1944
1945 !! test
1946 multiple templates that are redirects
1947 !! wikitext
1948 {{redirect to foo}}
1949 {{redirect to foo}}
1950 !! html
1951 <p>FOO
1952 FOO
1953 </p>
1954 !! end
1955
1956 !! test
1957 Multiple comments should still parse as SOL-transparent
1958 !! options
1959 parsoid=wt2html,wt2wt
1960 !! wikitext
1961 <!--c1-->*a
1962 <!--c2--><!--c3--><!--c4-->*b
1963 !! html/php
1964 <ul><li>a</li>
1965 <li>b</li></ul>
1966
1967 !! html/parsoid
1968 <!--c1--><ul>
1969 <li>a
1970 </li>
1971 <!--c2--><!--c3--><!--c4-->
1972 <li>b
1973 </li>
1974 </ul>
1975 !! end
1976
1977 ## Make sure ">" gets escaped in comments to avoid XSS
1978 !! test
1979 IE conditional comments
1980 !! wikitext
1981 <!--[if lt IE 9]>
1982 <script>alert('hi');</script>
1983 <![endif]-->
1984 !! html/parsoid
1985 <!--[if lt IE 9]&#x3E;
1986 <script&#x3E;alert('hi');</script&#x3E;
1987 <![endif]-->
1988 !! end
1989
1990 ###
1991 ### paragraph wrapping tests
1992 ###
1993
1994 !! test
1995 No block tags
1996 !! wikitext
1997 a
1998
1999 b
2000 !! html
2001 <p>a
2002 </p><p>b
2003 </p>
2004 !! end
2005
2006 !! test
2007 Block tag on one line (<div>)
2008 !! wikitext
2009 a <div>foo</div>
2010
2011 b
2012 !! html
2013 a <div>foo</div>
2014 <p>b
2015 </p>
2016 !! html+tidy
2017 <p>a </p><div>foo</div>
2018 <p>b
2019 </p>
2020 !! end
2021
2022 !! test
2023 No p-wrappable content
2024 !! options
2025 parsoid=wt2html,html2html
2026 !! wikitext
2027 <span><div>x</div></span>
2028 <span><s><div>x</div></s></span>
2029 <small><em></em></small><span><s><div>x</div></s></span>
2030 !! html+tidy
2031 <span><div>x</div></span>
2032 <span><s><div>x</div></s></span>
2033 <p><small><em></em></small></p><span><s><div>x</div></s></span>
2034 !! end
2035
2036 # T177612: Parsoid-only test
2037 !! test
2038 Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code
2039 !! wikitext
2040 {{echo|<span><div>x</div></span>}}
2041 x
2042 !! html/parsoid
2043 <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>
2044 <p>x</p>
2045 !! end
2046
2047 !! test
2048 Block tag on one line (<blockquote>)
2049 !! options
2050 parsoid=wt2html,html2html
2051 !! wikitext
2052 a <blockquote>foo</blockquote>
2053
2054 b
2055 !! html
2056 a <blockquote>foo</blockquote>
2057 <p>b
2058 </p>
2059 !! html+tidy
2060 <p>a </p><blockquote><p>foo</p></blockquote>
2061 <p>b
2062 </p>
2063 !! end
2064
2065 !! test
2066 Block tag on both lines (<div>)
2067 !! wikitext
2068 a <div>foo</div>
2069
2070 b <div>foo</div>
2071 !! html
2072 a <div>foo</div>
2073 b <div>foo</div>
2074
2075 !! html+tidy
2076 <p>a </p><div>foo</div><p>
2077 b </p><div>foo</div>
2078 !! end
2079
2080 !! test
2081 Block tag on both lines (<blockquote>)
2082 !! options
2083 parsoid=wt2html,html2html
2084 !! wikitext
2085 a <blockquote>foo</blockquote>
2086
2087 b <blockquote>foo</blockquote>
2088 !! html
2089 a <blockquote>foo</blockquote>
2090 b <blockquote>foo</blockquote>
2091
2092 !! html+tidy
2093 <p>a </p><blockquote><p>foo</p></blockquote><p>
2094 b </p><blockquote><p>foo</p></blockquote>
2095 !! end
2096
2097 !! test
2098 Multiple lines without block tags
2099 !! wikitext
2100 <div>foo</div> a
2101 b
2102 c
2103 d<!--foo--> e
2104 x <div>foo</div> z
2105 !! html
2106 <div>foo</div> a
2107 <p>b
2108 c
2109 d e
2110 </p>
2111 x <div>foo</div> z
2112
2113 !! html+tidy
2114 <div>foo</div><p> a
2115 </p><p>b
2116 c
2117 d e
2118 </p><p>
2119 x </p><div>foo</div><p> z
2120 </p>
2121 !! end
2122
2123 !! test
2124 Empty lines between lines with block tags
2125 !! wikitext
2126 <div></div>
2127
2128
2129 <div></div>a
2130
2131 b
2132 <div>a</div>b
2133
2134 <div>b</div>d
2135
2136
2137 <div>e</div>
2138 !! html
2139 <div></div>
2140 <p><br />
2141 </p>
2142 <div></div>a
2143 <p>b
2144 </p>
2145 <div>a</div>b
2146 <div>b</div>d
2147 <p><br />
2148 </p>
2149 <div>e</div>
2150
2151 !! html+tidy
2152 <div></div>
2153 <p><br />
2154 </p>
2155 <div></div><p>a
2156 </p><p>b
2157 </p>
2158 <div>a</div><p>b
2159 </p><div>b</div><p>d
2160 </p><p><br />
2161 </p>
2162 <div>e</div>
2163 !! html/parsoid
2164 <div data-parsoid='{"stx":"html"}'></div>
2165
2166 <p><br /></p>
2167 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2168
2169 <p>b</p>
2170 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2171
2172 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2173
2174 <p><br /></p>
2175 <div data-parsoid='{"stx":"html"}'>e</div>
2176 !! end
2177
2178 !! test
2179 Unclosed HTML p-tags should be handled properly
2180 !! wikitext
2181 <div><p>foo</div>
2182 a
2183
2184 b
2185 !! html/php+tidy
2186 <div><p>foo</p></div>
2187 <p>a
2188 </p><p>b
2189 </p>
2190 !! html/parsoid
2191 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2192 <p>a</p>
2193 <p>b</p>
2194 !! end
2195
2196 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2197 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2198 ## them for now.
2199 !! test
2200 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2201 !! options
2202 parsoid=wt2html
2203 !! wikitext
2204 a [[Category:A1]] [[Category:A2]]
2205 [[Category:A3]]
2206 [[Category:A4]]
2207 !! html/parsoid
2208 <p>a</p>
2209 <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"/>
2210 !! end
2211
2212 !! test
2213 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2214 !! options
2215 parsoid=wt2html
2216 !! wikitext
2217 [[Category:A1]]a
2218 !! html/parsoid
2219 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2220 !! end
2221
2222 !! test
2223 No paragraph necessary for SOL transparent template
2224 !! wikitext
2225 <span><div>foo</div></span>
2226 [[Category:Foo]]
2227
2228 <span><div>foo</div></span>
2229 {{echo|[[Category:Foo]]}}
2230 !! html/php
2231 <span><div>foo</div></span>
2232 <span><div>foo</div></span>
2233
2234 !! html/parsoid
2235 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2236 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
2237
2238 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2239 <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}}]}'/>
2240 !! end
2241
2242 !! test
2243 Avoid expanding multiline sol transparent template ranges unnecessarily
2244 !! wikitext
2245 hi
2246
2247
2248 {{echo|<br/>
2249 }}
2250
2251 [[Category:Ho]]
2252 !! html/php
2253 <p>hi
2254 </p><p><br />
2255 <br />
2256 </p>
2257 !! html/parsoid
2258 <p>hi</p>
2259
2260 <p><br />
2261 <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">
2262 </span></p>
2263
2264 <link rel="mw:PageProp/Category" href="./Category:Ho" />
2265 !! end
2266
2267 !! test
2268 Paragraph wrapping following unclosed table
2269 !! options
2270 parsoid=wt2html,html2html
2271 !! wikitext
2272 {|
2273 |-
2274
2275 {|
2276 | x
2277 |}
2278
2279 a
2280
2281 b
2282
2283 c
2284 !! html/php+tidy
2285 <table>
2286
2287
2288 </table><table>
2289 <tbody><tr>
2290 <td>x
2291 </td></tr></tbody></table>
2292 <p>a
2293 </p><p>b
2294 </p><p>c
2295 </p>
2296 !! html/parsoid
2297 <table data-parsoid='{"autoInsertedEnd":true}'>
2298 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr>
2299
2300 </tbody></table><table>
2301 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>x</td></tr>
2302 </tbody></table>
2303
2304 <p>a</p>
2305
2306 <p>b</p>
2307
2308 <p>c</p>
2309 !! end
2310
2311 !! test
2312 Paragraph wrapping suppressed in html p
2313 !! options
2314 parsoid=wt2html,html2html
2315 !! wikitext
2316 <p>
2317
2318
2319 hi
2320
2321
2322
2323 </p>
2324 !! html/php+tidy
2325 <p>
2326
2327
2328 hi
2329
2330
2331
2332 </p>
2333 !! html/parsoid
2334 <p data-parsoid='{"stx":"html"}'>
2335
2336
2337 hi
2338
2339
2340
2341 </p>
2342 !! end
2343
2344 !! test
2345 Dangling table row doesn't prevent p-wrapping
2346 !! options
2347 parsoid=wt2html,html2html
2348 !! wikitext
2349 {|
2350 | hi
2351 |-
2352 |} ho
2353 !! html/parsoid
2354 <table>
2355 <tbody><tr><td>hi</td></tr>
2356 <tr class="mw-empty-elt"></tr>
2357 </tbody></table><p> ho</p>
2358 !! end
2359
2360 ###
2361 ### Preformatted text
2362 ###
2363
2364 !! test
2365 Preformatted text
2366 !! wikitext
2367 This is some
2368 Preformatted text
2369 With ''italic''
2370 And '''bold'''
2371 And a [[Main Page|link]]
2372 !! html
2373 <pre>This is some
2374 Preformatted text
2375 With <i>italic</i>
2376 And <b>bold</b>
2377 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2378 </pre>
2379 !! end
2380
2381 !! test
2382 Tabs don't trigger preformatted text
2383 !! wikitext
2384 This is not
2385 preformatted text.
2386 This is preformatted text.
2387 So is this.
2388 !! html/php
2389 <p> This is not
2390 preformatted text.
2391 </p>
2392 <pre>This is preformatted text.
2393 So is this.
2394 </pre>
2395 !! html/parsoid
2396 <p> This is not
2397 preformatted text.</p>
2398 <pre>This is preformatted text.
2399 So is this.</pre>
2400 !! end
2401
2402 !! test
2403 Space before tab needs nowiki pre protection
2404 !! options
2405 parsoid=html2wt
2406 !! html/parsoid
2407 <p> a</p>
2408 !! wikitext
2409 <nowiki> </nowiki> a
2410 !! end
2411
2412 !! test
2413 Ident preformatting with inline content
2414 !! wikitext
2415 a
2416 ''b''
2417 !! html
2418 <pre>a
2419 <i>b</i>
2420 </pre>
2421 !! end
2422
2423 !! test
2424 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2425 !! wikitext
2426 <pre><nowiki>
2427 <b>
2428 <cite>
2429 <em>
2430 </nowiki></pre>
2431 !! html
2432 <pre>
2433 &lt;b&gt;
2434 &lt;cite&gt;
2435 &lt;em&gt;
2436 </pre>
2437
2438 !! end
2439
2440 !! test
2441 Regression with preformatted in <center>
2442 !! wikitext
2443 <center>
2444 Blah
2445 </center>
2446 !! html
2447 <center>
2448 <pre>Blah
2449 </pre>
2450 </center>
2451
2452 !! end
2453
2454 !! test
2455 T54763: Preformatted in <blockquote>
2456 !! wikitext
2457 <blockquote>
2458 Blah
2459 {|
2460 |
2461 indented cell (no pre-wrapping!)
2462 |}
2463 </blockquote>
2464 !! html
2465 <blockquote>
2466 <p> Blah
2467 </p>
2468 <table>
2469 <tr>
2470 <td>
2471 <p> indented cell (no pre-wrapping!)
2472 </p>
2473 </td></tr></table>
2474 </blockquote>
2475
2476 !! end
2477
2478 !! test
2479 T53086: Double newlines in blockquotes should be turned into paragraphs
2480 !! wikitext
2481 <blockquote>
2482 Foo
2483
2484 Bar
2485 </blockquote>
2486 !! html
2487 <blockquote>
2488 <p>Foo
2489 </p><p>Bar
2490 </p>
2491 </blockquote>
2492
2493 !! end
2494
2495 !! test
2496 T17491: <ins>/<del> in blockquote
2497 !! options
2498 parsoid=wt2html
2499 !! wikitext
2500 <blockquote>
2501 Foo <del>bar</del> <ins>baz</ins> quux
2502 </blockquote>
2503 !! html
2504 <blockquote>
2505 <p>Foo <del>bar</del> <ins>baz</ins> quux
2506 </p>
2507 </blockquote>
2508
2509 !! html+tidy
2510 <blockquote>
2511 <p>Foo <del>bar</del> <ins>baz</ins> quux
2512 </p>
2513 </blockquote>
2514 !! end
2515
2516 !! test
2517 T17491: <ins>/<del> in blockquote (2)
2518 !! options
2519 parsoid=wt2html
2520 !! wikitext
2521 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2522 </blockquote>
2523 !! html
2524 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2525 </blockquote>
2526
2527 !! html+tidy
2528 <blockquote><p>Foo <del>bar</del> <ins>baz</ins> quux
2529 </p></blockquote>
2530 !! end
2531
2532 !! test
2533 <pre> with attributes (T5202)
2534 !! wikitext
2535 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2536 !! html
2537 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2538
2539 !! end
2540
2541 !! test
2542 <pre> with width attribute (T5202)
2543 !! wikitext
2544 <pre width="8">Narrow screen goodies</pre>
2545 !! html
2546 <pre width="8">Narrow screen goodies</pre>
2547
2548 !! end
2549
2550 !! test
2551 <pre> with forbidden attribute (T5202)
2552 !! wikitext
2553 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2554 !! html
2555 <pre width="8">Narrow screen goodies</pre>
2556
2557 !! end
2558
2559 !! test
2560 Entities inside <pre>
2561 !! wikitext
2562 <pre>&lt;</pre>
2563 !! html
2564 <pre>&lt;</pre>
2565
2566 !! end
2567
2568 !! test
2569 <pre> with forbidden attribute values (T5202)
2570 !! wikitext
2571 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2572 !! html
2573 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2574
2575 !! end
2576
2577 !! test
2578 <nowiki> inside <pre> (T15238)
2579 !! wikitext
2580 <pre>
2581 <nowiki>
2582 </pre>
2583 <pre>
2584 <nowiki></nowiki>
2585 </pre>
2586 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2587 !! html
2588 <pre>
2589 &lt;nowiki&gt;
2590 </pre>
2591 <pre>
2592
2593 </pre>
2594 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2595
2596 !! end
2597
2598 !! test
2599 <nowiki> inside of #tag:pre
2600 !! wikitext
2601 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2602 !! html/php
2603 <pre>Foo &#8594;bar</pre>
2604
2605 !! html/parsoid
2606 <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>
2607 !! end
2608
2609 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2610 ## aren't enclosed in nowikis.
2611 !! test
2612 <nowiki> and <pre> preference (first one wins)
2613 !! options
2614 parsoid=wt2html
2615 !! wikitext
2616 <pre>
2617 <nowiki>
2618 </pre>
2619 </nowiki>
2620 </pre>
2621
2622 <nowiki>
2623 <pre>
2624 <nowiki>
2625 </pre>
2626 </nowiki>
2627 </pre>
2628
2629 !! html/php
2630 <pre>
2631 &lt;nowiki&gt;
2632 </pre>
2633 <p>&lt;/nowiki&gt;
2634 &lt;/pre&gt;
2635 </p><p>
2636 &lt;pre&gt;
2637 &lt;nowiki&gt;
2638 &lt;/pre&gt;
2639
2640 &lt;/pre&gt;
2641 </p>
2642 !! html/parsoid
2643 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2644 </pre>
2645 <p>&lt;/nowiki></p>
2646
2647
2648 <p><span typeof="mw:Nowiki">
2649 &lt;pre>
2650 &lt;nowiki>
2651 &lt;/pre>
2652 </span></p>
2653 !! end
2654
2655 !! test
2656 </pre> inside nowiki
2657 !! wikitext
2658 <nowiki></pre></nowiki>
2659 !! html
2660 <p>&lt;/pre&gt;
2661 </p>
2662 !! end
2663
2664 !! test
2665 Empty pre; pre inside other HTML tags (T56946)
2666 !! wikitext
2667 a
2668
2669 <div><pre>
2670 foo
2671 </pre></div>
2672 <pre></pre>
2673 !! html/php+tidy
2674 <p>a
2675 </p>
2676 <div><pre>foo
2677 </pre></div>
2678 <pre></pre>
2679 !! html/parsoid
2680 <p>a</p>
2681
2682 <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
2683 </pre></div>
2684 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2685 !! end
2686
2687 !! test
2688 HTML pre followed by indent-pre
2689 !! wikitext
2690 <pre>foo</pre>
2691 bar
2692 !! html
2693 <pre>foo</pre>
2694 <pre>bar
2695 </pre>
2696 !! end
2697
2698 !! test
2699 Block tag pre
2700 !! wikitext
2701 <p><pre>foo</pre></p>
2702 !! html/php+tidy
2703 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2704 !! html/parsoid
2705 <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>
2706 !! end
2707
2708 !!test
2709 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2710 !! wikitext
2711 {{echo|}}
2712 !! html
2713
2714 !!end
2715
2716 !!test
2717 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2718 !! wikitext
2719 {{echo|
2720 foo}}
2721 !! html
2722 <p>foo
2723 </p>
2724 !!end
2725
2726 !! test
2727 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2728 !! wikitext
2729 {{echo|a
2730 b}}
2731 !! html
2732 <pre>a
2733 </pre>
2734 <p>b
2735 </p>
2736 !!end
2737
2738 !! test
2739 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2740 !! wikitext
2741 {{echo|a
2742 b
2743 c
2744 d
2745 e
2746 }}
2747 !! html
2748 <pre>a
2749 </pre>
2750 <p>b
2751 c
2752 </p>
2753 <pre>d
2754 </pre>
2755 <p>e
2756 </p>
2757 !!end
2758
2759 !!test
2760 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2761 !! wikitext
2762 {{echo| foo}}
2763
2764 {{echo| foo}}{{echo| bar}}
2765
2766 {{echo| foo}}
2767 {{echo| bar}}
2768
2769 {{echo|<!--cmt--> foo}}
2770
2771 <!--cmt-->{{echo| foo}}
2772
2773 {{echo|{{echo| }}bar}}
2774 !! html
2775 <pre>foo
2776 </pre>
2777 <pre>foo bar
2778 </pre>
2779 <pre>foo
2780 bar
2781 </pre>
2782 <pre>foo
2783 </pre>
2784 <pre>foo
2785 </pre>
2786 <pre>bar
2787 </pre>
2788 !!end
2789
2790 !! test
2791 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2792 !! wikitext
2793 {{echo| }}a
2794
2795 {{echo|
2796 }}a
2797
2798 {{echo|
2799 b}}
2800
2801 {{echo|a
2802 }}b
2803
2804 {{echo|a
2805 }} b
2806 !! html
2807 <pre>a
2808 </pre>
2809 <p><br />
2810 </p>
2811 <pre>a
2812 </pre>
2813 <p><br />
2814 </p>
2815 <pre>b
2816 </pre>
2817 <p>a
2818 </p>
2819 <pre>b
2820 </pre>
2821 <p>a
2822 </p>
2823 <pre>b
2824 </pre>
2825 !!end
2826
2827 ## Hmm, should Parsoid rt this?
2828 !! test
2829 Pres with newline attributes
2830 !! options
2831 parsoid=wt2html,html2html
2832 !! wikitext
2833 <pre class="one
2834 two">hi</pre>
2835 !! html/php
2836 <pre class="one two">hi</pre>
2837
2838 !! html/parsoid
2839 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2840 !! end
2841
2842 !! test
2843 Things that look like <pre> tags aren't treated as such
2844 !! wikitext
2845 Barack Obama <President> of the United States
2846 <President></President>
2847 !! html
2848 <p>Barack Obama &lt;President&gt; of the United States
2849 &lt;President&gt;&lt;/President&gt;
2850 </p>
2851 !! end
2852
2853 ## Remex doesn't account for fostered content.
2854 !! test
2855 Handle broken pre-like tags (T66025)
2856 !! options
2857 parsoid=wt2html
2858 !! wikitext
2859 {{echo|<pre <pre>x</pre>}}
2860
2861 <table><pre </table>
2862 !! html/php
2863 <pre>x</pre>
2864 <table>&lt;pre </table>
2865
2866 !! html/php+tidy
2867 <pre>x</pre>
2868 &lt;pre <table></table>
2869 !! html/parsoid
2870 <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>
2871
2872 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>&lt;pre </p><table data-parsoid='{"stx":"html"}'></table>
2873 !! end
2874
2875 !! test
2876 Parsoid: handle pre with space after attribute
2877 !! options
2878 parsoid=wt2html
2879 !! wikitext
2880 <pre style="width:50%;" >{{echo|foo}}</pre>
2881 !! html/php
2882 <pre style="width:50%;">{{echo|foo}}</pre>
2883
2884 !! html/parsoid
2885 <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>
2886 !! end
2887
2888 # TODO / maybe: fix wt2wt for this
2889 !! test
2890 Parsoid: Don't paragraph-wrap fosterable content
2891 !! options
2892 parsoid=wt2html
2893 !! wikitext
2894 {|
2895 <td></td>
2896 <td></td>
2897
2898
2899
2900 |}
2901 !! html
2902 <table>
2903
2904 <tbody>
2905 <tr>
2906 <td></td>
2907
2908 <td></td></tr>
2909
2910
2911
2912 </tbody></table>
2913 !! end
2914
2915 !! test
2916 Self-closed pre
2917 !! wikitext
2918 <pre />
2919 !! html/php
2920 <pre></pre>
2921
2922 !! html/parsoid
2923 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":null}'></pre>
2924 !! end
2925
2926 !! test
2927 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2928 !! options
2929 parsoid=wt2html
2930 !! wikitext
2931 {|
2932 <td>
2933 <td>
2934 </td>
2935
2936
2937
2938 |}
2939 !! html
2940 <table>
2941
2942 <tbody>
2943 <tr>
2944 <td></td>
2945
2946 <td>
2947 </td></tr>
2948
2949
2950
2951 </tbody></table>
2952 !! end
2953
2954
2955 #--------------------------------------------------------------------
2956 # Transclusion parameter whitespace stripping tests
2957 # Behavior is different for positional and named parameters
2958 #--------------------------------------------------------------------
2959 !! test
2960 Templates: Strip leading and trailing whitespace from named-param values
2961 !! wikitext
2962 {{echo|1= a }}
2963
2964 {{echo|1= {{echo|b}} }}
2965
2966 {{echo| 1 =
2967 c }}
2968
2969 {{echo| 1 =
2970 * d
2971 }}
2972 !! html
2973 <p>a
2974 </p><p>b
2975 </p><p>c
2976 </p>
2977 <ul><li>d</li></ul>
2978
2979 !! end
2980
2981 !! test
2982 Templates: Don't strip whitespace from positional-param values
2983 !! wikitext
2984 {{echo|a }}
2985
2986 {{echo|{{echo|b}} }}
2987
2988 {{echo| c
2989 }}
2990
2991 {{echo| {{echo|d}}
2992 }}
2993
2994 {{echo|
2995 e}}
2996
2997 {{echo|
2998 *f}}
2999
3000 {{echo|
3001 }}g
3002 !! html
3003 <p>a
3004 </p><p>b
3005 </p>
3006 <pre>c
3007 </pre>
3008 <p><br />
3009 </p>
3010 <pre>d
3011 </pre>
3012 <p><br />
3013 </p>
3014 <pre>e
3015 </pre>
3016 <p><br />
3017 </p>
3018 <ul><li>f</li></ul>
3019 <p><br />
3020 </p>
3021 <pre>g
3022 </pre>
3023 !! end
3024
3025 !! test
3026 Templates: Don't recognize targets split by newlines
3027 !! options
3028 parsoid=wt2html
3029 !! wikitext
3030 {{ech
3031 o|foo}}
3032 !! html/php
3033 <p>{{ech
3034 o|foo}}
3035 </p>
3036 !! html/parsoid
3037 <p>{{ech
3038 o|foo}}</p>
3039 !! end
3040
3041 !! test
3042 Templates: Recognize targets when newlines and comments don't split the target
3043 !! options
3044 parsoid=wt2html
3045 !! wikitext
3046 {{
3047 <!--X--> ech<!--X-->o<!--X-->
3048 <!--X--> <!--X-->
3049
3050 |foo}}
3051 !! html/php
3052 <p>foo
3053 </p>
3054 !! html/parsoid
3055 <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>
3056 !! end
3057
3058 !! test
3059 Templates: Handle empty comment-and-ws-only lines correctly
3060 !! wikitext
3061 {{echo|foo
3062 <!--should be ignored-->
3063 <!--should be ignored as well-->
3064 bar}}
3065 !! html/php
3066 <p>foo
3067 bar
3068 </p>
3069 !! html/parsoid
3070 <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>
3071 !! end
3072
3073 !! test
3074 Templates: Handle comments in the target
3075 !! wikitext
3076 {{echo
3077 <!-- should be ignored -->
3078 |foo}}
3079
3080 {{echo
3081 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
3082 |foo}}
3083
3084 {{echo<!-- should be ignored -->
3085 |foo}}
3086
3087 {{echo<!-- should be ignored -->|foo}}
3088
3089 {{<!-- should be ignored -->echo|foo}}
3090 !! html/php
3091 <p>foo
3092 </p><p>foo
3093 </p><p>foo
3094 </p><p>foo
3095 </p><p>foo
3096 </p>
3097 !! html/parsoid
3098 <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>
3099
3100 <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>
3101
3102 <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>
3103
3104 <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>
3105
3106 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3107 !! end
3108
3109 !! test
3110 Templates: Handle comments in parameter names (T69657)
3111 !! wikitext
3112 {{echo|1
3113 <!-- should be ignored -->
3114 =foo}}
3115
3116 {{echo|
3117 <!-- should be ignored -->
3118 1 = foo}}
3119
3120 {{echo|1<!-- should be ignored -->=foo}}
3121
3122 {{echo|<!-- should be ignored -->1=foo}}
3123 !! html/php
3124 <p>foo
3125 </p><p>foo
3126 </p><p>foo
3127 </p><p>foo
3128 </p>
3129 !! html/parsoid
3130 <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>
3131
3132 <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>
3133
3134 <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>
3135
3136 <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>
3137 !! end
3138
3139 !! test
3140 Templates: Other wikitext in parameter names (T69657)
3141 !! wikitext
3142 {{echo|''1''=foo}}
3143 !! html/php
3144 <p>{{{1}}}
3145 </p>
3146 !! html/parsoid
3147 <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>
3148 !! end
3149
3150 !! test
3151 Templates: With colons
3152 !! wikitext
3153 {{With: Colon}}
3154 !! html/php
3155 <p>Template with colon
3156 </p>
3157 !! html/parsoid
3158 <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>
3159 !! end
3160
3161 #--------------------------------------------------------------------
3162 # Transclusion parameter escaping tests
3163 #--------------------------------------------------------------------
3164
3165 !! test
3166 Templates: Parsoid parameter escaping test 1
3167 !! wikitext
3168 {{echo|[foo]|{{echo|[bar]}}}}
3169 !! html/php+tidy
3170 <p>[foo]
3171 </p>
3172 !! html/parsoid
3173 <p about="#mwt1" typeof="mw:Transclusion"
3174 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
3175 !! end
3176
3177 !! test
3178 Parsoid: Pipes in external links in template parameter
3179 !! wikitext
3180 {{echo|[{{echo|http://example.com}} link]}}
3181 !! html/php+tidy
3182 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
3183 </p>
3184 !! html/parsoid
3185 <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>
3186 !! end
3187
3188 !! test
3189 Parsoid: pipe in transclusion parameter
3190 !! wikitext
3191 {{echo|http://foo.com/a&#124;b}}
3192 !! html/php+tidy
3193 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
3194 </p>
3195 !! html/parsoid
3196 <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>
3197 !! end
3198
3199 !! test
3200 Parsoid: Pipe in external link target and content in template parameter
3201 !! options
3202 parsoid=html2wt,wt2wt
3203 !! wikitext
3204 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
3205 !! html/php+tidy
3206 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
3207 </p>
3208 !! html/parsoid
3209 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
3210 typeof="mw:Transclusion"
3211 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
3212 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
3213 !! end
3214
3215 !! test
3216 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
3217 !! options
3218 parsoid
3219 !! wikitext
3220 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
3221 !! html
3222 <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>
3223 !! end
3224
3225 !! test
3226 Templates: Don't escape already nowiki-escaped text in template parameters
3227 !! options
3228 parsoid=html2wt,wt2wt
3229 !! wikitext
3230 {{echo|foo<nowiki>|</nowiki>bar}}
3231 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3232 {{echo|<nowiki></nowiki>}}
3233 !! html/php+tidy
3234 <p>foo|bar
3235 &lt;div&gt;
3236
3237 </p>
3238 !! html/parsoid
3239 <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>
3240 <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>
3241 <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>
3242 </p>
3243 !! end
3244
3245 ## T54824
3246 !! test
3247 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3248 !! options
3249 parsoid=html2wt,wt2wt
3250 !! wikitext
3251 {{echo|{{echo|1=bar}}}}
3252 !! html/php+tidy
3253 <p>bar
3254 </p>
3255 !! html/parsoid
3256 <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>
3257 !! end
3258
3259 ## T58733
3260 !! test
3261 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3262 !! wikitext
3263 {{echo|a : b}}
3264 !! html/php+tidy
3265 <p>a&#160;: b
3266 </p>
3267 !! html/parsoid
3268 <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>
3269 !! end
3270
3271 ## T73412
3272 !! test
3273 Templates: Preserve blank parameter names
3274 !! wikitext
3275 {{echo|=foo}}
3276 !! html/php+tidy
3277 <p>{{{1}}}
3278 </p>
3279 !! html/parsoid
3280 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3281 !! end
3282
3283 !! test
3284 Templates: Preserve blank parameter names in other positions
3285 !! wikitext
3286 {{blank_param|bar|=foo}}
3287 !! html/php+tidy
3288 <p>bar
3289 foo
3290 </p>
3291 !! html/parsoid
3292 <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
3293 foo</p>
3294 !! end
3295
3296 ###
3297 ### Parsoid-centric tests for testing RT edge cases for pre
3298 ###
3299
3300 !!test
3301 1a. Indent-Pre and Comments
3302 !! wikitext
3303 a
3304 <!--a-->
3305 c
3306 !! html
3307 <pre>a
3308 </pre>
3309 <p>c
3310 </p>
3311 !!end
3312
3313 !!test
3314 1b. Indent-Pre and Comments
3315 !! wikitext
3316 a
3317 <!--a-->
3318 c
3319 !! html
3320 <pre>a
3321 </pre>
3322 <p>c
3323 </p>
3324 !!end
3325
3326 !!test
3327 1c. Indent-Pre and Comments
3328 !! wikitext
3329 <!--a--> a
3330
3331 <!--a--> a
3332 !! html
3333 <pre> a
3334 </pre>
3335 <pre> a
3336 </pre>
3337 !!end
3338
3339 !!test
3340 1d. Indent-Pre and Comments
3341 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3342 !! wikitext
3343 <!--a--> a
3344
3345 <!--b-->b
3346 !! html
3347 <pre>a
3348 </pre>
3349 <pre>b
3350 </pre>
3351 !!end
3352
3353 !!test
3354 2a. Indent-Pre and tables
3355 !! wikitext
3356 {|
3357 |-
3358 !h1!!h2
3359 |foo||bar
3360 |}
3361 !! html
3362 <table>
3363
3364 <tr>
3365 <th>h1</th>
3366 <th>h2
3367 </th>
3368 <td>foo</td>
3369 <td>bar
3370 </td></tr></table>
3371
3372 !!end
3373
3374 !!test
3375 2b. Indent-Pre and tables
3376 !! wikitext
3377 {|
3378 |-
3379 |foo
3380 |}
3381 !! html
3382 <table>
3383
3384 <tr>
3385 <td>foo
3386 </td></tr></table>
3387
3388 !!end
3389
3390 !!test
3391 2c. Indent-Pre and tables (T44252)
3392 !! wikitext
3393 {|
3394 |+foo
3395 ! |bar
3396 |}
3397 !! html
3398 <table>
3399 <caption>foo
3400 </caption>
3401 <tr>
3402 <th>bar
3403 </th></tr></table>
3404
3405 !!end
3406
3407 !!test
3408 2d. Indent-Pre and tables
3409 !! wikitext
3410 a
3411 {|
3412 |b
3413 |}
3414 !! html/php
3415 <pre>a
3416 </pre>
3417 <table>
3418 <tr>
3419 <td>b
3420 </td></tr></table>
3421
3422 !! html/parsoid
3423 <pre>a</pre>
3424 <table>
3425 <tbody><tr><td> b</td></tr>
3426 </tbody></table>
3427 !!end
3428
3429 !!test
3430 2e. Indent-Pre and table-line syntax
3431 !! wikitext
3432 a
3433 | b
3434 | c
3435 !! html/php
3436 <pre>a
3437 | b
3438 | c
3439 </pre>
3440 !!end
3441
3442 !!test
3443 2f. Indent-pre started by table-line syntax
3444 !! wikitext
3445 a
3446 | b
3447 | c
3448 !! html/php
3449 <p>a
3450 </p>
3451 <pre>| b
3452 | c
3453 </pre>
3454 !! html/parsoid
3455 <p>a</p>
3456 <pre>
3457 | b
3458 | c</pre>
3459 !!end
3460
3461 !! test
3462 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3463 !! wikitext
3464 <table>
3465 <tr>
3466 <td>
3467 Text that should be rendered preformatted
3468 </td>
3469 </tr>
3470 </table>
3471 !! html
3472 <table>
3473 <tr>
3474 <td>
3475 <pre>Text that should be rendered preformatted
3476 </pre>
3477 </td>
3478 </tr>
3479 </table>
3480
3481 !! end
3482
3483 !! test
3484 2h. Indent pre in tables
3485 !! options
3486 parsoid=wt2html,html2html
3487 !! wikitext
3488 {|
3489 !
3490 foo
3491 !
3492 bar
3493 |-
3494 |
3495 baz
3496 {{!}}
3497 bam
3498 |}
3499 !! html/php
3500 <table>
3501 <tr>
3502 <th>
3503 <pre>foo
3504 </pre>
3505 </th>
3506 <th>
3507 <pre>bar
3508 </pre>
3509 </th></tr>
3510 <tr>
3511 <td>
3512 <pre>baz
3513 </pre>
3514 </td>
3515 <td>
3516 <pre>bam
3517 </pre>
3518 </td></tr></table>
3519
3520 !! html/parsoid
3521 <table>
3522 <tbody><tr><th>
3523 <pre>foo</pre>
3524 </th><th>
3525 <pre>bar</pre>
3526 </th></tr><tr>
3527 <td>
3528 <pre>baz</pre>
3529 </td><td data-parsoid='{"startTagSrc":"{{!}}"}'>
3530 <pre>bam</pre>
3531 </td></tr></tbody></table>
3532 !! end
3533
3534 !! test
3535 3a. Indent-Pre and block tags (single-line html)
3536 !! options
3537 parsoid=wt2html,html2html
3538 !! wikitext
3539 a <p> foo </p>
3540 b <div> foo </div>
3541 c <blockquote> foo </blockquote>
3542 <span> foo </span>
3543 !! html
3544 a <p> foo </p>
3545 b <div> foo </div>
3546 c <blockquote> foo </blockquote>
3547 <pre><span> foo </span>
3548 </pre>
3549 !! html/php+tidy
3550 <p> a </p><p> foo </p><p>
3551 b </p><div> foo </div><p>
3552 c </p><blockquote><p> foo </p></blockquote>
3553 <pre><span> foo </span>
3554 </pre>
3555 !! html/parsoid
3556 <p> a </p><p data-parsoid='{"stx":"html"}'> foo </p><p>
3557 b </p><div data-parsoid='{"stx":"html"}'> foo </div><p>
3558 c </p><blockquote data-parsoid='{"stx":"html"}'><p> foo </p></blockquote>
3559 <pre><span data-parsoid='{"stx":"html"}'> foo </span></pre>
3560 !! end
3561
3562 !! test
3563 3b. Indent-Pre and block tags (multi-line html)
3564 !! wikitext
3565 a <span>foo</span>
3566 <!-- comment --> b <div> foo </div>
3567 !! html/php
3568 <pre>a <span>foo</span>
3569 </pre>
3570 b <div> foo </div>
3571
3572 !! html/parsoid
3573 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3574 <!-- comment --> <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3575 !! html/php+tidy
3576 <pre>a <span>foo</span>
3577 </pre><p>
3578 b </p><div> foo </div>
3579 !! end
3580
3581 !!test
3582 3c. Indent-Pre and block tags (pre-content on separate line)
3583 !! wikitext
3584 <p>
3585 foo
3586 </p>
3587
3588 <div>
3589 foo
3590 </div>
3591
3592 <center>
3593 foo
3594 </center>
3595
3596 <blockquote>
3597 foo
3598 </blockquote>
3599
3600 <blockquote>
3601 <pre>
3602 foo
3603 </pre>
3604 </blockquote>
3605
3606 <table><tr><td>
3607 foo
3608 </td></tr></table>
3609
3610 <ul><li>
3611 foo
3612 </li></ul>
3613
3614 !! html
3615 <p>
3616 foo
3617 </p>
3618 <div>
3619 <pre>foo
3620 </pre>
3621 </div>
3622 <center>
3623 <pre>foo
3624 </pre>
3625 </center>
3626 <blockquote>
3627 <p> foo
3628 </p>
3629 </blockquote>
3630 <blockquote>
3631 <pre>
3632 foo
3633 </pre>
3634 </blockquote>
3635 <table><tr><td>
3636 <pre>foo
3637 </pre>
3638 </td></tr></table>
3639 <ul><li>
3640 foo
3641 </li></ul>
3642
3643 !!end
3644
3645 !! test
3646 4. Indent-Pre and extension tags
3647 !! options
3648 parsoid=wt2html,html2html
3649 !! wikitext
3650 a <tag />
3651 !! html/php+tidy
3652 <p> a </p><pre>NULL
3653 array (
3654 )
3655 </pre>
3656 !! html/parsoid
3657 <p> a </p><pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3658 !! end
3659
3660 !! test
3661 5. Indent-Pre and html pre
3662 !! wikitext
3663 <pre class="123">hi</pre>
3664 !! html/php
3665 <pre class="123">hi</pre>
3666
3667 !! html/parsoid
3668 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3669 !! end
3670
3671 !!test
3672 Render paragraphs when indent-pre is suppressed in blocklevels
3673 !! wikitext
3674 <blockquote>
3675 foo
3676
3677 bar
3678 </blockquote>
3679 !! html
3680 <blockquote>
3681 <p> foo
3682 </p><p> bar
3683 </p>
3684 </blockquote>
3685
3686 !!end
3687
3688 !!test
3689 4. Multiple spaces at start-of-line
3690 !! wikitext
3691 <p> foo </p>
3692 foo
3693 {|
3694 |foo
3695 |}
3696 !! html
3697 <p> foo </p>
3698 <pre> foo
3699 </pre>
3700 <table>
3701 <tr>
3702 <td>foo
3703 </td></tr></table>
3704
3705 !!end
3706
3707 ## NOTE: the leading white-space chars on empty line are significant
3708 !! test
3709 5a. White-space in indent-pre
3710 !! wikitext
3711 a<br />
3712
3713 b
3714 !! html
3715 <pre>a<br />
3716
3717 b
3718 </pre>
3719 !! end
3720
3721 ## NOTE: the leading white-space chars on empty line are significant
3722 !! test
3723 5b. White-space in indent-pre
3724 !! wikitext
3725 a
3726
3727 b
3728
3729
3730 c
3731 !! html
3732 <pre>a
3733
3734 b
3735
3736
3737 c
3738 </pre>
3739 !! end
3740
3741 !! test
3742 5c. White-space in indent-pre
3743 !! wikitext
3744 ''a''
3745 ''b''
3746 ''c''
3747 !! html
3748 <pre><i>a</i>
3749 <i>b</i>
3750 <i>c</i>
3751 </pre>
3752 !! end
3753
3754 !! test
3755 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3756 !! wikitext
3757 a
3758
3759 <!-- continue -->
3760 b
3761
3762 c
3763
3764 d
3765 !! html
3766 <pre>a
3767
3768 b
3769 </pre>
3770 <pre>c
3771
3772 </pre>
3773 <p>d
3774 </p>
3775 !! end
3776
3777 !! test
3778 7a. Indent-pre and category links
3779 !! options
3780 parsoid=wt2html,wt2wt
3781 !! wikitext
3782 [[Category:foo]] <!-- No pre-wrapping -->
3783 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3784 !! html/php+tidy
3785 !! html/parsoid
3786 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3787 <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 -->
3788 !! end
3789
3790 ## We used to, but no longer wt2wt this test since the default serializer
3791 ## will normalize all categories to serialize on their own line.
3792 ## This wikitext usage is going to be fairly uncommon in production and
3793 ## selser will take care of preserving formatting in those scenarios.
3794 !! test
3795 7b. Indent-pre and category links
3796 !! options
3797 parsoid=wt2html
3798 !! wikitext
3799 [[Category:foo]] a
3800 [[Category:foo]] {{echo|b}}
3801 !! html/parsoid
3802 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3803 <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>
3804 !! end
3805
3806 !! test
3807 Indent-Pre: Newlines in comments shouldn't affect sol state
3808 !! wikitext
3809 a <!--
3810 foo
3811 --> b
3812 !! html/php+tidy
3813 <p>a b
3814 </p>
3815 !! html/parsoid
3816 <p>a <!--
3817 foo
3818 --> b</p>
3819 !! end
3820
3821 ###
3822 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3823 ###
3824
3825 !!test
3826 HTML-pre: 1. embedded newlines
3827 !! wikitext
3828 <pre>foo</pre>
3829
3830 <pre>
3831 foo
3832 </pre>
3833
3834 <pre>
3835
3836 foo
3837 </pre>
3838
3839 <pre>
3840
3841
3842 foo
3843 </pre>
3844 !! html/php+tidy
3845 <pre>foo</pre>
3846 <pre>foo
3847 </pre>
3848 <pre>
3849
3850 foo
3851 </pre>
3852 <pre>
3853
3854
3855 foo
3856 </pre>
3857 !! html/parsoid
3858 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3859
3860 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3861 </pre>
3862
3863 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3864
3865 foo
3866 </pre>
3867
3868 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3869
3870
3871 foo
3872 </pre>
3873 !!end
3874
3875 !! test
3876 HTML-pre: big spaces
3877 !! wikitext
3878 <pre>
3879
3880
3881
3882
3883 haha
3884
3885
3886
3887
3888 haha
3889
3890
3891
3892
3893 </pre>
3894 !! html/php+tidy
3895 <pre>
3896
3897
3898
3899
3900 haha
3901
3902
3903
3904
3905 haha
3906
3907
3908
3909
3910 </pre>
3911 !! html/parsoid
3912 <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"}}'>
3913
3914
3915
3916
3917 haha
3918
3919
3920
3921
3922 haha
3923
3924
3925
3926
3927 </pre>
3928 !! end
3929
3930 !!test
3931 HTML-pre: 2: indented text
3932 !! wikitext
3933 <pre>
3934 foo
3935 </pre>
3936 !! html
3937 <pre>
3938 foo
3939 </pre>
3940
3941 !!end
3942
3943 !!test
3944 HTML-pre: 3: other wikitext
3945 !! wikitext
3946 <pre>
3947 * foo
3948 # bar
3949 = no-h =
3950 '' no-italic ''
3951 [[ NoLink ]]
3952 </pre>
3953 !! html/php
3954 <pre>
3955 * foo
3956 # bar
3957 = no-h =
3958 '' no-italic ''
3959 [[ NoLink ]]
3960 </pre>
3961
3962 !! html/parsoid
3963 <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
3964 # bar
3965 = no-h =
3966 '' no-italic ''
3967 [[ NoLink ]]
3968 </pre>
3969 !!end
3970
3971 ###
3972 ### Definition lists
3973 ###
3974 !! test
3975 Simple definition
3976 !! wikitext
3977 ;name :Definition
3978 !! html
3979 <dl><dt>name</dt>
3980 <dd>Definition</dd></dl>
3981
3982 !! end
3983
3984 !! test
3985 Definition list for indentation only
3986 !! wikitext
3987 :Indented text
3988 !! html
3989 <dl><dd>Indented text</dd></dl>
3990
3991 !! end
3992
3993 !! test
3994 Definition list with no space
3995 !! wikitext
3996 ;name:Definition
3997 !! html
3998 <dl><dt>name</dt>
3999 <dd>Definition</dd></dl>
4000
4001 !!end
4002
4003 !! test
4004 Definition list with URL link
4005 !! wikitext
4006 ;http://example.com/ :definition
4007 !! html
4008 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a></dt>
4009 <dd>definition</dd></dl>
4010
4011 !! end
4012
4013 !! test
4014 Definition list with bracketed URL link
4015 !! wikitext
4016 ;[http://www.example.com/ Example]:Something about it
4017 !! html
4018 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
4019 <dd>Something about it</dd></dl>
4020
4021 !! end
4022
4023 !! test
4024 Definition list with wikilink containing colon
4025 !! wikitext
4026 ;[[Help:FAQ]]:The least-read page on Wikipedia
4027 !! html
4028 <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>
4029 <dd>The least-read page on Wikipedia</dd></dl>
4030
4031 !! end
4032
4033 # At Brion's and JeLuF's insistence... :)
4034 !! test
4035 Definition list with news link containing colon
4036 !! wikitext
4037 ;news:alt.wikipedia.rox :This isn't even a real newsgroup!
4038 !! html/php
4039 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
4040 <dd>This isn't even a real newsgroup!</dd></dl>
4041
4042 !! html/parsoid
4043 <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>
4044 !! end
4045
4046 !! test
4047 Malformed definition list with colon
4048 !! wikitext
4049 ;news:alt.wikipedia.rox -- don't crash or enter an infinite loop
4050 !! html
4051 <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>
4052
4053 !! end
4054
4055 !! test
4056 Definition lists: colon in external link text
4057 !! wikitext
4058 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
4059 !! html
4060 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia :The Next Generation</a></dt>
4061 <dd>OK, I made that up</dd></dl>
4062
4063 !! end
4064
4065 !! test
4066 Definition lists: colon in HTML attribute
4067 !! wikitext
4068 ;<b style="display: inline">bold</b>
4069 !! html
4070 <dl><dt><b style="display: inline">bold</b></dt></dl>
4071
4072 !! end
4073
4074 !! test
4075 Definition lists: self-closed tag
4076 !! wikitext
4077 ;one<br/>two :two-line fun
4078 !! html
4079 <dl><dt>one<br />two</dt>
4080 <dd>two-line fun</dd></dl>
4081
4082 !! end
4083
4084 !! test
4085 Definition lists: ignore colons inside tags
4086 !! wikitext
4087 ;one <b>two : tag <i>fun:</i>:</b>:def
4088 !! html
4089 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
4090 <dd>def</dd></dl>
4091
4092 !! end
4093
4094 !! test
4095 Definition lists: excess closed tags
4096 !! wikitext
4097 ;one</b>two :bad tag fun
4098 !! html/php+tidy
4099 <dl><dt>onetwo</dt>
4100 <dd>bad tag fun</dd></dl>
4101 !! html/parsoid
4102 <dl>
4103 <dt>onetwo</dt>
4104 <dd>bad tag fun</dd>
4105 </dl>
4106 !! end
4107
4108 !! test
4109 T13748: Literal closing tags
4110 !! wikitext
4111 <dl>
4112 <dt>test 1</dt>
4113 <dd>test test test test test</dd>
4114 <dt>test 2</dt>
4115 <dd>test test test test test</dd>
4116 </dl>
4117 !! html
4118 <dl>
4119 <dt>test 1</dt>
4120 <dd>test test test test test</dd>
4121 <dt>test 2</dt>
4122 <dd>test test test test test</dd>
4123 </dl>
4124
4125 !! end
4126
4127 !! test
4128 Definition and unordered list using wiki syntax nested in unordered list using html tags.
4129 !! wikitext
4130 <ul><li>
4131 ;term :description
4132 *unordered
4133 </li></ul>
4134 !! html
4135 <ul><li>
4136 <dl><dt>term</dt>
4137 <dd>description</dd></dl>
4138 <ul><li>unordered</li></ul>
4139 </li></ul>
4140
4141 !! end
4142
4143 !! test
4144 Definition list with empty definition and following paragraph
4145 !! wikitext
4146 ;term:
4147
4148 Paragraph text
4149 !! html
4150 <dl><dt>term</dt>
4151 <dd></dd></dl>
4152 <p>Paragraph text
4153 </p>
4154 !! end
4155
4156 !! test
4157 Nested definition lists using html syntax
4158 !! wikitext
4159 <dl><dt>x</dt>
4160 <dd>a</dd>
4161 <dd>b</dd></dl>
4162 !! html
4163 <dl><dt>x</dt>
4164 <dd>a</dd>
4165 <dd>b</dd></dl>
4166
4167 !! end
4168
4169 !! test
4170 Definition Lists: No nesting: Multiple dd's
4171 !! wikitext
4172 ;x
4173 :a
4174 :b
4175 !! html
4176 <dl><dt>x</dt>
4177 <dd>a</dd>
4178 <dd>b</dd></dl>
4179
4180 !! end
4181
4182 !! test
4183 Definition Lists: Indentation: Regular
4184 !! wikitext
4185 :i1
4186 ::i2
4187 :::i3
4188 !! html
4189 <dl><dd>i1
4190 <dl><dd>i2
4191 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4192
4193 !! end
4194
4195 !! test
4196 Definition Lists: Indentation: Missing 1st level
4197 !! wikitext
4198 ::i2
4199 :::i3
4200 !! html
4201 <dl><dd><dl><dd>i2
4202 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4203
4204 !! end
4205
4206 !! test
4207 Definition Lists: Indentation: Multi-level indent
4208 !! wikitext
4209 :::i3
4210 !! html
4211 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
4212
4213 !! end
4214
4215 !! test
4216 Definition Lists: Hacky use to indent tables
4217 !! wikitext
4218 ::{|
4219 |foo
4220 |bar
4221 |}
4222 this text
4223 should be left alone
4224 !! html
4225 <dl><dd><dl><dd><table>
4226 <tr>
4227 <td>foo
4228 </td>
4229 <td>bar
4230 </td></tr></table></dd></dl></dd></dl>
4231 <p>this text
4232 should be left alone
4233 </p>
4234 !! end
4235
4236 !! test
4237 Definition Lists: Hacky use to indent tables (with content following table)
4238 !! wikitext
4239 :{|
4240 |foo
4241 |bar
4242 |} <!--c1--> this text should be part of the dl
4243 !! html/php+tidy
4244 <dl><dd><table>
4245 <tbody><tr>
4246 <td>foo
4247 </td>
4248 <td>bar
4249 </td></tr></tbody></table> this text should be part of the dl</dd></dl>
4250 !! html/parsoid
4251 <dl><dd><table>
4252 <tbody><tr>
4253 <td>foo
4254 </td>
4255 <td>bar
4256 </td></tr></tbody></table> <!--c1--> this text should be part of the dl</dd></dl>
4257 !! end
4258
4259 !! test
4260 Definition Lists: Hacky use to indent tables, with comments (T65979)
4261 !! wikitext
4262 <!-- foo -->
4263 ::{|
4264 |foo
4265 |bar
4266 |}<!-- bar -->
4267 this text
4268 should be left alone
4269 !! html/parsoid
4270 <!-- foo -->
4271 <dl><dd><dl><dd><table><tr>
4272 <td>foo</td>
4273 <td>bar</td>
4274 </tr></table><!-- bar --></dd></dl></dd></dl>
4275 <p>this text
4276 should be left alone</p>
4277 !! end
4278
4279 !! test
4280 Definition Lists: Hacky use to indent tables, with comment before table
4281 !!options
4282 parsoid=wt2html
4283 !! wikitext
4284 ::<!-- foo -->{|
4285 |foo
4286 |}
4287 !! html/parsoid
4288 <dl><dd><dl><dd><!-- foo --><table><tr>
4289 <td>foo</td>
4290 </tr></table></dd></dl></dd></dl>
4291 !! end
4292
4293 # The trailing whitespace in this test is to catch a regression in
4294 # Parsoid after T54473.
4295 !! test
4296 Definition Lists: Hacky use to indent tables (WS-insensitive)
4297 !! wikitext
4298 :{|
4299 |a
4300 |}
4301 !! html/php
4302 <dl><dd><table>
4303 <tr>
4304 <td>a
4305 </td></tr></table></dd></dl>
4306
4307 !! html/parsoid
4308 <dl><dd><table>
4309 <tbody><tr><td>a</td></tr>
4310 </tbody></table></dd></dl>
4311 !! end
4312
4313 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4314 ## as an empty dt item. It also ignores all but the last ";" when followed
4315 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4316 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4317 ## ";"s.
4318 ##
4319 ## Ex: ";;t2 ::d2" is transformed into:
4320 ##
4321 ## <dl>
4322 ## <dt>t2 </dt>
4323 ## <dd>
4324 ## <dl>
4325 ## <dt></dt>
4326 ## <dd>d2</dd>
4327 ## </dl>
4328 ## </dd>
4329 ## </dl>
4330 ##
4331 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4332 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4333 ##
4334 ## <dl>
4335 ## <dt>
4336 ## <dl>
4337 ## <dt>t2 </dt>
4338 ## <dd>:d2</dd>
4339 ## </dl>
4340 ## </dt>
4341 ## </dl>
4342 ##
4343 ## All Parsoid only definition list tests have this difference.
4344 ##
4345 ## See also: https://phabricator.wikimedia.org/T8569
4346 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4347
4348 !! test
4349 Table / list interaction: indented table with lists in table contents
4350 !! wikitext
4351 :{|
4352 |-
4353 |a
4354
4355 *b
4356 |-
4357 |c
4358
4359 *d
4360 |}
4361 !! html
4362 <dl><dd><table>
4363
4364 <tr>
4365 <td>a
4366 <ul><li>b</li></ul>
4367 </td></tr>
4368 <tr>
4369 <td>c
4370 <ul><li>d</li></ul>
4371 </td></tr></table></dd></dl>
4372
4373 !! end
4374
4375 !!test
4376 Table / list interaction: lists nested in tables nested in indented lists
4377 !! wikitext
4378 :{|
4379 |
4380 :a
4381 :b
4382 |
4383 *c
4384 *d
4385 |}
4386
4387 *e
4388 *f
4389 !! html
4390 <dl><dd><table>
4391 <tr>
4392 <td>
4393 <dl><dd>a</dd>
4394 <dd>b</dd></dl>
4395 </td>
4396 <td>
4397 <ul><li>c</li>
4398 <li>d</li></ul>
4399 </td></tr></table></dd></dl>
4400 <ul><li>e</li>
4401 <li>f</li></ul>
4402
4403 !!end
4404
4405 !! test
4406 Definition Lists: Nesting: Multi-level (Parsoid only)
4407 !! wikitext
4408 ;t1 :d1
4409 ;;t2 ::d2
4410 ;;;t3 :::d3
4411 !! html/parsoid
4412 <dl>
4413 <dt>t1 </dt>
4414 <dd>d1</dd>
4415 <dt>
4416 <dl>
4417 <dt>t2 </dt>
4418 <dd>:d2</dd>
4419 <dt>
4420 <dl>
4421 <dt>t3 </dt>
4422 <dd>::d3</dd>
4423 </dl>
4424 </dt>
4425 </dl>
4426 </dt>
4427 </dl>
4428
4429
4430 !! end
4431
4432
4433 !! test
4434 Definition Lists: Nesting: Test 2
4435 !! wikitext
4436 ;t1
4437 ::d2
4438 !! html+tidy
4439 <dl><dt>t1</dt>
4440 <dd>
4441 <dl><dd>d2</dd></dl></dd></dl>
4442 !! end
4443
4444
4445 !! test
4446 Definition Lists: Nesting: Test 3
4447 !! wikitext
4448 :;t1
4449 ::::d2
4450 !! html+tidy
4451 <dl><dd><dl><dt>t1</dt>
4452 <dd>
4453 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4454 !! end
4455
4456
4457 !! test
4458 Definition Lists: Nesting: Test 4
4459 !! wikitext
4460 ::;t3
4461 :::d3
4462 !! html
4463 <dl><dd><dl><dd><dl><dt>t3</dt>
4464 <dd>d3</dd></dl></dd></dl></dd></dl>
4465
4466 !! end
4467
4468
4469 ## The Parsoid team believes the following three test exposes a
4470 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4471 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4472 ## It also exposes a "misfeature" in tidy, which doesn't like
4473 ## <dl> tags with a single <dt> child; it converts the <dt> into
4474 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4475 !! test
4476 Definition Lists: Mixed Lists: Test 1
4477 !! wikitext
4478 :;*foo
4479 ::*bar
4480 :;baz
4481 !! html/php
4482 <dl><dd><dl><dt><ul><li>foo</li>
4483 <li>bar</li></ul></dt></dl>
4484 <dl><dt>baz</dt></dl></dd></dl>
4485
4486 !! html/php+tidy
4487 <dl><dd><dl><dt><ul><li>foo</li>
4488 <li>bar</li></ul></dt></dl>
4489 <dl><dt>baz</dt></dl></dd></dl>
4490 !! html/parsoid
4491 <dl>
4492 <dd><dl>
4493 <dt><ul>
4494 <li>foo
4495 </li>
4496 </ul></dt>
4497 <dd><ul>
4498 <li>bar
4499 </li>
4500 </ul></dd>
4501 <dt>baz</dt>
4502 </dl></dd>
4503 </dl>
4504 !! end
4505
4506 !! test
4507 Definition Lists: Mixed Lists: Test 2
4508 !! wikitext
4509 *:d1
4510 *:d2
4511 !! html
4512 <ul><li><dl><dd>d1</dd>
4513 <dd>d2</dd></dl></li></ul>
4514
4515 !! end
4516
4517
4518 !! test
4519 Definition Lists: Mixed Lists: Test 3
4520 !! wikitext
4521 *:::d1
4522 *:::d2
4523 !! html
4524 <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
4525 <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
4526
4527 !! end
4528
4529
4530 !! test
4531 Definition Lists: Mixed Lists: Test 4
4532 !! wikitext
4533 *;d1 :d2
4534 *;d3 :d4
4535 !! html
4536 <ul><li><dl><dt>d1</dt>
4537 <dd>d2</dd>
4538 <dt>d3</dt>
4539 <dd>d4</dd></dl></li></ul>
4540
4541 !! end
4542
4543
4544 !! test
4545 Definition Lists: Mixed Lists: Test 5
4546 !! wikitext
4547 *:d1
4548 *::d2
4549 !! html
4550 <ul><li><dl><dd>d1
4551 <dl><dd>d2</dd></dl></dd></dl></li></ul>
4552
4553 !! end
4554
4555
4556 !! test
4557 Definition Lists: Mixed Lists: Test 6
4558 !! wikitext
4559 #*:d1
4560 #*:::d3
4561 !! html
4562 <ol><li><ul><li><dl><dd>d1
4563 <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4564
4565 !! end
4566
4567
4568 !! test
4569 Definition Lists: Mixed Lists: Test 7
4570 !! wikitext
4571 :*d1
4572 :*d2
4573 !! html
4574 <dl><dd><ul><li>d1</li>
4575 <li>d2</li></ul></dd></dl>
4576
4577 !! end
4578
4579
4580 !! test
4581 Definition Lists: Mixed Lists: Test 8
4582 !! wikitext
4583 :*d1
4584 ::*d2
4585 !! html
4586 <dl><dd><ul><li>d1</li></ul>
4587 <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
4588
4589 !! end
4590
4591
4592 !! test
4593 Definition Lists: Mixed Lists: Test 9
4594 !! wikitext
4595 *;foo :bar
4596 !! html
4597 <ul><li><dl><dt>foo</dt>
4598 <dd>bar</dd></dl></li></ul>
4599
4600 !! end
4601
4602
4603 !! test
4604 Definition Lists: Mixed Lists: Test 10
4605 !! wikitext
4606 *#;foo :bar
4607 !! html
4608 <ul><li><ol><li><dl><dt>foo</dt>
4609 <dd>bar</dd></dl></li></ol></li></ul>
4610
4611 !! end
4612
4613 # The Parsoid team disagrees with the PHP parser's seemingly-random
4614 # rules regarding dd/dt on the next few tests. Parsoid is more
4615 # consistent, and recognizes the shared nesting and keeps the
4616 # still-open tags around until the nesting is complete.
4617
4618 # This is a regression test for T175099
4619 !! test
4620 Definition Lists: Mixed Lists: Test 11
4621 !! wikitext
4622 ;a
4623 :*b
4624 !! html/php
4625 <dl><dt>a</dt>
4626 <dd>
4627 <ul><li>b</li></ul></dd></dl>
4628
4629 !! html/parsoid
4630 <dl><dt>a
4631 <dd><ul><li>b</li></ul></dd></dl>
4632 !! end
4633
4634 # FIXME: Maybe get rid of this test?
4635 !! test
4636 Definition Lists: Mixed Lists: Test 12
4637 !! wikitext
4638 *#*#;*;;foo :bar
4639 *#*#;boo :baz
4640 !! html/php
4641 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4642 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4643 <dl><dt>boo</dt>
4644 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4645
4646 !! html/php+tidy
4647 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4648 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4649 <dl><dt>boo</dt>
4650 <dd>baz</dd></dl></li></ol></li></ul>
4651 !! html/parsoid
4652 <ul>
4653 <li>
4654 <ol>
4655 <li>
4656 <ul>
4657 <li>
4658 <ol>
4659 <li>
4660 <dl>
4661 <dt>
4662 <ul>
4663 <li>
4664 <dl>
4665 <dt>
4666 <dl>
4667 <dt>foo</dt>
4668 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4669 </dl></dt>
4670 </dl></li>
4671 </ul></dt>
4672 <dt>boo</dt>
4673 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4674 </dl></li>
4675 </ol></li>
4676 </ul></li>
4677 </ol></li>
4678 </ul>
4679 !! end
4680
4681 !! test
4682 Definition Lists: Mixed Lists: Test 13
4683 !! wikitext
4684 *#*#;*;;foo : bar
4685 *#*#;boo : baz
4686 !! html+tidy
4687 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4688 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4689 <dl><dt>boo&#160;</dt>
4690 <dd>baz</dd></dl></li></ol></li></ul>
4691 !! end
4692
4693 # FIXME: Maybe get rid of this test?
4694 # From whitelist:
4695 # * The test is wrong, there are two colons where there should be :;
4696 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4697 !! test
4698 Definition Lists: Weird Ones: Test 1
4699 !! wikitext
4700 *#;*::;;foo :bar (who uses this?)
4701 !! html/php+tidy
4702 <ul><li><ol><li><dl><dt>foo</dt>
4703 <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>
4704 !! html/parsoid
4705 <ul>
4706 <li>
4707 <ol>
4708 <li>
4709 <dl>
4710 <dt>
4711 <ul>
4712 <li>
4713 <dl>
4714 <dd>
4715 <dl>
4716 <dd>
4717 <dl>
4718 <dt>
4719 <dl>
4720 <dt>foo</dt>
4721 <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
4722 </dl></dt>
4723 </dl></dd>
4724 </dl></dd>
4725 </dl></li>
4726 </ul></dt>
4727 </dl></li>
4728 </ol></li>
4729 </ul>
4730 !! end
4731
4732 !! test
4733 Definition Lists: colons occurring in tags
4734 !! wikitext
4735 ;a:b
4736 ;'''a:b'''
4737 ;<i>a:b</i>
4738 ;<span>a:b</span>
4739 ;<div>a:b</div>
4740 ;<div>a
4741 :b</div>
4742 ;{{echo|a:b}}
4743 ;{{echo|''a:b''}}
4744 ;;;''a:b''
4745 !! html+tidy
4746 <dl><dt>a</dt>
4747 <dd>b</dd>
4748 <dt><b>a:b</b></dt>
4749 <dt><i>a:b</i></dt>
4750 <dt><span>a:b</span></dt>
4751 <dt><div>a:b</div></dt>
4752 <dt><div>a</div></dt>
4753 <dd>b</dd>
4754 <dt>a</dt>
4755 <dd>b</dd>
4756 <dt><i>a:b</i></dt></dl>
4757 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4758 !! html/parsoid
4759 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4760 <dt><b>a:b</b></dt>
4761 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4762 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4763 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4764 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4765 <dd>b</dd>
4766 <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>
4767 <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>
4768 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4769 !! end
4770
4771 # Parsoid's output differs here again because it shares
4772 # nesting between the two lists unlike the PHP parser.
4773 # Unsure which is more desirable.
4774 !! test
4775 Definition Lists: colons and tables 1
4776 !! wikitext
4777 :{|
4778 |x
4779 |}
4780 :{|
4781 |y
4782 |}
4783 !! html/php
4784 <dl><dd><table>
4785 <tr>
4786 <td>x
4787 </td></tr></table></dd></dl>
4788 <dl><dd><table>
4789 <tr>
4790 <td>y
4791 </td></tr></table></dd></dl>
4792
4793 !! html/parsoid
4794 <dl><dd><table>
4795 <tr>
4796 <td>x
4797 </td></tr></table></dd>
4798 <dd><table>
4799 <tr>
4800 <td>y
4801 </td></tr></table></dd></dl>
4802 !! end
4803
4804 # FIXME: Does this need a html/php section?
4805 !! test
4806 Definition Lists: template interaction
4807 !! wikitext
4808 ::{{definition_list}}
4809
4810 :one
4811 ::{{definition_list}}
4812 :::two
4813 :::three
4814 ::four
4815 !! html/parsoid
4816 <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">
4817 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4818
4819 <dl><dd data-parsoid='{}'>one
4820 <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">
4821 </span><dd about="#mwt2">two
4822 <dl><dd>two</dd>
4823 <dd>three</dd></dl></dd>
4824 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4825 !! end
4826
4827
4828 ###
4829 ### External links
4830 ###
4831 !! test
4832 External links: non-bracketed
4833 !! wikitext
4834 Non-bracketed: http://example.com
4835 !! html
4836 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4837 </p>
4838 !! end
4839
4840 # parsoid doesn't explicitly mark autonumbered links, see T55505
4841 !! test
4842 External links: numbered
4843 !! wikitext
4844 Numbered: [http://example.com]
4845 Numbered: [http://example.net]
4846 Numbered: [http://example.com]
4847 !! html/php
4848 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4849 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4850 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4851 </p>
4852 !! html/parsoid
4853 <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
4854 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4855 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
4856 !!end
4857
4858 !! test
4859 External links: specified text
4860 !! wikitext
4861 Specified text: [http://example.com link]
4862 !! html
4863 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4864 </p>
4865 !!end
4866
4867 !! test
4868 External links: trail
4869 !! wikitext
4870 Linktrails should not work for external links: [http://example.com link]s
4871 !! html
4872 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4873 </p>
4874 !! end
4875
4876 !! test
4877 External links: dollar sign in URL
4878 !! wikitext
4879 http://example.com/1$2345
4880 !! html
4881 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4882 </p>
4883 !! end
4884
4885 # parsoid doesn't explicitly mark autonumbered links, see T55505
4886 !! test
4887 External links: dollar sign in URL (autonumber)
4888 !! wikitext
4889 [http://example.com/1$2345]
4890 !! html/php
4891 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4892 </p>
4893 !! html/parsoid
4894 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
4895 !!end
4896
4897 !! test
4898 External links: open square bracket forbidden in URL (T6377)
4899 !! options
4900 parsoid=wt2html,wt2wt,html2html
4901 !! wikitext
4902 http://example.com/1[2345
4903 !! html/php
4904 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4905 </p>
4906 !! html/parsoid
4907 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
4908 !! end
4909
4910 !! test
4911 External links: open square bracket forbidden in URL (named) (T6377)
4912 !! options
4913 parsoid=wt2html,html2html
4914 !! wikitext
4915 [http://example.com/1[2345]
4916 !! html/php
4917 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4918 </p>
4919 !! html/parsoid
4920 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
4921 !!end
4922
4923 # parsoid adds a space before the link name
4924 !! test
4925 External links: open square bracket forbidden in URL (named) (T6377)
4926 Parsoid variant.
4927 !! wikitext
4928 [http://example.com/1 [2345]
4929 !! html
4930 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4931 </p>
4932 !!end
4933
4934 !! test
4935 External links: nowiki in URL link text (T8230)
4936 !! wikitext
4937 [http://example.com/ <nowiki>''example site''</nowiki>]
4938 !! html
4939 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4940 </p>
4941 !! end
4942
4943 !! test
4944 External links: newline forbidden in text (T8230 regression check)
4945 !! wikitext
4946 [http://example.com/ first
4947 second]
4948 !! html
4949 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4950 second]
4951 </p>
4952 !!end
4953
4954 !! test
4955 External links: Pipe char between url and text
4956 !! wikitext
4957 [http://example.com | link]
4958 !! html
4959 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4960 </p>
4961 !!end
4962
4963 !! test
4964 External links: protocol-relative URL in brackets
4965 !! wikitext
4966 [//example.com/ Test]
4967 !! html
4968 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4969 </p>
4970 !! end
4971
4972 # parsoid doesn't explicitly mark autonumbered links, see T55505
4973 !! test
4974 External links: protocol-relative URL in brackets without text
4975 !! wikitext
4976 [//example.com]
4977 !! html/php
4978 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4979 </p>
4980 !! html/parsoid
4981 <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
4982 !! end
4983
4984 !! test
4985 External links: protocol-relative URL in free text is left alone
4986 !! wikitext
4987 //example.com/Foo
4988 !! html
4989 <p>//example.com/Foo
4990 </p>
4991 !!end
4992
4993 !! test
4994 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4995 !! wikitext
4996 foo//example.com/Foo
4997 !! html
4998 <p>foo//example.com/Foo
4999 </p>
5000 !! end
5001
5002 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
5003 !! test
5004 External links: with no contents
5005 !! options
5006 parsoid=wt2html,wt2wt
5007 !! wikitext
5008 [http://en.wikipedia.org/wiki/Foo]
5009
5010 [[wikipedia:Foo|Bar]]
5011
5012 [[wikipedia:Foo|<span>Bar</span>]]
5013 !! html/php
5014 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
5015 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
5016 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
5017 </p>
5018 !! html/parsoid
5019 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
5020 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
5021 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
5022 !! end
5023
5024 !! test
5025 External links: Free with trailing punctuation
5026 !! wikitext
5027 http://example.com,
5028 http://example.com;
5029 http://example.com\
5030 http://example.com.
5031 http://example.com:
5032 http://example.com!
5033 http://example.com?
5034 http://example.com)
5035 http://example.com/url_with_(brackets)
5036 (http://example.com/url_without_brackets)
5037 http://example.com/url_with_entity&amp;
5038 http://example.com/url_with_entity&#x26;
5039 http://example.com/url_with_entity&#038;
5040 http://example.com/url_with_entity&nbsp;
5041 http://example.com/url_with_entity&#xA0;
5042 http://example.com/url_with_entity&#160;
5043 http://example.com/url_with_entity&lt;
5044 http://example.com/url_with_entity&#x3C;
5045 http://example.com/url_with_entity&#60;
5046 !! html/php
5047 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
5048 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
5049 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
5050 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
5051 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
5052 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
5053 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
5054 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5055 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5056 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5057 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5058 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5059 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5060 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5061 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
5062 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5063 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
5064 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
5065 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
5066 </p>
5067 !! html/parsoid
5068 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
5069 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
5070 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
5071 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
5072 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
5073 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
5074 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
5075 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
5076 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5077 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5078 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5079 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5080 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5081 <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>
5082 <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>
5083 <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>
5084 <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>
5085 <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>
5086 <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>
5087 !! end
5088
5089 !! test
5090 External links: tricky Parsoid html2html case
5091 !! options
5092 parsoid=wt2html,wt2wt,html2html
5093 !! wikitext
5094 http://example.com/url_with_entity&amp;amp;
5095 !! html/php
5096 <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>;
5097 </p>
5098 !! html/parsoid
5099 <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>
5100 !! end
5101
5102 !! test
5103 External links: Free with trailing quotes (T113666)
5104 !! wikitext
5105 '''News:''' Stuff here
5106
5107 news:'a'b''c''d e
5108 !! html/php
5109 <p><b>News:</b> Stuff here
5110 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
5111 </p>
5112 !! html/parsoid
5113 <p><b>News:</b> Stuff here</p>
5114 <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
5115 !! end
5116
5117 !! test
5118 External links: with entity
5119 !! wikitext
5120 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
5121 !! html/php
5122 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
5123 </p>
5124 !! html/parsoid
5125 <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>
5126 !! end
5127
5128 !! test
5129 External links: Lone protocols are never linked (T105697)
5130 !! wikitext
5131 http://
5132 http://;
5133 (http://)
5134 bitcoin:
5135 bitcoin:;
5136 (bitcoin:)
5137 !! html
5138 <p>http://
5139 http://;
5140 (http://)
5141 bitcoin:
5142 bitcoin:;
5143 (bitcoin:)
5144 </p>
5145 !! end
5146
5147 !! test
5148 External links: No preceding word characters allowed (T67278)
5149 !! wikitext
5150 NOPEhttp://example.com
5151 N0http://example.com
5152 ok:http://example.com
5153 ok-http://example.com
5154 !! html
5155 <p>NOPEhttp://example.com
5156 N0http://example.com
5157 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5158 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5159 </p>
5160 !! end
5161
5162 !! test
5163 External links: nofollow domain exception
5164 !! wikitext
5165 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
5166 !! html
5167 <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>.
5168 </p>
5169 !!end
5170
5171 !! test
5172 External image
5173 !! wikitext
5174 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5175 !! html
5176 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5177 </p>
5178 !! end
5179
5180 !! test
5181 External image from https
5182 !! wikitext
5183 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5184 !! html
5185 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5186 </p>
5187 !! end
5188
5189 !! test
5190 External image (when not allowed)
5191 !! options
5192 wgAllowExternalImages=0
5193 !! wikitext
5194 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5195 !! html
5196 <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>
5197 </p>
5198 !! end
5199
5200 !! test
5201 Link to non-http image, no img tag
5202 !! wikitext
5203 Link to non-http image, no img tag: ftp://example.com/test.jpg
5204 !! html
5205 <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>
5206 </p>
5207 !! end
5208
5209 !! test
5210 External links: terminating separator
5211 !! wikitext
5212 Terminating separator: http://example.com/thing,
5213 !! html
5214 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
5215 </p>
5216 !! end
5217
5218 !! test
5219 External links: intervening separator
5220 !! wikitext
5221 Intervening separator: http://example.com/1,2,3
5222 !! html
5223 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
5224 </p>
5225 !! end
5226
5227 !! test
5228 External links: old bug with URL in query
5229 !! wikitext
5230 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
5231 !! html
5232 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
5233 </p>
5234 !! end
5235
5236 !! test
5237 External links: old URL-in-URL bug, mixed protocols
5238 !! wikitext
5239 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
5240 !! html
5241 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
5242 </p>
5243 !!end
5244
5245 # Since Parsoid is starting to emit canonical wikitext for links,
5246 # [http://example.com http://example.com] will not RT back to that
5247 # form anymore.
5248 !! test
5249 External links: URL in text
5250 !! options
5251 parsoid=wt2html
5252 !! wikitext
5253 URL in text: [http://example.com http://example.com]
5254 !! html/php
5255 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
5256 </p>
5257 !! html/parsoid
5258 <p>URL in text: <a rel="mw:ExtLink" class="external text" href="http://example.com">http://example.com</a></p>
5259 !! end
5260
5261 !! test
5262 External links: Clickable images
5263 !! wikitext
5264 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5265 !! html/php
5266 <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>
5267 </p>
5268 !! html/parsoid
5269 <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>
5270 !! end
5271
5272 !! test
5273 External links: raw ampersand
5274 !! wikitext
5275 Old &amp; use: http://x&y
5276 !! html
5277 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5278 </p>
5279 !! end
5280
5281 !! test
5282 External links: encoded ampersand
5283 !! wikitext
5284 Old &amp; use: http://x&amp;y
5285 !! html/php
5286 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5287 </p>
5288 !! html/parsoid
5289 <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>
5290 !! end
5291
5292 !! test
5293 External links: encoded equals (T8102)
5294 !! wikitext
5295 http://example.com/?foo&#61;bar
5296 !! html/php
5297 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5298 </p>
5299 !! html/parsoid
5300 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5301 !! end
5302
5303 ##
5304 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5305 ## does it number them. As discussed in T55505, we can identify
5306 ## autonumbered links via CSS.
5307 ##
5308
5309 !! test
5310 External links: [raw ampersand]
5311 !! wikitext
5312 Old &amp; use: [http://x&y]
5313 !! html/php
5314 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5315 </p>
5316 !! html/parsoid
5317 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5318 !! end
5319
5320 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5321 # mode will return the [raw ampersand] wikitext
5322 !! test
5323 External links: [encoded ampersand]
5324 !! options
5325 parsoid=wt2html,wt2wt,html2html
5326 !! wikitext
5327 Old &amp; use: [http://x&amp;y]
5328 !! html/php
5329 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5330 </p>
5331 !! html/parsoid
5332 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5333 !! end
5334
5335 !! test
5336 External links: [raw equals]
5337 !! wikitext
5338 [http://example.com/?foo=bar]
5339 !! html/php
5340 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5341 </p>
5342 !! html/parsoid
5343 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5344 !! end
5345
5346 # note that parsoid html is identical to [raw equals] case; so html2wt
5347 # mode will return the [raw equals] wikitext
5348 !! test
5349 External links: [encoded equals] (T8102)
5350 !! options
5351 parsoid=wt2html,wt2wt,html2html
5352 !! wikitext
5353 [http://example.com/?foo&#61;bar]
5354 !! html/php
5355 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5356 </p>
5357 !! html/parsoid
5358 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5359 !! end
5360
5361 # xxx parsoid strips the IDN character, so the round-trip tests will
5362 # obviously fail and are disabled. --cscott
5363 !! test
5364 External links: [IDN ignored character reference in hostname; strip it right off]
5365 !! options
5366 parsoid=wt2html,wt2wt,html2html
5367 !! wikitext
5368 [http://e&zwnj;xample.com/]
5369 !! html/php
5370 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5371 </p>
5372 !! html/parsoid
5373 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
5374 !! end
5375
5376 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5377 # Where an external link could easily circumvent the sanitization of the text of
5378 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5379 # test demands a higher standard. That's a bit strange.
5380 #
5381 # Example:
5382 #
5383 # http://e‌xample.com -> [http://example.com|http://example.com]
5384 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5385 #
5386 # The first example is sanitized, but the second is not. Any security benefits
5387 # from this production are trivial to circumvent. Either remove this test and
5388 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5389 # the test accordingly.
5390 #
5391 # All our love,
5392 # The Parsoid team.
5393 # xxx parsoid strips the IDN character, so the round-trip tests will
5394 # obviously fail and are disabled. --cscott
5395 !! test
5396 External links: IDN ignored character reference in hostname; strip it right off
5397 !! options
5398 parsoid=wt2html,html2html
5399 !! wikitext
5400 http://e&zwnj;xample.com/
5401 !! html/php
5402 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5403 </p>
5404 !! html/parsoid
5405 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
5406 !! end
5407
5408 !! test
5409 External links: www.jpeg.org (T2554)
5410 !! wikitext
5411 http://www.jpeg.org
5412 !! html
5413 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5414 </p>
5415 !! end
5416
5417 # parsoid doesn't explicitly mark autonumbered links, see T55505
5418 !! test
5419 External links: URL within URL (T2002)
5420 !! wikitext
5421 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5422 !! html/php
5423 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5424 </p>
5425 !! html/parsoid
5426 <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>
5427 !! end
5428
5429 !! test
5430 T2361: URL inside bracketed URL
5431 !! wikitext
5432 [http://www.example.com/foo http://www.example.com/bar]
5433 !! html
5434 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5435 </p>
5436 !! end
5437
5438 !! test
5439 T2361: URL within URL, not bracketed
5440 !! wikitext
5441 http://www.example.com/foo?=http://www.example.com/bar
5442 !! html
5443 <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>
5444 </p>
5445 !! end
5446
5447 !! test
5448 T2289: ">"-token in URL-tail
5449 !! wikitext
5450 http://www.example.com/<hello>
5451 !! html
5452 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5453 </p>
5454 !!end
5455
5456 !! test
5457 T2289: literal ">"-token in URL-tail
5458 !! wikitext
5459 http://www.example.com/<b>html</b>
5460 !! html/php
5461 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5462 </p>
5463 !! html/parsoid
5464 <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>
5465 !! end
5466
5467 !! test
5468 T2289: ">"-token in bracketed URL
5469 !! wikitext
5470 [http://www.example.com/<hello> stuff]
5471 !! html
5472 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5473 </p>
5474 !!end
5475
5476 !! test
5477 T2289: literal ">"-token in bracketed URL
5478 !! wikitext
5479 [http://www.example.com/<b>html</b> stuff]
5480 !! html
5481 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5482 </p>
5483 !!end
5484
5485 !! test
5486 T2289: literal double quote at end of URL
5487 !! wikitext
5488 http://www.example.com/"hello"
5489 !! html
5490 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5491 </p>
5492 !!end
5493
5494 !! test
5495 T2289: literal double quote in bracketed URL
5496 !! wikitext
5497 [http://www.example.com/"hello" stuff]
5498 !! html
5499 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5500 </p>
5501 !!end
5502
5503 !! test
5504 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5505 !! wikitext
5506 [http://www.example.com test]
5507 !! html
5508 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5509 </p>
5510 !! end
5511
5512 !! test
5513 External links: link text with spaces
5514 !! wikitext
5515 [http://www.example.com a b c]
5516 [http://www.example.com ''a'' ''b'']
5517 !! html
5518 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5519 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5520 </p>
5521 !! end
5522
5523 # Note edge case difference between PHP and Parsoid here.
5524 !! test
5525 External links: wiki links within external link (T5695)
5526 !! options
5527 parsoid=wt2html,html2html
5528 !! wikitext
5529 [http://example.com [[wikilink]] embedded in ext link]
5530
5531 [http://example.com test [[wikilink]] embedded in ext link]
5532 !! html/php
5533 <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>
5534 </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>
5535 </p>
5536 !! html/parsoid
5537 <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>
5538 <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>
5539 !! end
5540
5541 !! test
5542 T2787: Links with one slash after the url protocol are invalid
5543 !! wikitext
5544 http:/example.com
5545
5546 [http:/example.com title]
5547 !! html
5548 <p>http:/example.com
5549 </p><p>[http:/example.com title]
5550 </p>
5551 !! end
5552
5553 !! test
5554 Bracketed external links with template-generated invalid target
5555 !! wikitext
5556 [{{echo|http:/example.com}} title]
5557 !! html
5558 <p>[http:/example.com title]
5559 </p>
5560 !! end
5561
5562 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5563 !! test
5564 Broken wikilinks (but not external links) prevent templates from closing
5565 !! options
5566 parsoid=wt2html
5567 !! wikitext
5568 [http://example.com x
5569
5570 {{echo|[http://example.com x}}
5571
5572 [[Foo
5573
5574 {{echo|[[Foo}}
5575 !! html/php
5576 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5577 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5578 </p><p>[[Foo
5579 </p><p>{{echo|[[Foo}}
5580 </p>
5581 !! html/parsoid
5582 <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5583 <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>
5584 <p>[[Foo</p>
5585 <p>{{echo|[[Foo}}</p>
5586 !! end
5587
5588 !! test
5589 Wikilinks with embedded newlines are not broken
5590 !! wikitext
5591 {{echo|[[ Foo
5592 B
5593 C]]}}
5594 !! html/php
5595 <p>[[ Foo
5596 B
5597 C]]
5598 </p>
5599 !! html/parsoid
5600 <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>
5601 !! end
5602
5603 !! test
5604 Broken templates
5605 !! options
5606 parsoid=wt2html
5607 !! wikitext
5608 {{echo|[[Foo|}}]]
5609
5610 [[Foo|{{echo|]]}}
5611 !! html/php
5612 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5613 </p><p>[[Foo|]]
5614 </p>
5615 !! html/parsoid
5616 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5617 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5618 !! end
5619
5620 !! test
5621 T4702: Mismatched <i>, <b> and <a> tags are invalid
5622 !! wikitext
5623 ''[http://example.com text'']
5624 [http://example.com '''text]'''
5625 ''Something [http://example.com in italic'']
5626 ''Something [http://example.com mixed''''', even bold]'''
5627 '''''Now [http://example.com both''''']
5628 !! html
5629 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5630 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5631 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5632 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5633 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5634 </p>
5635 !! end
5636
5637
5638 !! test
5639 T6781: %26 in URL
5640 !! wikitext
5641 http://www.example.com/?title=AT%26T
5642 !! html/php
5643 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5644 </p>
5645 !! html/parsoid
5646 <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>
5647 !! end
5648
5649 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5650 # % is actually legal in HTML5. Any change in output would need testing though.
5651 !! test
5652 T6781, T7267: %25 in URL
5653 !! wikitext
5654 http://www.example.com/?title=100%25_Bran
5655 !! html/php
5656 <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>
5657 </p>
5658 !! html/parsoid
5659 <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>
5660 !! end
5661
5662 !! test
5663 T6781, T7267: %28, %29 in URL
5664 !! wikitext
5665 http://www.example.com/?title=Ben-Hur_%281959_film%29
5666 !! html/php
5667 <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>
5668 </p>
5669 !! html/parsoid
5670 <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>
5671 !! end
5672
5673
5674 !! test
5675 T6781: %26 in autonumber URL
5676 !! wikitext
5677 [http://www.example.com/?title=AT%26T]
5678 !! html/php
5679 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5680 </p>
5681 !! html/parsoid
5682 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5683 !! end
5684
5685 !! test
5686 T6781, T7267: %26 in autonumber URL
5687 !! wikitext
5688 [http://www.example.com/?title=100%25_Bran]
5689 !! html/php
5690 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5691 </p>
5692 !! html/parsoid
5693 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5694 !! end
5695
5696 !! test
5697 T6781, T7267: %28, %29 in autonumber URL
5698 !! wikitext
5699 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5700 !! html/php
5701 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5702 </p>
5703 !! html/parsoid
5704 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5705 !! end
5706
5707
5708 !! test
5709 T6781: %26 in bracketed URL
5710 !! wikitext
5711 [http://www.example.com/?title=AT%26T link]
5712 !! html/php
5713 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5714 </p>
5715 !! html/parsoid
5716 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5717 !! end
5718
5719 !! test
5720 T6781, T7267: %25 in bracketed URL
5721 !! wikitext
5722 [http://www.example.com/?title=100%25_Bran link]
5723 !! html
5724 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5725 </p>
5726 !! end
5727
5728 !! test
5729 T6781, T7267: %28, %29 in bracketed URL
5730 !! wikitext
5731 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5732 !! html/php
5733 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5734 </p>
5735 !! html/parsoid
5736 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5737 !! end
5738
5739 !! test
5740 External link containing a period in the anchor. (T65947)
5741 !! wikitext
5742 [//foo.org/bar#baz. bang]
5743
5744 [//foo.org/bar. bang]
5745 !! html/php
5746 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5747 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5748 </p>
5749 !! html/parsoid
5750 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5751 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5752 !! end
5753
5754 !! test
5755 External link containing a single quote. (T65947)
5756 !! wikitext
5757 [//foo.org/bar'baz]
5758
5759 [//foo.org/bar'baz bang]
5760 !! html/php
5761 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5762 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5763 </p>
5764 !! html/parsoid
5765 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5766 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5767 !! end
5768
5769 !! test
5770 External link containing double-single-quotes in text '' (T6598 sanity check)
5771 !! wikitext
5772 Some [http://example.com/ pretty ''italics'' and stuff]!
5773 !! html
5774 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5775 </p>
5776 !! end
5777
5778 !! test
5779 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5780 !! wikitext
5781 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5782 !! html
5783 <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>
5784 </p>
5785 !! end
5786
5787 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5788 !! test
5789 External link containing double-single-quotes with no space separating the url from text in italics
5790 !! wikitext
5791 [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]].]
5792 !! html/php+tidy
5793 <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>.
5794 </p>
5795 !! html/parsoid
5796 <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>
5797 !! end
5798
5799 !! test
5800 External link with comments in link text
5801 !! wikitext
5802 [http://www.google.com Google <!-- comment -->]
5803 !! html/php
5804 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5805 </p>
5806 !! html/parsoid
5807 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5808 !! end
5809
5810 !! test
5811 External link to bare IPv4 address
5812 !! wikitext
5813 [http://192.168.0.1 Link]
5814 !! html/php
5815 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5816 </p>
5817 !! html/parsoid
5818 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5819 !! end
5820
5821 !! test
5822 URL-encoding in URL functions (single parameter)
5823 !! wikitext
5824 {{localurl:Some page|amp=&}}
5825 !! html
5826 <p>/index.php?title=Some_page&amp;amp=&amp;
5827 </p>
5828 !! end
5829
5830 !! test
5831 URL-encoding in URL functions (multiple parameters)
5832 !! wikitext
5833 {{localurl:Some page|q=?&amp=&}}
5834 !! html
5835 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5836 </p>
5837 !! end
5838
5839 !! test
5840 Brackets in urls
5841 !! wikitext
5842 http://example.com/index.php?foozoid%5B%5D=bar
5843
5844 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5845 !! html/php
5846 <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>
5847 </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>
5848 </p>
5849 !! html/parsoid
5850 <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>
5851
5852 <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>
5853 !! end
5854
5855 !! test
5856 IPv6 urls, autolink format (T23261)
5857 !! wikitext
5858 http://[2404:130:0:1000::187:2]/index.php
5859
5860 Examples from RFC 2373, section 2.2:
5861
5862 *http://[1080::8:800:200C:417A]/unicast
5863 *http://[FF01::101]/multicast
5864 *http://[::1]/loopback
5865 *http://[::]/unspecified
5866 *http://[::13.1.68.3]/ipv4compat
5867 *http://[::FFFF:129.144.52.38]/ipv4compat
5868
5869 Examples from RFC 2732, section 2:
5870
5871 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5872 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5873 *http://[3ffe:2a00:100:7031::1]
5874 *http://[1080::8:800:200C:417A]/foo
5875 *http://[::192.9.5.5]/ipng
5876 *http://[::FFFF:129.144.52.38]:80/index.html
5877 *http://[2010:836B:4179::836B:4179]
5878 !! html/php
5879 <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>
5880 </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:
5881 </p>
5882 <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>
5883 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5884 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5885 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5886 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5887 <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>
5888 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5889 </p>
5890 <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>
5891 <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>
5892 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5893 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5894 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5895 <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>
5896 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5897
5898 !! html/parsoid
5899 <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>
5900
5901 <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>
5902 <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>
5903 <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5904 <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5905 <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5906 <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5907 <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>
5908
5909 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5910 <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>
5911 <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>
5912 <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5913 <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>
5914 <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5915 <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>
5916 <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5917 !! end
5918
5919 !! test
5920 IPv6 urls, bracketed format (T23261)
5921 !! wikitext
5922 [http://[2404:130:0:1000::187:2]/index.php test]
5923
5924 Examples from RFC 2373, section 2.2:
5925
5926 *[http://[1080::8:800:200C:417A] unicast]
5927 *[http://[FF01::101] multicast]
5928 *[http://[::1]/ loopback]
5929 *[http://[::] unspecified]
5930 *[http://[::13.1.68.3] ipv4compat]
5931 *[http://[::FFFF:129.144.52.38] ipv4compat]
5932
5933 Examples from RFC 2732, section 2:
5934
5935 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5936 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5937 *[http://[3ffe:2a00:100:7031::1] 3]
5938 *[http://[1080::8:800:200C:417A]/foo 4]
5939 *[http://[::192.9.5.5]/ipng 5]
5940 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5941 *[http://[2010:836B:4179::836B:4179] 7]
5942 !! html/php
5943 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5944 </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:
5945 </p>
5946 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5947 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5948 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5949 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5950 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5951 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5952 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5953 </p>
5954 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5955 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5956 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5957 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5958 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5959 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5960 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5961
5962 !! html/parsoid
5963 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5964
5965 <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>
5966 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5967 <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5968 <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5969 <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5970 <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5971 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5972
5973 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5974 <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>
5975 <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5976 <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5977 <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5978 <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5979 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5980 <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5981 !! end
5982
5983 !! test
5984 Non-extlinks in brackets
5985 !! wikitext
5986 [foo]
5987 [foo bar]
5988 [foo ''bar'']
5989 [fool's] errand
5990 [fool's errand]
5991 [{{echo|foo}}]
5992 [{{echo|foo}} bar]
5993 [{{echo|foo}} ''bar'']
5994 [{{echo|foo}}l's] errand
5995 [{{echo|foo}}l's errand]
5996 [url={{echo|foo}}]
5997 [url=http://example.com]
5998 [http:// bare protocols don't count]
5999 !! html/php
6000 <p>[foo]
6001 [foo bar]
6002 [foo <i>bar</i>]
6003 [fool's] errand
6004 [fool's errand]
6005 [foo]
6006 [foo bar]
6007 [foo <i>bar</i>]
6008 [fool's] errand
6009 [fool's errand]
6010 [url=foo]
6011 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
6012 [http:// bare protocols don't count]
6013 </p>
6014 !! html/parsoid
6015 <p>[foo]
6016 [foo bar]
6017 [foo <i>bar</i>]
6018 [fool's] errand
6019 [fool's errand]
6020 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
6021 [<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]
6022 [<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>]
6023 [<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
6024 [<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]
6025 [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>]
6026 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
6027 [http:// bare protocols don't count]</p>
6028 !! end
6029
6030 !! test
6031 Percent encoding in external links
6032 !! wikitext
6033 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
6034 !! html/php
6035 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
6036 </p>
6037 !! html/parsoid
6038 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
6039 !! end
6040
6041 !! test
6042 Use url link syntax for links where the content is equal the link target
6043 !! wikitext
6044 http://example.com
6045 !! html/php
6046 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
6047 </p>
6048 !! html/parsoid
6049 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
6050 !! end
6051
6052 !! test
6053 Parenthesis in external links, especially URL links
6054 !! wikitext
6055 http://example.com)
6056
6057 http://example.com/test)
6058
6059 http://example.com/(test)
6060
6061 http://example.com/((test)
6062
6063 (http://example.com/(test))
6064
6065 (http://example.com/(test)))))
6066
6067 http://example.com/a)b
6068
6069 [http://example.com) foo]
6070 !! html/php
6071 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6072 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
6073 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
6074 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
6075 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
6076 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
6077 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
6078 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
6079 </p>
6080 !! html/parsoid
6081 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
6082 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
6083 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
6084 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
6085 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
6086 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
6087 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
6088 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
6089 !! end
6090
6091 !! test
6092 Parenthesis in external links, w/ transclusion or comment
6093 !! wikitext
6094 (http://example.com/{{echo|hi}})
6095
6096 (http://example.com<!-- hi -->)
6097 !! html/php
6098 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
6099 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6100 </p>
6101 !! html/parsoid
6102 <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>
6103
6104 <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>
6105 !! end
6106
6107 !! test
6108 Serialize <a> tags with invalid link targets as plain text
6109 !! options
6110 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
6111 !! html/parsoid
6112 <a rel="mw:WikiLink" href="[[foo]]">text</a>
6113 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
6114 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
6115 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
6116 !! wikitext
6117 text
6118 <nowiki>*</nowiki>text
6119 <nowiki>[[foo]]</nowiki>
6120 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
6121 !! end
6122
6123 !! test
6124 mw:ExtLink -vs- mw:WikiLink (T94723)
6125 !! options
6126 parsoid=html2wt
6127 !! html/parsoid
6128 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
6129 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
6130 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6131 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6132 <p>
6133 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6134 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6135 </p>
6136 !! wikitext
6137 [[Foo|Bar]]
6138 [[Foo|Bar]]
6139 [[:en:Foo|Bar]]
6140 [[:en:Foo|Bar]]
6141
6142 [[:en:European_Robin|European Robin]]
6143 [[:en:European_Robin|European Robin]]
6144 !! end
6145
6146 !! test
6147 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
6148 !! options
6149 parsoid=wt2wt
6150 !! wikitext
6151 [http://en.wikipedia.org/wiki/European_Robin European Robin]
6152 !! html/parsoid
6153 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
6154 !! end
6155
6156
6157 ###
6158 ### Quotes
6159 ###
6160
6161 !! test
6162 Quotes
6163 !! wikitext
6164 Normal text. '''Bold text.''' Normal text. ''Italic text.''
6165
6166 Normal text. '''''Bold italic text.''''' Normal text.
6167 !! html
6168 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
6169 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
6170 </p>
6171 !! end
6172
6173
6174 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
6175 # parser strips. The wikitext contains just the first half of the bold
6176 # quote pair.
6177 !! test
6178 Unclosed and unmatched quotes
6179 !! wikitext
6180 '''''Bold italic text '''with bold deactivated''' in between.'''''
6181
6182 '''''Bold italic text ''with italic deactivated'' in between.'''''
6183
6184 '''Bold text..
6185
6186 ..spanning two paragraphs (should not work).'''
6187
6188 '''Bold tag left open
6189
6190 ''Italic tag left open
6191
6192 Normal text.
6193
6194 <!-- Unmatching number of opening, closing tags: -->
6195 '''This year''''s election ''should'' beat '''last year''''s.
6196
6197 ''Tom'''s car is bigger than ''Susan'''s.
6198
6199 Plain ''italic'''s plain
6200 !! html/php
6201 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6202 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6203 </p><p><b>Bold text..</b>
6204 </p><p>..spanning two paragraphs (should not work).
6205 </p><p><b>Bold tag left open</b>
6206 </p><p><i>Italic tag left open</i>
6207 </p><p>Normal text.
6208 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6209 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6210 </p><p>Plain <i>italic'</i>s plain
6211 </p>
6212 !! html/parsoid
6213 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6214 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6215 </p><p><b>Bold text..</b>
6216 </p><p>..spanning two paragraphs (should not work).<b></b>
6217 </p><p><b>Bold tag left open</b>
6218 </p><p><i>Italic tag left open</i>
6219 </p><p>Normal text.
6220 </p>
6221 <!-- Unmatching number of opening, closing tags: -->
6222 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6223 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6224 </p><p>Plain <i>italic'</i>s plain
6225 </p>
6226 !! end
6227
6228 ###
6229 ### Tables
6230 ###
6231 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
6232 ###
6233
6234 # This should not produce <table></table> as <table><tr><td></td></tr></table>
6235 # is the bare minimum required by the spec, see:
6236 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
6237 # Parsoid team replies: empty table tags are legal in HTML5
6238 !! test
6239 A table with no data.
6240 !! options
6241 parsoid=wt2html
6242 !! wikitext
6243 {||}
6244 !! html/php
6245
6246 !! html/parsoid
6247 <table></table>
6248
6249 !! end
6250
6251 !! test
6252 A table with stray table end tags on start tag line (wt2html)
6253 !! options
6254 parsoid=wt2html
6255 !! wikitext
6256 {|style="color: red;"|}
6257
6258 {|style="color: red;" |}
6259 |foo
6260 |}
6261
6262 {|style="color: red;"|} id="foo"
6263 |foo
6264 |}
6265
6266 {|style="color: red;" |} id="foo"
6267 |foo
6268 |}
6269 !! html
6270 <table style="color: red;"></table>
6271
6272 <table style="color: red;">
6273 <tbody><tr>
6274 <td>foo</td>
6275 </tr></tbody>
6276 </table>
6277
6278 <table style="color: red;" id="foo">
6279 <tbody><tr>
6280 <td>foo</td>
6281 </tr></tbody>
6282 </table>
6283
6284 <table style="color: red;" id="foo">
6285 <tbody><tr>
6286 <td>foo</td>
6287 </tr></tbody>
6288 </table>
6289
6290 !! end
6291
6292 !! test
6293 A table with no data (take 2)
6294 !! wikitext
6295 {|
6296 |}
6297 !! html/parsoid
6298 <table></table>
6299 !! end
6300
6301 # A table with nothing but a caption is invalid XHTML, we might want to render
6302 # this as <p>caption</p>
6303 # Parsoid team replies: table with only a caption is legal in HTML5
6304 !! test
6305 A table with nothing but a caption
6306 !! wikitext
6307 {|
6308 |+caption
6309 |}
6310 !! html/php
6311 <table>
6312 <caption>caption
6313 </caption><tr><td></td></tr></table>
6314
6315 !! html/parsoid
6316 <table><caption>caption</caption></table>
6317 !! end
6318
6319 !! test
6320 A table with caption with default-spaced attributes and a table row
6321 !! wikitext
6322 {|
6323 |+ style="color: red;" |caption1
6324 |-
6325 |foo
6326 |}
6327 !! html
6328 <table>
6329 <caption style="color: red;">caption1
6330 </caption>
6331 <tr>
6332 <td>foo
6333 </td></tr></table>
6334
6335 !! end
6336
6337 !! test
6338 A table with captions with non-default spaced attributes and a table row
6339 !! wikitext
6340 {|
6341 |+style="color: red;"|caption2
6342 |+ style="color: red;"|caption3
6343 |-
6344 |foo
6345 |}
6346 !! html
6347 <table>
6348 <caption style="color: red;">caption2
6349 </caption>
6350 <caption style="color: red;">caption3
6351 </caption>
6352 <tr>
6353 <td>foo
6354 </td></tr></table>
6355
6356 !! end
6357
6358 !! test
6359 Table td-cell syntax variations
6360 !! wikitext
6361 {|
6362 |foo bar foo|baz
6363 |foo bar foo||baz
6364 |style='color:red;'|baz
6365 |style='color:red;'||baz
6366 |}
6367 !! html
6368 <table>
6369 <tr>
6370 <td>baz
6371 </td>
6372 <td>foo bar foo</td>
6373 <td>baz
6374 </td>
6375 <td style="color:red;">baz
6376 </td>
6377 <td>style='color:red;'</td>
6378 <td>baz
6379 </td></tr></table>
6380
6381 !! end
6382
6383 !! test
6384 Simple table
6385 !! wikitext
6386 {|
6387 |1||2
6388 |-
6389 |3||4
6390 |}
6391 !! html
6392 <table>
6393 <tr>
6394 <td>1</td>
6395 <td>2
6396 </td></tr>
6397 <tr>
6398 <td>3</td>
6399 <td>4
6400 </td></tr></table>
6401
6402 !! end
6403
6404 !! test
6405 Simple table but with multiple dashes for row wikitext
6406 !! wikitext
6407 {|
6408 |foo
6409 |-----
6410 |bar
6411 |}
6412 !! html
6413 <table>
6414 <tr>
6415 <td>foo
6416 </td></tr>
6417 <tr>
6418 <td>bar
6419 </td></tr></table>
6420
6421 !! end
6422
6423 !! test
6424 Multiplication table
6425 !! wikitext
6426 {| border="1" cellpadding="2"
6427 |+Multiplication table
6428 |-
6429 !&times;!!1!!2!!3
6430 |-
6431 !1
6432 |1||2||3
6433 |-
6434 !2
6435 |2||4||6
6436 |-
6437 !3
6438 |3||6||9
6439 |-
6440 !4
6441 |4||8||12
6442 |-
6443 !5
6444 |5||10||15
6445 |}
6446 !! html
6447 <table border="1" cellpadding="2">
6448 <caption>Multiplication table
6449 </caption>
6450 <tr>
6451 <th>&#215;</th>
6452 <th>1</th>
6453 <th>2</th>
6454 <th>3
6455 </th></tr>
6456 <tr>
6457 <th>1
6458 </th>
6459 <td>1</td>
6460 <td>2</td>
6461 <td>3
6462 </td></tr>
6463 <tr>
6464 <th>2
6465 </th>
6466 <td>2</td>
6467 <td>4</td>
6468 <td>6
6469 </td></tr>
6470 <tr>
6471 <th>3
6472 </th>
6473 <td>3</td>
6474 <td>6</td>
6475 <td>9
6476 </td></tr>
6477 <tr>
6478 <th>4
6479 </th>
6480 <td>4</td>
6481 <td>8</td>
6482 <td>12
6483 </td></tr>
6484 <tr>
6485 <th>5
6486 </th>
6487 <td>5</td>
6488 <td>10</td>
6489 <td>15
6490 </td></tr></table>
6491
6492 !! end
6493
6494 !! test
6495 Accept "||" in table headings
6496 !! wikitext
6497 {|
6498 !h1||h2
6499 |}
6500 !! html
6501 <table>
6502 <tr>
6503 <th>h1</th>
6504 <th>h2
6505 </th></tr></table>
6506
6507 !! end
6508
6509 !! test
6510 Accept "!!" in table data
6511 !! wikitext
6512 {|
6513 |Foo!!||
6514 |}
6515 !! html
6516 <table>
6517 <tr>
6518 <td>Foo!!</td>
6519 <td>
6520 </td></tr></table>
6521
6522 !! html/parsoid
6523 <table>
6524 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6525 </tbody></table>
6526 !! end
6527
6528 !! test
6529 Accept "||" in indented table headings
6530 !! wikitext
6531 :{|
6532 !h1||h2
6533 |}
6534 !! html
6535 <dl><dd><table>
6536 <tr>
6537 <th>h1</th>
6538 <th>h2
6539 </th></tr></table></dd></dl>
6540
6541 !! end
6542
6543 !! test
6544 Accept "!!" in templates
6545 !! wikitext
6546 {|
6547 !a {{echo|b!!c}}
6548 |}
6549 !! html/php
6550 <table>
6551 <tr>
6552 <th>a b</th>
6553 <th>c
6554 </th></tr></table>
6555
6556 !! html/parsoid
6557 <table>
6558 <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>
6559 !! end
6560
6561 !! test
6562 Accept "!!" in table headings after newline
6563 !! wikitext
6564 {|
6565 !a
6566 b!!c
6567 |}
6568 !! html/php
6569 <table>
6570 <tr>
6571 <th>a
6572 <p>b!!c
6573 </p>
6574 </th></tr></table>
6575
6576 !! html/parsoid
6577 <table>
6578 <tbody><tr><th>a
6579 <p>b!!c</p></th></tr>
6580 </tbody></table>
6581 !! end
6582
6583 !! test
6584 Accept "!!" in table data of mixed wikitext / html syntax
6585 !! wikitext
6586 {|
6587 !a
6588 <tr><td>b!!c</td></tr>
6589 |}
6590 !! html/php+tidy
6591 <table>
6592 <tbody><tr>
6593 <th>a
6594 </th></tr><tr><td>b!!c</td></tr>
6595 </tbody></table>
6596 !! html/parsoid
6597 <table>
6598 <tbody><tr><th>a</th></tr>
6599 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6600 </tbody></table>
6601 !! end
6602
6603 !! test
6604 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6605 !! wikitext
6606 {|
6607 !|h1
6608 ||a
6609 |}
6610 !! html
6611 <table>
6612 <tr>
6613 <th>h1
6614 </th>
6615 <td>a
6616 </td></tr></table>
6617
6618 !! end
6619
6620 !!test
6621 Accept "| !" at start of line in tables (ignore !-attribute)
6622 !! wikitext
6623 {|
6624 |-
6625 |!style="color:red"|bar
6626 |}
6627 !! html
6628 <table>
6629
6630 <tr>
6631 <td>bar
6632 </td></tr></table>
6633
6634 !!end
6635
6636 !!test
6637 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 +/-
6638 !! wikitext
6639 {|
6640 |-
6641 |style='color:red;'|+1
6642 |style='color:blue;'|-1
6643 |-
6644 |1||2||3
6645 |1||+2||-3
6646 |-
6647 | +1
6648 | -1
6649 |}
6650 !! html
6651 <table>
6652
6653 <tr>
6654 <td style="color:red;">+1
6655 </td>
6656 <td style="color:blue;">-1
6657 </td></tr>
6658 <tr>
6659 <td>1</td>
6660 <td>2</td>
6661 <td>3
6662 </td>
6663 <td>1</td>
6664 <td>+2</td>
6665 <td>-3
6666 </td></tr>
6667 <tr>
6668 <td>+1
6669 </td>
6670 <td>-1
6671 </td></tr></table>
6672
6673 !!end
6674
6675 !! test
6676 Table rowspan
6677 !! wikitext
6678 {| border=1
6679 |Cell 1, row 1
6680 |rowspan=2|Cell 2, row 1 (and 2)
6681 |Cell 3, row 1
6682 |-
6683 |Cell 1, row 2
6684 |Cell 3, row 2
6685 |}
6686 !! html
6687 <table border="1">
6688 <tr>
6689 <td>Cell 1, row 1
6690 </td>
6691 <td rowspan="2">Cell 2, row 1 (and 2)
6692 </td>
6693 <td>Cell 3, row 1
6694 </td></tr>
6695 <tr>
6696 <td>Cell 1, row 2
6697 </td>
6698 <td>Cell 3, row 2
6699 </td></tr></table>
6700
6701 !! end
6702
6703 !! test
6704 Nested table
6705 !! wikitext
6706 {| border=1
6707 | &alpha;
6708 |
6709 {| bgcolor=#ABCDEF border=2
6710 |nested
6711 |-
6712 |table
6713 |}
6714 |the original table again
6715 |}
6716 !! html
6717 <table border="1">
6718 <tr>
6719 <td>&#945;
6720 </td>
6721 <td>
6722 <table bgcolor="#ABCDEF" border="2">
6723 <tr>
6724 <td>nested
6725 </td></tr>
6726 <tr>
6727 <td>table
6728 </td></tr></table>
6729 </td>
6730 <td>the original table again
6731 </td></tr></table>
6732
6733 !! end
6734
6735 !! test
6736 Invalid attributes in table cell (T3830)
6737 !! wikitext
6738 {|
6739 |Cell:|broken
6740 |}
6741 !! html
6742 <table>
6743 <tr>
6744 <td>broken
6745 </td></tr></table>
6746
6747 !! end
6748
6749 !! test
6750 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6751 !! wikitext
6752 {|
6753 |title="foo" |bar
6754 |title="foo<nowiki>|</nowiki>" |bar
6755 |title="foo<nowiki>|</nowiki>" bar
6756 |}
6757 !! html/php
6758 <table>
6759 <tr>
6760 <td title="foo">bar
6761 </td>
6762 <td title="foo&#124;">bar
6763 </td>
6764 <td>title="foo|" bar
6765 </td></tr></table>
6766
6767 !! html/parsoid
6768 <table>
6769 <tbody><tr><td title="foo">bar</td>
6770 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6771 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6772 </tbody></table>
6773 !! end
6774
6775 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6776 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6777 # *2wt modes will fail.
6778 !! test
6779 Table security: embedded pipes
6780 !! options
6781 parsoid=wt2html,html2html
6782 !! wikitext
6783 {|
6784 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6785 !! html/php
6786 <table>
6787 <tr>
6788 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6789 <td>]" onmouseover="alert(document.cookie)"&gt;test
6790 </td>
6791 </tr>
6792 </table>
6793
6794 !! html/parsoid
6795 <table><tbody>
6796 <tr>
6797 <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>
6798 !! end
6799
6800 !! test
6801 Element attributes with double ! should not be broken up by <th>
6802 !! wikitext
6803 {|
6804 !hi <div class="!!">ha</div> ho
6805 |}
6806 !! html/php
6807 <table>
6808 <tr>
6809 <th>hi <div class="!!">ha</div> ho
6810 </th></tr></table>
6811
6812 !! html/parsoid
6813 <table>
6814 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6815 </tbody></table>
6816 !! end
6817
6818 !! test
6819 ! and || in element attributes should not be parsed as <th>/<td>
6820 !! wikitext
6821 {|
6822 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6823 |}
6824 !! html/php
6825 <table>
6826 <tr>
6827 <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6828 </td></tr></table>
6829
6830 !! html/parsoid
6831 <table>
6832 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6833 </tbody></table>
6834 !! end
6835
6836 # FIXME: The output seems broken. Filed as T110268.
6837 !! test
6838 ! and || in td attributes should not be parsed as <th>/<td>
6839 !! options
6840 parsoid=wt2html
6841 !! wikitext
6842 {|
6843 |style="color: red !important;" data-contrived="put this here ||"|foo
6844 |}
6845 !! html/php
6846 <table>
6847 <tr>
6848 <td>style="color: red !important;" data-contrived="put this here</td>
6849 <td>foo
6850 </td></tr></table>
6851
6852 !! html/parsoid
6853 <table>
6854 <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>
6855 </tbody></table>
6856 !! end
6857
6858 !! test
6859 Break on | in element attribute in template
6860 !! options
6861 parsoid=wt2html,html2html
6862 !! wikitext
6863 {{echo|1=<div class="hi|ho">ha</div>}}
6864 !! html/php
6865 <p>ho"&gt;ha&lt;/div&gt;
6866 </p>
6867 !! html/parsoid
6868 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</p>
6869 !! end
6870
6871 !! test
6872 Break on | in element attribute name in template
6873 !! wikitext
6874 {{echo|<div cla|ss="hiho">ha</div>}}
6875 !! html/parsoid
6876 <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>
6877 !! end
6878
6879 !! test
6880 Don't break on | in extension attribute in template
6881 !! wikitext
6882 {{echo|<ref name="hi|ho">ha</ref>}}
6883
6884 <references />
6885 !! html/parsoid
6886 <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>
6887
6888 <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>
6889 !! end
6890
6891 ## We don't support roundtripping of these attributes in Parsoid.
6892 ## Selective serialization takes care of preventing dirty diffs.
6893 ## But, on edits, we dirty-diff the invalid attribute text.
6894 !! test
6895 Invalid text in table attributes should be discarded
6896 !! options
6897 parsoid=wt2html
6898 !! wikitext
6899 {| <span>boo</span> style='border:1px solid black'
6900 | <span>boo</span> style='color:blue' |1
6901 |<span>boo</span> style='color:blue'|2
6902 |}
6903 !! html/php
6904 <table style="border:1px solid black">
6905 <tr>
6906 <td style="color:blue">1
6907 </td>
6908 <td style="color:blue">2
6909 </td></tr></table>
6910
6911 !! html/parsoid
6912 <table style="border:1px solid black">
6913 <tr>
6914 <td style="color:blue">1</td>
6915 <td style="color:blue">2</td>
6916 </tr>
6917 </table>
6918 !! end
6919
6920 !! test
6921 Invalid text in table attributes should be preserved by selective serializer
6922 !! options
6923 parsoid={
6924 "modes": ["selser"],
6925 "changes": [
6926 ["td:first-child", "text", "abc"],
6927 ["td + td", "text", "xyz"]
6928 ]
6929 }
6930 !! wikitext
6931 {| <span>boo</span> style='border:1px solid black'
6932 | <span>boo</span> style='color:blue' | 1
6933 |<span>boo</span> style='color:blue'| 2
6934 |}
6935 !! wikitext/edited
6936 {| <span>boo</span> style='border:1px solid black'
6937 | <span>boo</span> style='color:blue' | abc
6938 |<span>boo</span> style='color:blue'| xyz
6939 |}
6940 !! end
6941
6942 !! test
6943 1. Template-generated table cell attributes and cell content
6944 !! wikitext
6945 {|
6946 |{{table_attribs}}
6947 | {{table_attribs}}
6948 || {{table_attribs_5}}
6949 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6950 |align=center {{table_attribs}}
6951 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6952 |}
6953 !! html
6954 <table>
6955 <tr>
6956 <td style="color:red;">Foo
6957 </td>
6958 <td style="color:red;">Foo
6959 </td>
6960 <td>style="color:red;"</td>
6961 <td>Bar
6962 </td>
6963 <td style="color:red;">Foo
6964 </td>
6965 <td align="center" style="color:red;">Foo
6966 </td>
6967 <td align="center" style="color:red;">Foo
6968 </td></tr></table>
6969
6970 !! end
6971
6972 !! test
6973 2. Template-generated table cell attributes and cell content
6974 !! wikitext
6975 {|
6976 |{{table_attribs_2}}
6977 |}
6978 !! html/php
6979 <table>
6980 <tr>
6981 <td style="color:red;">Foo
6982 </td>
6983 <td>Bar</td>
6984 <td>Baz
6985 </td></tr></table>
6986
6987 !! html/parsoid
6988 <table>
6989 <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>
6990 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6991 </tbody></table>
6992 !! end
6993
6994 !! test
6995 3. Template-generated table cell attributes and cell content
6996 !! wikitext
6997 {|
6998 !align=center {{table_header_cells}}
6999 |-
7000 |align=center {{table_cells}}
7001 |}
7002 !! html/php
7003 <table>
7004 <tr>
7005 <th align="center" style="color:red;">Foo</th>
7006 <th style="color:red;"><i>Bar</i></th>
7007 <th style="color:brown;"><i>Foo</i> and Baz
7008 </th></tr>
7009 <tr>
7010 <td align="center" style="color:red;">Foo</td>
7011 <td style="color:red;"><i>Bar</i></td>
7012 <td style="color:brown;"><i>Foo</i> and Baz
7013 </td></tr></table>
7014
7015 !! html/parsoid
7016 <table>
7017 <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>
7018 <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>
7019 </tbody></table>
7020 !! end
7021
7022 !! test
7023 4. Template-generated table cell attributes and cell content inside a templated table
7024 !! wikitext
7025 {{tbl-start}}
7026 !align=center {{table_header_cells}}
7027 |-
7028 |align=center {{table_cells}}
7029 {{tbl-end}}
7030 !! html/php
7031 <table>
7032 <tr>
7033 <th align="center" style="color:red;">Foo</th>
7034 <th style="color:red;"><i>Bar</i></th>
7035 <th style="color:brown;"><i>Foo</i> and Baz
7036 </th></tr>
7037 <tr>
7038 <td align="center" style="color:red;">Foo</td>
7039 <td style="color:red;"><i>Bar</i></td>
7040 <td style="color:brown;"><i>Foo</i> and Baz
7041 </td></tr></table>
7042
7043 !! html/parsoid
7044 <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}}]}'>
7045 <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>
7046 <tr>
7047 <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>
7048 </tbody></table>
7049 !! end
7050
7051 ## Edge case fix to prevent future regressions
7052 !! test
7053 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
7054 !! wikitext
7055 {|
7056 |{{table_attribs_7}}
7057 |}
7058 <references />
7059 !! html/parsoid
7060 <table>
7061 <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>
7062 </tbody></table>
7063 <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>
7064 !! end
7065
7066 !! test
7067 Table with row followed by newlines and table heading
7068 !! options
7069 parsoid=wt2html,html2html
7070 !! wikitext
7071 {|
7072 |-
7073
7074 !foo
7075 |}
7076 !! html/*
7077 <table>
7078
7079
7080 <tr>
7081 <th>foo
7082 </th></tr></table>
7083
7084 !! end
7085
7086 !! test
7087 Table with empty line following the start tag
7088 !! options
7089 parsoid=wt2html,html2html
7090 !! wikitext
7091 {|
7092
7093 |-
7094 |foo
7095 |}
7096 !! html/*
7097 <table>
7098
7099
7100 <tr>
7101 <td>foo
7102 </td></tr></table>
7103
7104 !! end
7105
7106 !! test
7107 Table attributes with empty value
7108 !! options
7109 parsoid=wt2html,html2html
7110 !! wikitext
7111 {|
7112 | style=|hello
7113 |}
7114 !! html/php
7115 <table>
7116 <tr>
7117 <td style="">hello
7118 </td></tr></table>
7119
7120 !! html/parsoid
7121 <table>
7122 <tbody><tr><td style="">hello</td></tr>
7123 </tbody></table>
7124 !! end
7125
7126 !! test
7127 Wikitext table with a lot of comments
7128 !! wikitext
7129 {|
7130 <!-- c0 -->
7131 |foo
7132 <!-- c1 -->
7133 |-<!-- c2 -->
7134 <!-- c3 -->
7135 |<!-- c4 -->
7136 <!-- c5 -->
7137 |}
7138 !! html
7139 <table>
7140 <tr>
7141 <td>foo
7142 </td></tr>
7143 <tr>
7144 <td>
7145 </td></tr></table>
7146
7147 !! end
7148
7149 !! test
7150 Wikitext table comments represented in parsoid dom
7151 !! wikitext
7152 {|<!--c1--><!--c2-->
7153 |-<!--c3-->
7154 |x
7155 |}
7156 !! html/php+tidy
7157 <table>
7158
7159 <tbody><tr>
7160 <td>x
7161 </td></tr></tbody></table>
7162 !! html/parsoid
7163 <table><!--c1--><!--c2-->
7164 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
7165 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
7166 </tbody></table>
7167 !! end
7168
7169 !! test
7170 Wikitext table with double-line table cell
7171 !! wikitext
7172 {|
7173 |a
7174 b
7175 |}
7176 !! html
7177 <table>
7178 <tr>
7179 <td>a
7180 <p>b
7181 </p>
7182 </td></tr></table>
7183
7184 !! end
7185
7186 !! test
7187 Table cell with a single comment
7188 !! wikitext
7189 {|
7190 |<!-- c1 -->
7191 |a
7192 |}
7193 !! html
7194 <table>
7195 <tr>
7196 <td>
7197 </td>
7198 <td>a
7199 </td></tr></table>
7200
7201 !! end
7202
7203 !! test
7204 Table-cell after a comment-only-empty-line
7205 !! wikitext
7206 {|
7207 |a
7208 <!--c1-->
7209 <!--c2-->|b
7210 |}
7211 !! html
7212 <table>
7213 <tr>
7214 <td>a
7215 </td>
7216 <td>b
7217 </td></tr></table>
7218
7219 !! html/parsoid
7220 <table>
7221 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7222 <!--c1-->
7223 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
7224 </tbody></table>
7225
7226 !! end
7227
7228 !! test
7229 Build table with {{!}}
7230 !! wikitext
7231 {{{!}} class="wikitable"
7232 !header
7233 !second header
7234 {{!}}- style="color:red;"
7235 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
7236 {{!}}}
7237 !! html
7238 <table class="wikitable">
7239 <tr>
7240 <th>header
7241 </th>
7242 <th>second header
7243 </th></tr>
7244 <tr style="color:red;">
7245 <td>data</td>
7246 <td style="color:red;">second data
7247 </td></tr></table>
7248
7249 !! end
7250
7251 !! test
7252 Build table with pipe as data
7253 !! wikitext
7254 {| class="wikitable"
7255 !header
7256 !second header
7257 |- style="color:red;"
7258 |data|| style="color:red;" |second data
7259 |-
7260 | style="color:red;" |data with | || style="color:red;" | second data with |
7261 |-
7262 ||data with | |||second data with |
7263 |}
7264 !! html
7265 <table class="wikitable">
7266 <tr>
7267 <th>header
7268 </th>
7269 <th>second header
7270 </th></tr>
7271 <tr style="color:red;">
7272 <td>data</td>
7273 <td style="color:red;">second data
7274 </td></tr>
7275 <tr>
7276 <td style="color:red;">data with |</td>
7277 <td style="color:red;">second data with |
7278 </td></tr>
7279 <tr>
7280 <td>data with |</td>
7281 <td>second data with |
7282 </td></tr></table>
7283
7284 !! end
7285
7286 !! test
7287 Build table with wikilink
7288 !! wikitext
7289 {| class="wikitable"
7290 !header||second header
7291 |- style="color:red;"
7292 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
7293 |-
7294 |data||second data [[Main Page|link|text with pipe]]
7295 |}
7296 !! html
7297 <table class="wikitable">
7298 <tr>
7299 <th>header</th>
7300 <th>second header
7301 </th></tr>
7302 <tr style="color:red;">
7303 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
7304 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7305 </td></tr>
7306 <tr>
7307 <td>data</td>
7308 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7309 </td></tr></table>
7310
7311 !! end
7312
7313 # The expected HTML structure in this test is debatable. The PHP parser does
7314 # not parse this kind of table at all. The main focus for Parsoid is on
7315 # round-tripping, so this output is ok for now. TODO: revisit!
7316 !! test
7317 Wikitext table with html-syntax row
7318 !! wikitext
7319 {|
7320 |-
7321 <td>foo</td>
7322 |}
7323 !! html/parsoid
7324 <table>
7325 <tbody>
7326 <tr>
7327 <td>foo</td></tr></tbody></table>
7328 !! end
7329
7330 ## Remex doesn't account for fostered content.
7331 !! test
7332 Fostered content in tables: Plain text
7333 !! options
7334 parsoid=wt2html
7335 !! wikitext
7336 {|
7337 |-
7338 a
7339 |}
7340 !! html/php
7341 <table>
7342
7343 a
7344 </table>
7345
7346 !! html/php+tidy
7347
7348
7349 a
7350 <table></table>
7351 !! html/parsoid
7352 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
7353 a</p>
7354 <table>
7355 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr></tbody></table>
7356 !! end
7357
7358 !! test
7359 Fostered content in tables: Lists
7360 !! options
7361 parsoid=wt2html,html2html
7362 !! wikitext
7363 {|
7364 |-
7365 *a
7366 |}
7367 !! html/php
7368 <table>
7369
7370 <ul><li>a</li></ul>
7371 </table>
7372
7373 !! html/php+tidy
7374 <ul><li>a</li></ul><table>
7375
7376
7377 </table>
7378 !! html/parsoid
7379 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7380 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7381
7382 </tr></tbody></table>
7383 !! end
7384
7385 !! test
7386 Template generated table cell with attributes
7387 !! wikitext
7388 {|
7389 |-
7390 {{table_attribs_4}} ||a||b
7391 |}
7392 !! html/php+tidy
7393 <table>
7394
7395 <tbody><tr>
7396 <td style="background-color:#DC241f;" width="10px"></td>
7397 <td>a</td>
7398 <td>b
7399 </td></tr></tbody></table>
7400 !! html/parsoid
7401 <table>
7402 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7403 <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>
7404 !! end
7405
7406 !! test
7407 Parsoid: Round-trip tables directly followed by content (T53219)
7408 !! options
7409 parsoid=wt2html,wt2wt
7410 !! wikitext
7411 {|
7412 |foo
7413 |} bar
7414
7415 {|
7416 |baz
7417 |}<b>quux</b>
7418 !! html+tidy
7419 <table>
7420 <tbody><tr>
7421 <td>foo
7422 </td></tr></tbody></table><p> bar
7423 </p><table>
7424 <tbody><tr>
7425 <td>baz
7426 </td></tr></tbody></table><p><b>quux</b>
7427 </p>
7428 !! end
7429
7430 !! test
7431 Parsoid: Default to a newline after tables in new content (T53219)
7432 !! options
7433 parsoid=html2wt
7434 !! html/parsoid
7435 <table><tbody>
7436 <tr><td>foo</td></tr></tbody></table> bar
7437 <table><tbody>
7438 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7439 !! wikitext
7440 {|
7441 |foo
7442 |}
7443 <nowiki> </nowiki>bar
7444 {|
7445 |baz
7446 |}
7447 '''quux'''
7448 !! end
7449
7450 !! test
7451 Parsoid: Row-syntax table headings followed by comment & table cells
7452 !! options
7453 parsoid=wt2html,wt2wt
7454 !! wikitext
7455 {|
7456 !foo||bar
7457 <!-- foo --> ||baz||quux
7458 |}
7459 !! html/php
7460 <table>
7461 <tr>
7462 <th>foo</th>
7463 <th>bar
7464 </th>
7465 <td>baz</td>
7466 <td>quux
7467 </td></tr></table>
7468
7469 !! html/parsoid
7470 <table>
7471 <tbody><tr><th>foo</th><th>bar
7472 <!-- foo --></th><td> baz </td><td>quux</td></tr>
7473 </tbody></table>
7474 !! end
7475
7476 !!test
7477 Parsoid: Recover better from broken table attributes
7478 !!options
7479 parsoid=wt2html
7480 !!wikitext
7481 {| class="foo
7482 | class="bar" |
7483 foo
7484 |}
7485 !!html/php+tidy
7486 <table class="foo">
7487 <tbody><tr>
7488 <td class="bar">
7489 <p>foo
7490 </p>
7491 </td></tr></tbody></table>
7492 !!html/parsoid
7493 <table class="foo">
7494 <tr>
7495 <td class="bar">
7496 <p>foo</p></td></tr>
7497 </tbody></table>
7498 !!end
7499
7500 !! test
7501 Tables: Digest broken attributes on table and tr tag
7502 !! options
7503 parsoid=wt2html
7504 !! wikitext
7505 {| || |} ++
7506 |- || || ++ --
7507 |- > [
7508 |}
7509 !! html
7510 <table>
7511 <tbody>
7512 <tr class='mw-empty-elt'></tr>
7513 <tr class='mw-empty-elt'></tr>
7514 </tbody></table>
7515 !! end
7516
7517 !! test
7518 Table with missing opening <tr> tag
7519 !! options
7520 parsoid=wt2html,wt2wt
7521 !! wikitext
7522 <table>
7523 <td>foo</td>
7524 </tr>
7525 </table>
7526 !! html+tidy
7527 <table>
7528 <tbody><tr><td>foo</td>
7529 </tr>
7530 </tbody></table>
7531 !! end
7532
7533 # T137406: Whitespace in the HTML
7534 !! test
7535 1. Generate correct wikitext for tables with thead/tbody/tfoot
7536 !! options
7537 parsoid=html2wt
7538 !! html/parsoid
7539 <table>
7540 <caption>Test</caption>
7541 <thead>
7542 <tr>
7543 <th>Month</th>
7544 <th>Savings</th>
7545 </tr>
7546 </thead>
7547 <tbody>
7548 <tr>
7549 <td>January</td>
7550 <td>$100</td>
7551 </tr>
7552 <tr>
7553 <td>February</td>
7554 <td>$80</td>
7555 </tr>
7556 </tbody>
7557 <tfoot>
7558 <tr>
7559 <td>Sum</td>
7560 <td>$180</td>
7561 </tr>
7562 </tfoot>
7563 </table>
7564 !! wikitext
7565 {|
7566 |+Test
7567 !Month
7568 !Savings
7569 |-
7570 |January
7571 |$100
7572 |-
7573 |February
7574 |$80
7575 |-
7576 |Sum
7577 |$180
7578 |}
7579 !! html/php+tidy
7580 <table>
7581 <caption>Test
7582 </caption>
7583 <tbody><tr>
7584 <th>Month
7585 </th>
7586 <th>Savings
7587 </th></tr>
7588 <tr>
7589 <td>January
7590 </td>
7591 <td>$100
7592 </td></tr>
7593 <tr>
7594 <td>February
7595 </td>
7596 <td>$80
7597 </td></tr>
7598 <tr>
7599 <td>Sum
7600 </td>
7601 <td>$180
7602 </td></tr></tbody></table>
7603 !! end
7604
7605 # T137406: No whitespace in the HTML
7606 !! test
7607 2. Generate correct wikitext for tables with thead/tbody/tfoot
7608 !! options
7609 parsoid=html2wt
7610 !! html/parsoid
7611 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7612 !! wikitext
7613 {|
7614 !heading
7615 |-
7616 |foo
7617 |}
7618 !! end
7619
7620 !! test
7621 Wikitext tables can be nested inside HTML tables
7622 !! options
7623 parsoid=html2wt
7624 !! html
7625 <table data-parsoid='{"stx":"html"}'>
7626 <tr><td>
7627 <table>
7628 <tr><td>foo</td></tr>
7629 </table>
7630 </td></tr>
7631 </table>
7632 !! wikitext
7633 <table>
7634 <tr><td>
7635 {|
7636 |foo
7637 |}
7638 </td></tr>
7639 </table>
7640 !! end
7641
7642 ###
7643 ### Internal links
7644 ###
7645 !! test
7646 Plain link, capitalized
7647 !! wikitext
7648 [[Main Page]]
7649 !! html
7650 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7651 </p>
7652 !! end
7653
7654 !! test
7655 Plain link, uncapitalized
7656 !! wikitext
7657 [[main Page]]
7658 !! html
7659 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7660 </p>
7661 !! end
7662
7663 !! test
7664 Piped link
7665 !! wikitext
7666 [[Main Page|The Main Page]]
7667 !! html
7668 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7669 </p>
7670 !! end
7671
7672 !! test
7673 Piped link with comment in link text
7674 !! wikitext
7675 [[Main Page|The Main<!--front--> Page]]
7676 !! html
7677 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7678 </p>
7679 !! end
7680
7681 !! test
7682 Piped link with multiple pipe characters in link text
7683 !! wikitext
7684 [[Main Page||The|Main|Page|]]
7685 !! html/php
7686 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7687 </p>
7688 !! html/parsoid
7689 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7690 !! end
7691
7692 !! test
7693 Piped link with no link text
7694 !! wikitext
7695 [[Thomas Bek (bishop of St David's)|]]
7696 !! html/php
7697 <p>[[Thomas Bek (bishop of St David's)|]]
7698 </p>
7699 !! html/parsoid
7700 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7701 !! end
7702
7703 !! test
7704 Piped link with empty link text
7705 !! wikitext
7706 [[Main Page|<nowiki/>]] - empty nowiki
7707 [[Main Page| ]] - empty space
7708 [[Main Page|&nbsp;]] - empty non breaking space
7709 !! html/php
7710 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7711 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7712 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7713 </p>
7714 !! html/parsoid
7715 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7716 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7717 <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>
7718 !! end
7719
7720 !! test
7721 Broken link
7722 !! wikitext
7723 [[Zigzagzogzagzig]]
7724 !! html
7725 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7726 </p>
7727 !! end
7728
7729 !! test
7730 Broken link with fragment
7731 !! wikitext
7732 [[Zigzagzogzagzig#zug]]
7733 !! html
7734 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7735 </p>
7736 !! end
7737
7738 !! test
7739 Special page link with fragment
7740 !! wikitext
7741 [[Special:Version#anchor]]
7742 !! html
7743 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7744 </p>
7745 !! end
7746
7747 !! test
7748 Nonexistent special page link with fragment
7749 !! wikitext
7750 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7751 !! html
7752 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7753 </p>
7754 !! end
7755
7756 !! test
7757 Link with prefix
7758 !! wikitext
7759 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7760 !! html
7761 <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>
7762 </p>
7763 !! end
7764
7765 !! test
7766 Link with suffix
7767 !! wikitext
7768 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7769 !! html
7770 <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>!!!
7771 </p>
7772 !! end
7773
7774 !! article
7775 prefixed article
7776 !! text
7777 Some text
7778 !! endarticle
7779
7780 !! test
7781 T45661: Piped links with identical prefixes
7782 !! wikitext
7783 [[prefixed article|prefixed articles with spaces]]
7784
7785 [[prefixed article|prefixed articlesaoeu]]
7786
7787 [[Main Page|Main Page test]]
7788 !! html
7789 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7790 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7791 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7792 </p>
7793 !! end
7794
7795
7796 !! test
7797 Link with HTML entity in suffix / tail
7798 !! wikitext
7799 [[Main Page]]&quot;, [[Main Page]]&#97;
7800 !! html/php
7801 <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;
7802 </p>
7803 !! html/parsoid
7804 <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>
7805 !! end
7806
7807 !! test
7808 Link with 3 brackets
7809 !! wikitext
7810 [[[Main Page]]]
7811 Foo [[[Main Page]]]
7812 !! html
7813 <p>[[[Main Page]]]
7814 Foo [[[Main Page]]]
7815 </p>
7816 !! end
7817
7818 !! test
7819 Link with 4 brackets
7820 !! wikitext
7821 [[[[Main Page]]]]
7822 !! html
7823 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7824 </p>
7825 !! end
7826
7827 !! test
7828 Piped link with 3 brackets
7829 !! wikitext
7830 [[[main page|the main page]]]
7831 !! html
7832 <p>[[[main page|the main page]]]
7833 </p>
7834 !! end
7835
7836 !! test
7837 Piped link with extlink-like text
7838 !! wikitext
7839 [[Main Page|[bar]]]
7840 [[Main Page|This is a [bar]]]
7841 [[Main Page|[bar]]
7842 !! html/php
7843 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7844 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7845 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7846 </p>
7847 !! html/parsoid
7848 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7849 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7850 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7851 !! end
7852
7853 !! test
7854 Link with multiple pipes
7855 !! wikitext
7856 [[Main Page|The|Main|Page]]
7857 !! html
7858 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7859 </p>
7860 !! end
7861
7862 !! test
7863 Anchor containing a #. (T65430)
7864 !! config
7865 wgFragmentMode=[ 'html5', 'legacy' ]
7866 !! wikitext
7867 [[Main Page#And#Link]]
7868 !! html/php
7869 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7870 </p>
7871 !! html/parsoid
7872 <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>
7873 !! end
7874
7875 !! test
7876 Link to namespaces
7877 !! wikitext
7878 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7879 !! html
7880 <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>
7881 </p>
7882 !! end
7883
7884 !! test
7885 Link with space in namespace
7886 !! wikitext
7887 [[User talk:Foo bar]]
7888 !! html
7889 <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>
7890 </p>
7891 !! end
7892
7893 !! article
7894 MemoryAlpha:AlphaTest
7895 !! text
7896 This is an article in the MemoryAlpha namespace
7897 (which shadows the memoryalpha interwiki link).
7898 !! endarticle
7899
7900 !! test
7901 Namespace takes precedence over interwiki link (T53680)
7902 !! wikitext
7903 [[MemoryAlpha:AlphaTest]]
7904 !! html
7905 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7906 </p>
7907 !! end
7908
7909 # The previous test doesn't work correctly in html2*, due to not recognizing the
7910 # link as an internal one. This one checks for the correct behavior.
7911 !! test
7912 Link to namespace preferred over interwiki with correct rel attribute
7913 !! options
7914 parsoid=html2wt,html2html
7915 !! html/parsoid
7916 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7917 !! wikitext
7918 [[MemoryAlpha:AlphaTest]]
7919 !! end
7920
7921 !! test
7922 Piped link to namespace
7923 !! wikitext
7924 [[Meta:Disclaimers|The disclaimers]]
7925 !! html
7926 <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>
7927 </p>
7928 !! end
7929
7930 !! test
7931 Link containing }
7932 !! wikitext
7933 [[Usually caused by a typo (oops}]]
7934 !! html
7935 <p>[[Usually caused by a typo (oops}]]
7936 </p>
7937 !! end
7938
7939 !! article
7940 7% Solution
7941 !! text
7942 Just a test of an article title containing a percent.
7943 !! endarticle
7944
7945 !! test
7946 Link containing % (not as a hex sequence)
7947 !! wikitext
7948 [[7% Solution]]
7949 [[7% Solution|7%25 Solution]]
7950 !! html/php
7951 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7952 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7953 </p>
7954 !! html/parsoid
7955 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7956 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7957 !! end
7958
7959 # note that the parsoid HTML is identical to the previous test output,
7960 # so the previous test ensures that the html2wt mode will generate the
7961 # "not as a hex sequence" wikitext.
7962 !! test
7963 Link containing % as a single hex sequence interpreted to char
7964 !! options
7965 parsoid=wt2wt,wt2html,html2html
7966 !! wikitext
7967 [[7%25 Solution]]
7968 [[7%25 Solution|7%25 Solution]]
7969 !! html/php
7970 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7971 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7972 </p>
7973 !! html/parsoid
7974 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7975 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7976 !!end
7977
7978 !! test
7979 Link containing % as a double hex sequence interpreted to hex sequence
7980 !! wikitext
7981 [[7%2525 Solution]]
7982 !! html
7983 <p>[[7%2525 Solution]]
7984 </p>
7985 !!end
7986
7987 ## Example for such a section: == < ==
7988 !! test
7989 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7990 !! config
7991 wgFragmentMode=[ 'html5', 'legacy' ]
7992 !! wikitext
7993 [[%23%3c]][[%23%3e]]
7994 !! html/php
7995 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
7996 </p>
7997 !! html/parsoid
7998 <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>
7999 !! end
8000
8001 ## Example for such a section: == < ==
8002 !! test
8003 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
8004 !! config
8005 wgFragmentMode=[ 'legacy' ]
8006 !! wikitext
8007 [[%23%3c]][[%23%3e]]
8008 !! html/php
8009 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
8010 </p>
8011 !! end
8012
8013 !! test
8014 Link containing "<#" and ">#" as a hex sequences
8015 !! wikitext
8016 [[%3c%23]][[%3e%23]]
8017 !! html
8018 <p>[[%3c%23]][[%3e%23]]
8019 </p>
8020 !! end
8021
8022 !! test
8023 Link containing an equals sign
8024 !! wikitext
8025 [[Special:BookSources/isbn=4-00-026157-6]]
8026 !! html/php
8027 <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>
8028 </p>
8029 !! html/parsoid
8030 <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>
8031 !! end
8032
8033 !! article
8034 Foo~bar
8035 !! text
8036 Just a test of an article title containing a tilde.
8037 !! endarticle
8038
8039 # note that links containing signatures, like [[Foo~~~~]], are
8040 # massaged by the pre-save transform (PST) and so the tildes are never
8041 # seen by the parser.
8042 !! test
8043 Link containing a tilde
8044 !! wikitext
8045 [[Foo~bar]]
8046 !! html/php
8047 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
8048 </p>
8049 !! html/parsoid
8050 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
8051 !! end
8052
8053 !! test
8054 Link containing double-single-quotes '' (T6598)
8055 !! wikitext
8056 [[Lista d''e paise d''o munno]]
8057 !! html/php
8058 <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>
8059 </p>
8060 !! html/parsoid
8061 <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>
8062 !! end
8063
8064 !! test
8065 Link containing double quotes and spaces
8066 !! wikitext
8067 [[Cool "Gator"]]
8068 !! html/php
8069 <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>
8070 </p>
8071 !! html/parsoid
8072 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
8073 !! end
8074
8075 !! test
8076 File containing double quotes and spaces
8077 !! wikitext
8078 [[File:Cool "Gator".png]]
8079 !! html/parsoid
8080 <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>
8081 !! end
8082
8083 !! test
8084 Redirect containing double quotes and spaces
8085 !! wikitext
8086 #REDIRECT [[Cool "Gator"]]
8087 !! html/parsoid
8088 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
8089 !! end
8090
8091 !! test
8092 Link containing double-single-quotes '' in text (T6598 sanity check)
8093 !! wikitext
8094 Some [[Link|pretty ''italics'' and stuff]]!
8095 !! html/php
8096 <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>!
8097 </p>
8098 !! html/parsoid
8099 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8100 !! end
8101
8102 !! test
8103 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8104 !! wikitext
8105 ''Some [[Link|pretty ''italics'' and stuff]]!''
8106 !! html
8107 <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>
8108 </p>
8109 !! end
8110
8111 !! test
8112 Link with double quotes in title part (literal) and alternate part (interpreted)
8113 !! wikitext
8114 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8115
8116 [[''Pentecoste'']]
8117
8118 [[''Pentecoste''|Pentecoste]]
8119
8120 [[''Pentecoste''|''Pentecoste'']]
8121 !! html/php
8122 <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>
8123 </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>
8124 </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>
8125 </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>
8126 </p>
8127 !! html/parsoid
8128 <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>
8129 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8130 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8131 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8132 !! end
8133
8134 !! test
8135 Broken image links with HTML captions (T41700)
8136 !! wikitext
8137 [[File:Nonexistent|<script></script>]]
8138 [[File:Nonexistent|100x100px|<script></script>]]
8139 [[File:Nonexistent|&lt;]]
8140 [[File:Nonexistent|a<i>b</i>c]]
8141 !! html/php
8142 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8143 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8144 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8145 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8146 </p>
8147 !! html/parsoid
8148 <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>
8149 <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>
8150 <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>
8151 <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>
8152 !! end
8153
8154 !! test
8155 Plain link to URL
8156 !! wikitext
8157 [[http://www.example.com]]
8158 !! html/php
8159 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8160 </p>
8161 !! html/parsoid
8162 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
8163 !! end
8164
8165 !! test
8166 Plain link to URL with link text
8167 !! wikitext
8168 [[http://www.example.com Link text]]
8169 !! html
8170 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8171 </p>
8172 !! end
8173
8174 !! test
8175 Plain link to protocol-relative URL
8176 !! wikitext
8177 [[//www.example.com]]
8178 !! html/php
8179 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8180 </p>
8181 !! html/parsoid
8182 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8183 !! end
8184
8185 !! test
8186 Plain link to protocol-relative URL with link text
8187 !! wikitext
8188 [[//www.example.com Link text]]
8189 !! html
8190 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8191 </p>
8192 !! end
8193
8194 !! test
8195 Plain link to page with question mark in title
8196 !! wikitext
8197 [[A?b]]
8198
8199 [[A?b|Baz]]
8200 !! html
8201 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8202 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8203 </p>
8204 !! end
8205
8206 # I'm fairly sure the expected result here is wrong.
8207 # We want these to be URL links, not pseudo-pages with URLs for titles....
8208 # However the current output is also pretty screwy.
8209 #
8210 # ----
8211 # I'm changing it to match the current output--it arguably makes more
8212 # sense in the light of the test above. Old expected result was:
8213 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8214 #</p>
8215 # But I think this test is bordering on "garbage in, garbage out" anyway.
8216 # -- wtm
8217 !! test
8218 Piped link to URL
8219 !! wikitext
8220 Piped link to URL: [[http://www.example.com|an example URL]]
8221 !! html/php
8222 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8223 </p>
8224 !! html/parsoid
8225 <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>
8226 !! end
8227
8228 !! test
8229 Plain link in template argument
8230 !! options
8231 parsoid=wt2html
8232 !! wikitext
8233 {{echo|[http://www.example.com |123]}}
8234
8235 {{echo|[[http://www.example.com |123]]}}
8236
8237 {{echo|[[http://www.example.com |123]}}
8238
8239 {{echo|[http://www.example.com |123]]}}
8240 !! html/php
8241 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8242 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8243 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8244 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8245 </p>
8246 !! html/parsoid
8247 <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>
8248
8249 <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>
8250
8251 <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>
8252
8253 <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>
8254 !! end
8255
8256 !! test
8257 T2002: [[page|http://url/]] should link to page, not http://url/
8258 !! wikitext
8259 [[Main Page|http://url/]]
8260 !! html/php
8261 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8262 </p>
8263 !! html/parsoid
8264 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8265 !! end
8266
8267 # Parsoid does not mark self-links, by design.
8268 !! test
8269 T2337: Escaped self-links should be bold
8270 !! options
8271 title=[[Bug462]]
8272 !! wikitext
8273 [[Bu&#103;462]] [[Bug462]]
8274 !! html/php+tidy
8275 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8276 </p>
8277 !! html/parsoid
8278 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8279 !! end
8280
8281 !! test
8282 Self-link to section should not be bold
8283 !! options
8284 title=[[Main Page]]
8285 !! wikitext
8286 [[Main Page#section]]
8287 !! html
8288 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8289 </p>
8290 !! end
8291
8292 !! article
8293 00
8294 !! text
8295 This is 00.
8296 !! endarticle
8297
8298 !!test
8299 Self-link to numeric title
8300 !!options
8301 title=[[0]]
8302 !! wikitext
8303 [[0]]
8304 !! html
8305 <p><a class="mw-selflink selflink">0</a>
8306 </p>
8307 !!end
8308
8309 !!test
8310 Link to numeric-equivalent title
8311 !!options
8312 title=[[0]]
8313 !! wikitext
8314 [[00]]
8315 !! html
8316 <p><a href="/wiki/00" title="00">00</a>
8317 </p>
8318 !!end
8319
8320 !! test
8321 <nowiki> inside a link
8322 !! wikitext
8323 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8324 !! html
8325 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8326 </p>
8327 !! end
8328
8329 !! test
8330 Non-breaking spaces in title
8331 !! wikitext
8332 [[&nbsp; Main &nbsp; Page &nbsp;]]
8333 !! html
8334 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8335 </p>
8336 !!end
8337
8338 # Add new article for the test below so that it doesn't red-link
8339 !! article
8340 Foo bar baz
8341 !! text
8342 boo
8343 !! endarticle
8344
8345 !! test
8346 Multiple spaces in titles should normalize to a single underscore
8347 !! options
8348 parsoid=wt2html,wt2wt
8349 !! wikitext
8350 [[Foo bar baz|x]]
8351 [[Foo bar baz|x]]
8352 [[Foo bar baz|x]]
8353 !! html/php
8354 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8355 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8356 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8357 </p>
8358 !! html/parsoid
8359 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8360 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8361 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8362 </p>
8363 !! end
8364
8365 !! test
8366 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8367 !! options
8368 language=ca
8369 !! wikitext
8370 '''[[Main Page]]'''
8371 !! html
8372 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8373 </p>
8374 !! end
8375
8376 !! test
8377 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8378 !! options
8379 language=ca
8380 !! wikitext
8381 ''[[Main Page]]''
8382 !! html
8383 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8384 </p>
8385 !! end
8386
8387 !! test
8388 Internal link with en linktrail: no apostrophes (T29473)
8389 !! options
8390 language=en
8391 !! wikitext
8392 [[Something]]'nice
8393 !! html
8394 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8395 </p>
8396 !! end
8397
8398 !! test
8399 Internal link with ca linktrail with apostrophes (T29473)
8400 !! options
8401 language=ca
8402 !! wikitext
8403 [[Something]]'nice
8404 !! html
8405 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8406 </p>
8407 !! end
8408
8409 !! test
8410 Internal link with kaa linktrail with apostrophes (T29473)
8411 !! options
8412 language=kaa
8413 !! wikitext
8414 [[Something]]'nice
8415 !! html
8416 <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>
8417 </p>
8418 !! end
8419
8420 !! test
8421 Link with multiple ":" in a subpage-supporting namespace (T65636)
8422 !! wikitext
8423 [[User:Foo/Test/63636:Bar|Test]]
8424 !! html/php
8425 <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>
8426 </p>
8427 !! html/parsoid
8428 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8429 !! end
8430
8431 ## Mainly a sanity check for Parsoid
8432 !! test
8433 Handle title parsing for subpages
8434 !! options
8435 title=[[/123123]]
8436 subpage
8437 !! wikitext
8438 123
8439 !! html/php
8440 <p>123
8441 </p>
8442 !! html/parsoid
8443 <p>123</p>
8444 !! end
8445
8446 !! article
8447 User:Test/123
8448 !! text
8449 test 123
8450 !! endarticle
8451
8452 !! test
8453 Link to a subpage from a namespace other than main
8454 !! options
8455 title=[[User:Test]]
8456 subpage
8457 !! wikitext
8458 [[/123]]
8459 !! html/php
8460 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8461 </p>
8462 !! html/parsoid
8463 <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>
8464 !! end
8465
8466 !! test
8467 Ensure that transclusion titles are not url-decoded
8468 !! options
8469 subpage title=[[Test]]
8470 parsoid=wt2html
8471 !! wikitext
8472 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8473 !! html/php
8474 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8475 </p>
8476 !! html/parsoid
8477 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8478 !! end
8479
8480 !! test
8481 Purely hash wikilink
8482 !! options
8483 title=[[User:Test/123]]
8484 subpage
8485 !! wikitext
8486 [[#a|b]]
8487 !! html/php
8488 <p><a href="#a">b</a>
8489 </p>
8490 !! html/parsoid
8491 <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>
8492 !! end
8493
8494 !! test
8495 Serialization of purely hash wikilink
8496 !! options
8497 title=[[User:Test/123]]
8498 subpage
8499 parsoid=html2wt
8500 !! html/parsoid
8501 <p><a href="#a">[[</a></p>
8502 !! wikitext
8503 [[#a|<nowiki>[[</nowiki>]]
8504 !! html/php
8505 <p><a href="#a">[[</a>
8506 </p>
8507 !! end
8508
8509 !! test
8510 1. Interaction of linktrail and template encapsulation
8511 !! wikitext
8512 {{echo|[[Foo]]}}l
8513 !! html/parsoid
8514 <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>
8515 !! end
8516
8517 !! test
8518 2. Interaction of linktrail and template encapsulation
8519 !! options
8520 parsoid
8521 !! wikitext
8522 {{echo|Some [[Fool]]}}s
8523 !! html
8524 <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>
8525 !! end
8526
8527 !! test
8528 3. Interaction of linktrail and template encapsulation
8529 !! options
8530 parsoid
8531 !! wikitext
8532 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8533 !! html
8534 <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>
8535 !! end
8536
8537 !! article
8538 Söfnuður
8539 !! text
8540 Test.
8541 !! endarticle
8542
8543 !! test
8544 Internal link with is link prefix
8545 !! options
8546 language=is
8547 !! wikitext
8548 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8549 !! html
8550 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8551 </p>
8552 !! end
8553
8554 !! article
8555 Mótmælendatrú
8556 !! text
8557 Test.
8558 !! endarticle
8559
8560 !! test
8561 Internal link with is link trail and link prefix
8562 !! options
8563 language=is
8564 !! wikitext
8565 [[mótmælendatrú|xxx]]ar
8566 [[mótmælendatrú]]ar
8567 mótmælenda[[söfnuður]]
8568 mótmælenda[[söfnuður|söfnuðir]]
8569 mótmælenda[[söfnuður|söfnuðir]]xxx
8570 !! html
8571 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8572 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8573 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8574 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8575 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8576 </p>
8577 !! end
8578
8579 !! test
8580 Parsoid link trail escaping
8581 !! options
8582 parsoid=html2wt,html2html
8583 !! html/parsoid
8584 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8585 !! wikitext
8586 [[apple]]<nowiki/>s
8587 !! end
8588
8589 !! test
8590 Parsoid link prefix escaping
8591 !! options
8592 language=is
8593 parsoid=html2wt,html2html
8594 !! html/parsoid
8595 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8596 !! wikitext
8597 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8598 !! end
8599
8600 !! test
8601 Parsoid link bracket escaping
8602 !! options
8603 parsoid=html2wt,html2html
8604 !! html/parsoid
8605 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8606 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8607 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8608 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8609 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8610 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8611 !! wikitext
8612 [[Test]]
8613
8614 [<nowiki/>[[Test]]]
8615
8616 [[[[Test]]]]
8617
8618 [[[<nowiki/>[[Test]]]]]
8619
8620 [[[[[[Test]]]]]]
8621
8622 [[[[[<nowiki/>[[Test]]]]]]]
8623 !! end
8624
8625 !! test
8626 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8627 !! wikitext
8628 [[Foo| bar]]
8629
8630 [[Foo| ''bar'']]
8631
8632 [http://wp.org foo]
8633
8634 [http://wp.org ''foo'']
8635 !! html
8636 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8637 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8638 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8639 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8640 </p>
8641 !! end
8642
8643 !! test
8644 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8645 !! wikitext
8646 [[Foo|{{echo|a}} b {{echo|c}}]]
8647 !! html/parsoid
8648 <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>
8649 !! end
8650
8651 !! test
8652 Link with angle bracket after anchor
8653 !! config
8654 wgFragmentMode=[ 'html5', 'legacy' ]
8655 !! wikitext
8656 [[Foo#<bar>]]
8657 !! html/php
8658 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8659 </p>
8660 !! html/parsoid
8661 <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>
8662 !! end
8663
8664 !! test
8665 Link with angle bracket after anchor (legacy)
8666 !! config
8667 wgFragmentMode=[ 'legacy' ]
8668 !! wikitext
8669 [[Foo#<bar>]]
8670 !! html/php
8671 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8672 </p>
8673 !! end
8674
8675 ###
8676 ### Interwiki links (see maintenance/interwiki.sql)
8677 ###
8678
8679 !! test
8680 Inline interwiki link
8681 !! options
8682 parsoid=wt2html,wt2wt,html2html
8683 !! wikitext
8684 [[MeatBall:SoftSecurity]]
8685 !! html/php
8686 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8687 </p>
8688 !! html/parsoid
8689 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8690 !! end
8691
8692 !! test
8693 Inline interwiki link with empty title (T4372)
8694 !! options
8695 parsoid=wt2html,wt2wt,html2html
8696 !! wikitext
8697 [[MeatBall:]]
8698 !! html/php
8699 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8700 </p>
8701 !! html/parsoid
8702 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8703 !! end
8704
8705 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8706 !! test
8707 Interwiki link encoding conversion (T3636)
8708 !! options
8709 parsoid=wt2html,wt2wt
8710 !! wikitext
8711 *[[Wikipedia:ro:Olteni&#0355;a]]
8712 *[[Wikipedia:ro:Olteni&#355;a]]
8713 !! html
8714 <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>
8715 <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>
8716
8717 !! html/php+tidy
8718 <ul>
8719 <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>
8720 <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>
8721 </ul>
8722 !! html/parsoid
8723 <ul>
8724 <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>
8725 <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>
8726 </ul>
8727 !! end
8728
8729 !! test
8730 Interwiki link with fragment (T4130)
8731 !! wikitext
8732 [[MeatBall:SoftSecurity#foo]]
8733 !! html
8734 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8735 </p>
8736 !! end
8737
8738 !! test
8739 Link scenarios with escaped fragments
8740 !! config
8741 wgFragmentMode=[ 'html5', 'legacy' ]
8742 !! wikitext
8743 [[#Is this great?]]
8744 [[Foo#Is this great?]]
8745 [[meatball:Foo#Is this great?]]
8746 !! html/php
8747 <p><a href="#Is_this_great?">#Is this great?</a>
8748 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8749 <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>
8750 </p>
8751 !! html/parsoid
8752 <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>
8753 <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>
8754 <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>
8755 !! end
8756
8757 !! test
8758 Link scenarios with escaped fragments (legacy)
8759 !! config
8760 wgFragmentMode=[ 'legacy' ]
8761 !! wikitext
8762 [[#Is this great?]]
8763 [[Foo#Is this great?]]
8764 [[meatball:Foo#Is this great?]]
8765 !! html/php
8766 <p><a href="#Is_this_great.3F">#Is this great?</a>
8767 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8768 <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>
8769 </p>
8770 !! end
8771
8772 # Ideally the wikipedia: prefix here should be proto-relative too
8773 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8774 # define the 'en' prefix, and originally the test used 'wikipedia',
8775 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8776 # article.
8777 !! test
8778 Different interwiki prefixes mapping to the same URL
8779 !! wikitext
8780 [[:en:Foo]]
8781
8782 [[:en:Foo|Foo]]
8783
8784 [[wikipedia:Foo]]
8785
8786 [[:wikipedia:Foo|Foo]]
8787
8788 [[wikipedia:en:Foo]]
8789
8790 [[:wikipedia:en:Foo]]
8791
8792 [[ wikiPEdia :Foo]]
8793 !! html/parsoid
8794 <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>
8795
8796 <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>
8797
8798 <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>
8799
8800 <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>
8801
8802 <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>
8803
8804 <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>
8805
8806 <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>
8807 !! end
8808
8809 !! test
8810 Interwiki links that cannot be represented in wiki syntax
8811 !! wikitext
8812 [[meatball:ok]]
8813 [[meatball:ok#foo|ok with fragment]]
8814 [[meatball:ok_as_well?|ok ending with ? mark]]
8815 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8816 [http://de.wikipedia.org/wiki/#foo is just fragment]
8817
8818 !! html/php
8819 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8820 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8821 <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>
8822 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8823 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8824 </p>
8825 !! html/parsoid
8826 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8827 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8828 <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>
8829 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8830 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8831 !! end
8832
8833 !! test
8834 Interwiki links: trail
8835 !! wikitext
8836 [[wikipedia:Foo|Ba]]r
8837 !! html/php
8838 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8839 </p>
8840 !! html/parsoid
8841 <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>
8842 !! end
8843
8844 !! test
8845 Local interwiki link
8846 !! options
8847 parsoid=wt2html,wt2wt,html2html
8848 !! wikitext
8849 [[local:Template:Foo]]
8850 !! html/php
8851 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8852 </p>
8853 !! html/parsoid
8854 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8855 !! end
8856
8857 # Parsoid does not mark self-links, by design.
8858 !! test
8859 Local interwiki link: self-link to current page
8860 !! options
8861 title=[[Main Page]]
8862 parsoid=wt2html,wt2wt,html2html
8863 !! wikitext
8864 [[local:Main Page]]
8865 !! html/php
8866 <p><a class="mw-selflink selflink">local:Main Page</a>
8867 </p>
8868 !! html/parsoid
8869 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8870 !! end
8871
8872 !! test
8873 Local interwiki link: prefix only (T66167)
8874 !! options
8875 parsoid=wt2html,wt2wt,html2html
8876 !! wikitext
8877 [[local:]]
8878 !! html/php
8879 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8880 </p>
8881 !! html/parsoid
8882 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8883 !! end
8884
8885 !! test
8886 Local interwiki link: with additional interwiki prefix (T63357)
8887 !! options
8888 parsoid=wt2html,wt2wt,html2html
8889 !! wikitext
8890 [[local:meatball:Hello]]
8891 !! html/php
8892 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8893 </p>
8894 !! html/parsoid
8895 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8896 !! end
8897
8898 !! test
8899 Multiple local interwiki link prefixes
8900 !! wikitext
8901 [[local:local:local:local:mi:local:Foo]]
8902 !! options
8903 parsoid=wt2html,wt2wt,html2html
8904 !! html/php
8905 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8906 </p>
8907 !! html/parsoid
8908 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8909 !! end
8910
8911 ###
8912 ### Interlanguage links
8913 ### Language links (so that searching for '### language' matches..)
8914 ###
8915
8916 !! test
8917 Interlanguage link
8918 !! wikitext
8919 Blah blah blah
8920 [[zh:Chinese]]
8921 !! html/php
8922 <p>Blah blah blah
8923 </p>
8924 !! html/parsoid
8925 <p>Blah blah blah</p>
8926 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8927 !! end
8928
8929 ## parsoid html2wt will lose the space variations
8930 !! test
8931 Interlanguage link with spacing
8932 !! options
8933 parsoid=wt2html,wt2wt,html2html
8934 !! wikitext
8935 Blah blah blah
8936 [[ zh : Chinese ]]
8937 !! html/php
8938 <p>Blah blah blah
8939 </p>
8940 !! html/parsoid
8941 <p>Blah blah blah</p>
8942 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8943 !! end
8944
8945 !! test
8946 Double interlanguage link
8947 !! wikitext
8948 Blah blah blah
8949 [[es:Spanish]]
8950 [[zh:Chinese]]
8951 !! html/php
8952 <p>Blah blah blah
8953 </p>
8954 !! html/parsoid
8955 <p>Blah blah blah</p>
8956 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8957 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8958 !! end
8959
8960 ## parsoid html2wt will lose the space variations
8961 !! test
8962 Interlanguage link variations
8963 !! options
8964 parsoid=wt2html,wt2wt,html2html
8965 !! wikitext
8966 Blah blah blah
8967 [[ es :Spanish]]
8968 [[ ZH :Chinese]]
8969 [[es:Foo_bar]]
8970 !! html/php
8971 <p>Blah blah blah
8972 </p>
8973 !! html/parsoid
8974 <p>Blah blah blah</p>
8975 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8976 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8977 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8978 !! end
8979
8980 !! test
8981 Escaping of interlanguage links (T129218, T156308)
8982 !! wikitext
8983 Blah blah blah
8984 [[:es:Spanish]]
8985 [[ : zh : Chinese ]]
8986 !! html/php
8987 <p>Blah blah blah
8988 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8989 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8990 </p>
8991 !! html/parsoid
8992 <p>Blah blah blah
8993 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8994 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8995 !! end
8996
8997 !! test
8998 Multiple colons escaping interlanguage links
8999 !! options
9000 parsoid=wt2html
9001 !! wikitext
9002 [[:es:Spanish]]
9003 [[::es:Spanish]]
9004 [[:::es:Spanish]]
9005 !! html/php
9006 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9007 [[::es:Spanish]]
9008 [[:::es:Spanish]]
9009 </p>
9010 !! html/parsoid
9011 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9012 [[::es:Spanish]]
9013 [[:::es:Spanish]]</p>
9014 !! end
9015
9016 ## parsoid html2wt will normalize the space to _
9017 !! test
9018 Space and question mark encoding in interlanguage links (T95473)
9019 !! options
9020 parsoid=wt2html,wt2wt,html2html
9021 !! wikitext
9022 Blah blah blah
9023 [[es:Foo bar?]]
9024 !! html/php
9025 <p>Blah blah blah
9026 </p>
9027 !! html/parsoid
9028 <p>Blah blah blah</p>
9029 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
9030 !! end
9031
9032 !! test
9033 Interlanguage link, with prefix links
9034 !! options
9035 language=ln
9036 !! wikitext
9037 Blah blah blah
9038 [[zh:Chinese]]
9039 !! html/php
9040 <p>Blah blah blah
9041 </p>
9042 !! html/parsoid
9043 <p>Blah blah blah</p>
9044 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9045 !! end
9046
9047 !! test
9048 Double interlanguage link, with prefix links (T10897)
9049 !! options
9050 language=ln
9051 !! wikitext
9052 Blah blah blah
9053 [[es:Spanish]]
9054 [[zh:Chinese]]
9055 !! html/php
9056 <p>Blah blah blah
9057 </p>
9058 !! html/parsoid
9059 <p>Blah blah blah</p>
9060 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9061 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9062 !! end
9063
9064 !! test
9065 "Extra" interlanguage links (T34189 / gerrit 111390)
9066 !! wikitext
9067 Blah blah blah
9068 [[mul:Article]]
9069 !! html/php
9070 <p>Blah blah blah
9071 </p>
9072 !! html/parsoid
9073 <p>Blah blah blah</p>
9074 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
9075 !! end
9076
9077 ## PHP parser tests script needs an update
9078 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9079 !! test
9080 Language links render as inline links if $wgInterwikiMagic=false
9081 !! options
9082 wgInterwikiMagic=false
9083 parsoid=wt2html,wt2wt,html2html
9084 !! wikitext
9085 Blah blah blah
9086 [[zh:Chinese]]
9087 !! html/parsoid
9088 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9089 !! end
9090
9091 ## PHP parser tests script needs an update
9092 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9093 !! test
9094 Language links render as inline links in the Talk namespace
9095 !! options
9096 title=Talk:Foo
9097 parsoid=wt2html,wt2wt,html2html
9098 !! wikitext
9099 Blah blah blah
9100 [[zh:Chinese]]
9101 !! html/parsoid
9102 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9103 !! end
9104
9105 !! test
9106 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
9107 !! options
9108 language=ln
9109 !! wikitext
9110 [[WW&nbsp;II]]
9111 !! html
9112 <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>
9113 </p>
9114 !! end
9115
9116 !! test
9117 Parsoid T55221: Wikilinks should be properly entity-escaped
9118 !! options
9119 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
9120 !! html/parsoid
9121 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9122 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9123 !! wikitext
9124 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
9125
9126 He&amp;nbsp;llo He&amp;nbsp;llo
9127 !! html/php
9128 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
9129 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
9130 </p>
9131 !! end
9132
9133 # html2wt will fail because of title normalization without data-parsoid
9134 !! test
9135 Parsoid: handle constructor well
9136 !! options
9137 parsoid=wt2html,wt2wt
9138 !! wikitext
9139 [[constructor]]
9140
9141 [[constructor:foo]]
9142 !! html/php
9143 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9144 </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>
9145 </p>
9146 !! html/parsoid
9147 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9148
9149 <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>
9150 !! end
9151
9152 !! test
9153 Template parameter named "constructor"
9154 !! wikitext
9155 {{echo| constructor = |hi}}
9156 !! html/parsoid
9157 <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>
9158 !! end
9159
9160 !! article
9161 ko:
9162 !! text
9163 Test.
9164 !! endarticle
9165
9166 # Note that `ko` isn't a known interlanguage prefix
9167 !! test
9168 Parsoid: recognize interlanguage links without a target page
9169 !! options
9170 ill
9171 !! wikitext
9172 [[es:]]
9173
9174 [[ko:]]
9175 !! html/php
9176 es:
9177 !! html/parsoid
9178 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9179
9180 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9181 !! end
9182
9183 # Note that `ko` isn't a known interwiki prefix
9184 !! test
9185 Parsoid: recognize interwiki links without a target page
9186 !! options
9187 parsoid=wt2html,wt2wt,html2html
9188 !! wikitext
9189 [[:es:]]
9190
9191 [[:ko:]]
9192 !! html/php
9193 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9194 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9195 </p>
9196 !! html/parsoid
9197 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9198 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9199 !! end
9200
9201 !! test
9202 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9203 !! wikitext
9204 [[mi:Foo]]
9205 !! html/php
9206 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9207 </p>
9208 !! html/parsoid
9209 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9210 !! end
9211
9212 !! test
9213 Interlanguage link with preceding local interwiki link (T70085)
9214 !! options
9215 parsoid=wt2html,wt2wt,html2html
9216 !! wikitext
9217 Blah blah blah
9218 [[local:es:Spanish]]
9219 !! html/php
9220 <p>Blah blah blah
9221 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9222 </p>
9223 !! html/parsoid
9224 <p>Blah blah blah
9225 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9226 !! end
9227
9228 !! test
9229 Looks like an interlanguage link, but is actually a local interwiki
9230 !! options
9231 parsoid=wt2html,wt2wt,html2html
9232 !! wikitext
9233 Blah blah blah
9234 [[mi:Template:Foo]]
9235 !! html/php
9236 <p>Blah blah blah
9237 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9238 </p>
9239 !! html/parsoid
9240 <p>Blah blah blah
9241 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9242 !! end
9243
9244 ###
9245 ### Redirects, Parsoid-only
9246 ###
9247
9248 !! test
9249 1. Simple redirect to page
9250 !! wikitext
9251 #REDIRECT [[Main Page]]
9252 !! html/parsoid
9253 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9254 !! end
9255
9256 !! test
9257 2. Other redirect variants
9258 !! wikitext
9259 #REDIRECT [[Main_Page]]
9260 !! html/parsoid
9261 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9262 !! end
9263
9264 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9265 # This tests the Parsoid bail-out code.
9266 !! test
9267 3. Other redirect variants
9268 !! options
9269 parsoid=wt2html
9270 !! wikitext
9271 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9272 !! html/parsoid
9273 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9274 !! end
9275
9276 !! test
9277 4. Redirect to a templated destination
9278 !! wikitext
9279 #REDIRECT [[{{echo|Foo}}bar]]
9280 !! html/parsoid
9281 <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"}]]}'/>
9282 !! end
9283
9284 !! test
9285 Empty redirect
9286 !! options
9287 parsoid=wt2html,wt2wt
9288 !! wikitext
9289 #REDIRECT [[]]
9290 !! html/parsoid
9291 <ol>
9292 <li>REDIRECT [[]]</li></ol>
9293 !! end
9294
9295 !! test
9296 Optional colon in #REDIRECT
9297 !! options
9298 # the colon is archaic syntax. we support it for wt2html, but we
9299 # don't care that it roundtrips back to the modern syntax.
9300 parsoid=wt2html,html2html
9301 !! wikitext
9302 #REDIRECT:[[Main Page]]
9303 !! html/parsoid
9304 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9305 !! end
9306
9307 !! test
9308 Whitespace in #REDIRECT with optional colon
9309 !! options
9310 # the colon and gratuitous whitespace is archaic syntax. we support
9311 # it for wt2html, but we don't care that it roundtrips back to the
9312 # modern syntax (without extra whitespace)
9313 parsoid=wt2html,html2html
9314 !! wikitext
9315
9316 #REDIRECT
9317 :
9318 [[Main Page]]
9319 !! html/parsoid
9320 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9321 !! end
9322
9323 !! test
9324 Piped link in #REDIRECT
9325 !! options
9326 # content after piped link is ignored. we support this syntax,
9327 # but don't care that the piped link is lost when we roundtrip this.
9328 parsoid=wt2html
9329 !! wikitext
9330 #REDIRECT [[Main Page|bar]]
9331 !! html/parsoid
9332 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9333 !! end
9334
9335 !! test
9336 Redirect to category (T104502)
9337 !! options
9338 parsoid=wt2html,wt2wt
9339 !! wikitext
9340 #REDIRECT [[Category:Foo]]
9341 !! html/parsoid
9342 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9343 !! end
9344
9345 !! test
9346 Redirect to category with URL encoding (T104502)
9347 !! options
9348 parsoid=wt2html
9349 !! wikitext
9350 #REDIRECT [[Category%3AFoo]]
9351 !! html/parsoid
9352 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9353 !! end
9354
9355 !! test
9356 Redirect to category page
9357 !! wikitext
9358 #REDIRECT [[:Category:Foo]]
9359 !! html/parsoid
9360 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9361 !! end
9362
9363 !! test
9364 Redirect to image page (1)
9365 !! wikitext
9366 #REDIRECT [[File:Wiki.png]]
9367 !! html/parsoid
9368 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9369 !! end
9370
9371 !! test
9372 Redirect to image page (2)
9373 !! wikitext
9374 #REDIRECT [[Image:Wiki.png]]
9375 !! html/parsoid
9376 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9377 !! end
9378
9379 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9380 # Next test confirms this.
9381 !! test
9382 Redirect to language (1) (T104918)
9383 !! options
9384 parsoid=wt2html,wt2wt,html2html
9385 !! wikitext
9386 #REDIRECT [[en:File:Wiki.png]]
9387 !! html/parsoid
9388 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9389 !! end
9390
9391 !! test
9392 Redirect to language (2) (T104918)
9393 !! wikitext
9394 #REDIRECT [[:en:File:Wiki.png]]
9395 !! html/parsoid
9396 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9397 !! end
9398
9399 !! test
9400 Redirect to interwiki (T104918)
9401 !! wikitext
9402 #REDIRECT [[meatball:File:Wiki.png]]
9403 !! html/parsoid
9404 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9405 !! end
9406
9407 !! test
9408 Non-English #REDIRECT
9409 !! options
9410 language=is
9411 !! wikitext
9412 #TILVÍSUN [[Main Page]]
9413 !! html/parsoid
9414 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9415 !! end
9416
9417 !! test
9418 Redirect syntax under text isn't considered a redirect
9419 !! wikitext
9420 some text
9421
9422 #redirect [[Main Page]]
9423 !! html/parsoid
9424 <p>some text</p>
9425 <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>
9426 !! end
9427
9428 !! test
9429 New redirect
9430 !! options
9431 parsoid=html2wt
9432 !! html/parsoid
9433 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9434 !! wikitext
9435 #REDIRECT [[Foo]]
9436 Foo
9437 !! end
9438
9439 !! test
9440 Redirect followed by block on the same line
9441 !! options
9442 parsoid=wt2html
9443 !! wikitext
9444 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9445 !! html/parsoid
9446 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9447 !! end
9448
9449 !! test
9450 Redirect followed by a newline
9451 !! wikitext
9452 #REDIRECT [[Main Page]]
9453 A newline
9454 !! html/parsoid
9455 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9456 <p>A newline</p>
9457 !! end
9458
9459 !! test
9460 Redirect followed by multiple newlines
9461 !! wikitext
9462 #REDIRECT [[Main Page]]
9463
9464
9465 A newline
9466 !! html/parsoid
9467 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9468
9469 <p><br/>
9470 A newline</p>
9471 !! end
9472
9473 !! test
9474 Drop duplicate redirects
9475 !! options
9476 parsoid=html2wt
9477 !! html/parsoid
9478 <link rel="mw:PageProp/redirect" href="./Foo"/>
9479 <link rel="mw:PageProp/redirect" href="./Bar"/>
9480 <link rel="mw:PageProp/redirect" href="./Baz"/>
9481 !! wikitext
9482 #REDIRECT [[Foo]]
9483 !! end
9484
9485 ##
9486 ## XHTML tidiness
9487 ###
9488
9489 !! test
9490 <br> to <br />
9491 !! wikitext
9492 1<br>2<br />3
9493 !! html
9494 <p>1<br />2<br />3
9495 </p>
9496 !! end
9497
9498 !! test
9499 Broken br tag sanitization
9500 !! wikitext
9501 </br>
9502 !! html/php
9503 <p>&lt;/br&gt;
9504 </p>
9505 !! end
9506
9507 # TODO: Fix html2html mode (T53055)!
9508 !! test
9509 Parsoid: Broken br tag recognition
9510 !! options
9511 parsoid=wt2html
9512 !! wikitext
9513 </br>
9514
9515 <br/ >
9516 !! html+tidy
9517 <p><br />
9518 </p><p><br />
9519 </p>
9520 !! end
9521
9522 !! test
9523 Incorrecly removing closing slashes from correctly formed XHTML
9524 !! wikitext
9525 <br style="clear:both;" />
9526 !! html
9527 <p><br style="clear:both;" />
9528 </p>
9529 !! end
9530
9531 !! test
9532 Failing to transform badly formed HTML into correct XHTML
9533 !! wikitext
9534 <br style="clear: left;">
9535 <br style="clear: right;">
9536 <br style="clear: both;">
9537 !! html
9538 <p><br style="clear: left;" />
9539 <br style="clear: right;" />
9540 <br style="clear: both;" />
9541 </p>
9542 !!end
9543
9544 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9545 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9546 !! test
9547 Handling html with a div self-closing tag
9548 !! wikitext
9549 <div title />
9550 <div title/>
9551 <div title/ >
9552 <div title=bar />
9553 <div title=bar/>
9554 <div title=bar/ >
9555 !! html/php
9556 <p>&lt;div title /&gt;
9557 &lt;div title/&gt;
9558 </p>
9559 <div>
9560 <p>&lt;div title=bar /&gt;
9561 &lt;div title=bar/&gt;
9562 </p>
9563 <div title="bar/"></div>
9564 </div>
9565
9566 !! html/parsoid
9567 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9568 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9569 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9570 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9571 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9572 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9573 !! end
9574
9575 !! test
9576 Handling html with a br self-closing tag
9577 !! wikitext
9578 <br title />
9579 <br title/>
9580 <br title/ >
9581 <br title=bar />
9582 <br title=bar/>
9583 <br title=bar/ >
9584 !! html/php
9585 <p><br title="" />
9586 <br title="" />
9587 <br />
9588 <br title="bar" />
9589 <br title="bar" />
9590 <br title="bar/" />
9591 </p>
9592 !! html/parsoid
9593 <p><br title="" />
9594 <br title="" />
9595 <br title="" />
9596 <br title="bar" />
9597 <br title="bar" />
9598 <br title="bar/" />
9599 </p>
9600 !! end
9601
9602 !! test
9603 Horizontal ruler (should it add that extra space?)
9604 !! wikitext
9605 <hr>
9606 <hr >
9607 foo <hr
9608 > bar
9609 !! html+tidy
9610 <hr />
9611 <hr /><p>
9612 foo </p><hr /><p> bar
9613 </p>
9614 !! end
9615
9616 !! test
9617 Horizontal ruler -- 4+ dashes render hr
9618 !! wikitext
9619 ----
9620 !! html
9621 <hr />
9622
9623 !! end
9624
9625 !! test
9626 Horizontal ruler -- eats additional dashes on the same line
9627 !! wikitext
9628 ---------
9629 !! html
9630 <hr />
9631
9632 !! end
9633
9634 !! test
9635 Horizontal ruler -- does not collapse dashes on consecutive lines
9636 !! wikitext
9637 ----
9638 ----
9639 !! html
9640 <hr />
9641 <hr />
9642
9643 !! end
9644
9645 !! test
9646 Horizontal ruler -- <4 dashes render as plain text
9647 !! wikitext
9648 ---
9649 !! html
9650 <p>---
9651 </p>
9652 !! end
9653
9654 !! test
9655 Horizontal ruler -- Supports content following dashes on same line
9656 !! wikitext
9657 ---- Foo
9658 !! html
9659 <hr /> Foo
9660
9661 !! html+tidy
9662 <hr /><p> Foo
9663 </p>
9664 !! end
9665
9666 ###
9667 ### Block-level elements
9668 ###
9669 !! test
9670 Common list
9671 !! wikitext
9672 *Common list
9673 *item 2
9674 *item 3
9675 !! html
9676 <ul><li>Common list</li>
9677 <li>item 2</li>
9678 <li>item 3</li></ul>
9679
9680 !! end
9681
9682 !! test
9683 Numbered list
9684 !! wikitext
9685 #Numbered list
9686 #item 2
9687 #item 3
9688 !! html
9689 <ol><li>Numbered list</li>
9690 <li>item 2</li>
9691 <li>item 3</li></ol>
9692
9693 !! end
9694
9695 # the switch from level 3 to ordered should not introduce a newline between
9696 !! test
9697 Mixed list
9698 !! wikitext
9699 *Mixed list
9700 *#with numbers
9701 **and bullets
9702 *#and numbers
9703 *bullets again
9704 **bullet level 2
9705 ***bullet level 3
9706 ***#Number on level 4
9707 **bullet level 2
9708 **#Number on level 3
9709 **#Number on level 3
9710 *#number level 2
9711 *Level 1
9712 ***Level 3
9713 #**Level 3, but ordered
9714 !! html
9715 <ul><li>Mixed list
9716 <ol><li>with numbers</li></ol>
9717 <ul><li>and bullets</li></ul>
9718 <ol><li>and numbers</li></ol></li>
9719 <li>bullets again
9720 <ul><li>bullet level 2
9721 <ul><li>bullet level 3
9722 <ol><li>Number on level 4</li></ol></li></ul></li>
9723 <li>bullet level 2
9724 <ol><li>Number on level 3</li>
9725 <li>Number on level 3</li></ol></li></ul>
9726 <ol><li>number level 2</li></ol></li>
9727 <li>Level 1
9728 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9729 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9730
9731 !! end
9732
9733 !! test
9734 1. Nested mixed wikitext and html list
9735 !! wikitext
9736 *hi
9737 *<ul><li>ho</li></ul>
9738 *hi
9739 **ho
9740 !! html/php
9741 <ul><li>hi</li>
9742 <li><ul><li>ho</li></ul></li>
9743 <li>hi
9744 <ul><li>ho</li></ul></li></ul>
9745
9746 !! html/parsoid
9747 <ul><li>hi</li>
9748 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9749 <li>hi
9750 <ul><li>ho</li></ul></li></ul>
9751 !! end
9752
9753 !! test
9754 2. Nested mixed wikitext and html list (incompatible)
9755 !! wikitext
9756 ;hi
9757 :{{echo|<li>ho</li>}}
9758 !! html/php
9759 <dl><dt>hi</dt>
9760 <dd><li>ho</li></dd></dl>
9761
9762 !! html/parsoid
9763 <dl><dt>hi</dt>
9764 <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>
9765 !! end
9766
9767 !! test
9768 Nested lists 1
9769 !! wikitext
9770 *foo
9771 **bar
9772 !! html
9773 <ul><li>foo
9774 <ul><li>bar</li></ul></li></ul>
9775
9776 !! end
9777
9778 !! test
9779 Nested lists 2
9780 !! wikitext
9781 **foo
9782 *bar
9783 !! html
9784 <ul><li><ul><li>foo</li></ul></li>
9785 <li>bar</li></ul>
9786
9787 !! end
9788
9789 !! test
9790 Nested lists 3 (first element empty)
9791 !! wikitext
9792 *
9793 **bar
9794 !! html
9795 <ul><li>
9796 <ul><li>bar</li></ul></li></ul>
9797
9798 !! end
9799
9800 !! test
9801 Nested lists 4 (first element empty)
9802 !! wikitext
9803 **
9804 *bar
9805 !! html
9806 <ul><li><ul><li></li></ul></li>
9807 <li>bar</li></ul>
9808
9809 !! end
9810
9811 !! test
9812 Nested lists 5 (both elements empty)
9813 !! wikitext
9814 **
9815 *
9816 !! html
9817 <ul><li><ul><li></li></ul></li>
9818 <li></li></ul>
9819
9820 !! end
9821
9822 !! test
9823 Nested lists 6 (both elements empty)
9824 !! wikitext
9825 *
9826 **
9827 !! html
9828 <ul><li>
9829 <ul><li></li></ul></li></ul>
9830
9831 !! end
9832
9833 !! test
9834 Nested lists 7 (skip initial nesting levels)
9835 !! wikitext
9836 ***foo
9837 !! html
9838 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9839
9840 !! end
9841
9842 !! test
9843 Nested lists 8 (multiple nesting transitions)
9844 !! wikitext
9845 *foo
9846 ***bar
9847 **baz
9848 *boo
9849 !! html
9850 <ul><li>foo
9851 <ul><li><ul><li>bar</li></ul></li>
9852 <li>baz</li></ul></li>
9853 <li>boo</li></ul>
9854
9855 !! end
9856
9857 !! test
9858 Nested lists 9 (extension interaction)
9859 !! options
9860 parsoid
9861 !! wikitext
9862 *<references />
9863 !! html/parsoid
9864 <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>
9865 !! end
9866
9867 !! test
9868 1. Lists with start-of-line-transparent tokens before bullets: Comments
9869 !! wikitext
9870 *foo
9871 *<!--cmt-->bar
9872 <!--cmt-->*baz
9873 !! html
9874 <ul><li>foo</li>
9875 <li>bar</li>
9876 <li>baz</li></ul>
9877
9878 !! end
9879
9880 !! test
9881 Nested lists 10 (list and span siblings: wt2wt regression)
9882 !! wikitext
9883 *a <span>x</span>
9884 **b <span>y</span>
9885 !! html/parsoid
9886 <ul><li>a <span>x</span>
9887 <ul><li>b <span>y</span></li></ul></li></ul>
9888 !! end
9889
9890 !! test
9891 2. Lists with start-of-line-transparent tokens before bullets: Template close
9892 !! wikitext
9893 *foo {{echo|bar
9894 }}*baz
9895 !! html
9896 <ul><li>foo bar</li>
9897 <li>baz</li></ul>
9898
9899 !! end
9900
9901 !! test
9902 List items are not parsed correctly following a <pre> block (T2785)
9903 !! wikitext
9904 *<pre>foo</pre>
9905 *<pre>bar</pre>
9906 *zar
9907 !! html/php
9908 <ul><li><pre>foo</pre></li>
9909 <li><pre>bar</pre></li>
9910 <li>zar</li></ul>
9911
9912 !! html/parsoid
9913 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9914 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9915 <li>zar</li></ul>
9916 !! end
9917
9918 # FIXME: Might benefit from a html/parsoid since this has a template
9919 !! test
9920 List items from template
9921 !! wikitext
9922
9923 {{inner list}}
9924 *item 2
9925
9926 *item 0
9927 {{inner list}}
9928 *item 2
9929
9930 *item 0
9931 *notSOL{{inner list}}
9932 *item 2
9933 !! html
9934 <ul><li>item 1</li>
9935 <li>item 2</li></ul>
9936 <ul><li>item 0</li>
9937 <li>item 1</li>
9938 <li>item 2</li></ul>
9939 <ul><li>item 0</li>
9940 <li>notSOL</li>
9941 <li>item 1</li>
9942 <li>item 2</li></ul>
9943
9944 !! end
9945
9946 !! test
9947 List interrupted by empty line or heading
9948 !! wikitext
9949 *foo
9950
9951 **bar
9952 ==A heading==
9953 *Another list item
9954 !! html
9955 <ul><li>foo</li></ul>
9956 <ul><li><ul><li>bar</li></ul></li></ul>
9957 <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>
9958 <ul><li>Another list item</li></ul>
9959
9960 !!end
9961
9962 !! test
9963 Multiple list tags generated by templates
9964 !! wikitext
9965 {{echo|<li>}}a
9966 {{echo|<li>}}b
9967 {{echo|<li>}}c
9968 !! html
9969 <li>a
9970 <li>b
9971 <li>c</li>
9972 </li>
9973 </li>
9974
9975
9976 !! html+tidy
9977 <li>a
9978 </li><li>b
9979 </li><li>c
9980 </li>
9981 !! html/parsoid
9982 <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
9983 </li><li about="#mwt1">b
9984 </li><li about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[null,44,null,0]}'>c</li>
9985 !! end
9986
9987 !! test
9988 Multiple newlines in between HTML list items don't induce paragraph wrapping
9989 !! wikitext
9990 <ul>
9991 <li>hi</li>
9992
9993
9994
9995
9996 <li>ho</li>
9997 </ul>
9998
9999 <dl>
10000 <dt>hi</dt>
10001 <dd>ho<div>123</div>
10002 </dd>
10003
10004
10005 </dl>
10006 !! html/php+tidy
10007 <ul>
10008 <li>hi</li>
10009
10010
10011
10012
10013 <li>ho</li>
10014 </ul>
10015 <dl>
10016 <dt>hi</dt>
10017 <dd>ho<div>123</div>
10018 </dd>
10019
10020
10021 </dl>
10022 !! end
10023
10024 !!test
10025 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
10026 !! wikitext
10027 *a
10028 <!--This line will NOT split the list-->
10029 *b
10030 <!--This line will NOT split the list either-->
10031 *c
10032 <!--foo--> <!----> <!--This line NOT split the list either-->
10033 *d
10034 !! html
10035 <ul><li>a</li>
10036 <li>b</li>
10037 <li>c</li>
10038 <li>d</li></ul>
10039
10040 !!end
10041
10042 !!test
10043 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
10044 !! wikitext
10045 *a
10046 <!--This line will NOT split the list-->
10047 *b
10048 <!--This line will NOT split the list either-->
10049 *c
10050 <!--foo--> <!----> <!--This line NOT split the list
10051 either-->
10052 *d
10053 !! html
10054 <ul><li>a</li>
10055 <li>b</li>
10056 <li>c</li>
10057 <li>d</li></ul>
10058
10059 !!end
10060
10061 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
10062 # That pass could possibly be removed.
10063 !!test
10064 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
10065 !!options
10066 parsoid=wt2html,wt2wt
10067 !! wikitext
10068 *foo
10069 *<li>li-hack
10070 *{{echo|<li>templated li-hack}}
10071 *<!--foo--><li> unsupported li-hack with preceding comments
10072
10073 <ul>
10074 <li><li>not a li-hack
10075 </li>
10076 </ul>
10077 !! html+tidy
10078 <ul><li>foo</li>
10079 <li class="mw-empty-elt"></li><li>li-hack</li>
10080 <li class="mw-empty-elt"></li><li>templated li-hack</li>
10081 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
10082 <ul>
10083 <li class="mw-empty-elt"></li><li>not a li-hack
10084 </li>
10085 </ul>
10086 !! html/parsoid
10087 <ul><li> foo</li>
10088 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
10089 <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>
10090 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
10091
10092 <ul data-parsoid='{"stx":"html"}'>
10093 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
10094 </li>
10095 </ul>
10096
10097 !!end
10098
10099 !! test
10100 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
10101 !! options
10102 parsoid
10103 !! wikitext
10104 #foo
10105 ##bar
10106
10107 *foo
10108 **bar
10109
10110 :foo
10111 ::bar
10112 !! html
10113 <ol>
10114 <li>foo<ol>
10115 <li>bar</li>
10116 </ol></li>
10117 </ol><ul>
10118 <li>foo<ul>
10119 <li>bar</li>
10120 </ul></li>
10121 </ul><dl>
10122 <dd>foo<dl>
10123 <dd>bar</dd>
10124 </dl></dd>
10125 </dl>
10126 !! end
10127
10128 !! test
10129 Parsoid: Test of whitespace serialization with Templated bullets
10130 !! options
10131 parsoid=wt2html
10132 !! wikitext
10133 * {{bullet}}
10134 !! html/parsoid
10135 <ul>
10136 <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>
10137 </ul>
10138 !! end
10139
10140 # ------------------------------------------------------------------------
10141 # The next set of tests are about Parsoid's ability to handle badly nested
10142 # tags (parse, minimize scope of fixup, and roundtrip back)
10143 # ------------------------------------------------------------------------
10144
10145 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
10146 # Parsoid's list handling is more aware of block structure.
10147 !! test
10148 Unbalanced closing block tags break a list
10149 !! wikitext
10150 <div>
10151 *a</div><div>
10152 *b</div>
10153 !! html+tidy
10154 <div>
10155 <ul><li>a</li></ul></div><div>
10156 <li>b</li></div>
10157 !! html/parsoid
10158 <div><ul>
10159 <li>a</li>
10160 </ul></div>
10161 <div><ul>
10162 <li>b</li>
10163 </ul></div>
10164 !! end
10165
10166 !! test
10167 Unbalanced closing non-block tags don't break a list
10168 !! options
10169 parsoid=wt2html,html2html
10170 !! wikitext
10171 <span>
10172 *a</span><span>
10173 *b</span>
10174 !! html/php+tidy
10175 <p><span>
10176 </span></p>
10177 <ul><li>a<span></span></li>
10178 <li>b</li></ul>
10179 !! html/parsoid
10180 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></p>
10181 <ul><li>a<span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></li>
10182 <li>b</li></ul>
10183 !! end
10184
10185 # Parsoid does some post-dom-building cleanup
10186 # which is why its output differs from Remex.
10187 !! test
10188 Unclosed formatting tags that straddle lists are closed and reopened
10189 !! options
10190 parsoid=wt2html,wt2wt,html2html
10191 !! wikitext
10192 #<s> a
10193 #b </s>
10194 !! html/php+tidy
10195 <ol><li><s> a</s></li><s>
10196 </s><li><s>b </s></li></ol>
10197 !! html/parsoid
10198 <ol><li><s> a</s></li>
10199 <li><s>b </s></li></ol>
10200 !! end
10201
10202 # Output is ugly because of all the misnested tag fixups.
10203 !! test
10204 1. List embedded in a formatting tag
10205 !! wikitext
10206 <small>
10207 *foo
10208 </small>
10209 !! html/php+tidy
10210 <p><small>
10211 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10212 </p>
10213 !! html/parsoid
10214 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
10215 <ul><li data-parsoid='{}'>foo</li></ul></small>
10216 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p>
10217 !! end
10218
10219 # Output is ugly because of all the misnested tag fixups.
10220 !! test
10221 2. List embedded in a formatting tag in a misnested way
10222 !! wikitext
10223 <small>
10224 *a
10225 *b</small>
10226 !! html/php+tidy
10227 <p><small>
10228 </small></p><small></small><ul><small><li>a</li>
10229 </small><li><small>b</small></li></ul>
10230 !! html/parsoid
10231 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><p></p>
10232 <ul><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'><li>a</li></small>
10233 <li><small data-parsoid='{"stx":"html","autoInsertedStart":true}'>b</small></li></ul>
10234 !! end
10235
10236 ###
10237 ### Magic Words
10238 ###
10239
10240 # Note that the current date is hard-coded as
10241 # 1970-01-01T00:02:03Z (a Thursday)
10242 # when running parser tests. The timezone is also fixed to GMT, so
10243 # local date will be identical to current date.
10244
10245 !! test
10246 Magic Word: {{CURRENTDAY}}
10247 !! wikitext
10248 {{CURRENTDAY}}
10249 !! html
10250 <p>1
10251 </p>
10252 !! end
10253
10254 !! test
10255 Magic Word: {{CURRENTDAY2}}
10256 !! wikitext
10257 {{CURRENTDAY2}}
10258 !! html
10259 <p>01
10260 </p>
10261 !! end
10262
10263 !! test
10264 Magic Word: {{CURRENTDAYNAME}}
10265 !! wikitext
10266 {{CURRENTDAYNAME}}
10267 !! html
10268 <p>Thursday
10269 </p>
10270 !! end
10271
10272 !! test
10273 Magic Word: {{CURRENTDOW}}
10274 !! wikitext
10275 {{CURRENTDOW}}
10276 !! html
10277 <p>4
10278 </p>
10279 !! end
10280
10281 !! test
10282 Magic Word: {{CURRENTMONTH}}
10283 !! wikitext
10284 {{CURRENTMONTH}}
10285 !! html
10286 <p>01
10287 </p>
10288 !! end
10289
10290 !! test
10291 Magic Word: {{CURRENTMONTH1}}
10292 !! wikitext
10293 {{CURRENTMONTH1}}
10294 !! html
10295 <p>1
10296 </p>
10297 !! end
10298
10299 !! test
10300 Magic Word: {{CURRENTMONTHABBREV}}
10301 !! wikitext
10302 {{CURRENTMONTHABBREV}}
10303 !! html
10304 <p>Jan
10305 </p>
10306 !! end
10307
10308 !! test
10309 Magic Word: {{CURRENTMONTHNAME}}
10310 !! wikitext
10311 {{CURRENTMONTHNAME}}
10312 !! html
10313 <p>January
10314 </p>
10315 !! end
10316
10317 !! test
10318 Magic Word: {{CURRENTMONTHNAMEGEN}}
10319 !! wikitext
10320 {{CURRENTMONTHNAMEGEN}}
10321 !! html
10322 <p>January
10323 </p>
10324 !! end
10325
10326 !! test
10327 Magic Word: {{CURRENTTIME}}
10328 !! wikitext
10329 {{CURRENTTIME}}
10330 !! html
10331 <p>00:02
10332 </p>
10333 !! end
10334
10335 !! test
10336 Magic Word: {{CURRENTHOUR}}
10337 !! wikitext
10338 {{CURRENTHOUR}}
10339 !! html
10340 <p>00
10341 </p>
10342 !! end
10343
10344 !! test
10345 Magic Word: {{CURRENTWEEK}} (T6594)
10346 !! wikitext
10347 {{CURRENTWEEK}}
10348 !! html
10349 <p>1
10350 </p>
10351 !! end
10352
10353 !! test
10354 Magic Word: {{CURRENTYEAR}}
10355 !! wikitext
10356 {{CURRENTYEAR}}
10357 !! html
10358 <p>1970
10359 </p>
10360 !! end
10361
10362 !! test
10363 Magic Word: {{CURRENTTIMESTAMP}}
10364 !! wikitext
10365 {{CURRENTTIMESTAMP}}
10366 !! html
10367 <p>19700101000203
10368 </p>
10369 !! end
10370
10371 !! test
10372 Magic Words LOCAL (UTC)
10373 !! wikitext
10374 *{{LOCALMONTH}}
10375 *{{LOCALMONTH1}}
10376 *{{LOCALMONTHNAME}}
10377 *{{LOCALMONTHNAMEGEN}}
10378 *{{LOCALMONTHABBREV}}
10379 *{{LOCALDAY}}
10380 *{{LOCALDAY2}}
10381 *{{LOCALDAYNAME}}
10382 *{{LOCALYEAR}}
10383 *{{LOCALTIME}}
10384 *{{LOCALHOUR}}
10385 *{{LOCALWEEK}}
10386 *{{LOCALDOW}}
10387 *{{LOCALTIMESTAMP}}
10388 !! html
10389 <ul><li>01</li>
10390 <li>1</li>
10391 <li>January</li>
10392 <li>January</li>
10393 <li>Jan</li>
10394 <li>1</li>
10395 <li>01</li>
10396 <li>Thursday</li>
10397 <li>1970</li>
10398 <li>00:02</li>
10399 <li>00</li>
10400 <li>1</li>
10401 <li>4</li>
10402 <li>19700101000203</li></ul>
10403
10404 !! end
10405
10406 !! test
10407 Magic Word: {{FULLPAGENAME}}
10408 !! options
10409 title=[[User:Ævar Arnfjörð Bjarmason]]
10410 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10411 !! wikitext
10412 {{FULLPAGENAME}}
10413 !! html/*
10414 <p>User:Ævar Arnfjörð Bjarmason
10415 </p>
10416 !! end
10417
10418 !! test
10419 Magic Word: {{FULLPAGENAMEE}}
10420 !! options
10421 title=[[User:Ævar Arnfjörð Bjarmason]]
10422 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10423 !! wikitext
10424 {{FULLPAGENAMEE}}
10425 !! html/*
10426 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10427 </p>
10428 !! end
10429
10430 !! test
10431 Magic Word: {{TALKSPACE}}
10432 !! options
10433 title=[[User:Ævar Arnfjörð Bjarmason]]
10434 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10435 !! wikitext
10436 {{TALKSPACE}}
10437 !! html/*
10438 <p>User talk
10439 </p>
10440 !! end
10441
10442 !! test
10443 Magic Word: {{TALKSPACE}}, same namespace
10444 !! options
10445 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10446 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10447 !! wikitext
10448 {{TALKSPACE}}
10449 !! html/*
10450 <p>User talk
10451 </p>
10452 !! end
10453
10454 !! test
10455 Magic Word: {{TALKSPACE}}, main namespace
10456 !! options
10457 title=[[Parser Test]]
10458 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10459 !! wikitext
10460 {{TALKSPACE}}
10461 !! html/*
10462 <p>Talk
10463 </p>
10464 !! end
10465
10466 !! test
10467 Magic Word: {{TALKSPACEE}}
10468 !! options
10469 title=[[User:Ævar Arnfjörð Bjarmason]]
10470 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10471 !! wikitext
10472 {{TALKSPACEE}}
10473 !! html/*
10474 <p>User_talk
10475 </p>
10476 !! end
10477
10478 !! test
10479 Magic Word: {{SUBJECTSPACE}}
10480 !! options
10481 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10482 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10483 !! wikitext
10484 {{SUBJECTSPACE}}
10485 !! html/*
10486 <p>User
10487 </p>
10488 !! end
10489
10490 !! test
10491 Magic Word: {{SUBJECTSPACE}}, same namespace
10492 !! options
10493 title=[[User:Ævar Arnfjörð Bjarmason]]
10494 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10495 !! wikitext
10496 {{SUBJECTSPACE}}
10497 !! html/*
10498 <p>User
10499 </p>
10500 !! end
10501
10502 !! test
10503 Magic Word: {{SUBJECTSPACE}}, main namespace
10504 !! options
10505 title=[[Parser Test]]
10506 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10507 !! wikitext
10508 {{SUBJECTSPACE}}
10509 !! html/*
10510
10511 !! end
10512
10513 !! test
10514 Magic Word: {{SUBJECTSPACEE}}
10515 !! options
10516 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10517 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10518 !! wikitext
10519 {{SUBJECTSPACEE}}
10520 !! html/*
10521 <p>User
10522 </p>
10523 !! end
10524
10525 !! test
10526 Magic Word: {{NAMESPACE}}
10527 !! options
10528 title=[[User:Ævar Arnfjörð Bjarmason]]
10529 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10530 !! wikitext
10531 {{NAMESPACE}}
10532 !! html/*
10533 <p>User
10534 </p>
10535 !! end
10536
10537 !! test
10538 Magic Word: {{NAMESPACEE}}
10539 !! options
10540 title=[[User:Ævar Arnfjörð Bjarmason]]
10541 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10542 !! wikitext
10543 {{NAMESPACEE}}
10544 !! html/*
10545 <p>User
10546 </p>
10547 !! end
10548
10549 !! test
10550 Magic Word: {{NAMESPACENUMBER}}
10551 !! options
10552 title=[[User:Ævar Arnfjörð Bjarmason]]
10553 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10554 !! wikitext
10555 {{NAMESPACENUMBER}}
10556 !! html/*
10557 <p>2
10558 </p>
10559 !! end
10560
10561 !! test
10562 Magic Word: {{SUBPAGENAME}}
10563 !! options
10564 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10565 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10566 !! wikitext
10567 {{SUBPAGENAME}}
10568 !! html/*
10569 <p>sub ö
10570 </p>
10571 !! end
10572
10573 !! test
10574 Magic Word: {{SUBPAGENAMEE}}
10575 !! options
10576 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10577 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10578 !! wikitext
10579 {{SUBPAGENAMEE}}
10580 !! html/*
10581 <p>sub_%C3%B6
10582 </p>
10583 !! end
10584
10585 !! test
10586 Magic Word: {{ROOTPAGENAME}}
10587 !! options
10588 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10589 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10590 !! wikitext
10591 {{ROOTPAGENAME}}
10592 !! html/*
10593 <p>Ævar Arnfjörð Bjarmason
10594 </p>
10595 !! end
10596
10597 !! test
10598 Magic Word: {{ROOTPAGENAMEE}}
10599 !! options
10600 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10601 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10602 !! wikitext
10603 {{ROOTPAGENAMEE}}
10604 !! html/*
10605 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10606 </p>
10607 !! end
10608
10609 !! test
10610 Magic Word: {{BASEPAGENAME}}
10611 !! options
10612 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10613 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10614 !! wikitext
10615 {{BASEPAGENAME}}
10616 !! html/*
10617 <p>Ævar Arnfjörð Bjarmason
10618 </p>
10619 !! end
10620
10621 !! test
10622 Magic Word: {{BASEPAGENAMEE}}
10623 !! options
10624 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10625 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10626 !! wikitext
10627 {{BASEPAGENAMEE}}
10628 !! html/*
10629 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10630 </p>
10631 !! end
10632
10633 !! test
10634 Magic Word: {{TALKPAGENAME}}
10635 !! options
10636 title=[[User:Ævar Arnfjörð Bjarmason]]
10637 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10638 !! wikitext
10639 {{TALKPAGENAME}}
10640 !! html/*
10641 <p>User talk:Ævar Arnfjörð Bjarmason
10642 </p>
10643 !! end
10644
10645 !! test
10646 Magic Word: {{TALKPAGENAMEE}}
10647 !! options
10648 title=[[User:Ævar Arnfjörð Bjarmason]]
10649 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10650 !! wikitext
10651 {{TALKPAGENAMEE}}
10652 !! html/*
10653 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10654 </p>
10655 !! end
10656
10657 !! test
10658 Magic Word: {{SUBJECTPAGENAME}}
10659 !! options
10660 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10661 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10662 !! wikitext
10663 {{SUBJECTPAGENAME}}
10664 !! html/*
10665 <p>User:Ævar Arnfjörð Bjarmason
10666 </p>
10667 !! end
10668
10669 !! test
10670 Magic Word: {{SUBJECTPAGENAMEE}}
10671 !! options
10672 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10673 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10674 !! wikitext
10675 {{SUBJECTPAGENAMEE}}
10676 !! html/*
10677 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10678 </p>
10679 !! end
10680
10681 !! test
10682 Magic Word: {{NUMBEROFFILES}}
10683 !! options
10684 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10685 !! wikitext
10686 {{NUMBEROFFILES}}
10687 !! html/*
10688 <p>7
10689 </p>
10690 !! end
10691
10692 !! test
10693 Magic Word: {{PAGENAME}}
10694 !! options
10695 title=[[User:Ævar Arnfjörð Bjarmason]]
10696 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10697 !! wikitext
10698 {{PAGENAME}}
10699 !! html/*
10700 <p>Ævar Arnfjörð Bjarmason
10701 </p>
10702 !! end
10703
10704 !! test
10705 Magic Word: {{PAGENAME}} with metacharacters
10706 !! options
10707 title=[['foo & bar = baz']]
10708 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10709 !! wikitext
10710 ''{{PAGENAME}}''
10711 !! html+tidy
10712 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10713 </p>
10714 !! end
10715
10716 !! test
10717 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10718 !! options
10719 title=[[*RFC 1234 http://example.com/]]
10720 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10721 !! wikitext
10722 {{PAGENAME}}
10723 !! html+tidy
10724 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10725 </p>
10726 !! end
10727
10728 !! test
10729 Magic Word: {{PAGENAMEE}}
10730 !! options
10731 title=[[User:Ævar Arnfjörð Bjarmason]]
10732 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10733 !! wikitext
10734 {{PAGENAMEE}}
10735 !! html/*
10736 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10737 </p>
10738 !! end
10739
10740 !! test
10741 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10742 !! options
10743 title=[[*RFC 1234 http://example.com/]]
10744 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10745 !! wikitext
10746 {{PAGENAMEE}}
10747 !! html+tidy
10748 <p>&#42;RFC_1234_http&#58;//example.com/
10749 </p>
10750 !! end
10751
10752 !! test
10753 Magic Word: {{REVISIONID}}
10754 !! options
10755 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10756 showflags
10757 !! wikitext
10758 {{REVISIONID}}
10759 !! html/*
10760 <p>1337
10761 </p>
10762 flags=vary-revision-id
10763 !! end
10764
10765 !! test
10766 Magic Word: {{SCRIPTPATH}}
10767 !! options
10768 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10769 !! wikitext
10770 {{SCRIPTPATH}}
10771 !! html/*
10772
10773 !! end
10774
10775 !! test
10776 Magic Word: {{STYLEPATH}}
10777 !! options
10778 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10779 !! wikitext
10780 {{STYLEPATH}}
10781 !! html/*
10782 <p>/skins
10783 </p>
10784 !! end
10785
10786 !! test
10787 Magic Word: {{SERVER}}
10788 !! options
10789 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10790 !! wikitext
10791 {{SERVER}}
10792 !! html/*
10793 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10794 </p>
10795 !! end
10796
10797 !! test
10798 Magic Word: {{SERVERNAME}}
10799 !! options
10800 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10801 !! wikitext
10802 {{SERVERNAME}}
10803 !! html/*
10804 <p>example.org
10805 </p>
10806 !! end
10807
10808 !! test
10809 Magic Word: {{SITENAME}}
10810 !! options
10811 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10812 !! wikitext
10813 {{SITENAME}}
10814 !! html/*
10815 <p>MediaWiki
10816 </p>
10817 !! end
10818
10819 !! test
10820 Magic Word: {{PAGELANGUAGE}}
10821 !! options
10822 language=fr
10823 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10824 !! wikitext
10825 {{PAGELANGUAGE}}
10826 !! html/*
10827 <p>fr
10828 </p>
10829 !! end
10830
10831 !! test
10832 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10833 !! options
10834 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10835 !! wikitext
10836 {{PAGELANGUAGE}}
10837 !! html/*
10838 <p>en
10839 </p>
10840 !! end
10841
10842 !! test
10843 Case-sensitive magic words, when cased differently, should just be template transclusions
10844 !! wikitext
10845 {{CurrentMonth}}
10846 {{currentday}}
10847 {{cURreNTweEK}}
10848 {{currentHour}}
10849 !! html
10850 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
10851 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
10852 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
10853 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
10854 </p>
10855 !! end
10856
10857 !! test
10858 Case-insensitive magic words should still work with weird casing.
10859 !! wikitext
10860 {{sErVeRNaMe}}
10861 {{LCFirst:AOEU}}
10862 {{ucFIRST:aoeu}}
10863 {{SERver}}
10864 !! html
10865 <p>example.org
10866 aOEU
10867 Aoeu
10868 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10869 </p>
10870 !! end
10871
10872 # From plwiki:PLOS_ONE
10873 !! test
10874 Parsoid: Page property magic word with magic word contents
10875 !! wikitext
10876 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10877 !! html/parsoid
10878 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"DISPLAYTITLE:&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10879 !! end
10880
10881 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10882 # But, this is a limitation of our representation and is documented in
10883 # TemplateHandler.js in processSpecialMagicWord
10884 !! test
10885 Parsoid: Template-generated DISPLAYTITLE
10886 !! wikitext
10887 {{{{echo|DISPLAYTITLE}}:Foo}}
10888 !! options
10889 showtitle
10890 !! config
10891 wgAllowDisplayTitle=true
10892 wgRestrictDisplayTitle=false
10893 !! html/php
10894 Foo
10895
10896 !! html/parsoid
10897 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:ExpandedAttrs" data-parsoid='{"pi":[[]]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,23,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DISPLAYTITLE\"}},\"i\":0}}]}&#39;>DISPLAYTITLE&lt;/span>:Foo"}]]}'/>
10898 !! end
10899
10900 !! test
10901 Namespace 1 {{ns:1}}
10902 !! wikitext
10903 {{ns:1}}
10904 !! html
10905 <p>Talk
10906 </p>
10907 !! end
10908
10909 !! test
10910 Namespace 1 {{ns:01}}
10911 !! wikitext
10912 {{ns:01}}
10913 !! html
10914 <p>Talk
10915 </p>
10916 !! end
10917
10918 !! test
10919 Namespace 0 {{ns:0}} (T6783)
10920 !! wikitext
10921 {{ns:0}}
10922 !! html
10923
10924 !! end
10925
10926 !! test
10927 Namespace 0 {{ns:00}} (T6783)
10928 !! wikitext
10929 {{ns:00}}
10930 !! html
10931
10932 !! end
10933
10934 !! test
10935 Namespace -1 {{ns:-1}}
10936 !! wikitext
10937 {{ns:-1}}
10938 !! html
10939 <p>Special
10940 </p>
10941 !! end
10942
10943 !! test
10944 Namespace User {{ns:User}}
10945 !! wikitext
10946 {{ns:User}}
10947 !! html
10948 <p>User
10949 </p>
10950 !! end
10951
10952 !! test
10953 Namespace User talk {{ns:User_talk}}
10954 !! wikitext
10955 {{ns:User_talk}}
10956 !! html
10957 <p>User talk
10958 </p>
10959 !! end
10960
10961 !! test
10962 Namespace User talk {{ns:uSeR tAlK}}
10963 !! wikitext
10964 {{ns:uSeR tAlK}}
10965 !! html
10966 <p>User talk
10967 </p>
10968 !! end
10969
10970 !! test
10971 Namespace File {{ns:File}}
10972 !! wikitext
10973 {{ns:File}}
10974 !! html
10975 <p>File
10976 </p>
10977 !! end
10978
10979 !! test
10980 Namespace File {{ns:Image}}
10981 !! wikitext
10982 {{ns:Image}}
10983 !! html
10984 <p>File
10985 </p>
10986 !! end
10987
10988 !! test
10989 Namespace (lang=de) Benutzer {{ns:User}}
10990 !! options
10991 language=de
10992 !! wikitext
10993 {{ns:User}}
10994 !! html
10995 <p>Benutzer
10996 </p>
10997 !! end
10998
10999 !! test
11000 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
11001 !! options
11002 language=de
11003 !! wikitext
11004 {{ns:3}}
11005 !! html
11006 <p>Benutzer Diskussion
11007 </p>
11008 !! end
11009
11010 !! test
11011 Urlencode
11012 !! wikitext
11013 {{urlencode:hi world?!}}
11014 {{urlencode:hi world?!|WIKI}}
11015 {{urlencode:hi world?!|PATH}}
11016 {{urlencode:hi world?!|QUERY}}
11017 !! html/php
11018 <p>hi+world%3F%21
11019 hi_world%3F!
11020 hi%20world%3F%21
11021 hi+world%3F%21
11022 </p>
11023 !! end
11024
11025 !! test
11026 Magic Word: prioritize type info over data-parsoid
11027 !! options
11028 parsoid=html2wt
11029 !! html/parsoid
11030 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
11031 !! wikitext
11032 __FORCETOC__
11033 !! end
11034
11035 !! test
11036 Magic Word: serialize on separate line (parsoid)
11037 !! options
11038 parsoid=wt2wt,html2wt
11039 !! wikitext
11040 foo
11041 __NOTOC__
11042 bar
11043 !! html/parsoid
11044 foo<meta property="mw:PageProp/notoc"/>bar
11045 !! end
11046
11047 !! test
11048 Magic Word: rt non-english wikis
11049 !! options
11050 parsoid=wt2wt
11051 language=de
11052 !! wikitext
11053 __NOEDITSECTION__
11054 !! html/parsoid
11055 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
11056 !! end
11057
11058 !!test
11059 __proto__ is treated as normal wikitext (T105997)
11060 !!wikitext
11061 __proto__
11062 !!html
11063 <p>__proto__
11064 </p>
11065 !!end
11066
11067 ###
11068 ### Magic links
11069 ###
11070 !! test
11071 Magic links: internal link to RFC (T2479)
11072 !! wikitext
11073 [[RFC 123]]
11074 !! html/php
11075 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
11076 </p>
11077 !! html/parsoid
11078 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
11079 !! end
11080
11081 !! test
11082 Magic links: RFC (T2479)
11083 !! wikitext
11084 RFC 822
11085 !! html/php
11086 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11087 </p>
11088 !! html/parsoid
11089 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
11090 !! end
11091
11092 !! test
11093 Magic links: RFC (T67278)
11094 !! wikitext
11095 This is RFC 822 but thisRFC 822 is not RFC 822linked.
11096 !! html/php
11097 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
11098 </p>
11099 !! html/parsoid
11100 <p>This is <a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
11101 !! end
11102
11103 !! test
11104 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
11105 !! wikitext
11106 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
11107 RFC
11108 822
11109 !! html/php
11110 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11111 RFC
11112 822
11113 </p>
11114 !! html/parsoid
11115 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
11116 RFC
11117 822</p>
11118 !! end
11119
11120 !! test
11121 Magic links: ISBN (T3937)
11122 !! wikitext
11123 ISBN 0-306-40615-2
11124 !! html/php
11125 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
11126 </p>
11127 !! html/parsoid
11128 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
11129 !! end
11130
11131 !! test
11132 Magic links: ISBN (T67278)
11133 !! wikitext
11134 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11135 !! html/php
11136 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11137 </p>
11138 !! html/parsoid
11139 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
11140 !! end
11141
11142 !! test
11143 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
11144 !! wikitext
11145 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
11146 ISBN
11147 9780316098113
11148 ISBN 978
11149 0316098113
11150 !! html/php
11151 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11152 ISBN
11153 9780316098113
11154 ISBN 978
11155 0316098113
11156 </p>
11157 !! html/parsoid
11158 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
11159 ISBN
11160 9780316098113
11161 ISBN 978
11162 0316098113</p>
11163 !! end
11164
11165 !! test
11166 Magic links: PMID incorrectly converts space to underscore
11167 !! wikitext
11168 PMID 1234
11169 !! html/php
11170 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11171 </p>
11172 !! html/parsoid
11173 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
11174 !! end
11175
11176 !! test
11177 Magic links: PMID (T67278)
11178 !! wikitext
11179 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11180 !! html/php
11181 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
11182 </p>
11183 !! html/parsoid
11184 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
11185 !! end
11186
11187 !! test
11188 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11189 !! wikitext
11190 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11191 PMID
11192 1234
11193 !! html/php
11194 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11195 PMID
11196 1234
11197 </p>
11198 !! html/parsoid
11199 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
11200 PMID
11201 1234</p>
11202 !! end
11203
11204 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11205 # since these are ExtLinkText, not MagicLinkText
11206 !! test
11207 Magic links: use appropriate serialization for "almost" magic links.
11208 !! wikitext
11209 X[[Special:BookSources/0978739256|foo]]
11210
11211 X[https://tools.ietf.org/html/rfc1234 foo]
11212 !! html/php
11213 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11214 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11215 </p>
11216 !! html/parsoid
11217 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11218 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11219 !! end
11220
11221 !! test
11222 Magic links: All disabled (T47942)
11223 !! options
11224 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11225 !! wikitext
11226 ISBN 0-306-40615-2
11227 PMID 1234
11228 RFC 4321
11229 !! html/php
11230 <p>ISBN 0-306-40615-2
11231 PMID 1234
11232 RFC 4321
11233 </p>
11234 !! end
11235
11236 ###
11237 ### Templates
11238 ####
11239
11240 !! test
11241 Nonexistent template
11242 !! wikitext
11243 {{thistemplatedoesnotexist}}
11244 !! html
11245 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
11246 </p>
11247 !! end
11248
11249 !! test
11250 Template with invalid target containing tags
11251 !! wikitext
11252 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11253 !! html
11254 <p>{{a<b>b</b>|foo|a=b|a = b}}
11255 </p>
11256 !! end
11257
11258 !! test
11259 Template with invalid target containing unclosed tag
11260 !! wikitext
11261 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11262 !! html
11263 <p>{{a<b>|foo|a=b|a = b}}</b>
11264 </p>
11265 !! end
11266
11267 !! test
11268 Template with invalid target containing wikilink
11269 !! wikitext
11270 {{[[Main Page]]}}
11271 !! html/php
11272 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11273 </p>
11274 !! html/parsoid
11275 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
11276 !! end
11277
11278 !! test
11279 Template with just whitespace in it, T70421
11280 !! wikitext
11281 {{echo|{{ }}}}
11282 !! html/parsoid
11283 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</p>
11284 !! end
11285
11286 !! article
11287 Template:test
11288 !! text
11289 This is a test template
11290 !! endarticle
11291
11292 !! test
11293 Simple template
11294 !! wikitext
11295 {{test}}
11296 !! html
11297 <p>This is a test template
11298 </p>
11299 !! end
11300
11301 !! test
11302 Template with explicit namespace
11303 !! wikitext
11304 {{Template:test}}
11305 !! html
11306 <p>This is a test template
11307 </p>
11308 !! end
11309
11310
11311 !! article
11312 Template:paramtest
11313 !! text
11314 This is a test template with parameter {{{param}}}
11315 !! endarticle
11316
11317 !! test
11318 Template parameter
11319 !! wikitext
11320 {{paramtest|param=foo}}
11321 !! html
11322 <p>This is a test template with parameter foo
11323 </p>
11324 !! end
11325
11326 !! article
11327 Template:paramtestnum
11328 !! text
11329 [[{{{1}}}|{{{2}}}]]
11330 !! endarticle
11331
11332 !! test
11333 Template unnamed parameter
11334 !! wikitext
11335 {{paramtestnum|Main Page|the main page}}
11336 !! html
11337 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11338 </p>
11339 !! end
11340
11341 !! article
11342 Template:templatesimple
11343 !! text
11344 (test)
11345 !! endarticle
11346
11347 !! article
11348 Template:templateredirect
11349 !! text
11350 #redirect [[Template:templatesimple]]
11351 !! endarticle
11352
11353 !! article
11354 Template:templateasargtestnum
11355 !! text
11356 {{{{{1}}}}}
11357 !! endarticle
11358
11359 !! article
11360 Template:templateasargtest
11361 !! text
11362 {{template{{{templ}}}}}
11363 !! endarticle
11364
11365 !! article
11366 Template:templateasargtest2
11367 !! text
11368 {{{{{templ}}}}}
11369 !! endarticle
11370
11371 !! test
11372 Template with template name as unnamed argument
11373 !! wikitext
11374 {{templateasargtestnum|templatesimple}}
11375 !! html
11376 <p>(test)
11377 </p>
11378 !! end
11379
11380 !! test
11381 Template with template name as argument
11382 !! wikitext
11383 {{templateasargtest|templ=simple}}
11384 !! html
11385 <p>(test)
11386 </p>
11387 !! end
11388
11389 !! test
11390 Template with template name as argument (2)
11391 !! wikitext
11392 {{templateasargtest2|templ=templatesimple}}
11393 !! html
11394 <p>(test)
11395 </p>
11396 !! end
11397
11398 !! article
11399 Template:templateasargtestdefault
11400 !! text
11401 {{{{{templ|templatesimple}}}}}
11402 !! endarticle
11403
11404 !! article
11405 Template:templa
11406 !! text
11407 '''templ'''
11408 !! endarticle
11409
11410 !! test
11411 Template with default value
11412 !! wikitext
11413 {{templateasargtestdefault}}
11414 !! html
11415 <p>(test)
11416 </p>
11417 !! end
11418
11419 !! test
11420 Template with default value (value set)
11421 !! wikitext
11422 {{templateasargtestdefault|templ=templa}}
11423 !! html
11424 <p><b>templ</b>
11425 </p>
11426 !! end
11427
11428 !! test
11429 Template redirect
11430 !! wikitext
11431 {{templateredirect}}
11432 !! html/php
11433 <p>(test)
11434 </p>
11435 !! html/parsoid
11436 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11437 !! end
11438
11439 !! test
11440 Template with argument in separate line
11441 !! wikitext
11442 {{ templateasargtest |
11443 templ = simple }}
11444 !! html
11445 <p>(test)
11446 </p>
11447 !! end
11448
11449 !! test
11450 Template with complex template as argument
11451 !! wikitext
11452 {{paramtest|
11453 param ={{ templateasargtest |
11454 templ = simple }}}}
11455 !! html
11456 <p>This is a test template with parameter (test)
11457 </p>
11458 !! end
11459
11460 !! test
11461 Templates with templated name
11462 !! wikitext
11463 {{{{echo|echo}}|foo}}
11464 {{{{echo|inner list}} }}
11465 !! html
11466 <p>foo
11467 </p>
11468 <ul><li>item 1</li></ul>
11469
11470 !! html/parsoid
11471 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|echo}}","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
11472 <ul about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|inner list}} ","href":"./Template:Inner_list"},"params":{},"i":0}}]}'><li>item 1</li></ul>
11473 !! end
11474
11475 ## Regression test; the output here isn't really that interesting.
11476 !! test
11477 Templates with templated name and top level template args
11478 !! wikitext
11479 {{1{{2{{{3}}}|4=5}}}}
11480 !! html/parsoid
11481 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1{{2{{{3}}}|4=5}}"},"params":{},"i":0}}]}'>{{1{{2{{{3}}}|4=5}}}}</p>
11482 !! end
11483
11484 # Parsoid markup is deliberate "broken". This is an edge case.
11485 # See long comment in TemplateHandler.js:convertAttribsToString.
11486 !! test
11487 Templates with invalid templated targets
11488 !! wikitext
11489 {{echo
11490 {{echo|foo}}
11491 }}
11492 !! html/php
11493 <p>{{echo
11494 foo
11495 }}
11496 </p>
11497 !! html/parsoid
11498 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11499 foo }}</p>
11500 !! end
11501
11502 !! test
11503 Template with thumb image (with link in description)
11504 !! wikitext
11505 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11506 !! html/php
11507 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
11508
11509 !! html+tidy
11510 <p>This is a test template with parameter </p><div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
11511 !! html/parsoid
11512 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
11513 !! end
11514
11515 !! article
11516 Template:complextemplate
11517 !! text
11518 {{{1}}} {{paramtest|
11519 param ={{{param}}}}}
11520 !! endarticle
11521
11522 !! test
11523 Template with complex arguments
11524 !! wikitext
11525 {{complextemplate|
11526 param ={{ templateasargtest |
11527 templ = simple }}|[[Template:complextemplate|link]]}}
11528 !! html
11529 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11530 </p>
11531 !! end
11532
11533 !! test
11534 T2553: link with two variables in a piped link
11535 !! wikitext
11536 {|
11537 |[[{{{1}}}|{{{2}}}]]
11538 |}
11539 !! html/php
11540 <table>
11541 <tr>
11542 <td>[[{{{1}}}|{{{2}}}]]
11543 </td></tr></table>
11544
11545 !! html/parsoid
11546 <table>
11547 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{},"i":0}}]}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"2"},"params":{},"i":0}}]}'>{{{2}}}</span>]]</td></tr>
11548 </tbody></table>
11549 !! end
11550
11551 # See: T2553
11552 !! test
11553 Abort table cell attribute parsing on wikilink
11554 !! wikitext
11555 {|
11556 |testing [[one|two]] |three||four
11557 |testing one two |three||four
11558 |testing="[[one|two]]" |three||four
11559 |}
11560 !! html/php
11561 <table>
11562 <tr>
11563 <td>testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> |three</td>
11564 <td>four
11565 </td>
11566 <td>three</td>
11567 <td>four
11568 </td>
11569 <td>testing="<a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a>" |three</td>
11570 <td>four
11571 </td></tr></table>
11572
11573 !! html/parsoid
11574 <table>
11575 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> |three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td>
11576 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'>three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td>
11577 <td>testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" |three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td></tr>
11578 </tbody></table>
11579 !! end
11580
11581 !! test
11582 Don't abort table cell attribute parsing if wikilink is found in template arg
11583 !! wikitext
11584 {|
11585 |Test {{#tag:ref|One two "[[three]]" four}}
11586 |}
11587 !! html/parsoid
11588 <table>
11589 <tbody><tr><td>Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
11590 </tbody></table>
11591 !! end
11592
11593 !! test
11594 Magic variable as template parameter
11595 !! wikitext
11596 {{paramtest|param={{SITENAME}}}}
11597 !! html
11598 <p>This is a test template with parameter MediaWiki
11599 </p>
11600 !! end
11601
11602 !! article
11603 Template:linktest
11604 !! text
11605 [[{{{param}}}|link]]
11606 !! endarticle
11607
11608 !! test
11609 Template parameter as link source
11610 !! wikitext
11611 {{linktest|param=Main Page}}
11612 !! html
11613 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11614 </p>
11615 !! end
11616
11617 !!article
11618 Template:paramtest2
11619 !! text
11620 including another template, {{paramtest|param={{{arg}}}}}
11621 !! endarticle
11622
11623 !! test
11624 Template passing argument to another template
11625 !! wikitext
11626 {{paramtest2|arg='hmm'}}
11627 !! html
11628 <p>including another template, This is a test template with parameter 'hmm'
11629 </p>
11630 !! end
11631
11632 !! article
11633 Template:Linktest2
11634 !! text
11635 Main Page
11636 !! endarticle
11637
11638 !! test
11639 Template as link source
11640 !! wikitext
11641 [[{{linktest2}}]]
11642
11643 [[{{linktest2}}|Main Page]]
11644
11645 [[{{linktest2}}]]Page
11646 !! html
11647 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11648 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11649 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11650 </p>
11651 !! end
11652
11653
11654 !! article
11655 Template:loop1
11656 !! text
11657 {{loop2}}
11658 !! endarticle
11659
11660 !! article
11661 Template:loop2
11662 !! text
11663 {{loop1}}
11664 !! endarticle
11665
11666 !! test
11667 Template infinite loop
11668 !! wikitext
11669 {{loop1}}
11670 !! html
11671 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11672 </p>
11673 !! end
11674
11675 !! test
11676 Template from main namespace
11677 !! wikitext
11678 {{:Main Page}}
11679 !! html
11680 <p>blah blah
11681 </p>
11682 !! end
11683
11684 !! test
11685 Template from non-includable namespace
11686 !! options
11687 wgNonincludableNamespaces=10
11688 !! wikitext
11689 {{echo|uh oh!}}
11690 !! html
11691 <p><a href="/wiki/Template:Echo" title="Template:Echo">Template:Echo</a>
11692 </p>
11693 !! end
11694
11695 !! article
11696 Template:table
11697 !! text
11698 {|
11699 | 1 || 2
11700 |-
11701 | 3 || 4
11702 |}
11703 !! endarticle
11704
11705 !! test
11706 T2529: Template with table, not included at beginning of line
11707 !! wikitext
11708 foo {{table}}
11709 !! html
11710 <p>foo
11711 </p>
11712 <table>
11713 <tr>
11714 <td>1</td>
11715 <td>2
11716 </td></tr>
11717 <tr>
11718 <td>3</td>
11719 <td>4
11720 </td></tr></table>
11721
11722 !! end
11723
11724 !! test
11725 T2523: Template shouldn't eat newline (or add an extra one before table)
11726 !! wikitext
11727 foo
11728 {{table}}
11729 !! html
11730 <p>foo
11731 </p>
11732 <table>
11733 <tr>
11734 <td>1</td>
11735 <td>2
11736 </td></tr>
11737 <tr>
11738 <td>3</td>
11739 <td>4
11740 </td></tr></table>
11741
11742 !! end
11743
11744 !! test
11745 T2041: Template parameters shown as broken links
11746 !! wikitext
11747 {{{parameter}}}
11748 !! html
11749 <p>{{{parameter}}}
11750 </p>
11751 !! end
11752
11753 !! test
11754 Template with targets containing wikilinks
11755 !! options
11756 parsoid=wt2html
11757 !! wikitext
11758 {{[[foo]]}}
11759
11760 {{[[{{echo|foo}}]]}}
11761
11762 {{{{echo|[[foo}}]]}}
11763 !! html/php
11764 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11765 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11766 </p><p>{{[[foo}}]]
11767 </p>
11768 !! html/parsoid
11769 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11770 <p>{{<a typeof="mw:ExpandedAttrs" rel="mw:WikiLink" href="./Foo" title="Foo" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>"}]]}'>foo</a>}}</p>
11771 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11772 !! end
11773
11774 !! article
11775 Template:''
11776 !! text
11777 bar
11778 !! endarticle
11779
11780 !! test
11781 Templates: Double quotes as template target
11782 !! wikitext
11783 foo {{''}} baz
11784 !! html/php
11785 <p>foo bar baz
11786 </p>
11787 !! html/parsoid
11788 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;","href":"./Template:&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
11789 </p>
11790 !! end
11791
11792 ## This test is about making sure Parsoid's data-mw is well formed in the
11793 ## face of multiple templates with intersecting and overlapping ranges. The
11794 ## wikitext itself is wretched.
11795 !! test
11796 Templates with intersecting and overlapping ranges
11797 !! wikitext
11798 {|{{echo|
11799 <p>ha</p>}}
11800 {|{{echo|
11801 <p>ho</p>}}
11802 {{echo|{{!}}hi}}
11803 |}
11804 !! html/php+tidy
11805 <p>ha</p><table>
11806
11807 </table><p>ho</p><table>
11808
11809 <tbody><tr>
11810 <td>hi
11811 </td></tr></tbody></table>
11812 !! html/parsoid
11813 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]],"firstWikitextNode":"table"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11814
11815 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11816
11817 <tbody><tr><td>hi</td></tr>
11818 </tbody></table>
11819 !! end
11820
11821 !! article
11822 Template:MSGNW test
11823 !! text
11824 ''None'' of '''this''' should be
11825 * interpreted
11826 but rather passed unmodified
11827 {{test}}
11828 <gallery>
11829 File:Foobar.jpg
11830 </gallery>
11831 <!-- comment -->
11832 !! endarticle
11833
11834 # hmm, fix this or just deprecate msgnw and document its behavior?
11835 !! test
11836 msgnw keyword
11837 !! wikitext
11838 {{msgnw:MSGNW test}}
11839 !! html/php
11840 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11841 &#42; interpreted
11842 &#32;but rather passed unmodified
11843 &#123;&#123;test&#125;&#125;
11844 &#60;gallery&#62;
11845 File:Foobar.jpg
11846 &#60;/gallery&#62;
11847 &#60;!-- comment --&#62;
11848 </p>
11849 !! end
11850
11851 !! test
11852 int keyword
11853 !! wikitext
11854 {{int:youhavenewmessages|lots of money|not!}}
11855 !! html
11856 <p>You have lots of money (not!).
11857 </p>
11858 !! end
11859
11860 !! test
11861 int keyword - non-existing message
11862 !! wikitext
11863 {{int:var}}
11864 !! html
11865 <p>⧼var⧽
11866 </p>
11867 !! end
11868
11869 !! article
11870 Template:Includes
11871 !! text
11872 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11873 !! endarticle
11874
11875 !! test
11876 <includeonly> and <noinclude> being included
11877 !! wikitext
11878 {{Includes}}
11879 !! html
11880 <p>Foobar
11881 </p>
11882 !! end
11883
11884 !! article
11885 Template:Includes2
11886 !! text
11887 <onlyinclude>Foo</onlyinclude>bar
11888 !! endarticle
11889
11890 !! test
11891 <onlyinclude> being included
11892 !! wikitext
11893 {{Includes2}}
11894 !! html
11895 <p>Foo
11896 </p>
11897 !! end
11898
11899
11900 !! article
11901 Template:Includes3
11902 !! text
11903 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11904 !! endarticle
11905
11906 !! test
11907 <onlyinclude> and <includeonly> being included
11908 !! wikitext
11909 {{Includes3}}
11910 !! html
11911 <p>Foo
11912 </p>
11913 !! end
11914
11915 !! test
11916 <includeonly> and <noinclude> on a page
11917 !! wikitext
11918 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11919 !! html
11920 <p>Foozar
11921 </p>
11922 !! end
11923
11924 !! test
11925 Un-closed <noinclude>
11926 !! wikitext
11927 <noinclude>
11928 !! html
11929 !! end
11930
11931 !! test
11932 <onlyinclude> on a page
11933 !! wikitext
11934 <onlyinclude>Foo</onlyinclude>bar
11935 !! html
11936 <p>Foobar
11937 </p>
11938 !! end
11939
11940 !! test
11941 Un-closed <onlyinclude>
11942 !! wikitext
11943 <onlyinclude>
11944 !! html
11945 !! end
11946
11947 !!test
11948 Self-closed noinclude, includeonly, onlyinclude tags
11949 !! wikitext
11950 <noinclude />
11951 <includeonly />
11952 <onlyinclude />
11953 !! html
11954 <p><br />
11955 </p>
11956 !!end
11957
11958 !!test
11959 Unbalanced includeonly and noinclude tags
11960 !! wikitext
11961 {|
11962 |a</noinclude>
11963 |b</noinclude></noinclude>
11964 |c</noinclude></includeonly>
11965 |d</includeonly></includeonly>
11966 |}
11967 !! html
11968 <table>
11969 <tr>
11970 <td>a
11971 </td>
11972 <td>b
11973 </td>
11974 <td>c&lt;/includeonly&gt;
11975 </td>
11976 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11977 </td></tr></table>
11978
11979 !!end
11980
11981 !! article
11982 Template:Includeonly section
11983 !! text
11984 <includeonly>
11985 ==Includeonly section==
11986 </includeonly>
11987 ==Section T-1==
11988 !!endarticle
11989
11990 !! test
11991 T8563: Edit link generation for section shown by <includeonly>
11992 !! wikitext
11993 {{includeonly section}}
11994 !! html
11995 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11996 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11997
11998 !! end
11999
12000 # Uses same input as the contents of [[Template:Includeonly section]]
12001 !! test
12002 T8563: Section extraction for section shown by <includeonly>
12003 !! options
12004 section=T-2
12005 !! wikitext
12006 <includeonly>
12007 ==Includeonly section==
12008 </includeonly>
12009 ==Section T-2==
12010 !! html
12011 ==Section T-2==
12012 !! end
12013
12014 !! test
12015 T8563: Edit link generation for section suppressed by <includeonly>
12016 !! wikitext
12017 <includeonly>
12018 ==Includeonly section==
12019 </includeonly>
12020 ==Section 1==
12021 !! html
12022 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12023
12024 !! end
12025
12026 !! test
12027 T8563: Section extraction for section suppressed by <includeonly>
12028 !! options
12029 section=1
12030 !! wikitext
12031 <includeonly>
12032 ==Includeonly section==
12033 </includeonly>
12034 ==Section 1==
12035 !! html
12036 ==Section 1==
12037 !! end
12038
12039 !! test
12040 Un-closed <includeonly>
12041 !! wikitext
12042 <includeonly>
12043 !! html/php
12044 !! html/parsoid
12045 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
12046 !! end
12047
12048 ## We used to, but no longer wt2wt this test since the default serializer
12049 ## will normalize the include directives to serialize on their own line.
12050 ## Selser will take care of preserving formatting in scenarios where they
12051 ## intermingled with other wikitext.
12052 !! test
12053 Includes and comments at SOL
12054 !! options
12055 parsoid=wt2html,html2html
12056 !! wikitext
12057 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
12058
12059 <noinclude>
12060 some
12061 </noinclude>*stuff
12062 *here
12063
12064 <includeonly>can have stuff</includeonly>===here===
12065
12066 !! html/php
12067 <h2><span class="mw-headline" id="hu">hu</span></h2>
12068 <p>some
12069 </p>
12070 <ul><li>stuff</li>
12071 <li>here</li></ul>
12072 <h3><span class="mw-headline" id="here">here</span></h3>
12073
12074 !! html/parsoid
12075 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment --><h2 id="hu">hu</h2>
12076
12077 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12078 <p>some</p>
12079 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
12080 <li>here</li></ul>
12081
12082 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3 id="here">here</h3>
12083
12084 !! end
12085
12086 # TODO: test with DOM fragment reuse!
12087 !! test
12088 Parsoid: DOM fragment reuse
12089 !! options
12090 parsoid=wt2wt,wt2html
12091 !! wikitext
12092 a{{echo|b<table></table>c}}d
12093
12094 a{{echo|b
12095 <table></table>
12096 c}}d
12097
12098 {{echo|a
12099
12100 <table></table>
12101
12102 b}}
12103 !! html
12104 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
12105
12106 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><span about="#mwt2">
12107 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
12108 </span><p about="#mwt2">cd</p>
12109
12110 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>a</p><span about="#mwt3">
12111
12112 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
12113
12114 </span><p about="#mwt3">b</p>
12115 !! end
12116
12117 !! test
12118 Parsoid: Merge double tds (T52603)
12119 !! options
12120 parsoid
12121 !! wikitext
12122 {|
12123 |{{echo|{{!}} foo}}
12124 |}
12125 !! html
12126 <table><tbody>
12127 <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
12128 </tbody></table>
12129 !! end
12130
12131 !! test
12132 Parsoid: Merge double tds in nested transclusion content (T52603)
12133 !! options
12134 parsoid
12135 !! wikitext
12136 {{echo|<div>}}
12137 {|
12138 |{{echo|{{!}} foo}}
12139 |}
12140 {{echo|</div>}}
12141 !! html
12142 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
12143 <table><tbody>
12144 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
12145 </tbody></table>
12146 </div>
12147 !! end
12148
12149 ###
12150 ### <includeonly> and <noinclude> in attributes
12151 ###
12152 !!test
12153 0. includeonly around the entire attribute
12154 !! wikitext
12155 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12156 !! html
12157 <p><span id="v2">bar</span>
12158 </p>
12159 !!end
12160
12161 !!test
12162 1. includeonly in html attr key
12163 !! wikitext
12164 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12165 !! html
12166 <p><span id="foo">bar</span>
12167 </p>
12168 !!end
12169
12170 !!test
12171 2. includeonly in html attr value
12172 !! wikitext
12173 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12174 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12175 !! html
12176 <p><span id="v1">bar</span>
12177 <span id="v1">bar</span>
12178 </p>
12179 !!end
12180
12181 !!test
12182 3. includeonly in part of an attr value
12183 !! wikitext
12184 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12185 !! html
12186 <p><span style="color:red;">bar</span>
12187 </p>
12188 !!end
12189
12190 !!test
12191 4. includeonly in table attributes
12192 !! wikitext
12193 {|
12194 |- <noinclude>
12195 |-
12196 |a
12197 </noinclude>
12198 |- <includeonly>
12199 |-
12200 |b
12201 </includeonly>
12202 |}
12203 !! html
12204 <table>
12205
12206
12207 <tr>
12208 <td>a
12209 </td></tr>
12210 </table>
12211
12212 !!end
12213
12214 ###
12215 ### Preprocessor precedence tests
12216 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12217 ###
12218 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12219 !! test
12220 Preprocessor precedence 1: link is rightmost opening
12221 !! options
12222 parsoid=wt2html
12223 !! wikitext
12224 {{[[Foo|bar}}]]
12225
12226 But close-brace is not a valid character in a link title:
12227 {{[[Foo}}|bar]]
12228
12229 However, we can still tell this was handled as a link in the preprocessor:
12230 {{echo|[[Foo}}|bar]]|bat}}
12231 !! html/php
12232 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12233 </p><p>But close-brace is not a valid character in a link title:
12234 {{[[Foo}}|bar]]
12235 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12236 [[Foo}}|bar]]
12237 </p>
12238 !! html/parsoid
12239 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12240 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12241 <p>However, we can still tell this was handled as a link in the preprocessor: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo}}|bar]]"},"2":{"wt":"bat"}},"i":0}}]}'>[[Foo}}|bar]]</span></p>
12242 !! end
12243
12244 !! test
12245 Preprocessor precedence 2: template is rightmost opening
12246 !! options
12247 language=zh
12248 !! wikitext
12249 -{{echo|foo}-}}-
12250 !! html/php
12251 <p>-foo}--
12252 </p>
12253 !! html/parsoid
12254 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12255 !! end
12256
12257 !! test
12258 Preprocessor precedence 3: language converter is rightmost opening
12259 !! options
12260 language=zh
12261 parsoid=wt2html
12262 !! wikitext
12263 {{echo|hi}}
12264
12265 {{-{R|echo|hi}}}-
12266
12267 [[-{R|raw]]}-
12268 !! html/php
12269 <p>hi
12270 </p><p>{{echo|hi}}
12271 </p><p>[[raw]]
12272 </p>
12273 !! html/parsoid
12274 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12275 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12276 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12277 !! end
12278
12279 !! test
12280 Preprocessor precedence 4: left-most angle bracket
12281 !! options
12282 language=zh
12283 !! wikitext
12284 <!--{raw}-->
12285 !! html/php
12286 !! html/parsoid
12287 <!--{raw}-->
12288 !! end
12289
12290 !! article
12291 Template:Precedence5
12292 !! text
12293 {{{{{1}}}}}
12294 !! endarticle
12295
12296 !! test
12297 Preprocessor precedence 5: tplarg takes precedence over template
12298 !! wikitext
12299 {{Precedence5|Bullet}}
12300 !! html/php
12301 <ul><li>Bar</li></ul>
12302
12303 !! html/parsoid
12304 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12305 !! end
12306
12307 !! test
12308 Preprocessor precedence 6: broken link is rightmost opening
12309 !! options
12310 parsoid=wt2html
12311 !! wikitext
12312 {{echo|[[Foo}}
12313
12314 {{echo|[[Foo|bar|bat=baz}}
12315 !! html/php
12316 <p>{{echo|[[Foo}}
12317 </p><p>{{echo|[[Foo|bar|bat=baz}}
12318 </p>
12319 !! html/parsoid
12320 <p>{{echo|[[Foo}}</p>
12321 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12322 !! end
12323
12324 # This next test exposes a difference between PHP and Parsoid:
12325 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12326 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12327 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12328 # outer `[[Foo` extends until the `y]]`
12329 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12330 # intermediate result (after template expansion), and link processing
12331 # happens on this intermediate result, which moves the wikilink
12332 # boundary leftward to `[[Foo|Bar]]`
12333 # 2b) Parsoid works in a single step, so it's going to keep the
12334 # wikilink as extending to the `y]]`
12335 # 3a) Then PHP does linktrail processing which slurps up the trailing
12336 # `xy` inside the link.
12337 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12338 # `z` inside the link.
12339 # This is "correct" behavior. Parsoid's basic worldview is that the
12340 # `]]` inside the template shouldn't be allowed to leak out to affect
12341 # the surrounding wikilink. PHP may match Parsoid (in the future)
12342 # if you use {{#balance}} (T114445).
12343
12344 !! test
12345 Preprocessor precedence 7: broken template is rightmost opening
12346 !! options
12347 parsoid=wt2html
12348 !! wikitext
12349 [[Foo|{{echo|Bar]]
12350
12351 [[Foo|{{echo|Bar]]-x}}-y]]-z
12352
12353 Careful: linktrails can move the end of the wikilink:
12354 [[Foo|{{echo|y']]a}}l]]l
12355 !! html/php
12356 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12357 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12358 </p><p>Careful: linktrails can move the end of the wikilink:
12359 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12360 </p>
12361 !! html/parsoid
12362 <p>[[Foo|{{echo|Bar]]</p>
12363 <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar]]-x"}},"i":0}}]}'>Bar]]-x</span>-y</a>-z</p>
12364 <p>Careful: linktrails can move the end of the wikilink:
12365 <a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"y&#39;]]a"}},"i":0}}]}'>y']]a</span>ll</a></p>
12366 !! end
12367
12368 !! test
12369 Preprocessor precedence 8: broken language converter is rightmost opening
12370 !! options
12371 language=zh
12372 !! wikitext
12373 [[Foo-{R|raw]]
12374 !! html
12375 <p>[[Foo-{R|raw]]
12376 </p>
12377 !! end
12378
12379 !! article
12380 Template:Preprocessor_precedence_9
12381 !! text
12382 ;4: {{{{1}}}}
12383 ;5: {{{{{2}}}}}
12384 ;6: {{{{{{3}}}}}}
12385 ;7: {{{{{{{4}}}}}}}
12386 !! endarticle
12387
12388 !! test
12389 Preprocessor precedence 9: groups of braces
12390 !! wikitext
12391 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12392 !! html/php
12393 <dl><dt>4</dt>
12394 <dd>{Four}</dd>
12395 <dt>5</dt>
12396 <dd></dd></dl>
12397 <ul><li>Bar</li></ul>
12398 <dl><dt>6</dt>
12399 <dd>Four</dd>
12400 <dt>7</dt>
12401 <dd>{Bullet}</dd></dl>
12402
12403 !! html/parsoid
12404 <dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 9","href":"./Template:Preprocessor_precedence_9"},"params":{"1":{"wt":"Four"},"2":{"wt":"Bullet"},"3":{"wt":"1"},"4":{"wt":"2"}},"i":0}}]}'>
12405 <dt>4</dt>
12406 <dd>{Four}</dd>
12407 <dt>5</dt>
12408 <dd></dd>
12409 </dl><ul about="#mwt1">
12410 <li>Bar</li>
12411 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12412 <dt>6</dt>
12413 <dd>Four</dd>
12414 <dt>7</dt>
12415 <dd>{Bullet}</dd>
12416 </dl>
12417 !! end
12418
12419 !! article
12420 Template:Preprocessor_precedence_10
12421 !! text
12422 ;1: -{R|raw}-
12423 ;2: -{{Bullet}}-
12424 ;3: -{{{1}}}-
12425 ;4: -{{{{2}}}}-
12426 ;5: -{{{{{3}}}}}-
12427 ;6: -{{{{{{4}}}}}}-
12428 ;7: -{{{{{{{5}}}}}}}-
12429 !! endarticle
12430
12431 !! test
12432 Preprocessor precedence 10: groups of braces with leading dash
12433 !! options
12434 language=zh
12435 !! wikitext
12436 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12437 !! html/php
12438 <dl><dt>1</dt>
12439 <dd>raw</dd>
12440 <dt>2</dt>
12441 <dd>-</dd></dl>
12442 <ul><li>Bar-</li></ul>
12443 <dl><dt>3</dt>
12444 <dd>-Three-</dd>
12445 <dt>4</dt>
12446 <dd>raw2</dd>
12447 <dt>5</dt>
12448 <dd>-</dd></dl>
12449 <ul><li>Bar-</li></ul>
12450 <dl><dt>6</dt>
12451 <dd>-Three-</dd>
12452 <dt>7</dt>
12453 <dd>raw2</dd></dl>
12454
12455 !! html/parsoid
12456 <dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 10","href":"./Template:Preprocessor_precedence_10"},"params":{"1":{"wt":"Three"},"2":{"wt":"raw2"},"3":{"wt":"Bullet"},"4":{"wt":"1"},"5":{"wt":"2"}},"i":0}}]}'>
12457 <dt>1</dt>
12458 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12459 <dt>2</dt>
12460 <dd>-</dd>
12461 </dl><ul about="#mwt1">
12462 <li>Bar-</li>
12463 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12464 <dt>3</dt>
12465 <dd>-Three-</dd>
12466 <dt>4</dt>
12467 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12468 <dt>5</dt>
12469 <dd>-</dd>
12470 </dl><ul about="#mwt1">
12471 <li>Bar-</li>
12472 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12473 <dt>6</dt>
12474 <dd>-Three-</dd>
12475 <dt>7</dt>
12476 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12477 </dl>
12478 !! end
12479
12480 !! test
12481 Preprocessor precedence 11: found during visual diff testing
12482 !! wikitext
12483 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12484
12485 {{echo|-{{echo|-{{echo|x}}}}}}
12486
12487 {{echo|-{{echo|x}}}}
12488 !! html/php
12489 <p><span>-<span>-x</span></span>
12490 </p><p>--x
12491 </p><p>-x
12492 </p>
12493 !! html/parsoid
12494 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#tag:span","function":"tag"},"params":{"1":{"wt":"-{{#tag:span|-{{echo|x}}}}"}},"i":0}}]}'>-<span>-x</span></span></p>
12495
12496 <p about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"-{{echo|-{{echo|x}}}}"}},"i":0}}]}'>--x</p>
12497
12498 <p about="#mwt7" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"-{{echo|x}}"}},"i":0}}]}'>-x</p>
12499 !! end
12500
12501 !! test
12502 Preprocessor precedence 12: broken language converter closed by brace.
12503 !! options
12504 parsoid=wt2html
12505 !! wikitext
12506 This form breaks the template, which is unfortunate:
12507 *{{echo|foo-{bar}bat}}
12508
12509 But if the broken language converter markup is inside an extension
12510 tag, nothing bad happens:
12511 *<nowiki>foo-{bar}bat</nowiki>
12512 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12513 *<pre>foo-{bar}bat</pre>
12514 *{{echo|<pre>foo-{bar}bat</pre>}}
12515
12516 <tag>foo-{bar}bat</tag>
12517 {{echo|<tag>foo-{bar}bat</tag>}}
12518
12519 !! html/php+tidy
12520 <p>This form breaks the template, which is unfortunate:
12521 </p>
12522 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12523 <p>But if the broken language converter markup is inside an extension
12524 tag, nothing bad happens:
12525 </p>
12526 <ul><li>foo-&#123;bar}bat</li>
12527 <li>foo-&#123;bar}bat</li>
12528 <li><pre>foo-{bar}bat</pre></li>
12529 <li><pre>foo-{bar}bat</pre></li></ul>
12530 <pre>'foo-{bar}bat'
12531 array (
12532 )
12533 </pre>
12534 <pre>'foo-{bar}bat'
12535 array (
12536 )
12537 </pre>
12538 !! html/parsoid
12539 <p>This form breaks the template, which is unfortunate:</p>
12540 <ul>
12541 <li>{{echo|foo-{bar}bat}}</li>
12542 </ul>
12543 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12544 <ul>
12545 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12546 <li><span typeof="mw:Transclusion mw:Nowiki" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki>foo-{bar}bat&lt;/nowiki>"}},"i":0}}]}'>foo-{bar}bat</span></li>
12547 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12548 <li><pre typeof="mw:Transclusion mw:Extension/pre" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre>foo-{bar}bat&lt;/pre>"}},"i":0}}]}'>foo-{bar}bat</pre></li>
12549 </ul>
12550 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'></pre> <pre typeof="mw:Extension/tag mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tag>foo-{bar}bat&lt;/tag>"}},"i":0}}]}'></pre>
12551 !! end
12552
12553 !! test
12554 Preprocessor precedence 13: broken language converter in external link
12555 !! options
12556 parsoid=wt2html
12557 !! wikitext
12558 *[http://example.com/-{foo Example in URL]
12559 *[http://example.com Example in -{link} description]
12560 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12561 !! html/php+tidy
12562 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12563 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12564 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12565 !! html/parsoid
12566 <ul>
12567 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12568 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12569 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12570 </ul>
12571 !! end
12572
12573 !! test
12574 Preprocessor precedence 14: broken language converter in comment
12575 !! wikitext
12576 *<!--{{foo}}-->...should be ok
12577 *<!---{{foo}}-->...extra dashes
12578 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12579 !! html/php+tidy
12580 <ul><li>...should be ok</li>
12581 <li>...extra dashes</li>
12582 <li>foobat...should be ok</li></ul>
12583 !! html/parsoid
12584 <ul>
12585 <li><!--{{foo}}-->...should be ok</li>
12586 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12587 <li><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;!-- -{bar} -->bat"}},"i":0}}]}'>foo</span><span about="#mwt1"><!-- &#x2D;{bar} --></span><span about="#mwt1">bat</span>...should be ok</li>
12588 </ul>
12589 !! end
12590
12591 !! test
12592 Preprocessor precedence 15: broken brace markup in headings
12593 !! config
12594 wgFragmentMode=[ 'html5', 'legacy' ]
12595 !! options
12596 parsoid=wt2html
12597 !! wikitext
12598 __NOTOC__ __NOEDITSECTION__
12599 ===1 foo[bar 1===
12600 1
12601 ===2 foo[[bar 2===
12602 2
12603 ===3 foo{bar 3===
12604 3
12605 ===4 foo{{bar 4===
12606 4
12607 ===5 foo{{{bar 5===
12608 5
12609 ===6 foo-{bar 6===
12610 6
12611 !! html/php+tidy
12612 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12613 <p>1
12614 </p>
12615 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12616 <p>2
12617 </p>
12618 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12619 <p>3
12620 </p>
12621 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12622 <p>4
12623 </p>
12624 <h3><span id="5_foo.7B.7B.7Bbar_5"></span><span class="mw-headline" id="5_foo{{{bar_5">5 foo{{{bar 5</span></h3>
12625 <p>5
12626 </p>
12627 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12628 <p>6
12629 </p>
12630 !! html/parsoid
12631 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12632 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12633 <p>1</p>
12634 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12635 <p>2</p>
12636 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12637 <p>3</p>
12638 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12639 <p>4</p>
12640 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12641 <p>5</p>
12642 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12643 <p>6</p>
12644 !! end
12645
12646 !! test
12647 Preprocessor precedence 16: matching closing braces to opening braces
12648 !! options
12649 language=zh
12650 parsoid=wt2html
12651 !! wikitext
12652 -{{{echo|foo}}bar}-
12653 !! html/php
12654 <p>foobar
12655 </p>
12656 !! html/parsoid
12657 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,14,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>bar"}}'></span></p>
12658 !! end
12659
12660 !! test
12661 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12662 !! options
12663 parsoid=wt2html
12664 !! wikitext
12665 {{echo|hi {{}}}}
12666 !! html/php
12667 <p>hi {{}}
12668 </p>
12669 !! html/parsoid
12670 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12671 !! end
12672
12673 !! test
12674 Preprocessor precedence 18: another rightmost wins scenario
12675 !! options
12676 parsoid=wt2html
12677 !! wikitext
12678 {{ -{{{{1|tplarg}}} }} }-
12679 !! html/php
12680 <p>{{ -{tplarg }} }-
12681 </p>
12682 !! html/parsoid
12683 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12684 !! end
12685
12686 !! test
12687 Preprocessor precedence 19: break syntax
12688 !! options
12689 parsoid=wt2html
12690 !! wikitext
12691 -{{
12692 !! html/php
12693 <p>-{{
12694 </p>
12695 !! html/parsoid
12696 <p>-{{</p>
12697 !! end
12698
12699 ###
12700 ### Token Stream Patcher tests
12701 ###
12702 ### These tests won't always pass wt2wt and other modes because
12703 ### on serialization, the table will be output on a new line.
12704 ### For now, we are blacklisting them, and using this to test selser.
12705 ###
12706
12707 !!test
12708 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12709 !!options
12710 parsoid=wt2html,wt2wt
12711 !!wikitext
12712 {{echo|}}{| width = '100%'
12713 |foo
12714 |}
12715 !!html/parsoid
12716 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12717 <tbody><tr><td>foo</td></tr>
12718 </tbody></table>
12719 !!end
12720
12721 ## We used to, but no longer wt2wt this test since the default serializer
12722 ## will normalize the include directives to serialize on their own line.
12723 ## Selser will take care of preserving formatting in scenarios where they
12724 ## intermingled with other wikitext.
12725 !!test
12726 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12727 !!options
12728 parsoid=wt2html
12729 !!wikitext
12730 <includeonly>a</includeonly>{| {{{b}}}
12731 |c
12732 |}
12733 !!html/parsoid
12734 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[31,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"b\"},\"params\":{},\"i\":0}}]}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
12735 <tbody><tr><td>c</td></tr>
12736 </tbody></table>
12737 !!end
12738
12739 !! test
12740 Table wikitext syntax outside wiki-tables
12741 !! wikitext
12742 a
12743 |+ not a caption
12744 ! not a table heading
12745 |- not a table row
12746 | not a table cell
12747 | class="foo bar" | baz
12748 b
12749 |}
12750 |-
12751 c
12752 !! html
12753 <p>a
12754 |+ not a caption
12755 ! not a table heading
12756 |- not a table row
12757 | not a table cell
12758 | class="foo bar" | baz
12759 b
12760 |}
12761 |-
12762 c
12763 </p>
12764 !! end
12765
12766 ###
12767 ### Testing parsing of templates where a template arg
12768 ### has the same name as the template itself.
12769 ###
12770
12771 !! article
12772 Template:quote
12773 !! text
12774 {{{quote|{{{1}}}}}}
12775 !! endarticle
12776
12777 !!test
12778 Templates: Template Name/Arg clash: 1. Use of positional param
12779 !! wikitext
12780 {{quote|foo}}
12781 !! html
12782 <p>foo
12783 </p>
12784 !!end
12785
12786 !!test
12787 Templates: Template Name/Arg clash: 2. Use of named param
12788 !! wikitext
12789 {{quote|quote=foo}}
12790 !! html
12791 <p>foo
12792 </p>
12793 !!end
12794
12795 !!test
12796 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12797 !! wikitext
12798 {{quote|quote}}
12799 !! html
12800 <p>quote
12801 </p>
12802 !!end
12803
12804 ###
12805 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12806 ###
12807
12808 !!test
12809 Templates: 1. Simple use
12810 !! wikitext
12811 {{echo|Foo}}
12812 !! html
12813 <p>Foo
12814 </p>
12815 !!end
12816
12817 !!test
12818 Templates: 2. Inside a block tag
12819 !! wikitext
12820 <div>{{echo|Foo}}</div>
12821 <blockquote>{{echo|Foo}}</blockquote>
12822 !! html
12823 <div>Foo</div>
12824 <blockquote>Foo</blockquote>
12825
12826 !! html+tidy
12827 <div>Foo</div>
12828 <blockquote><p>Foo</p></blockquote>
12829 !!end
12830
12831 !!test
12832 Templates: P-wrapping: 1a. Templates on consecutive lines
12833 !! wikitext
12834 {{echo|Foo}}
12835 {{echo|bar}}
12836 !! html
12837 <p>Foo
12838 bar
12839 </p>
12840 !!end
12841
12842 !!test
12843 Templates: P-wrapping: 1b. Templates on consecutive lines
12844 !! wikitext
12845 Foo
12846
12847 {{echo|bar}}
12848 {{echo|baz}}
12849 !! html
12850 <p>Foo
12851 </p><p>bar
12852 baz
12853 </p>
12854 !!end
12855
12856 !!test
12857 Templates: P-wrapping: 1c. Templates on consecutive lines
12858 !! wikitext
12859 {{echo|Foo}}
12860 {{echo|bar}} <div>baz</div>
12861 !! html
12862 <p>Foo
12863 </p>
12864 bar <div>baz</div>
12865
12866 !! html+tidy
12867 <p>Foo
12868 </p><p>
12869 bar </p><div>baz</div>
12870 !! end
12871
12872 !!test
12873 Templates: P-wrapping: 1d. Template preceded by comment-only line
12874 !!options
12875 parsoid
12876 !! wikitext
12877 <!-- foo -->
12878 {{echo|Bar}}
12879 !! html
12880 <!-- foo -->
12881
12882 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12883 !!end
12884
12885 !!test
12886 Templates: Inline Text: 1. Multiple template uses
12887 !! wikitext
12888 {{echo|Foo}}bar{{echo|baz}}
12889 !! html
12890 <p>Foobarbaz
12891 </p>
12892 !!end
12893
12894 !!test
12895 Templates: Inline Text: 2. Back-to-back template uses
12896 !! wikitext
12897 {{echo|Foo}}{{echo|bar}}
12898 !! html
12899 <p>Foobar
12900 </p>
12901 !!end
12902
12903 !!test
12904 Templates: Block Tags: 1. Multiple template uses
12905 !! wikitext
12906 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12907 !! html
12908 <div>Foo</div><div>bar</div><div>baz</div>
12909
12910 !!end
12911
12912 !!test
12913 Templates: Block Tags: 2. Back-to-back template uses
12914 !! wikitext
12915 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12916 !! html
12917 <div>Foo</div><div>bar</div>
12918
12919 !!end
12920
12921 ## Parsoid drops empty elements in templates.
12922 !! test
12923 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12924 !! wikitext
12925 {{echo|a
12926 b</p>}}
12927 !! html/php+tidy
12928 <p>a
12929 </p><p>
12930 b</p><p class="mw-empty-elt"></p>
12931 !! html/parsoid
12932 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a</p><span about="#mwt1">
12933 </span><p about="#mwt1">b</p>
12934 !! end
12935
12936 !!test
12937 Templates: Links: 1. Simple example
12938 !! wikitext
12939 {{echo|[[Foo|bar]]}}
12940 !! html
12941 <p><a href="/wiki/Foo" title="Foo">bar</a>
12942 </p>
12943 !!end
12944
12945 !!test
12946 Templates: Links: 2. Generation of link href
12947 !! wikitext
12948 [[{{echo|Foo}}|bar]]
12949 !! html
12950 <p><a href="/wiki/Foo" title="Foo">bar</a>
12951 </p>
12952 !!end
12953
12954 !!test
12955 Templates: Links: 3. Generation of part of a link href
12956 !! wikitext
12957 [[Fo{{echo|o}}|bar]]
12958
12959 [[Foo{{echo|bar}}]]
12960
12961 [[Foo{{echo|bar}}baz]]
12962
12963 [[Foo{{echo|bar}}|bar]]
12964
12965 [[:Foo{{echo|bar}}]]
12966
12967 [[:Foo{{echo|bar}}|bar]]
12968 !! html
12969 <p><a href="/wiki/Foo" title="Foo">bar</a>
12970 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12971 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12972 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12973 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12974 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12975 </p>
12976 !!end
12977
12978 !!test
12979 Templates: Links: 4. Multiple templates generating link href
12980 !! wikitext
12981 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12982 !! html
12983 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12984 </p>
12985 !!end
12986
12987 !!test
12988 Templates: Links: 5. Generation of link text
12989 !! wikitext
12990 [[Foo|{{echo|bar}}]]
12991 !! html
12992 <p><a href="/wiki/Foo" title="Foo">bar</a>
12993 </p>
12994 !!end
12995
12996 !!test
12997 Templates: Links: 5. Nested templates (only outermost template should be marked)
12998 !! wikitext
12999 {{echo|[[{{echo|Foo}}|bar]]}}
13000 !! html
13001 <p><a href="/wiki/Foo" title="Foo">bar</a>
13002 </p>
13003 !!end
13004
13005 !!test
13006 Templates: HTML Tag: 1. Generation of HTML attr. key
13007 !! wikitext
13008 <div {{echo|style}}="color:red;">foo</div>
13009 !! html
13010 <div style="color:red;">foo</div>
13011
13012 !!end
13013
13014 !!test
13015 Templates: HTML Tag: 2. Generation of HTML attr. value
13016 !! wikitext
13017 <div style={{echo|'color:red;'}}>foo</div>
13018 !! html
13019 <div style="color:red;">foo</div>
13020
13021 !!end
13022
13023 !!test
13024 Templates: HTML Tag: 3. Generation of HTML attr key and value
13025 !! wikitext
13026 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
13027 !! html
13028 <div style="color:red;">foo</div>
13029
13030 !!end
13031
13032 !!test
13033 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
13034 !! wikitext
13035 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
13036 !! html
13037 <div title="This is a long title with just one piece templated">foo</div>
13038
13039 !!end
13040
13041 !!test
13042 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
13043 !! wikitext
13044 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
13045 !! html
13046 <div title="This is a long title with just one piece templated">foo</div>
13047
13048 !!end
13049
13050 !!test
13051 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
13052 !! wikitext
13053 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
13054 !! html
13055 <div title="This is a long title with just one piece templated">foo</div>
13056
13057 !!end
13058
13059 # SSS FIXME: While it is great we added support for all this,
13060 # do we want to make this part of the spec? Maybe we want to
13061 # deprecate this kind of usage in the future?
13062 !!test
13063 Templates: HTML Tag: 7. Generation of partial attribute key string
13064 !! wikitext
13065 <div st{{echo|yle}}="color:red;">foo</div>
13066 !! html
13067 <div style="color:red;">foo</div>
13068
13069 !!end
13070
13071 !! test
13072 Templates: HTML Tag: 8. Template-generated attribute (k=v)
13073 !! wikitext
13074 <div {{echo|1=id="v1"}}>bar</div>
13075 !! html
13076 <div id="v1">bar</div>
13077
13078 !!end
13079
13080 !! test
13081 Templates: HTML Tag: 9. Multiple template-generated attributes
13082 !! wikitext
13083 <div {{echo|1=id="v1" title="foo"}}>bar</div>
13084 !! html
13085 <div id="v1" title="foo">bar</div>
13086
13087 !!end
13088
13089 !! test
13090 Templates: Support for templates generating attributes and content
13091 !! wikitext
13092 {| {{mixed_attr_content_template}}
13093 |-
13094 |bar
13095 |}
13096 !! html/php
13097 <table style="color:red;" title="T48811">
13098
13099 <tr>
13100 <td>foo
13101 </td></tr>
13102 <tr>
13103 <td>bar
13104 </td></tr></table>
13105
13106 !! html/parsoid
13107 <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|}"]}'>
13108 <tbody><tr>
13109 <td>foo</td></tr>
13110 <tr>
13111 <td>bar</td></tr>
13112 </tbody></table>
13113 !!end
13114
13115 !! article
13116 Template:attribute_from_template
13117 !! text
13118 class="123"
13119 !! endarticle
13120
13121 !! test
13122 Table cell with attribute before expanded attribute
13123 !! wikitext
13124 {|
13125 | align="center" {{attribute_from_template}} |456
13126 |}
13127 !! html/parsoid
13128 <table>
13129 <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>
13130 </tbody></table>
13131 !! end
13132
13133 !! test
13134 1. Entities and nowikis inside templated attributes should be handled correctly
13135 !! wikitext
13136 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
13137 !! html/php
13138 <div style="background:#f9f9f9;">foo</div>
13139
13140 !! html/parsoid
13141 <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>
13142 !! end
13143
13144 !! test
13145 2. Entities and nowikis inside templated attributes should be handled correctly
13146 !! wikitext
13147 {|
13148 |{{table_attribs_3}}
13149 |}
13150 !! html/php
13151 <table>
13152 <tr>
13153 <td style="background:#f9f9f9;">Foo
13154 </td></tr></table>
13155
13156 !! html/parsoid
13157 <table>
13158 <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>
13159 </tbody></table>
13160 !! end
13161
13162 !! test
13163 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13164 !! wikitext
13165 {{tbl-start}}
13166 |{{table_attribs_3}}
13167 {{tbl-end}}
13168 !! html/php
13169 <table>
13170 <tr>
13171 <td style="background:#f9f9f9;">Foo
13172 </td></tr></table>
13173
13174 !! html/parsoid
13175 <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}}]}'>
13176 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
13177 </tbody></table>
13178 !! end
13179
13180 # T107622
13181 !! test
13182 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13183 !! wikitext
13184 {|
13185 |{{table_attribs_6}} hi
13186 |}
13187 !! html/php
13188 <table>
13189 <tr>
13190 <td style="background: red;">hi
13191 </td></tr></table>
13192
13193 !! html/parsoid
13194 <table>
13195 <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>
13196 </tbody></table>
13197 !! end
13198
13199 !!test
13200 Templates: HTML Tables: 1. Generating start of a HTML table
13201 !! wikitext
13202 {{echo|<table><tr><td>foo</td>}}</tr></table>
13203 !! html
13204 <table><tr><td>foo</td></tr></table>
13205
13206 !!end
13207
13208 !!test
13209 Templates: HTML Tables: 2a. Generating middle of a HTML table
13210 !! wikitext
13211 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13212 !! html
13213 <table><tr><td>foo</td></tr></table>
13214
13215 !!end
13216
13217 !!test
13218 Templates: HTML Tables: 2b. Generating middle of a HTML table
13219 !! wikitext
13220 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13221 !! html
13222 <table><tr><td>foo</td></tr></table>
13223
13224 !!end
13225
13226 !!test
13227 Templates: HTML Tables: 3. Generating end of a HTML table
13228 !! wikitext
13229 <table><tr>{{echo|<td>foo</td></tr></table>}}
13230 !! html
13231 <table><tr><td>foo</td></tr></table>
13232
13233 !!end
13234
13235 !!test
13236 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13237 !! wikitext
13238 {{echo|<table>}}<tr><td>foo</td></tr></table>
13239 !! html
13240 <table><tr><td>foo</td></tr></table>
13241
13242 !!end
13243
13244 !!test
13245 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13246 !! wikitext
13247 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13248 !! html
13249 <table><tr><td>foo</td></tr></table>
13250
13251 !!end
13252
13253 !!test
13254 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13255 !! wikitext
13256 <table><tr>{{echo|<td>}}foo</td></tr></table>
13257 !! html
13258 <table><tr><td>foo</td></tr></table>
13259
13260 !!end
13261
13262 !!test
13263 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13264 !! wikitext
13265 <table><tr><td>foo{{echo|</td>}}</tr></table>
13266 !! html
13267 <table><tr><td>foo</td></tr></table>
13268
13269 !!end
13270
13271 !!test
13272 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13273 !! wikitext
13274 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13275 !! html
13276 <table><tr><td>foo</td></tr></table>
13277
13278 !!end
13279
13280 !!test
13281 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13282 !! wikitext
13283 <table><tr><td>foo</td></tr>{{echo|</table>}}
13284 !! html
13285 <table><tr><td>foo</td></tr></table>
13286
13287 !!end
13288
13289 !!test
13290 Templates: HTML Tables: 5. Proper fostering of categories from inside
13291 !!options
13292 parsoid=wt2html,wt2wt
13293 !! wikitext
13294 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13295 <!--Two categories (T52330)-->
13296 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13297 !! html
13298 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13299 <!--Two categories (T52330)-->
13300 <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>
13301 !!end
13302
13303 ## Remex doesn't account for fostered content.
13304 !! test
13305 Templates: Wiki Tables: 1a. Fostering of entire template content
13306 !! wikitext
13307 {|
13308 {{echo|a}}
13309 |}
13310 !! html/php
13311 <table>
13312 a
13313 <tr><td></td></tr></table>
13314
13315 !! html/php+tidy
13316
13317 a
13318 <table><tbody><tr><td></td></tr></tbody></table>
13319 !! html/parsoid
13320 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}},"\n|}"]}'>a</p><table about="#mwt2">
13321
13322 </table>
13323 !! end
13324
13325 !!test
13326 Templates: Wiki Tables: 1b. Fostering of entire template content
13327 !! wikitext
13328 {|
13329 {{echo|<div>}}
13330 foo
13331 {{echo|</div>}}
13332 |}
13333 !! html
13334 <table>
13335 <div>
13336 <p>foo
13337 </p>
13338 </div>
13339 <tr><td></td></tr></table>
13340
13341 !! html/php+tidy
13342 <div>
13343 <p>foo
13344 </p>
13345 </div><table>
13346
13347 <tbody><tr><td></td></tr></tbody></table>
13348 !! html/parsoid
13349 <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|}"]}'>
13350 <p>foo</p>
13351 </div><table about="#mwt3">
13352
13353 </table>
13354 !! end
13355
13356 ## Remex doesn't account for fostered content.
13357 !! test
13358 Templates: Wiki Tables: 2. Fostering of partial template content
13359 !! wikitext
13360 {|
13361 {{echo|a
13362 <div>b</div>}}
13363 |}
13364 !! html/php
13365 <table>
13366 a
13367 <div>b</div>
13368 <tr><td></td></tr></table>
13369
13370 !! html/php+tidy
13371
13372 a
13373 <div>b</div><table>
13374 <tbody><tr><td></td></tr></tbody></table>
13375 !! html/parsoid
13376 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n&lt;div>b&lt;/div>"}},"i":0}},"\n|}"]}'>a</p><div about="#mwt2">b</div><table about="#mwt2">
13377
13378
13379 </table>
13380 !! end
13381
13382 !!test
13383 Templates: Wiki Tables: 3. td-content via multiple templates
13384 !! wikitext
13385 {|
13386 {{echo|{{pipe}}a}}{{echo|b}}
13387 |}
13388 !! html
13389 <table>
13390 <tr>
13391 <td>ab
13392 </td></tr></table>
13393
13394 !!end
13395
13396 !!test
13397 Templates: Wiki Tables: 4. Templated tags, no content
13398 !! wikitext
13399 {{tbl-start}}
13400 {{tbl-end}}
13401 !! html
13402 <table>
13403 <tr><td></td></tr></table>
13404
13405 !!end
13406
13407 !!test
13408 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13409 !! wikitext
13410 {{tbl-start}}
13411 |foo
13412 {{tbl-end}}
13413 !! html
13414 <table>
13415 <tr>
13416 <td>foo
13417 </td></tr></table>
13418
13419 !!end
13420
13421 !!test
13422 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13423 !! wikitext
13424 {{tbl-start}}
13425 {{!}}foo
13426 {{tbl-end}}
13427 !! html
13428 <table>
13429 <tr>
13430 <td>foo
13431 </td></tr></table>
13432
13433 !!end
13434
13435 ## This test case is very specific to Parsoid's internals
13436 ## and is hence only tested for Parsoid's code. Parsoid uses
13437 ## a <meta> marker tag for <ref> tags and they are expanded
13438 ## much later. We are verifying that this <meta> tag usage
13439 ## doesn't prevent foster parenting.
13440 !! test
13441 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13442 !! wikitext
13443 {{PartialTable}}<ref>foo</ref>
13444 |}
13445
13446 <references />
13447 !! html/parsoid
13448 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><sup about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","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></p><table about="#mwt2">
13449 <tbody>
13450 </tbody></table>
13451
13452 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
13453 !! end
13454
13455 !! test
13456 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13457 !! wikitext
13458 {{echo|
13459 {{{!}}
13460 {{!}}-}}
13461 <onlyinclude>
13462 |foo
13463 </onlyinclude>
13464 {{!}}}
13465 !! html/parsoid
13466 <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{{!}}}"]}'>
13467 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13468 <tbody><tr>
13469
13470 <td>foo
13471 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13472 </tbody></table>
13473 !! end
13474
13475 !!test
13476 Templates: Lists: Multi-line list-items via templates
13477 !! wikitext
13478 *{{echo|a {{nonexistent|
13479 unused}}}}
13480 *{{echo|b {{nonexistent|
13481 unused}}}}
13482 !! html
13483 <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>
13484 <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>
13485
13486 !!end
13487
13488 !!test
13489 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13490 !! wikitext
13491 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13492 !! html
13493 <p><i>ab</i>c<i>d</i>e
13494 </p>
13495 !!end
13496
13497 !!test
13498 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13499 (PHP parser generates misnested html)
13500 !! wikitext
13501 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13502 !! html/parsoid
13503 <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>
13504 !!end
13505
13506 !!test
13507 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13508 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13509 !! options
13510 parsoid=wt2html,wt2wt
13511 !! wikitext
13512 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13513 !! html
13514 <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>
13515 <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>
13516 <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>
13517 !!end
13518
13519 !!test
13520 Templates: Ugly nesting: 4. Divs opened/closed across templates
13521 !! wikitext
13522 a<div>b{{echo|c</div>d}}e
13523 !! html
13524 a<div>bc</div>de
13525
13526 !! html+tidy
13527 <p>a</p><div>bc</div><p>de
13528 </p>
13529 !! end
13530
13531 !! test
13532 Templates: Ugly templates: 3. newline-only template parameter
13533 !! wikitext
13534 foo {{echo|
13535 }}
13536 !! html
13537 <p>foo
13538 </p>
13539 !! end
13540
13541 # This looks like a bug: a single newline triggers p/br for some reason.
13542 !! test
13543 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13544 !! wikitext
13545 {{echo|
13546 }}
13547 !! html
13548 <p><br />
13549 </p>
13550 !! end
13551
13552 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13553 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13554 !! test
13555 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13556 !! wikitext
13557 {{echo|<table>}}
13558 {{echo|<div>foo}}
13559 {{echo|</table>}}
13560 !! html/parsoid
13561 <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
13562 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13563 </table>
13564 !! end
13565
13566 # T66017 -- ugly wikitext with fostered content generates two template ranges
13567 # that are "identical" and generate nesting cycles in the algorithm
13568 !! test
13569 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13570 !! wikitext
13571 {{echo|<table><tr><td><table>}}
13572 {{echo|<div>}}
13573 {{echo|</div>}}
13574 !! html/parsoid
13575 <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"}'>
13576 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13577 </table></td></tr></tbody></table>
13578 !! end
13579
13580 !! test
13581 Templates: Parameters substituted at the top-level
13582 !! wikitext
13583 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13584
13585 {{{foo|bar|baz}}}
13586 !! html/php
13587 <p><i>who</i> me? <b>never!</b>
13588 </p><p>bar
13589 </p>
13590 !! html/parsoid
13591 <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>
13592
13593 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13594 !! end
13595
13596 !! test
13597 Templates: Param with empty arg in the final position
13598 !! wikitext
13599 {{{hi|}}}
13600 !! html/parsoid
13601 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13602 !! end
13603
13604 !!test
13605 Parser Functions: 1. Simple example
13606 !! wikitext
13607 {{uc:foo}}
13608 !! html
13609 <p>FOO
13610 </p>
13611 !!end
13612
13613 !!test
13614 Parser Functions: 2. Nested use (only outermost should be marked up)
13615 !! wikitext
13616 {{uc:{{lc:FOO}}}}
13617 !! html
13618 <p>FOO
13619 </p>
13620 !!end
13621
13622 ## Note that the templates inside the references are not wrapped
13623 !! test
13624 Template nested in extension tag in template
13625 !! wikitext
13626 {{echo|hi<ref>[[ho|{{echo|hi}}]]</ref>}}
13627 {{echo|hi<ref>[http://test.com?q={{echo|ho}}]</ref>}}
13628 <references />
13629 !! html/parsoid
13630 <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>
13631 <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>
13632 <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>
13633 !! end
13634
13635 ###
13636 ### Pre-save transform tests
13637 ###
13638 !! test
13639 pre-save transform: subst:
13640 !! options
13641 pst
13642 !! wikitext
13643 {{subst:test}}
13644 !! html/php
13645 This is a test template
13646 !! end
13647
13648 !! test
13649 pre-save transform: normal template
13650 !! options
13651 pst
13652 !! wikitext
13653 {{test}}
13654 !! html/php
13655 {{test}}
13656 !! end
13657
13658 !! test
13659 pre-save transform: nonexistent template
13660 !! options
13661 pst
13662 !! wikitext
13663 {{thistemplatedoesnotexist}}
13664 !! html/php
13665 {{thistemplatedoesnotexist}}
13666 !! end
13667
13668 !! test
13669 pre-save transform: subst magic variables
13670 !! options
13671 pst
13672 !! wikitext
13673 {{subst:SITENAME}}
13674 !! html/php
13675 MediaWiki
13676 !! end
13677
13678 # This is T2089, which I fixed. -- wtm
13679 !! test
13680 pre-save transform: subst: templates with parameters
13681 !! options
13682 pst
13683 !! wikitext
13684 {{subst:paramtest|param="something else"}}
13685 !! html/php
13686 This is a test template with parameter "something else"
13687 !! end
13688
13689 !! article
13690 Template:nowikitest
13691 !! text
13692 <nowiki>'''not wiki'''</nowiki>
13693 !! endarticle
13694
13695 !! test
13696 pre-save transform: nowiki in subst (T3188)
13697 !! options
13698 pst
13699 !! wikitext
13700 {{subst:nowikitest}}
13701 !! html/php
13702 <nowiki>'''not wiki'''</nowiki>
13703 !! end
13704
13705 !! article
13706 Template:commenttest
13707 !! text
13708 This template has <!-- a comment --> in it.
13709 !! endarticle
13710
13711 !! test
13712 pre-save transform: comment in subst (T3936)
13713 !! options
13714 pst
13715 !! wikitext
13716 {{subst:commenttest}}
13717 !! html/php
13718 This template has <!-- a comment --> in it.
13719 !! end
13720
13721 !! test
13722 pre-save transform: unclosed tag
13723 !! options
13724 pst
13725 !! wikitext
13726 <nowiki>'''not wiki'''
13727 !! html/php
13728 <nowiki>'''not wiki'''
13729 !! end
13730
13731 !! test
13732 pre-save transform: mixed tag case
13733 !! options
13734 pst
13735 !! wikitext
13736 <NOwiki>'''not wiki'''</noWIKI>
13737 !! html/php
13738 <NOwiki>'''not wiki'''</noWIKI>
13739 !! end
13740
13741 !! test
13742 pre-save transform: unclosed comment in <nowiki>
13743 !! options
13744 pst
13745 !! wikitext
13746 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13747 !! html/php
13748 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13749 !!end
13750
13751 # Leading @ in this template definition works around a limitation
13752 # in parsoid's parserTests which otherwise strips the <span> from the
13753 # result (confusing it for a template wrapper)
13754 !! article
13755 Template:dangerous
13756 !!text
13757 @<span onmouseover="alert('crap')">Oh no</span>
13758 !!endarticle
13759
13760 !!test
13761 (confirming safety of fix for subst T3936)
13762 !! wikitext
13763 {{Template:dangerous}}
13764 !! html
13765 <p>@<span>Oh no</span>
13766 </p>
13767 !! end
13768
13769 !! test
13770 pre-save transform: comment containing gallery (T7024)
13771 !! options
13772 pst
13773 !! wikitext
13774 <!-- <gallery>data</gallery> -->
13775 !! html/php
13776 <!-- <gallery>data</gallery> -->
13777 !!end
13778
13779 !! test
13780 pre-save transform: comment containing extension
13781 !! options
13782 pst
13783 !! wikitext
13784 <!-- <tag>data</tag> -->
13785 !! html/php
13786 <!-- <tag>data</tag> -->
13787 !!end
13788
13789 !! test
13790 pre-save transform: comment containing nowiki
13791 !! options
13792 pst
13793 !! wikitext
13794 <!-- <nowiki>data</nowiki> -->
13795 !! html/php
13796 <!-- <nowiki>data</nowiki> -->
13797 !!end
13798
13799 !! test
13800 pre-save transform: <noinclude> in subst (T5298)
13801 !! options
13802 pst
13803 !! wikitext
13804 {{subst:Includes}}
13805 !! html/php
13806 Foobar
13807 !! end
13808
13809 !! test
13810 pre-save transform: <onlyinclude> in subst (T5298)
13811 !! options
13812 pst
13813 !! wikitext
13814 {{subst:Includes2}}
13815 !! html/php
13816 Foo
13817 !! end
13818
13819 !! article
13820 Template:SubstTest
13821 !!text
13822 {{<includeonly>subst:</includeonly>Includes}}
13823 !! endarticle
13824
13825 !! article
13826 Template:SafeSubstTest
13827 !! text
13828 {{<includeonly>safesubst:</includeonly>Includes}}
13829 !! endarticle
13830
13831 !! test
13832 T24297: safesubst: works during PST
13833 !! options
13834 pst
13835 !! wikitext
13836 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13837 !! html/php
13838 FoobarFoobar
13839 !! end
13840
13841 !! test
13842 T24297: safesubst: works during normal parse
13843 !! wikitext
13844 {{SafeSubstTest}}
13845 !! html
13846 <p>Foobar
13847 </p>
13848 !! end
13849
13850 !! test
13851 subst: does not work during normal parse
13852 !! wikitext
13853 {{SubstTest}}
13854 !! html
13855 <p>{{subst:Includes}}
13856 </p>
13857 !! end
13858
13859 !! test
13860 pre-save transform: context links ("pipe trick")
13861 !! options
13862 pst
13863 !! wikitext
13864 [[Article (context)|]]
13865 [[Bar:Article|]]
13866 [[:Bar:Article|]]
13867 [[Bar:Article (context)|]]
13868 [[:Bar:Article (context)|]]
13869 [[|Article]]
13870 [[|Article (context)]]
13871 [[Bar:X (Y) Z|]]
13872 [[:Bar:X (Y) Z|]]
13873 !! html/php
13874 [[Article (context)|Article]]
13875 [[Bar:Article|Article]]
13876 [[:Bar:Article|Article]]
13877 [[Bar:Article (context)|Article]]
13878 [[:Bar:Article (context)|Article]]
13879 [[Article]]
13880 [[Article (context)]]
13881 [[Bar:X (Y) Z|X (Y) Z]]
13882 [[:Bar:X (Y) Z|X (Y) Z]]
13883 !! end
13884
13885 !! test
13886 pre-save transform: context links ("pipe trick") with interwiki prefix
13887 !! options
13888 pst
13889 !! wikitext
13890 [[interwiki:Article|]]
13891 [[:interwiki:Article|]]
13892 [[interwiki:Bar:Article|]]
13893 [[:interwiki:Bar:Article|]]
13894 !! html/php
13895 [[interwiki:Article|Article]]
13896 [[:interwiki:Article|Article]]
13897 [[interwiki:Bar:Article|Bar:Article]]
13898 [[:interwiki:Bar:Article|Bar:Article]]
13899 !! end
13900
13901 !! test
13902 pre-save transform: context links ("pipe trick") with parens in title
13903 !! options
13904 pst title=[[Somearticle (context)]]
13905 !! wikitext
13906 [[|Article]]
13907 !! html/php
13908 [[Article (context)|Article]]
13909 !! end
13910
13911 !! test
13912 pre-save transform: context links ("pipe trick") with comma in title
13913 !! options
13914 pst title=[[Someplace, Somewhere]]
13915 !! wikitext
13916 [[|Otherplace]]
13917 [[Otherplace, Elsewhere|]]
13918 [[Otherplace, Elsewhere, Anywhere|]]
13919 !! html/php
13920 [[Otherplace, Somewhere|Otherplace]]
13921 [[Otherplace, Elsewhere|Otherplace]]
13922 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13923 !! end
13924
13925 !! test
13926 pre-save transform: context links ("pipe trick") with parens and comma
13927 !! options
13928 pst title=[[Someplace (IGNORED), Somewhere]]
13929 !! wikitext
13930 [[|Otherplace]]
13931 [[Otherplace (place), Elsewhere|]]
13932 !! html/php
13933 [[Otherplace, Somewhere|Otherplace]]
13934 [[Otherplace (place), Elsewhere|Otherplace]]
13935 !! end
13936
13937 !! test
13938 pre-save transform: context links ("pipe trick") with comma and parens
13939 !! options
13940 pst title=[[Who, me? (context)]]
13941 !! wikitext
13942 [[|Yes, you.]]
13943 [[Me, Myself, and I (1937 song)|]]
13944 !! html/php
13945 [[Yes, you. (context)|Yes, you.]]
13946 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13947 !! end
13948
13949 !! test
13950 pre-save transform: context links ("pipe trick") with namespace
13951 !! options
13952 pst title=[[Ns:Somearticle]]
13953 !! wikitext
13954 [[|Article]]
13955 !! html/php
13956 [[Ns:Article|Article]]
13957 !! end
13958
13959 !! test
13960 pre-save transform: context links ("pipe trick") with namespace and parens
13961 !! options
13962 pst title=[[Ns:Somearticle (context)]]
13963 !! wikitext
13964 [[|Article]]
13965 !! html/php
13966 [[Ns:Article (context)|Article]]
13967 !! end
13968
13969 !! test
13970 pre-save transform: context links ("pipe trick") with namespace and comma
13971 !! options
13972 pst title=[[Ns:Somearticle, Context, Whatever]]
13973 !! wikitext
13974 [[|Article]]
13975 !! html/php
13976 [[Ns:Article, Context, Whatever|Article]]
13977 !! end
13978
13979 !! test
13980 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13981 !! options
13982 pst title=[[Ns:Somearticle, Context (context)]]
13983 !! wikitext
13984 [[|Article]]
13985 !! html/php
13986 [[Ns:Article (context)|Article]]
13987 !! end
13988
13989 !! test
13990 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13991 !! options
13992 pst title=[[Ns:Somearticle (IGNORED), Context]]
13993 !! wikitext
13994 [[|Article]]
13995 !! html/php
13996 [[Ns:Article, Context|Article]]
13997 !! end
13998
13999 !! test
14000 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
14001 !! options
14002 pst
14003 !! wikitext
14004 [[Article(context)|]]
14005 [[Bar:Article(context)|]]
14006 [[:Bar:Article(context)|]]
14007 [[|Article(context)]]
14008 [[Bar:X(Y)Z|]]
14009 [[:Bar:X(Y)Z|]]
14010 !! html/php
14011 [[Article(context)|Article]]
14012 [[Bar:Article(context)|Article]]
14013 [[:Bar:Article(context)|Article]]
14014 [[Article(context)]]
14015 [[Bar:X(Y)Z|X(Y)Z]]
14016 [[:Bar:X(Y)Z|X(Y)Z]]
14017 !! end
14018
14019 !! test
14020 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
14021 !! options
14022 pst
14023 !! wikitext
14024 [[Article (context)|]]
14025 [[Bar:Article (context)|]]
14026 [[:Bar:Article (context)|]]
14027 [[|Article (context)]]
14028 [[Bar:X (Y) Z|]]
14029 [[:Bar:X (Y) Z|]]
14030 !! html/php
14031 [[Article (context)|Article]]
14032 [[Bar:Article (context)|Article]]
14033 [[:Bar:Article (context)|Article]]
14034 [[Article (context)]]
14035 [[Bar:X (Y) Z|X (Y) Z]]
14036 [[:Bar:X (Y) Z|X (Y) Z]]
14037 !! end
14038
14039 !! test
14040 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
14041 !! options
14042 pst
14043 !! wikitext
14044 [[Article(context)|]]
14045 [[Bar:Article(context)|]]
14046 [[:Bar:Article(context)|]]
14047 [[|Article(context)]]
14048 [[Bar:X(Y)Z|]]
14049 [[:Bar:X(Y)Z|]]
14050 !! html/php
14051 [[Article(context)|Article]]
14052 [[Bar:Article(context)|Article]]
14053 [[:Bar:Article(context)|Article]]
14054 [[Article(context)]]
14055 [[Bar:X(Y)Z|X(Y)Z]]
14056 [[:Bar:X(Y)Z|X(Y)Z]]
14057 !! end
14058
14059 !! test
14060 pre-save transform: context links ("pipe trick") with commas (T23660)
14061 !! options
14062 pst
14063 !! wikitext
14064 [[Article (context), context|]]
14065 [[Article (context),context|]]
14066 [[Bar:Article (context), context|]]
14067 [[Bar:Article (context),context|]]
14068 [[:Bar:Article (context), context|]]
14069 [[:Bar:Article (context),context|]]
14070 !! html/php
14071 [[Article (context), context|Article]]
14072 [[Article (context),context|Article]]
14073 [[Bar:Article (context), context|Article]]
14074 [[Bar:Article (context),context|Article]]
14075 [[:Bar:Article (context), context|Article]]
14076 [[:Bar:Article (context),context|Article]]
14077 !! end
14078
14079 !! test
14080 Parsoid: backwards pipe trick
14081 !! wikitext
14082 [[|'''bar''']]
14083 !! html/php
14084 <p>[[|<b>bar</b>]]
14085 </p>
14086 !! html/parsoid
14087 <p>[[|<b>bar</b>]]</p>
14088 !! end
14089
14090 !! test
14091 pre-save transform: trim trailing empty lines
14092 !! options
14093 pst
14094 !! wikitext
14095 Empty lines are trimmed
14096
14097
14098
14099
14100 !! html/php
14101 Empty lines are trimmed
14102 !! end
14103
14104 !! test
14105 pre-save transform: Signature expansion
14106 !! options
14107 pst
14108 !! wikitext
14109 * ~~~
14110 * ~~~~
14111 * ~~~~~
14112 * <noinclude>~~~</noinclude>
14113 * <includeonly>~~~</includeonly>
14114 * <onlyinclude>~~~</onlyinclude>
14115 !! html/php
14116 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
14117 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14118 * 00:02, 1 January 1970 (UTC)
14119 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
14120 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
14121 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
14122 !! end
14123
14124
14125 !! test
14126 ParserOutput flags from signature expansion (T84843)
14127 !! options
14128 pst
14129 showflags
14130 !! wikitext
14131 ~~~~
14132 !! html/php
14133 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14134 flags=user-signature
14135 !! end
14136
14137
14138 !! test
14139 pre-save transform: Signature expansion in nowiki tags (T2093)
14140 !! options
14141 pst disabled
14142 !! wikitext
14143 Shall not expand:
14144
14145 <nowiki>~~~~</nowiki>
14146
14147 <includeonly><nowiki>~~~~</nowiki></includeonly>
14148
14149 <noinclude><nowiki>~~~~</nowiki></noinclude>
14150
14151 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14152
14153 {{subst:Foo}} shall be converted to FOO
14154
14155 As well as inside noinclude/onlyinclude
14156 <noinclude>{{subst:Foo}}</noinclude>
14157 <onlyinclude>{{subst:Foo}}</onlyinclude>
14158
14159 But not inside includeonly
14160 <includeonly>{{subst:Foo}}</includeonly>
14161 !! html/php
14162 Shall not expand:
14163
14164 <nowiki>~~~~</nowiki>
14165
14166 <includeonly><nowiki>~~~~</nowiki></includeonly>
14167
14168 <noinclude><nowiki>~~~~</nowiki></noinclude>
14169
14170 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14171
14172 FOO shall be converted to FOO
14173
14174 As well as inside noinclude/onlyinclude
14175 <noinclude>FOO</noinclude>
14176 <onlyinclude>FOO</onlyinclude>
14177
14178 But not inside includeonly
14179 <includeonly>{{subst:Foo}}</includeonly>
14180 !! end
14181
14182 !! test
14183 Parsoid: Recognize nowiki with trailing space in tags
14184 !! options
14185 parsoid=wt2html
14186 !! wikitext
14187 <nowiki ><div>[[foo]]</nowiki >
14188
14189 a<nowiki / >b
14190
14191 c<nowiki />d
14192
14193 e<nowiki/ >f
14194 !! html
14195 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14196 <p>ab</p>
14197 <p>cd</p>
14198 <p>ef</p>
14199 !! end
14200
14201 !! test
14202 Parsoid: Recognize nowiki with odd capitalization
14203 !! options
14204 parsoid=wt2html
14205 !! wikitext
14206 <noWikI ><div>[[foo]]</Nowiki >
14207 !! html
14208 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14209 !! end
14210
14211
14212 !! test
14213 Parsoid: Escape nowiki with trailing space in tags
14214 !! options
14215 parsoid=html2wt
14216 !! html/parsoid
14217 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14218 <p>a&lt;nowiki /&gt;b</p>
14219 <p>c&lt;nowiki/ &gt;d</p>
14220 !! wikitext
14221 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14222
14223 a&lt;nowiki /&gt;b
14224
14225 c&lt;nowiki/ &gt;d
14226 !! end
14227
14228 !! test
14229 Parsoid: Escape weird noWikI capitalizations
14230 !! options
14231 parsoid=html2wt
14232 !! html/parsoid
14233 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14234 !! wikitext
14235 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14236 !! end
14237
14238 ###
14239 ### Message transform tests
14240 ###
14241 !! test
14242 message transform: magic variables
14243 !! options
14244 msg
14245 !! wikitext
14246 {{SITENAME}}
14247 !! html
14248 MediaWiki
14249 !! end
14250
14251 !! test
14252 message transform: should not transform wiki markup
14253 !! options
14254 msg
14255 !! wikitext
14256 ''test''
14257 !! html
14258 ''test''
14259 !! end
14260
14261 !! test
14262 message transform: <noinclude> in transcluded template (T6926)
14263 !! options
14264 msg
14265 !! wikitext
14266 {{Includes}}
14267 !! html
14268 Foobar
14269 !! end
14270
14271 !! test
14272 message transform: <onlyinclude> in transcluded template (T6926)
14273 !! options
14274 msg
14275 !! wikitext
14276 {{Includes2}}
14277 !! html
14278 Foo
14279 !! end
14280
14281 !! test
14282 {{#special:}} page name, known
14283 !! options
14284 msg
14285 !! wikitext
14286 {{#special:Recentchanges}}
14287 !! html
14288 Special:RecentChanges
14289 !! end
14290
14291 !! test
14292 {{#special:}} page name with subpage, known
14293 !! options
14294 msg
14295 !! wikitext
14296 {{#special:Recentchanges/param}}
14297 !! html
14298 Special:RecentChanges/param
14299 !! end
14300
14301 !! test
14302 {{#special:}} page name, unknown
14303 !! options
14304 msg
14305 !! wikitext
14306 {{#special:foobar nonexistent}}
14307 !! html
14308 Special:Foobar nonexistent
14309 !! end
14310
14311 !! test
14312 {{#speciale:}} page name, known
14313 !! options
14314 msg
14315 !! wikitext
14316 {{#speciale:Recentchanges}}
14317 !! html
14318 Special:RecentChanges
14319 !! end
14320
14321 !! test
14322 {{#speciale:}} page name with subpage, known
14323 !! options
14324 msg
14325 !! wikitext
14326 {{#speciale:Recentchanges/param}}
14327 !! html
14328 Special:RecentChanges/param
14329 !! end
14330
14331 !! test
14332 {{#speciale:}} page name, unknown
14333 !! options
14334 msg
14335 !! wikitext
14336 {{#speciale:foobar nonexistent}}
14337 !! html
14338 Special:Foobar_nonexistent
14339 !! end
14340
14341 ###
14342 ### Images
14343 ###
14344 ### For Parsoid-specific tests, see
14345 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14346
14347 !! test
14348 Simple image
14349 !! options
14350 parsoid=wt2html,wt2wt,html2html
14351 !! wikitext
14352 [[Image:foobar.jpg]]
14353 !! html/php
14354 <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>
14355 </p>
14356 !! html/parsoid
14357 <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>
14358 !! end
14359
14360 !! test
14361 Serialize simple image with span wrapper
14362 !! options
14363 parsoid=html2wt
14364 !! html/parsoid
14365 <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>
14366 !! wikitext
14367 [[File:Foobar.jpg]]
14368 !! end
14369
14370 !! test
14371 Simple image (using File: namespace, now canonical)
14372 !! wikitext
14373 [[File:Foobar.jpg]]
14374 !! html/php
14375 <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>
14376 </p>
14377 !! html/parsoid
14378 <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>
14379 !! end
14380
14381 !! test
14382 Right-aligned image
14383 !! wikitext
14384 [[File:Foobar.jpg|right]]
14385 !! html/php
14386 <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>
14387
14388 !! html/parsoid
14389 <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>
14390 !! end
14391
14392 !! test
14393 Image with caption
14394 !! wikitext
14395 [[File:Foobar.jpg|right|Caption text]]
14396 !! html/php
14397 <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>
14398
14399 !! html/parsoid
14400 <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>
14401 !! end
14402
14403 !! test
14404 Image with caption, T55312 #1
14405 !! wikitext
14406 [[File:Foobar.jpg|right|Caption page stuff]]
14407 !! html/php
14408 <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>
14409
14410 !! html/parsoid
14411 <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>
14412 !! end
14413
14414 !! test
14415 Image with caption, T55312 #2
14416 !! wikitext
14417 [[File:Foobar.jpg|right|Caption page=]]
14418 !! html/php
14419 <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>
14420
14421 !! html/parsoid
14422 <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>
14423 !! end
14424
14425 !! test
14426 Image with caption, T55312 #3
14427 !! wikitext
14428 [[File:Foobar.jpg|right|Caption page=stuff]]
14429 !! html/php
14430 <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>
14431
14432 !! html/parsoid
14433 <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>
14434 !! end
14435
14436 !! test
14437 Image caption with pipe entity
14438 !! wikitext
14439 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14440 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14441 !! html/php
14442 <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>
14443 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>one <i>two</i> &#x7c; three</div></div></div>
14444
14445 !! html/parsoid
14446 <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>
14447 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>one <i>two</i> <span typeof="mw:Entity">|</span> three</figcaption></figure>
14448 !! end
14449
14450 !! test
14451 Allow empty links in image captions (T62753)
14452 !! options
14453 thumbsize=220
14454 !! wikitext
14455 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14456 [[]]
14457 [[Link2]]
14458 ]]
14459 !! html/php
14460 <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>
14461
14462 !! html/parsoid
14463 <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>
14464 [[]]
14465 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14466 </figcaption></figure>
14467 !! end
14468
14469 !! test
14470 Titles in unlinked images (T23454)
14471 !! wikitext
14472 [[File:Foobar.jpg|link=|stuff]]
14473 !! html/php
14474 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14475 </p>
14476 !! html/parsoid
14477 <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>
14478 !! end
14479
14480 !! test
14481 Link with empty target
14482 !! wikitext
14483 [[]]
14484 !! html
14485 <p>[[]]
14486 </p>
14487 !! end
14488
14489 !! test
14490 Image with link trail
14491 !! wikitext
14492 Linktrails should not work for images: [[File:Foobar.jpg]]s
14493 !! html/php
14494 <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
14495 </p>
14496 !! html/parsoid
14497 <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>
14498 !! end
14499
14500 !! test
14501 Image with empty attribute
14502 !! options
14503 parsoid=wt2html,wt2wt,html2html
14504 !! wikitext
14505 [[File:Foobar.jpg|right||Caption text]]
14506 !! html/php
14507 <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>
14508
14509 !! html/parsoid
14510 <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>
14511 !! end
14512
14513 !! test
14514 1. Block image with individual attributes from templates
14515 !! wikitext
14516 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14517 !! html/php
14518 <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>
14519
14520 !! html/parsoid
14521 <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>
14522 !! end
14523
14524 !! test
14525 2. Block Image with individual attributes from templates
14526 !! wikitext
14527 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14528 !! html/php
14529 <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>
14530
14531 !! html/parsoid
14532 <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>
14533 !! end
14534
14535 !! test
14536 3. Inline image with individual attributes from templates
14537 !! wikitext
14538 [[File:Foobar.jpg|{{echo|50px}}]]
14539 !! html/php
14540 <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>
14541 </p>
14542 !! html/parsoid
14543 <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>
14544 !! end
14545
14546 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14547 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14548 !! test
14549 Image with multiple attributes from the same template
14550 !! wikitext
14551 [[File:Foobar.jpg|{{image_attribs}}]]
14552 !! html/php
14553 <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>
14554
14555 !! html/parsoid
14556 <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>
14557 !! end
14558
14559 !! test
14560 Image with link tails
14561 !! options
14562 thumbsize=220
14563 !! wikitext
14564 123[[File:Foobar.jpg]]456
14565 123[[File:Foobar.jpg|right]]456
14566 123[[File:Foobar.jpg|thumb]]456
14567 !! html/php
14568 <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
14569 </p>
14570 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
14571 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
14572
14573 !! html/php+tidy
14574 <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
14575 </p><p>
14576 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
14577 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
14578 </p>
14579 !! html/parsoid
14580 <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>
14581 <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
14582 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>
14583 !! end
14584
14585 !! test
14586 Image with multiple captions -- only last one is accepted
14587 !! wikitext
14588 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14589 !! html/php
14590 <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>
14591
14592 !! html/parsoid
14593 <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>
14594 !! end
14595
14596 !! test
14597 Image with multiple widths -- use last
14598 !! wikitext
14599 [[File:Foobar.jpg|200px|300px|caption]]
14600 !! html/php
14601 <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>
14602 </p>
14603 !! html/parsoid
14604 <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>
14605 !! end
14606
14607 !! test
14608 Image with multiple alignments -- use first (T50664)
14609 !! options
14610 thumbsize=220
14611 !! wikitext
14612 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14613
14614 [[File:Foobar.jpg|middle|text-top|caption]]
14615 !! html/php
14616 <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>
14617 <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>
14618 </p>
14619 !! html/parsoid
14620 <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>
14621 <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>
14622 !! end
14623
14624 !! test
14625 Image with width attribute at different positions
14626 !! wikitext
14627 [[File:Foobar.jpg|200px|right|Caption]]
14628 [[File:Foobar.jpg|right|200px|Caption]]
14629 [[File:Foobar.jpg|right|Caption|200px]]
14630 !! html/php
14631 <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>
14632 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
14633 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
14634
14635 !! html/parsoid
14636 <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>
14637 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
14638 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
14639 !! end
14640
14641 # a sad bit of backward-compatibility
14642 !! test
14643 Image with size specified with pxpx (T15500, T53628)
14644 !! options
14645 parsoid=wt2html,wt2wt,html2html
14646 !! wikitext
14647 [[File:Foobar.jpg|20pxpx]]
14648 [[File:Foobar.jpg|200x20pxpx]]
14649 !! html/php
14650 <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>
14651 <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>
14652 </p>
14653 !! html/parsoid
14654 <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>
14655 !! end
14656
14657 !! test
14658 Image with link parameter, wiki target
14659 !! wikitext
14660 [[File:Foobar.jpg|link=Main Page]]
14661 !! html/php
14662 <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>
14663 </p>
14664 !! html/parsoid
14665 <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>
14666 !! end
14667
14668 # parsoid T51293 (part 1)
14669 !! test
14670 Image with link parameter, URL target
14671 !! wikitext
14672 [[File:Foobar.jpg|link=http://example.com/]]
14673 !! html/php
14674 <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>
14675 </p>
14676 !! html/parsoid
14677 <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>
14678 !! end
14679
14680 # parsoid T51293 (part 2)
14681 !! test
14682 Image with link parameter, protocol-less URL target
14683 !! wikitext
14684 [[File:Foobar.jpg|link=//example.com/]]
14685 !! html/php
14686 <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>
14687 </p>
14688 !! html/parsoid
14689 <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>
14690 !! end
14691
14692 !! test
14693 Escaping non-block captions (T107435)
14694 !! options
14695 parsoid={
14696 "modes": ["wt2wt"],
14697 "changes": [
14698 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14699 ]
14700 }
14701 !! wikitext
14702 [[Image:Foobar.jpg|caption]]
14703 !! wikitext/edited
14704 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14705 !! end
14706
14707 # wgExternalLinkTarget not supported by Parsoid
14708 !! test
14709 Image with link parameter, wgExternalLinkTarget
14710 !! wikitext
14711 [[Image:foobar.jpg|link=http://example.com/]]
14712 !! config
14713 wgExternalLinkTarget='foobar'
14714 !! html/php
14715 <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>
14716 </p>
14717 !! end
14718
14719 !! test
14720 Image with link parameter, wgNoFollowLinks set to false
14721 !! wikitext
14722 [[Image:foobar.jpg|link=http://example.com/]]
14723 !! config
14724 wgNoFollowLinks=false
14725 !! html/php
14726 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14727 </p>
14728 !! end
14729
14730 !! test
14731 Image with link parameter, wgNoFollowDomainExceptions
14732 !! wikitext
14733 [[Image:foobar.jpg|link=http://example.com/]]
14734 !! config
14735 wgNoFollowDomainExceptions='example.com'
14736 !! html/php
14737 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14738 </p>
14739 !! end
14740
14741 # wgExternalLinkTarget not supported by Parsoid
14742 !! test
14743 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14744 !! wikitext
14745 [[Image:foobar.jpg|link=http://example.com/|Title]]
14746 !! config
14747 wgExternalLinkTarget='foobar'
14748 !! html/php
14749 <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>
14750 </p>
14751 !! end
14752
14753 !! test
14754 Image with empty link parameter
14755 !! wikitext
14756 [[File:Foobar.jpg|link=]]
14757 !! html/php
14758 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14759 </p>
14760 !! html/parsoid
14761 <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>
14762 !! end
14763
14764 !! test
14765 Image with link parameter (wiki target) and unnamed parameter
14766 !! wikitext
14767 [[File:Foobar.jpg|link=Main_Page|Title]]
14768 !! html/php
14769 <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>
14770 </p>
14771 !! html/parsoid
14772 <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>
14773 !! end
14774
14775 !! test
14776 Image with link parameter (URL target) and unnamed parameter
14777 !! wikitext
14778 [[File:Foobar.jpg|link=http://example.com/|Title]]
14779 !! html/php
14780 <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>
14781 </p>
14782 !! html/parsoid
14783 <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>
14784 !! end
14785
14786 !! test
14787 Thumbnail image with link parameter
14788 !! options
14789 thumbsize=220
14790 parsoid=wt2html,wt2wt,html2html
14791 !! wikitext
14792 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14793 !! html/php
14794 <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>
14795
14796 !! html/parsoid
14797 <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>
14798 !! end
14799
14800 !! test
14801 Manually-specified thumbnail image
14802 !! options
14803 thumbsize=220
14804 !! wikitext
14805 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14806 !! html/php
14807 <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>
14808
14809 !! html/parsoid
14810 <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>
14811 !! end
14812
14813 !! test
14814 Manually-specified thumbnail image with explicit link to wiki page
14815 !! options
14816 thumbsize=220
14817 parsoid=wt2html,wt2wt,html2html
14818 !! wikitext
14819 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14820 !! html/php
14821 <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>
14822
14823 !! html/parsoid
14824 <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>
14825 !! end
14826
14827 !! test
14828 Manually-specified thumbnail image with explicit link to url
14829 !! options
14830 thumbsize=220
14831 parsoid=wt2html,wt2wt,html2html
14832 !! wikitext
14833 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14834 !! html/php
14835 <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>
14836
14837 !! html/parsoid
14838 <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>
14839 !! end
14840
14841 !! test
14842 Manually-specified thumbnail image with explicit no link
14843 !! options
14844 thumbsize=220
14845 parsoid=wt2html,wt2wt,html2html
14846 !! wikitext
14847 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14848 !! html/php
14849 <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>
14850
14851 !! html/parsoid
14852 <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>
14853 !! end
14854
14855 !! test
14856 Manually-specified thumbnail image with explicit link and alt text
14857 !! options
14858 thumbsize=220
14859 parsoid=wt2html,wt2wt,html2html
14860 !! wikitext
14861 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14862 !! html/php
14863 <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>
14864
14865 !! html/parsoid
14866 <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>
14867 !! end
14868
14869 !! test
14870 Image with frame and link
14871 !! options
14872 parsoid=wt2html,wt2wt,html2html
14873 !! wikitext
14874 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14875 !! html/php
14876 <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>
14877
14878 !! html/parsoid
14879 <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>
14880 !! end
14881
14882 !! test
14883 Image with frame and link and explicit alt
14884 !! options
14885 parsoid=wt2html,wt2wt,html2html
14886 !! wikitext
14887 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14888 !! html/php
14889 <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>
14890
14891 !! html/parsoid
14892 <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>
14893 !! end
14894
14895 !! test
14896 Image with wiki markup in implicit alt
14897 !! wikitext
14898 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14899
14900 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14901 !! html/php
14902 <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>
14903 </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>
14904 </p>
14905 !! html/parsoid
14906 <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>
14907
14908 <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>
14909 !! end
14910
14911 !! test
14912 Alt image option should handle most kinds of wikitext without barfing
14913 !! wikitext
14914 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14915 !! html/php
14916 <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>
14917
14918 !! html/parsoid
14919 <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>
14920 !! end
14921
14922 !! test
14923 Image with table with attributes in caption
14924 !! options
14925 parsoid=wt2html,html2html
14926 !! wikitext
14927 [[File:Foobar.jpg|thumb|
14928 {| class="123" |
14929 |- class="456" |
14930 | ha
14931 |}
14932 ]]
14933 !! html/parsoid
14934 <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>
14935 <table class="123">
14936 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
14937 <td> ha</td></tr>
14938 </tbody></table>
14939 </figcaption></figure>
14940 !! end
14941
14942 !! test
14943 Image with table with rows from templates in caption
14944 !! wikitext
14945 [[File:Foobar.jpg|thumb|
14946 {|
14947 {{echo|{{!}} hi}}
14948 |}
14949 ]]
14950 !! html/parsoid
14951 <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>
14952 <table>
14953 <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>
14954 </tbody></table>
14955 </figcaption></figure>
14956 !! end
14957
14958 !! test
14959 Image with nested tables in caption
14960 !! wikitext
14961 [[File:Foobar.jpg|thumb|Foo<br />
14962 {|
14963 |
14964 {|
14965 |z
14966 |}
14967 |}
14968 ]]
14969 !! html/parsoid
14970 <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}'/>
14971 <table>
14972 <tbody><tr><td>
14973 <table>
14974 <tbody><tr><td>z</td></tr>
14975 </tbody></table></td></tr>
14976 </tbody></table>
14977 </figcaption></figure>
14978 !! end
14979
14980 !! test
14981 Image with heading and horizontal rule in caption
14982 !! wikitext
14983 [[File:Foobar.jpg|thumb|
14984 ===Testing===
14985 123
14986 --------------
14987 ]]
14988 !! html/php
14989 <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>
14990
14991 !! html/parsoid
14992 <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>
14993 <h3 id="Testing">Testing</h3>
14994 123
14995 <hr data-parsoid='{"extra_dashes":10}'/>
14996 </figcaption></figure>
14997 !! end
14998
14999 ###################
15000 # Conflicting image format options.
15001 # First option specified should 'win'.
15002 # All three cases in each test should be identical.
15003
15004 !! test
15005 Image with 'frameless' first.
15006 !! options
15007 parsoid=wt2html,wt2wt,html2html
15008 !! wikitext
15009 [[File:Foobar.jpg|frameless|caption]]
15010
15011 [[File:Foobar.jpg|frameless|frame|caption]]
15012
15013 [[File:Foobar.jpg|frameless|thumb|caption]]
15014 !! html/php
15015 <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>
15016 </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>
15017 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
15018 </p>
15019 !! html/parsoid
15020 <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>
15021 <p><figure-inline class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure-inline></p>
15022 <p><figure-inline class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure-inline></p>
15023 !! end
15024
15025 !! test
15026 Image with 'frame' first.
15027 !! options
15028 parsoid=wt2html,wt2wt,html2html
15029 !! wikitext
15030 [[File:Foobar.jpg|frame|caption]]
15031 [[File:Foobar.jpg|frame|frameless|caption]]
15032 [[File:Foobar.jpg|frame|thumb|caption]]
15033 !! html/php
15034 <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>
15035 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
15036 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
15037
15038 !! html/parsoid
15039 <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>
15040 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
15041 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
15042 !! end
15043
15044 !! test
15045 Image with 'thumb' first.
15046 !! options
15047 parsoid=wt2html,wt2wt,html2html
15048 !! wikitext
15049 [[File:Foobar.jpg|thumb|caption]]
15050 [[File:Foobar.jpg|thumb|frameless|caption]]
15051 [[File:Foobar.jpg|thumb|frame|caption]]
15052 !! html/php
15053 <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>
15054 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
15055 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
15056
15057 !! html/parsoid
15058 <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>
15059 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
15060 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
15061 !! end
15062
15063 ###################
15064 # Image sizing.
15065 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
15066 # and https://phabricator.wikimedia.org/T64258
15067 # Foobar has actual size of 1941x220
15068 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
15069 # a scalable format.
15070 # 2. Framed images always ignore size options; always render at default size.
15071 # 3. "Unspecified format" and border are the only types which can be
15072 # enlarged.
15073
15074 !! test
15075 Image: unspecified format and border enlarge
15076 !! options
15077 parsoid=wt2html,wt2wt,html2html
15078 !! wikitext
15079 [[File:Foobar.jpg|2000px]]
15080
15081 [[File:Foobar.jpg|border|2000px]]
15082 !! html/php
15083 <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>
15084 </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>
15085 </p>
15086 !! html/parsoid
15087 <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>
15088 <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>
15089 !! end
15090
15091 !! test
15092 Image: "unspecified format" and border reduce
15093 !! options
15094 parsoid=wt2html,wt2wt,html2html
15095 !! wikitext
15096 [[File:Foobar.jpg|1000px]]
15097
15098 [[File:Foobar.jpg|border|1000px]]
15099 !! html/php
15100 <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>
15101 </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>
15102 </p>
15103 !! html/parsoid
15104 <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>
15105 <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>
15106 !! end
15107
15108 !! test
15109 Image: thumbs reduce
15110 !! options
15111 parsoid=wt2html,wt2wt,html2html
15112 !! wikitext
15113 [[File:Foobar.jpg|thumb|50px]]
15114 !! html/php
15115 <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>
15116
15117 !! html/parsoid
15118 <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>
15119 !! end
15120
15121 !! test
15122 Image: bitmap thumbs can't be enlarged past original size, but vector can.
15123 !! options
15124 parsoid=wt2html,wt2wt,html2html
15125 !! wikitext
15126 [[File:Foobar.jpg|thumb|2000px]]
15127
15128 [[File:Foobar.svg|thumb|2000px]]
15129 !! html/php
15130 <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>
15131 <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>
15132
15133 !! html/parsoid
15134 <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>
15135 <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>
15136 !! end
15137
15138 !! test
15139 Image: frameless can reduce in size
15140 !! options
15141 parsoid=wt2html,wt2wt,html2html
15142 !! wikitext
15143 [[File:Foobar.jpg|frameless|50px]]
15144 !! html/php
15145 <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>
15146 </p>
15147 !! html/parsoid
15148 <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>
15149 !! end
15150
15151 !! test
15152 Image: bitmap frameless can't be enlarged past original size, but vector can
15153 !! options
15154 parsoid=wt2html,wt2wt,html2html
15155 !! wikitext
15156 [[File:Foobar.jpg|frameless|2000px]]
15157
15158 [[File:Foobar.svg|frameless|2000px]]
15159 !! html/php
15160 <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>
15161 </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>
15162 </p>
15163 !! html/parsoid
15164 <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>
15165 <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>
15166 !! end
15167
15168 !! test
15169 Image: framed images are always unscaled.
15170 !! options
15171 parsoid=wt2html,wt2wt,html2html
15172 !! wikitext
15173 [[File:Foobar.jpg|frame]]
15174
15175 [[File:Foobar.jpg|frame|50px]]
15176
15177 [[File:Foobar.jpg|frame|50x50px]]
15178
15179 [[File:Foobar.jpg|frame|2000px]]
15180 !! html/php
15181 <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>
15182 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
15183 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
15184 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
15185
15186 !! html/parsoid
15187 <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>
15188 <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>
15189 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
15190 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
15191 !! end
15192
15193 ###################
15194
15195 !! test
15196 Link to image page- image page normally doesn't exists, hence edit link
15197 Add test with existing image page
15198 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
15199 !! wikitext
15200 [[:Image:test]]
15201 !! html
15202 <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>
15203 </p>
15204 !! end
15205
15206 !! test
15207 T20784 Link to non-existent image page with caption should use caption as link text
15208 !! wikitext
15209 [[:Image:test|caption]]
15210 !! html
15211 <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>
15212 </p>
15213 !! end
15214
15215 !! test
15216 Frameless image caption with a free URL
15217 !! wikitext
15218 [[File:Foobar.jpg|http://example.com]]
15219 !! html/php
15220 <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>
15221 </p>
15222 !! html/parsoid
15223 <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>
15224 !! end
15225
15226 !! test
15227 Thumbnail image caption with a free URL
15228 !! options
15229 thumbsize=220
15230 !! wikitext
15231 [[File:Foobar.jpg|thumb|http://example.com]]
15232 !! html/php
15233 <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>
15234
15235 !! html/parsoid
15236 <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>
15237 !! end
15238
15239 !! test
15240 Thumbnail image caption with a free URL and explicit alt
15241 !! options
15242 thumbsize=220
15243 parsoid=wt2html,wt2wt,html2html
15244 !! wikitext
15245 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15246 !! html/php
15247 <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>
15248
15249 !! html/parsoid
15250 <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>
15251 !! end
15252
15253 !! test
15254 SVG thumbnails with no language set
15255 !! options
15256 !! wikitext
15257 [[File:Foobar.svg|thumb|caption]]
15258 !! html/php
15259 <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>
15260
15261 !! html/parsoid
15262 <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>
15263 !! end
15264
15265 !! test
15266 SVG thumbnails with language de
15267 !! options
15268 parsoid=wt2html,wt2wt,html2html
15269 !! wikitext
15270 [[File:Foobar.svg|thumb|caption|lang=de]]
15271 !! html/php
15272 <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>
15273
15274 !! html/parsoid
15275 <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>
15276 !! end
15277
15278 !! test
15279 SVG thumbnails with invalid language code
15280 !! options
15281 parsoid=wt2html,wt2wt,html2html
15282 !! wikitext
15283 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15284 !! html/php
15285 <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>
15286
15287 !! html/parsoid
15288 <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>
15289 !! end
15290
15291 !! test
15292 T3887: A ISBN with a thumbnail
15293 !! wikitext
15294 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15295 !! html/php
15296 <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>
15297
15298 !! html/parsoid
15299 <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>
15300 !! end
15301
15302 !! test
15303 T3887: A RFC with a thumbnail
15304 !! wikitext
15305 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15306 !! html/php
15307 <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>
15308
15309 !! html/parsoid
15310 <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>
15311 !! end
15312
15313 !! test
15314 T3887: A mailto link with a thumbnail
15315 !! wikitext
15316 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15317 !! html/php
15318 <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>
15319
15320 !! html/parsoid
15321 <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>
15322 !! end
15323
15324 # Pending resolution to T2368
15325 !! test
15326 T2648: Frameless image caption with a link
15327 !! wikitext
15328 [[File:Foobar.jpg|text with a [[link]] in it]]
15329 !! html/php
15330 <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>
15331 </p>
15332 !! html/parsoid
15333 <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>
15334 !! end
15335
15336 !! test
15337 T2648: Frameless image caption with a link (suffix)
15338 !! wikitext
15339 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15340 !! html/php
15341 <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>
15342 </p>
15343 !! html/parsoid
15344 <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>
15345 !! end
15346
15347 !! test
15348 T2648: Frameless image caption with an interwiki link
15349 !! wikitext
15350 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15351 !! html/php
15352 <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>
15353 </p>
15354 !! html/parsoid
15355 <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>
15356 !! end
15357
15358 !! test
15359 T2648: Frameless image caption with a piped interwiki link
15360 !! wikitext
15361 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15362 !! html/php
15363 <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>
15364 </p>
15365 !! html/parsoid
15366 <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>
15367 !! end
15368
15369 !! test
15370 T107474: Frameless image caption with <nowiki>
15371 !! wikitext
15372 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15373 !! html/parsoid
15374 <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>
15375 !! end
15376
15377 !! test
15378 Escape HTML special chars in image alt text
15379 !! wikitext
15380 [[File:Foobar.jpg|& < > "]]
15381 !! html/php
15382 <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>
15383 </p>
15384 !! html/parsoid
15385 <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>
15386 !! end
15387
15388 !! test
15389 Escape HTML special chars in image alt text with LanguageConverter
15390 !! options
15391 language=zh
15392 !! wikitext
15393 [[File:Foobar.jpg|& < > "]]
15394 !! html/php
15395 <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>
15396 </p>
15397 !! html/parsoid
15398 <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>
15399 !! end
15400
15401 !! test
15402 Entities in file name and attributes
15403 !! wikitext
15404 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15405 !! html/php
15406 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15407 </p>
15408 !! html/parsoid
15409 <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>
15410 !! end
15411
15412 !! test
15413 T2499: Alt text should have &#1234;, not &amp;1234;
15414 !! wikitext
15415 [[File:Foobar.jpg|&#9792;]]
15416 !! html/php
15417 <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>
15418 </p>
15419 !! html/parsoid
15420 <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>
15421 !! end
15422
15423 !! test
15424 Broken image caption with link
15425 !! options
15426 parsoid=wt2html,wt2wt,html2html
15427 !! wikitext
15428 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15429 !! html/php
15430 <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.
15431 </p>
15432 !! html/parsoid
15433 <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>
15434 !! end
15435
15436 !! test
15437 Image caption containing another image
15438 !! wikitext
15439 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15440 !! html/php
15441 <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>
15442
15443 !! html/parsoid
15444 <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>
15445 !! end
15446
15447 !! test
15448 Image: caption containing a newline
15449 !! wikitext
15450 [[File:Foobar.jpg|This
15451 *is some text]]
15452 !! html/php
15453 <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>
15454 </p>
15455 !! html/parsoid
15456 <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>
15457 !!end
15458
15459 !!test
15460 Image: caption containing leading space
15461 (The leading space should not trigger nowiki escaping in wt2wt mode)
15462 !! wikitext
15463 [[File:Foobar.jpg|thumb| bar]]
15464 !! html/php
15465 <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>
15466
15467 !! html/parsoid
15468 <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>
15469 !!end
15470
15471 # html/php output not have newlines after table, td, th, etc. because
15472 # Linker::makeThumbLink2() replaces the newlines with spaces since
15473 # the table is inside a caption.
15474 # FIXME: Verify if that circa 2004 fix is still required.
15475 !! test
15476 Image: caption containing a table
15477 !! options
15478 parsoid=wt2html,wt2wt,html2html
15479 !! wikitext
15480 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15481 {|
15482 !Foo!!Bar
15483 |-
15484 |Foo1||Bar1
15485 |}
15486 and some more text.]]
15487 !! html/php
15488 <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>
15489
15490 !! html/parsoid
15491 <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
15492 <table>
15493 <tbody>
15494 <tr><th>Foo</th><th>Bar</th></tr>
15495 <tr>
15496 <td>Foo1</td>
15497 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15498 !! end
15499
15500 !! test
15501 T5090: External links other than http: in image captions
15502 !! wikitext
15503 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15504 !! html/php
15505 <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>
15506
15507 !! html/parsoid
15508 <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>
15509 !! end
15510
15511 !! test
15512 Custom class
15513 !! options
15514 parsoid=wt2html,wt2wt,html2html
15515 !! wikitext
15516 [[Image:foobar.jpg|a|class=b]]
15517 !! html/php
15518 <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>
15519 </p>
15520 !! html/parsoid
15521 <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>
15522 !! end
15523
15524 !! test
15525 Localized image handling (1).
15526 !! options
15527 parsoid=wt2html,wt2wt,html2html
15528 language=es
15529 !! wikitext
15530 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15531 !! html/php
15532 <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>
15533
15534 !! html/parsoid
15535 <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>
15536 !! end
15537
15538 !! test
15539 Localized image handling (2).
15540 !! options
15541 thumbsize=220
15542 parsoid=wt2html,wt2wt,html2html
15543 language=es
15544 !! wikitext
15545 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15546 !! html/php
15547 <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>
15548
15549 !! html/parsoid
15550 <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>
15551 !! end
15552
15553 !! test
15554 Localized image handling (3).
15555 !! options
15556 language=fa
15557 parsoid=html2wt
15558 !! html/parsoid
15559 <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>
15560 !! wikitext
15561 [[File:Foobar.jpg|بندانگشتی]]
15562 !! end
15563
15564 !! test
15565 "border", "frameless" and "class" attributes on an image.
15566 !! options
15567 thumbsize=220
15568 parsoid=wt2html,wt2wt,html2html
15569 !! wikitext
15570 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15571 !! html/php
15572 <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>
15573 </p>
15574 !! html/parsoid
15575 <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>
15576 !! end
15577
15578 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15579 !! test
15580 Invalid image attributes (T64500)
15581 !! options
15582 thumbsize=220
15583 parsoid=wt2html,wt2wt,html2html
15584 !! wikitext
15585 [[File:Foobar.jpg|thumb|float|left|caption]]
15586
15587 [[File:Foobar.jpg|thumb|righ|caption]]
15588
15589 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15590 !! html/php
15591 <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>
15592 <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>
15593 <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>
15594
15595 !! html/parsoid
15596 <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>
15597 <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>
15598 <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>
15599 !! end
15600
15601 !! article
15602 File:Barfoo.jpg
15603 !! text
15604 #REDIRECT [[File:Barfoo.jpg]]
15605 !! endarticle
15606
15607 # FIXME: Parsoid should run this test -- but we'd need to teach the
15608 # mockAPI about the redirected Barfoo.jpg image.
15609 !! test
15610 Redirected image
15611 !! wikitext
15612 [[Image:Barfoo.jpg]]
15613 !! html/php
15614 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15615 </p>
15616 !! end
15617
15618 !! test
15619 Missing image with uploads disabled
15620 !! options
15621 wgEnableUploads=0
15622 !! wikitext
15623 [[File:Foobaz.jpg]]
15624 !! html/php
15625 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15626 </p>
15627 !! html/parsoid
15628 <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>
15629 !! end
15630
15631 # Parsoid-specific testing for images
15632 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15633 # Currently imperfect due to a flaw in the Parsoid testrunner
15634 # Work in progress
15635 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15636 # image tests.
15637
15638 !! test
15639 Parsoid-specific image handling - simple image with size and middle alignment
15640 !! wikitext
15641 [[File:Foobar.jpg|middle|50px]]
15642 !! html/parsoid
15643 <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>
15644 !! end
15645
15646 !! test
15647 Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
15648 !! options
15649 parsoid=wt2wt,wt2html,html2html
15650 !! wikitext
15651 [[Image:Foobar.jpg|middle|50px]]
15652 !! html/parsoid
15653 <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>
15654 !! end
15655
15656 !! test
15657 Parsoid-specific image handling - simple image with size and middle alignment (existing content)
15658 !! wikitext
15659 [[File:Foobar.jpg|50px|middle]]
15660 !! html/parsoid
15661 <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>
15662 !! end
15663
15664 !! test
15665 Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
15666 !! options
15667 parsoid=wt2html,wt2wt,html2html
15668 !! wikitext
15669 [[Image:Foobar.jpg|50px|middle]]
15670 !! html/parsoid
15671 <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>
15672 !! end
15673
15674 !! test
15675 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15676 !! wikitext
15677 [[File:Foobar.jpg|500x10px|baseline|caption]]
15678 !! html/parsoid
15679 <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>
15680 !! end
15681
15682 !! test
15683 Parsoid-specific image handling - simple image with border and size spec
15684 !! wikitext
15685 [[File:Foobar.jpg|50px|border|caption]]
15686 !! html/parsoid
15687 <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>
15688 !! end
15689
15690 !! test
15691 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15692 !! options
15693 parsoid=wt2html,html2html
15694 !! wikitext
15695 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15696 !! html/parsoid
15697 <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>
15698 !! end
15699
15700 !! test
15701 Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
15702 !! options
15703 parsoid=wt2html,html2html
15704 !! wikitext
15705 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15706 !! html/parsoid
15707 <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>
15708 !! end
15709
15710 !! test
15711 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15712 !! options
15713 parsoid=wt2html,html2html
15714 !! wikitext
15715 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15716 !! html/parsoid
15717 <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>
15718 !! end
15719
15720 !! test
15721 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
15722 !! options
15723 parsoid=wt2html,html2html
15724 !! wikitext
15725 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15726 !! html/parsoid
15727 <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>
15728 !! end
15729
15730 !! test
15731 Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
15732 !! options
15733 parsoid=wt2html,wt2wt,html2html
15734 !! wikitext
15735 [[File:Foobar.jpg|frame|500x50px|caption]]
15736 !! html/parsoid
15737 <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>
15738 !! end
15739
15740 !! test
15741 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
15742 !! options
15743 parsoid=wt2html,html2html
15744 !! wikitext
15745 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15746 !! html/parsoid
15747 <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>
15748 !! end
15749
15750 !! test
15751 Parsoid-specific image handling - frameless image with specific size, border, and caption
15752 !! wikitext
15753 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15754 !! html/parsoid
15755 <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>
15756 !! end
15757
15758 !! test
15759 Parsoid-specific image handling - simple image with a formatted caption
15760 !! wikitext
15761 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15762 !! html/parsoid
15763 <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>
15764 !! end
15765
15766 !! test
15767 Parsoid-specific image handling - caption with a template in it
15768 !! wikitext
15769 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15770 !! html/parsoid
15771 <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>
15772 !! end
15773
15774 !! test
15775 Parsoid-specific image handling - caption with unbalanced tags in it
15776 !! options
15777 parsoid=wt2html,wt2wt,html2html
15778 !! wikitext
15779 foo
15780 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15781 bar
15782 !! html/parsoid
15783 <p>foo</p>
15784 <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>
15785 <p>bar</p>
15786 !! end
15787
15788 !! test
15789 Parsoid-specific image handling - empty caption (1)
15790 !! options
15791 parsoid=wt2html,wt2wt
15792 !! wikitext
15793 [[File:Foobar.jpg|thumb|]]
15794 !! html/parsoid
15795 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption></figcaption></figure>
15796 !! end
15797
15798 # empty captions don't get serialized unless we're in the "round trip" case
15799 !! test
15800 Parsoid-specific image handling - empty caption (2)
15801 !! options
15802 parsoid=html2wt
15803 !! html/parsoid
15804 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15805 <a href="./File:Foobar.jpg">
15806 <img resource="./File:Foobar.jpg"
15807 src="//example.com/images/3/3a/Foobar.jpg"
15808 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15809 height="25" width="220"/>
15810 </a>
15811 <figcaption></figcaption>
15812 </figure>
15813 !! wikitext
15814 [[File:Foobar.jpg|thumb]]
15815 !! end
15816
15817 !! test
15818 Parsoid-specific image handling - whitespace caption
15819 !! wikitext
15820 [[File:Foobar.jpg|thumb| ]]
15821 !! html/parsoid
15822 <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>
15823 !! end
15824
15825 !! test
15826 Parsoid-specific image handling - lang option
15827 !! wikitext
15828 foo
15829 [[File:Foobar.svg|lang=de|caption]]
15830 bar
15831 !! html/parsoid
15832 <p>foo
15833 <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>
15834 bar</p>
15835 !! end
15836
15837 ## Edge case bugs in Parsoid from T93580
15838 !! test
15839 T93580: 1. Templated <ref> inside block images
15840 !! wikitext
15841 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15842
15843 <references />
15844 !! html/parsoid
15845 <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>
15846
15847 <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>
15848 !! end
15849
15850 !! test
15851 T93580: 2. <ref> inside inline images
15852 !! wikitext
15853 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15854
15855 <references />
15856 !! html/parsoid
15857 <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>
15858
15859 <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>
15860 !! end
15861
15862 !! test
15863 T93580: 3. Templated <ref> inside inline images
15864 !! wikitext
15865 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15866
15867 <references />
15868 !! html/parsoid
15869 <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>
15870
15871 <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>
15872 !! end
15873
15874 ###
15875 ### Subpages
15876 ###
15877 !! article
15878 Subpage test/subpage
15879 !! text
15880 foo
15881 !! endarticle
15882
15883 !! test
15884 Subpage link
15885 !! options
15886 subpage title=[[Subpage test]]
15887 !! wikitext
15888 [[/subpage]]
15889 !! html
15890 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15891 </p>
15892 !! end
15893
15894 !! test
15895 Subpage noslash link
15896 !! options
15897 subpage title=[[Subpage test]]
15898 !! wikitext
15899 [[/subpage/]]
15900 !! html
15901 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15902 </p>
15903 !! end
15904
15905 !! article
15906 Subpage test/1/2/subpage
15907 !! text
15908 blah
15909 !! endarticle
15910
15911 !! test
15912 Relative subpage noslash link
15913 !! options
15914 parsoid=wt2wt,wt2html,html2html
15915 subpage title=[[Subpage test/1/2/3/4]]
15916 !! wikitext
15917 [[../../subpage/]]
15918
15919 [[../../subpage]]
15920 !! html/php
15921 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15922 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15923 </p>
15924 !! html/parsoid
15925 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15926 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15927 !! end
15928
15929 !! test
15930 Parsoid: dot-slash prefixed wikilinks
15931 !! wikitext
15932 [[./foo]]
15933
15934 [[././bar]]
15935
15936 [[././baz/]]
15937 !! html/php
15938 <p>[[./foo]]
15939 </p><p>[[././bar]]
15940 </p><p>[[././baz/]]
15941 </p>
15942 !! html/parsoid
15943 <p>[[./foo]]
15944 </p><p>[[././bar]]
15945 </p><p>[[././baz/]]
15946 </p>
15947 !! end
15948
15949 !! test
15950 Render invalid page names as plain text (T53090)
15951 !! wikitext
15952 [[./../foo|bar]]
15953 [[foo�|bar]]
15954 [[foo/.|bar]]
15955 [[foo/..|bar]]
15956 [[foo~~~bar]]
15957 [[foo>bar]]
15958 [[foo[bar]]
15959 [[.]]
15960 [[..]]
15961 [[foo././bar]]
15962 [[foo[http://example.com]xyz]]
15963
15964 [[{{echo|./../foo}}|bar]]
15965 [[{{echo|foo/.}}|bar]]
15966 [[{{echo|foo/..}}|bar]]
15967 [[{{echo|foo~~~~bar}}]]
15968 [[{{echo|foo>bar}}]]
15969 [[{{echo|foo././bar}}]]
15970 [[{{echo|foo{bar}}]]
15971 [[{{echo|foo}bar}}]]
15972 [[{{echo|foo[bar}}]]
15973 [[{{echo|foo]bar}}]]
15974 [[{{echo|foo<bar}}]]
15975 !!html/php
15976 <p>[[./../foo|bar]]
15977 [[foo�|bar]]
15978 [[foo/.|bar]]
15979 [[foo/..|bar]]
15980 [[foo~~~bar]]
15981 [[foo&gt;bar]]
15982 [[foo[bar]]
15983 [[.]]
15984 [[..]]
15985 [[foo././bar]]
15986 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15987 </p><p>[[./../foo|bar]]
15988 [[foo/.|bar]]
15989 [[foo/..|bar]]
15990 [[foo~~~~bar]]
15991 [[foo&gt;bar]]
15992 [[foo././bar]]
15993 [[foo{bar]]
15994 [[foo}bar]]
15995 [[foo[bar]]
15996 [[foo]bar]]
15997 [[foo&lt;bar]]
15998 </p>
15999 !!html/parsoid
16000 <p>[[./../foo|bar]]
16001 [[foo�|bar]]
16002 [[foo/.|bar]]
16003 [[foo/..|bar]]
16004 [[foo~~~bar]]
16005 [[foo>bar]]
16006 [[foo[bar]]
16007 [[.]]
16008 [[..]]
16009 [[foo././bar]]
16010 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
16011
16012 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
16013 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
16014 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
16015 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
16016 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
16017 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
16018 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
16019 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
16020 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
16021 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
16022 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
16023 !!end
16024
16025 !! test
16026 Disabled subpages
16027 !! wikitext
16028 [[/subpage]]
16029 !! html
16030 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
16031 </p>
16032 !! end
16033
16034 !! test
16035 T2561: {{/Subpage}}
16036 !! options
16037 subpage title=[[Page]]
16038 !! wikitext
16039 {{/Subpage}}
16040 !! html
16041 <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>
16042 </p>
16043 !! end
16044
16045 ###
16046 ### Categories
16047 ###
16048 !! article
16049 Category:MediaWiki User's Guide
16050 !! text
16051 blah
16052 !! endarticle
16053
16054 !! test
16055 Link to category
16056 !! wikitext
16057 [[:Category:MediaWiki User's Guide]]
16058 !! html
16059 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
16060 </p>
16061 !! end
16062
16063 !! test
16064 Simple category
16065 !! options
16066 cat
16067 !! wikitext
16068 [[Category:MediaWiki User's Guide]]
16069 !! html/php
16070 cat=MediaWiki_User's_Guide sort=
16071 !! html/parsoid
16072 <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"}}'/>
16073 !! end
16074
16075 !! test
16076 PAGESINCATEGORY invalid title fatal (r33546 fix)
16077 !! wikitext
16078 {{PAGESINCATEGORY:<bogus>}}
16079 !! html
16080 <p>0
16081 </p>
16082 !! end
16083
16084 !! test
16085 Category with different sort key
16086 !! options
16087 cat
16088 !! wikitext
16089 [[Category:MediaWiki User's Guide|Foo]]
16090 !! html/php
16091 cat=MediaWiki_User's_Guide sort=Foo
16092 !! html/parsoid
16093 <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"}}'/>
16094 !! end
16095
16096 !! test
16097 Category with identical sort key
16098 !! options
16099 cat
16100 !! wikitext
16101 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16102 !! html/php
16103 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
16104 !! html/parsoid
16105 <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"}}'/>
16106 !! end
16107
16108 !! test
16109 Category with empty sort key
16110 !! options
16111 cat
16112 pst
16113 !! wikitext
16114 [[Category:MediaWiki User's Guide|]]
16115 !! html/php
16116 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16117 !! end
16118
16119 !! test
16120 Category with empty sort key and parentheses
16121 !! options
16122 cat
16123 pst
16124 !! wikitext
16125 [[Category:Foo (bar)|]]
16126 !! html/php
16127 [[Category:Foo (bar)|Foo]]
16128 !! end
16129
16130 !! test
16131 Category with link tail
16132 !! options
16133 cat
16134 pst
16135 !! wikitext
16136 123[[Category:Foo]]456
16137 !! html/php
16138 123[[Category:Foo]]456
16139 !! end
16140
16141 !! test
16142 Category with template
16143 !! options
16144 cat
16145 pst
16146 !! wikitext
16147 [[Category:{{echo|Foo}}]]
16148 !! html/php
16149 [[Category:{{echo|Foo}}]]
16150 !! end
16151
16152 !! test
16153 Category with template in sort key
16154 !! options
16155 cat
16156 pst
16157 !! wikitext
16158 [[Category:Foo|{{echo|Bar}}]]
16159 !! html/php
16160 [[Category:Foo|{{echo|Bar}}]]
16161 !! end
16162
16163 !! test
16164 Category with template in sort key and title
16165 !! options
16166 cat
16167 pst
16168 !! wikitext
16169 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16170 !! html/php
16171 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16172 !! end
16173
16174 ## We used to, but no longer wt2wt this test since the default serializer
16175 ## will normalize all categories to serialize on their own line.
16176 ## This wikitext usage is going to be fairly uncommon in production and
16177 ## selser will take care of preserving formatting in those scenarios.
16178 !! test
16179 Category / paragraph interactions
16180 !! options
16181 parsoid=wt2html
16182 !! wikitext
16183 Foo [[Category:Baz]] Bar
16184
16185 Foo [[Category:Baz]]
16186 Bar
16187
16188 Foo
16189 [[Category:Baz]]
16190 Bar
16191
16192 Foo
16193 [[Category:Baz]] Bar
16194
16195 Foo
16196 [[Category:Baz]]
16197 [[Category:Baz]]
16198 [[Category:Baz]]
16199 Bar
16200
16201 [[Category:Baz]]
16202 [[Category:Baz]]
16203 [[Category:Baz]]
16204
16205 [[Category:Baz]]
16206 {{echo|[[Category:Baz]]}}
16207 [[Category:Baz]]
16208 !! html/php
16209 <p>Foo Bar
16210 </p><p>Foo
16211 Bar
16212 </p><p>Foo
16213 Bar
16214 </p><p>Foo Bar
16215 </p><p>Foo
16216 Bar
16217 </p>
16218 !! html/parsoid
16219 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16220 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16221 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16222 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16223 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16224 <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}}]}'/>
16225 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16226 !! end
16227
16228 ## We used to, but no longer wt2wt this test since the default serializer
16229 ## will normalize all categories to serialize on their own line.
16230 ## This wikitext usage is going to be fairly uncommon in production and
16231 ## selser will take care of preserving formatting in those scenarios.
16232 ##
16233 ## The whitespace on the empty line is part of the test. Please do not delete
16234 !! test
16235 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16236 !! options
16237 parsoid=wt2html
16238 !! wikitext
16239 This
16240
16241 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16242
16243 {{echo|[[Category:Foo]] and so should this!}}
16244 !! html/php
16245 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16246 </p>
16247 !! html/parsoid
16248 <p>This
16249
16250 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16251
16252 <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>
16253 !! end
16254
16255 ## Parsoid will not try to wt2wt this while preserving newlines because
16256 ## it suppresses excess newlines within list items -- and we don't want to
16257 ## introduce a special case just for categories, which is, in reality somewhat
16258 ## odd behavior -- categories are unlikely to be used in list items like this
16259 ## in top-level pages and are only likely to show up in template-generated
16260 ## list items where this RT-ing is a non-issue.
16261 ##
16262 ## The whitespace on the empty line is part of the test. Please do not delete
16263 !! test
16264 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16265 !! options
16266 parsoid=wt2html
16267 !! wikitext
16268 * This
16269
16270 [[Category:Foo]] and this should be part of the same list item
16271 * So should this
16272
16273 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16274 !! html
16275 <ul><li>This and this should be part of the same list item</li>
16276 <li>So should this and this should be part of the same list item</li></ul>
16277 !! html/parsoid
16278 <ul>
16279 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16280 <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>
16281 </ul>
16282 !! end
16283
16284 ## Newlines and categories that follow the last item of a list
16285 ## are treated differently because this (list followed by categories)
16286 ## is an extremely common pattern on wikis.
16287 !! test
16288 3. Categories and newlines: newline suppression for last list item should RT properly
16289 !! wikitext
16290 *a
16291 *b
16292
16293 [[Category:Foo]]
16294
16295 [[Category:Bar]]
16296 [[Category:Baz]]
16297
16298 :c
16299
16300 [[Category:C]]
16301
16302 ;d
16303
16304 [[Category:D]]
16305 !! html/parsoid
16306 <ul><li>a</li>
16307 <li>b</li></ul>
16308
16309 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16310
16311 <link rel="mw:PageProp/Category" href="./Category:Bar"/>
16312 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16313
16314 <dl><dd>c</dd></dl>
16315
16316 <link rel="mw:PageProp/Category" href="./Category:C"/>
16317
16318 <dl><dt>d</dt></dl>
16319
16320 <link rel="mw:PageProp/Category" href="./Category:D"/>
16321 !! end
16322
16323 !! test
16324 4. Categories and newlines: newline suppression for last list item should RT properly
16325 !! wikitext
16326 *a
16327 ****b
16328
16329 [[Category:Foo]]
16330 !! html/parsoid
16331 <ul><li>a
16332 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
16333
16334 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16335 !! end
16336
16337 ## only wt2html for this to make sure the algo only applies to the rightmost path
16338 !! test
16339 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16340 !! options
16341 parsoid=wt2html
16342 !! wikitext
16343 *a
16344 **b
16345 [[Category:Foo]]
16346 *c
16347 **d
16348 [[Category:Foo]]
16349 !! html/parsoid
16350 <ul><li>a
16351 <ul><li>b
16352 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16353 <li>c
16354 <ul><li>d</li></ul></li></ul>
16355 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16356 !! end
16357
16358 ## We used to, but no longer wt2wt this test since the default serializer
16359 ## will normalize all categories to serialize on their own line.
16360 ## This wikitext usage is going to be fairly uncommon in production and
16361 ## selser will take care of preserving formatting in those scenarios.
16362 !! test
16363 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16364 !! options
16365 parsoid=wt2html
16366 !! wikitext
16367 *a [[Category:Foo]]
16368 !! html/parsoid
16369 <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>
16370 !! end
16371
16372 # This test also demonstrates because of newline+category tunneling
16373 # through the list hander, template wrapping doesn't expand to the
16374 # containing list when the list item swallows the category.
16375 !! test
16376 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16377 !! wikitext
16378 *{{echo|a
16379 [[Category:Foo]]}}
16380 !! html/parsoid
16381 <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
16382 </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>
16383 !! end
16384
16385 !! test
16386 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16387 !! wikitext
16388 *a
16389
16390 {{echo|[[Category:Foo]]
16391 [[Category:Bar]]}}
16392 [[Category:Baz]]
16393 !! html/parsoid
16394 <ul><li>a</li></ul>
16395
16396 <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">
16397 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16398 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16399 !! end
16400
16401 !! test
16402 Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
16403 !! wikitext
16404 *a
16405
16406 [[Category:Bar]]<!--boo1--> <!--boo2-->
16407 [[Category:Baz]]<!--boo3--> <!--boo4-->
16408 !! html/parsoid
16409 <ul><li>a</li></ul>
16410
16411 <link rel="mw:PageProp/Category" href="./Category:Bar"/><!--boo1--> <!--boo2-->
16412 <link rel="mw:PageProp/Category" href="./Category:Baz"/><!--boo3--> <!--boo4-->
16413 !! end
16414
16415 !! test
16416 Categories and newlines: should behave properly with linkprefix (T87753)
16417 !! options
16418 language=ar
16419 !! wikitext
16420 foo bar
16421 foo bar
16422 [[تصنيف:Foo]]
16423 [[تصنيف:Bar]]
16424 !! html/php
16425 <p>foo bar
16426 foo bar
16427 </p>
16428 !! html/parsoid
16429 <p>foo bar
16430 foo bar</p>
16431 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16432 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16433 !! end
16434
16435 !! test
16436 No regressions on internal links following category (T174639)
16437 !! options
16438 parsoid=wt2html,html2html
16439 !! wikitext
16440 [[Category:Foo]]<div>a
16441
16442 [[Foo]]</div>
16443 !! html/php
16444 <div>a
16445 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16446
16447 !! html/parsoid
16448 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16449
16450 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16451 !! end
16452
16453 # Note that Parsoid differs slightly from PHP due to T175421
16454 !! test
16455 11. Special case where only newlines separate links (T175416)
16456 !! options
16457 parsoid=wt2html,html2html
16458 !! wikitext
16459 [[Category:Foo]]
16460
16461 [[Foo]][[es:Alimento]]
16462
16463 [[Foo]]
16464 !! html/php
16465 <p><br />
16466 <a href="/wiki/Foo" title="Foo">Foo</a>
16467 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16468 </p>
16469 !! html/parsoid
16470 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16471
16472 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16473
16474 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16475 !! end
16476
16477 !! test
16478 Category links with multiple namespaces
16479 !! wikitext
16480 [[Category:Project:Foo]]
16481 !! html/parsoid
16482 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16483 !! end
16484
16485 !! test
16486 Parsoid: Serialize link to category page with colon escape
16487 !! options
16488 parsoid
16489 !! wikitext
16490
16491 [[:Category:Foo]]
16492 [[:Category:Foo|Bar]]
16493 !! html
16494 <p>
16495 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16496 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16497 </p>
16498 !! end
16499
16500 # We used to, but no longer wt2wt this test since the default serializer
16501 # will normalize all categories to serialize on their own line.
16502 # This wikitext usage is going to be fairly uncommon in production and
16503 # selser will take care of preventing whitespace insertion if this
16504 # occurs in an article.
16505 #
16506 # html2html disabled for the same reason (whitespace insertion between
16507 # x and y).
16508 #
16509 # html2wt disabled because it localizes the "Category" namespace.
16510 !! test
16511 Link prefix/suffixes aren't applied to category links
16512 !! options
16513 parsoid=wt2html
16514 language=is
16515 !! wikitext
16516 x[[Category:Foo]]y
16517 !! html/php
16518 <p>xy
16519 </p>
16520 !! html/parsoid
16521 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16522 !! end
16523
16524 !! test
16525 Link prefix/suffixes aren't applied to language links
16526 !! options
16527 parsoid=wt2html
16528 language=is
16529 !! wikitext
16530 x[[es:Foo]]y
16531 !! html/php
16532 <p>xy
16533 </p>
16534 !! html/parsoid
16535 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16536 !! end
16537
16538 !! test
16539 Parsoid: Serialize link to file page with colon escape
16540 !! options
16541 parsoid
16542 !! wikitext
16543
16544 [[:File:Foo.png]]
16545 [[:File:Foo.png|Bar]]
16546 !! html
16547 <p>
16548 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16549 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16550 </p>
16551 !! end
16552
16553 !! test
16554 Parsoid: Serialize a genuine category link without colon escape
16555 !! options
16556 parsoid
16557 !! wikitext
16558 [[Category:Foo]]
16559 [[Category:Foo|Bar]]
16560 !! html
16561 <link rel="mw:PageProp/Category" href="./Category:Foo">
16562 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16563 !! end
16564
16565 !! test
16566 Normalize hrefs properly before testing for invalid link targets (T72894)
16567 !! options
16568 parsoid=html2wt
16569 !! html/parsoid
16570 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16571 !! wikitext
16572 [[Category:Toxine bactérienne]]
16573 !! end
16574
16575 !! test
16576 Parsoid: Defaultsort
16577 !! wikitext
16578 {{DEFAULTSORT:Foo}}
16579 !! html/parsoid
16580 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16581 !! end
16582
16583 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16584 # But, this is a limitation of our representation and is documented in
16585 # TemplateHandler.js in processSpecialMagicWord
16586 !! test
16587 Parsoid: Defaultsort (template-generated)
16588 !! wikitext
16589 {{{{echo|DEFAULTSORT}}:Foo}}
16590 !! html/parsoid
16591 <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"}]]}'/>
16592 !! end
16593
16594 ###
16595 ### Inter-language links
16596 ###
16597 !! test
16598 Interlanguage links
16599 !! options
16600 ill
16601 !! wikitext
16602 [[es:Alimento]]
16603 [[fr:Nourriture]]
16604 [[zh:食品]]
16605 !! html/php
16606 es:Alimento fr:Nourriture zh:食品
16607 !! html/parsoid
16608 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16609 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16610 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16611 !! end
16612
16613 !! test
16614 Duplicate interlanguage links (T26502)
16615 !! options
16616 ill
16617 !! wikitext
16618 [[es:1]]
16619 [[es:2]]
16620 [[fr:1]]
16621 [[fr:2]]
16622 !! html/php
16623 es:1 fr:1
16624 !! html/parsoid
16625 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16626 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16627 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16628 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16629 !! end
16630
16631 ###
16632 ### Sections
16633 ###
16634 !! test
16635 Basic section headings
16636 !! wikitext
16637 ==Headline 1==
16638 Some text
16639
16640 ==Headline 2==
16641 More
16642 ===Smaller headline===
16643 Blah blah
16644 !! html
16645 <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>
16646 <p>Some text
16647 </p>
16648 <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>
16649 <p>More
16650 </p>
16651 <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>
16652 <p>Blah blah
16653 </p>
16654 !! end
16655
16656 !! test
16657 Section headings with TOC
16658 !! wikitext
16659 ==Headline 1==
16660 ===Subheadline 1===
16661 =====Skipping a level=====
16662 ======Skipping a level======
16663
16664 ==Headline 2==
16665 Some text
16666 ===Another headline===
16667 !! html
16668 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
16669 <ul>
16670 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16671 <ul>
16672 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16673 <ul>
16674 <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>
16675 <ul>
16676 <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>
16677 </ul>
16678 </li>
16679 </ul>
16680 </li>
16681 </ul>
16682 </li>
16683 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16684 <ul>
16685 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16686 </ul>
16687 </li>
16688 </ul>
16689 </div>
16690
16691 <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>
16692 <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>
16693 <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>
16694 <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>
16695 <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>
16696 <p>Some text
16697 </p>
16698 <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>
16699
16700 !! end
16701
16702 !! test
16703 TOC anchors don't collide
16704 !! wikitext
16705 __FORCETOC__
16706 ==Headline 2==
16707 ==Headline==
16708 ==Headline 2==
16709 ==Headline==
16710 !! html/php
16711 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
16712 <ul>
16713 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16714 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16715 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16716 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16717 </ul>
16718 </div>
16719
16720 <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>
16721 <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>
16722 <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>
16723 <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>
16724
16725 !! end
16726
16727 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16728 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
16729 !! test
16730 Handling of sections up to level 6 and beyond
16731 !! options
16732 parsoid=wt2html
16733 !! wikitext
16734 =Level 1 Heading=
16735 ==Level 2 Heading==
16736 ===Level 3 Heading===
16737 ====Level 4 Heading====
16738 =====Level 5 Heading=====
16739 ======Level 6 Heading======
16740 =======Level 7 Heading=======
16741 ========Level 8 Heading========
16742 =========Level 9 Heading=========
16743 ==========Level 10 Heading==========
16744 !! html/php
16745 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
16746 <ul>
16747 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16748 <ul>
16749 <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>
16750 <ul>
16751 <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>
16752 <ul>
16753 <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>
16754 <ul>
16755 <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>
16756 <ul>
16757 <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>
16758 <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>
16759 <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>
16760 <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>
16761 <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>
16762 </ul>
16763 </li>
16764 </ul>
16765 </li>
16766 </ul>
16767 </li>
16768 </ul>
16769 </li>
16770 </ul>
16771 </li>
16772 </ul>
16773 </div>
16774
16775 <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>
16776 <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>
16777 <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>
16778 <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>
16779 <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>
16780 <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>
16781 <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>
16782 <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>
16783 <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>
16784 <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>
16785
16786 !! html/parsoid
16787 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
16788 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
16789 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
16790 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
16791 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
16792 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
16793 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
16794 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
16795 <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>
16796 <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>
16797 !! end
16798
16799 !! test
16800 TOC regression (T11764)
16801 !! wikitext
16802 ==title 1==
16803 ===title 1.1===
16804 ====title 1.1.1====
16805 ===title 1.2===
16806 ==title 2==
16807 ===title 2.1===
16808 !! html
16809 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
16810 <ul>
16811 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16812 <ul>
16813 <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>
16814 <ul>
16815 <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>
16816 </ul>
16817 </li>
16818 <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>
16819 </ul>
16820 </li>
16821 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16822 <ul>
16823 <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>
16824 </ul>
16825 </li>
16826 </ul>
16827 </div>
16828
16829 <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>
16830 <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>
16831 <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>
16832 <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>
16833 <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>
16834 <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>
16835
16836 !! end
16837
16838 !! test
16839 TOC for heading containing <span id="..."></span> (T96153)
16840 !! wikitext
16841 __FORCETOC__
16842 ==<span id="old-anchor"></span>New title==
16843 !! html/php
16844 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
16845 <ul>
16846 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16847 </ul>
16848 </div>
16849
16850 <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>
16851
16852 !! end
16853
16854 !! test
16855 TOC with wgMaxTocLevel=3 (T8204)
16856 !! options
16857 wgMaxTocLevel=3
16858 !! wikitext
16859 ==title 1==
16860 ===title 1.1===
16861 ====title 1.1.1====
16862 ===title 1.2===
16863 ==title 2==
16864 ===title 2.1===
16865 !! html
16866 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
16867 <ul>
16868 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16869 <ul>
16870 <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>
16871 <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>
16872 </ul>
16873 </li>
16874 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16875 <ul>
16876 <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>
16877 </ul>
16878 </li>
16879 </ul>
16880 </div>
16881
16882 <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>
16883 <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>
16884 <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>
16885 <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>
16886 <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>
16887 <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>
16888
16889 !! end
16890
16891 !! test
16892 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16893 !! options
16894 wgMaxTocLevel=3
16895 !! wikitext
16896 ==Section 1==
16897 ===Section 1.1===
16898 ====Section 1.1.1====
16899 ====Section 1.1.1.1====
16900 ==Section 2==
16901 !! html
16902 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
16903 <ul>
16904 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16905 <ul>
16906 <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>
16907 </ul>
16908 </li>
16909 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16910 </ul>
16911 </div>
16912
16913 <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>
16914 <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>
16915 <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>
16916 <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>
16917 <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>
16918
16919 !! end
16920
16921
16922 !! test
16923 Resolving duplicate section names
16924 !! wikitext
16925 ==Foo bar==
16926 ==Foo bar==
16927 !! html
16928 <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>
16929 <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>
16930
16931 !! end
16932
16933 !! test
16934 Resolving duplicate section names with differing case (T12721)
16935 !! wikitext
16936 ==Foo bar==
16937 ==Foo Bar==
16938 !! html
16939 <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>
16940 <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>
16941
16942 !! end
16943
16944 !! article
16945 Template:sections
16946 !! text
16947 ===Section 1===
16948 ==Section 2==
16949 !! endarticle
16950
16951 !! test
16952 Template with sections, __NOTOC__
16953 !! wikitext
16954 __NOTOC__
16955 ==Section 0==
16956 {{sections}}
16957 ==Section 4==
16958 !! html
16959 <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>
16960 <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>
16961 <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>
16962 <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>
16963
16964 !! end
16965
16966 !! test
16967 __NOEDITSECTION__ keyword
16968 !! wikitext
16969 __NOEDITSECTION__
16970 ==Section 1==
16971 ==Section 2==
16972 !! html
16973 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16974 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16975
16976 !! end
16977
16978 !! test
16979 Link inside a section heading
16980 !! wikitext
16981 ==Section with a [[Main Page|link]] in it==
16982 !! html
16983 <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>
16984
16985 !! end
16986
16987 !! test
16988 TOC regression (T14077)
16989 !! wikitext
16990 __TOC__
16991 ==title 1==
16992 ===title 1.1===
16993 ==title 2==
16994 !! html
16995 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
16996 <ul>
16997 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16998 <ul>
16999 <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>
17000 </ul>
17001 </li>
17002 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
17003 </ul>
17004 </div>
17005
17006 <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>
17007 <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>
17008 <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>
17009
17010 !! end
17011
17012 !! test
17013 T3219 URL next to image (good)
17014 !! wikitext
17015 http://example.com [[File:Foobar.jpg]]
17016 !! html/php
17017 <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>
17018 </p>
17019 !! html/parsoid
17020 <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>
17021 !!end
17022
17023 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
17024 !! test
17025 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
17026 !! options
17027 parsoid=wt2html,html2html
17028 !! wikitext
17029 ===
17030 The line above must have a trailing space!
17031 === <!--
17032 --> <!-- -->
17033 But just in case it doesn't...
17034 !! html/php
17035 <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>
17036 <p>The line above must have a trailing space!
17037 </p>
17038 <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>
17039 <p>But just in case it doesn't...
17040 </p>
17041 !! html/parsoid
17042 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
17043 <p>The line above must have a trailing space!</p>
17044 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
17045 --> <!-- -->
17046 <p>But just in case it doesn't...</p>
17047 !! end
17048
17049 !! test
17050 Header with special characters (T27462)
17051 !! wikitext
17052 The tooltips shall not show entities to the user (ie. be double escaped)
17053
17054 ==text > text==
17055 section 1
17056
17057 ==text < text==
17058 section 2
17059
17060 ==text & text==
17061 section 3
17062
17063 ==text ' text==
17064 section 4
17065
17066 ==text " text==
17067 section 5
17068 !! html/php
17069 <p>The tooltips shall not show entities to the user (ie. be double escaped)
17070 </p>
17071 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17072 <ul>
17073 <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>
17074 <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>
17075 <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>
17076 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
17077 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
17078 </ul>
17079 </div>
17080
17081 <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>
17082 <p>section 1
17083 </p>
17084 <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>
17085 <p>section 2
17086 </p>
17087 <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>
17088 <p>section 3
17089 </p>
17090 <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>
17091 <p>section 4
17092 </p>
17093 <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>
17094 <p>section 5
17095 </p>
17096 !! html/parsoid
17097 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
17098
17099 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
17100 <p>section 1</p>
17101
17102 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
17103 <p>section 2</p>
17104
17105 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
17106 <p>section 3</p>
17107
17108 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
17109 <p>section 4</p>
17110
17111 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
17112 <p>section 5</p>
17113 !! end
17114
17115 !! test
17116 Header with space, plus and underscore as entity
17117 !! wikitext
17118 Id should not contain + for spaces
17119
17120 ==Space between Text==
17121 section 1
17122
17123 ==Space-Entity&#32;between&#32;Text==
17124 section 2
17125
17126 ==Plus+between+Text==
17127 section 3
17128
17129 ==Plus-Entity&#43;between&#43;Text==
17130 section 4
17131
17132 ==Underscore_between_Text==
17133 section 5
17134
17135 ==Underscore-Entity&#95;between&#95;Text==
17136 section 6
17137
17138 [[#Space between Text]]
17139 [[#Space-Entity&#32;between&#32;Text]]
17140 [[#Plus+between+Text]]
17141 [[#Plus-Entity&#43;between&#43;Text]]
17142 [[#Underscore_between_Text]]
17143 [[#Underscore-Entity&#95;between&#95;Text]]
17144 !! html/php
17145 <p>Id should not contain + for spaces
17146 </p>
17147 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17148 <ul>
17149 <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>
17150 <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>
17151 <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>
17152 <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>
17153 <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>
17154 <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>
17155 </ul>
17156 </div>
17157
17158 <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>
17159 <p>section 1
17160 </p>
17161 <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>
17162 <p>section 2
17163 </p>
17164 <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>
17165 <p>section 3
17166 </p>
17167 <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>
17168 <p>section 4
17169 </p>
17170 <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>
17171 <p>section 5
17172 </p>
17173 <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>
17174 <p>section 6
17175 </p><p><a href="#Space_between_Text">#Space between Text</a>
17176 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
17177 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
17178 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
17179 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17180 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17181 </p>
17182 !! html/parsoid
17183 <p>Id should not contain + for spaces</p>
17184
17185 <h2 id="Space_between_Text">Space between Text</h2>
17186 <p>section 1</p>
17187
17188 <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>
17189 <p>section 2</p>
17190
17191 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
17192 <p>section 3</p>
17193
17194 <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>
17195 <p>section 4</p>
17196
17197 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
17198 <p>section 5</p>
17199
17200 <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>
17201 <p>section 6</p>
17202
17203 <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>
17204 <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>
17205 <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>
17206 <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>
17207 <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>
17208 <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>
17209 !! end
17210
17211 # Parsoid html2wt disabled because it adds padding spaces around =
17212 !! test
17213 Headers with excess '=' characters
17214 (Are similar tests necessary beyond the 1st level?)
17215 !! options
17216 parsoid=wt2html,wt2wt,html2html
17217 !! wikitext
17218 =foo==
17219 ==foo=
17220 =''italic'' heading==
17221 ==''italic'' heading=
17222 !! html/php
17223 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17224 <ul>
17225 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17226 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17227 <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>
17228 <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>
17229 </ul>
17230 </div>
17231
17232 <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>
17233 <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>
17234 <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>
17235 <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>
17236
17237 !! html/parsoid
17238 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
17239 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
17240 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
17241 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
17242 !! end
17243
17244 !! test
17245 HTML headers vs TOC (T25393)
17246 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17247 !! wikitext
17248 <h1>Header 1</h1>
17249 ==Header 1.1==
17250 ==Header 1.2==
17251
17252 <h1>Header 2
17253 </h1>
17254 ==Header 2.1==
17255 ==Header 2.2==
17256 __NOEDITSECTION__
17257 !! html/php
17258 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17259 <ul>
17260 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17261 <ul>
17262 <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>
17263 <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>
17264 </ul>
17265 </li>
17266 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
17267 <ul>
17268 <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>
17269 <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>
17270 </ul>
17271 </li>
17272 </ul>
17273 </div>
17274
17275 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17276 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17277 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17278 <h1><span class="mw-headline" id="Header_2">Header 2
17279 </span></h1>
17280 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17281 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17282
17283 !! html/parsoid
17284 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17285 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17286 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17287
17288 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17289 </h1>
17290 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17291 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17292 <meta property="mw:PageProp/noeditsection"/>
17293 !! end
17294
17295 !! test
17296 Single-line or multiline-comments can follow headings
17297 !! options
17298 parsoid=wt2html,wt2wt
17299 !! wikitext
17300 ==foo==<!---->
17301 ==bar==<!--c1-->
17302 ==baz==<!--
17303 c2
17304 c3-->
17305 !! html/php
17306 <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>
17307 <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>
17308 <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>
17309
17310 !! html/parsoid
17311 <h2 id="foo">foo</h2><!---->
17312 <h2 id="bar">bar</h2><!--c1-->
17313 <h2 id="baz">baz</h2><!--
17314 c2
17315 c3-->
17316 !! end
17317
17318 !! test
17319 T3219 URL next to image (broken)
17320 !! wikitext
17321 http://example.com[[File:Foobar.jpg]]
17322 !! html/php
17323 <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>
17324 </p>
17325 !! html/parsoid
17326 <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>
17327 !!end
17328
17329 !! test
17330 T3186 news: in the middle of text
17331 !! wikitext
17332 http://en.wikinews.org/wiki/Wikinews:Workplace
17333 !! html
17334 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17335 </p>
17336 !!end
17337
17338
17339 !! test
17340 Namespaced link must have a title
17341 !! wikitext
17342 [[Project:]]
17343 !! html
17344 <p>[[Project:]]
17345 </p>
17346 !!end
17347
17348 !! test
17349 Namespaced link must have a title (bad fragment version)
17350 !! wikitext
17351 [[Project:#fragment]]
17352 !! html
17353 <p>[[Project:#fragment]]
17354 </p>
17355 !!end
17356
17357
17358 ###
17359 ### HTML tags and HTML attributes
17360 ###
17361
17362 !! test
17363 div with no attributes
17364 !! wikitext
17365 <div>HTML rocks</div>
17366 !! html
17367 <div>HTML rocks</div>
17368
17369 !! end
17370
17371 !! test
17372 div with double-quoted attribute
17373 !! wikitext
17374 <div id="rock">HTML rocks</div>
17375 !! html
17376 <div id="rock">HTML rocks</div>
17377
17378 !! end
17379
17380 !! test
17381 div with single-quoted attribute
17382 !! wikitext
17383 <div id='rock'>HTML rocks</div>
17384 !! html
17385 <div id="rock">HTML rocks</div>
17386
17387 !! end
17388
17389 !! test
17390 div with unquoted attribute
17391 !! wikitext
17392 <div id=rock>HTML rocks</div>
17393 !! html
17394 <div id="rock">HTML rocks</div>
17395
17396 !! end
17397
17398 !! test
17399 div with illegal double attributes
17400 !! wikitext
17401 <div id="a" id="b">HTML rocks</div>
17402 !! html
17403 <div id="b">HTML rocks</div>
17404
17405 !!end
17406
17407 !! test
17408 div with empty attribute value, space before equals
17409 !! options
17410 parsoid=wt2html,html2html
17411 !! wikitext
17412 <div class =>HTML rocks</div>
17413 !! html/php
17414 <div class="">HTML rocks</div>
17415
17416 !! html/parsoid
17417 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17418 !! end
17419
17420 !! test
17421 div with multiple empty attribute values
17422 !! config
17423 wgFragmentMode=[ 'html5', 'legacy' ]
17424 !! options
17425 parsoid=wt2html,html2html
17426 !! wikitext
17427 <div id= title=>HTML rocks</div>
17428 !! html/php
17429 <div id="title=">HTML rocks</div>
17430
17431 !! html/parsoid
17432 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17433 !! end
17434
17435 # FIXME Parsoid doesn't actually match PHP here.
17436 # Probably we should use the synthetic <foo /> or <indicator>
17437 # extensions for this test, which are enabled when running parser tests.
17438 !! test
17439 Extension tag in attribute value
17440 !! wikitext
17441 <span title="<translate>123</translate>">ok</span>
17442 !! html/php+disabled
17443 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17444 </p>
17445 !! html/parsoid
17446 <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>
17447 !! end
17448
17449 !! test
17450 table with multiple empty attribute values
17451 !! options
17452 parsoid=wt2html,html2html
17453 !! wikitext
17454 {| title= id=
17455 |hi
17456 |}
17457 !! html/php
17458 <table title="id=">
17459 <tr>
17460 <td>hi
17461 </td></tr></table>
17462
17463 !! html/parsoid
17464 <table title="id=">
17465 <tbody><tr><td>hi</td></tr>
17466 </tbody></table>
17467 !! end
17468
17469 !! test
17470 div with braces in attribute value
17471 !! wikitext
17472 <div title="{}">Foo</div>
17473 !! html/php
17474 <div title="&#123;&#125;">Foo</div>
17475
17476 !! html/parsoid
17477 <div title="{}">Foo</div>
17478 !! end
17479
17480 !! test
17481 div with empty attribute value, no space before equals
17482 !! options
17483 parsoid=wt2html,html2html
17484 !! wikitext
17485 <div class=>HTML rocks</div>
17486 !! html/php
17487 <div class="">HTML rocks</div>
17488
17489 !! html/parsoid
17490 <div class="">HTML rocks</div>
17491 !! end
17492
17493 !! test
17494 HTML multiple attributes correction
17495 !! wikitext
17496 <p class="error" class="awesome">Awesome!</p>
17497 !! html
17498 <p class="awesome">Awesome!</p>
17499
17500 !!end
17501
17502 !! test
17503 Table multiple attributes correction
17504 !! wikitext
17505 {|
17506 !+ class="error" class="awesome"|status
17507 |}
17508 !! html
17509 <table>
17510 <tr>
17511 <th class="awesome">status
17512 </th></tr></table>
17513
17514 !!end
17515
17516 !! test
17517 DIV IN UPPERCASE
17518 !! wikitext
17519 <DIV ID="x">HTML ROCKS</DIV>
17520 !! html
17521 <div id="x">HTML ROCKS</div>
17522
17523 !!end
17524
17525 !! test
17526 Non-ASCII pseudo-tags are rendered as text
17527 !! wikitext
17528 <khyô>
17529 !! html
17530 <p>&lt;khyô&gt;
17531 </p>
17532 !! end
17533
17534 !! test
17535 Pseudo-tag with URL 'name' renders as url link
17536 !! wikitext
17537 <http://example.com/>
17538 !! html
17539 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17540 </p>
17541 !! end
17542
17543 !! test
17544 text with amp in the middle of nowhere
17545 !! wikitext
17546 Remember AT&T?
17547 !! html
17548 <p>Remember AT&amp;T?
17549 </p>
17550 !! end
17551
17552 !! test
17553 text with character entity: eacute
17554 !! wikitext
17555 I always thought &eacute; was a cute letter.
17556 !! html+tidy
17557 <p>I always thought &#233; was a cute letter.
17558 </p>
17559 !! end
17560
17561 !! test
17562 text with entity-escaped character entity-like string: eacute
17563 !! wikitext
17564 I always thought &amp;eacute; was a cute letter.
17565 !! html
17566 <p>I always thought &amp;eacute; was a cute letter.
17567 </p>
17568 !! end
17569
17570 !! test
17571 text with undefined character entity: xacute
17572 !! wikitext
17573 I always thought &xacute; was a cute letter.
17574 !! html
17575 <p>I always thought &amp;xacute; was a cute letter.
17576 </p>
17577 !! end
17578
17579 !! test
17580 HTML5 tags
17581 !! wikitext
17582 <data value="5">five</data>
17583 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17584 <mark>This highlighted text</mark>
17585 !! html
17586 <p><data value="5">five</data>
17587 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17588 <mark>This highlighted text</mark>
17589 </p>
17590 !! end
17591
17592 !! test
17593 HTML tag with leading space is parsed as text
17594 !! wikitext
17595 < div>foo< /div>
17596 !! html
17597 <p>&lt; div&gt;foo&lt; /div&gt;
17598 </p>
17599 !! end
17600
17601 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17602 ## the HTML5 parsing spec.
17603 !! test
17604 Element with broken attribute syntax
17605 !! options
17606 parsoid=wt2html
17607 !! wikitext
17608 <div style=" style="123">hi</div>
17609 <div =>ho</div>
17610 !! html/php
17611 <div style="123">hi</div>
17612 <div>ho</div>
17613
17614 !! html/parsoid
17615 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17616 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17617 !! end
17618
17619 ###
17620 ### Nesting tests (see T43545, T52604, T53081)
17621 ###
17622
17623 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17624 # Note that html2wt is considerably more difficult if we use <b> in
17625 # the test case, instead of <small>
17626 !! test
17627 Ensure that HTML adoption agency algorithm is properly implemented.
17628 !! wikitext
17629 <small>X<small>Y</small>Z</small>
17630 !! html
17631 <p><small>X<small>Y</small>Z</small>
17632 </p>
17633 !! end
17634
17635 # This was T43545 in the PHP parser.
17636 !! test
17637 Nesting of <kbd>
17638 !! wikitext
17639 <kbd>X<kbd>Y</kbd>Z</kbd>
17640 !! html+tidy
17641 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17642 </p>
17643 !! end
17644
17645 # The following cases were T53081 in the PHP parser.
17646 # Note that there are some other nestable tags (b, i, etc) which are
17647 # not covered; see T53081 for discussion.
17648
17649 !! test
17650 Nesting of <em>
17651 !! wikitext
17652 <em>X<em>Y</em>Z</em>
17653 !! html+tidy
17654 <p><em>X<em>Y</em>Z</em>
17655 </p>
17656 !! end
17657
17658 !! test
17659 Nesting of <strong>
17660 !! wikitext
17661 <strong>X<strong>Y</strong>Z</strong>
17662 !! html+tidy
17663 <p><strong>X<strong>Y</strong>Z</strong>
17664 </p>
17665 !! end
17666
17667 !! test
17668 Nesting of <q>
17669 !! wikitext
17670 <q>X<q>Y</q>Z</q>
17671 !! html+tidy
17672 <p><q>X<q>Y</q>Z</q>
17673 </p>
17674 !! end
17675
17676 !! test
17677 Nesting of <ruby>
17678 !! wikitext
17679 <ruby>X<ruby>Y</ruby>Z</ruby>
17680 !! html
17681 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17682 </p>
17683 !! end
17684
17685 !! test
17686 Nesting of <bdo>
17687 !! wikitext
17688 <bdo>X<bdo>Y</bdo>Z</bdo>
17689 !! html
17690 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17691 </p>
17692 !! end
17693
17694
17695 ###
17696 ### Media links
17697 ###
17698
17699 !! test
17700 Media link
17701 !! wikitext
17702 [[Media:Foobar.jpg]]
17703 [[Media:Video.ogv]]
17704 [[:Media:Video.ogv]]
17705 !! html/php
17706 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17707 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17708 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17709 </p>
17710 !! html/parsoid
17711 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17712 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17713 <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>
17714 !! end
17715
17716 !! test
17717 Media link with text
17718 !! wikitext
17719 [[Media:Foobar.jpg|A neat file to look at]]
17720 !! html/php
17721 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17722 </p>
17723 !! html/parsoid
17724 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17725 !! end
17726
17727 # FIXME: this is still bad HTML tag nesting
17728 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17729 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
17730 !! test
17731 Media link with nasty text
17732 !! options
17733 parsoid=wt2html,html2html
17734 !! wikitext
17735 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17736 !! html/php
17737 <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>
17738
17739 !! html/php+tidy
17740 <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>
17741 !! html/parsoid
17742 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Safe Link</a></p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg"><div style="display:none" data-parsoid='{"stx":"html"}'>" onmouseover="alert(document.cookie)" onfoo="</div></a>
17743 !! end
17744
17745 !! test
17746 Media link to nonexistent file (T3702)
17747 !! wikitext
17748 [[Media:No such.jpg]]
17749 [[Media:No_such file.jpg]]
17750 !! html/php
17751 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17752 <a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such_file.jpg" class="new" title="No such file.jpg">Media:No_such file.jpg</a>
17753 </p>
17754 !! html/parsoid
17755 <p><a rel="mw:MediaLink" href="./Special:FilePath/No_such.jpg" title="No such.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"fileName":"No_such.jpg"},"sa":{"fileName":"No such.jpg"}}'>Media:No such.jpg</a>
17756 <a rel="mw:MediaLink" href="./Special:FilePath/No_such_file.jpg" title="No such file.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"fileName":"No_such_file.jpg"},"sa":{"fileName":"No_such file.jpg"}}'>Media:No_such file.jpg</a></p>
17757 !! end
17758
17759 !! test
17760 Image link to nonexistent file (T3850 - good)
17761 !! wikitext
17762 [[File:No_such.jpg]]
17763 !! html/php
17764 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a>
17765 </p>
17766 !! html/parsoid
17767 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:No_such.jpg"><img resource="./File:No_such.jpg" src="./Special:FilePath/No_such.jpg" height="220" width="220"/></a></figure-inline></p>
17768 !! end
17769
17770 !! test
17771 :Image link to nonexistent file (T3850 - bad)
17772 !! wikitext
17773 [[:Image:No such.jpg]]
17774 !! html/php
17775 <p><a href="/index.php?title=File:No_such.jpg&amp;action=edit&amp;redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a>
17776 </p>
17777 !! html/parsoid
17778 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17779 !! end
17780
17781 !! test
17782 Character reference normalization in link text (T3938)
17783 !! wikitext
17784 [[Main Page|this&that]]
17785 !! html
17786 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17787 </p>
17788 !!end
17789
17790 !! article
17791 אַ
17792 !! text
17793 Test for unicode normalization
17794
17795 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17796 !! endarticle
17797
17798 !! test
17799 (T21451) Links should refer to the normalized form.
17800 !! wikitext
17801 [[&#xFB2E;]]
17802 [[&#x5d0;&#x5b7;]]
17803 [[&#x5d0;ַ]]
17804 [[א&#x5b7;]]
17805 [[אַ]]
17806 !! html
17807 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17808 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17809 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17810 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17811 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17812 </p>
17813 !! end
17814
17815 !! test
17816 Empty attribute crash test (T4067)
17817 !! wikitext
17818 <font color="">foo</font>
17819 !! html
17820 <p><font color="">foo</font>
17821 </p>
17822 !! end
17823
17824 !! test
17825 Empty attribute crash test single-quotes (T4067)
17826 !! wikitext
17827 <font color=''>foo</font>
17828 !! html
17829 <p><font color="">foo</font>
17830 </p>
17831 !! end
17832
17833 !! test
17834 Attribute test: equals, then nothing
17835 !! options
17836 parsoid=wt2html,html2html
17837 !! wikitext
17838 <font color=>foo</font>
17839 !! html/php
17840 <p><font color="">foo</font>
17841 </p>
17842 !! html/parsoid
17843 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17844 !! end
17845
17846 !! test
17847 Attribute test: unquoted value
17848 !! options
17849 parsoid=wt2html,html2html
17850 !! wikitext
17851 <font color=x>foo</font>
17852 !! html/php
17853 <p><font color="x">foo</font>
17854 </p>
17855 !! html/parsoid
17856 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17857 !! end
17858
17859 !! test
17860 Attribute test: unquoted but illegal value (hash)
17861 !! wikitext
17862 <font color=#x>foo</font>
17863 !! html
17864 <p><font color="#x">foo</font>
17865 </p>
17866 !! end
17867
17868 # Parsoid does not serialize to empty attribute syntax,
17869 # so wt2wt and html2wt cases are skipped
17870 !! test
17871 Attribute test: no value (T54330)
17872 !! options
17873 parsoid=wt2html,html2html
17874 !! wikitext
17875 <font color>foo</font>
17876 !! html/php
17877 <p><font color="">foo</font>
17878 </p>
17879 !! html/parsoid
17880 <p><font color="">foo</font></p>
17881 !! end
17882
17883 !! test
17884 T4095: link with three closing brackets
17885 !! wikitext
17886 [[Main Page]]]
17887 !! html/php
17888 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17889 </p>
17890 !! html/parsoid
17891 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17892 !! end
17893
17894 !! test
17895 T4095: link with pipe and three closing brackets
17896 !! wikitext
17897 [[Main Page|link]]]
17898 !! html/php
17899 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17900 </p>
17901 !! html/parsoid
17902 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17903 !! end
17904
17905 !! test
17906 T4095: link with pipe and three closing brackets, version 2
17907 !! wikitext
17908 [[Main Page|[http://example.com/]]]
17909 !! html/php
17910 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17911 </p>
17912 !! html/parsoid
17913 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17914 !! end
17915
17916
17917 ###
17918 ### Safety
17919 ###
17920
17921 !! article
17922 Template:Dangerous attribute
17923 !! text
17924 " onmouseover="alert(document.cookie)
17925 !! endarticle
17926
17927 !! article
17928 Template:Dangerous style attribute
17929 !! text
17930 border-size: expression(alert(document.cookie))
17931 !! endarticle
17932
17933 !! article
17934 Template:Div style
17935 !! text
17936 <div style="float: right; {{{1}}}">Magic div</div>
17937 !! endarticle
17938
17939 !! test
17940 T4304: HTML attribute safety (safe template; regression T4309)
17941 !! wikitext
17942 <div title="{{test}}"></div>
17943 !! html/php
17944 <div title="This is a test template"></div>
17945
17946 !! html/parsoid
17947 <div title="This is a test template" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"This is a test template"},"sa":{"title":"{{test}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,20,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"test\",\"href\":\"./Template:Test\"},\"params\":{},\"i\":0}}]}&#39;>This is a test template&lt;/span>"}]]}'></div>
17948 !! end
17949
17950 # Parsoid has enough context to handle this case
17951 !! test
17952 T4304: HTML attribute safety (dangerous template; 2309)
17953 !! wikitext
17954 <div title="{{dangerous attribute}}"></div>
17955 !! html/php
17956 <div title=""></div>
17957
17958 !! html/parsoid
17959 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,35,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous attribute\",\"href\":\"./Template:Dangerous_attribute\"},\"params\":{},\"i\":0}}]}&#39;>\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
17960 !! end
17961
17962 !! test
17963 T4304: HTML attribute safety (dangerous style template; 2309)
17964 !! wikitext
17965 <div style="{{dangerous style attribute}}"></div>
17966 !! html/php
17967 <div style="/* insecure input */"></div>
17968
17969 !! html/parsoid
17970 <div style="/* insecure input */" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"{{dangerous style attribute}}"}}' data-mw='{"attribs":[[{"txt":"style"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,41,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous style attribute\",\"href\":\"./Template:Dangerous_style_attribute\"},\"params\":{},\"i\":0}}]}&#39;>border-size: expression(alert(document.cookie))&lt;/span>"}]]}'></div>
17971 !! end
17972
17973 !! test
17974 T4304: HTML attribute safety (safe parameter; 2309)
17975 !! wikitext
17976 {{div style|width: 200px}}
17977 !! html/php
17978 <div style="float: right; width: 200px">Magic div</div>
17979
17980 !! html/parsoid
17981 <div style="float: right; width: 200px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"float: right; width: 200px"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: 200px"}},"i":0}}]}'>Magic div</div>
17982 !! end
17983
17984 !! test
17985 T4304: HTML attribute safety (unsafe parameter; 2309)
17986 !! wikitext
17987 {{div style|width: expression(alert(document.cookie))}}
17988 !! html/php
17989 <div style="/* insecure input */">Magic div</div>
17990
17991 !! html/parsoid
17992 <div style="/* insecure input */" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: expression(alert(document.cookie))"}},"i":0}}]}'>Magic div</div>
17993 !! end
17994
17995 ## Parsoid output here differs; needs investigation.
17996 !! test
17997 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17998 !! wikitext
17999 {{div style|"><script>alert(document.cookie)</script>}}
18000 !! html
18001 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18002
18003 !! end
18004
18005 ## Parsoid output here differs; needs investigation.
18006 !! test
18007 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
18008 !! wikitext
18009 {{div style|" ><script>alert(document.cookie)</script>}}
18010 !! html
18011 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18012
18013 !! end
18014
18015 !! test
18016 T4304: HTML attribute safety (link)
18017 !! wikitext
18018 <div title="[[Main Page]]"></div>
18019 !! html/php
18020 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
18021
18022 !! html/parsoid
18023 <div title="[[Main Page]]"></div>
18024 !! end
18025
18026 !! test
18027 T4304: HTML attribute safety (italics)
18028 !! wikitext
18029 <div title="''foobar''"></div>
18030 !! html
18031 <div title="&#39;&#39;foobar&#39;&#39;"></div>
18032
18033 !! end
18034
18035 !! test
18036 T4304: HTML attribute safety (bold)
18037 !! wikitext
18038 <div title="'''foobar'''"></div>
18039 !! html
18040 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
18041
18042 !! end
18043
18044 !! test
18045 T4304: HTML attribute safety (ISBN)
18046 !! wikitext
18047 <div title="ISBN 1234567890"></div>
18048 !! html
18049 <div title="&#73;SBN 1234567890"></div>
18050
18051 !! end
18052
18053 !! test
18054 T4304: HTML attribute safety (RFC)
18055 !! wikitext
18056 <div title="RFC 1234"></div>
18057 !! html
18058 <div title="&#82;FC 1234"></div>
18059
18060 !! end
18061
18062 !! test
18063 T4304: HTML attribute safety (PMID)
18064 !! wikitext
18065 <div title="PMID 1234567890"></div>
18066 !! html
18067 <div title="&#80;MID 1234567890"></div>
18068
18069 !! end
18070
18071 !! test
18072 T4304: HTML attribute safety (web link)
18073 !! wikitext
18074 <div title="http://example.com/"></div>
18075 !! html
18076 <div title="http&#58;//example.com/"></div>
18077
18078 !! end
18079
18080 !! test
18081 T4304: HTML attribute safety (named web link)
18082 !! wikitext
18083 <div title="[http://example.com/ link]"></div>
18084 !! html/php
18085 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
18086
18087 !! html/parsoid
18088 <div title="[http://example.com/ link]"></div>
18089 !! end
18090
18091 !! test
18092 T5244: HTML attribute safety (extension; safe)
18093 !! wikitext
18094 <div style="<nowiki>background:blue</nowiki>"></div>
18095 !! html/php
18096 <div style="background:blue"></div>
18097
18098 !! html/parsoid
18099 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
18100 !! end
18101
18102 !! test
18103 T5244: HTML attribute safety (extension; unsafe)
18104 !! wikitext
18105 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
18106 !! html/php
18107 <div style="/* insecure input */"></div>
18108
18109 !! html/parsoid
18110 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"&lt;nowiki>border-left:expression(alert(document.cookie))&lt;/nowiki>"}}'></div>
18111 !! end
18112
18113 # More MSIE fun discovered by Tom Gilder
18114
18115 !! test
18116 MSIE CSS safety test: spurious slash
18117 !! wikitext
18118 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
18119 !! html/php
18120 <div style="/* insecure input */">evil</div>
18121
18122 !! html/parsoid
18123 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
18124 !! end
18125
18126 !! test
18127 MSIE CSS safety test: hex code
18128 !! wikitext
18129 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
18130 !! html/php
18131 <div style="/* insecure input */">evil</div>
18132
18133 !! html/parsoid
18134 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\72l(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
18135 !! end
18136
18137 !! test
18138 MSIE CSS safety test: comment in url
18139 !! wikitext
18140 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
18141 !! html/php
18142 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
18143
18144 !! html/parsoid
18145 <div style="background-image:u rl(javascript:alert('boo'))" data-parsoid='{"stx":"html","a":{"style":"background-image:u rl(javascript:alert(&#39;boo&#39;))"},"sa":{"style":"background-image:u/**/rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
18146 !! end
18147
18148 !! test
18149 MSIE CSS safety test: comment in expression
18150 !! wikitext
18151 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
18152 !! html/php
18153 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
18154
18155 !! html/parsoid
18156 <div style="background-image:expres sion(alert('boo4'))" data-parsoid='{"stx":"html","a":{"style":"background-image:expres sion(alert(&#39;boo4&#39;))"},"sa":{"style":"background-image:expres/**/sion(alert(&#39;boo4&#39;))"}}'>evil4</div>
18157 !! end
18158
18159 !! test
18160 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
18161 !! wikitext
18162 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
18163 !! html/php
18164 <p style="/* invalid control char */">A</p>
18165
18166 !! html/parsoid
18167 <p style="/* invalid control char */" data-parsoid='{"stx":"html","a":{"style":"/* invalid control char */"},"sa":{"style":"font-size: 100px; background-image:url\\b(https://www.google.com/images/srpr/logo6w.png)"}}'>A</p>
18168 !! end
18169
18170 !! test
18171 MSIE 6 CSS safety test: Fullwidth (T57332)
18172 !! wikitext
18173 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
18174 <div style="top:EXPRESSION(alert())">B</div>
18175 !! html/php
18176 <p style="/* insecure input */">A</p>
18177 <div style="/* insecure input */">B</div>
18178
18179 !! html/parsoid
18180 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expression((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
18181 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
18182 !! end
18183
18184 !! test
18185 MSIE 6 CSS safety test: IPA extensions (T57332)
18186 !! wikitext
18187 <div style="background-image:uʀʟ(javascript:alert())">A</div>
18188 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
18189 !! html/php
18190 <div style="/* insecure input */">A</div>
18191 <p style="/* insecure input */">B</p>
18192
18193 !! html/parsoid
18194 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
18195 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expʀessɪoɴ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
18196 !! end
18197
18198 !! test
18199 MSIE 6 CSS safety test: sup/sub script (T57332)
18200 !! wikitext
18201 <div style="background-image:url⁽javascript:alert())">A</div>
18202 <div style="background-image:url₍javascript:alert())">B</div>
18203 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
18204 !! html/php
18205 <div style="/* insecure input */">A</div>
18206 <div style="/* insecure input */">B</div>
18207 <p style="/* insecure input */">C</p>
18208
18209 !! html/parsoid
18210 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
18211 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
18212 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expressioⁿ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
18213 !! end
18214
18215 !! test
18216 Opera -o-link CSS
18217 !! options
18218 parsoid=wt2html,html2html
18219 !! wikitext
18220 <div
18221 title="&#100;&#97;&#116;&#97;&#58;&#116;&#101;&#120;&#116;&#47;&#104;&#116;&#109;&#108;&#44;&#60;&#105;&#109;&#103;&#32;&#115;&#114;&#99;&#61;&#49;&#32;&#111;&#110;&#101;&#114;&#114;&#111;&#114;&#61;&#97;&#108;&#101;&#114;&#116;&#40;&#49;&#41;&#62;"
18222 style="-o-link:attr(title);-o-link-source:current">X</div>
18223 !! html/php
18224 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
18225
18226 !! html/parsoid
18227 <div title="data:text/html,&lt;img src=1 onerror=alert(1)>" style="/* insecure input */" data-parsoid='{"stx":"html","a":{"title":"data:text/html,&lt;img src=1 onerror=alert(1)>","style":"/* insecure input */"},"sa":{"title":"&amp;#100;&amp;#97;&amp;#116;&amp;#97;&amp;#58;&amp;#116;&amp;#101;&amp;#120;&amp;#116;&amp;#47;&amp;#104;&amp;#116;&amp;#109;&amp;#108;&amp;#44;&amp;#60;&amp;#105;&amp;#109;&amp;#103;&amp;#32;&amp;#115;&amp;#114;&amp;#99;&amp;#61;&amp;#49;&amp;#32;&amp;#111;&amp;#110;&amp;#101;&amp;#114;&amp;#114;&amp;#111;&amp;#114;&amp;#61;&amp;#97;&amp;#108;&amp;#101;&amp;#114;&amp;#116;&amp;#40;&amp;#49;&amp;#41;&amp;#62;","style":"-o-link:attr(title);-o-link-source:current"}}'>X</div>
18228 !! end
18229
18230 !! test
18231 MSIE 6 CSS safety test: Repetition markers (T57332)
18232 !! wikitext
18233 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
18234 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
18235 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
18236 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
18237 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
18238 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
18239 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
18240 !! html/php
18241 <p style="/* insecure input */">A</p>
18242 <p style="/* insecure input */">B</p>
18243 <p style="/* insecure input */">C</p>
18244 <p style="/* insecure input */">D</p>
18245 <p style="/* insecure input */">E</p>
18246 <p style="/* insecure input */">F</p>
18247 <p style="/* insecure input */">G</p>
18248
18249 !! html/parsoid
18250 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expres〱ion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
18251 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresゝion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
18252 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
18253 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresヽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>D</p>
18254 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>E</p>
18255 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹼion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>F</p>
18256 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>G</p>
18257 !! end
18258
18259 !! test
18260 Table attribute legitimate extension
18261 !! wikitext
18262 {|
18263 !+ style="<nowiki>color:blue</nowiki>"|status
18264 |}
18265 !! html
18266 <table>
18267 <tr>
18268 <th style="color:blue">status
18269 </th></tr></table>
18270
18271 !!end
18272
18273 !! test
18274 Table attribute safety
18275 !! wikitext
18276 {|
18277 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18278 |}
18279 !! html
18280 <table>
18281 <tr>
18282 <th style="/* insecure input */">status
18283 </th></tr></table>
18284
18285 !! end
18286
18287 !! test
18288 CSS line continuation 1
18289 !! wikitext
18290 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18291 !! html
18292 <div style="/* insecure input */"></div>
18293
18294 !! end
18295
18296 !! test
18297 CSS line continuation 2
18298 !! wikitext
18299 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18300 !! html
18301 <div style="/* invalid control char */"></div>
18302
18303 !! end
18304
18305 !! article
18306 Template:Identity
18307 !! text
18308 {{{1}}}
18309 !! endarticle
18310
18311 !! test
18312 Expansion of multi-line templates in attribute values (T8255)
18313 !! wikitext
18314 <div style="background: {{identity|#00FF00}}">-</div>
18315 !! html
18316 <div style="background: #00FF00">-</div>
18317
18318 !! end
18319
18320 !! test
18321 Expansion of multi-line templates in attribute values (T8255 sanity check)
18322 !! wikitext
18323 <div style="background:
18324 #00FF00">-</div>
18325 !! html/php
18326 <div style="background: #00FF00">-</div>
18327
18328 !! html/parsoid
18329 <div style="background:
18330 #00FF00">-</div>
18331 !! end
18332
18333 !! test
18334 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18335 !! wikitext
18336 <div style="background: &#10;#00FF00">-</div>
18337 !! html
18338 <div style="background: &#10;#00FF00">-</div>
18339
18340 !! end
18341
18342 !! test
18343 Tags which are hidden from tidiers cannot pass through the Sanitizer
18344 !! wikitext
18345 <mw:toc><script>alert();</script></mw:toc>
18346 !! html+tidy
18347 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18348 </p>
18349 !! end
18350
18351 ###
18352 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18353 ###
18354
18355 !! test
18356 Parser hook: empty input
18357 !! wikitext
18358 <tag></tag>
18359 !! html/php
18360 <pre>
18361 ''
18362 array (
18363 )
18364 </pre>
18365
18366 !! html/parsoid
18367 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18368 !! end
18369
18370 ## Don't expect parsoid to rt this form.
18371 !! test
18372 Parser hook: empty input using terminated empty elements
18373 !! options
18374 parsoid=wt2html,html2html
18375 !! wikitext
18376 <tag/>
18377 !! html/php
18378 <pre>
18379 NULL
18380 array (
18381 )
18382 </pre>
18383
18384 !! html/parsoid
18385 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18386 !! end
18387
18388 !! test
18389 Parser hook: empty input using terminated empty elements (space before)
18390 !! wikitext
18391 <tag />
18392 !! html/php
18393 <pre>
18394 NULL
18395 array (
18396 )
18397 </pre>
18398
18399 !! html/parsoid
18400 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18401 !! end
18402
18403 !! test
18404 Parser hook: basic input
18405 !! wikitext
18406 <tag>input</tag>
18407 !! html/php
18408 <pre>
18409 'input'
18410 array (
18411 )
18412 </pre>
18413
18414 !! html/parsoid
18415 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18416 !! end
18417
18418 ## Don't expect parsoid to rt this form.
18419 !! test
18420 Parser hook: case insensitive
18421 !! options
18422 parsoid=wt2html,html2html
18423 !! wikitext
18424 <TAG>input</TAG>
18425 !! html/php
18426 <pre>
18427 'input'
18428 array (
18429 )
18430 </pre>
18431
18432 !! html/parsoid
18433 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18434 !! end
18435
18436 ## Don't expect parsoid to rt this form.
18437 !! test
18438 Parser hook: case insensitive, redux
18439 !! options
18440 parsoid=wt2html,html2html
18441 !! wikitext
18442 <TaG>input</TAg>
18443 !! html/php
18444 <pre>
18445 'input'
18446 array (
18447 )
18448 </pre>
18449
18450 !! html/parsoid
18451 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18452 !! end
18453
18454 !! test
18455 Parser hook: nested tags
18456 !! options
18457 parsoid=wt2html
18458 !! wikitext
18459 <tag><tag></tag></tag>
18460 !! html/php
18461 <pre>
18462 '<tag>'
18463 array (
18464 )
18465 </pre>&lt;/tag&gt;
18466
18467 !! html/php+tidy
18468 <pre>'<tag>'
18469 array (
18470 )
18471 </tag></pre><p>&lt;/tag&gt;
18472 </p>
18473 !! html/parsoid
18474 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}'></pre><p>&lt;/tag></p>
18475 !! end
18476
18477 !! test
18478 Parser hook: basic arguments
18479 !! wikitext
18480 <tag width="200" height="100" depth="50" square=""></tag>
18481 !! html/php
18482 <pre>
18483 ''
18484 array (
18485 'width' => '200',
18486 'height' => '100',
18487 'depth' => '50',
18488 'square' => '',
18489 )
18490 </pre>
18491
18492 !! html/parsoid
18493 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18494 !! end
18495
18496 ## Don't expect parsoid to rt this form.
18497 !! test
18498 Parser hook: basic arguments, variations
18499 !! options
18500 parsoid=wt2html,html2html
18501 !! wikitext
18502 <tag width=200 height = "100" depth = '50' square></tag>
18503 !! html/php
18504 <pre>
18505 ''
18506 array (
18507 'width' => '200',
18508 'height' => '100',
18509 'depth' => '50',
18510 'square' => '',
18511 )
18512 </pre>
18513
18514 !! html/parsoid
18515 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18516 !! end
18517
18518 !! test
18519 Parser hook: argument containing a forward slash (T7344)
18520 !! wikitext
18521 <tag filename="/tmp/bla"></tag>
18522 !! html/php
18523 <pre>
18524 ''
18525 array (
18526 'filename' => '/tmp/bla',
18527 )
18528 </pre>
18529
18530 !! html/parsoid
18531 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18532 !! end
18533
18534 ## Don't expect parsoid to rt this form.
18535 !! test
18536 Parser hook: empty input using terminated empty elements (T4374)
18537 !! options
18538 parsoid=wt2html,html2html
18539 !! wikitext
18540 <tag foo=bar/>text
18541 !! html/php
18542 <pre>
18543 NULL
18544 array (
18545 'foo' => 'bar',
18546 )
18547 </pre>text
18548
18549 !! html/parsoid
18550 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}'></pre><p>text</p>
18551 !! end
18552
18553 ## </tag> should be output literally since there is no matching tag that begins it
18554 ## Don't expect parsoid to rt this form.
18555 !! test
18556 Parser hook: basic arguments using terminated empty elements (T4374)
18557 !! options
18558 parsoid=wt2html
18559 !! wikitext
18560 <tag width=200 height = "100" depth = '50' square/>
18561 other stuff
18562 </tag>
18563 !! html/php
18564 <pre>
18565 NULL
18566 array (
18567 'width' => '200',
18568 'height' => '100',
18569 'depth' => '50',
18570 'square' => '',
18571 )
18572 </pre>
18573 <p>other stuff
18574 &lt;/tag&gt;
18575 </p>
18576 !! html/parsoid
18577 <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
18578 &lt;/tag></p>
18579 !! end
18580
18581 ## Don't expect parsoid to rt this form.
18582 !! test
18583 Parser hook: Don't allow unclosed extension tags
18584 !! options
18585 parsoid=wt2html
18586 !! wikitext
18587 test <tag>123
18588
18589 this is a '''test'''
18590 !! html/php
18591 <p>test &lt;tag&gt;123
18592 </p><p>this is a <b>test</b>
18593 </p>
18594 !! html/parsoid
18595 <p>test &lt;tag>123</p>
18596
18597 <p>this is a <b>test</b></p>
18598 !! end
18599
18600 !! test
18601 Parser hook: horizontal rule inside extension tag that outputs <pre>
18602 !! wikitext
18603 <tag>
18604 Hello
18605 <hr/>
18606 Goodbye
18607 </tag>
18608 !! html/php
18609 <pre>
18610 '
18611 Hello
18612 <hr/>
18613 Goodbye
18614 '
18615 array (
18616 )
18617 </pre>
18618
18619 !! end
18620
18621 ###
18622 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18623 ###
18624
18625 !! test
18626 Parser hook: static parser hook not inside a comment
18627 !! wikitext
18628 <statictag>hello, world</statictag>
18629
18630 <statictag action="flush" />
18631 !! html/php
18632 <p><br />
18633 hello, world
18634 </p>
18635 !! html/parsoid
18636 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18637 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18638 !! end
18639
18640 !! test
18641 Parser hook: static parser hook inside a comment
18642 !! wikitext
18643 <!-- <statictag>hello, world</statictag> -->
18644 <statictag action="flush" />
18645 !! html/php
18646 <p><br />
18647 </p>
18648 !! html/parsoid
18649 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18650 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18651 !! end
18652
18653 # Nested template calls; this case was broken by Parser.php rev 1.506,
18654 # since reverted.
18655
18656 !! article
18657 Template:One-parameter
18658 !! text
18659 (My parameter is: {{{1}}})
18660 !! endarticle
18661
18662 !! article
18663 Template:Map-one-parameter
18664 !! text
18665 {{{{{1}}}|{{{2}}}}}
18666 !! endarticle
18667
18668 !! test
18669 Nested template calls
18670 !! wikitext
18671 {{Map-one-parameter|One-parameter|param}}
18672 !! html
18673 <p>(My parameter is: param)
18674 </p>
18675 !! end
18676
18677
18678 ###
18679 ### Sanitizer
18680 ###
18681
18682 !! test
18683 Sanitizer: Closing of open tags
18684 !! wikitext
18685 <s></s><table></table>
18686 !! html/php+tidy
18687 <p><s></s></p><table></table>
18688 !! html/parsoid
18689 <p><s data-parsoid='{"stx":"html"}'></s></p><table data-parsoid='{"stx":"html"}'></table>
18690 !! end
18691
18692 !! test
18693 Sanitizer: Closing of open but not closed tags
18694 !! wikitext
18695 <s>foo
18696 !! html
18697 <p><s>foo</s>
18698 </p>
18699 !! end
18700
18701 !! test
18702 Sanitizer: Closing of closed but not open tags
18703 !! options
18704 parsoid=wt2html
18705 !! wikitext
18706 </s>
18707 !! html+tidy
18708 <p class="mw-empty-elt">
18709 </p>
18710 !! end
18711
18712 !! test
18713 Sanitizer: Closing of closed but not open table tags
18714 !! options
18715 parsoid=wt2html
18716 !! wikitext
18717 Table not started</td></tr></table>
18718 !! html+tidy
18719 <p>Table not started
18720 </p>
18721 !! end
18722
18723 !! test
18724 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18725 !! config
18726 wgFragmentMode=[ 'html5', 'legacy' ]
18727 !! wikitext
18728 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18729 !! html/php
18730 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18731 </p>
18732 !! html/parsoid
18733 <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>
18734 !! end
18735
18736 !! test
18737 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18738 !! config
18739 wgFragmentMode=[ 'legacy' ]
18740 !! wikitext
18741 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18742 !! html/php
18743 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18744 </p>
18745 !! end
18746
18747 # In HTML5, the restrictions are that id must contain at least one character,
18748 # and must not contain any space characters.
18749 !! test
18750 Sanitizer: Validating the contents of the id attribute (T6515)
18751 !! options
18752 disabled
18753 !! wikitext
18754 <br id="" /><br id="a space" />
18755 !! html
18756 Something ...
18757 !! end
18758
18759 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18760 !! test
18761 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18762 !! options
18763 disabled
18764 !! wikitext
18765 <br id="foo" /><br id="foo" />
18766 !! html
18767 Something need to be done. foo-2 ?
18768 !! end
18769
18770 !! test
18771 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18772 !! wikitext
18773 <div itemscope>
18774 <meta itemprop="hello" content="world">
18775 <meta http-equiv="refresh" content="5">
18776 <meta itemprop="hello" http-equiv="refresh" content="5">
18777 <link itemprop="hello" href="{{SERVER}}">
18778 <link rel="stylesheet" href="{{SERVER}}">
18779 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18780 </div>
18781 !! html
18782 <div itemscope="">
18783 <p> <meta itemprop="hello" content="world" />
18784 &lt;meta http-equiv="refresh" content="5"&gt;
18785 <meta itemprop="hello" content="5" />
18786 <link itemprop="hello" href="http&#58;//example.org" />
18787 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18788 <link itemprop="hello" href="http&#58;//example.org" />
18789 </p>
18790 </div>
18791
18792 !! end
18793
18794 !! test
18795 Sanitizer: Strip comments from CSS attributes
18796 !! options
18797 parsoid=wt2html,wt2wt
18798 !! wikitext
18799 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18800 !! html/php
18801 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18802 </p>
18803 !! html/parsoid
18804 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18805 !! end
18806
18807 !! test
18808 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18809 !! wikitext
18810 [[meatball:Soft"Security]]
18811 !! html/php
18812 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18813 </p>
18814 !! html/parsoid
18815 <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>
18816 !! end
18817
18818 !! test
18819 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18820 !! wikitext
18821 [[meatball:Foo<Bar]]
18822 [[meatball:Foo>Bar]]
18823 [[meatball:Foo&lt;bar]]
18824 [[meatball:Foo&gt;bar]]
18825 !! html/php
18826 <p>[[meatball:Foo&lt;Bar]]
18827 [[meatball:Foo&gt;Bar]]
18828 [[meatball:Foo&lt;bar]]
18829 [[meatball:Foo&gt;bar]]
18830 </p>
18831 !! html/parsoid
18832 <p>[[meatball:Foo&lt;Bar]]
18833 [[meatball:Foo>Bar]]
18834 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
18835 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
18836 !! end
18837
18838 !! test
18839 Language converter: output gets cut off unexpectedly (T7757)
18840 !! options
18841 language=zh
18842 !! wikitext
18843 this bit is safe: }-
18844
18845 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18846
18847 then we get cut off here: }-
18848
18849 all additional text is vanished
18850 !! html/php
18851 <p>this bit is safe: }-
18852 </p><p>but if we add a conversion instance: xxx
18853 </p><p>then we get cut off here: }-
18854 </p><p>all additional text is vanished
18855 </p>
18856 !! html/parsoid
18857 <p>this bit is safe: }-</p>
18858 <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>
18859 <p>then we get cut off here: }-</p>
18860 <p>all additional text is vanished</p>
18861 !! end
18862
18863 !! test
18864 Language converter glossary rules inside attributes (T119158)
18865 !! options
18866 language=sr variant=sr-el
18867 !! wikitext
18868 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
18869
18870 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
18871 !! html/php
18872 <p>
18873 </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>
18874 </p>
18875 !! html/parsoid
18876 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
18877
18878 <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>
18879 !! end
18880
18881 !! test
18882 Self closed html pairs (T7487)
18883 !! wikitext
18884 <center><font id="bug" />Centered text</center>
18885 <div><font id="bug2" />In div text</div>
18886 !! html+tidy
18887 <center><font id="bug"></font>Centered text</center>
18888 <div><font id="bug2"></font>In div text</div>
18889 !! end
18890
18891 !! test
18892 Punctuation: nbsp before exclamation
18893 !! wikitext
18894 C'est grave !
18895 !! html
18896 <p>C'est grave&#160;!
18897 </p>
18898 !! end
18899
18900 !! test
18901 Punctuation: CSS !important (T13874)
18902 !! wikitext
18903 <div style="width:50% !important">important</div>
18904 !! html
18905 <div style="width:50% !important">important</div>
18906
18907 !!end
18908
18909 !! test
18910 Punctuation: CSS ! important (T13874; with space after)
18911 !! wikitext
18912 <div style="width:50% ! important">important</div>
18913 !! html
18914 <div style="width:50%&#32;! important">important</div>
18915
18916 !!end
18917
18918 !! test
18919 HTML bullet list, closed tags (T7497)
18920 !! wikitext
18921 <ul>
18922 <li>One</li>
18923 <li>Two</li>
18924 </ul>
18925 !! html/php
18926 <ul>
18927 <li>One</li>
18928 <li>Two</li>
18929 </ul>
18930
18931 !! html/parsoid
18932 <ul data-parsoid='{"stx":"html"}'>
18933 <li data-parsoid='{"stx":"html"}'>One</li>
18934 <li data-parsoid='{"stx":"html"}'>Two</li>
18935 </ul>
18936
18937 !! end
18938
18939 !! test
18940 HTML bullet list, unclosed tags (T7497)
18941 !! wikitext
18942 <ul>
18943 <li>One
18944 <li>Two
18945 </ul>
18946 !! html/php+tidy
18947 <ul>
18948 <li>One
18949 </li><li>Two
18950 </li></ul>
18951 !! html/parsoid
18952 <ul data-parsoid='{"stx":"html"}'>
18953 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18954 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18955 </ul>
18956
18957 !! end
18958
18959 !! test
18960 HTML ordered list, closed tags (T7497)
18961 !! wikitext
18962 <ol>
18963 <li>One</li>
18964 <li>Two</li>
18965 </ol>
18966 !! html/php
18967 <ol>
18968 <li>One</li>
18969 <li>Two</li>
18970 </ol>
18971
18972 !! html/parsoid
18973 <ol data-parsoid='{"stx":"html"}'>
18974 <li data-parsoid='{"stx":"html"}'>One</li>
18975 <li data-parsoid='{"stx":"html"}'>Two</li>
18976 </ol>
18977
18978 !! end
18979
18980 !! test
18981 HTML ordered list, unclosed tags (T7497)
18982 !! options
18983 !! wikitext
18984 <ol>
18985 <li>One
18986 <li>Two
18987 </ol>
18988 !! html/php+tidy
18989 <ol>
18990 <li>One
18991 </li><li>Two
18992 </li></ol>
18993 !! html/parsoid
18994 <ol data-parsoid='{"stx":"html"}'>
18995 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18996 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18997 </ol>
18998
18999 !! end
19000
19001 !! test
19002 HTML nested bullet list, closed tags (T7497)
19003 !! wikitext
19004 <ul>
19005 <li>One</li>
19006 <li>Two:
19007 <ul>
19008 <li>Sub-one</li>
19009 <li>Sub-two</li>
19010 </ul>
19011 </li>
19012 </ul>
19013 !! html/php
19014 <ul>
19015 <li>One</li>
19016 <li>Two:
19017 <ul>
19018 <li>Sub-one</li>
19019 <li>Sub-two</li>
19020 </ul>
19021 </li>
19022 </ul>
19023
19024 !! html/parsoid
19025 <ul data-parsoid='{"stx":"html"}'>
19026 <li data-parsoid='{"stx":"html"}'>One</li>
19027 <li data-parsoid='{"stx":"html"}'>Two:
19028 <ul data-parsoid='{"stx":"html"}'>
19029 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
19030 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
19031 </ul>
19032 </li>
19033 </ul>
19034 !! end
19035
19036 !! test
19037 HTML nested bullet list, open tags (T7497)
19038 !! wikitext
19039 <ul>
19040 <li>One
19041 <li>Two:
19042 <ul>
19043 <li>Sub-one
19044 <li>Sub-two
19045 </ul>
19046 </ul>
19047 !! html+tidy
19048 <ul>
19049 <li>One
19050 </li><li>Two:
19051 <ul>
19052 <li>Sub-one
19053 </li><li>Sub-two
19054 </li></ul>
19055 </li></ul>
19056 !! end
19057
19058 !! test
19059 HTML nested ordered list, closed tags (T7497)
19060 !! wikitext
19061 <ol>
19062 <li>One</li>
19063 <li>Two:
19064 <ol>
19065 <li>Sub-one</li>
19066 <li>Sub-two</li>
19067 </ol>
19068 </li>
19069 </ol>
19070 !! html
19071 <ol>
19072 <li>One</li>
19073 <li>Two:
19074 <ol>
19075 <li>Sub-one</li>
19076 <li>Sub-two</li>
19077 </ol>
19078 </li>
19079 </ol>
19080
19081 !! end
19082
19083 !! test
19084 HTML nested ordered list, open tags (T7497)
19085 !! wikitext
19086 <ol>
19087 <li>One
19088 <li>Two:
19089 <ol>
19090 <li>Sub-one
19091 <li>Sub-two
19092 </ol>
19093 </ol>
19094 !! html/php
19095 <ol>
19096 <li>One
19097 <li>Two:
19098 <ol>
19099 <li>Sub-one
19100 <li>Sub-two
19101 </ol>
19102 </ol>
19103
19104 !! html/parsoid
19105 <ol>
19106 <li>One
19107 </li>
19108 <li>Two:
19109 <ol>
19110 <li>Sub-one
19111 </li>
19112 <li>Sub-two
19113 </li>
19114 </ol>
19115 </li>
19116 </ol>
19117
19118 !! end
19119
19120 !! test
19121 HTML ordered list item with parameters oddity
19122 !! wikitext
19123 <ol><li id="fragment">One</li>
19124 </ol>
19125 !! html
19126 <ol><li id="fragment">One</li>
19127 </ol>
19128
19129 !! end
19130
19131 # parsoid doesn't explicitly mark autonumbered links, see T55505
19132 !!test
19133 T7918: autonumbering
19134 !! wikitext
19135 [http://first/] [http://second] [ftp://ftp]
19136
19137 ftp://inlineftp
19138
19139 [mailto:enclosed@mail.tld With target]
19140
19141 [mailto:enclosed@mail.tld]
19142
19143 mailto:inline@mail.tld
19144 !! html/php
19145 <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>
19146 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
19147 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
19148 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
19149 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
19150 </p>
19151 !! html/parsoid
19152 <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>
19153 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
19154 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
19155 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
19156 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
19157 !! end
19158
19159
19160 #
19161 # Security and HTML correctness
19162 # From Nick Jenkins' fuzz testing
19163 #
19164
19165 !! test
19166 Fuzz testing: Parser13
19167 !! wikitext
19168 {|
19169 | http://a|
19170 !! html
19171 <table>
19172 <tr>
19173 <td>
19174 </td>
19175 </tr>
19176 </table>
19177
19178 !! end
19179
19180 # Note that Parsoid output differs from the PHP parser here: the PHP
19181 # parser breaks the URL for the magic word, while in Parsoid the URL
19182 # production takes precedence.
19183 !! test
19184 Fuzz testing: Parser14
19185 !! wikitext
19186 ==onmouseover===
19187 http://__TOC__
19188 !! html/php
19189 <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>
19190 http://<div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
19191 <ul>
19192 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19193 </ul>
19194 </div>
19195
19196
19197 !! html/php+tidy
19198 <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>
19199 http://</p><div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
19200 <ul>
19201 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19202 </ul>
19203 </div>
19204 !! html/parsoid
19205 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
19206 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
19207 !! end
19208
19209 !! test
19210 Fuzz testing: Parser14-table
19211 !! options
19212 parsoid=wt2html,html2html
19213 !! wikitext
19214 ==a==
19215 {| STYLE=__TOC__
19216 !! html
19217 <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>
19218 <table style="&#95;_TOC&#95;_">
19219 <tr><td></td></tr>
19220 </table>
19221
19222 !! html+tidy
19223 <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>
19224 <table style="__TOC__">
19225 <tr>
19226 <td></td>
19227 </tr>
19228 </table>
19229 !! html/parsoid
19230 <h2 id="a">a</h2>
19231 <table style="__TOC__"></table>
19232 !! end
19233
19234 # Known to produce bogus xml (extra </td>)
19235 # Don't add the html/php section since it generates broken HTML
19236 !! test
19237 Fuzz testing: Parser16
19238 !! wikitext
19239 {|
19240 !https://||||||
19241 !! html+tidy
19242 <table>
19243 <tbody><tr>
19244 <th>https://</th>
19245 <th></th>
19246 <th></th>
19247 <th>
19248
19249 </th></tr>
19250 </tbody></table>
19251 !! end
19252
19253 !! test
19254 Fuzz testing: Parser21
19255 !! wikitext
19256 {|
19257 !irc://{{ftp://a" onmouseover="alert('hello world');"
19258 |
19259 !! html
19260 <table>
19261 <tr>
19262 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
19263 </th>
19264 <td>
19265 </td>
19266 </tr>
19267 </table>
19268
19269 !! end
19270
19271 !! test
19272 Fuzz testing: Parser22
19273 !! wikitext
19274 http://===r:::https://b
19275
19276 {|
19277 !! html
19278 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
19279 </p>
19280 <table>
19281 <tr><td></td></tr>
19282 </table>
19283
19284 !! end
19285
19286 ## Remex doesn't account for fostered content.
19287 ## Known to produce bad XML for now
19288 !! test
19289 Fuzz testing: Parser24
19290 !! options
19291 parsoid=wt2html
19292 !! wikitext
19293 {|
19294 {{{|
19295 <u CLASS=
19296 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19297 <br style="onmouseover='alert(document.cookie);' " />
19298
19299 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19300 |
19301 !! html/php
19302 <table>
19303 {{{|
19304 <u class="&#124;">}}}} &gt;
19305 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19306
19307 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19308 <tr>
19309 <td></u>
19310 </td>
19311 </tr>
19312 </table>
19313
19314 !! html/php+tidy
19315
19316 {{{|
19317 <u class="&#124;">}}}} &gt;
19318 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19319
19320 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19321 </u><table><tbody><tr>
19322 <td>
19323 </td>
19324 </tr>
19325 </tbody></table><p><u class="&#124;">
19326 </u></p>
19327 !! html/parsoid
19328 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
19329 {{{|
19330 <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>"}'/>}}}} >
19331 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/>
19332
19333 MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p>
19334 <table data-parsoid='{"autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedStart":true}'><td></td></tr></tbody></table>
19335 !! end
19336
19337 # Note: the current result listed for this is not what the original one was,
19338 # but the original bug was JavaScript injection, which is fixed in any case.
19339 # It's not clear that the original result listed was any more correct than the
19340 # current one. Original result:
19341 # <p>{{{|
19342 # </p>
19343 # <li class="&#124;&#124;">
19344 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19345 !!test
19346 Fuzz testing: Parser25 (T8055)
19347 !! wikitext
19348 {{{
19349 |
19350 <LI CLASS=||
19351 >
19352 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19353 !! html/php
19354 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19355 </p>
19356 !! html/parsoid
19357 <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"]}'>
19358 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19359 !! end
19360
19361 !!test
19362 Fuzz testing: URL adjacent extension (with space, clean)
19363 !! wikitext
19364 http://example.com <nowiki>junk</nowiki>
19365 !! html/php
19366 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19367 </p>
19368 !! html/parsoid
19369 <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>
19370 !! end
19371
19372 !!test
19373 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19374 !! wikitext
19375 http://example.com<nowiki>junk</nowiki>
19376 !! html/php
19377 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19378 </p>
19379 !! html/parsoid
19380 <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>
19381 !! end
19382
19383 !! test
19384 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19385 !! wikitext
19386 http://example.com<pre>junk</pre>
19387 !! html/php
19388 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19389
19390 !! html/php+tidy
19391 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19392 !! html/parsoid
19393 <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>
19394 !! end
19395
19396 !! test
19397 Fuzz testing: image with bogus manual thumbnail
19398 !! wikitext
19399 [[Image:foobar.jpg|thumbnail= ]]
19400 !! html/php
19401 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19402
19403 !! html/parsoid
19404 <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>
19405 !! end
19406
19407 # Parsoid will emit the newline literally in wt2wt; see next test case.
19408 !! test
19409 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19410 !! options
19411 parsoid=wt2html
19412 !! wikitext
19413 <pre dir="&#10;"></pre>
19414 !! html/php
19415 <pre dir="&#10;"></pre>
19416
19417 !! html/parsoid
19418 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19419 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19420 !! end
19421
19422 !! test
19423 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19424 !! options
19425 parsoid=html2wt
19426 !! html/parsoid
19427 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19428 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19429 !! wikitext
19430 <pre dir="
19431 "></pre>
19432 !! html/php
19433 <pre dir=""></pre>
19434
19435 !! end
19436
19437 !! test
19438 Templates in extension attributes are not expanded
19439 !! wikitext
19440 <pre dir="{{echo|ltr}}"></pre>
19441 !! html/php
19442 <pre dir="{{echo|ltr}}"></pre>
19443
19444 !! html/parsoid
19445 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19446 !! end
19447
19448 !! test
19449 Parsing optional HTML elements (T8171)
19450 !! options
19451 !! wikitext
19452 <table>
19453 <tr>
19454 <td> Some tabular data</td>
19455 <td> More tabular data ...
19456 <td> And yet som tabular data</td>
19457 </tr>
19458 </table>
19459 !! html
19460 <table>
19461 <tr>
19462 <td> Some tabular data</td>
19463 <td> More tabular data ...
19464 </td><td> And yet som tabular data</td>
19465 </tr>
19466 </table>
19467
19468 !! end
19469
19470 !! test
19471 Correct handling of <td>, <tr> (T8171)
19472 !! options
19473 !! wikitext
19474 <table>
19475 <tr>
19476 <td> Some tabular data</td>
19477 <td> More tabular data ...</td>
19478 <td> And yet som tabular data</td>
19479 </tr>
19480 </table>
19481 !! html
19482 <table>
19483 <tr>
19484 <td> Some tabular data</td>
19485 <td> More tabular data ...</td>
19486 <td> And yet som tabular data</td>
19487 </tr>
19488 </table>
19489
19490 !! end
19491
19492
19493 !! test
19494 Parsing crashing regression (fr:JavaScript)
19495 !! wikitext
19496 </body></x>
19497 !! html
19498 <p>&lt;/body&gt;&lt;/x&gt;
19499 </p>
19500 !! end
19501
19502 !! test
19503 Inline wiki vs wiki block nesting
19504 !! wikitext
19505 '''Bold paragraph
19506
19507 New wiki paragraph
19508 !! html
19509 <p><b>Bold paragraph</b>
19510 </p><p>New wiki paragraph
19511 </p>
19512 !! end
19513
19514 # FIXME: The current php output is documented
19515 # and desired output is the parsoid target.
19516 !! test
19517 Inline HTML vs wiki block nesting
19518 !! wikitext
19519 <b>Bold paragraph
19520
19521 New wiki paragraph
19522 !! html/php
19523 <p><b>Bold paragraph
19524 </p><p>New wiki paragraph</b>
19525 </p>
19526 !! html/php+tidy
19527 <p><b>Bold paragraph
19528 </b></p><p><b>New wiki paragraph
19529 </b></p>
19530 !! html/parsoid
19531 <p><b>Bold paragraph</b>
19532 </p><p>New wiki paragraph
19533 </p>
19534 !! end
19535
19536 # Original result was this:
19537 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19538 # </p>
19539 # While that might be marginally more intuitive, maybe, the six-apostrophe
19540 # construct is clearly pathological and the result stated here (which is what
19541 # the parser actually does) is about as reasonable as anything.
19542 !!test
19543 Mixing markup for italics and bold
19544 !! options
19545 !! wikitext
19546 '''bold''''''bold''bolditalics'''''
19547 !! html
19548 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19549 </p>
19550 !! end
19551
19552
19553 !! article
19554 Xyzzyx
19555 !! text
19556 Article for special page transclusion test
19557 !! endarticle
19558
19559 !! test
19560 Special page transclusion
19561 !! options
19562 !! wikitext
19563 {{Special:Prefixindex/Xyzzyx}}
19564 !! html
19565 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19566 </ul>
19567
19568 !! end
19569
19570 !! test
19571 Special page transclusion twice (T7021)
19572 !! options
19573 !! wikitext
19574 {{Special:Prefixindex/Xyzzyx}}
19575 {{Special:Prefixindex/Xyzzyx}}
19576 !! html
19577 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19578 </ul>
19579 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19580 </ul>
19581
19582 !! end
19583
19584 !! test
19585 Transclusion of default MediaWiki message
19586 !! wikitext
19587 {{MediaWiki:Mainpage}}
19588 !! html
19589 <p>Main Page
19590 </p>
19591 !! end
19592
19593 !! test
19594 Transclusion of nonexistent MediaWiki message
19595 !! wikitext
19596 {{MediaWiki:Mainpagexxx}}
19597 !! html
19598 <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>
19599 </p>
19600 !! end
19601
19602 !! test
19603 Transclusion of MediaWiki message with underscore
19604 !! wikitext
19605 {{MediaWiki:history_short}}
19606 !! html
19607 <p>History
19608 </p>
19609 !! end
19610
19611 !! test
19612 Transclusion of MediaWiki message with space
19613 !! wikitext
19614 {{MediaWiki:history short}}
19615 !! html
19616 <p>History
19617 </p>
19618 !! end
19619
19620 !! test
19621 Invalid header with following text
19622 !! wikitext
19623 = x = y
19624 !! html
19625 <p>= x = y
19626 </p>
19627 !! end
19628
19629
19630 !! test
19631 Section extraction test (section 0)
19632 !! options
19633 section=0
19634 !! wikitext
19635 start
19636 ==a==
19637 ===aa===
19638 ====aaa====
19639 ==b==
19640 ===ba===
19641 ===bb===
19642 ====bba====
19643 ===bc===
19644 ==c==
19645 ===ca===
19646 !! html/php
19647 start
19648 !! end
19649
19650 !! test
19651 Section extraction test (section 1)
19652 !! options
19653 section=1
19654 !! wikitext
19655 start
19656 ==a==
19657 ===aa===
19658 ====aaa====
19659 ==b==
19660 ===ba===
19661 ===bb===
19662 ====bba====
19663 ===bc===
19664 ==c==
19665 ===ca===
19666 !! html/php
19667 ==a==
19668 ===aa===
19669 ====aaa====
19670 !! end
19671
19672 !! test
19673 Section extraction test (section 2)
19674 !! options
19675 section=2
19676 !! wikitext
19677 start
19678 ==a==
19679 ===aa===
19680 ====aaa====
19681 ==b==
19682 ===ba===
19683 ===bb===
19684 ====bba====
19685 ===bc===
19686 ==c==
19687 ===ca===
19688 !! html/php
19689 ===aa===
19690 ====aaa====
19691 !! end
19692
19693 !! test
19694 Section extraction test (section 3)
19695 !! options
19696 section=3
19697 !! wikitext
19698 start
19699 ==a==
19700 ===aa===
19701 ====aaa====
19702 ==b==
19703 ===ba===
19704 ===bb===
19705 ====bba====
19706 ===bc===
19707 ==c==
19708 ===ca===
19709 !! html/php
19710 ====aaa====
19711 !! end
19712
19713 !! test
19714 Section extraction test (section 4)
19715 !! options
19716 section=4
19717 !! wikitext
19718 start
19719 ==a==
19720 ===aa===
19721 ====aaa====
19722 ==b==
19723 ===ba===
19724 ===bb===
19725 ====bba====
19726 ===bc===
19727 ==c==
19728 ===ca===
19729 !! html/php
19730 ==b==
19731 ===ba===
19732 ===bb===
19733 ====bba====
19734 ===bc===
19735 !! end
19736
19737 !! test
19738 Section extraction test (section 5)
19739 !! options
19740 section=5
19741 !! wikitext
19742 start
19743 ==a==
19744 ===aa===
19745 ====aaa====
19746 ==b==
19747 ===ba===
19748 ===bb===
19749 ====bba====
19750 ===bc===
19751 ==c==
19752 ===ca===
19753 !! html/php
19754 ===ba===
19755 !! end
19756
19757 !! test
19758 Section extraction test (section 6)
19759 !! options
19760 section=6
19761 !! wikitext
19762 start
19763 ==a==
19764 ===aa===
19765 ====aaa====
19766 ==b==
19767 ===ba===
19768 ===bb===
19769 ====bba====
19770 ===bc===
19771 ==c==
19772 ===ca===
19773 !! html/php
19774 ===bb===
19775 ====bba====
19776 !! end
19777
19778 !! test
19779 Section extraction test (section 7)
19780 !! options
19781 section=7
19782 !! wikitext
19783 start
19784 ==a==
19785 ===aa===
19786 ====aaa====
19787 ==b==
19788 ===ba===
19789 ===bb===
19790 ====bba====
19791 ===bc===
19792 ==c==
19793 ===ca===
19794 !! html/php
19795 ====bba====
19796 !! end
19797
19798 !! test
19799 Section extraction test (section 8)
19800 !! options
19801 section=8
19802 !! wikitext
19803 start
19804 ==a==
19805 ===aa===
19806 ====aaa====
19807 ==b==
19808 ===ba===
19809 ===bb===
19810 ====bba====
19811 ===bc===
19812 ==c==
19813 ===ca===
19814 !! html/php
19815 ===bc===
19816 !! end
19817
19818 !! test
19819 Section extraction test (section 9)
19820 !! options
19821 section=9
19822 !! wikitext
19823 start
19824 ==a==
19825 ===aa===
19826 ====aaa====
19827 ==b==
19828 ===ba===
19829 ===bb===
19830 ====bba====
19831 ===bc===
19832 ==c==
19833 ===ca===
19834 !! html/php
19835 ==c==
19836 ===ca===
19837 !! end
19838
19839 !! test
19840 Section extraction test (section 10)
19841 !! options
19842 section=10
19843 !! wikitext
19844 start
19845 ==a==
19846 ===aa===
19847 ====aaa====
19848 ==b==
19849 ===ba===
19850 ===bb===
19851 ====bba====
19852 ===bc===
19853 ==c==
19854 ===ca===
19855 !! html/php
19856 ===ca===
19857 !! end
19858
19859 !! test
19860 Section extraction test (nonexistent section 11)
19861 !! options
19862 section=11
19863 !! wikitext
19864 start
19865 ==a==
19866 ===aa===
19867 ====aaa====
19868 ==b==
19869 ===ba===
19870 ===bb===
19871 ====bba====
19872 ===bc===
19873 ==c==
19874 ===ca===
19875 !! html/php
19876 !! end
19877
19878 !! test
19879 Section extraction test with bogus heading (section 1)
19880 !! options
19881 section=1
19882 !! wikitext
19883 ==a==
19884 ==bogus== not a legal section
19885 ==b==
19886 !! html/php
19887 ==a==
19888 ==bogus== not a legal section
19889 !! end
19890
19891 !! test
19892 Section extraction test with bogus heading (section 2)
19893 !! options
19894 section=2
19895 !! wikitext
19896 ==a==
19897 ==bogus== not a legal section
19898 ==b==
19899 !! html/php
19900 ==b==
19901 !! end
19902
19903 !! test
19904 Section extraction test with comment after heading (section 1)
19905 !! options
19906 section=1
19907 !! wikitext
19908 ==a==
19909 ==b== <!-- -->
19910 ==c==
19911 !! html/php
19912 ==a==
19913 !! end
19914
19915 !! test
19916 Section extraction test with comment after heading (section 2)
19917 !! options
19918 section=2
19919 !! wikitext
19920 ==a==
19921 ==b== <!-- -->
19922 ==c==
19923 !! html/php
19924 ==b== <!-- -->
19925 !! end
19926
19927 !! test
19928 Section extraction test with bogus <nowiki> heading (section 1)
19929 !! options
19930 section=1
19931 !! wikitext
19932 ==a==
19933 ==bogus== <nowiki>not a legal section</nowiki>
19934 ==b==
19935 !! html/php
19936 ==a==
19937 ==bogus== <nowiki>not a legal section</nowiki>
19938 !! end
19939
19940 !! test
19941 Section extraction test with bogus <nowiki> heading (section 2)
19942 !! options
19943 section=2
19944 !! wikitext
19945 ==a==
19946 ==bogus== <nowiki>not a legal section</nowiki>
19947 ==b==
19948 !! html/php
19949 ==b==
19950 !! end
19951
19952 # Formerly testing for T4587, now resolved by the use of unmarked sections
19953 # instead of respecting commented sections
19954 !! test
19955 Section extraction prefixed by comment (section 1)
19956 !! options
19957 section=1
19958 !! wikitext
19959 <!-- -->==sec1==
19960 ==sec2==
19961 !! html/php
19962 ==sec2==
19963 !!end
19964
19965 !! test
19966 Section extraction prefixed by comment (section 2)
19967 !! options
19968 section=2
19969 !! wikitext
19970 <!-- -->==sec1==
19971 ==sec2==
19972 !! html/php
19973
19974 !!end
19975
19976 # Formerly testing for T4607, now resolved by the use of unmarked sections
19977 # instead of respecting HTML-style headings
19978 !! test
19979 Section extraction, mixed wiki and html (section 1)
19980 !! options
19981 section=1
19982 !! wikitext
19983 <h2>unmarked</h2>
19984 unmarked
19985 ==1==
19986 one
19987 ==2==
19988 two
19989 !! html/php
19990 ==1==
19991 one
19992 !! end
19993
19994 !! test
19995 Section extraction, mixed wiki and html (section 2)
19996 !! options
19997 section=2
19998 !! wikitext
19999 <h2>unmarked</h2>
20000 unmarked
20001 ==1==
20002 one
20003 ==2==
20004 two
20005 !! html/php
20006 ==2==
20007 two
20008 !! end
20009
20010
20011 # Formerly testing for T5342
20012 !! test
20013 Section extraction, heading surrounded by <noinclude>
20014 !! options
20015 section=1
20016 !! wikitext
20017 <noinclude>==unmarked==</noinclude>
20018 ==marked==
20019 !! html/php
20020 ==marked==
20021 !!end
20022
20023 # Test behavior of T21910
20024 !! test
20025 Sectiion with all-equals
20026 !! options
20027 section=2
20028 !! wikitext
20029 ===
20030 The line above must have a trailing space
20031 === <!--
20032 --> <!-- -->
20033 But just in case it doesn't...
20034 !! html/php
20035 === <!--
20036 --> <!-- -->
20037 But just in case it doesn't...
20038 !! end
20039
20040 !! test
20041 Section replacement test (section 0)
20042 !! options
20043 replace=0,"xxx"
20044 !! wikitext
20045 start
20046 ==a==
20047 ===aa===
20048 ====aaa====
20049 ==b==
20050 ===ba===
20051 ===bb===
20052 ====bba====
20053 ===bc===
20054 ==c==
20055 ===ca===
20056 !! html/php
20057 xxx
20058
20059 ==a==
20060 ===aa===
20061 ====aaa====
20062 ==b==
20063 ===ba===
20064 ===bb===
20065 ====bba====
20066 ===bc===
20067 ==c==
20068 ===ca===
20069 !! end
20070
20071 !! test
20072 Section replacement test (section 1)
20073 !! options
20074 replace=1,"xxx"
20075 !! wikitext
20076 start
20077 ==a==
20078 ===aa===
20079 ====aaa====
20080 ==b==
20081 ===ba===
20082 ===bb===
20083 ====bba====
20084 ===bc===
20085 ==c==
20086 ===ca===
20087 !! html/php
20088 start
20089 xxx
20090
20091 ==b==
20092 ===ba===
20093 ===bb===
20094 ====bba====
20095 ===bc===
20096 ==c==
20097 ===ca===
20098 !! end
20099
20100 !! test
20101 Section replacement test (section 2)
20102 !! options
20103 replace=2,"xxx"
20104 !! wikitext
20105 start
20106 ==a==
20107 ===aa===
20108 ====aaa====
20109 ==b==
20110 ===ba===
20111 ===bb===
20112 ====bba====
20113 ===bc===
20114 ==c==
20115 ===ca===
20116 !! html/php
20117 start
20118 ==a==
20119 xxx
20120
20121 ==b==
20122 ===ba===
20123 ===bb===
20124 ====bba====
20125 ===bc===
20126 ==c==
20127 ===ca===
20128 !! end
20129
20130 !! test
20131 Section replacement test (section 3)
20132 !! options
20133 replace=3,"xxx"
20134 !! wikitext
20135 start
20136 ==a==
20137 ===aa===
20138 ====aaa====
20139 ==b==
20140 ===ba===
20141 ===bb===
20142 ====bba====
20143 ===bc===
20144 ==c==
20145 ===ca===
20146 !! html/php
20147 start
20148 ==a==
20149 ===aa===
20150 xxx
20151
20152 ==b==
20153 ===ba===
20154 ===bb===
20155 ====bba====
20156 ===bc===
20157 ==c==
20158 ===ca===
20159 !! end
20160
20161 !! test
20162 Section replacement test (section 4)
20163 !! options
20164 replace=4,"xxx"
20165 !! wikitext
20166 start
20167 ==a==
20168 ===aa===
20169 ====aaa====
20170 ==b==
20171 ===ba===
20172 ===bb===
20173 ====bba====
20174 ===bc===
20175 ==c==
20176 ===ca===
20177 !! html/php
20178 start
20179 ==a==
20180 ===aa===
20181 ====aaa====
20182 xxx
20183
20184 ==c==
20185 ===ca===
20186 !! end
20187
20188 !! test
20189 Section replacement test (section 5)
20190 !! options
20191 replace=5,"xxx"
20192 !! wikitext
20193 start
20194 ==a==
20195 ===aa===
20196 ====aaa====
20197 ==b==
20198 ===ba===
20199 ===bb===
20200 ====bba====
20201 ===bc===
20202 ==c==
20203 ===ca===
20204 !! html/php
20205 start
20206 ==a==
20207 ===aa===
20208 ====aaa====
20209 ==b==
20210 xxx
20211
20212 ===bb===
20213 ====bba====
20214 ===bc===
20215 ==c==
20216 ===ca===
20217 !! end
20218
20219 !! test
20220 Section replacement test (section 6)
20221 !! options
20222 replace=6,"xxx"
20223 !! wikitext
20224 start
20225 ==a==
20226 ===aa===
20227 ====aaa====
20228 ==b==
20229 ===ba===
20230 ===bb===
20231 ====bba====
20232 ===bc===
20233 ==c==
20234 ===ca===
20235 !! html/php
20236 start
20237 ==a==
20238 ===aa===
20239 ====aaa====
20240 ==b==
20241 ===ba===
20242 xxx
20243
20244 ===bc===
20245 ==c==
20246 ===ca===
20247 !! end
20248
20249 !! test
20250 Section replacement test (section 7)
20251 !! options
20252 replace=7,"xxx"
20253 !! wikitext
20254 start
20255 ==a==
20256 ===aa===
20257 ====aaa====
20258 ==b==
20259 ===ba===
20260 ===bb===
20261 ====bba====
20262 ===bc===
20263 ==c==
20264 ===ca===
20265 !! html/php
20266 start
20267 ==a==
20268 ===aa===
20269 ====aaa====
20270 ==b==
20271 ===ba===
20272 ===bb===
20273 xxx
20274
20275 ===bc===
20276 ==c==
20277 ===ca===
20278 !! end
20279
20280 !! test
20281 Section replacement test (section 8)
20282 !! options
20283 replace=8,"xxx"
20284 !! wikitext
20285 start
20286 ==a==
20287 ===aa===
20288 ====aaa====
20289 ==b==
20290 ===ba===
20291 ===bb===
20292 ====bba====
20293 ===bc===
20294 ==c==
20295 ===ca===
20296 !! html/php
20297 start
20298 ==a==
20299 ===aa===
20300 ====aaa====
20301 ==b==
20302 ===ba===
20303 ===bb===
20304 ====bba====
20305 xxx
20306
20307 ==c==
20308 ===ca===
20309 !!end
20310
20311 !! test
20312 Section replacement test (section 9)
20313 !! options
20314 replace=9,"xxx"
20315 !! wikitext
20316 start
20317 ==a==
20318 ===aa===
20319 ====aaa====
20320 ==b==
20321 ===ba===
20322 ===bb===
20323 ====bba====
20324 ===bc===
20325 ==c==
20326 ===ca===
20327 !! html/php
20328 start
20329 ==a==
20330 ===aa===
20331 ====aaa====
20332 ==b==
20333 ===ba===
20334 ===bb===
20335 ====bba====
20336 ===bc===
20337 xxx
20338 !! end
20339
20340 !! test
20341 Section replacement test (section 10)
20342 !! options
20343 replace=10,"xxx"
20344 !! wikitext
20345 start
20346 ==a==
20347 ===aa===
20348 ====aaa====
20349 ==b==
20350 ===ba===
20351 ===bb===
20352 ====bba====
20353 ===bc===
20354 ==c==
20355 ===ca===
20356 !! html/php
20357 start
20358 ==a==
20359 ===aa===
20360 ====aaa====
20361 ==b==
20362 ===ba===
20363 ===bb===
20364 ====bba====
20365 ===bc===
20366 ==c==
20367 xxx
20368 !! end
20369
20370 !! test
20371 Section replacement test with initial whitespace (T15728)
20372 !! options
20373 replace=2,"xxx"
20374 !! wikitext
20375 Preformatted initial line
20376 ==a==
20377 ===a===
20378 !! html/php
20379 Preformatted initial line
20380 ==a==
20381 xxx
20382 !! end
20383
20384
20385 !! test
20386 Section extraction, heading followed by pre with 20 spaces (T8398)
20387 !! options
20388 section=1
20389 !! wikitext
20390 ==a==
20391 a
20392 !! html/php
20393 ==a==
20394 a
20395 !! end
20396
20397 !! test
20398 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20399 !! options
20400 section=1
20401 !! wikitext
20402 ==a==
20403 a
20404 !! html/php
20405 ==a==
20406 a
20407 !! end
20408
20409
20410 !! test
20411 Section extraction, <pre> around bogus header (T12309)
20412 !! options
20413 section=2
20414 !! wikitext
20415 == Section One ==
20416 <pre>
20417 =======
20418 </pre>
20419
20420 == Section Two ==
20421 stuff
20422 !! html/php
20423 == Section Two ==
20424 stuff
20425 !! end
20426
20427 !! test
20428 Section replacement, <pre> around bogus header (T12309)
20429 !! options
20430 replace=2,"xxx"
20431 !! wikitext
20432 == Section One ==
20433 <pre>
20434 =======
20435 </pre>
20436
20437 == Section Two ==
20438 stuff
20439 !! html/php
20440 == Section One ==
20441 <pre>
20442 =======
20443 </pre>
20444
20445 xxx
20446 !! end
20447
20448 !! test
20449 Handling of &#x0A; in URLs
20450 !! wikitext
20451 *irc://&#x0A;a
20452 !! html/php
20453 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20454
20455 !! html/parsoid
20456 <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>
20457 !! end
20458
20459 !! test
20460 Handling of %0A in URLs
20461 !! wikitext
20462 *irc://%0Aa
20463 !! html/php
20464 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20465
20466 !! html/parsoid
20467 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20468 !! end
20469
20470 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20471 !! test
20472 5 quotes, code coverage +1 line
20473 !! options
20474 parsoid=wt2html
20475 !! wikitext
20476 '''''
20477 !! html/php
20478 !! html/parsoid
20479 <p><b><i></i></b></p>
20480 !! end
20481
20482 # same html as previous, but wikitext adjusted to match parsoid html2wt
20483 # note that wt2html and html2html will put the <i> before the <b>
20484 !! test
20485 5 quotes, code coverage +1 line w/ nowiki (1)
20486 !! options
20487 parsoid=wt2wt,html2wt
20488 !! wikitext
20489 '''''<nowiki/>'''''
20490 !! html/php
20491 <p><i></i>
20492 </p>
20493 !! html/parsoid
20494 <p><b><i></i></b></p>
20495 !! end
20496
20497 # same as previous, just swapping the <i> and <b>
20498 !! test
20499 5 quotes, code coverage +1 line w/ nowiki (2)
20500 !! wikitext
20501 '''''<nowiki/>'''''
20502 !! html/php
20503 <p><i></i>
20504 </p>
20505 !! html/parsoid
20506 <p><i><b></b></i></p>
20507 !! end
20508
20509 !! test
20510 Special:Search page linking.
20511 !! wikitext
20512 {{Special:search}}
20513 !! html
20514 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20515 </p>
20516 !! end
20517
20518 !! test
20519 {{!}} is a magic word
20520 !! wikitext
20521 {{!}} is a magic word there and {{!}} is still a magic word here
20522 | is not a magic word here but {{!}} is still a magic word here
20523 !! html/php
20524 <p>| is a magic word there and | is still a magic word here
20525 | is not a magic word here but | is still a magic word here
20526 </p>
20527 !! html/parsoid
20528 <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
20529 | 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>
20530 !! end
20531
20532 !! test
20533 Say the magic word
20534 !! options
20535 title=[[Parser test]]
20536 !! wikitext
20537 *{{PAGENAME}}
20538 *{{PAGENAMEE}}
20539 *{{FULLPAGENAME}}
20540 *{{FULLPAGENAMEE}}
20541 *{{BASEPAGENAME}}
20542 *{{BASEPAGENAMEE}}
20543 *{{SUBPAGENAME}}
20544 *{{SUBPAGENAMEE}}
20545 *{{ROOTPAGENAME}}
20546 *{{ROOTPAGENAMEE}}
20547 *{{TALKPAGENAME}}
20548 *{{TALKPAGENAMEE}}
20549 *{{SUBJECTPAGENAME}}
20550 *{{SUBJECTPAGENAMEE}}
20551 *{{NAMESPACEE}}
20552 *{{NAMESPACE}}
20553 *{{NAMESPACENUMBER}}
20554 *{{TALKSPACE}}
20555 *{{TALKSPACEE}}
20556 *{{SUBJECTSPACE}}
20557 *{{SUBJECTSPACEE}}
20558 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20559 !! html
20560 <ul><li>Parser test</li>
20561 <li>Parser_test</li>
20562 <li>Parser test</li>
20563 <li>Parser_test</li>
20564 <li>Parser test</li>
20565 <li>Parser_test</li>
20566 <li>Parser test</li>
20567 <li>Parser_test</li>
20568 <li>Parser test</li>
20569 <li>Parser_test</li>
20570 <li>Talk:Parser test</li>
20571 <li>Talk:Parser_test</li>
20572 <li>Parser test</li>
20573 <li>Parser_test</li>
20574 <li></li>
20575 <li></li>
20576 <li>0</li>
20577 <li>Talk</li>
20578 <li>Talk</li>
20579 <li></li>
20580 <li></li>
20581 <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>
20582
20583 !! end
20584 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20585
20586 !! test
20587 Gallery with valid attributes
20588 !! wikitext
20589 <gallery type="123" summary="345">
20590 File:File:Foobar.jpg
20591 </gallery>
20592 !! html/php
20593 <ul class="gallery mw-gallery-traditional" type="123">
20594 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20595 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20596 <div class="gallerytext">
20597 </div>
20598 </div></li>
20599 </ul>
20600
20601 !! html/parsoid
20602 <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"}}'>
20603 <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>
20604 </ul>
20605 !! end
20606
20607 ## Parsoid thinks the "centre" here is a property, not a caption.
20608 !! test
20609 Gallery
20610 !! options
20611 parsoid={
20612 "modes": ["wt2html"],
20613 "nativeGallery": true
20614 }
20615 !! wikitext
20616 <gallery>
20617 image1.png |
20618 image2.gif|||||
20619
20620 image3|
20621 image4 |300px| centre
20622 image5.svg| http://///////
20623 [[x|xx]]]]
20624 * image6
20625 </gallery>
20626 !! html/php
20627 <ul class="gallery mw-gallery-traditional">
20628 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20629 <div class="thumb" style="height: 150px;">Image1.png</div>
20630 <div class="gallerytext">
20631 </div>
20632 </div></li>
20633 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20634 <div class="thumb" style="height: 150px;">Image2.gif</div>
20635 <div class="gallerytext">
20636 </div>
20637 </div></li>
20638 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20639 <div class="thumb" style="height: 150px;">Image3</div>
20640 <div class="gallerytext">
20641 </div>
20642 </div></li>
20643 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20644 <div class="thumb" style="height: 150px;">Image4</div>
20645 <div class="gallerytext">
20646 <pre>centre
20647 </pre>
20648 </div>
20649 </div></li>
20650 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20651 <div class="thumb" style="height: 150px;">Image5.svg</div>
20652 <div class="gallerytext">
20653 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20654 </p>
20655 </div>
20656 </div></li>
20657 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20658 <div class="thumb" style="height: 150px;">* image6</div>
20659 <div class="gallerytext">
20660 </div>
20661 </div></li>
20662 </ul>
20663
20664 !! html/parsoid
20665 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20666 <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>
20667 <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>
20668 <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>
20669 <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>
20670 <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>
20671 <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>
20672 </ul>
20673 !! end
20674
20675 !! test
20676 Gallery (with options, html)
20677 !! options
20678 parsoid={
20679 "modes": ["wt2html", "html2html"],
20680 "nativeGallery": true
20681 }
20682 !! wikitext
20683 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20684 File:Nonexistent.jpg|caption
20685 File:Nonexistent.jpg
20686 image:foobar.jpg|some '''caption''' [[Main Page]]
20687 image:foobar.jpg
20688 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20689 </gallery>
20690 !! html/php
20691 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20692 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20693 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20694 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20695 <div class="gallerytext">
20696 <p>caption
20697 </p>
20698 </div>
20699 </div></li>
20700 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20701 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20702 <div class="gallerytext">
20703 </div>
20704 </div></li>
20705 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20706 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
20707 <div class="gallerytext">
20708 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20709 </p>
20710 </div>
20711 </div></li>
20712 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20713 <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>
20714 <div class="gallerytext">
20715 </div>
20716 </div></li>
20717 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20718 <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>
20719 <div class="gallerytext">
20720 <p>blabla.
20721 </p>
20722 </div>
20723 </div></li>
20724 </ul>
20725
20726 !! html/parsoid
20727 <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":{}}'>
20728 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20729 <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>
20730 <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>
20731 <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>
20732 <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>
20733 <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>
20734 </ul>
20735 !! end
20736
20737 !! test
20738 Gallery (with options, extsrc)
20739 !! options
20740 parsoid={
20741 "nativeGallery": false
20742 }
20743 !! wikitext
20744 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20745 File:Nonexistent.jpg|caption
20746 File:Nonexistent.jpg
20747 image:foobar.jpg|some '''caption''' [[Main Page]]
20748 image:foobar.jpg
20749 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20750 </gallery>
20751 !! html/php
20752 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20753 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20754 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20755 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20756 <div class="gallerytext">
20757 <p>caption
20758 </p>
20759 </div>
20760 </div></li>
20761 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20762 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20763 <div class="gallerytext">
20764 </div>
20765 </div></li>
20766 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20767 <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>
20768 <div class="gallerytext">
20769 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20770 </p>
20771 </div>
20772 </div></li>
20773 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20774 <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>
20775 <div class="gallerytext">
20776 </div>
20777 </div></li>
20778 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20779 <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>
20780 <div class="gallerytext">
20781 <p>blabla.
20782 </p>
20783 </div>
20784 </div></li>
20785 </ul>
20786
20787 !! html/parsoid
20788 <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"}}'>
20789 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20790 <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>
20791 <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>
20792 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext">some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
20793 <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>
20794 <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>
20795 </ul>
20796 !! end
20797
20798 !! test
20799 Gallery (without px units)
20800 !! wikitext
20801 <gallery widths="70" heights="40">
20802 File:Foobar.jpg
20803 </gallery>
20804 !! html/php
20805 <ul class="gallery mw-gallery-traditional">
20806 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20807 <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>
20808 <div class="gallerytext">
20809 </div>
20810 </div></li>
20811 </ul>
20812
20813 !! html/parsoid
20814 <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"}}'>
20815 <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>
20816 </ul>
20817 !! end
20818
20819 !! test
20820 Gallery (with invalid units)
20821 !! wikitext
20822 <gallery widths="70em" heights="40em">
20823 File:Foobar.jpg
20824 </gallery>
20825 !! html/php
20826 <ul class="gallery mw-gallery-traditional">
20827 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20828 <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>
20829 <div class="gallerytext">
20830 </div>
20831 </div></li>
20832 </ul>
20833
20834 !! html/parsoid
20835 <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"}}'>
20836 <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>
20837 </ul>
20838 !! end
20839
20840 !! test
20841 Gallery with link that has fragment
20842 !! options
20843 parsoid={
20844 "modes": ["wt2html", "html2html"],
20845 "nativeGallery": true
20846 }
20847 !! wikitext
20848 <gallery>
20849 image:foobar.jpg|link=Main_Page
20850 image:foobar.jpg|link=Main_Page#section
20851 image:foobar.jpg|link=Main Page#section|caption
20852 </gallery>
20853 !! html/php
20854 <ul class="gallery mw-gallery-traditional">
20855 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20856 <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>
20857 <div class="gallerytext">
20858 </div>
20859 </div></li>
20860 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20861 <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>
20862 <div class="gallerytext">
20863 </div>
20864 </div></li>
20865 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20866 <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>
20867 <div class="gallerytext">
20868 <p>caption
20869 </p>
20870 </div>
20871 </div></li>
20872 </ul>
20873
20874 !! html/parsoid
20875 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20876 <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>
20877 <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>
20878 <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>
20879 </ul>
20880 !! end
20881
20882 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20883 !! test
20884 Gallery with template inside caption
20885 !! options
20886 parsoid={
20887 "nativeGallery": true
20888 }
20889 !! wikitext
20890 <gallery caption="{{echo|hi}}">
20891 File:Foobar.jpg|{{echo|ho}}
20892 </gallery>
20893 !! html/php
20894 <ul class="gallery mw-gallery-traditional">
20895 <li class='gallerycaption'>{{echo|hi}}</li>
20896 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20897 <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>
20898 <div class="gallerytext">
20899 <p>ho
20900 </p>
20901 </div>
20902 </div></li>
20903 </ul>
20904
20905 !! html/parsoid
20906 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20907 <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>
20908 <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>
20909 </ul>
20910 !! end
20911
20912 !! test
20913 Gallery with wikitext inside caption
20914 !! options
20915 parsoid={
20916 "nativeGallery": true
20917 }
20918 !! wikitext
20919 <gallery>
20920 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20921 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20922 </gallery>
20923 !! html/php
20924 <ul class="gallery mw-gallery-traditional">
20925 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20926 <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>
20927 <div class="gallerytext">
20928 <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>
20929 </p>
20930 </div>
20931 </div></li>
20932 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20933 <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>
20934 <div class="gallerytext">
20935 <p>This is a test template
20936 </p>
20937 </div>
20938 </div></li>
20939 </ul>
20940
20941 !! html/parsoid
20942 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20943 <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>
20944 <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>
20945 </ul>
20946 !! end
20947
20948 !! test
20949 Gallery (with showfilename option)
20950 !! options
20951 parsoid={
20952 "nativeGallery": true
20953 }
20954 !! wikitext
20955 <gallery showfilename="">
20956 File:Nonexistent.jpg|caption
20957 File:Nonexistent.jpg
20958 File:Foobar.jpg|some '''caption''' [[Main Page]]
20959 File:Foobar.jpg
20960 </gallery>
20961 !! html/php
20962 <ul class="gallery mw-gallery-traditional">
20963 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20964 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20965 <div class="gallerytext">
20966 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20967 caption
20968 </p>
20969 </div>
20970 </div></li>
20971 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20972 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20973 <div class="gallerytext">
20974 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20975 </p>
20976 </div>
20977 </div></li>
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/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>
20980 <div class="gallerytext">
20981 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20982 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20983 </p>
20984 </div>
20985 </div></li>
20986 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20987 <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>
20988 <div class="gallerytext">
20989 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20990 </p>
20991 </div>
20992 </div></li>
20993 </ul>
20994
20995 !! html/parsoid
20996 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20997 <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>
20998 <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>
20999 <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>
21000 <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>
21001 </ul>
21002 !! end
21003
21004 ## Should Parsoid be preserving these variations? See T151367
21005 !! test
21006 Gallery (with namespace-less filenames)
21007 !! options
21008 parsoid={
21009 "modes": ["wt2html", "html2html"],
21010 "nativeGallery": true
21011 }
21012 !! wikitext
21013 <gallery>
21014 File:Nonexistent.jpg
21015 Nonexistent.jpg
21016 image:foobar.jpg
21017 foobar.jpg
21018 </gallery>
21019 !! html/php
21020 <ul class="gallery mw-gallery-traditional">
21021 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21022 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21023 <div class="gallerytext">
21024 </div>
21025 </div></li>
21026 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21027 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21028 <div class="gallerytext">
21029 </div>
21030 </div></li>
21031 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21032 <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>
21033 <div class="gallerytext">
21034 </div>
21035 </div></li>
21036 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21037 <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>
21038 <div class="gallerytext">
21039 </div>
21040 </div></li>
21041 </ul>
21042
21043 !! html/parsoid
21044 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21045 <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>
21046 <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>
21047 <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>
21048 <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>
21049 </ul>
21050 !! end
21051
21052 !! test
21053 Gallery override link with wikilink (T36852)
21054 !! options
21055 parsoid={
21056 "nativeGallery": true
21057 }
21058 !! wikitext
21059 <gallery>
21060 File:Foobar.jpg|alt=galleryalt|link=Wikilink
21061 </gallery>
21062 !! html/php
21063 <ul class="gallery mw-gallery-traditional">
21064 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21065 <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>
21066 <div class="gallerytext">
21067 </div>
21068 </div></li>
21069 </ul>
21070
21071 !! html/parsoid
21072 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21073 <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>
21074 </ul>
21075 !! end
21076
21077 !! test
21078 Gallery override link with absolute external link (T36852)
21079 !! options
21080 parsoid={
21081 "nativeGallery": true
21082 }
21083 !! wikitext
21084 <gallery>
21085 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
21086 </gallery>
21087 !! html/php
21088 <ul class="gallery mw-gallery-traditional">
21089 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21090 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21091 <div class="gallerytext">
21092 </div>
21093 </div></li>
21094 </ul>
21095
21096 !! html/parsoid
21097 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21098 <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>
21099 </ul>
21100 !! end
21101
21102 !! test
21103 Gallery override link with absolute external link with LanguageConverter
21104 !! options
21105 language=zh
21106 !! wikitext
21107 <gallery>
21108 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21109 </gallery>
21110 !! html/php
21111 <ul class="gallery mw-gallery-traditional">
21112 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21113 <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>
21114 <div class="gallerytext">
21115 <p>caption
21116 </p>
21117 </div>
21118 </div></li>
21119 </ul>
21120
21121 !! html/parsoid
21122 <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"}}'>
21123 <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>
21124 </ul>
21125 !! end
21126
21127 !! test
21128 Gallery override link with malicious javascript (T36852)
21129 !! options
21130 parsoid={
21131 "modes": ["wt2html", "html2html"],
21132 "nativeGallery": true
21133 }
21134 !! wikitext
21135 <gallery>
21136 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21137 </gallery>
21138 !! html/php
21139 <ul class="gallery mw-gallery-traditional">
21140 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21141 <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>
21142 <div class="gallerytext">
21143 </div>
21144 </div></li>
21145 </ul>
21146
21147 !! html/parsoid
21148 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21149 <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>
21150 </ul>
21151 !! end
21152
21153 # Note that parsoid uses the invalid link as a caption, PHP does not.
21154 !! test
21155 Gallery with invalid title as link (T45964)
21156 !! options
21157 parsoid={
21158 "modes": ["wt2html", "html2html"],
21159 "nativeGallery": true
21160 }
21161 !! wikitext
21162 <gallery>
21163 File:Foobar.jpg|link=<
21164 </gallery>
21165 !! html/php
21166 <ul class="gallery mw-gallery-traditional">
21167 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21168 <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>
21169 <div class="gallerytext">
21170 </div>
21171 </div></li>
21172 </ul>
21173
21174 !! html/parsoid
21175 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21176 <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>
21177 </ul>
21178 !! end
21179
21180 !! test
21181 Serialize gallery without attrs in data-mw
21182 !! options
21183 parsoid={
21184 "modes": ["html2wt"],
21185 "nativeGallery": true
21186 }
21187 !! html/parsoid
21188 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
21189 <li class="gallerycaption">123</li>
21190 <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>
21191 </ul>
21192 !! wikitext
21193 <gallery caption="123">
21194 File:Test.png
21195 </gallery>
21196 !! end
21197
21198 !! test
21199 Gallery with class and style attributes
21200 !! options
21201 parsoid={
21202 "nativeGallery": true
21203 }
21204 !! wikitext
21205 <gallery class="center" style="text-align: center;">
21206 File:Foobar.jpg
21207 </gallery>
21208 !! html/php
21209 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
21210 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21211 <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>
21212 <div class="gallerytext">
21213 </div>
21214 </div></li>
21215 </ul>
21216
21217 !! html/parsoid
21218 <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":{}}'>
21219 <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>
21220 </ul>
21221 !! end
21222
21223 !! test
21224 Gallery in slideshow mode
21225 !! options
21226 parsoid={
21227 "nativeGallery": true
21228 }
21229 !! wikitext
21230 <gallery mode="slideshow" showthumbnails="">
21231 File:Foobar.jpg
21232 </gallery>
21233 !! html/php
21234 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
21235 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21236 <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>
21237 <div class="gallerytext">
21238 </div>
21239 </div></li>
21240 </ul>
21241
21242 !! html/parsoid
21243 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
21244 <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>
21245 </ul>
21246 !! end
21247
21248 !! test
21249 Serialize gallery image captions on a line
21250 !! options
21251 parsoid={
21252 "modes": ["html2wt"],
21253 "nativeGallery": true
21254 }
21255 !! html/parsoid
21256 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21257 <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>
21258 <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>
21259 </ul>
21260 !! wikitext
21261 <gallery>
21262 File:Foobar.jpg| hi ho
21263 File:Foobar.jpg|hi<br />ho
21264 </gallery>
21265 !! end
21266
21267 !! test
21268 HTML Hex character encoding (spells the word "JavaScript")
21269 !! options
21270 parsoid=wt2html,wt2wt,html2html
21271 !! wikitext
21272 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
21273 !! html/php
21274 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
21275 </p>
21276 !! html/parsoid
21277 <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>
21278 !! end
21279
21280 !! test
21281 HTML Hex character encoding bogus encoding (T28437 regression check)
21282 !! wikitext
21283 &#xsee;&#XSEE;
21284 !! html
21285 <p>&amp;#xsee;&amp;#XSEE;
21286 </p>
21287 !! end
21288
21289 !! test
21290 HTML Hex character encoding mixed case
21291 !! options
21292 parsoid=wt2html,wt2wt,html2html
21293 !! wikitext
21294 &#xEE;&#Xee;
21295 !! html/php
21296 <p>&#xee;&#xee;
21297 </p>
21298 !! html/parsoid
21299 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
21300 !! end
21301
21302 # See: https://www.w3.org/TR/html5/syntax.html#character-references
21303 # Note that U+000C (form feed) is not a valid XML character, so
21304 # it is banned even though allowed in HTML5.
21305 !! test
21306 Illegal character references (T106578)
21307 !! wikitext
21308 ; Null: &#00;
21309 ; FF: &#xC;
21310 ; CR: &#xD;
21311 ; Control (low): &#8;
21312 ; Control (high): &#x7F; &#x9F;
21313 ; Surrogate: &#xD83D;&#xDCA9;
21314 ; This is an okay astral character: &#x1F4A9;
21315 !! html+tidy
21316 <dl><dt>Null</dt>
21317 <dd>&amp;#00;</dd>
21318 <dt>FF</dt>
21319 <dd>&amp;#xC;</dd>
21320 <dt>CR</dt>
21321 <dd>&amp;#xD;</dd>
21322 <dt>Control (low)</dt>
21323 <dd>&amp;#8;</dd>
21324 <dt>Control (high)</dt>
21325 <dd>&amp;#x7F; &amp;#x9F;</dd>
21326 <dt>Surrogate</dt>
21327 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
21328 <dt>This is an okay astral character</dt>
21329 <dd>&#x1f4a9;</dd></dl>
21330 !! end
21331
21332 !! test
21333 __FORCETOC__ override
21334 !! wikitext
21335 __NEWSECTIONLINK__
21336 __FORCETOC__
21337 !! html/php
21338 <p><br />
21339 </p>
21340 !! end
21341
21342 !! test
21343 ISBN code coverage
21344 !! wikitext
21345 ISBN 978-0-1234-56&#x20;789
21346 !! html/php
21347 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21348 </p>
21349 !! html/parsoid
21350 <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>
21351 !! end
21352
21353 !! test
21354 ISBN followed by 5 spaces
21355 !! wikitext
21356 ISBN
21357 !! html
21358 <p>ISBN
21359 </p>
21360 !! end
21361
21362 !! test
21363 Double ISBN
21364 !! wikitext
21365 ISBN ISBN 1234567890
21366 !! html/php
21367 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21368 </p>
21369 !! html/parsoid
21370 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21371 !! end
21372
21373 # Uppercase X and lowercase x as well
21374 !! test
21375 ISBN with an X
21376 !! wikitext
21377 ISBN 3-462-04561-X
21378 ISBN 3-462-04561-x
21379 ISBN 080442957X
21380 ISBN 080442957x
21381 ISBN 978080442957X
21382 ISBN 978080442957x
21383 !! html/php
21384 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21385 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21386 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21387 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21388 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21389 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21390 </p>
21391 !! html/parsoid
21392 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21393 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21394 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21395 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21396 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21397 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21398 !! end
21399
21400 !! test
21401 ISBN with empty prefix (parsoid test)
21402 !! wikitext
21403 ISBN 1234567890
21404 !! html/php
21405 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21406 </p>
21407 !! html/parsoid
21408 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21409 !! end
21410
21411 !! test
21412 T24905: <abbr> followed by ISBN followed by </a>
21413 !! wikitext
21414 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21415 !! html/php
21416 <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>
21417 </p>
21418 !! html/parsoid
21419 <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>
21420 !! end
21421
21422 !! test
21423 Double RFC
21424 !! wikitext
21425 RFC RFC 1234
21426 !! html/php
21427 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21428 </p>
21429 !! html/parsoid
21430 <p>RFC <a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
21431 !! end
21432
21433 !! test
21434 Double RFC with a wiki link
21435 !! wikitext
21436 RFC [[RFC 1234]]
21437 !! html/php
21438 <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>
21439 </p>
21440 !! html/parsoid
21441 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234" title="RFC 1234">RFC 1234</a></p>
21442 !! end
21443
21444 !! test
21445 RFC code coverage
21446 !! wikitext
21447 RFC 983&#x20;987
21448 !! html/php
21449 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21450 </p>
21451 !! html/parsoid
21452 <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>
21453 !! end
21454
21455 !! test
21456 Centre-aligned image
21457 !! wikitext
21458 [[Image:foobar.jpg|centre]]
21459 !! html/php
21460 <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>
21461
21462 !! html/parsoid
21463 <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>
21464 !! end
21465
21466 !! test
21467 None-aligned image
21468 !! wikitext
21469 [[Image:foobar.jpg|none]]
21470 !! html/php
21471 <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>
21472
21473 !! html/parsoid
21474 <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>
21475 !! end
21476
21477 !! test
21478 Width + Height sized image (using px) (height is ignored)
21479 !! wikitext
21480 [[Image:foobar.jpg|640x480px]]
21481 !! html/php
21482 <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>
21483 </p>
21484 !! html/parsoid
21485 <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>
21486 !! end
21487
21488 !! test
21489 Width-sized image (using px, no following whitespace)
21490 !! wikitext
21491 [[Image:foobar.jpg|640px]]
21492 !! html/php
21493 <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>
21494 </p>
21495 !! html/parsoid
21496 <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>
21497 !! end
21498
21499 !! test
21500 Width-sized image (using px, with following whitespace - test regression from r39467)
21501 !! wikitext
21502 [[Image:foobar.jpg|640px ]]
21503 !! html/php
21504 <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>
21505 </p>
21506 !! html/parsoid
21507 <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>
21508 !!end
21509
21510 !! test
21511 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21512 !! wikitext
21513 [[Image:foobar.jpg| 640px]]
21514 !! html/php
21515 <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>
21516 </p>
21517 !! html/parsoid
21518 <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>
21519 !! end
21520
21521 !! test
21522 Image with page parameter
21523 !! options
21524 djvu
21525 !! wikitext
21526 [[File:LoremIpsum.djvu|page=2]]
21527 !! html/php
21528 <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>
21529 </p>
21530 !! html/parsoid
21531 <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>
21532 !! end
21533
21534 !! test
21535 Another italics / bold test
21536 !! wikitext
21537 ''' ''x'
21538 !! html
21539 <pre>'<i> </i>x'
21540 </pre>
21541 !!end
21542
21543 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21544 !! test
21545 dt/dd/dl test
21546 !! wikitext
21547 :;;;::
21548 !! html/php
21549 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21550
21551 !! html/parsoid
21552 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21553
21554 !!end
21555
21556 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21557 !! test
21558 Images with the "|" character in the comment
21559 !! wikitext
21560 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21561 !! html/php
21562 <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>
21563
21564 !! html/parsoid
21565 <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>
21566 !! end
21567
21568 !! test
21569 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21570 !! wikitext
21571 <html><script>alert(1);</script></html>
21572 !! html
21573 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21574 </p>
21575 !! end
21576
21577 !! test
21578 HTML with raw HTML ($wgRawHtml==true)
21579 !! options
21580 wgRawHtml=1
21581 !! wikitext
21582 <html><script>alert(1);</script></html>
21583 !! html/php
21584 <p><script>alert(1);</script>
21585 </p>
21586 !! end
21587
21588 !! test
21589 Parents of subpages, one level up
21590 !! options
21591 subpage title=[[Subpage test/L1/L2/L3]]
21592 !! wikitext
21593 [[../|L2]]
21594 !! html
21595 <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>
21596 </p>
21597 !! end
21598
21599
21600 !! test
21601 Parents of subpages, one level up, not named
21602 !! options
21603 subpage title=[[Subpage test/L1/L2/L3]]
21604 !! wikitext
21605 [[../]]
21606 !! html
21607 <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>
21608 </p>
21609 !! end
21610
21611
21612
21613 !! test
21614 Parents of subpages, two levels up
21615 !! options
21616 subpage title=[[Subpage test/L1/L2/L3]]
21617 !! wikitext
21618 [[../../|L1]]2
21619
21620 [[../../|L1]]l
21621 !! html
21622 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2
21623 </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>
21624 </p>
21625 !! end
21626
21627 !! test
21628 Parents of subpages, two levels up, without trailing slash or name.
21629 !! options
21630 subpage title=[[Subpage test/L1/L2/L3]]
21631 !! wikitext
21632 [[../..]]
21633 !! html
21634 <p>[[../..]]
21635 </p>
21636 !! end
21637
21638 !! test
21639 Parents of subpages, two levels up, with lots of extra trailing slashes.
21640 !! options
21641 subpage title=[[Subpage test/L1/L2/L3]]
21642 !! wikitext
21643 [[../../////]]
21644 !! html
21645 <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>
21646 </p>
21647 !! end
21648
21649 !! article
21650 Subpage test/L1/L2/L3Sibling
21651 !! text
21652 Sibling article
21653 !! endarticle
21654
21655 !! test
21656 Transclusion of a sibling page (one level up)
21657 !! options
21658 subpage title=[[Subpage test/L1/L2/L3]]
21659 !! wikitext
21660 {{../L3Sibling}}
21661 !! html
21662 <p>Sibling article
21663 </p>
21664 !! end
21665
21666 !! test
21667 Transclusion of a child page
21668 !! options
21669 subpage title=[[Subpage test/L1/L2]]
21670 !! wikitext
21671 {{/L3Sibling}}
21672 !! html
21673 <p>Sibling article
21674 </p>
21675 !! end
21676
21677 # This is wt2html only in Parsoid because we add <nowiki>
21678 # because of {{..}} and we don't expect to fix that to
21679 # eliminate the nowikis selective for {{..}} markup.
21680 !! test
21681 Non-transclusion because of too many up levels
21682 !! options
21683 subpage title=[[Subpage test/L1/L2/L3]]
21684 parsoid=wt2html
21685 !! wikitext
21686 {{../../../../More than parent}}
21687 !! html/php
21688 <p>{{../../../../More than parent}}
21689 </p>
21690 !! html/parsoid
21691 <p>{{../../../../More than parent}}</p>
21692 !! end
21693
21694 !! test
21695 Definition list code coverage
21696 !! wikitext
21697 ;title :def
21698 ;title :def
21699 ;title:def
21700 !! html/php
21701 <dl><dt>title</dt>
21702 <dd>def</dd>
21703 <dt>title</dt>
21704 <dd>def</dd>
21705 <dt>title</dt>
21706 <dd>def</dd></dl>
21707
21708 !! html/parsoid
21709 <dl><dt>title </dt><dd>def</dd>
21710 <dt>title </dt><dd>def</dd>
21711 <dt>title</dt><dd>def</dd></dl>
21712 !! end
21713
21714 !! test
21715 Don't fall for the self-closing div
21716 !! wikitext
21717 <div>hello world</div/>
21718 !! html
21719 <div>hello world</div>
21720
21721 !! end
21722
21723 !! test
21724 MSGNW magic word
21725 !! wikitext
21726 {{MSGNW:msg}}
21727 !! html/php
21728 <p>&#91;&#91;:Template:Msg&#93;&#93;
21729 </p>
21730 !! end
21731
21732 !! test
21733 RAW magic word
21734 !! wikitext
21735 {{RAW:QUERTY}}
21736 !! html
21737 <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>
21738 </p>
21739 !! end
21740
21741 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21742 !! test
21743 Always escape literal '>' in output, not just after '<'
21744 !! wikitext
21745 ><>
21746 !! html
21747 <p>&gt;&lt;&gt;
21748 </p>
21749 !! end
21750
21751 !! test
21752 Template caching
21753 !! wikitext
21754 {{Test}}
21755 {{Test}}
21756 !! html
21757 <p>This is a test template
21758 This is a test template
21759 </p>
21760 !! end
21761
21762
21763 !! article
21764 MediaWiki:Fake
21765 !! text
21766 ==header==
21767 !! endarticle
21768
21769 !! test
21770 Inclusion of !userCanEdit() content
21771 !! wikitext
21772 {{MediaWiki:Fake}}
21773 !! html
21774 <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>
21775
21776 !! end
21777
21778
21779 !! test
21780 Out-of-order TOC heading levels
21781 !! wikitext
21782 ==2==
21783 ======6======
21784 ===3===
21785 =1=
21786 =====5=====
21787 ==2==
21788 !! html
21789 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
21790 <ul>
21791 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21792 <ul>
21793 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21794 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21795 </ul>
21796 </li>
21797 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21798 <ul>
21799 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21800 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21801 </ul>
21802 </li>
21803 </ul>
21804 </div>
21805
21806 <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>
21807 <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>
21808 <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>
21809 <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>
21810 <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>
21811 <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>
21812
21813 !! end
21814
21815
21816 !! test
21817 ISBN with a dummy number
21818 !! wikitext
21819 ISBN ---
21820 !! html
21821 <p>ISBN ---
21822 </p>
21823 !! end
21824
21825
21826 !! test
21827 ISBN with space-delimited number
21828 !! wikitext
21829 ISBN 92 9017 032 8
21830 !! html/php
21831 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21832 </p>
21833 !! html/parsoid
21834 <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>
21835 !! end
21836
21837
21838 !! test
21839 ISBN with multiple spaces, no number
21840 !! wikitext
21841 ISBN foo
21842 !! html
21843 <p>ISBN foo
21844 </p>
21845 !! end
21846
21847
21848 !! test
21849 ISBN length
21850 !! wikitext
21851 ISBN 123456789
21852
21853 ISBN 1234567890
21854
21855 ISBN 12345678901
21856 !! html/php
21857 <p>ISBN 123456789
21858 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21859 </p><p>ISBN 12345678901
21860 </p>
21861 !! html/parsoid
21862 <p>ISBN 123456789</p>
21863
21864 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21865
21866 <p>ISBN 12345678901</p>
21867 !! end
21868
21869
21870 !! test
21871 ISBN with trailing year (T9110)
21872 !! wikitext
21873 ISBN 1-234-56789-0 - 2006
21874
21875 ISBN 1 234 56789 0 - 2006
21876 !! html/php
21877 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21878 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21879 </p>
21880 !! html/parsoid
21881 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21882
21883 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21884 !! end
21885
21886
21887 !! test
21888 anchorencode
21889 !! config
21890 wgFragmentMode=[ 'html5', 'legacy' ]
21891 !! wikitext
21892 {{anchorencode:foo bar©#%n}}
21893 !! html/php
21894 <p>foo_bar©#%n
21895 </p>
21896 !! html/parsoid
21897 <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>
21898 !! end
21899
21900 !! test
21901 anchorencode (legacy)
21902 !! config
21903 wgFragmentMode=[ 'legacy' ]
21904 !! wikitext
21905 {{anchorencode:foo bar©#%n}}
21906 !! html/php
21907 <p>foo_bar.C2.A9.23.25n
21908 </p>
21909 !! end
21910
21911 !! test
21912 anchorencode trims spaces
21913 !! config
21914 wgFragmentMode=[ 'html5', 'legacy' ]
21915 !! wikitext
21916 {{anchorencode: __pretty__please__}}
21917 !! html/php
21918 <p>pretty_please
21919 </p>
21920 !! html/parsoid
21921 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
21922 !! end
21923
21924 !! test
21925 anchorencode deals with links
21926 !! config
21927 wgFragmentMode=[ 'html5', 'legacy' ]
21928 !! wikitext
21929 {{anchorencode: [[hello|world]] [[hi]]}}
21930 !! html/php
21931 <p>world_hi
21932 </p>
21933 !! html/parsoid
21934 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
21935 !! end
21936
21937 !! test
21938 anchorencode deals with templates
21939 !! config
21940 wgFragmentMode=[ 'html5', 'legacy' ]
21941 !! wikitext
21942 {{anchorencode: {{Foo}} x}}
21943 !! html/php
21944 <p>FOO_x
21945 </p>
21946 !! html/parsoid
21947 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
21948 !! end
21949
21950 !! test
21951 anchorencode encodes like the TOC generator: (T20431)
21952 !! config
21953 wgFragmentMode=[ 'html5', 'legacy' ]
21954 !! wikitext
21955 ===_ +:.3A%3A _ &&amp;]] x===
21956 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
21957 __NOEDITSECTION__
21958 !! html/php
21959 <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>
21960 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
21961 </p>
21962 !! html/parsoid
21963 <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>
21964 <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>
21965 <meta property="mw:PageProp/noeditsection"/>
21966 !! end
21967
21968 !! test
21969 anchorencode encodes like the TOC generator: (T20431) (legacy)
21970 !! config
21971 wgFragmentMode=[ 'legacy' ]
21972 !! wikitext
21973 ===_ +:.3A%3A&&amp;]]===
21974 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21975 __NOEDITSECTION__
21976 !! html/php
21977 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21978 <p>.2B:.3A.253A.26.26.5D.5D
21979 </p>
21980 !! end
21981
21982 !! test
21983 T8200: blockquotes and paragraph formatting
21984 !! wikitext
21985 <blockquote>
21986 foo
21987 </blockquote>
21988
21989 bar
21990
21991 baz
21992 !! html
21993 <blockquote>
21994 <p>foo
21995 </p>
21996 </blockquote>
21997 <p>bar
21998 </p>
21999 <pre>baz
22000 </pre>
22001 !! end
22002
22003 !! test
22004 T10293: Use of center tag ruins paragraph formatting
22005 !! wikitext
22006 <center>
22007 foo
22008 </center>
22009
22010 bar
22011
22012 baz
22013 !! html
22014 <center>
22015 <p>foo
22016 </p>
22017 </center>
22018 <p>bar
22019 </p>
22020 <pre>baz
22021 </pre>
22022 !! end
22023
22024 !!test
22025 Parsing of overlapping (improperly nested) inline html tags
22026 !! wikitext
22027 <span><s>x</span></s>
22028 !! html/php
22029 <p><span><s>x&lt;/span&gt;</s></span>
22030 </p>
22031 !! html/parsoid
22032 <p><span><s>x</s></span>
22033 </p>
22034 !!end
22035
22036 ###
22037 ### Language variants related tests
22038 ###
22039
22040 # Parsoid does not mark self-links.
22041 # Parsoid does not convert links; PHP will do any necessary redirects.
22042
22043 !! test
22044 Self-link in language variants
22045 !! options
22046 title=[[Dunav]] language=sr
22047 !! wikitext
22048 Both [[Dunav]] and [[Дунав]] are names for this river.
22049 !! html/php
22050 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
22051 </p>
22052 !! html/parsoid
22053 <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>
22054 !! end
22055
22056 !! article
22057 Дуна
22058 !! text
22059 content
22060 !! endarticle
22061
22062 !! test
22063 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
22064 !! options
22065 title=[[Duna]] language=sr
22066 !! wikitext
22067 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
22068 !! html/php
22069 <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.
22070 </p>
22071 !! html/parsoid
22072 <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>
22073 !! end
22074
22075 !! test
22076 Link to a section of a variant of this title shouldn't be parsed as self-link
22077 !! options
22078 title=[[Duna]] language=sr
22079 !! wikitext
22080 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
22081 !! html/php
22082 <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.
22083 </p>
22084 !! html/parsoid
22085 <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>
22086 !! end
22087
22088 !! test
22089 Link to pages in language variants
22090 !! options
22091 language=sr
22092 !! wikitext
22093 Main Page can be written as [[Маин Паге]]
22094 !! html/php
22095 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
22096 </p>
22097 !! html/parsoid
22098 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
22099 !! end
22100
22101
22102 !! test
22103 Multiple links to pages in language variants
22104 !! options
22105 language=sr
22106 !! wikitext
22107 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
22108 !! html/php
22109 <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>.
22110 </p>
22111 !! html/parsoid
22112 <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>
22113 !! end
22114
22115
22116 !! test
22117 Simple template in language variants
22118 !! options
22119 language=sr
22120 !! wikitext
22121 {{тест}}
22122 !! html/php
22123 <p>This is a test template
22124 </p>
22125 !! end
22126
22127
22128 !! test
22129 Template with explicit namespace in language variants
22130 !! options
22131 language=sr
22132 !! wikitext
22133 {{Template:тест}}
22134 !! html/php
22135 <p>This is a test template
22136 </p>
22137 !! end
22138
22139
22140 !! test
22141 Basic test for template parameter in language variants
22142 !! options
22143 language=sr
22144 !! wikitext
22145 {{парамтест|param=foo}}
22146 !! html/php
22147 <p>This is a test template with parameter foo
22148 </p>
22149 !! end
22150
22151 !! test
22152 Simple category in language variants
22153 !! options
22154 language=sr cat
22155 !! wikitext
22156 [[Category:МедиаWики Усер'с Гуиде]]
22157 !! html/php
22158 cat=МедиаWики_Усер'с_Гуиде sort=
22159 !! html/parsoid
22160 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
22161 !! end
22162
22163 !! article
22164 Category:分类
22165 !! text
22166 blah
22167 !! endarticle
22168
22169 !! article
22170 Category:分類
22171 !! text
22172 blah
22173 !! endarticle
22174
22175 ## We used to, but no longer wt2wt this test since the default serializer
22176 ## will normalize all categories to serialize on their own line.
22177 ## This wikitext usage is going to be fairly uncommon in production and
22178 ## selser will take care of preserving formatting in those scenarios.
22179 !! test
22180 Don't convert blue categorylinks to another variant (T35210)
22181 !! options
22182 cat
22183 language=zh
22184 parsoid=wt2html
22185 !! wikitext
22186 [[A]][[Category:分类]]
22187 !! html/php
22188 cat=分类 sort=
22189 !! html/parsoid
22190 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
22191 <link rel="mw:PageProp/Category" href="./Category:分类"/>
22192 !! end
22193
22194 !! test
22195 Stripping -{}- tags (language variants)
22196 !! options
22197 language=sr
22198 !! wikitext
22199 Latin proverb: -{Ne nuntium necare}-
22200 !! html/php
22201 <p>Latin proverb: Ne nuntium necare
22202 </p>
22203 !! html/parsoid
22204 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22205 !! end
22206
22207
22208 !! test
22209 Prevent conversion with -{}- tags (language variants)
22210 !! options
22211 language=sr variant=sr-ec
22212 !! wikitext
22213 Latinski: -{Ne nuntium necare}-
22214 !! html/php
22215 <p>Латински: Ne nuntium necare
22216 </p>
22217 !! html/parsoid
22218 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22219 !! end
22220
22221
22222 !! test
22223 Prevent conversion of text with -{}- tags (language variants)
22224 !! options
22225 language=sr variant=sr-ec
22226 !! wikitext
22227 Latinski: -{Ne nuntium necare}-
22228 !! html/php
22229 <p>Латински: Ne nuntium necare
22230 </p>
22231 !! html/parsoid
22232 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22233 !! end
22234
22235
22236 !! test
22237 Prevent conversion of links with -{}- tags (language variants)
22238 !! options
22239 language=sr variant=sr-ec
22240 !! wikitext
22241 -{[[Main Page]]}-
22242 !! html/php
22243 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22244 </p>
22245 !! html/parsoid
22246 <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>
22247 !! end
22248
22249
22250 !! test
22251 -{}- tags within headlines (within html for parserConvert())
22252 !! config
22253 wgFragmentMode=[ 'html5', 'legacy' ]
22254 !! options
22255 language=sr variant=sr-ec
22256 !! wikitext
22257 ==-{Naslov}-==
22258
22259 Note that even an unprotected headline ID is not affected by language
22260 conversion:
22261
22262 ==Latinski==
22263 !! html/php
22264 <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>
22265 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
22266 цонверсион:
22267 </p>
22268 <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>
22269
22270 !! html/parsoid
22271 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
22272
22273 <p>Note that even an unprotected headline ID is not affected by language
22274 conversion:</p>
22275
22276 <h2 id="Latinski">Latinski</h2>
22277 !! end
22278
22279 !! test
22280 Explicit definition of language variant alternatives
22281 !! options
22282 language=zh variant=zh-tw
22283 !! wikitext
22284 -{zh:China;zh-tw:Taiwan}-, not China
22285 !! html/php
22286 <p>Taiwan, not China
22287 </p>
22288 !! html/parsoid
22289 <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>
22290 !! end
22291
22292 !! test
22293 Filter syntax for language variants
22294 !! options
22295 language=zh variant=zh-tw
22296 !! wikitext
22297 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
22298 !! html/php
22299 <p>fooblog, WEBJOURNAL, WEBLOGquux
22300 </p>
22301 !! html/parsoid
22302 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
22303 !! end
22304
22305 # Note that Parsoid post-processing for language variants needs to
22306 # update the `title` attribute here, based on the mw:ExpandedAttrs property
22307 !! test
22308 Conversion around HTML tags
22309 !! options
22310 language=sr variant=sr-ec
22311 !! wikitext
22312 -{H|span=>sr-ec:script;title=>sr-ec:src}-
22313 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
22314 !! html/php
22315 <p>
22316 <span title="ЛаCтин">ски</span>
22317 </p>
22318 !! html/parsoid
22319 <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"}]}'/>
22320 <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>
22321 !! end
22322
22323 !! test
22324 Explicit session-wise two-way language variant mapping (A flag and - flag)
22325 !! options
22326 language=zh variant=zh-tw
22327 !! wikitext
22328 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
22329
22330 Taiwan is not China.
22331
22332 But -{A|zh:China; zh-tw:Taiwan}- is China,
22333
22334 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
22335
22336 and -{China}- is China.
22337 !! html/php
22338 <p>This is Taiwan, but we'll forget that now.
22339 </p><p>Taiwan is not China.
22340 </p><p>But Taiwan is Taiwan,
22341 </p><p>(This should be stripped!)
22342 </p><p>and China is China.
22343 </p>
22344 !! html/parsoid
22345 <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>
22346 <p>Taiwan is not China.</p>
22347 <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>
22348 <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>
22349 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22350 !! end
22351
22352 !! test
22353 Explicit session-wise one-way language variant mapping (A flag and - flag)
22354 !! options
22355 language=zh variant=zh-tw
22356 !! wikitext
22357 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
22358
22359 COUNTRY is China or Taiwan.
22360
22361 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
22362
22363 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22364
22365 and -{COUNTRY}- is COUNTRY.
22366 !! html/php
22367 <p>This is Taiwan, but we'll forget that now.
22368 </p><p>COUNTRY is China or Taiwan.
22369 </p><p>But Taiwan is Taiwan,
22370 </p><p>(This should be stripped!)
22371 </p><p>and COUNTRY is COUNTRY.
22372 </p>
22373 !! html/parsoid
22374 <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>
22375 <p>COUNTRY is China or Taiwan.</p>
22376 <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>
22377 <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>
22378 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22379 !! end
22380
22381 !! test
22382 Explicit session-wise two-way language variant mapping (H flag for hide)
22383 !! options
22384 language=zh variant=zh-tw
22385 !! wikitext
22386 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22387
22388 Taiwan is China.
22389 !! html/php
22390 <p>(This should be stripped!)
22391 </p><p>Taiwan is Taiwan.
22392 </p>
22393 !! html/parsoid
22394 <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>
22395 <p>Taiwan is China.</p>
22396 !! end
22397
22398 !! test
22399 Explicit session-wise one-way language variant mapping (H flag for hide)
22400 !! options
22401 language=zh variant=zh-tw
22402 !! wikitext
22403 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22404
22405 COUNTRY is Taiwan or China.
22406 !! html/php
22407 <p>(This should be stripped!)
22408 </p><p>Taiwan is Taiwan or China.
22409 </p>
22410 !! html/parsoid
22411 <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>
22412 <p>COUNTRY is Taiwan or China.</p>
22413 !! end
22414
22415 ## Note that parsoid test runner does not support 'showtitle' option.
22416 !! test
22417 Adding explicit conversion rule for title (T flag)
22418 !! options
22419 language=zh variant=zh-tw showtitle
22420 !! wikitext
22421 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22422
22423 Taiwan is China.
22424 !! html/php
22425 Taiwan
22426 <p>Should be stripped!
22427 </p><p>Taiwan is China.
22428 </p>
22429 !! html/parsoid
22430 <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>
22431 <p>Taiwan is China.</p>
22432 !! end
22433
22434 !! test
22435 Code coverage: T combined with H flag
22436 !! options
22437 language=zh variant=zh-tw showtitle
22438 !! wikitext
22439 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22440
22441 Taiwan is China.
22442 !! html/php
22443 Taiwan
22444 <p>Should be stripped!
22445 </p><p>Taiwan is Taiwan.
22446 </p>
22447 !! html/parsoid
22448 <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>
22449 <p>Taiwan is China.</p>
22450 !! end
22451
22452 !! test
22453 Code coverage: T with no variants
22454 !! options
22455 language=zh variant=zh-tw showtitle
22456 !! wikitext
22457 -{H|zh:China; zh-tw:Taiwan}-
22458 Taiwan is China.-{T|Taiwan is China}-
22459 !! html/php
22460 Taiwan is China
22461 <p>
22462 Taiwan is Taiwan.
22463 </p>
22464 !! html/parsoid
22465 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22466 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22467 !! end
22468
22469 !! test
22470 Code coverage: rules with no variants
22471 !! options
22472 language=zh variant=zh-tw
22473 !! wikitext
22474 -{H|zh:China; zh-tw:Taiwan}-
22475 Taiwan is China.
22476 -{H|China}-
22477 Taiwan is China.
22478 !! html/php
22479 <p>
22480 Taiwan is Taiwan.
22481
22482 Taiwan is China.
22483 </p>
22484 !! html/parsoid
22485 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22486 Taiwan is China.
22487 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22488 Taiwan is China.</p>
22489 !! end
22490
22491
22492 !! test
22493 Code coverage: D flag for conversion rule
22494 !! options
22495 language=zh variant=zh-tw
22496 !! wikitext
22497 -{D|zh-cn:XA; zh-tw:YA}-
22498 -{A;D|zh-cn:XB; zh-tw:YB}-
22499 -{D;H|zh-cn:XC; zh-tw:YC}-
22500
22501 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22502
22503 -{D|0=>zh-tw:1}-
22504 -{A;D|2=>zh-tw:3}-
22505 -{D;H|4=>zh-tw:5}-
22506
22507 XA XB XC YA YB YC FOO BAR BAT 012345
22508 !! html/php
22509 <p>大陆:XA;台灣:YA;
22510
22511 大陆:XC;台灣:YC;
22512 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22513 </p><p>0⇒台灣:1;
22514
22515 4⇒台灣:5;
22516 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22517 </p>
22518 !! html/parsoid
22519 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22520 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22521 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22522 <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>
22523 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22524 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22525 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22526 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22527 !! end
22528
22529 !! test
22530 Code coverage: N flag for conversion rule
22531 !! options
22532 language=zh variant=zh-cn
22533 !! wikitext
22534 -{N|zh-cn}-
22535
22536 -{N|zh-tw}-
22537
22538 -{N|sr-ec}-
22539 !! html/php
22540 <p>大陆
22541 </p><p>台灣
22542 </p><p>српски (ћирилица)‎
22543 </p>
22544 !! html/parsoid
22545 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22546 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22547 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22548 !! end
22549
22550 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22551 !! test
22552 Code coverage: N flag for conversion rule (wt2html only)
22553 !! options
22554 language=zh variant=zh-cn
22555 parsoid=wt2html,html2html
22556 !! wikitext
22557 -{D;N|en}-
22558 !! html/php
22559 <p>English
22560 </p>
22561 !! html/parsoid
22562 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22563 !! end
22564
22565 !! test
22566 Testing that changing the language variant here in the tests actually works
22567 !! options
22568 language=zh variant=zh showtitle
22569 !! wikitext
22570 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22571 !! html/php
22572 China
22573 <p>Should be stripped!
22574 </p>
22575 !! html/parsoid
22576 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22577 !! end
22578
22579 !! test
22580 Recursive conversion of alt and title attrs shouldn't clear converter state
22581 !! options
22582 language=zh variant=zh-cn
22583 showtitle
22584 !! wikitext
22585 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22586 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22587 !! html/php
22588 China
22589 <p>
22590 Should be stripped<span title="Exclamation">!</span>
22591 </p>
22592 !! html/parsoid
22593 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22594 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>
22595 !! end
22596
22597 !! test
22598 T26072: more test on conversion rule for title
22599 !! options
22600 language=zh variant=zh-tw showtitle
22601 !! wikitext
22602 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22603
22604 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22605 !! html/php
22606 Taiwan
22607 <p>This should be stripped!
22608 </p><p>This won't take interferes with the title rule.
22609 </p>
22610 !! html/parsoid
22611 <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>
22612 <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>
22613 !! end
22614
22615 !! test
22616 Partly disable title conversion if variant == main language code
22617 !! options
22618 language=zh variant=zh title=[[ZH]] showtitle
22619 !! wikitext
22620 -{T|zh-cn:CN;zh-tw:TW}-
22621 !! html/php
22622 ZH
22623 <p>
22624 </p>
22625 !! html/parsoid
22626 <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>
22627 !! end
22628
22629 !! test
22630 Partly disable title conversion if variant == main language code, more
22631 !! options
22632 language=zh variant=zh title=[[ZH]] showtitle
22633 !! wikitext
22634 -{T|TW}-
22635 !! html/php
22636 ZH
22637 <p>
22638 </p>
22639 !! html/parsoid
22640 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22641 !! end
22642
22643 !! test
22644 Raw output of variant escape tags (R flag)
22645 !! options
22646 language=zh variant=zh-tw
22647 !! wikitext
22648 Raw: -{R|zh:China;zh-tw:Taiwan}-
22649 !! html/php
22650 <p>Raw: zh:China;zh-tw:Taiwan
22651 </p>
22652 !! html/parsoid
22653 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22654 !! end
22655
22656 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22657 !! test
22658 Raw output of variant escape tags (R flag) (wt2html only)
22659 !! options
22660 language=zh variant=zh-tw
22661 parsoid=wt2html,html2html
22662 !! wikitext
22663 -{Variant}- -{D|syntax}- -{D;R|options}-
22664 !! html/php
22665 <p>Variant syntax options
22666 </p>
22667 !! html/parsoid
22668 <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>
22669 !! end
22670
22671 !! test
22672 Nested markup inside raw output of variant escape tags (R flag)
22673 !! options
22674 language=zh variant=zh-tw
22675 !! wikitext
22676 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22677 !! html/php
22678 <p>Nested raw: nested Taiwan nested
22679 </p>
22680 !! html/parsoid
22681 <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>
22682 !! end
22683
22684 !! test
22685 Nested markup and spaces inside raw output of variant escape tags (R flag)
22686 !! options
22687 language=zh variant=zh-tw
22688 !! wikitext
22689 X-{ outer -{ inner }- outer }-X
22690 !! html/php
22691 <p>X outer inner outer X
22692 </p>
22693 !! html/parsoid
22694 <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>
22695 !! end
22696
22697 !! test
22698 Templates inside raw output of variant escape tags (R flag)
22699 !! options
22700 language=zh variant=zh-tw
22701 !! wikitext
22702 Nested raw: -{R|nested {{echo|hi}} templates}-
22703 !! html/php
22704 <p>Nested raw: nested hi templates
22705 </p>
22706 !! html/parsoid
22707 <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>
22708 !! end
22709
22710 !! test
22711 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22712 !! options
22713 language=zh variant=zh-cn
22714 !! wikitext
22715 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22716 !! html/php
22717 <p>0
22718 </p>
22719 !! html/parsoid
22720 <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>
22721 !! end
22722
22723 !! test
22724 Conversion rules from [numeric-only string] to [something else] (T48634)
22725 !! options
22726 language=zh variant=zh-cn
22727 !! wikitext
22728 -{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
22729 !! html/php
22730 <p>D12345EE12345
22731 </p>
22732 !! html/parsoid
22733 <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>
22734 !! end
22735
22736 !! test
22737 Two-way converter rule entries with an empty value should be ignored (T53551)
22738 !! options
22739 language=zh variant=zh-cn
22740 !! wikitext
22741 -{H|zh-cn:foo;zh-tw:;}-foobar
22742 !! html/php
22743 <p>foobar
22744 </p>
22745 !! html/parsoid
22746 <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>
22747 !! end
22748
22749 !! test
22750 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22751 !! options
22752 language=zh variant=zh-cn
22753 !! wikitext
22754 -{H|=>zh-cn:foo;}-foobar
22755 !! html/php
22756 <p>foobar
22757 </p>
22758 !! html/parsoid
22759 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22760 !! end
22761
22762 !! test
22763 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22764 !! options
22765 language=zh variant=zh-cn
22766 !! wikitext
22767 -{H|}-foobar
22768 !! html/php
22769 <p>foobar
22770 </p>
22771 !! html/parsoid
22772 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22773 !! end
22774
22775 !! test
22776 Nested using of manual convert syntax
22777 !! options
22778 language=zh variant=zh-hk
22779 !! wikitext
22780 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22781 !! html/php
22782 <p>Nested: Hello Hong Kong!
22783 </p>
22784 !! html/parsoid
22785 <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>
22786 !! end
22787
22788 !! test
22789 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22790 !! options
22791 language=zh variant=zh-cn
22792 !! wikitext
22793 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22794 !! html/php
22795 <p><span title="X">A</span>
22796 </p>
22797 !! html/parsoid
22798 <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>
22799 !! end
22800
22801 !! test
22802 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22803 !! options
22804 language=zh variant=zh-cn
22805 !! wikitext
22806 -{<span title="-{X}-">A</span>}-
22807 !! html/php+disabled
22808 <p><span title="X">A</span>
22809 </p>
22810 !! html/parsoid
22811 <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>
22812 !! end
22813
22814 # Parsoid and PHP disagree on how to parse this example: Parsoid
22815 # insists that the content of a language converter element be a valid
22816 # DOM fragment or attribute string
22817 !! test
22818 Language converter markup with block content
22819 !! options
22820 language=zh variant=zh-cn
22821 !! wikitext
22822 <span>a-{b<div>c}-d
22823
22824 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22825
22826 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22827 !! html/php+tidy
22828 <span>ab<div>cd
22829 <span>ab<div>cd
22830 <span>ad
22831 </span></div></span></div></span>
22832 !! html/parsoid
22833 <span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a<div typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"b&lt;div data-parsoid=&apos;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[10,16,5,0]}&apos;>c&lt;/div>"}}'></div>d
22834
22835 <span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a<div typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"b&lt;div data-parsoid=&apos;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[50,56,5,0]}&apos;>c&lt;/div>"}}'></div>d
22836
22837 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a<meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-cn","t":"x&lt;span data-parsoid=&apos;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[82,89,6,0]}&apos;>y&lt;/span>"},{"f":"0","l":"zh-tw","t":"b&lt;div data-parsoid=&apos;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[100,106,5,0]}&apos;>c&lt;/div>"}]}'/>d</span></p></span></span>
22838 !! end
22839
22840 !! test
22841 LanguageConverter selser (1)
22842 !! options
22843 language=zh variant=zh-cn
22844 parsoid={
22845 "modes": ["wt2wt", "selser"],
22846 "changes": [
22847 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22848 ]
22849 }
22850 !! wikitext
22851 -{raw}-
22852 !! wikitext/edited
22853 -{edited}-
22854 !! end
22855
22856 !! test
22857 LanguageConverter selser (2)
22858 !! options
22859 language=zh variant=zh-cn
22860 parsoid={
22861 "modes": ["wt2wt", "selser"],
22862 "changes": [
22863 ["span[class='x']", "contents", "text", "-{foo}-"],
22864 ["a", "contents", "text", "-{"],
22865 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22866 ]
22867 }
22868 !! wikitext
22869 <span class="x">TEXT1</span>
22870 [http://example.com TEXT2]
22871 [[Foo|TEXT3]]
22872 {{echo|TEXT4}}
22873 !! wikitext/edited
22874 <span class="x"><nowiki>-{foo}-</nowiki></span>
22875 [http://example.com -{]
22876 [[Foo|<nowiki>-{</nowiki>]]
22877 {{1x|<nowiki>-{</nowiki>}}
22878 !! end
22879
22880 # Tests LanguageVariantText in ConstrainedText
22881 !! test
22882 LanguageConverter selser (3)
22883 !! options
22884 language=zh variant=zh-cn
22885 parsoid={
22886 "modes": ["wt2wt", "selser"],
22887 "changes": [
22888 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22889 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22890 ]
22891 }
22892 !! wikitext
22893 {|
22894 |-
22895 |<span>Foo</span>
22896 |}
22897 !! wikitext/edited
22898 {|
22899 |-
22900 |<nowiki/>-{edited}-
22901 |}
22902 !! end
22903
22904 # Tests LanguageVariantText._fromSelSer
22905 !! test
22906 LanguageConverter selser (4)
22907 !! options
22908 language=zh variant=zh-cn
22909 parsoid={
22910 "modes": ["wt2wt", "selser"],
22911 "changes": [
22912 ["td > span.x", "remove"]
22913 ]
22914 }
22915 !! wikitext
22916 {|
22917 |-
22918 |<span class="x">Foo</span>-{Bar}-
22919 ||<span class="x">Foo</span>-{Bar}-
22920 |}
22921 !! wikitext/edited
22922 {|
22923 |-
22924 |<nowiki/>-{Bar}-
22925 ||-{Bar}-
22926 |}
22927 !! end
22928
22929 # Since Parsoid is starting to emit canonical wikitext for links,
22930 # [http://example.com http://example.com] will not RT back to that
22931 # form anymore.
22932 # Parsoid does not language-convert links (it is done in a
22933 # post-processing step)
22934 !! test
22935 Proper conversion of text in external links
22936 !! options
22937 language=sr variant=sr-ec
22938 parsoid=wt2html
22939 !! wikitext
22940 http://www.google.com
22941 gopher://www.google.com
22942 [http://www.google.com http://www.google.com]
22943 [gopher://www.google.com gopher://www.google.com]
22944 [https://www.google.com irc://www.google.com]
22945 [ftp://www.google.com www.google.com/ftp://dir]
22946 [//www.google.com www.google.com]
22947 !! html/php
22948 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22949 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22950 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
22951 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22952 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22953 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22954 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22955 </p>
22956 !! html/parsoid
22957 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22958 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22959 <a rel="mw:ExtLink" class="external text" href="http://www.google.com">http://www.google.com</a>
22960 <a rel="mw:ExtLink" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22961 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
22962 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22963 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
22964 !! end
22965
22966 !! test
22967 Do not convert roman numbers to language variants
22968 !! options
22969 language=sr variant=sr-ec
22970 !! wikitext
22971 Fridrih IV je car.
22972 !! html/php
22973 <p>Фридрих IV је цар.
22974 </p>
22975 !! html/parsoid
22976 <p>Fridrih IV je car.</p>
22977 !! end
22978
22979 !! test
22980 Unclosed language converter markup "-{"
22981 !! options
22982 language=sr
22983 !! wikitext
22984 -{T|hello
22985 !! html
22986 <p>-{T|hello
22987 </p>
22988 !! end
22989
22990 !! test
22991 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22992 !! options
22993 language=sr
22994 !! wikitext
22995 -{R|=&gt;}-
22996 !! html/php
22997 <p>=&gt;
22998 </p>
22999 !! html/parsoid
23000 <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>
23001 !!end
23002
23003 !! test
23004 Don't break link parsing if language converter markup is in the caption.
23005 !! options
23006 language=sr variant=sr-ec
23007 !! wikitext
23008 [[Main Page|-{R|main page}-]]
23009 !! html/php
23010 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
23011 </p>
23012 !! html/parsoid
23013 <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>
23014 !! end
23015
23016 !! test
23017 T146304: Don't break template parsing if language converter markup is in the parameter.
23018 !! options
23019 language=sr variant=sr-ec
23020 !! wikitext
23021 {{echo|-{R|foo}-}}
23022 !! html/php
23023 <p>foo
23024 </p>
23025 !! html/parsoid
23026 <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>
23027 !! end
23028
23029 !! test
23030 T146305: Don't break image parsing if language converter markup is in the caption.
23031 !! options
23032 language=sr
23033 !! wikitext
23034 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
23035 !! html/php
23036 <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>
23037
23038 !! html/parsoid
23039 <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>
23040 !! end
23041
23042 !! test
23043 T146305: Don't break image parsing if nested language converter markup is in the caption.
23044 !! options
23045 language=zh variant=zh-cn
23046 !! wikitext
23047 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
23048 !! html/php
23049 <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>
23050
23051 !! html/parsoid
23052 <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>
23053 !! end
23054
23055 # XXX html2wt disabled because rich markup in alt is not preserved.
23056 !! test
23057 Don't break gallery if language converter markup is inside.
23058 !! options
23059 language=zh
23060 !! wikitext
23061 <gallery>
23062 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
23063 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
23064 </gallery>
23065 !! html/php
23066 <ul class="gallery mw-gallery-traditional">
23067 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23068 <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>
23069 <div class="gallerytext">
23070 <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>
23071 </p>
23072 </div>
23073 </div></li>
23074 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23075 <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>
23076 <div class="gallerytext">
23077 <p>This is a test template
23078 </p>
23079 </div>
23080 </div></li>
23081 </ul>
23082
23083 !! html/parsoid
23084 <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"}}'>
23085 <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>
23086 <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>
23087 </ul>
23088 !! end
23089
23090 !! test
23091 T153135: Don't break list handling if language converter markup is in the item.
23092 !! options
23093 language=zh variant=zh-cn
23094 !! wikitext
23095 ;-{zh-cn:AAA;zh-tw:BBB}-
23096 ;-{R|foo:bar}-
23097 !! html/php
23098 <dl><dt>AAA</dt>
23099 <dt>foo:bar</dt></dl>
23100
23101 !! html/parsoid
23102 <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>
23103 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
23104 </dl>
23105 !! end
23106
23107 // Note that parsoid does not protect colons unless language converter
23108 // markup is properly nested, because it is a backtracking parser.
23109 !! test
23110 T153135: Unclosed markup in definition list (code coverage)
23111 !! options
23112 language=zh variant=zh-cn
23113 !! wikitext
23114 ;<b>foo:bar
23115 ;-{zh-cn:AAA
23116 !! html/php+tidy
23117 <dl><dt><b>foo:bar</b></dt><b>
23118 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
23119 </b></p>
23120 !! html/parsoid
23121 <dl><dt data-parsoid='{}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
23122 <dt data-parsoid='{}'>-{zh-cn</dt><dd data-parsoid='{"stx":"row"}'>AAA</dd></b></dl>
23123 !! end
23124
23125 !! test
23126 T153135: Nested language converter markup in definition list (code coverage)
23127 !! options
23128 language=zh variant=zh-cn
23129 !! wikitext
23130 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
23131 !! html/php
23132 <dl><dt>AAA foo:bar bat:baz</dt>
23133 <dd>def</dd></dl>
23134
23135 !! html/parsoid
23136 <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>
23137 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
23138 </dl>
23139 !! end
23140
23141 # html2wt mode disabled due to <nowiki> insertion.
23142 !! test
23143 T153140: Don't break table handling if language converter markup is in the cell.
23144 !! options
23145 language=sr variant=sr-ec
23146 parsoid=wt2html,wt2wt,html2html
23147 !! wikitext
23148 {|
23149 |-
23150 | -{R|B}-
23151 |}
23152 !! html/php
23153 <table>
23154
23155 <tr>
23156 <td>B
23157 </td></tr></table>
23158
23159 !! html/parsoid
23160 <table>
23161 <tbody>
23162 <tr>
23163 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
23164 </tr>
23165 </tbody>
23166 </table>
23167 !! end
23168
23169 !! test
23170 Language converter tricky html2wt cases (1)
23171 !! options
23172 language=sr
23173 parsoid=html2wt,wt2wt
23174 !! html/parsoid
23175 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
23176 !! wikitext
23177 -{<nowiki>}-</nowiki>}-
23178 !! html/php
23179 <p>&#125;-
23180 </p>
23181 !! end
23182
23183 !! test
23184 Language converter tricky html2wt cases (2)
23185 !! options
23186 language=sr
23187 parsoid=html2wt,wt2wt
23188 !! html/parsoid
23189 <p>-{foo}-</p>
23190 !! wikitext
23191 <nowiki>-{foo}-</nowiki>
23192 !! html/php
23193 <p>-&#123;foo&#125;-
23194 </p>
23195 !! end
23196
23197 !! test
23198 Language converter tricky html2wt cases (3)
23199 !! options
23200 language=sr
23201 parsoid=html2wt,wt2wt
23202 !! html/parsoid
23203 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
23204 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
23205 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
23206 !! wikitext
23207 -{R||}-
23208
23209 -{R|R|raw}-
23210
23211 -{<nowiki>-{foo}-</nowiki>}-
23212 !! html/php
23213 <p>|
23214 </p><p>R|raw
23215 </p><p>-&#123;foo&#125;-
23216 </p>
23217 !! end
23218
23219 !! test
23220 Language converter tricky html2wt cases (4)
23221 !! options
23222 language=sr
23223 parsoid=html2wt,wt2wt
23224 !! html/parsoid
23225 <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>
23226 !! wikitext
23227 -{R|{{echo|hey}}}-
23228 !! html/php
23229 <p>hey
23230 </p>
23231 !! end
23232
23233 # Note that the <nowiki> escaping added by parsoid for source text,
23234 # destination text, and language names only works on the PHP side
23235 # for *destination text*. (HTML entity escaping wouldn't work
23236 # any better.) This is probably a bug, at least for source texts.
23237 # (For language names PHP uses a precise regexp based on the languages
23238 # it currently knows have variants, which is fragile since this set
23239 # can grow/shrink over time.)
23240 !! test
23241 Language converter tricky html2wt cases (5)
23242 !! options
23243 language=zh variant=zh-cn
23244 !! html/parsoid
23245 <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>
23246 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
23247 <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>
23248 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
23249 <p>a:b=>c xyz</p>
23250 !! wikitext
23251 -{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
23252
23253 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
23254
23255 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
23256
23257 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
23258
23259 a:b=>c xyz
23260 !! html/php+disabled
23261 <p>foobat;xyz=&gt;zh-cn:abc
23262 </p><p>A
23263 </p><p>0;zh-tw:bar
23264 </p><p>abc
23265 </p><p>a:b=&gt;c 0;zh-tw:bar
23266 </p>
23267 !! end
23268
23269 !! test
23270 T179579: Nowiki and lc interaction
23271 !! options
23272 parsoid=wt2html
23273 language=sr
23274 !! wikitext
23275 -{</nowiki>123}-
23276
23277 -{123<nowiki>|</nowiki>456}-
23278 !! html/parsoid
23279 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
23280
23281 <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>
23282 !! end
23283
23284 !! test
23285 T2529: Uncovered bullet
23286 !! wikitext
23287 *Foo {{bullet}}
23288 !! html
23289 <ul><li>Foo</li>
23290 <li>Bar</li></ul>
23291
23292 !! end
23293
23294 !! test
23295 T2529: Uncovered bullet in a deeply nested list
23296 !! wikitext
23297 *******Foo {{bullet}}
23298 !! html
23299 <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>
23300 <li>Bar</li></ul>
23301
23302 !! end
23303
23304 !! test
23305 T2529: Uncovered table already at line-start
23306 !! wikitext
23307 x
23308
23309 {{table}}
23310 y
23311 !! html
23312 <p>x
23313 </p>
23314 <table>
23315 <tr>
23316 <td>1</td>
23317 <td>2
23318 </td></tr>
23319 <tr>
23320 <td>3</td>
23321 <td>4
23322 </td></tr></table>
23323 <p>y
23324 </p>
23325 !! end
23326
23327 !! test
23328 T2529: Uncovered bullet in parser function result
23329 !! wikitext
23330 *Foo {{lc:{{bullet}} }}
23331 !! html
23332 <ul><li>Foo</li>
23333 <li>bar</li></ul>
23334
23335 !! end
23336
23337 !! test
23338 T7678: Double-parsed template argument
23339 !! wikitext
23340 {{lc:{{{1}}}|hello}}
23341 !! html
23342 <p>{{{1}}}
23343 </p>
23344 !! end
23345
23346 !! test
23347 T7678: Double-parsed template invocation
23348 !! wikitext
23349 {{lc:{{paramtest {{!}} param = hello }} }}
23350 !! html
23351 <p>{{paramtest | param = hello }}
23352 </p>
23353 !! end
23354
23355 !! test
23356 Case insensitivity of parser functions for non-ASCII characters (T10143)
23357 !! options
23358 language=cs
23359 title=[[Main Page]]
23360 !! wikitext
23361 {{PRVNÍVELKÉ:ěščř}}
23362 {{prvnívelké:ěščř}}
23363 {{PRVNÍMALÉ:ěščř}}
23364 {{prvnímalé:ěščř}}
23365 {{MALÁ:ěščř}}
23366 {{malá:ěščř}}
23367 {{VELKÁ:ěščř}}
23368 {{velká:ěščř}}
23369 !! html
23370 <p>Ěščř
23371 Ěščř
23372 ěščř
23373 ěščř
23374 ěščř
23375 ěščř
23376 ĚŠČŘ
23377 ĚŠČŘ
23378 </p>
23379 !! end
23380
23381 !! test
23382 Morwen/13: Unclosed link followed by heading
23383 !! wikitext
23384 [[link
23385 ==heading==
23386 !! html
23387 <p>[[link
23388 </p>
23389 <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>
23390
23391 !! end
23392
23393 !! test
23394 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23395 !! wikitext
23396 {{foo|
23397 =heading=
23398 !! html
23399 <p>{{foo|
23400 </p>
23401 <h1><span class="mw-headline" id="heading">heading</span></h1>
23402
23403 !! end
23404
23405 !! test
23406 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23407 !! wikitext
23408 {{foo|
23409 ==heading==
23410 !! html
23411 <p>{{foo|
23412 </p>
23413 <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>
23414
23415 !! end
23416
23417 !! test
23418 Tildes in comments
23419 !! options
23420 pst
23421 !! wikitext
23422 <!-- ~~~~ -->
23423 !! html/php
23424 <!-- ~~~~ -->
23425 !! end
23426
23427 !! test
23428 Paragraphs inside divs (no extra line breaks)
23429 !! wikitext
23430 <div>Line one
23431
23432 Line two</div>
23433 !! html
23434 <div>Line one
23435 Line two</div>
23436
23437 !! end
23438
23439 !! test
23440 Paragraphs inside divs (extra line break on open)
23441 !! wikitext
23442 <div>
23443 Line one
23444
23445 Line two</div>
23446 !! html
23447 <div>
23448 <p>Line one
23449 </p>
23450 Line two</div>
23451
23452 !! end
23453
23454 !! test
23455 Paragraphs inside divs (extra line break on close)
23456 !! wikitext
23457 <div>Line one
23458
23459 Line two
23460 </div>
23461 !! html
23462 <div>Line one
23463 <p>Line two
23464 </p>
23465 </div>
23466
23467 !! end
23468
23469 !! test
23470 Paragraphs inside divs (extra line break on open and close)
23471 !! wikitext
23472 <div>
23473 Line one
23474
23475 Line two
23476 </div>
23477 !! html
23478 <div>
23479 <p>Line one
23480 </p><p>Line two
23481 </p>
23482 </div>
23483
23484 !! end
23485
23486 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23487 !! test
23488 Nesting tags, paragraphs on lines which begin with <div>
23489 !! wikitext
23490 <div></div><strong>A
23491 B</strong>
23492 !! html/php+tidy
23493 <div></div><p><strong>A
23494 </strong></p><strong></strong><p><strong>B</strong>
23495 </p>
23496 !! html/parsoid
23497 <div data-parsoid='{"stx":"html"}'></div><p><strong data-parsoid='{"stx":"html","autoInsertedEnd":true}'>A</strong></p>
23498 <p><strong data-parsoid='{"stx":"html","autoInsertedStart":true}'>B</strong></p>
23499 !! end
23500
23501 # T8200: <blockquote> should behave like <div> with respect to line breaks
23502 !! test
23503 T8200: paragraphs inside blockquotes (no extra line breaks)
23504 !! options
23505 parsoid=wt2html,html2html
23506 !! wikitext
23507 <blockquote>Line one
23508
23509 Line two</blockquote>
23510 !! html
23511 <blockquote>Line one
23512 Line two</blockquote>
23513
23514 !! html+tidy
23515 <blockquote><p>Line one
23516 Line two</p></blockquote>
23517 !! end
23518
23519 !! test
23520 T8200: paragraphs inside blockquotes (extra line break on open)
23521 !! options
23522 parsoid=wt2html,html2html
23523 !! wikitext
23524 <blockquote>
23525 Line one
23526
23527 Line two</blockquote>
23528 !! html
23529 <blockquote>
23530 <p>Line one
23531 </p>
23532 Line two</blockquote>
23533
23534 !! html+tidy
23535 <blockquote>
23536 <p>Line one
23537 </p><p>
23538 Line two</p></blockquote>
23539 !! end
23540
23541 !! test
23542 T8200: paragraphs inside blockquotes (extra line break on close)
23543 !! options
23544 parsoid=wt2html,html2html
23545 !! wikitext
23546 <blockquote>Line one
23547
23548 Line two
23549 </blockquote>
23550 !! html
23551 <blockquote>Line one
23552 <p>Line two
23553 </p>
23554 </blockquote>
23555
23556 !! html+tidy
23557 <blockquote><p>Line one
23558 </p><p>Line two
23559 </p>
23560 </blockquote>
23561 !! end
23562
23563 !! test
23564 T8200: paragraphs inside blockquotes (extra line break on open and close)
23565 !! wikitext
23566 <blockquote>
23567 Line one
23568
23569 Line two
23570 </blockquote>
23571 !! html
23572 <blockquote>
23573 <p>Line one
23574 </p><p>Line two
23575 </p>
23576 </blockquote>
23577
23578 !! end
23579
23580 ## This is a corner case interaction between the paragraph wrapping in the
23581 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
23582 ## some tags which close paragraphs (and thus prevent wrapping on their line),
23583 ## of which "div" is one, but do p-wrapping inside them. These are referred
23584 ## to as "never suppressing". Remex, for its part, doesn't traverse into
23585 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
23586 !! test
23587 Paragraphs inside blockquotes/divs (no extra line breaks)
23588 !! wikitext
23589 <blockquote><div>Line one
23590
23591 Line two</div></blockquote>
23592 !! html
23593 <blockquote><div>Line one
23594 Line two</div></blockquote>
23595
23596 !! end
23597
23598 !! test
23599 Paragraphs inside blockquotes/divs (extra line break on open)
23600 !! wikitext
23601 <blockquote><div>
23602 Line one
23603
23604 Line two</div></blockquote>
23605 !! html
23606 <blockquote><div>
23607 <p>Line one
23608 </p>
23609 Line two</div></blockquote>
23610
23611 !! end
23612
23613 !! test
23614 Paragraphs inside blockquotes/divs (extra line break on close)
23615 !! wikitext
23616 <blockquote><div>Line one
23617
23618 Line two
23619 </div></blockquote>
23620 !! html
23621 <blockquote><div>Line one
23622 <p>Line two
23623 </p>
23624 </div></blockquote>
23625
23626 !! end
23627
23628 !! test
23629 Paragraphs inside blockquotes/divs (extra line break on open and close)
23630 !! wikitext
23631 <blockquote><div>
23632 Line one
23633
23634 Line two
23635 </div></blockquote>
23636 !! html
23637 <blockquote><div>
23638 <p>Line one
23639 </p><p>Line two
23640 </p>
23641 </div></blockquote>
23642
23643 !! end
23644
23645 !! test
23646 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23647 !! options
23648 wgLinkHolderBatchSize=0
23649 !! wikitext
23650 [[meatball:1]]
23651 [[meatball:2]]
23652 [[meatball:3]]
23653 !! html
23654 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23655 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23656 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23657 </p>
23658 !! end
23659
23660 !! test
23661 Free external link invading image caption
23662 !! wikitext
23663 [[Image:Foobar.jpg|thumb|http://x|hello]]
23664 !! html/php
23665 <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>
23666
23667 !! html/parsoid
23668 <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>
23669 !! end
23670
23671 !! test
23672 T17196: localised external link numbers
23673 !! options
23674 language=fa
23675 !! wikitext
23676 [http://en.wikipedia.org/]
23677 !! html/php
23678 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23679 </p>
23680 !! html/parsoid
23681 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23682 !! end
23683
23684 !! test
23685 Multibyte character in padleft
23686 !! wikitext
23687 {{padleft:-Hello|7|Æ}}
23688 !! html/php
23689 <p>Æ-Hello
23690 </p>
23691 !! html/parsoid
23692 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23693 !! end
23694
23695 !! test
23696 Multibyte character in padright
23697 !! wikitext
23698 {{padright:Hello-|7|Æ}}
23699 !! html/php
23700 <p>Hello-Æ
23701 </p>
23702 !! html/parsoid
23703 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23704 !! end
23705
23706 !!test
23707 formatdate parser function
23708 !! wikitext
23709 {{#formatdate:2009-03-24}}
23710 !! html
23711 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23712 </p>
23713 !! end
23714
23715 !!test
23716 formatdate parser function, with default format
23717 !! wikitext
23718 {{#formatdate:2009-03-24|mdy}}
23719 !! html
23720 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23721 </p>
23722 !! end
23723
23724 !! test
23725 Spacing of numbers in formatted dates
23726 !! wikitext
23727 {{#formatdate:January 15}}
23728 !! html
23729 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23730 </p>
23731 !! end
23732
23733 !! test
23734 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
23735 !! options
23736 language=nl title=[[MediaWiki:Common.css]]
23737 !! wikitext
23738 {{#formatdate:2009-03-24|dmy}}
23739 !! html
23740 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23741 </p>
23742 !! end
23743
23744 #
23745 #
23746 #
23747
23748 #
23749 # Edit comments
23750 #
23751
23752 !! test
23753 Edit comment with link
23754 !! options
23755 comment
23756 !! wikitext
23757 I like the [[Main Page]] a lot
23758 !! html/php
23759 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23760 !!end
23761
23762 !! test
23763 Edit comment with link and link text
23764 !! options
23765 comment
23766 !! wikitext
23767 I like the [[Main Page|best pages]] a lot
23768 !! html/php
23769 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23770 !!end
23771
23772 !! test
23773 Edit comment with link and link text with suffix
23774 !! options
23775 comment
23776 !! wikitext
23777 I like the [[Main Page|best page]]s a lot
23778 !! html/php
23779 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23780 !!end
23781
23782 !! test
23783 Edit comment with section link (non-local, eg in history list)
23784 !! options
23785 comment title=[[Main Page]]
23786 !! wikitext
23787 /* External links */ removed bogus entries
23788 !! html/php
23789 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23790 !!end
23791
23792 !! test
23793 Edit comment with section link and text before it (non-local, eg in history list)
23794 !! options
23795 comment title=[[Main Page]]
23796 !! wikitext
23797 pre-comment text /* External links */ removed bogus entries
23798 !! html/php
23799 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>
23800 !!end
23801
23802 !! test
23803 Edit comment with section link (local, eg in diff view)
23804 !! options
23805 comment local title=[[Main Page]]
23806 !! wikitext
23807 /* External links */ removed bogus entries
23808 !! html/php
23809 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23810 !!end
23811
23812 !! test
23813 Edit comment with subpage link (T16080)
23814 !! options
23815 comment
23816 subpage
23817 title=[[Subpage test]]
23818 !! wikitext
23819 Poked at a [[/subpage]] here...
23820 !! html/php
23821 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23822 !!end
23823
23824 !! test
23825 Edit comment with subpage link and link text (T16080)
23826 !! options
23827 comment
23828 subpage
23829 title=[[Subpage test]]
23830 !! wikitext
23831 Poked at a [[/subpage|neat little page]] here...
23832 !! html/php
23833 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23834 !!end
23835
23836 !! test
23837 Edit comment with bogus subpage link in non-subpage NS (T16080)
23838 !! options
23839 comment
23840 title=[[Subpage test]]
23841 !! wikitext
23842 Poked at a [[/subpage]] here...
23843 !! html/php
23844 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...
23845 !!end
23846
23847 !! test
23848 Edit comment with bare anchor link (local, as on diff)
23849 !! options
23850 comment
23851 local
23852 title=[[Main Page]]
23853 !! wikitext
23854 [[#section]]
23855 !! html/php
23856 <a href="#section">#section</a>
23857 !! end
23858
23859 !! test
23860 Edit comment with bare anchor link (non-local, as on history)
23861 !! options
23862 comment
23863 title=[[Main Page]]
23864 !! wikitext
23865 [[#section]]
23866 !! html/php
23867 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23868 !! end
23869
23870 !! test
23871 Anchor starting with underscore
23872 !! options
23873 title=[[Foo]]
23874 !! wikitext
23875 [[#_ref|One]]
23876 !! html/php
23877 <p><a href="#_ref">One</a>
23878 </p>
23879 !! html/parsoid
23880 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23881 !! end
23882
23883 !! test
23884 Id starting with underscore
23885 !! wikitext
23886 <div id="_ref"></div>
23887 !! html/*
23888 <div id="_ref"></div>
23889
23890 !! end
23891
23892 !! test
23893 Edit comment with link with more than one pipe (T99346)
23894 !! options
23895 comment
23896 !! wikitext
23897 [[Main Page|Many|pipes]]
23898 !! html/php
23899 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23900 !! end
23901
23902 !! test
23903 Complex edit comment with link with more than one pipe (T99346)
23904 !! options
23905 comment
23906 !! wikitext
23907 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23908 !! html/php
23909 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;
23910 !! end
23911
23912 !! test
23913 Space normalisation on autocomment (T24784)
23914 !! options
23915 comment
23916 title=[[Main Page]]
23917 !! wikitext
23918 /* __hello__world__ */
23919 !! html/php
23920 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23921 !! end
23922
23923 !! test
23924 percent-encoding and + signs in comments (T28410)
23925 !! options
23926 comment
23927 !! wikitext
23928 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23929 !! html/php
23930 <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>
23931 !! end
23932
23933 # Parsoid doesn't support this yet: see T75581
23934 # but it *should* omit the 'src' attribute if the image is bad.
23935 # PHP side of tests was disabled in
23936 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23937 # because of issues in the PHP parserTests infrastructure
23938 # (but the output below is indeed what the PHP side emits)
23939 !! test
23940 Bad images - basic functionality
23941 !! wikitext
23942 [[File:Bad.jpg]]
23943 !! html/php+disabled
23944 !! html/parsoid
23945 <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>
23946 !! end
23947
23948 !! test
23949 Bad images - T18039: text after bad image disappears
23950 !! wikitext
23951 Foo bar
23952 [[File:Bad.jpg]]
23953 Bar foo
23954 !! html/php+disabled
23955 <p>Foo bar
23956 </p><p>Bar foo
23957 </p>
23958 !! html/parsoid
23959 <p>Foo bar
23960 <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>
23961 Bar foo</p>
23962 !! end
23963
23964 !! test
23965 Verify that displaytitle works (T24501) no displaytitle
23966 !! options
23967 showtitle
23968 !! config
23969 wgAllowDisplayTitle=true
23970 wgRestrictDisplayTitle=false
23971 !! wikitext
23972 this is not the the title
23973 !! html/php
23974 Parser test
23975 <p>this is not the the title
23976 </p>
23977 !! end
23978
23979 !! test
23980 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23981 !! options
23982 showtitle
23983 title=[[Screen]]
23984 !! config
23985 wgAllowDisplayTitle=true
23986 wgRestrictDisplayTitle=false
23987 !! wikitext
23988 this is not the the title
23989 {{DISPLAYTITLE:whatever}}
23990 !! html/php
23991 whatever
23992 <p>this is not the the title
23993 </p>
23994 !! end
23995
23996 !! test
23997 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23998 !! options
23999 showtitle
24000 title=[[Screen]]
24001 !! config
24002 wgAllowDisplayTitle=true
24003 wgRestrictDisplayTitle=true
24004 !! wikitext
24005 this is not the the title
24006 {{DISPLAYTITLE:whatever}}
24007 !! html/php
24008 Screen
24009 <p>this is not the the title
24010 </p>
24011 !! end
24012
24013 !! test
24014 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
24015 !! options
24016 showtitle
24017 title=[[Screen]]
24018 !! config
24019 wgAllowDisplayTitle=true
24020 wgRestrictDisplayTitle=true
24021 !! wikitext
24022 this is not the the title
24023 {{DISPLAYTITLE:screen}}
24024 !! html/php
24025 screen
24026 <p>this is not the the title
24027 </p>
24028 !! end
24029
24030 !! test
24031 Verify that displaytitle works (T24501) AllowDisplayTitle=false
24032 !! options
24033 showtitle
24034 title=[[Screen]]
24035 !! config
24036 wgAllowDisplayTitle=false
24037 !! wikitext
24038 this is not the the title
24039 {{DISPLAYTITLE:screen}}
24040 !! html/php
24041 Screen
24042 <p>this is not the the title
24043 <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>
24044 </p>
24045 !! end
24046
24047 !! test
24048 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
24049 !! options
24050 showtitle
24051 title=[[Screen]]
24052 !! config
24053 wgAllowDisplayTitle=false
24054 !! wikitext
24055 this is not the the title
24056 !! html/php
24057 Screen
24058 <p>this is not the the title
24059 </p>
24060 !! end
24061
24062 !! test
24063 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
24064 !! options
24065 showtitle
24066 title=[[Screen]]
24067 !! config
24068 wgAllowDisplayTitle=true
24069 wgRestrictDisplayTitle=true
24070 !! wikitext
24071 this is not the the title
24072 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
24073 !! html/php
24074 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
24075 <p>this is not the the title
24076 </p>
24077 !! end
24078
24079 !! test
24080 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
24081 !! options
24082 showtitle
24083 title=[[Screen]]
24084 !! config
24085 wgAllowDisplayTitle=true
24086 wgRestrictDisplayTitle=true
24087 !! wikitext
24088 this is not the the title
24089 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
24090 !! html/php
24091 <span style="color: red;">s</span>creen
24092 <p>this is not the the title
24093 </p>
24094 !! end
24095
24096 !! test
24097 Page status indicators: Empty name is invalid
24098 !! options
24099 showindicators
24100 !! wikitext
24101 <indicator name=" "></indicator>
24102 <indicator></indicator>
24103 !! html/php
24104 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24105 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24106 </p>
24107 !! end
24108
24109 !! test
24110 Page status indicators: Weird syntaxes that are okay
24111 !! options
24112 showindicators
24113 !! wikitext
24114 <indicator name="empty" />
24115 <indicator name="name"></indicator>
24116 !! html/php
24117 empty=
24118 name=
24119 <p><br />
24120 </p>
24121 !! end
24122
24123 !! test
24124 Page status indicators: Torture test
24125 !! options
24126 showindicators
24127 !! wikitext
24128 <indicator name="01">hello world</indicator>
24129 <indicator name="02">[[Main Page]]</indicator>
24130 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
24131 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
24132 <indicator name="05">*foo
24133 *bar</indicator>
24134 <indicator name="06"><nowiki>foo</nowiki></indicator>
24135 <indicator name="07"> Preformatted</indicator>
24136 <indicator name="08"><div>Broken tag</indicator>
24137 <indicator name="09">{| class=wikitable
24138 |cell
24139 |}</indicator>
24140 <indicator name="10">Two
24141
24142 paragraphs</indicator>
24143 !! html/php
24144 01=hello world
24145 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
24146 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" />
24147 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>
24148 05=<ul><li>foo</li>
24149 <li>bar</li></ul>
24150
24151 06=foo
24152 07=<pre>Preformatted
24153 </pre>
24154 08=<div>Broken tag</div>
24155
24156 09=<table class="wikitable">
24157 <tr>
24158 <td>cell
24159 </td></tr></table>
24160
24161 10=<p>Two
24162 </p><p>paragraphs
24163 </p>
24164 <p><br />
24165 </p><p><br />
24166 </p><p><br />
24167 </p><p><br />
24168 </p><p><br />
24169 </p>
24170 !! end
24171
24172 !! test
24173 preload: check <noinclude> and <includeonly>
24174 !! options
24175 preload
24176 !! wikitext
24177 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
24178 !! html/php
24179 Hello kind world.
24180 !! end
24181
24182 !! test
24183 preload: check <onlyinclude>
24184 !! options
24185 preload
24186 !! wikitext
24187 Goodbye <onlyinclude>Hello world</onlyinclude>
24188 !! html/php
24189 Hello world
24190 !! end
24191
24192 !! test
24193 preload: can pass tags through if we want to
24194 !! options
24195 preload
24196 !! wikitext
24197 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
24198 !! html/php
24199 <includeonly>Hello world</includeonly>
24200 !! end
24201
24202 !! test
24203 preload: check that it doesn't try to do tricks
24204 !! options
24205 preload
24206 !! wikitext
24207 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24208 !! html/php
24209 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24210 !! end
24211
24212 !! test
24213 Play a bit with r67090 and T5158
24214 !! wikitext
24215 <div style="width:50% !important">&nbsp;</div>
24216 <div style="width:50%&nbsp;!important">&nbsp;</div>
24217 <div style="width:50%&#160;!important">&nbsp;</div>
24218 <div style="border : solid;">&nbsp;</div>
24219 !! html/php
24220 <div style="width:50% !important">&#160;</div>
24221 <div style="width:50% !important">&#160;</div>
24222 <div style="width:50% !important">&#160;</div>
24223 <div style="border&#32;: solid;">&#160;</div>
24224
24225 !! html/parsoid
24226 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24227 <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>
24228 <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>
24229 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24230
24231 !! end
24232
24233 !! test
24234 French spaces in wikitext
24235 !! wikitext
24236 foo ! bar ? bat 50 % is less than 75 %.
24237
24238 Hello : this ; is « something ‹ else › again »
24239 !! html
24240 <p>foo&#160;! bar&#160;? bat 50&#160;% is less than 75&#160;%.
24241 </p><p>Hello&#160;: this&#160;; is «&#160;something ‹&#160;else&#160;› again&#160;»
24242 </p>
24243 !! end
24244
24245 # It would be reasonable for Parsoid and PHP to differ here.
24246 # The PHP behavior is arguably a bug.
24247 !! test
24248 Corner case: french spaces in definition list
24249 !! wikitext
24250 ;foo : bar
24251 !! html+tidy
24252 <dl><dt>foo&#160;</dt>
24253 <dd>bar</dd></dl>
24254 !! end
24255
24256 !! test
24257 T5158: Test for French spaces in attributes
24258 !! wikitext
24259 <br style=" clear : both ; " />
24260 !! html/php
24261 <p><br style="clear&#32;: both&#32;;" />
24262 </p>
24263 !! end
24264
24265 !! test
24266 HTML5 data attributes
24267 !! wikitext
24268 <span data-foo="bar">Baz</span>
24269 <p data-abc-def_hij="">Quuz</p>
24270 !! html/php
24271 <p><span data-foo="bar">Baz</span>
24272 </p>
24273 <p data-abc-def_hij="">Quuz</p>
24274
24275 !! html/parsoid
24276 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
24277 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
24278 !! end
24279
24280 !! test
24281 Strip reserved data attributes
24282 !! wikitext
24283 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
24284 !! html/php
24285 <div data-ok="fred">d</div>
24286
24287 !! html/parsoid
24288 <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>
24289 !! end
24290
24291 !! test
24292 percent-encoding and + signs in internal links (T28410)
24293 !! wikitext
24294 [[User:+%]] [[Page+title%]]
24295 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
24296 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
24297 [[%33%45]] [[%33%45+]]
24298 !! html/php
24299 <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>
24300 <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>
24301 <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>
24302 <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>
24303 </p>
24304 !! html/parsoid
24305 <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>
24306 <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>
24307 <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>
24308 <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>
24309 !! end
24310
24311 !! test
24312 Special characters in embedded file links (T29679)
24313 !! wikitext
24314 [[File:Contains & ampersand.jpg]]
24315 [[File:Does not exist.jpg|Title with & ampersand]]
24316 !! html/php
24317 <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>
24318 <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>
24319 </p>
24320 !! html/parsoid
24321 <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>
24322 <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>
24323 !! end
24324
24325 !! test
24326 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
24327 !! wikitext
24328 Text&apos;s been normalized?
24329 !! html
24330 <p>Text&#39;s been normalized?
24331 </p>
24332 !! end
24333
24334 !! test
24335 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
24336 !! wikitext
24337 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
24338 !! html
24339 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
24340 </p>
24341 !! end
24342
24343 !! test
24344 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
24345 !! wikitext
24346 [http://www.example.org/ ideograms]
24347 !! html
24348 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
24349 </p>
24350 !! end
24351
24352 !! test
24353 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
24354 !! wikitext
24355 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
24356 !! html
24357 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
24358 </p>
24359 !! end
24360
24361 !! article
24362 Mediawiki:loop1
24363 !! text
24364 {{Identical|A}}
24365 !! endarticle
24366
24367 !! article
24368 Mediawiki:loop2
24369 !! text
24370 {{Identical|B}}
24371 !! endarticle
24372
24373 !! article
24374 Template:Identical
24375 !! text
24376 {{int:loop1}}
24377 {{int:loop2}}
24378 !! endarticle
24379
24380 !! test
24381 T33098 Template which includes system messages which includes the template
24382 !! wikitext
24383 {{Identical}}
24384 !! html
24385 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24386 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24387 </p>
24388 !! end
24389
24390 !! test
24391 T33490 Turkish: ucfirst 'blah'
24392 !! options
24393 language=tr
24394 !! wikitext
24395 {{ucfirst:blah}}
24396 !! html
24397 <p>Blah
24398 </p>
24399 !! end
24400
24401 !! test
24402 T33490 Turkish: ucfirst 'ix'
24403 !! options
24404 language=tr
24405 !! wikitext
24406 {{ucfirst:ix}}
24407 !! html
24408 <p>İx
24409 </p>
24410 !! end
24411
24412 !! test
24413 T33490 Turkish: lcfirst 'BLAH'
24414 !! options
24415 language=tr
24416 !! wikitext
24417 {{lcfirst:BLAH}}
24418 !! html
24419 <p>bLAH
24420 </p>
24421 !! end
24422
24423 !! test
24424 T33490 Turkish: ucfırst (with a dotless i)
24425 !! options
24426 language=tr
24427 !! wikitext
24428 {{ucfırst:blah}}
24429 !! html
24430 <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>
24431 </p>
24432 !! end
24433
24434 !! test
24435 T33490 ucfırst (with a dotless i) with English language
24436 !! options
24437 language=en
24438 !! wikitext
24439 {{ucfırst:blah}}
24440 !! html
24441 <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>
24442 </p>
24443 !! end
24444
24445 # Note that Parsoid doesn't emit an explicit TOC.
24446 # Note also that the html2wt direction tends to emit an extra newline
24447 # between the __TOC__ magicword and the first heading unless *both*
24448 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24449 # it's "{}").
24450
24451 !! test
24452 T28375: TOC with italics
24453 !! options
24454 title=[[Main Page]]
24455 !! wikitext
24456 __TOC__
24457 ==''Lost'' episodes==
24458 !! html/php
24459 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
24460 <ul>
24461 <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>
24462 </ul>
24463 </div>
24464
24465 <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>
24466
24467 !! html/parsoid
24468 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24469 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24470 !! end
24471
24472 !! test
24473 T28375: TOC with bold
24474 !! options
24475 title=[[Main Page]]
24476 !! wikitext
24477 __TOC__
24478 =='''should be bold''' then normal text==
24479 !! html/php
24480 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
24481 <ul>
24482 <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>
24483 </ul>
24484 </div>
24485
24486 <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>
24487
24488 !! html/parsoid
24489 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24490 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24491 !! end
24492
24493 !! test
24494 T35845: Headings become cursive in TOC when they contain an image
24495 !! options
24496 title=[[Main Page]]
24497 !! wikitext
24498 __TOC__
24499 ==Image [[Image:foobar.jpg]]==
24500 !! html/php
24501 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
24502 <ul>
24503 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24504 </ul>
24505 </div>
24506
24507 <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>
24508
24509 !! html/parsoid
24510 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24511 <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>
24512 !! end
24513
24514 !! test
24515 T35845 (2): Headings become bold in TOC when they contain a blockquote
24516 !! options
24517 title=[[Main Page]]
24518 !! wikitext
24519 __TOC__
24520 ==<blockquote>Quote</blockquote>==
24521 !! html/php
24522 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
24523 <ul>
24524 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24525 </ul>
24526 </div>
24527
24528 <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>
24529
24530 !! html/php+tidy
24531 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
24532 <ul>
24533 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24534 </ul>
24535 </div>
24536
24537 <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>
24538 !! html/parsoid
24539 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24540 <h2 id="Quote" data-parsoid='{}'><blockquote><p>Quote</p></blockquote></h2>
24541 !! end
24542
24543 !! test
24544 Unclosed tags in TOC
24545 !! config
24546 wgFragmentMode=[ 'html5', 'legacy' ]
24547 !! options
24548 title=[[Main Page]]
24549 !! wikitext
24550 __TOC__
24551 ==Proof: 2 < 3==
24552 <small>Hanc marginis exiguitas non caperet.</small>
24553 QED
24554 !! html/php
24555 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
24556 <ul>
24557 <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>
24558 </ul>
24559 </div>
24560
24561 <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>
24562 <p><small>Hanc marginis exiguitas non caperet.</small>
24563 QED
24564 </p>
24565 !! html/parsoid
24566 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24567 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24568 <p><small>Hanc marginis exiguitas non caperet.</small>
24569 QED</p>
24570 !! end
24571
24572 !! test
24573 Multiple tags in TOC
24574 !! wikitext
24575 __TOC__
24576 ==<i>Foo</i> <b>Bar</b>==
24577
24578 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24579 !! html/php
24580 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
24581 <ul>
24582 <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>
24583 <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>
24584 </ul>
24585 </div>
24586
24587 <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>
24588 <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>
24589
24590 !! html/php+tidy
24591 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
24592 <ul>
24593 <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>
24594 <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>
24595 </ul>
24596 </div>
24597
24598 <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>
24599 <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>
24600 !! html/parsoid
24601 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24602 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
24603
24604 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote><p>Bar</p></blockquote></h2>
24605 !! end
24606
24607 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24608 # html5 tag parsing.
24609 !! test
24610 Tags with parameters in TOC
24611 !! options
24612 parsoid=wt2html
24613 !! wikitext
24614 __TOC__
24615 ==<sup class="in-h2">Hello</sup>==
24616
24617 ==<sup class="a > b">Evilbye</sup>==
24618 !! html/php
24619 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
24620 <ul>
24621 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24622 <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>
24623 </ul>
24624 </div>
24625
24626 <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>
24627 <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>
24628
24629 !! html/parsoid
24630 <meta property="mw:PageProp/toc" />
24631 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
24632
24633 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
24634 !! end
24635
24636 !! test
24637 span tags with directionality in TOC
24638 !! wikitext
24639 __TOC__
24640 ==<span dir="ltr">C++</span>==
24641
24642 ==<span dir="rtl">זבנג!</span>==
24643
24644 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
24645
24646 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
24647
24648 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
24649 !! html/php
24650 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
24651 <ul>
24652 <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>
24653 <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>
24654 <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>
24655 <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>
24656 <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>
24657 </ul>
24658 </div>
24659
24660 <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>
24661 <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>
24662 <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>
24663 <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>
24664 <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>
24665
24666 !! html/parsoid
24667 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24668 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
24669 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
24670 <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>
24671 <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>
24672 <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>
24673 !! end
24674
24675 !! test
24676 T74884: bdi element in ToC
24677 !! wikitext
24678 __TOC__
24679 ==<bdi>test</bdi>==
24680 !! html/php
24681 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
24682 <ul>
24683 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24684 </ul>
24685 </div>
24686
24687 <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>
24688
24689 !! html/parsoid
24690 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24691 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
24692 !! end
24693
24694 !! test
24695 T35715: s/strike element in ToC
24696 !! wikitext
24697 __TOC__
24698 ==<s>test</s> test <strike>test</strike>==
24699 !! html/php
24700 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
24701 <ul>
24702 <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>
24703 </ul>
24704 </div>
24705
24706 <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>
24707
24708 !! html/parsoid
24709 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24710 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
24711 !! end
24712
24713 !! test
24714 T198618: style element in ToC
24715 !! options
24716 styletag=1
24717 !! wikitext
24718 __TOC__
24719 ==<style>.foo {}</style>Style<style>.bar {}</style>==
24720 !! html/php
24721 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
24722 <ul>
24723 <li class="toclevel-1 tocsection-1"><a href="#Style"><span class="tocnumber">1</span> <span class="toctext">Style</span></a></li>
24724 </ul>
24725 </div>
24726
24727 <h2><span class="mw-headline" id="Style"><style>.foo {}</style>Style<style>.bar {}</style></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Style">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
24728
24729 !! html/parsoid
24730 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24731 <h2 id="Style" data-parsoid='{}'><style>.foo {}</style>Style<style>.bar {}</style></h2>
24732 !! end
24733
24734 !! test
24735 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24736 !! wikitext
24737 __TOC__
24738 ==x==
24739 !! html/php
24740 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
24741 <ul>
24742 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24743 </ul>
24744 </div>
24745
24746 <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>
24747
24748 !! html/parsoid
24749 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24750 <h2 id="x" data-parsoid='{}'>x</h2>
24751 !! end
24752
24753 !! article
24754 MediaWiki:T34057
24755 !! text
24756 == {{int:headline_sample}} ==
24757 !! endarticle
24758
24759 !! test
24760 T34057: Title needed when expanding <h> nodes.
24761 !! options
24762 title=[[Main Page]]
24763 !! wikitext
24764 {{int:T34057}}
24765 !! html
24766 <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>
24767
24768 !! end
24769
24770 !! test
24771 Strip marker in urlencode
24772 !! wikitext
24773 {{urlencode:x<nowiki/>y}}
24774 {{urlencode:x<nowiki/>y|wiki}}
24775 {{urlencode:x<nowiki/>y|path}}
24776 {{urlencode:x<pre id="one">two</pre>y}}
24777 !! html/php
24778 <p>xy
24779 xy
24780 xy
24781 xy
24782 </p>
24783 !! end
24784
24785 !! test
24786 Strip marker in lc
24787 !! wikitext
24788 {{lc:x<nowiki/>y}}
24789 !! html
24790 <p>xy
24791 </p>
24792 !! end
24793
24794 !! test
24795 Strip marker in uc
24796 !! wikitext
24797 {{uc:x<nowiki/>y}}
24798 !! html
24799 <p>XY
24800 </p>
24801 !! end
24802
24803 !! test
24804 Strip marker in formatNum
24805 !! wikitext
24806 {{formatnum:1<nowiki/>2}}
24807 {{formatnum:1<nowiki/>2|R}}
24808 !! html
24809 <p>12
24810 12
24811 </p>
24812 !! end
24813
24814 !! test
24815 Check noCommafy in formatNum
24816 !! options
24817 language=be-tarask
24818 !! wikitext
24819 {{formatnum:123456.78}}
24820 {{formatnum:123456.78|NOSEP}}
24821 !! html
24822 <p>123 456,78
24823 123456.78
24824 </p>
24825 !! end
24826
24827 !! test
24828 Wrong option for formatNum (T58199)
24829 !! wikitext
24830 {{formatnum:1,234.56|Random}}
24831 {{formatnum:1,234.56|EVERYTHING}}
24832 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24833 !! html
24834 <p>1,234.56
24835 1,234.56
24836 1,234.56
24837 </p>
24838 !! end
24839
24840 !! test
24841 Strip marker in grammar
24842 !! options
24843 language=fi
24844 !! wikitext
24845 {{grammar:elative|foo<nowiki/>bar}}
24846 !! html
24847 <p>foobarista
24848 </p>
24849 !! end
24850
24851 !! test
24852 Strip marker in padleft
24853 !! wikitext
24854 {{padleft:|2|x<nowiki/>y}}
24855 !! html
24856 <p>xy
24857 </p>
24858 !! end
24859
24860 !! test
24861 Strip marker in padright
24862 !! wikitext
24863 {{padright:|2|x<nowiki/>y}}
24864 !! html
24865 <p>xy
24866 </p>
24867 !! end
24868
24869 !! test
24870 Strip marker in anchorencode
24871 !! wikitext
24872 {{anchorencode:x<nowiki/>y}}
24873 !! html/php
24874 <p>xy
24875 </p>
24876 !! html/parsoid
24877 <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>
24878 !! end
24879
24880 !! test
24881 nowiki inside link inside heading (T20295)
24882 !! wikitext
24883 ==[[foo|x<nowiki>y</nowiki>z]]==
24884 !! html
24885 <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>
24886
24887 !! end
24888
24889 !! test
24890 new support for bdi element (T33817)
24891 !! wikitext
24892 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24893 !! html
24894 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24895
24896 !!end
24897
24898 !! test
24899 Ignore pipe between table row attributes
24900 !! wikitext
24901 {|
24902 |quux
24903 |- id=foo | style='color: red'
24904 |bar
24905 |}
24906 !! html
24907 <table>
24908 <tr>
24909 <td>quux
24910 </td></tr>
24911 <tr id="foo" style="color: red">
24912 <td>bar
24913 </td></tr></table>
24914
24915 !! end
24916
24917 !!test
24918 Language parser function
24919 !! wikitext
24920 {{#language:ar}}
24921 !! html
24922 <p>العربية
24923 </p>
24924 !! end
24925
24926 !!test
24927 Padleft and padright (default 0-padding)
24928 !! wikitext
24929 {{padleft:xyz|5}}
24930 {{padright:xyz|5}}
24931 !! html/php
24932 <p>00xyz
24933 xyz00
24934 </p>
24935 !! html/parsoid
24936 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
24937 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
24938 !! end
24939
24940 !!test
24941 Padleft and padright (partial fill)
24942 !! wikitext
24943 {{padleft:xyz|6|ab}}
24944 {{padright:xyz|6|ab}}
24945 !! html/php
24946 <p>abaxyz
24947 xyzaba
24948 </p>
24949 !! html/parsoid
24950 <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>
24951 <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>
24952 !! end
24953
24954 !!test
24955 Padleft and padright as substr
24956 !! wikitext
24957 {{padleft:|3|abcde}}
24958 {{padright:|3|abcde}}
24959 !! html/php
24960 <p>abc
24961 abc
24962 </p>
24963 !! html/parsoid
24964 <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>
24965 <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>
24966 !! end
24967
24968 !! test
24969 Padleft and padright with non-numerical length (T180403)
24970 !! wikitext
24971 {{padleft:abcdef|junk}}
24972 {{padright:abcdef|junk}}
24973 !! html/php
24974 <p>abcdef
24975 abcdef
24976 </p>
24977 !! end
24978
24979 !!test
24980 Special parser function
24981 !! wikitext
24982 {{#special:RandomPage}}
24983 {{#special:BaDtItLe}}
24984 {{#special:Foobar}}
24985 !! html
24986 <p>Special:Random
24987 Special:Badtitle
24988 Special:Foobar
24989 </p>
24990 !! end
24991
24992 !!test
24993 T36939 - Case insensitive link parsing ([HttP://])
24994 !! wikitext
24995 [HttP://MediaWiki.Org/]
24996 !! html/php
24997 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24998 </p>
24999 !! html/parsoid
25000 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
25001 !! end
25002
25003 !!test
25004 T36939 - Case insensitive link parsing ([HttP:// title])
25005 !! wikitext
25006 [HttP://MediaWiki.Org/ MediaWiki]
25007 !! html
25008 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
25009 </p>
25010 !! end
25011
25012 !!test
25013 T36939 - Case insensitive link parsing (HttP://)
25014 !! wikitext
25015 HttP://MediaWiki.Org/
25016 !! html/php
25017 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
25018 </p>
25019 !! html/parsoid
25020 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
25021 !! end
25022
25023 !!test
25024 Disable TOC
25025 !! options
25026 notoc
25027 !! wikitext
25028 Lead
25029 ==Section 1==
25030 ==Section 2==
25031 ==Section 3==
25032 ==Section 4==
25033 ==Section 5==
25034 !! html
25035 <p>Lead
25036 </p>
25037
25038 <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>
25039 <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>
25040 <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>
25041 <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>
25042 <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>
25043
25044 !! end
25045
25046
25047 ###
25048 ### Parsoid-specific tests
25049 ### Parsoid-PHP parser incompatibilities
25050 ###
25051 !!test
25052 1. SOL-sensitive wikitext tokens as template-args
25053 !!options
25054 parsoid=wt2html,wt2wt
25055 !! wikitext
25056 {{echo|*a}}
25057 {{echo|#a}}
25058 {{echo|:a}}
25059 !! html
25060 <span about="#mwt1" typeof="mw:Transclusion">
25061 </span><ul about="#mwt1"><li>a</li>
25062 </ul>
25063 <span about="#mwt2" typeof="mw:Transclusion">
25064 </span><ol about="#mwt2"><li>a</li>
25065 </ol>
25066 <span about="#mwt3" typeof="mw:Transclusion">
25067 </span><dl about="#mwt3"><dd>a</dd>
25068 </dl>
25069 !!end
25070
25071 #### -----------------------------------------------------------------
25072 #### Parsoid-specific functionality tests
25073 #### -----------------------------------------------------------------
25074
25075 # T65642/T68749: Formatting elt fixup around images.
25076 # We know wt2wt will fail, but we expect selser to pass.
25077 # Due to the nature of our testing, wt2wt and selser tests will enter the
25078 # blacklist and we'll catch selser regressions based on changes to the
25079 # blacklist entries for selser tests.
25080 !! test
25081 1. Treebuilder fixup of formatting elt
25082 !! options
25083 parsoid=wt2html,wt2wt
25084 !! wikitext
25085 {|
25086 |
25087 <small>
25088 [[Image:Foobar.jpg|right|Test]]
25089 </small>
25090 |}
25091 !! html/php+tidy
25092 <table>
25093 <tbody><tr>
25094 <td>
25095 <p><small>
25096 </small></p><small>
25097 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Test"><img alt="Test" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
25098 </small><p><small></small>
25099 </p>
25100 </td></tr></tbody></table>
25101 !! html/parsoid
25102 <table>
25103 <tbody><tr><td>
25104 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
25105 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Test</figcaption></figure></small>
25106 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p></td></tr>
25107 </tbody></table>
25108 !! end
25109
25110 !! test
25111 2. Treebuilder fixup of formatting elt
25112 !! options
25113 parsoid=wt2html,wt2wt
25114 !! wikitext
25115 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
25116
25117 <small>[[Image:Foobar.jpg|right|300px]]</small>
25118 !! html/php+tidy
25119 <p><b>foo</b></p><b><div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div></b><p><b>bar</b>
25120 </p><small><div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" width="300" height="34" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/450px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/600px-Foobar.jpg 2x" /></a></div></small>
25121 !! html/parsoid
25122 <p><b>foo</b></p><b><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure></b><p><b>bar</b></p>
25123
25124 <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>
25125 !! end
25126
25127 !! test
25128 3. Treebuilder fixup of formatting elt
25129 !! options
25130 parsoid=wt2html,wt2wt
25131 !! wikitext
25132 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
25133 !! html/php+tidy
25134 <p><small><b>foo</b></small></p><small><b><div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div></b></small><p><small><b>bar</b></small>
25135 </p>
25136 !! html/parsoid
25137 <p><small><b>foo</b></small></p><small><b><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure></b></small><p><small><b>bar</b></small></p>
25138 !! end
25139
25140 !! test
25141 4. Treebuilder fixup of formatting elt: formatting tags around captionless images
25142 !! options
25143 parsoid=wt2html,wt2wt
25144 !! wikitext
25145 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
25146 !! html/php+tidy
25147 <b><small><div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" width="300" height="34" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/450px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/600px-Foobar.jpg 2x" /></a></div></small></b>
25148 !! html/parsoid
25149 <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>
25150 !! end
25151
25152 #### ----------------------------------------------------------------
25153 #### Parsoid-only testing of Parsoid's impl of LST
25154 #### Not implemented yet, see
25155 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
25156 #### ----------------------------------------------------------------
25157
25158 ## We still need to support serializing the older format while content is stored.
25159 !! test
25160 LST Sections: Backwards compatibility
25161 !! options
25162 parsoid={
25163 "suppressErrors": true,
25164 "modes": ["html2wt"]
25165 }
25166 !! wikitext
25167 <section begin="2011-05-16" />
25168 <section end="2014-04-10 (MW 1.23wmf22)" />
25169 !! html/parsoid
25170 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
25171 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
25172 !! end
25173
25174 !! test
25175 LST Sections: Newfangled approach
25176 !! wikitext
25177 <section begin="2011-05-16" />
25178 <section end="2014-04-10 (MW 1.23wmf22)" />
25179 !! html/parsoid
25180 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
25181 </span>
25182 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
25183 </span></p>
25184 !! end
25185
25186 #--------- Test stripping of empty nodes in template content ----------
25187
25188 !! test
25189 Empty LI and TR nodes should be stripped from template content
25190 !! wikitext
25191 {{EmptyLITest}}
25192 {{EmptyTRTest}}
25193 !! html/parsoid
25194 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
25195 <li>a</li>
25196 <li>b</li>
25197 </ul>
25198 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
25199 <tbody>
25200 <tr>
25201 <td>foo</td>
25202 </tr>
25203 <tr>
25204 <td>bar</td>
25205 </tr>
25206 </tbody>
25207 </table>
25208 !! end
25209
25210 !! test
25211 Empty LI and TR nodes should not be stripped from top-level content
25212 !! wikitext
25213 *a
25214 *
25215 *b
25216
25217 {|
25218 |-
25219 |-
25220 |foo
25221 |}
25222 !! html/parsoid
25223 <ul>
25224 <li>a</li>
25225 <li class='mw-empty-elt'></li>
25226 <li>b</li>
25227 </ul>
25228 <table>
25229 <tbody>
25230 <tr class='mw-empty-elt'></tr>
25231 <tr>
25232 <td>foo</td>
25233 </tr>
25234 </tbody>
25235 </table>
25236 !! end
25237
25238 !! test
25239 Empty TR nodes should not be stripped if they have any attributes set
25240 !! wikitext
25241 {{EmptyTRWithHTMLAttrTest}}
25242 !! html/parsoid
25243 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
25244 <tr align='center'></tr>
25245 <tr><td>foo</td></tr>
25246 <tr align='center'></tr>
25247 <tr><td>bar</td></tr>
25248 </table>
25249 !! end
25250
25251 #### ----------------------------------------------------------------
25252 #### The following section of tests are primarily to test
25253 #### wikitext escaping capabilities of Parsoid. Given that
25254 #### escaping can be done any number of ways, the wikitext (input)
25255 #### is always adjusted to reflect how Parsoid adds nowiki
25256 #### escape tags.
25257 ####
25258 #### We are marking several tests as parsoid-only since the
25259 #### HTML in the result section is different from what the
25260 #### PHP parser generates for it.
25261 #### ----------------------------------------------------------------
25262
25263
25264 #### --------------- Headings ---------------
25265 #### 0. Unnested
25266 #### 1. Nested inside html <h1>=foo=</h1>
25267 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
25268 #### 3. Nested inside html with wikitext split by html tags
25269 #### 4. No escape needed
25270 #### 5. Empty headings <h1></h1>
25271 #### 6. Heading chars in SOL context
25272 #### ----------------------------------------
25273 !! test
25274 Headings: 0. Unnested
25275 !! options
25276 parsoid=html2wt
25277 !! html/parsoid
25278 <p>=foo=</p>
25279
25280 <p> =foo=
25281 <!--cmt-->
25282 =foo=</p>
25283
25284 <p>=foo<i>a</i>=</p>
25285 !! wikitext
25286 <nowiki>=foo=</nowiki>
25287
25288 <nowiki> </nowiki>=foo=
25289 <!--cmt-->
25290 <nowiki>=foo=</nowiki>
25291
25292 =foo''a''<nowiki>=</nowiki>
25293 !!end
25294
25295 # New headings and existing headings are handled differently
25296 !! test
25297 Headings: 1. Nested inside html
25298 !! options
25299 parsoid=html2wt
25300 !! html/parsoid
25301 <h1>=foo=</h1>
25302 <h2>=foo=</h2>
25303 <h3>=foo=</h3>
25304
25305 <h1 data-parsoid=''>=foo=</h1>
25306 <h2 data-parsoid=''>=foo=</h2>
25307 <h3 data-parsoid=''>=foo=</h3>
25308 <h4 data-parsoid=''>=foo=</h4>
25309 <h5 data-parsoid=''>=foo=</h5>
25310 <h6 data-parsoid=''>=foo=</h6>
25311 !! wikitext
25312 = =foo= =
25313
25314 == =foo= ==
25315
25316 === =foo= ===
25317
25318 =<nowiki>=foo=</nowiki>=
25319 ==<nowiki>=foo=</nowiki>==
25320 ===<nowiki>=foo=</nowiki>===
25321 ====<nowiki>=foo=</nowiki>====
25322 =====<nowiki>=foo=</nowiki>=====
25323 ======<nowiki>=foo=</nowiki>======
25324
25325 !!end
25326
25327 !! test
25328 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
25329 !! options
25330 parsoid=html2wt
25331 !! html/parsoid
25332 <h1>foo</h1>*bar
25333 <h1>foo</h1>=bar
25334 <h1>foo</h1>=bar=
25335 !! wikitext
25336 = foo =
25337 <nowiki>*</nowiki>bar
25338
25339 = foo =
25340 =bar
25341
25342 = foo =
25343 <nowiki>=bar=</nowiki>
25344 !!end
25345
25346 !! test
25347 Headings: 3. Nested inside html with wikitext split by html tags
25348 !! options
25349 parsoid=html2wt
25350 !! html/parsoid
25351 <h1>=<b>bold</b>foo=</h1>
25352 !! wikitext
25353 = ='''bold'''foo= =
25354 !!end
25355
25356 !! test
25357 Headings: 4a. No escaping needed (testing just h1 and h2)
25358 !! options
25359 parsoid=html2wt
25360 !! html/parsoid
25361 <h1>=foo</h1>
25362 <h1>foo=</h1>
25363 <h1> =foo= </h1>
25364 <h1>=foo= bar</h1>
25365 <h2>=foo</h2>
25366 <h2>foo=</h2>
25367 <h1>=</h1>
25368 <h1><i>=</i>foo=</h1>
25369 !! wikitext
25370 = =foo =
25371
25372 = foo= =
25373
25374 = =foo= =
25375
25376 = =foo= bar =
25377
25378 == =foo ==
25379
25380 == foo= ==
25381
25382 = = =
25383
25384 = ''=''foo= =
25385 !!end
25386
25387 !! test
25388 Headings: 4b. No escaping needed (inside p-tags)
25389 !! options
25390 parsoid=html2wt
25391 !! html/parsoid
25392 <p>=foo= x
25393 =foo= <s></s>
25394 </p>
25395 !! wikitext
25396 =foo= x
25397 =foo= <s></s>
25398 !! html/php
25399 <p>=foo= x
25400 =foo= <s></s>
25401 </p>
25402 !!end
25403
25404 !! test
25405 Headings: 4c. Short headings (1)
25406 !! options
25407 parsoid=html2wt
25408 !! html/parsoid
25409 <p>===
25410 </p>
25411 !! wikitext
25412 <nowiki>===</nowiki>
25413 !! html/php
25414 <p>===
25415 </p>
25416 !! end
25417
25418 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
25419 !! test
25420 Headings: 4d. Short headings (2)
25421 !! options
25422 parsoid=wt2html,html2html
25423 !! wikitext
25424 =
25425 ==
25426 ===
25427 ====
25428 =====
25429 !! html/php
25430 <p>=
25431 ==
25432 </p>
25433 <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>
25434 <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>
25435 <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>
25436
25437 !! html/parsoid
25438 <p>=
25439 ==</p>
25440 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
25441 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
25442 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
25443 !! end
25444
25445 !! test
25446 Headings: 5. Empty headings
25447 !! options
25448 parsoid=html2wt
25449 !! html/parsoid
25450 <h1 data-parsoid='{}'></h1>
25451
25452 <h2 data-parsoid='{}'></h2>
25453
25454 <h3 data-parsoid='{}'></h3>
25455
25456 <h4 data-parsoid='{}'></h4>
25457
25458 <h5 data-parsoid='{}'></h5>
25459
25460 <h6 data-parsoid='{}'></h6>
25461 !! wikitext
25462 =<nowiki/>=
25463
25464 ==<nowiki/>==
25465
25466 ===<nowiki/>===
25467
25468 ====<nowiki/>====
25469
25470 =====<nowiki/>=====
25471
25472 ======<nowiki/>======
25473 !!end
25474
25475 !! test
25476 Headings: 6a. Heading chars in SOL context (with trailing spaces)
25477 !! options
25478 parsoid=html2wt
25479 !! html/parsoid
25480 <p>=a=</p>
25481
25482 <p>=a=</p>
25483
25484 <p>=a=</p>
25485 !! wikitext
25486 <nowiki>=a=</nowiki>
25487
25488 <nowiki>=a=</nowiki>
25489
25490 <nowiki>=a=</nowiki>
25491 !!end
25492
25493 !! test
25494 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25495 !! options
25496 parsoid=html2wt
25497 !! html/parsoid
25498 <p>=a=
25499 b</p>
25500
25501 <p>=a=
25502 b</p>
25503
25504 <p>=a=
25505 b</p>
25506 !! wikitext
25507 <nowiki>=a=</nowiki>
25508 b
25509
25510 <nowiki>=a=</nowiki>
25511 b
25512
25513 <nowiki>=a=</nowiki>
25514 b
25515 !!end
25516
25517 !! test
25518 Headings: 6c. Heading chars in SOL context (leading newline break)
25519 !! options
25520 parsoid=html2wt
25521 !! html/parsoid
25522 <p>a
25523 =b=</p>
25524 !! wikitext
25525 a
25526 <nowiki>=b=</nowiki>
25527 !!end
25528
25529 !! test
25530 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25531 !! options
25532 parsoid=html2wt
25533 !! html/parsoid
25534 <!--c0--><p>=a=</p>
25535
25536 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25537 !! wikitext
25538 <!--c0--><nowiki>=a=</nowiki>
25539
25540 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25541 !!end
25542
25543 !! test
25544 Headings: 6d. Heading chars in SOL context (No escaping needed)
25545 !! options
25546 parsoid=html2wt
25547 !! html/parsoid
25548 =a=<div>b</div>
25549 !! wikitext
25550 =a=<div>b</div>
25551 !!end
25552
25553 !! test
25554 Headings: 7. Insert a newline between new content and headings
25555 !! options
25556 parsoid=html2wt
25557 !! html/parsoid
25558 <h2>NEW</h2>
25559 <p>new</p>
25560 <h2 data-parsoid='{}'>A</h2>
25561 <p data-parsoid='{}'>a</p>
25562 !! wikitext
25563 == NEW ==
25564 new
25565
25566 ==A==
25567 a
25568
25569 !! end
25570
25571 !! test
25572 Headings: Used as horizontal rule
25573 !! config
25574 wgFragmentMode=[ 'html5', 'legacy' ]
25575 !! options
25576 parsoid=wt2html
25577 !! wikitext
25578 ===============
25579 !! html/php
25580 <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>
25581
25582 !! html/parsoid
25583 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25584 !! end
25585
25586 #### --------------- Lists ---------------
25587 #### 0. Outside nests (*foo, etc.)
25588 #### 1. Nested inside html <ul><li>*foo</li></ul>
25589 #### 2. Inside definition lists
25590 #### 3. Only bullets at start should be escaped
25591 #### 4. No escapes needed
25592 #### 5. No unnecessary escapes
25593 #### 6. Escape bullets in SOL position
25594 #### 7. Escape bullets in a multi-line context
25595 #### ----------------------------------------
25596
25597 !! test
25598 Lists: 0. Outside nests
25599 !! options
25600 parsoid=html2wt
25601 !! html/parsoid
25602 <p>*foo</p>
25603
25604 <p>#foo</p>
25605
25606 <p>;Foo:bar</p>
25607 !! wikitext
25608 <nowiki>*</nowiki>foo
25609
25610 <nowiki>#</nowiki>foo
25611
25612 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25613 !!end
25614
25615 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25616 ## to test wikitext escaping, and insignificant whitespace diffs
25617 ## cause PHP parser tests to barf
25618 !! test
25619 Lists: 1. Nested inside html (No unnecessary escapes)
25620 !! options
25621 parsoid=html2wt
25622 !! html/parsoid
25623 <ul>
25624 <li>*foo</li>
25625 <li>#foo</li>
25626 <li>:foo</li>
25627 <li>;foo</li>
25628 <li data-parsoid='{}'>*foo</li>
25629 <li data-parsoid='{}'>#foo</li>
25630 <li data-parsoid='{}'>:foo</li>
25631 <li data-parsoid='{}'>;foo</li>
25632 </ul>
25633
25634 <ol>
25635 <li>*foo</li>
25636 <li>#foo</li>
25637 <li>:foo</li>
25638 <li>;foo</li>
25639 <li data-parsoid='{}'>*foo</li>
25640 <li data-parsoid='{}'>#foo</li>
25641 <li data-parsoid='{}'>:foo</li>
25642 <li data-parsoid='{}'>;foo</li>
25643 </ol>
25644 !! wikitext
25645 * *foo
25646 * #foo
25647 * :foo
25648 * ;foo
25649 *<nowiki>*foo</nowiki>
25650 *<nowiki>#foo</nowiki>
25651 *<nowiki>:foo</nowiki>
25652 *<nowiki>;foo</nowiki>
25653
25654 # *foo
25655 # #foo
25656 # :foo
25657 # ;foo
25658 #<nowiki>*foo</nowiki>
25659 #<nowiki>#foo</nowiki>
25660 #<nowiki>:foo</nowiki>
25661 #<nowiki>;foo</nowiki>
25662 !!end
25663
25664 !! test
25665 Lists: 2. Inside definition lists
25666 !! options
25667 parsoid=html2wt
25668 !! html/parsoid
25669 <dl><dt>;foo</dt></dl>
25670 <dl><dt>:foo</dt></dl>
25671 <dl><dt>:foo</dt>
25672 <dd>bar</dd></dl>
25673 <dl><dd>:foo</dd></dl>
25674 !! wikitext
25675 ; ;foo
25676
25677 ; <nowiki>:foo</nowiki>
25678
25679 ; <nowiki>:foo</nowiki>
25680 : bar
25681
25682 : :foo
25683 !!end
25684
25685 !! test
25686 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25687 !! options
25688 parsoid=html2wt
25689 !! html/parsoid
25690 <ul>
25691 <li>*foo*bar</li>
25692 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25693 </ul>
25694 !! wikitext
25695 * *foo*bar
25696 *<nowiki>*foo</nowiki>''it''*bar
25697 !!end
25698
25699 !! test
25700 Lists: 4. No escapes needed
25701 !! options
25702 parsoid=html2wt
25703 !! html/parsoid
25704 <ul>
25705 <li>foo*bar
25706 </li>
25707 </ul>
25708 <ul>
25709 <li><i>foo</i>*bar
25710 </li>
25711 </ul>
25712 <ul>
25713 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25714 </li>
25715 </ul>
25716 <ul>
25717 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25718 </li>
25719 </ul>
25720 !! wikitext
25721 *foo*bar
25722
25723 *''foo''*bar
25724
25725 *[[Foo]]: bar
25726
25727 *[[Foo]]*bar
25728 !!end
25729
25730 !! test
25731 Lists: 5. No unnecessary escapes
25732 !! options
25733 parsoid=html2wt
25734 !! html/parsoid
25735 <ul><li> bar <span>[[foo]]</span></li></ul>
25736 <ul><li> =bar <span>[[foo]]</span></li></ul>
25737 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25738 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25739 <ul><li> =bar <span>foo]]</span>=</li></ul>
25740 <ul><li> <s></s>: a</li></ul>
25741 <ul><li> <i>* foo</i></li></ul>
25742
25743 !! wikitext
25744 * bar <span><nowiki>[[foo]]</nowiki></span>
25745
25746 * =bar <span><nowiki>[[foo]]</nowiki></span>
25747
25748 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25749
25750 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25751
25752 * =bar <span>foo]]</span>=
25753
25754 * <s></s>: a
25755
25756 * ''* foo''
25757 !!end
25758
25759 !! test
25760 Lists: 6. Escape bullets in SOL position
25761 !! options
25762 parsoid=html2wt
25763 !! html/parsoid
25764 <p><!--cmt-->*foo</p>
25765 !! wikitext
25766 <!--cmt--><nowiki>*</nowiki>foo
25767 !!end
25768
25769 !! test
25770 Lists: 7. Escape bullets in a multi-line context
25771 !! options
25772 parsoid=html2wt
25773 !! html/parsoid
25774 <p>a
25775 *b
25776 </p>
25777 !! wikitext
25778 a
25779 <nowiki>*</nowiki>b
25780 !!end
25781
25782 !! test
25783 Lists: 8. Escape colons only if not present in tags
25784 !! options
25785 parsoid=html2wt
25786 !! html/parsoid
25787 <dl><dt>a:b<i>c:d</i></dt></dl>
25788 !! wikitext
25789 ; <nowiki>a:b</nowiki>''c:d''
25790 !! end
25791
25792 #### --------------- HRs ---------------
25793 #### 1. Single line
25794 #### -----------------------------------
25795
25796 !! test
25797 HRs: 1. Single line
25798 !! options
25799 parsoid=html2wt
25800 !! html/parsoid
25801 <hr />----
25802 <hr />=foo=
25803 <hr />*foo
25804 !! wikitext
25805 ----<nowiki>----</nowiki>
25806 ----=foo=
25807 ----*foo
25808 !! end
25809
25810 #### --------------- Tables ---------------
25811 #### 1a. Simple example
25812 #### 1b. No escaping needed (!foo)
25813 #### 1c. No escaping needed (|foo)
25814 #### 1d. No escaping needed (|}foo)
25815 ####
25816 #### 2a. Nested in td (<td>foo|bar</td>)
25817 #### 2b. Nested in td (<td>foo||bar</td>)
25818 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25819 ####
25820 #### 3a. Nested in th (<th>foo!bar</th>)
25821 #### 3b. Nested in th (<th>foo!!bar</th>)
25822 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25823 ####
25824 #### 4a. Escape -
25825 #### 4b. Escape +
25826 #### 4c. No escaping needed
25827 #### --------------------------------------
25828
25829 !! test
25830 Tables: 1a. Simple example
25831 !! options
25832 parsoid=html2wt
25833 !! html/parsoid
25834 <p>{|
25835 |}
25836 </p>
25837 !! wikitext
25838 <nowiki>{|</nowiki>
25839 |}
25840 !! end
25841
25842 !! test
25843 Tables: 1b. No escaping needed
25844 !! options
25845 parsoid=html2wt
25846 !! html/parsoid
25847 <p>!foo
25848 </p>
25849 !! wikitext
25850 !foo
25851 !! end
25852
25853 !! test
25854 Tables: 1c. No escaping needed
25855 !! options
25856 parsoid=html2wt
25857 !! html/parsoid
25858 <p>|foo
25859 </p>
25860 !! wikitext
25861 |foo
25862 !! end
25863
25864 !! test
25865 Tables: 1d. No escaping needed
25866 !! options
25867 parsoid=html2wt
25868 !! html/parsoid
25869 <p>|}foo
25870 </p>
25871 !! wikitext
25872 |}foo
25873 !! end
25874
25875 !! test
25876 Tables: 2a. Nested in td
25877 !! options
25878 parsoid=html2wt
25879 !! html/parsoid
25880 <table><tbody><tr>
25881 <td>foo|bar</td></tr>
25882 <tr><td>x<div>a|b</div></td>
25883 </tbody></table>
25884 !! wikitext
25885 {|
25886 |<nowiki>foo|bar</nowiki>
25887 |-
25888 |x<div><nowiki>a|b</nowiki></div>
25889 |}
25890 !! html/php+tidy
25891 <table>
25892 <tbody><tr>
25893 <td>foo|bar
25894 </td></tr>
25895 <tr>
25896 <td>x<div>a|b</div>
25897 </td></tr></tbody></table>
25898 !! end
25899
25900 !! test
25901 Tables: 2b. Nested in td
25902 !! options
25903 parsoid=html2wt
25904 !! html/parsoid
25905 <table><tbody><tr>
25906 <td>foo||bar</td>
25907 <td>a<i>b||c</i></td>
25908 <td>a<i><div>b||c</div></i></td>
25909 </tr></tbody></table>
25910 !! wikitext
25911 {|
25912 |<nowiki>foo||bar</nowiki>
25913 |a''<nowiki>b||c</nowiki>''
25914 |a''<div><nowiki>b||c</nowiki></div>''
25915 |}
25916 !! html/php
25917 <table>
25918 <tr>
25919 <td>foo||bar
25920 </td>
25921 <td>a<i>b||c</i>
25922 </td>
25923 <td>a<i><div>b||c</div></i>
25924 </td></tr></table>
25925
25926 !! end
25927
25928 !! test
25929 Tables: 2c. Nested in td -- no escaping needed
25930 !! options
25931 parsoid=html2wt
25932 !! html/*
25933 <table>
25934 <tr>
25935 <td>foo!!bar
25936 </td></tr></table>
25937
25938 !! wikitext
25939 {|
25940 |foo!!bar
25941 |}
25942 !! end
25943
25944 !! test
25945 Tables: 3a. Nested in th
25946 !! options
25947 parsoid=html2wt
25948 !! html/*
25949 <table>
25950 <tr>
25951 <th>foo!bar
25952 </th></tr></table>
25953
25954 !! wikitext
25955 {|
25956 !foo!bar
25957 |}
25958 !! end
25959
25960 !! test
25961 Tables: 3b. Nested in th
25962 !! options
25963 parsoid=html2wt
25964 !! html/parsoid
25965 <table><tbody>
25966 <tr><th>foo!!bar</th>
25967 <th><i>foo|bar</i></th>
25968 <th><i>foo!!bar</i></th>
25969 <th><i><span>foo!!bar</span></i></th>
25970 </tr></tbody></table>
25971 !! wikitext
25972 {|
25973 !<nowiki>foo!!bar</nowiki>
25974 !''<nowiki>foo|bar</nowiki>''
25975 !''<nowiki>foo!!bar</nowiki>''
25976 !''<span><nowiki>foo!!bar</nowiki></span>''
25977 |}
25978 !! html/php
25979 <table>
25980 <tr>
25981 <th>foo!!bar
25982 </th>
25983 <th><i>foo|bar</i>
25984 </th>
25985 <th><i>foo!!bar</i>
25986 </th>
25987 <th><i><span>foo!!bar</span></i>
25988 </th></tr></table>
25989
25990 !! end
25991
25992 !! test
25993 Tables: 3c. Nested in th
25994 !! options
25995 parsoid=html2wt
25996 !! html/parsoid
25997 <table><tbody>
25998 <tr><th>foo||bar</th>
25999 <th><span typeof="mw:Nowiki">foo||bar</span></th>
26000 </tr></tbody></table>
26001 !! wikitext
26002 {|
26003 !<nowiki>foo||bar</nowiki>
26004 !<nowiki>foo||bar</nowiki>
26005 |}
26006 !! html/php
26007 <table>
26008 <tr>
26009 <th>foo||bar
26010 </th>
26011 <th>foo||bar
26012 </th></tr></table>
26013
26014 !! end
26015
26016 !! test
26017 Tables: 4a. Escape -
26018 !! options
26019 parsoid=html2wt
26020 !! html/*
26021 <table>
26022 <tr>
26023 <th>-bar
26024 </th></tr>
26025 <tr>
26026 <td>-bar
26027 </td></tr></table>
26028
26029 !! wikitext
26030 {|
26031 !-bar
26032 |-
26033 |<nowiki>-bar</nowiki>
26034 |}
26035 !! end
26036
26037 !! test
26038 Tables: 4b. Escape +
26039 !! options
26040 parsoid=html2wt
26041 !! html/*
26042 <table>
26043 <tr>
26044 <th>+bar
26045 </th></tr>
26046 <tr>
26047 <td>+bar
26048 </td></tr></table>
26049
26050 !! wikitext
26051 {|
26052 !+bar
26053 |-
26054 |<nowiki>+bar</nowiki>
26055 |}
26056 !! end
26057
26058 !! test
26059 Tables: 4c. No escaping needed
26060 !! options
26061 parsoid=html2wt
26062 !! html/parsoid
26063 <table><tbody>
26064 <tr><td>foo-bar</td><td>foo+bar</td></tr>
26065 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
26066 <tr><td>foo
26067 <p>bar|baz
26068 +bar
26069 -bar</p></td></tr>
26070 <tr><td>x
26071 <div>a|b</div></td>
26072 </tbody></table>
26073 !! wikitext
26074 {|
26075 |foo-bar
26076 |foo+bar
26077 |-
26078 |''foo''-bar
26079 |''foo''+bar
26080 |-
26081 |foo
26082 bar|baz
26083 +bar
26084 -bar
26085 |-
26086 |x
26087 <div>a|b</div>
26088 |}
26089 !! html/php
26090 <table>
26091 <tr>
26092 <td>foo-bar
26093 </td>
26094 <td>foo+bar
26095 </td></tr>
26096 <tr>
26097 <td><i>foo</i>-bar
26098 </td>
26099 <td><i>foo</i>+bar
26100 </td></tr>
26101 <tr>
26102 <td>foo
26103 <p>bar|baz
26104 +bar
26105 -bar
26106 </p>
26107 </td></tr>
26108 <tr>
26109 <td>x
26110 <div>a|b</div>
26111 </td></tr></table>
26112
26113 !! end
26114
26115 !! test
26116 Tables: 4d. No escaping needed
26117 !! options
26118 parsoid=html2wt
26119 !! html/parsoid
26120 <table>
26121 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
26122 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
26123 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
26124 </tbody></table>
26125 !! wikitext
26126 {|
26127 |[[Foo]]-bar
26128 ||+1
26129 ||-2
26130 |}
26131 !! html/php
26132 <table>
26133 <tr>
26134 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
26135 </td>
26136 <td>+1
26137 </td>
26138 <td>-2
26139 </td></tr></table>
26140
26141 !! end
26142
26143 !! test
26144 Tables: 5. Empty table cells should get whitespace to avoid need for nowikis
26145 !! options
26146 parsoid=html2wt
26147 !! html/parsoid
26148 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26149
26150 <table><tr><td></td><td align="center"></td><td></td></tr></table>
26151
26152 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26153
26154 <table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table>
26155 !! wikitext
26156 {|
26157 | || align="center" | ||
26158 |}
26159
26160 {|
26161 |
26162 | align="center" |
26163 |
26164 |}
26165
26166 {|
26167 | {{!}}{{!}} align="center" | ||
26168 |}
26169
26170 {|
26171 ! !! align="center" | !!
26172 |}
26173 !! html/php+tidy
26174 <table>
26175 <tbody><tr>
26176 <td></td>
26177 <td align="center"></td>
26178 <td>
26179 </td></tr></tbody></table>
26180 <table>
26181 <tbody><tr>
26182 <td>
26183 </td>
26184 <td align="center">
26185 </td>
26186 <td>
26187 </td></tr></tbody></table>
26188 <table>
26189 <tbody><tr>
26190 <td></td>
26191 <td align="center"></td>
26192 <td>
26193 </td></tr></tbody></table>
26194 <table>
26195 <tbody><tr>
26196 <th></th>
26197 <th align="center"></th>
26198 <th>
26199 </th></tr></tbody></table>
26200 !! end
26201
26202 !! test
26203 T97430: Don't emit empty nowiki pairs around marker meta tags
26204 !! options
26205 parsoid=html2wt
26206 !! html/parsoid
26207 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26208 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
26209 !! wikitext
26210 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26211 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
26212 !! end
26213
26214 !! test
26215 Unclosed xmlish element in table line shouldn't eat end delimiters
26216 !! options
26217 parsoid=html2wt
26218 !! html/parsoid
26219 <table>
26220 <tbody><tr><td> &lt;foo</td>
26221 <td> bar></td></tr>
26222 </tbody></table>
26223 !! wikitext
26224 {|
26225 | <foo
26226 | bar>
26227 |}
26228 !! html/php
26229 <table>
26230 <tr>
26231 <td>&lt;foo
26232 </td>
26233 <td>bar&gt;
26234 </td></tr></table>
26235
26236 !! end
26237
26238 #### --------------- Links ----------------
26239 #### 1. Quote marks in link text
26240 #### 2. Wikilinks: Escapes needed
26241 #### 3. Wikilinks: No escapes needed
26242 #### 4. Extlinks: Escapes needed
26243 #### 5. Extlinks: No escapes needed
26244 #### --------------------------------------
26245 !! test
26246 Links 1. WikiLinks: No escapes needed
26247 !! options
26248 parsoid=html2wt
26249 !! html/parsoid
26250 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
26251 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
26252 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
26253 !! wikitext
26254 [[Foo|Foo''boo'']]
26255 [[Foo|[Foobar]]]
26256 [[Foo|x [Foobar] x]]
26257 !! html/php
26258 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
26259 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
26260 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
26261 </p>
26262 !! end
26263
26264 !! test
26265 Links 2. WikiLinks: Escapes needed
26266 !! options
26267 parsoid=html2wt
26268 !! html/parsoid
26269 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
26270 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
26271 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
26272 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
26273 <a href="Foo" rel="mw:WikiLink">|Bar</a>
26274 <a href="Foo" rel="mw:WikiLink">]]bar</a>
26275 <a href="Foo" rel="mw:WikiLink">[[bar</a>
26276 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
26277 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
26278 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
26279 !! wikitext
26280 [[Foo|<nowiki>Foobar]</nowiki>]]
26281 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
26282 [[Foo|<nowiki>[[Bar]]</nowiki>]]
26283 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
26284 [[Foo|<nowiki>|Bar</nowiki>]]
26285 [[Foo|<nowiki>]]bar</nowiki>]]
26286 [[Foo|<nowiki>[[bar</nowiki>]]
26287 [[Foo|<nowiki>x [[ y</nowiki>]]
26288 [[Foo|<nowiki>x ]] y</nowiki>]]
26289 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
26290 !! html/php
26291 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
26292 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
26293 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
26294 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
26295 <a href="/wiki/Foo" title="Foo">|Bar</a>
26296 <a href="/wiki/Foo" title="Foo">]]bar</a>
26297 <a href="/wiki/Foo" title="Foo">[[bar</a>
26298 <a href="/wiki/Foo" title="Foo">x [[ y</a>
26299 <a href="/wiki/Foo" title="Foo">x ]] y</a>
26300 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
26301 </p>
26302 !! end
26303
26304 !! test
26305 Links 3. WikiLinks: No escapes needed
26306 !! options
26307 parsoid=html2wt
26308 !! html/parsoid
26309 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
26310 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
26311 !! wikitext
26312 [[Foo|[Foobar]]
26313 [[Foo|foo|bar]]
26314 !! html/php
26315 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
26316 <a href="/wiki/Foo" title="Foo">foo|bar</a>
26317 </p>
26318 !! end
26319
26320 !! test
26321 Links 4. ExtLinks: Escapes needed
26322 !! options
26323 parsoid=html2wt
26324 !! html/parsoid
26325 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
26326 <a rel="mw:ExtLink" href="http://google.com">google]</a>
26327 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
26328 <p>[http://google.com]</p>
26329 <p>[http://google.com google]</p>
26330 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
26331 <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>
26332 !! wikitext
26333 [http://google.com <nowiki>[google]</nowiki>]
26334 [http://google.com <nowiki>google]</nowiki>]
26335 [http://google.com <nowiki>goog] le</nowiki>]
26336
26337 <nowiki>[http://google.com]</nowiki>
26338
26339 <nowiki>[http://google.com google]</nowiki>
26340
26341 [http://google.com<nowiki>]</nowiki>
26342
26343 [{{echo|http://google.com}}<nowiki>]</nowiki>
26344 !! html/php
26345 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
26346 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
26347 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
26348 </p><p>[http://google.com]
26349 </p><p>[http://google.com google]
26350 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26351 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26352 </p>
26353 !! end
26354
26355 !! test
26356 Links 5. ExtLinks: No escapes needed
26357 !! options
26358 parsoid=html2wt
26359 !! html/parsoid
26360 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
26361 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
26362 !! wikitext
26363 [http://google.com [google]
26364
26365 [[http://google.com]]
26366 !! html/php
26367 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
26368 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
26369 </p>
26370 !! end
26371
26372 !! test
26373 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
26374 !! options
26375 parsoid=html2wt
26376 !! html/parsoid
26377 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
26378 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
26379 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
26380 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
26381 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
26382 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
26383 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26384 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
26385 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26386 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
26387 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
26388 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
26389 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
26390 </p>
26391 !! wikitext
26392 x<nowiki/>http://example.com<nowiki/>y
26393 http://example.com<nowiki/>?x
26394 http://example.com<nowiki/>&x
26395 http://example.com<nowiki/>'x
26396 http://example.com<nowiki/>,x
26397 http://example.com<nowiki/>.x
26398 http://example.com<nowiki/>;x
26399 http://example.com<nowiki/>:x
26400 http://example.com<nowiki/>;x
26401 http://example.com<nowiki/>!x
26402 http://example.com<nowiki/>=x
26403 http://example.com<nowiki/>(x)
26404 http://example.com(x<nowiki/>)
26405 !! end
26406
26407 !! test
26408 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26409 !! options
26410 parsoid=html2wt
26411 !! html/parsoid
26412 <p>x
26413 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
26414 y
26415 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
26416 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
26417 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
26418 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
26419 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
26420 </p>
26421 !! wikitext
26422 x
26423 http://example.com
26424 y
26425 "http://example.com"
26426 (http://example.com)
26427 (http://example.com) foo
26428 http://example.com,
26429 http://example.com, foo
26430 !! html/php
26431 <p>x
26432 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
26433 y
26434 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
26435 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
26436 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
26437 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
26438 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
26439 </p>
26440 !! end
26441
26442 !! test
26443 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26444 !! options
26445 parsoid=html2wt
26446 !! html/parsoid
26447 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
26448 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
26449 !! wikitext
26450 http://example.com.,;:!?\
26451 -http://example.com:
26452 !! html/php
26453 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
26454 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
26455 </p>
26456 !! end
26457
26458 !! test
26459 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
26460 !! options
26461 parsoid=html2wt
26462 !! html/parsoid
26463 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
26464 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
26465 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
26466 !! wikitext
26467 RFC 123<nowiki/>4
26468 RFC 123<nowiki/>y
26469 X<nowiki/>RFC 123<nowiki/>y
26470 !! end
26471
26472 !! test
26473 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
26474 !! options
26475 parsoid=html2wt
26476 !! html/parsoid
26477 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
26478 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
26479 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
26480 </p>
26481 !! wikitext
26482 RFC 123?foo
26483 RFC 123&foo
26484 -RFC 123-
26485 !! html/php
26486 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
26487 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
26488 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
26489 </p>
26490 !! end
26491
26492 !! test
26493 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
26494 !! options
26495 parsoid=html2wt
26496 !! html/parsoid
26497 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
26498 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26499 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26500 !! wikitext
26501 PMID 123<nowiki/>4
26502 PMID 123<nowiki/>y
26503 X<nowiki/>PMID 123<nowiki/>y
26504 !! end
26505
26506 !! test
26507 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
26508 !! options
26509 parsoid=html2wt
26510 !! html/parsoid
26511 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
26512 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
26513 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
26514 </p>
26515 !! wikitext
26516 PMID 123?foo
26517 PMID 123&foo
26518 -PMID 123-
26519 !! html/php
26520 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
26521 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
26522 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
26523 </p>
26524 !! end
26525
26526 !! test
26527 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
26528 !! options
26529 parsoid=html2wt
26530 !! html/parsoid
26531 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
26532 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
26533 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
26534 </p>
26535 !! wikitext
26536 ISBN 1234567890<nowiki/>1
26537 ISBN 1234567890<nowiki/>x
26538 a<nowiki/>ISBN 1234567890<nowiki/>b
26539 !! end
26540
26541 !! test
26542 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
26543 !! options
26544 parsoid=html2wt
26545 !! html/parsoid
26546 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26547 !! wikitext
26548 -ISBN 1234567890's
26549 !! html/php
26550 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26551 </p>
26552 !! end
26553
26554 !! test
26555 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26556 !! options
26557 parsoid=html2wt
26558 !! html/*
26559 <p>this is not a link: http://example.com
26560 </p>
26561 !! wikitext
26562 this is not a link: <nowiki>http://example.com</nowiki>
26563 !! end
26564
26565 !! test
26566 Links 15. Link trails can't become link prefixes.
26567 !! options
26568 language=is
26569 parsoid=html2wt
26570 !! html/parsoid
26571 <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>
26572 !! wikitext
26573 [[Söfnuður]]-[[00]]
26574 !! html/php
26575 <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>
26576 </p>
26577 !! end
26578
26579 #### --------------- Quotes ---------------
26580 #### 1. Quotes inside <b> and <i>
26581 #### 2. Link fragments separated by <i> and <b> tags
26582 #### 3. Link fragments inside <i> and <b>
26583 #### 4. No escaping needed
26584 #### --------------------------------------
26585 !! test
26586 1a. Quotes inside <b> and <i>
26587 !! options
26588 parsoid=html2wt
26589 !! html/*
26590 <p><i>'foo'</i>
26591 <i>''foo''</i>
26592 <i>'''foo'''</i>
26593 <i>foo</i>'s
26594 <b>'foo'</b>
26595 <b>''foo''</b>
26596 <b>'''foo'''</b>
26597 <b>foo'<i>bar'</i>baz</b>
26598 <b>foo</b>'s
26599 '<i>foo</i>
26600 <i>foo</i>'
26601 <i>foo'</i>'
26602 '<i>foo</i>'
26603 '<b>foo</b>
26604 <b>foo</b>'
26605 '<b>foo</b>'
26606 <i>fools'<span> errand</span></i>
26607 <i><span>fool</span>'s errand</i>
26608 '<i>foo</i> bar '<i>baz</i>
26609 a|!*#-:;+-~[]{}b'<i>x</i>
26610 </p>
26611 !! wikitext
26612 ''<nowiki/>'foo'''
26613 ''<nowiki>''foo''</nowiki>''
26614 ''<nowiki>'''foo'''</nowiki>''
26615 ''foo''<nowiki/>'s
26616 '''<nowiki/>'foo''''
26617 '''<nowiki>''foo''</nowiki>'''
26618 '''<nowiki>'''foo'''</nowiki>'''
26619 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26620 '''foo'''<nowiki/>'s
26621 '''foo''
26622 ''foo''<nowiki/>'
26623 ''foo'''<nowiki/>'
26624 '''foo''<nowiki/>'
26625 ''''foo'''
26626 '''foo'''<nowiki/>'
26627 ''''foo'''<nowiki/>'
26628 ''fools'<span> errand</span>''
26629 ''<span>fool</span>'s errand''
26630 '<nowiki/>''foo'' bar '''baz''
26631 a|!*#-:;+-~[]{}b'''x''
26632 !! end
26633
26634 !! test
26635 1b. Quotes inside <b> and <i> with other tags on same line
26636 !! options
26637 parsoid=html2wt
26638 !! html/parsoid
26639 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26640 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26641 <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>
26642 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26643 '<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>
26644 '<i>foo</i> <div title="name">test</div>
26645 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26646 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26647 <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>
26648 </ol>
26649 !! wikitext
26650 '''a'' foo ''[[bar]]''
26651 ''a''' foo ''[[bar]]''
26652 ''a''' foo '''{{echo|[[bar]]}}'''
26653 [[foo]] x'''[[bar]]''
26654 '''foo'' <ref>test</ref>
26655 '''foo'' <div title="name">test</div>
26656 '''foo'' and <br> bar
26657 <references />
26658 !! end
26659
26660 !! test
26661 2. Link fragments separated by <i> and <b> tags
26662 !! options
26663 parsoid=html2wt
26664 !! html/parsoid
26665 <p>[[<i>foo</i>hello]]</p>
26666 <p>[[<b>foo</b>hello]]</p>
26667 !! wikitext
26668 [[''foo''<nowiki>hello]]</nowiki>
26669
26670 [['''foo'''<nowiki>hello]]</nowiki>
26671 !! end
26672
26673 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26674 # this is one of the shortcomings of this format
26675 !! test
26676 3. Link fragments inside <i> and <b>
26677 !! options
26678 parsoid=html2wt
26679 !! html/parsoid
26680 <p><i>[[foo</i>]]</p>
26681 <p><b>[[foo</b>]]</p>
26682 !! wikitext
26683 ''[[foo''<nowiki>]]</nowiki>
26684
26685 '''[[foo'''<nowiki>]]</nowiki>
26686 !! end
26687
26688 !! test
26689 4. No escaping needed
26690 !! options
26691 parsoid=html2wt
26692 !! html/parsoid
26693 <p>'<span><i>bar</i></span>'
26694 '<span><b>bar</b></span>'
26695 'a:b'foo
26696 </p>
26697 !! wikitext
26698 '<span>''bar''</span>'
26699 '<span>'''bar'''</span>'
26700 'a:b'foo
26701 !! end
26702
26703 #### ----------- Paragraphs ---------------
26704 #### 1. No unnecessary escapes
26705 #### --------------------------------------
26706
26707 !! test
26708 1. No unnecessary escapes
26709 !! options
26710 parsoid=html2wt
26711 !! html/parsoid
26712 <p>bar <span>[[foo]]</span>
26713 </p><p>=bar <span>[[foo]]</span>
26714 </p><p>[[bar <span>[[foo]]</span>
26715 </p><p>]]bar <span>[[foo]]</span>
26716 </p><p>=bar <span>foo]]</span>=
26717 </p>
26718 !! wikitext
26719 bar <span><nowiki>[[foo]]</nowiki></span>
26720
26721 =bar <span><nowiki>[[foo]]</nowiki></span>
26722
26723 [[bar <span><nowiki>[[foo]]</nowiki></span>
26724
26725 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26726
26727 =bar <span>foo]]</span><nowiki>=</nowiki>
26728 !!end
26729
26730 #### ----------------------- PRE --------------------------
26731 !! test
26732 1. Leading whitespace in SOL context should be escaped
26733 !! options
26734 parsoid=html2wt
26735 !! html/parsoid
26736 <p> a</p>
26737
26738 <p> a</p>
26739
26740 <p> a(tab)</p>
26741
26742 <p> a
26743 <!--cmt-->
26744 a</p>
26745
26746 <p>a
26747 b</p>
26748
26749 <p>a
26750 b</p>
26751
26752 <p>a
26753 b</p>
26754 !! wikitext
26755 <nowiki> </nowiki>a
26756
26757 <nowiki> </nowiki> a
26758
26759 a(tab)
26760
26761 <nowiki> </nowiki> a
26762 <!--cmt-->
26763 <nowiki> </nowiki>a
26764
26765 a
26766 <nowiki> </nowiki>b
26767
26768 a
26769 b
26770
26771 a
26772 b
26773 !! html/php
26774 <p> a
26775 </p><p> a
26776 </p><p> a(tab)
26777 </p><p> a
26778 a
26779 </p><p>a
26780 b
26781 </p><p>a
26782 b
26783 </p><p>a
26784 b
26785 </p>
26786 !! end
26787
26788 !! test
26789 2. Leading whitespace in non-indent-pre contexts should not be escaped
26790 !! options
26791 parsoid=html2wt
26792 !! html/parsoid
26793 <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>
26794 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26795 <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>
26796 b</span></li>
26797 </ol>
26798 !! wikitext
26799 foo <ref>''a''
26800 b</ref>
26801 <references />
26802 !! end
26803
26804 !! test
26805 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26806 !! options
26807 parsoid=html2wt
26808 !! html/parsoid
26809 <blockquote>
26810 <p>
26811 a
26812 <span>b</span>
26813 c</p>
26814 </blockquote>
26815 !! wikitext
26816 <blockquote>
26817 a
26818 <span>b</span>
26819 c
26820 </blockquote>
26821 !! end
26822
26823 !! test
26824 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26825 !! options
26826 parsoid=html2wt
26827 !! html/parsoid
26828 <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>
26829 !! wikitext
26830 [[File:Foobar.jpg|thumb|caption]]
26831 !! end
26832
26833 !! test
26834 5. Nowiki escaping should account for indent-pres
26835 !! options
26836 parsoid=html2wt
26837 !! html/parsoid
26838 <pre>==foo==</pre>
26839 !! wikitext
26840 ==foo==
26841 !! end
26842
26843 !! test
26844 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26845 !! options
26846 parsoid=html2wt
26847 !! html/parsoid
26848 <pre>
26849 * foo
26850 * bar
26851 </pre>
26852 !! wikitext
26853 * foo
26854 * bar
26855 !! end
26856
26857 !! test
26858 Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup
26859 !! options
26860 parsoid = {
26861 "modes": ["html2wt"],
26862 "scrubWikitext": true
26863 }
26864 !! html/parsoid
26865 <p> foo</p>
26866 <p> %foo</p>
26867 <p> *foo</p>
26868 <p> #foo</p>
26869 <p> =foo=</p>
26870 <p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p>
26871 <p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p>
26872 <p> <!--boo-->*foo</p>
26873 <p><!--boo--> *foo</p>
26874 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p>
26875 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p>
26876 !! wikitext
26877 foo
26878
26879 %foo
26880
26881 <nowiki/>*foo
26882
26883 <nowiki/>#foo
26884
26885 <nowiki/>=foo=
26886
26887 [[Category:Foo]]
26888 <nowiki/>*foo
26889
26890 [[Category:Foo]]
26891 <nowiki>*</nowiki>foo
26892
26893 <nowiki/><!--boo-->*foo
26894
26895 <!--boo--><nowiki/>*foo
26896
26897 <!--a--><!--b--><!--c--><!--d--><!--e-->foo
26898
26899 <!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo
26900 !! end
26901
26902 #### --------------- Behavior Switches --------------------
26903
26904 !! test
26905 1. Valid behavior switches should be escaped
26906 !! options
26907 parsoid=html2wt
26908 !! html/parsoid
26909 __TOC__
26910 <i>__TOC__</i>
26911 !! wikitext
26912 <nowiki>__TOC__</nowiki>
26913 ''<nowiki>__TOC__</nowiki>''
26914 !! end
26915
26916 !! test
26917 2. Invalid behavior switches should not be escaped
26918 !! options
26919 parsoid=html2wt
26920 !! html/parsoid
26921 __TOO__
26922 __|__
26923 !! wikitext
26924 __TOO__
26925 __|__
26926 !! end
26927
26928 # We use indent-pre as an indirect way to test for sol-transparent behavior.
26929 !! test
26930 Behavior switches should be SOL-transparent
26931 !! options
26932 parsoid=html2wt
26933 !! html/parsoid
26934 <meta property="mw:PageProp/toc" />
26935
26936 <!-- this one's bogus -->
26937 <pre>__TOO__</pre>
26938
26939 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26940
26941 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26942 !! wikitext
26943 __TOC__
26944
26945 <!-- this one's bogus -->
26946 __TOO__
26947
26948 __TOC__ foo
26949
26950 __TOC__
26951 bar
26952 !! end
26953
26954 #### --------------- HTML tags ---------------
26955 #### 1. a tags
26956 #### 2. other tags
26957 #### 3. multi-line html tag
26958 #### 4. extension tags
26959 #### -----------------------------------------
26960 !! test
26961 1. a tags
26962 !! options
26963 parsoid=html2wt
26964 !! html/parsoid
26965 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26966 !! wikitext
26967 <a href="http://google.com">google</a>
26968 !! end
26969
26970 !! test
26971 2. other tags
26972 !! options
26973 parsoid=html2wt
26974 !! html/parsoid
26975 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26976 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26977 <li> &lt;td&gt;</li></ul>
26978
26979 !! wikitext
26980 * <nowiki><div>foo</div></nowiki>
26981 * <nowiki><div style="color:red">foo</div></nowiki>
26982 * <nowiki><td></nowiki>
26983 !! end
26984
26985 !! test
26986 3. multi-line html tag
26987 !! options
26988 parsoid=html2wt
26989 !! html/parsoid
26990 <p>&lt;div
26991 &gt;foo&lt;/div
26992 &gt;
26993 </p>
26994 !! wikitext
26995 <nowiki><div
26996 >foo</div
26997 ></nowiki>
26998 !! end
26999
27000 !! test
27001 4. extension tags
27002 !! options
27003 parsoid=html2wt
27004 !! html/parsoid
27005 <p>&lt;ref&gt;foo&lt;/ref&gt;
27006 </p><p>&lt;ref&gt;bar
27007 </p><p>baz&lt;/ref&gt;
27008 </p>
27009 !! wikitext
27010 <nowiki><ref>foo</ref></nowiki>
27011
27012 <nowiki><ref>bar</nowiki>
27013
27014 baz<nowiki></ref></nowiki>
27015 !! end
27016
27017 !! test
27018 Parsoid: newline inducing block nodes don't suppress <nowiki>
27019 !! options
27020 parsoid=html2wt
27021 !! html/parsoid
27022 a<h1>foo</h1>
27023 !! wikitext
27024 <nowiki> </nowiki>a
27025
27026 = foo =
27027 !! end
27028
27029 #### --------------- Others ---------------
27030 !! test
27031 Escaping nowikis
27032 !! options
27033 parsoid=html2wt
27034 !! html/parsoid
27035 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
27036 </p>
27037 !! wikitext
27038 &lt;nowiki&gt;foo&lt;/nowiki&gt;
27039 !! end
27040
27041 ## The quote-char in the input is necessary for triggering the bug
27042 !! test
27043 (T54035) Nowiki-escaping should not get tripped by " :" in text
27044 !! options
27045 parsoid=html2wt
27046 !! html/parsoid
27047 <p>foo's bar :</p>
27048 !! wikitext
27049 foo's bar :
27050 !! end
27051
27052 #----------- End of wikitext escaping tests --------------
27053
27054 !! test
27055
27056 Tag-like HTML structures are passed through as text
27057 !! wikitext
27058 <x y>
27059
27060 <x.y>
27061
27062 <x-y>
27063
27064 1>2
27065
27066 x<y
27067
27068 a>b
27069
27070 1<d e>f
27071 !! html
27072 <p>&lt;x y&gt;
27073 </p><p>&lt;x.y&gt;
27074 </p><p>&lt;x-y&gt;
27075 </p><p>1&gt;2
27076 </p><p>x&lt;y
27077 </p><p>a&gt;b
27078 </p><p>1&lt;d e&gt;f
27079 </p>
27080 !! end
27081
27082 !! test
27083 HTML tag with necessary entities in attributes
27084 !! wikitext
27085 <span title="&amp;amp;">foo</span>
27086 !! html
27087 <p><span title="&amp;amp;">foo</span>
27088 </p>
27089 !! end
27090
27091 !! test
27092 HTML tag with 'unnecessary' entity encoding in attributes
27093 !! wikitext
27094 <span title="&amp;">foo</span>
27095 !! html
27096 <p><span title="&amp;">foo</span>
27097 </p>
27098 !! end
27099
27100 !! test
27101 HTML tag with broken attribute value quoting
27102 !! options
27103 parsoid=wt2html,html2html
27104 !! wikitext
27105 <span title="Hello world>Foo</span>
27106 !! html/php
27107 <p><span title="Hello world">Foo</span>
27108 </p>
27109 !! html/parsoid
27110 <p><span title="Hello world">Foo</span></p>
27111 !! end
27112
27113 !! test
27114 Self-closed tag with broken attribute value quoting
27115 !! options
27116 parsoid=wt2html,html2html
27117 !! wikitext
27118 <div title="Hello world />Foo
27119 !! html/php+tidy
27120 <div title="Hello world"></div><p>Foo
27121 </p>
27122 !! html/parsoid
27123 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
27124 !! end
27125
27126 !! test
27127 Table with broken attribute value quoting
27128 !! options
27129 parsoid=wt2html,html2html
27130 !! wikitext
27131 {|
27132 | title="Hello world|Foo
27133 |}
27134 !! html/php
27135 <table>
27136 <tr>
27137 <td title="Hello world">Foo
27138 </td></tr></table>
27139
27140 !! html/parsoid
27141 <table>
27142 <tr>
27143 <td title="Hello world">Foo
27144 </td></tr></table>
27145
27146 !! end
27147
27148 !! test
27149 Table with broken attribute value quoting on consecutive lines
27150 !! options
27151 parsoid=wt2html,html2html
27152 !! wikitext
27153 {|
27154 | title="Hello world|Foo
27155 | style="color:red|Bar
27156 |}
27157 !! html/php
27158 <table>
27159 <tr>
27160 <td title="Hello world">Foo
27161 </td>
27162 <td style="color:red">Bar
27163 </td></tr></table>
27164
27165 !! html/parsoid
27166 <table><tbody>
27167 <tr>
27168 <td title="Hello world">Foo
27169 </td><td style="color: red">Bar
27170 </td></tr></tbody></table>
27171
27172 !! end
27173
27174 !!test
27175 Accept empty td cell attribute
27176 !! wikitext
27177 {|
27178 | align="center" |foo|| |
27179 |}
27180 !! html
27181 <table>
27182 <tr>
27183 <td align="center">foo</td>
27184 <td>
27185 </td></tr></table>
27186
27187 !!end
27188
27189 !!test
27190 Non-empty attributes in th-cells
27191 !! wikitext
27192 {|
27193 !Foo!! style="color: red" |Bar
27194 |}
27195 !! html
27196 <table>
27197 <tr>
27198 <th>Foo</th>
27199 <th style="color: red">Bar
27200 </th></tr></table>
27201
27202 !!end
27203
27204 !!test
27205 Accept empty attributes in th-cells
27206 !! wikitext
27207 {|
27208 !|foo!!|bar
27209 |}
27210 !! html
27211 <table>
27212 <tr>
27213 <th>foo</th>
27214 <th>bar
27215 </th></tr></table>
27216
27217 !!end
27218
27219 !!test
27220 Empty table rows go away
27221 !! wikitext
27222 {|
27223 |Hello
27224 |there
27225 |- class="foo"
27226 |-
27227 |}
27228 !! html
27229 <table>
27230 <tr>
27231 <td>Hello
27232 </td>
27233 <td>there
27234 </td></tr>
27235
27236 </table>
27237
27238 !! end
27239
27240 ###
27241 ### Parsoid-centric tests for testing RTing of inter-element separators
27242 ### Edge cases not tested by existing parser tests and specific to
27243 ### Parsoid-specific serialization strategies.
27244 ###
27245
27246 !!test
27247 RT-ed inter-element separators should be valid separators
27248 !! wikitext
27249 {|
27250 |- [[foo]]
27251 |}
27252 !! html/php
27253 <table>
27254
27255 </table>
27256
27257 !! html/parsoid
27258 <table>
27259 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
27260 </tbody></table>
27261 !!end
27262
27263 # Parsoid-only test of a DOM pass
27264 !!test
27265 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
27266 !! wikitext
27267 {|
27268 |<small>foo
27269 bar
27270 |}
27271
27272 {|
27273 |<small>foo<small>
27274 |}
27275 !! html/parsoid
27276 <table>
27277 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
27278 <p>bar</p></small></td></tr>
27279 </tbody></table>
27280
27281 <table>
27282 <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>
27283 </tbody></table>
27284 !!end
27285
27286 # Note that the "style" attribute is really a template parameter here.
27287 # The = would have to be {{=}} if you wanted the literal.
27288 !!test
27289 Empty TD followed by TD with tpl-generated attribute
27290 !! wikitext
27291 {|
27292 |-
27293 |
27294 |{{echo|style='color:red'}}|foo
27295 |}
27296 !! html
27297 <table>
27298
27299 <tr>
27300 <td>
27301 </td>
27302 <td>foo
27303 </td></tr></table>
27304
27305 !!end
27306
27307 !!test
27308 Indented table with an empty td
27309 !! wikitext
27310 {|
27311 |-
27312 |
27313 |foo
27314 |}
27315 !! html
27316 <table>
27317
27318 <tr>
27319 <td>
27320 </td>
27321 <td>foo
27322 </td></tr></table>
27323
27324 !!end
27325
27326 ## We have some newline diffs RT-ing this edge case
27327 ## and it is not important enough -- we seem to be emitting
27328 ## at most 2 newlines after a </tr> and this is unrelated to
27329 ## the issue from T85627 that this is testing.
27330 !!test
27331 Indented table with blank lines in between (T85627)
27332 !! options
27333 parsoid=wt2html
27334 !! wikitext
27335 {|
27336 |foo
27337
27338
27339 |}
27340 !! html
27341 <table>
27342
27343 <tr>
27344 <td>foo
27345 </td></tr></table>
27346
27347 !!end
27348
27349 !!test
27350 Indented block & table
27351 !! wikitext
27352 <div>foo</div>
27353 {|
27354 |foo
27355 |}
27356 !! html/php
27357 <div>foo</div>
27358 <table>
27359 <tr>
27360 <td>foo
27361 </td></tr></table>
27362
27363 !! html/parsoid
27364 <div data-parsoid='{"stx":"html"}'>foo</div>
27365 <table><tbody>
27366 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
27367 </tbody></table>
27368 !!end
27369
27370 !! test
27371 Indent and comment before table row
27372 !! wikitext
27373 {|
27374 <!--hi-->|-
27375 |there
27376 |}
27377 !! html/php
27378 <table>
27379
27380 <tr>
27381 <td>there
27382 </td></tr></table>
27383
27384 !! html/parsoid
27385 <table>
27386 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
27387 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
27388 </tbody></table>
27389 !! end
27390
27391 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
27392 !!test
27393 Empty TR followed by a template-generated TR
27394 !!options
27395 parsoid
27396 !! wikitext
27397 {|
27398 |-
27399 {{echo|<tr><td>foo</td></tr>}}
27400 |}
27401 !! html
27402 <table>
27403 <tbody>
27404 <tr class='mw-empty-elt'></tr>
27405 <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}}]}'>
27406 <td>foo</td></tr>
27407 </tbody></table>
27408 !!end
27409
27410 ## PHP and parsoid output differ for this, and since this is primarily
27411 ## for testing Parsoid's serializer, marking this Parsoid only
27412 !!test
27413 Empty TR followed by mixed-ws-comment line should RT correctly
27414 !!options
27415 parsoid
27416 !! wikitext
27417 {|
27418 |-
27419 <!--c-->
27420 |-
27421 <!--c--> <!--d-->
27422 |}
27423 !! html
27424 <table>
27425 <tbody>
27426 <tr class='mw-empty-elt'></tr>
27427 <!--c-->
27428 <tr>
27429 <!--c--> </tr><!--d-->
27430 </tbody></table>
27431
27432 !!end
27433
27434 !!test
27435 Multi-line image caption generated by templates with/without trailing newlines
27436 !! wikitext
27437 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
27438 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
27439 !! html/parsoid
27440 <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>
27441 <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>
27442 !!end
27443
27444 !! test
27445 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
27446 !! options
27447 parsoid=html2wt
27448 !! html/parsoid
27449 <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>
27450
27451 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
27452 !! wikitext
27453 <includeonly>foo</includeonly>
27454 new para
27455
27456 [[Category:Foo]]
27457
27458 = new heading =
27459 !! end
27460
27461 ## PHP emits broken html for this, and since this is primarily
27462 ## a Parsoid serializer test, marking this Parsoid only
27463 !!test
27464 Improperly nested inline or quotes tags with whitespace in between
27465 !! wikitext
27466 <span> <s>x</span> </s>
27467 ''' ''x''' ''
27468 !! html/parsoid
27469 <p><span> <s>x</s></span><s> </s>
27470 <b> <i>x</i></b><i> </i>
27471 </p>
27472 !!end
27473
27474 !!test
27475 Encapsulate protected attributes from wt
27476 !! wikitext
27477 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
27478
27479 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
27480 |ok
27481 |}
27482 !! html/parsoid
27483 <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>
27484
27485 <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">
27486 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'>ok</td></tr>
27487 </tbody></table>
27488 !!end
27489
27490 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
27491 ## Having nested or stray pre tags results in the attempt to add duplicates,
27492 ## causing an assertion fail. This test tries to prevent that situation.
27493 !! test
27494 Ensure ParagraphWrapper can deal with stray closing pre tags
27495 !! options
27496 parsoid=wt2html
27497 !! wikitext
27498 plain text</pre>
27499 !! html/parsoid
27500 <p>plain text</p>
27501 !! end
27502
27503 ## Remex doesn't account for fostered content.
27504 !! test
27505 1. Ensure fostered text content is wrapped in element nodes
27506 !! options
27507 parsoid=wt2html
27508 !! wikitext
27509 <table>hi</table><table>ho</table>
27510 !! html/php+tidy
27511 hi<table></table>ho<table></table>
27512 !! html/parsoid
27513 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>hi</p><table data-parsoid='{"stx":"html"}'></table><p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>ho</p><table data-parsoid='{"stx":"html"}'></table>
27514 !! end
27515
27516 ## Remex doesn't account for fostered content.
27517 !! test
27518 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
27519 !! options
27520 parsoid=wt2html,wt2wt
27521 !! wikitext
27522 <table>
27523 <tr> || ||
27524 <td> a
27525 </table>
27526 !! html/php+tidy
27527 || ||
27528 <table>
27529 <tbody><tr><td> a
27530 </td></tr></tbody></table>
27531 !! html/parsoid
27532 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||</p>
27533 <table data-parsoid='{"stx":"html"}'>
27534 <tbody><tr data-parsoid='{"stx":"html","autoInsertedEnd":true}'><td data-parsoid='{"stx":"html","autoInsertedEnd":true}'> a
27535 </td></tr></tbody></table>
27536 !! end
27537
27538 ## Remex doesn't account for fostered content.
27539 !! test
27540 Encapsulation properly handles null DSR information from foster box
27541 !! options
27542 parsoid=wt2html,wt2wt
27543 !! wikitext
27544 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
27545 !! html/parsoid
27546 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>foo&lt;tr>&lt;td>bar&lt;/td>&lt;/tr>&lt;/table>"}},"i":0}}]}'>foo</p><table about="#mwt1" data-parsoid='{"stx":"html"}'><tbody><tr><td>bar</td></tr></tbody></table>
27547 !! end
27548
27549 ## Remex doesn't account for fostered content.
27550 !! test
27551 1. Encapsulate foster-parented transclusion content
27552 !! options
27553 parsoid=wt2wt,wt2html
27554 !! wikitext
27555 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
27556 !! html/php+tidy
27557 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
27558 !! html/parsoid
27559 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;tr>&lt;td>bar&lt;/td>&lt;/tr>"}},"i":0}},"&lt;/table>"]}'>foo</p><table about="#mwt2" data-parsoid='{"stx":"html"}'><tbody><tr><td>bar</td></tr></tbody></table>
27560 !! end
27561
27562 !! test
27563 2. Encapsulate foster-parented transclusion content
27564 !! options
27565 parsoid=wt2wt,wt2html
27566 !! wikitext
27567 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
27568 !! html/parsoid
27569 <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>
27570 <table>
27571 <tbody>
27572 <tr>
27573 <td>bar</td>
27574 </tr>
27575 </tbody>
27576 </table>
27577 !! end
27578
27579 !! test
27580 3. Encapsulate foster-parented transclusion content
27581 !! options
27582 parsoid=wt2wt,wt2html
27583 !! wikitext
27584 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27585 !! html/parsoid
27586 <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;]}">
27587 <p>foo</p>
27588 </div>
27589 <table>
27590 <tbody>
27591 <tr>
27592 <td>bar</td>
27593 </tr>
27594 </tbody>
27595 </table>
27596 !! end
27597
27598 !! test
27599 4. Encapsulate foster-parented transclusion content
27600 !! options
27601 parsoid=wt2wt,wt2html
27602 !! wikitext
27603 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27604 !! html/parsoid
27605 <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;]}">
27606 <p>foo</p>
27607 </div>
27608 <table>
27609 <tbody>
27610 <tr>
27611 <td>bar</td>
27612 </tr>
27613 </tbody>
27614 </table>
27615 !! end
27616
27617 ## Remex doesn't account for fostered content.
27618 !! test
27619 5. Encapsulate foster-parented transclusion content
27620 !!options
27621 parsoid=wt2wt,wt2html
27622 !! wikitext
27623 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27624 !! html/php+tidy
27625 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
27626 !! html/parsoid
27627 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>&lt;tr>&lt;td>&lt;div>&lt;p>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;/p>&lt;/div>&lt;/td>foo"}},"i":0}},"&lt;/tr>&lt;/table>"]}'>foo</p><table about="#mwt2" data-parsoid='{"stx":"html"}'><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
27628 !! end
27629
27630 ## Remex doesn't account for fostered content.
27631 !! test
27632 6. Encapsulate foster-parented transclusion content
27633 !! options
27634 parsoid=wt2wt,wt2html
27635 !! wikitext
27636 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27637 !! html/php+tidy
27638 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
27639 !! html/parsoid
27640 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>&lt;tr>&lt;td>&lt;div>&lt;p>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;/p>&lt;/div>&lt;/td>foo&lt;/tr>&lt;/table>"}},"i":0}}]}'>foo</p><table about="#mwt2" data-parsoid='{"stx":"html"}'><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p data-parsoid='{"stx":"html"}'>ok</p>
27641 !! end
27642
27643 !! test
27644 7. Encapsulate foster-parented transclusion content
27645 !!options
27646 parsoid=wt2wt,wt2html
27647 !! wikitext
27648 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27649 !! html/parsoid
27650 <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>
27651 <table>
27652 <tbody>
27653 <tr>
27654 <td>bar</td>
27655 </tr>
27656 </tbody>
27657 </table>
27658 !! end
27659
27660 ## Remex doesn't account for fostered content.
27661 # Note that the wt is broken on purpose: the = should be {{=}} if you
27662 # don't want it to be a template parameter key.
27663 !! test
27664 8. Encapsulate foster-parented transclusion content
27665 !! options
27666 parsoid=wt2wt,wt2html
27667 !! wikitext
27668 {{echo|a
27669 }}{|{{echo|style='color:red'}}
27670 |-
27671 |b
27672 |}
27673 !! html/php+tidy
27674 <p>a
27675 </p>
27676 <table>
27677
27678 <tbody><tr>
27679 <td>b
27680 </td></tr></tbody></table>
27681 !! html/parsoid
27682 <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">
27683 </span><p about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE","pi":[[{"k":"style","named":true}]]}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"style":{"wt":"&apos;color:red&apos;"}},"i":0}},"\n|-\n|b\n|}"]}'>{{{1}}}</p><table about="#mwt3">
27684 <tbody><tr>
27685 <td>b
27686 </td></tr></tbody></table>
27687 !! end
27688
27689 ## Remex doesn't account for fostered content.
27690 !! test
27691 9. Encapsulate foster-parented transclusion content
27692 !!options
27693 parsoid=wt2wt,wt2html
27694 !! wikitext
27695 <table>{{echo|hi</table>hello}}
27696 !! html/php+tidy
27697 hi<table></table><p>hello
27698 </p>
27699 !! html/parsoid
27700 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;/table>hello"}},"i":0}}]}'>hi</p><table about="#mwt2"></table><p about="#mwt2">hello</p>
27701 !! end
27702
27703 !! test
27704 Table in fosterable position
27705 !!options
27706 parsoid=wt2html
27707 !! wikitext
27708 {{OpenTable}}
27709 <div>
27710 {|
27711 |}
27712 </div>
27713 |}
27714 !! html/parsoid
27715 <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">
27716 </span>
27717 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27718
27719 <table>
27720 </table>
27721 !! end
27722
27723 # Parsoid only for T66747
27724 !! test
27725 Properly encapsulate empty-content transclusions in fosterable positions
27726 !! wikitext
27727 <table>
27728 {{#if:|
27729 <td>foo</td>
27730 }}
27731 </table>
27732 !! html/parsoid
27733 <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"}]]}'>
27734
27735 </table>
27736 !! end
27737
27738 !! test
27739 Always encapsulate foster box when template range is expanded to table
27740 !! options
27741 parsoid=wt2wt
27742 !! wikitext
27743 {|
27744 hello
27745 {{OpenTable}}
27746 |}
27747 !! html/parsoid
27748
27749 !! end
27750
27751 !! test
27752 T115289: Unclosed table
27753 !! wikitext
27754 {{echo|<table>}}<!--c-->[[Category:Two]]
27755 !! html/parsoid
27756 <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>
27757 !! end
27758
27759 !! test
27760 T115289: Don't migrate newlines out of tables with fostered content
27761 !! wikitext
27762 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27763 !! html/parsoid
27764 <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>
27765 !! end
27766
27767 !! test
27768 T73074: More fostering fun
27769 !! wikitext
27770 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27771 !! html/parsoid
27772 <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>
27773 !! end
27774
27775 !!test
27776 Support <object> element with .data attribute
27777 !!options
27778 parsoid=html2wt
27779 !! html/parsoid
27780 <object data="test.swf"></object>
27781 !! wikitext
27782 <object data="test.swf"></object>
27783 !!end
27784
27785 !! test
27786 Don't block XML namespace declaration
27787 !! wikitext
27788 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27789 !! html/php
27790 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27791 </p>
27792 !! html/parsoid
27793 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27794 !! end
27795
27796 # -----------------------------------------------------------------
27797 # The following section of tests are primarily to spec requirements
27798 # around Parsoid's serialization (old, new, edited content)
27799 #
27800 # All these tests are marked Parsoid html2wt and html2html only
27801 # ----------------------------------------------------------------
27802
27803 !! test
27804 Ignore rel attribute in a-tags during serialization to url-links
27805 !! options
27806 parsoid=html2wt
27807 !! html/parsoid
27808 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27809 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27810 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27811 !! wikitext
27812 http://en.wikipedia.org/wiki/Foobar
27813 http://en.wikipedia.org/wiki/Foobar
27814 http://en.wikipedia.org/wiki/Foobar
27815 !! end
27816
27817 # 'mi' is a localinterwiki prefix as well as a language
27818 !! test
27819 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27820 !! options
27821 parsoid=html2wt
27822 !! html/parsoid
27823 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27824 !! wikitext
27825 [[Foo]]
27826 !! end
27827
27828 !! test
27829 Parsoid should accept interwiki shortcuts
27830 !! options
27831 parsoid=html2wt
27832 !! html/parsoid
27833 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27834 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27835 <a href='./fr:Foo'>Foo</a></p>
27836 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27837 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27838 <a href='fr%3AFoo'>Foo</a></p>
27839 <p><a href='FR%3AFoo'>Foo</a>
27840 <a href='./FR:Foo'>Foo</a></p>
27841 !! wikitext
27842 [[:fr:Foo|Foo]]
27843 [[:fr:Foo|Foo]]
27844 [[:fr:Foo|Foo]]
27845
27846 [[:fr:Foo|Foo]]
27847 [[:fr:Foo|Foo]]
27848 [[:fr:Foo|Foo]]
27849
27850 [[:fr:Foo|Foo]]
27851 [[:fr:Foo|Foo]]
27852 !! end
27853
27854 !! test
27855 Parsoid should not accept invalid interwiki shortcuts
27856 !! options
27857 parsoid=html2wt
27858 !! html/parsoid
27859 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
27860 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
27861 <a href='news:Foo'>Foo</a></p>
27862 !! wikitext
27863 [news:Foo Foo]
27864 [news:Foo Foo]
27865 [news:Foo Foo]
27866 !! end
27867
27868 # See T93839
27869 !! test
27870 New wikilinks should be serialized properly
27871 !! options
27872 parsoid=html2wt
27873 !! html/parsoid
27874 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
27875 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
27876 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
27877 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
27878 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
27879 !! wikitext
27880 [[Foo]]
27881 [[Foo]]
27882 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
27883 http://en.wikipedia.org/wiki/Foo
27884 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
27885 !! end
27886
27887 !! test
27888 New wiki links (href variations)
27889 !! options
27890 parsoid=html2wt
27891 !! html/parsoid
27892 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27893 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
27894 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
27895 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
27896 !! wikitext
27897 [[Foo_bar]]
27898 [[Foo_bar]]
27899 [[Foo_bar]]
27900 [[Toxine bactérienne]]
27901 !! end
27902
27903 !! test
27904 New wiki links (content string variations)
27905 !! options
27906 parsoid=html2wt
27907 !! html/parsoid
27908 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27909 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
27910 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
27911 !! wikitext
27912 [[Foo_bar]]
27913 [[Foo bar]]
27914 [[Foo_bar|./Foo_bar]]
27915 !! end
27916
27917 !! test
27918 New category links (href variations)
27919 !! options
27920 parsoid=html2wt
27921 !! html/parsoid
27922 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
27923 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
27924 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
27925 !! wikitext
27926 [[Category:Toxine bactérienne]]
27927 [[Category:Toxine bactérienne]]
27928 [[Category:Toxine bactérienne]]
27929 !! end
27930
27931 !! test
27932 New sol transparent links don't need indent-pre nowiki protection
27933 !! options
27934 parsoid=html2wt
27935 language=de
27936 !! html/parsoid
27937 <link rel="mw:PageProp/redirect" href="./Main_Page">
27938 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27939 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27940 !! wikitext
27941 #WEITERLEITUNG [[Main Page]]
27942 <!-- this is good --> [[Category:Good]]
27943 <!-- this is great --> [[Kategorie:Great]]
27944 !! end
27945
27946 !! test
27947 New interlanguage links (href variations)
27948 !! options
27949 parsoid=html2wt
27950 !! html/parsoid
27951 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
27952 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
27953 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
27954 !! wikitext
27955 [[es:Toxine bactérienne]]
27956 [[es:Toxine_bactérienne]]
27957 [[es:Toxine_bactérienne]]
27958 !! end
27959
27960 !! test
27961 Image: Modifying size of an image (1)
27962 !! options
27963 parsoid={
27964 "modes": ["wt2wt"],
27965 "changes": [
27966 ["img[height]", "attr", "height", "22"],
27967 ["img[width]", "attr", "width", "200"]
27968 ]
27969 }
27970 !! wikitext
27971 [[Image:Foobar.jpg|230x230px]]
27972 !! wikitext/edited
27973 [[Image:Foobar.jpg|200x200px]]
27974 !!end
27975
27976 !! test
27977 Image: Modifying size of an image (2)
27978 !! options
27979 parsoid={
27980 "modes": ["wt2wt"],
27981 "changes": [
27982 ["img[height]", "attr", "height", "100"],
27983 ["img[width]", "attr", "width", "500"]
27984 ]
27985 }
27986 !! wikitext
27987 [[Image:Foobar.jpg|230x230px]]
27988 !! wikitext/edited
27989 [[Image:Foobar.jpg|500x500px]]
27990 !!end
27991
27992 # Change in size is ignored so long as class='mw-default-size'
27993 !! test
27994 Image: Modifying size of an image (3)
27995 !! options
27996 parsoid={
27997 "modes": ["wt2wt"],
27998 "changes": [
27999 ["figure[class]", "removeClass", "mw-default-size"],
28000 ["figure img", "attr", "height", "19"],
28001 ["figure img", "attr", "width", "170"]
28002 ]
28003 }
28004 !! wikitext
28005 [[Image:Foobar.jpg|thumb]]
28006 !! wikitext/edited
28007 [[Image:Foobar.jpg|thumb|170x170px]]
28008 !!end
28009
28010 !! test
28011 Image: Modifying alignment of an image (T50665)
28012 !! options
28013 parsoid={
28014 "modes": ["wt2wt"],
28015 "changes": [
28016 ["figure[class]", "removeClass", "mw-halign-right"],
28017 ["figure[class]", "addClass", "mw-halign-left"]
28018 ]
28019 }
28020 !! wikitext
28021 [[Image:Foobar.jpg|thumb|caption|right]]
28022 !! wikitext/edited
28023 [[Image:Foobar.jpg|thumb|caption|left]]
28024 !! end
28025
28026 !! test
28027 Image: Modifying mw-default-size of an frameless image (T64805)
28028 !! options
28029 parsoid={
28030 "modes": ["wt2wt"],
28031 "changes": [
28032 ["figure.mw-default-size", "removeClass", "mw-default-size"]
28033 ]
28034 }
28035 !! wikitext
28036 [[Image:Foobar.jpg|frameless|right]]
28037 !! wikitext/edited
28038 [[Image:Foobar.jpg|frameless|right|220x220px]]
28039 !! end
28040
28041 !! test
28042 Image: Modifying valign of an image (T51221)
28043 !! options
28044 parsoid={
28045 "modes": ["wt2wt"],
28046 "changes": [
28047 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
28048 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
28049 ]
28050 }
28051 !! wikitext
28052 [[File:Foobar.jpg|20px|middle]]
28053 !! wikitext/edited
28054 [[File:Foobar.jpg|20px|text-top]]
28055 !! end
28056
28057 !! test
28058 Image: Modifying alt attribute of an image (T58400)
28059 !! options
28060 parsoid={
28061 "modes": ["wt2wt"],
28062 "changes": [
28063 ["img[alt]", "attr", "alt", "some alternate edited text"]
28064 ]
28065 }
28066 !! wikitext
28067 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
28068 !! wikitext/edited
28069 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
28070 !!end
28071
28072 !! test
28073 Image: Modifying caption of an image
28074 !! options
28075 parsoid={
28076 "modes": ["wt2wt"],
28077 "changes": [
28078 ["figcaption", "text", "new caption"]
28079 ]
28080 }
28081 !! wikitext
28082 [[Image:Foobar.jpg|thumb|original caption]]
28083 !! wikitext/edited
28084 [[Image:Foobar.jpg|thumb|new caption]]
28085 !!end
28086
28087 !! test
28088 Image: empty alt attribute (T50924)
28089 !! options
28090 parsoid
28091 !! wikitext
28092 [[File:Foobar.jpg|thumb|alt=|bar]]
28093 !! html
28094 <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>
28095 !! end
28096
28097 !! test
28098 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
28099 !! options
28100 parsoid=html2wt
28101 language=ar
28102 disabled
28103 !! html/parsoid
28104 <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>
28105 !! wikitext
28106 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
28107 !! end
28108
28109 !! test
28110 Image: Block level image should have \n before and after
28111 !! wikitext
28112 123
28113 [[File:Foobar.jpg|right|thumb|150x150px]]
28114 456
28115 !! html/parsoid
28116 <p>123</p>
28117 <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>
28118 <p>456</p>
28119 !! end
28120
28121 !! test
28122 Image: New block level image should have \n before and after (existing content)
28123 !! wikitext
28124 123
28125 [[File:Foobar.jpg|right|thumb|150x150px]]
28126 456
28127 !! html/parsoid
28128 <p>123</p>
28129 <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>
28130 <p>456</p>
28131 !! end
28132
28133 !! test
28134 Image: upright option (parsoid)
28135 !! wikitext
28136 [[File:Foobar.jpg|thumb|upright|caption]]
28137 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
28138 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
28139 !! html/parsoid
28140 <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>
28141 <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>
28142 <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>
28143 !! end
28144
28145 !! test
28146 Image: upright option is ignored on inline and frame images (parsoid)
28147 !! wikitext
28148 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
28149 !! html/parsoid
28150 <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>
28151 !! end
28152
28153 !! test
28154 Image: in template parameter with empty parameter
28155 !! wikitext
28156 {{echo|[[File:Foobar.jpg|link=]]}}
28157 !! html/parsoid
28158 <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>
28159 !! end
28160
28161 !! test
28162 Image: from basic HTML (1)
28163 !! options
28164 parsoid=html2wt
28165 !! html/parsoid
28166 <span typeof="mw:Image">
28167 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28168 </span>
28169 !! wikitext
28170 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28171 !! end
28172
28173 !! test
28174 Image: from basic HTML (2)
28175 !! options
28176 parsoid=html2wt
28177 !! html/parsoid
28178 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28179 !! wikitext
28180 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28181 !! end
28182
28183 !! test
28184 Image: from basic HTML (3)
28185 !! options
28186 parsoid=html2wt
28187 !! html/parsoid
28188 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
28189 !! wikitext
28190 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
28191 !! end
28192
28193 !! test
28194 Image: from basic HTML (4)
28195 !! options
28196 parsoid=html2wt
28197 !! html/parsoid
28198 <img src="./File:Foobar.jpg">
28199 !! wikitext
28200 [[File:Foobar.jpg|link=]]
28201 !! end
28202
28203 !! test
28204 Image: Invalid title as link
28205 !! wikitext
28206 [[File:Foobar.jpg|link=<]]
28207 !! html/php
28208 <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>
28209 </p>
28210 !! html/parsoid
28211 <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>
28212 !! end
28213
28214 !! test
28215 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
28216 !! options
28217 parsoid=html2wt
28218 !! html/parsoid
28219 <ul>
28220 <li><p>foo</p></li>
28221 </ul>
28222 !! wikitext
28223 * foo
28224 !! end
28225
28226 !! test
28227 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
28228 !! options
28229 parsoid=html2wt
28230 !! html/parsoid
28231 <ul> <li>foo</li></ul>
28232 !! wikitext
28233 * foo
28234 !! end
28235
28236 !! test
28237 Don't strip leading whitespace when handling indent-pre suppressing tags
28238 !! options
28239 parsoid=html2wt
28240 !! html/parsoid
28241 <table>
28242 <tr><td> indented row</td></tr>
28243 </table>
28244 <blockquote><p>
28245 <b>This is very bold of you!</b>
28246 </p>
28247 <table><tr><td>
28248 indented cell (no pre-wrapping!)
28249 </td></tr></table>
28250 </blockquote>
28251 <p>foo</p>
28252 <div>bar</div>
28253 !! wikitext
28254 {|
28255 | indented row
28256 |}
28257 <blockquote>
28258 '''This is very bold of you!'''
28259
28260 {|
28261 |
28262 indented cell (no pre-wrapping!)
28263 |}
28264 </blockquote>
28265 foo
28266 <div>bar</div>
28267 !! end
28268
28269 !! test
28270 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
28271 !! options
28272 parsoid=html2wt
28273 !! html/parsoid
28274 <p>foo</p>
28275 <span>bar</span>
28276
28277 <span>foo2
28278 </span>bar2
28279
28280 <div>foo</div>
28281 <span>bar</span>
28282
28283 <div>
28284 <span>foo</span>
28285 </div>
28286 !! wikitext
28287 foo
28288
28289 <span>bar</span>
28290
28291 <span>foo2
28292 <nowiki> </nowiki></span>bar2
28293
28294 <div>foo</div>
28295 <nowiki> </nowiki><span>bar</span>
28296
28297 <div>
28298 <nowiki> </nowiki><span>foo</span>
28299 </div>
28300 !! end
28301
28302 !! test
28303 Lists: Dont insert newlines in a serialized list item.
28304 !! options
28305 parsoid=html2wt
28306 !! html/parsoid
28307 <ul><li>a<br>b</li><li>c</li></ul>
28308 !! wikitext
28309 * a<br />b
28310 * c
28311 !! end
28312
28313 !! test
28314 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
28315 !! options
28316 parsoid={
28317 "modes": ["html2wt"],
28318 "scrubWikitext": false
28319 }
28320 !! html/parsoid
28321 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28322 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28323
28324 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28325 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28326
28327 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
28328
28329 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28330 !! wikitext
28331 == hello there [[Category:A1]] ==
28332
28333 == [[Category:A2]] hi pal ==
28334
28335 == <!--foo--> [[Category:A3]] how goes it ==
28336
28337 == it goes well [[Category:A4]] <!--bar--> ==
28338
28339 ==howdy [[Category:A5]]==
28340
28341 == __TOC__ ok ==
28342 !! end
28343
28344 !! test
28345 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
28346 !! options
28347 parsoid={
28348 "modes": ["html2wt"],
28349 "scrubWikitext": true
28350 }
28351 !! html/parsoid
28352 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28353 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28354
28355 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28356 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28357
28358 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28359 !! wikitext
28360 == hello there ==
28361 [[Category:A1]]
28362 [[Category:A2]]
28363
28364 == hi pal ==
28365
28366 <!--foo-->[[Category:A3]]
28367
28368 == how goes it ==
28369
28370 == it goes well ==
28371 [[Category:A4]] <!--bar-->
28372
28373 __TOC__
28374
28375 == ok ==
28376 !! end
28377
28378 !! test
28379 Headings: Don't hoist metas that come from templates
28380 !! options
28381 parsoid={
28382 "modes": ["html2wt"],
28383 "scrubWikitext": true
28384 }
28385 !! html/parsoid
28386 <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>
28387 !! wikitext
28388 == {{echo|foo [[Category:Foo]]}} ==
28389 !! end
28390
28391 !! test
28392 Headings: Category in ref isn't hoisted
28393 !! options
28394 parsoid={
28395 "modes": ["html2wt"],
28396 "scrubWikitext": true
28397 }
28398 !! html/parsoid
28399 <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>
28400
28401 <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>
28402 !! wikitext
28403 == foo <ref>bar
28404 [[Category:Baz]] </ref> ==
28405
28406 <references />
28407 !! end
28408
28409 !! test
28410 Parsoid: Serialize positional parameters with = in them as named parameter
28411 !! options
28412 parsoid=html2wt
28413 !! html/parsoid
28414 <p about="#mwt1" typeof="mw:Transclusion"
28415 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
28416
28417 <p about="#mwt1" typeof="mw:Transclusion"
28418 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
28419
28420 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28421 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28422 <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>
28423 !! wikitext
28424 {{echo|1=f=oo}}
28425
28426 {{echo|1=f=oo|2=bar}}
28427
28428 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28429 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28430 {{echo|<nowiki>f=oo</nowiki>|bar}}
28431 !! end
28432
28433 !! test
28434 Parsoid: Serialize positional parameters with = in extlink as named parameter
28435 !! options
28436 parsoid=html2wt
28437 !! html/parsoid
28438 <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>
28439 !! wikitext
28440 {{echo|1=http://stuff?is=ok}}
28441 !! end
28442
28443 !! test
28444 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
28445 !! options
28446 parsoid=html2wt
28447 !! html/parsoid
28448 <div>a<p>b</p></div>
28449 <div>a
28450 <p>b</p></div>
28451 <div>
28452 a
28453 <p>b</p></div>
28454 !! wikitext
28455 <div>a
28456 b
28457 </div>
28458 <div>a
28459 b
28460 </div>
28461 <div>
28462 a
28463
28464 b
28465 </div>
28466 !! end
28467
28468 !! test
28469 Substrings resembling wikitext in hrefs should not get nowiki escapes
28470 !! options
28471 parsoid=html2wt
28472 !! html/parsoid
28473 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
28474 !! wikitext
28475 [[Foo''bar''baz]]
28476 !! end
28477
28478 !! test
28479 Enforce single-line context in the serializer
28480 !! options
28481 parsoid=html2wt
28482 !! html/parsoid
28483 <h2>testing
28484 123</h2>
28485
28486 <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">
28487 </span><span about="#mwt1">you</span> </h2>
28488
28489 <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>
28490
28491 <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
28492 there</span></li></ol>
28493
28494 <ul><li>asd
28495 sdf</li></ul>
28496
28497 <ul><li>foo
28498 bar
28499 baz</li>
28500 <li>foo <b>bar</b>
28501 baz</li></ul>
28502
28503 <dl><dt>hi
28504 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
28505 ho</dd></dl>
28506
28507 <dl><dd> <table>
28508 <tbody><tr><td> ha
28509 ha
28510 ha</td></tr>
28511 </tbody></table></dd></dl>
28512 !! wikitext
28513 == testing 123 ==
28514
28515 == hi {{bogus|there
28516 you}} ==
28517
28518 == foo <ref>hello
28519 there</ref> ==
28520
28521 <references />
28522
28523 * asd sdf
28524
28525 * foo bar baz
28526 * foo '''bar''' baz
28527
28528 ; hi ho : hi ho
28529
28530 : {|
28531 | ha
28532 ha
28533 ha
28534 |}
28535 !! end
28536
28537 !! test
28538 Serialize new placeholder space without spans
28539 !! options
28540 parsoid=html2wt
28541 !! html/parsoid
28542 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
28543
28544 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
28545
28546 <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>
28547 !! wikitext
28548 foo : bar
28549
28550 foo : bar
28551
28552 <ref>foo : bar</ref>ok
28553 !! end
28554
28555
28556 #-----------------------
28557 # Tag minimization tests
28558 #-----------------------
28559
28560 !! test
28561 1. I/B quote minimization: wikitext-only tags should be combined
28562 !! options
28563 parsoid=html2wt
28564 !! html/parsoid
28565 <p><i>A</i><i>B</i></p>
28566 <p><b>A</b><b>B</b></p>
28567 <p><i>A</i><b><i>B</i></b></p>
28568 <p><b>A</b><i><b>B</b></i></p>
28569 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
28570 <p><i><b>A</b></i><i><b>B</b></i></p>
28571 <p><i><b>A</b></i><b><i>B</i></b></p>
28572 <p><b><i>A</i></b><i><b>B</b></i></p>
28573 !! wikitext
28574 ''AB''
28575
28576 '''AB'''
28577
28578 ''A'''B'''''
28579
28580 '''A''B'''''
28581
28582 '''A''BC''D'''
28583
28584 '''''AB'''''
28585
28586 '''''AB'''''
28587
28588 '''''AB'''''
28589 !! end
28590
28591 !! test
28592 2. I/B quote minimization: wikitext and html tags should not be combined
28593 !! options
28594 parsoid=html2wt
28595 !! html/parsoid
28596 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
28597 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
28598 !! wikitext
28599 ''A''<i>B</i>
28600
28601 ''A''<nowiki/>'''<i>B</i>'''
28602 !! end
28603
28604 !! test
28605 3. I/B quote minimization: templated content stops minimization
28606 !! options
28607 parsoid=html2wt
28608 !! html/parsoid
28609 <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>
28610 <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>
28611 !! wikitext
28612 ''A''{{echo|''B''}}
28613
28614 ''A''{{echo|'''''B'''''}}
28615 !! end
28616
28617 !! test
28618 4. I/B quote minimization: new content should be mimimized with adjacent old content
28619 !! options
28620 parsoid=html2wt
28621 !! html/parsoid
28622 <p><i>A</i><i>B</i></p>
28623 <p><b>A</b><b>B</b></p>
28624 <p><i>A</i><b><i>B</i></b></p>
28625 !! wikitext
28626 ''AB''
28627
28628 '''AB'''
28629
28630 ''A'''B'''''
28631 !! end
28632
28633 !! test
28634 5a. Merge adjacent quote nodes if they've been edited
28635 !! options
28636 parsoid={
28637 "modes": ["wt2wt", "selser"],
28638 "changes": [
28639 ["p", "contents", "remove", ":contains('b')"]
28640 ]
28641 }
28642 !! wikitext
28643 ''a''b''c''
28644 !! wikitext/edited
28645 ''ac''
28646 !! end
28647
28648 !! test
28649 5b. Merge adjacent quote nodes if they've been edited
28650 !! options
28651 parsoid={
28652 "modes": ["wt2wt", "selser"],
28653 "changes": [
28654 ["#x", "remove"]
28655 ]
28656 }
28657 !! wikitext
28658 ''a''<span id="x">b</span>''c''
28659 !! wikitext/edited
28660 ''ac''
28661 !! end
28662
28663 !! test
28664 1. Merge adjacent link nodes as long as at least one element is new
28665 !! options
28666 parsoid={
28667 "modes": ["html2wt"],
28668 "scrubWikitext": true
28669 }
28670 !! html/parsoid
28671 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28672 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28673 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28674 !! wikitext
28675 [[Football]]
28676 [[Football]]
28677 [[Football|Foot]][[Football|ball]]
28678 !! end
28679
28680 !! test
28681 2. Merge adjacent link nodes and enable additional normalizations
28682 !! options
28683 parsoid={
28684 "modes": ["html2wt"],
28685 "scrubWikitext": true
28686 }
28687 !! html/parsoid
28688 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28689 !! wikitext
28690 ''[[Football]]''
28691 !! end
28692
28693 !! test
28694 3. Don't merge adjacent link nodes if scrubWikitext is false
28695 !! options
28696 parsoid={
28697 "modes": ["html2wt"],
28698 "scrubWikitext": false
28699 }
28700 !! html/parsoid
28701 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28702 !! wikitext
28703 [[Football|Foot]][[Football|ball]]
28704 !! end
28705
28706 !! test
28707 1. Move format tags outside of WikiLink
28708 !! options
28709 parsoid={
28710 "modes": ["html2wt"],
28711 "scrubWikitext": true
28712 }
28713 !! html/parsoid
28714 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
28715 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
28716 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
28717 !! wikitext
28718 ''[[Football]]''
28719 '''''[[Football]]'''''
28720 <u>'''''[[Football]]'''''</u>
28721 !! end
28722
28723 !! test
28724 2. Move format tags outside of WikiLink with mergable A tags
28725 !! options
28726 parsoid={
28727 "modes": ["html2wt"],
28728 "scrubWikitext": true
28729 }
28730 !! html/parsoid
28731 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
28732 !! wikitext
28733 '''''[[Football]]'''''
28734 !! end
28735
28736 !! test
28737 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
28738 !! options
28739 parsoid={
28740 "modes": ["html2wt"],
28741 "scrubWikitext": true
28742 }
28743 !! html/parsoid
28744 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
28745 !! wikitext
28746 <font color="red"><u>'''[[Foo]]'''</u></font>
28747 !! end
28748
28749 !! test
28750 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
28751 !! options
28752 parsoid={
28753 "modes": ["html2wt"],
28754 "scrubWikitext": true
28755 }
28756 !! html/parsoid
28757 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
28758 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
28759 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
28760 !! wikitext
28761 [[Foo|<font color="red">Foo</font>]]
28762 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
28763 [[Foo|<span class="Bar">Foo</span>]]
28764 !! end
28765
28766 !! test
28767 5. T194083 Regression test: Manual edit test that also enables scrubWikitext to move format tags outside wikilinks
28768 !! options
28769 parsoid={
28770 "modes": ["selser"],
28771 "scrubWikitext": true,
28772 "changes": [
28773 ["a", "html", "<i>Foo</i>"]
28774 ]
28775 }
28776 !! wikitext
28777 [[Foo]]
28778 !! wikitext/edited
28779 ''[[Foo]]''
28780 !! end
28781
28782 !! test
28783 6. Regression test: Manual edit test to ensure diff markers are not lost
28784 !! options
28785 parsoid={
28786 "modes": ["selser"],
28787 "scrubWikitext": true,
28788 "changes": [
28789 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
28790 ]
28791 }
28792 !! wikitext
28793 ''Foo''
28794 !! wikitext/edited
28795 ''[[Foo]]''
28796 !! end
28797
28798 #------------------------------
28799 # End of tag minimization tests
28800 #------------------------------
28801
28802 !!test
28803 T56262: New entities
28804 !! options
28805 parsoid=html2wt
28806 !! html/parsoid
28807 <span typeof="mw:Entity">&nbsp;</span>
28808 !! wikitext
28809 &nbsp;
28810 !! end
28811
28812 ## Note that there is no wikitext output for 'unknownproperty' ##
28813 ## Unknown magic words are silently dropped ##
28814
28815 !! test
28816 Magic words
28817 !! options
28818 parsoid=html2wt
28819 !! html/parsoid
28820 <meta property='mw:PageProp/toc' />
28821 <meta property='mw:PageProp/notoc' />
28822 <meta property='mw:PageProp/forcetoc' />
28823 <meta property='mw:PageProp/index' />
28824 <meta property='mw:PageProp/noindex' />
28825 <meta property='mw:PageProp/nogallery' />
28826 <meta property='mw:PageProp/noeditsection' />
28827 <meta property='mw:PageProp/notitleconvert' />
28828 <meta property='mw:PageProp/nocontentconvert' />
28829 <meta property='mw:PageProp/unknownproperty' />
28830 !! wikitext
28831 __TOC__
28832 __NOTOC__
28833 __FORCETOC__
28834 __INDEX__
28835 __NOINDEX__
28836 __NOGALLERY__
28837 __NOEDITSECTION__
28838 __NOTITLECONVERT__
28839 __NOCONTENTCONVERT__
28840 !! end
28841
28842 !! test
28843 Consecutive <pre>s should not get merged
28844 !! options
28845 parsoid=html2wt,html2html
28846 !! html/parsoid
28847 <pre>a</pre><pre>b</pre>
28848
28849 <pre>c
28850 </pre><pre>
28851 d</pre>
28852
28853 <pre>e
28854
28855 </pre><pre>
28856
28857 f</pre>
28858 !! wikitext
28859 a
28860
28861 b
28862
28863 c
28864
28865 d
28866
28867 e
28868
28869
28870
28871 f
28872 !! end
28873
28874 !! test
28875 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
28876 !! options
28877 parsoid=html2wt
28878 !! html/parsoid
28879 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
28880 !! wikitext
28881 [[Special:BookSources/1234567890|ISBN 1234567895]]
28882 !! end
28883
28884 !! test
28885 Edited RFC links not serializable as RFC links should serialize as extlinks
28886 !! options
28887 parsoid=html2wt
28888 !! html/parsoid
28889 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
28890 !! wikitext
28891 [https://tools.ietf.org/html/rfc123 New RFC]
28892 !! end
28893
28894 !! test
28895 Edited PMID links not serializable as PMID links should serialize as extlinks
28896 !! options
28897 parsoid=html2wt
28898 !! html/parsoid
28899 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
28900 !! wikitext
28901 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
28902 !! end
28903
28904 !! test
28905 WTS of autolinks with trailing/surrounding context
28906 !! options
28907 parsoid=html2wt
28908 !! html/parsoid
28909 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
28910 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
28911 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
28912 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
28913 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
28914 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
28915 !! wikitext
28916 http://cscott.net'''foo'''
28917
28918 http://cscott.net<b>foo</b>
28919
28920 '''http://cscott.net'''
28921
28922 '''http://cscott.net '''
28923
28924 '''http://cscott.net<nowiki/>x'''
28925
28926 http://cscott.net<nowiki/>x
28927 !! end
28928
28929 !! test
28930 WTS of autolinks with nowikis (round-trip)
28931 !! wikitext
28932 x<nowiki/>http://cscott.net<nowiki/>x
28933 !! html/parsoid
28934 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
28935 !! end
28936
28937 # this is the "easy" test because it leaves in place all the
28938 # data-parsoid information indicating this is an autolink
28939 !! test
28940 WTS of autolinks with escapes (editing)
28941 !! options
28942 parsoid={
28943 "modes": ["wt2wt"],
28944 "changes": [
28945 [ "span", "remove" ]
28946 ]
28947 }
28948 !! wikitext
28949 x<nowiki/>http://cscott.net<nowiki/>x
28950 !! wikitext/edited
28951 x<nowiki/>http://cscott.net<nowiki/>x
28952 !! end
28953
28954 !! test
28955 WTS of edited autolink-like text (T103364)
28956 !! options
28957 parsoid={
28958 "modes": ["wt2wt"],
28959 "changes": [
28960 [ "span[typeof]", "removeAttr", "typeof" ]
28961 ]
28962 }
28963 !! wikitext
28964 Not a link: <nowiki>http://example.com</nowiki>.
28965 !! wikitext/edited
28966 Not a link: <span><nowiki>http://example.com</nowiki></span>.
28967 !! end
28968
28969 !! test
28970 WTS of newly-authored autolink-like text (T103364)
28971 !! options
28972 parsoid=html2wt
28973 !! html/parsoid
28974 <p>http://example.com is not a link.</p>
28975 !! wikitext
28976 <nowiki>http://example.com</nowiki> is not a link.
28977 !! end
28978
28979 !! test
28980 WTS of autolink-like text after an autolink (T108563)
28981 !! options
28982 parsoid=html2wt
28983 !! html/parsoid
28984 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
28985 !! wikitext
28986 http://example.com <nowiki>http://example.com</nowiki> is not a link.
28987 !! end
28988
28989 !! test
28990 Magic links inside links (not autolinked)
28991 !! wikitext
28992 [[Foo|http://example.com]]
28993 [[Foo|RFC 1234]]
28994 [[Foo|PMID 1234]]
28995 [[Foo|ISBN 123456789x]]
28996
28997 [http://foo.com http://example.com]
28998 [http://foo.com RFC 1234]
28999 [http://foo.com PMID 1234]
29000 [http://foo.com ISBN 123456789x]
29001 !! html+tidy
29002 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
29003 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
29004 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
29005 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
29006 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
29007 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
29008 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
29009 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
29010 </p>
29011 !! html/parsoid
29012 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
29013 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
29014 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
29015 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
29016
29017 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
29018 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
29019 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
29020 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
29021 !! end
29022
29023 !! test
29024 Magic links inside image captions (autolinked)
29025 !! wikitext
29026 [[File:Foobar.jpg|thumb|http://example.com]]
29027 [[File:Foobar.jpg|thumb|RFC 1234]]
29028 [[File:Foobar.jpg|thumb|PMID 1234]]
29029 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
29030 !! html+tidy
29031 <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>
29032 <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>
29033 <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>
29034 <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>
29035 !! html/parsoid
29036 <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>
29037 <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>
29038 <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>
29039 <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>
29040 !! end
29041
29042 !! test
29043 WTS of magic word text (T109371)
29044 !! options
29045 parsoid=html2wt
29046 !! html/parsoid
29047 <p>RFC 1234</p>
29048 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
29049 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
29050 !! wikitext
29051 <nowiki>RFC 1234</nowiki>
29052
29053 [http://foo.com RFC 1234]
29054
29055 [[Foo|RFC 1234]]
29056 !! end
29057
29058 !! test
29059 Edited Redirect link should emit a non-piped wikitext link
29060 !! options
29061 parsoid=html2wt
29062 !! html/parsoid
29063 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
29064 !! wikitext
29065 #REDIRECT [[Bar]]
29066 !! end
29067
29068 !! test
29069 T75121: Infer extension name from typeOf if data-mw is not present
29070 !! options
29071 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29072 !! html/parsoid
29073 <div typeOf="mw:Extension/foo"></div>
29074 !! wikitext
29075 <foo />
29076 !! end
29077
29078 # Note that the <p> wrapping isn't present in PHP parser output
29079 # The important thing for this test is that P-wrapping doesn't
29080 # interfere with the <nowiki> protection for leading - in <td>
29081 # (which isn't necessary for <th>).
29082 !! test
29083 T88318: p-wrapped dash in table.
29084 !! options
29085 parsoid=html2wt,wt2wt
29086 !! html/parsoid
29087 <table><tbody>
29088 <tr><th><p>-</p></th><th><p>- </p></th></tr>
29089 <tr><td><p>-</p></td><td><p>- </p></td></tr>
29090 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
29091 </tbody></table>
29092 !! wikitext
29093 {|
29094 !-
29095 !-
29096 |-
29097 |<nowiki>-</nowiki>
29098 |<nowiki>- </nowiki>
29099 |-
29100 |<small>-</small>
29101 |<br />
29102 -
29103 |<br />-
29104 |}
29105 !! html/php+tidy
29106 <table>
29107 <tbody><tr>
29108 <th>-
29109 </th>
29110 <th>-
29111 </th></tr>
29112 <tr>
29113 <td>-
29114 </td>
29115 <td>-
29116 </td></tr>
29117 <tr>
29118 <td><small>-</small>
29119 </td>
29120 <td><br />
29121 <p>-
29122 </p>
29123 </td>
29124 <td><br />-
29125 </td></tr></tbody></table>
29126 !! end
29127
29128 !! test
29129 T149209: WTS: Handle newlines in table cells properly
29130 !! options
29131 parsoid=html2wt
29132 !! html/parsoid
29133 <table>
29134 <tbody>
29135 <tr><td>a
29136 b
29137 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
29138 <tr><td><p>x</p>
29139 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
29140 </tbody></table>
29141 <table>
29142 <tbody>
29143 <tr><th>a
29144 b
29145 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
29146 <tr><th><p>x</h>
29147 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
29148 </tbody></table>
29149 !! wikitext
29150 {|
29151 |a
29152 b
29153 |c
29154 |-
29155 |x
29156 {{!}}y
29157 |}
29158 {|
29159 !a
29160 b
29161 !c
29162 |-
29163 !x
29164 !y
29165 |}
29166 !! end
29167
29168 !! test
29169 T149209: Selser: Handle newlines in table cells properly
29170 !! options
29171 parsoid={
29172 "modes": ["selser"],
29173 "changes": [
29174 [ "#h1", "html", "a\nb\n" ],
29175 [ "#h2", "html", "a\nb\n" ],
29176 [ "#c1", "html", "a\nb\n" ],
29177 [ "#c2", "html", "<p>a</p>" ],
29178 [ "#c3", "html", "<p>a</p>" ],
29179 [ "#c4", "html", "edit-me<p>a</p>" ]
29180 ]
29181 }
29182 !! wikitext
29183 {|
29184 ! id="h1" |edit-me!!1
29185 |-
29186 ! id="h2" |edit-me||2
29187 |-
29188 | id="c1" |edit-me||3
29189 |-
29190 | id="c2" |edit-me||4
29191 |-
29192 | id="c3" |edit-me||p||q||r
29193 |-
29194 | id="c4" |edit-me||p||q||r
29195 |}
29196 !! wikitext/edited
29197 {|
29198 ! id="h1" |a
29199 b
29200 !1
29201 |-
29202 ! id="h2" |a
29203 b
29204 !2
29205 |-
29206 | id="c1" |a
29207 b
29208 |3
29209 |-
29210 | id="c2" |a
29211 |4
29212 |-
29213 | id="c3" |a
29214 |p||q||r
29215 |-
29216 | id="c4" |edit-me
29217 a
29218 |p||q||r
29219 |}
29220 !! end
29221
29222 !! test
29223 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
29224 !! options
29225 parsoid=html2wt
29226 !! html/parsoid
29227 <table id='mwAb'>
29228 <td id='mwAc'>foo</td>
29229 <td id='serialize-this'>bar</td>
29230 </table>
29231 !! wikitext
29232 {|
29233 |foo
29234 | id="serialize-this" |bar
29235 |}
29236 !! end
29237
29238 !! test
29239 Parsoid-like element ids should not be serialized to wikitext unless shadowed
29240 !! options
29241 parsoid=html2wt
29242 !! html/parsoid
29243 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
29244 !! wikitext
29245 <div id="hello">ok</div>
29246 !! end
29247
29248 !! test
29249 Testing serialization after deletion in references
29250 !! options
29251 parsoid={
29252 "modes": ["wt2wt"],
29253 "changes": [
29254 ["#x", "remove"]
29255 ]
29256 }
29257 !! wikitext
29258 hi <ref><div id="x">ho</div></ref>
29259
29260 <references />
29261 !! wikitext/edited
29262 hi <ref></ref>
29263
29264 <references />
29265 !! end
29266
29267 !!test
29268 Testing serialization after deletion of table cells
29269 !!options
29270 parsoid={
29271 "modes": ["wt2wt", "selser"],
29272 "changes": [
29273 ["#x", "remove"]
29274 ]
29275 }
29276 !!wikitext
29277 {|
29278 !h1 !!h2 !!h3
29279 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
29280 |}
29281 !! wikitext/edited
29282 {|
29283 !h1!!h2!!h3
29284 |c2|||c3
29285 |}
29286 !!end
29287
29288 !! test
29289 Testing selser after addition of new row before first row (T125419)
29290 !! options
29291 parsoid={
29292 "modes": ["wt2wt", "selser"],
29293 "changes": [
29294 [ "tr", "before", "<tr><td>X</td></tr>" ]
29295 ]
29296 }
29297 !! wikitext
29298 {|
29299 |a
29300 |}
29301 !! wikitext/edited
29302 {|
29303 |X
29304 |-
29305 |a
29306 |}
29307 !! end
29308
29309 !! test
29310 Serialize new table rows in a HTML table using HTML tags
29311 !! options
29312 parsoid={
29313 "modes": ["wt2wt", "selser"],
29314 "changes": [
29315 [ "tr", "before", "<tr><td>X</td></tr>" ]
29316 ]
29317 }
29318 !! wikitext
29319 <table><tr><td>a</td></tr></table>
29320 !! wikitext/edited
29321 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
29322 !! end
29323
29324 !! test
29325 Serialize new table cells in a HTML row using HTML tags
29326 !! options
29327 parsoid={
29328 "modes": ["wt2wt", "selser"],
29329 "changes": [
29330 [ "td", "before", "<td>X</td>" ]
29331 ]
29332 }
29333 !! wikitext
29334 <table><tr><td>a</td></tr></table>
29335 !! wikitext/edited
29336 <table><tr><td>X</td><td>a</td></tr></table>
29337 !! end
29338
29339 !! test
29340 Serialize wikitext list items as HTML list items when embedded in a HTML list
29341 !! options
29342 parsoid=html2wt
29343 !! html
29344 <ul data-parsoid='{"stx": "html"}'>
29345 <li data-parsoid='{}'>a</li>
29346 <li>b</li>
29347 </ul>
29348 !! wikitext
29349 <ul>
29350 <li>a</li>
29351 <li>b</li>
29352 </ul>
29353 !! end
29354
29355 # SSS FIXME: Is this actually a good thing given the
29356 # odd nested list output that is generated by MW?
29357 # <ul><li>foo<ul>..</ul></li></ul> instead of
29358 # <ul><li>foo</li><ul>..</ul></ul>
29359 !! test
29360 Wikitext lists can be nested inside HTML lists
29361 !! options
29362 parsoid=html2wt
29363 !! html
29364 <ul data-parsoid='{"stx": "html"}'>
29365 <li data-parsoid='{"stx": "html"}'>a
29366 <ul><li>b</li></ul>
29367 </li>
29368 </ul>
29369
29370 <ul data-parsoid='{"stx": "html"}'>
29371 <li>x
29372 <ul><li>y</li></ul>
29373 </li>
29374 </ul>
29375 !! wikitext
29376 <ul>
29377 <li>a
29378 * b
29379 </li>
29380 </ul>
29381
29382 <ul>
29383 <li>x
29384 * y
29385 </li>
29386 </ul>
29387 !! end
29388
29389 !! test
29390 WTS change modes
29391 !! options
29392 parsoid={
29393 "modes": ["wt2wt"],
29394 "changes": [
29395 [ "#xyz", "before", "<b>before</b> stuff " ],
29396 [ "#xyz", "after", " stuff <i>after</i>" ],
29397 [ "#xyz", "html", "x <b>y</b> z" ]
29398 ]
29399 }
29400 !! wikitext
29401 <span id="xyz">hello</span>
29402 !! wikitext/edited
29403 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
29404 !! end
29405
29406 !! test
29407 Never serialize a-tag as html, regardless of what data-parsoid has to say
29408 !! options
29409 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29410 !! html/parsoid
29411 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
29412 !! wikitext
29413 [[Foo]]
29414 !! end
29415
29416 ## SSS FIXME: This is broken output nevertheless.
29417 ## What might be a reasonable non-broken output for this?
29418 ## This is an edge case unlikely to be seen in production
29419 ## that I am not wasting more time on this right now.
29420 !! test
29421 Never serialize a-tag as html, no matter what attributes it has
29422 !! options
29423 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29424 !! html/parsoid
29425 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
29426 !! wikitext
29427 [http://boo.org http://boohoo.org]
29428 !! end
29429
29430 # Misnested is an indication that selser can reuse the source but these have
29431 # shown to sneak through on occasion. See T101768.
29432 # The original wikitext here is: [http://test.com [[one]] two three]
29433 !! test
29434 Strip span tags added to mark misnested links
29435 !! options
29436 parsoid=html2wt
29437 !! html/parsoid
29438 <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>
29439 !! wikitext
29440 [http://test.com][[one]] two three
29441 !! end
29442
29443 !! test
29444 Catch regression when unpacking misnested links
29445 !! options
29446 parsoid=wt2html
29447 !! wikitext
29448 {{echo|hi}}[http://example.com [[ho]]]
29449 !! html/parsoid
29450 <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>
29451 !! end
29452
29453 !! test
29454 Catch regression when unpacking with trailing content
29455 !! wikitext
29456 {{echo|Foo <references/> bar}}
29457 !! html/parsoid
29458 <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>
29459 !! end
29460
29461 !! test
29462 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
29463 !! options
29464 parsoid=html2wt
29465 !! html/parsoid
29466 <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|}"]}'>
29467 <tbody><tr><td>d
29468 </td></tr>
29469 </tbody></table>
29470 !! wikitext
29471 {{echo|a}}
29472 {|{{echo|c
29473 {{!}}d
29474 }}
29475 |}
29476 !! end
29477
29478 ## This test verifies the presence and computation of this attribute indirectly
29479 ## by making an edit and ensuring that the serialization is correct (which it would be
29480 ## only if firstWikitextNode is properly set).
29481 !! test
29482 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
29483 !! options
29484 parsoid= {
29485 "modes": ["wt2wt"],
29486 "changes": [
29487 [ "div#x", "remove" ],
29488 [ "div", "before", "<div>new</div>" ]
29489 ]
29490 }
29491 !! wikitext
29492 <div id="x">foo</div>
29493 {|
29494 {{echo|<div>boo</div>
29495 {{!}}b}}
29496 |c
29497 |}
29498 !! wikitext/edited
29499
29500 <div>new</div>
29501 {|
29502 {{echo|<div>boo</div>
29503 {{!}}b}}
29504 |c
29505 |}
29506 !! end
29507
29508 # --------------------------------------------
29509 # Tests spec'ing wikitext serialization norms |
29510 # --------------------------------------------
29511
29512 !! test
29513 Serialize multi-line indent-pre starting with wikitext syntax
29514 !! options
29515 parsoid=html2wt
29516 !! html/parsoid
29517 <pre>* 1
29518 ** 2
29519 * 3</pre>
29520 !! wikitext
29521 * 1
29522 ** 2
29523 * 3
29524 !! end
29525
29526 !! test
29527 1. Categories should always be serialized on their own line
29528 !! options
29529 parsoid=html2wt
29530 !! html/parsoid
29531 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
29532 !! wikitext
29533 foo
29534 [[Category:Foo]]
29535 bar
29536 !! end
29537
29538 !! test
29539 2. Categories that are part of templates should not introduce a line break
29540 !! wikitext
29541 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
29542 !! html/parsoid
29543 <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>
29544 !! end
29545
29546 # Careful while editing these next 2 tests. There are \u200f characters
29547 # before and after the <link> tags in the HTML and following some
29548 # of the categories in wikitext
29549 # Do not remove these characters in edits.
29550 #
29551 # As part of the serialization, these bidi characters will get stripped.
29552 !! test
29553 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
29554 !! options
29555 parsoid={
29556 "modes": ["html2wt"],
29557 "scrubWikitext": true
29558 }
29559 !! html/parsoid
29560 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
29561 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
29562 !! wikitext
29563 [[קטגוריה:טקסים]]
29564 [[קטגוריה: שיטות משפט]]
29565 !! end
29566
29567 !! test
29568 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
29569 !! options
29570 parsoid={
29571 "modes": ["html2wt"],
29572 "scrubWikitext": true
29573 }
29574 !! html/parsoid
29575 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
29576 !! wikitext
29577 [[קטגוריה:טקסים]]
29578 ‏y
29579 !! end
29580
29581 !! test
29582 Lists: Add space after bullets
29583 !! options
29584 parsoid=html2wt
29585 !! html/parsoid
29586 <ul>
29587 <li>foo</li>
29588 <li> bar</li>
29589 <li><span> baz</span></li>
29590 </ul>
29591 !! wikitext
29592 * foo
29593 * bar
29594 * <span> baz</span>
29595 !! end
29596
29597 !! test
29598 1. Headings: Add space before/after == (T53744)
29599 !! options
29600 parsoid=html2wt
29601 !! html/parsoid
29602 <h2>foo</h2>
29603 <h2> bar</h2>
29604 <h2>baz </h2>
29605 <h2><span> baz</span></h2>
29606 !! wikitext
29607 == foo ==
29608
29609 == bar ==
29610
29611 == baz ==
29612
29613 == <span> baz</span> ==
29614 !! end
29615
29616 !! test
29617 2. Headings: Add space before/after == even after hoisted content
29618 !! options
29619 parsoid={
29620 "modes": ["html2wt"],
29621 "scrubWikitext": true
29622 }
29623 !! html/parsoid
29624 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
29625 !! wikitext
29626 [[Category:A2]]
29627
29628 == ok ==
29629 !! end
29630
29631 !! test
29632 1. Headings: suppress newly created empty headings
29633 !! options
29634 parsoid={
29635 "modes": ["html2wt"],
29636 "scrubWikitext": true
29637 }
29638 !! html/parsoid
29639 <h2></h2>
29640 !! wikitext
29641 !! end
29642
29643 !! test
29644 2. Headings: don't suppress empty headings if scrubWikitext is false
29645 !! options
29646 parsoid=html2wt
29647 !! html/parsoid
29648 <h2></h2>
29649 !! wikitext
29650 ==<nowiki/>==
29651 !! end
29652
29653 !! test
29654 3. Headings: suppress empty headings on edits
29655 !! options
29656 parsoid={
29657 "modes": ["selser"],
29658 "scrubWikitext": true,
29659 "changes": [
29660 [ "#x", "remove"]
29661 ]
29662 }
29663 !! wikitext
29664 ==<span id="x">foo</span>==
29665 !! wikitext/edited
29666 !! end
29667
29668 !! test
29669 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
29670 !! options
29671 parsoid={
29672 "modes": ["html2wt"],
29673 "scrubWikitext": true
29674 }
29675 !! html/parsoid
29676 <h2>foo<br/>bar</h2>
29677 <h2>foo <span><br/>bar</span> baz</h2>
29678 !! wikitext
29679 == foo bar ==
29680
29681 == foo <span> bar</span> baz ==
29682 !! end
29683
29684 !! test
29685 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
29686 !! options
29687 parsoid={
29688 "modes": ["html2wt"],
29689 "scrubWikitext": false
29690 }
29691 !! html/parsoid
29692 <h2>foo<br/>bar</h2>
29693 !! wikitext
29694 == foo<br />bar ==
29695 !! end
29696
29697 !! test
29698 1. WT Quote Tags: suppress newly created empty style tags
29699 !! options
29700 parsoid={
29701 "modes": ["html2wt"],
29702 "scrubWikitext": true
29703 }
29704 !! html/parsoid
29705 <i></i><b></b>
29706 !! wikitext
29707 !! end
29708
29709 !! test
29710 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
29711 !! options
29712 parsoid=html2wt
29713 !! html/parsoid
29714 <i></i><b></b>
29715 !! wikitext
29716 ''<nowiki/>'''''<nowiki/>'''
29717 !! end
29718
29719 !! test
29720 3. WT Quote Tags: suppress empty style tags on edits
29721 !! options
29722 parsoid={
29723 "modes": ["selser"],
29724 "scrubWikitext": true,
29725 "changes": [
29726 [ "#x", "remove"]
29727 ]
29728 }
29729 !! wikitext
29730 '''<span id="x">foo</span>'''
29731 !! wikitext/edited
29732 !! end
29733
29734 !! test
29735 1. Anchors: suppress newly created empty anchors
29736 !! options
29737 parsoid={
29738 "modes": ["html2wt"],
29739 "scrubWikitext": true
29740 }
29741 !! html/parsoid
29742 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29743 !! wikitext
29744 !! end
29745
29746 !! test
29747 2. Anchors: don't suppress empty anchors if scrubWikitext is false
29748 !! options
29749 parsoid={
29750 "modes": ["html2wt"],
29751 "scrubWikitext": false
29752 }
29753 !! html/parsoid
29754 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29755 !! wikitext
29756 [[Test|<nowiki/>]]
29757 !! end
29758
29759 !! test
29760 3. Anchors: suppress empty anchors on edits
29761 !! options
29762 parsoid={
29763 "modes": ["selser"],
29764 "scrubWikitext": true,
29765 "changes": [
29766 [ "#x", "remove"]
29767 ]
29768 }
29769 !! wikitext
29770 [[Test|<span id="x">foo</span>]]
29771 !! wikitext/edited
29772 !! end
29773
29774 !! test
29775 3a. Anchors: do not suppress numbered extlinks
29776 !! options
29777 parsoid={
29778 "modes": ["wt2wt"],
29779 "scrubWikitext": true
29780 }
29781 !! wikitext
29782 [http://foo.com]
29783 !! html/parsoid
29784 <a rel="mw:ExtLink" href="http://foo.com"></a>
29785 !! end
29786
29787 !! test
29788 3b. Anchors: do not suppress numbered extlinks
29789 !! options
29790 parsoid={
29791 "modes": ["wt2wt"],
29792 "scrubWikitext": true,
29793 "changes": [
29794 [ "#x", "remove"]
29795 ]
29796 }
29797 !! wikitext
29798 [http://foo.com <span id="x">foo</span>]
29799 !! wikitext/edited
29800 [http://foo.com]
29801 !! end
29802
29803 !!test
29804 Normalizations should be restricted to edited content
29805 !!options
29806 parsoid={
29807 "modes": ["selser"],
29808 "scrubWikitext": true,
29809 "changes": [
29810 [ "h1", "before", "<i></i>"]
29811 ]
29812 }
29813 !!wikitext
29814 a
29815 = =
29816 b
29817 !!wikitext/edited
29818 a
29819 = =
29820 b
29821 !!end
29822
29823 !! test
29824 1. Multiple normalizations (html2wt)
29825 !! options
29826 parsoid={
29827 "modes": ["html2wt"],
29828 "scrubWikitext": true
29829 }
29830 !! html
29831 <h2><i></i></h2>
29832 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
29833 </a><b><i></i></b>x</p>
29834 !! wikitext
29835
29836 [[foo]]
29837 x
29838
29839 !! end
29840
29841 !! test
29842 2. Multiple normalizations (selser)
29843 !! options
29844 parsoid={
29845 "modes": ["selser"],
29846 "scrubWikitext": true,
29847 "changes": [
29848 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
29849 ]
29850 }
29851 !! wikitext
29852 <span id="x">foo</span>
29853 !! wikitext/edited
29854 <span id="x">foo</span>
29855
29856 x
29857 !! end
29858
29859 !! test
29860 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
29861 !! options
29862 parsoid={
29863 "modes": ["html2wt"],
29864 "scrubWikitext": true
29865 }
29866 !! html/parsoid
29867 <p> hi</p>
29868 <p> hello</p>
29869 !! wikitext
29870 hi
29871
29872 hello
29873 !! end
29874
29875 !! test
29876 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
29877 !! options
29878 parsoid=html2wt
29879 !! html/parsoid
29880 <p> hi</p>
29881 <p> hello</p>
29882 !! wikitext
29883 <nowiki> </nowiki>hi
29884
29885 <nowiki> </nowiki> hello
29886 !! end
29887
29888 !! test
29889 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
29890 !! options
29891 parsoid={
29892 "modes": ["html2wt"],
29893 "scrubWikitext": true
29894 }
29895 !! html/parsoid
29896 <p>Foo
29897 bar
29898 baz</p>
29899
29900 <table><tr><td>Foo
29901 bar
29902 baz bang</td></tr></table>
29903
29904 <p><!--boo--> foo
29905 bar</p>
29906
29907 <p> foo
29908 bar<span>boo</span></p>
29909 !! wikitext
29910 Foo
29911 bar
29912 baz
29913
29914 {|
29915 |Foo
29916 bar
29917 baz bang
29918 |}
29919
29920 <!--boo-->foo
29921 bar
29922
29923 foo
29924 bar<span>boo</span>
29925 !! end
29926
29927 !! test
29928 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
29929 !! options
29930 parsoid={
29931 "modes": ["selser"],
29932 "scrubWikitext": true,
29933 "changes": [
29934 [ "p", "html", " a\n b" ]
29935 ]
29936 }
29937 !! wikitext
29938 xyz
29939 !! wikitext/edited
29940 a
29941 b
29942 !! end
29943
29944 !! test
29945 1. New links that end in spaces
29946 !! options
29947 parsoid={
29948 "modes": ["html2wt"],
29949 "scrubWikitext": false
29950 }
29951 !! html/parsoid
29952 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29953 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29954 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29955 !! wikitext
29956 [[Berlin ]]<nowiki/>is the capital of Germany.
29957
29958 [[Foo ]]'''bar'''
29959
29960 [[Boston ]] is a city.
29961 !! end
29962
29963 !! test
29964 2. New links that end in spaces
29965 !! options
29966 parsoid={
29967 "modes": ["html2wt"],
29968 "scrubWikitext": true
29969 }
29970 !! html/parsoid
29971 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29972 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29973 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29974 !! wikitext
29975 [[Berlin]] is the capital of Germany.
29976
29977 [[Foo]] '''bar'''
29978
29979 [[Boston]] is a city.
29980 !! end
29981
29982 !! test
29983 1. Table cells with escapable prefixes
29984 !! options
29985 parsoid={
29986 "modes": ["html2wt"],
29987 "scrubWikitext": false
29988 }
29989 !! html
29990 <table>
29991 <tr><td>a</td></tr>
29992 <tr><td>-</td></tr>
29993 <tr><td>+</td></tr>
29994 </table>
29995 !! wikitext
29996 {|
29997 |a
29998 |-
29999 |<nowiki>-</nowiki>
30000 |-
30001 |<nowiki>+</nowiki>
30002 |}
30003 !! end
30004
30005 !! test
30006 2. Table cells with escapable prefixes
30007 !! options
30008 parsoid={
30009 "modes": ["html2wt"],
30010 "scrubWikitext": true
30011 }
30012 !! html
30013 <table>
30014 <tr><td>a</td></tr>
30015 <tr><td>-</td></tr>
30016 <tr><td>+</td></tr>
30017 </table>
30018 !! wikitext
30019 {|
30020 |a
30021 |-
30022 | -
30023 |-
30024 | +
30025 |}
30026 !! end
30027
30028 !! test
30029 3a. Table cells with escapable prefixes after edits
30030 !! options
30031 parsoid={
30032 "modes": ["selser"],
30033 "scrubWikitext": true,
30034 "changes": [
30035 [ "table tbody tr:first-child td:first-child", "remove"]
30036 ]
30037 }
30038 !! wikitext
30039 {|
30040 |a||-
30041 |}
30042 !! wikitext/edited
30043 {|
30044 | -
30045 |}
30046 !! end
30047
30048 !! test
30049 3b. Table cells with escapable prefixes after edits
30050 !! options
30051 parsoid={
30052 "modes": ["selser"],
30053 "scrubWikitext": true,
30054 "changes": [
30055 [ "table tbody tr:first-child td:first-child", "html", "-" ],
30056 [ "#x", "remove" ]
30057 ]
30058 }
30059 !! wikitext
30060 {|
30061 |pqr
30062 |<span id="x">foo</span>+
30063 |}
30064 !! wikitext/edited
30065 {|
30066 | -
30067 | +
30068 |}
30069 !! end
30070
30071 # FIXME: This test will fail because
30072 # normalization doesn't realize that the id attribute
30073 # will eliminate the escapable scenario
30074 !! test
30075 4a. Table cells without escapable prefixes after edits
30076 !! options
30077 parsoid={
30078 "modes": ["selser"],
30079 "scrubWikitext": true,
30080 "changes": [
30081 [ "#x", "html", "-" ]
30082 ]
30083 }
30084 !! wikitext
30085 {|
30086 | id="x" |abcd
30087 |}
30088 !! wikitext/edited
30089 {|
30090 | id="x" |-
30091 |}
30092 !! end
30093
30094 ## This tests normalizer's ability to discriminate between
30095 ## cells having identical content.
30096 !! test
30097 4b. Table cells without escapable prefixes after edits
30098 !! options
30099 parsoid={
30100 "modes": ["selser"],
30101 "scrubWikitext": true,
30102 "changes": [
30103 [ "td", "html", "-" ]
30104 ]
30105 }
30106 !! wikitext
30107 {|
30108 |a||b
30109 |}
30110 !! wikitext/edited
30111 {|
30112 | -||-
30113 |}
30114 !! end
30115
30116 ## This tests normalizer's ability to not be tripped by
30117 ## comments (and whitespace)
30118 !! test
30119 4c. Table cells without escapable prefixes after edits
30120 !! options
30121 parsoid={
30122 "modes": ["selser"],
30123 "scrubWikitext": true,
30124 "changes": [
30125 [ "table tbody tr td:first-child", "remove" ]
30126 ]
30127 }
30128 !! wikitext
30129 {|
30130 |-
30131 <!--foo--> |a||-
30132 |}
30133 !! wikitext/edited
30134 {|
30135 |-
30136 <!--foo--> | -
30137 |}
30138 !! end
30139
30140 ## This tests normalizer's ability to handle HTML cells
30141 !! test
30142 4d. Table cells without escapable prefixes after edits
30143 !! options
30144 parsoid={
30145 "modes": ["selser"],
30146 "scrubWikitext": true,
30147 "changes": [
30148 [ "td", "html", "-" ]
30149 ]
30150 }
30151 !! wikitext
30152 <table>
30153 <tr><td>a</td></tr>
30154 </table>
30155 !! wikitext/edited
30156 <table>
30157 <tr><td>-</td></tr>
30158 </table>
30159 !! end
30160
30161 ## T111151 Remove font elements without attributes
30162 !! test
30163 5a. font tags without attributes should be dropped in scrubWikitext mode
30164 !! options
30165 parsoid={
30166 "modes": ["html2wt"],
30167 "scrubWikitext": true
30168 }
30169 !! html
30170 <font>foo</font>
30171 <font><font>bar</font></font>
30172 <font class="x">boo</font>
30173 !! wikitext
30174 foo
30175 bar
30176 <font class="x">boo</font>
30177 !! end
30178
30179 !! test
30180 5b. font tags should not be dropped without scrubWikitext being enabled
30181 !! options
30182 parsoid={
30183 "modes": ["html2wt"],
30184 "scrubWikitext": false
30185 }
30186 !! html
30187 <font>foo</font>
30188 !! wikitext
30189 <font>foo</font>
30190 !! end
30191
30192 !! test
30193 Escape nowiki DOM elements
30194 !! options
30195 parsoid=html2wt
30196 !! html/parsoid
30197 <nowiki><i>foo</i></nowiki>
30198 !! wikitext
30199 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
30200 !! end
30201
30202 # This is meant to be an interim fix while we go about figuring out
30203 # how to not introduce these trailing <nowiki/>s in the first place.
30204 !! test
30205 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
30206 !! options
30207 parsoid=html2wt
30208 !! html/parsoid
30209 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
30210 y</p>
30211 <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>
30212 <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>
30213 !! wikitext
30214 x
30215 y
30216
30217 {{echo|
30218 1 = <nowiki/>}}
30219
30220 {{echo|
30221 1 = <nowiki/>
30222 }}
30223 !! end
30224
30225 !! test
30226 New list is serialized on newlines
30227 !! options
30228 parsoid=html2wt
30229 !! html/parsoid
30230 <p>The quick brown fox jumps over the lazy dog.</p><ul>
30231 <li>Yesterday</li>
30232 <li>Today</li>
30233 <li>Tomorrow</li>
30234 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
30235 !! wikitext
30236 The quick brown fox jumps over the lazy dog.
30237
30238 * Yesterday
30239 * Today
30240 * Tomorrow
30241
30242 The quick onyx goblin jumps over the lazy dwarf.
30243 !! end
30244
30245 !! test
30246 New lists in formatting elements serialized w/o newlines
30247 !! options
30248 parsoid=html2wt
30249 !! html/parsoid
30250 <small>
30251
30252 <ul>
30253 <li>123</li>
30254 </ul>
30255
30256 </small>
30257
30258 <small><ul><li>hi</li></ul></small>
30259 !! wikitext
30260 <small>
30261 * 123
30262 </small>
30263
30264 <small>
30265 * hi
30266 </small>
30267 !! end
30268
30269 !! test
30270 New list in table doesn't need newlines
30271 !! options
30272 parsoid=html2wt
30273 !! html/parsoid
30274 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
30275 !! wikitext
30276 {|
30277 |
30278 * test
30279 * 123
30280 |}
30281 !! end
30282
30283 # ---------------------------------------------------
30284 # End of tests spec'ing wikitext serialization norms |
30285 # ---------------------------------------------------
30286
30287 # T104032
30288 !! test
30289 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
30290 !! options
30291 parsoid=html2wt
30292 !! html/parsoid
30293 a<p>b</p>
30294 <b>c</b><p>d</p>
30295 <table><tr>
30296 <td>a<p>b</p></td>
30297 <td><b>c</b><p>d</p></td>
30298 </tr></table>
30299 !! wikitext
30300 a
30301
30302 b
30303
30304 '''c'''
30305
30306 d
30307 {|
30308 |a
30309 b
30310 |'''c'''
30311 d
30312 |}
30313 !! end
30314
30315 !! test
30316 Anchor without href scenarios
30317 !! options
30318 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30319 !! html/parsoid
30320 <a class="bc"></a>
30321 <a class="no">dice</a>
30322 <a name="foo"></a>
30323 !! wikitext
30324
30325 dice
30326 <span name="foo"></span>
30327 !! end
30328
30329 !! test
30330 New transclusion added after a list should be serialized after the list
30331 !! options
30332 parsoid=html2wt
30333 !! html/parsoid
30334 <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>
30335 !! wikitext
30336 * a
30337 {{echo|foo}}
30338 !! end
30339
30340 # -----------------------------------------------------------------
30341 # End of section for Parsoid-only html2wt tests for serialization
30342 # of new content
30343 # -----------------------------------------------------------------
30344
30345 # -----------------------------------------------------------------
30346 # The following section of tests are primarily to spec behavior of
30347 # the selective serializer. All these tests have manual selser
30348 # changes. The automated selser changes for all tests handle the
30349 # wide variation of changes, but these tests here capture specs
30350 # deterministically.
30351 # ----------------------------------------------------------------
30352
30353 ## T90517
30354 !! test
30355 Selser: New comments should not be lost
30356 !! options
30357 parsoid={
30358 "modes": ["selser"],
30359 "changes": [
30360 [ "#a", "after", "<!--c1-->" ],
30361 [ "#b", "before", "<!--c2-->" ]
30362 ]
30363 }
30364 !! wikitext
30365 <span id="a">a</span>
30366
30367 <span id="b">b</span>
30368 !! wikitext/edited
30369 <span id="a">a</span><!--c1-->
30370
30371 <!--c2--><span id="b">b</span>
30372 !! end
30373
30374 ## T89383
30375 !! test
30376 Selser: Check for validity of DSR before using it
30377 !! options
30378 parsoid={
30379 "modes": ["selser"],
30380 "changes": [
30381 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
30382 ]
30383 }
30384 !! wikitext
30385 <span id="a">a</span>
30386 !! wikitext/edited
30387 {{DISPLAYTITLE:foo}}
30388 <span id="a">a</span>
30389 !! end
30390
30391 !! test
30392 1. DOMDiff: Changes to <ref> content should be looked up using id
30393 !! options
30394 parsoid={
30395 "modes": ["selser"],
30396 "changes": [
30397 ["#X", "after", "bar"],
30398 ["#Y", "after", "baz"]
30399 ]
30400 }
30401 !! wikitext
30402 X <ref><span id="X">foo</span></ref>
30403 Y <ref name="a" />
30404 <references>
30405 <ref name="a"><span id="Y">foo</span></ref>
30406 </references>
30407 !! wikitext/edited
30408 X <ref><span id="X">foo</span>bar</ref>
30409 Y <ref name="a" />
30410 <references>
30411 <ref name="a"><span id="Y">foo</span>baz</ref>
30412 </references>
30413 !! end
30414
30415 !! test
30416 2. DOMDiff: Changes to <ref> content should be looked up using id
30417 !! options
30418 parsoid={
30419 "modes": ["selser"],
30420 "changes": [
30421 ["#Z", "after", "bar"]
30422 ]
30423 }
30424 !! wikitext
30425 A <ref>foo bar for a</ref>
30426 B <ref group="X" name="b" />
30427
30428 <references />
30429
30430 <references group="X">
30431 <ref name="b"><span id="Z">foo</span></ref>
30432 </references>
30433 !! wikitext/edited
30434 A <ref>foo bar for a</ref>
30435 B <ref group="X" name="b" />
30436
30437 <references />
30438
30439 <references group="X">
30440 <ref name="b"><span id="Z">foo</span>bar</ref>
30441 </references>
30442 !! end
30443
30444 !! test
30445 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
30446 !! options
30447 parsoid={
30448 "modes": ["selser"],
30449 "changes": [
30450 [ "div:first-child", "text", "bar" ]
30451 ]
30452 }
30453 !! wikitext
30454 <div style="{{1x|color:red;}}%">foo</div>
30455 !! wikitext/edited
30456 <div style="{{1x|color:red;}}%">bar</div>
30457 !! end
30458
30459 !! test
30460 Empty LI (T49673)
30461 !! wikitext
30462 *a
30463 *
30464 *
30465 *b
30466 !! html+tidy
30467 <ul><li>a</li>
30468 <li class="mw-empty-elt"></li>
30469 <li class="mw-empty-elt"></li>
30470 <li>b</li></ul>
30471 !! end
30472
30473 !! test
30474 Thumbnail output
30475 !! wikitext
30476 [[File:Thumb.png|thumb]]
30477 !! html/php+tidy
30478 <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>
30479 !! html/parsoid
30480 <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>
30481 !! end
30482
30483 !! test
30484 unclosed internal link XSS (T137264)
30485 !! wikitext
30486 [[#%3Cscript%3Ealert(1)%3C/script%3E|
30487 !! html/php
30488 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
30489 </p>
30490 !! html/parsoid
30491 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
30492 !! end
30493
30494 !! test
30495 Validating that <style> isn't eaten by tidy (T167349)
30496 !! options
30497 styletag=1
30498 !! wikitext
30499 <div class="foo">
30500 <style>.foo::before { content: "<foo>"; }</style>
30501 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
30502 </div>
30503 !! html/php+tidy
30504 <div class="foo">
30505 <style>.foo::before { content: "<foo>"; }</style>
30506 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
30507 </div>
30508 !! end
30509
30510 !! test
30511 Validating that <style> isn't wrapped in a paragraph (T186965)
30512 !! options
30513 styletag=1
30514 !! wikitext
30515 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30516
30517 <style>.foo::before { content: "<foo>"; }</style>
30518
30519 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
30520
30521 But if it's on a line with other content, let it be wrapped.
30522
30523 <style>.foo::before { content: "<foo>"; }</style> bar
30524
30525 foo <style>.foo::before { content: "<foo>"; }</style>
30526
30527 foo <style>.foo::before { content: "<foo>"; }</style> bar
30528
30529 And the same if we have non-paragraph-breaking whitespace
30530
30531 foo
30532 <style>.foo::before { content: "<foo>"; }</style>
30533 bar
30534 !! html/php
30535 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30536 </p>
30537 <style>.foo::before { content: "<foo>"; }</style>
30538 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
30539 <p>But if it's on a line with other content, let it be wrapped.
30540 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
30541 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
30542 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
30543 </p><p>And the same if we have non-paragraph-breaking whitespace
30544 </p><p>foo
30545 <style>.foo::before { content: "<foo>"; }</style>
30546 bar
30547 </p>
30548 !! end
30549
30550 !! test
30551 Validating that <link> isn't wrapped in a paragraph (T186965)
30552 !! options
30553 styletag=1
30554 !! wikitext
30555 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30556
30557 <link rel="foo" href="bar"/>
30558
30559 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
30560
30561 But if it's on a line with other content, let it be wrapped.
30562
30563 <link rel="foo" href="bar"/> bar
30564
30565 foo <link rel="foo" href="bar"/>
30566
30567 foo <link rel="foo" href="bar"/> bar
30568
30569 And the same if we have non-paragraph-breaking whitespace
30570
30571 foo
30572 <link rel="foo" href="bar"/>
30573 bar
30574 !! html/php
30575 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30576 </p>
30577 <link rel="foo" href="bar"/>
30578 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
30579 <p>But if it's on a line with other content, let it be wrapped.
30580 </p><p><link rel="foo" href="bar"/> bar
30581 </p><p>foo <link rel="foo" href="bar"/>
30582 </p><p>foo <link rel="foo" href="bar"/> bar
30583 </p><p>And the same if we have non-paragraph-breaking whitespace
30584 </p><p>foo
30585 <link rel="foo" href="bar"/>
30586 bar
30587 </p>
30588 !! end
30589
30590 !! test
30591 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
30592 !! config
30593 wgFragmentMode=[ 'html5', 'legacy' ]
30594 !! wikitext
30595 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
30596 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
30597 !! html/php
30598 <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>
30599 <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>
30600 </p>
30601 !! html/parsoid
30602 <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>
30603 <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>
30604 !! end
30605
30606 !! test
30607 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
30608 !! config
30609 wgFragmentMode=[ 'legacy' ]
30610 !! wikitext
30611 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
30612 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
30613 !! html/php
30614 <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>
30615 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
30616 </p>
30617 !! end
30618
30619 !! test
30620 Decoding of HTML entities in embedded HTML tags
30621 !! wikitext
30622 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
30623 !! html/php
30624 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
30625
30626 !! html/parsoid
30627 <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>
30628 !! end
30629
30630 !! test
30631 Decoding of HTML entities in indicator names for IDs (T104196)
30632 !! options
30633 parsoid=wt2html,html2html
30634 showindicators
30635 !! wikitext
30636 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
30637 !! html/php
30638 1&2&3&amp;4&amp;amp;5=Indicator
30639
30640 !! html/parsoid
30641 <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>
30642 !! end
30643
30644 # this version of the test strips out the ambiguity so Parsoid rts cleanly
30645 !! test
30646 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
30647 !! options
30648 showindicators
30649 !! wikitext
30650 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
30651 !! html/php
30652 1&2&3&amp;4&amp;amp;5=Indicator
30653
30654 !! html/parsoid
30655 <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>
30656 !! end
30657
30658 # This fragment mode is what Parsoid supports.
30659 !! test
30660 HTML5 ids: fallback to legacy
30661 !! config
30662 wgFragmentMode=[ 'html5', 'legacy' ]
30663 !! wikitext
30664 ==Foo bar==
30665
30666 ==foo Bar==
30667
30668 ==Тест==
30669
30670 ==Тест==
30671
30672 ==тест==
30673
30674 ==Hey < # " > % : '==
30675 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30676
30677 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30678
30679 <!-- These two links should produce identical HTML -->
30680 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30681
30682 !! html/php
30683 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
30684 <ul>
30685 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30686 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30687 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30688 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30689 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30690 <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>
30691 </ul>
30692 </div>
30693
30694 <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>
30695 <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>
30696 <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>
30697 <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>
30698 <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>
30699 <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>
30700 <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>
30701 </p><p>💩 <span id="💩"></span>
30702 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30703 </p>
30704 !! html/parsoid
30705 <h2 id="Foo_bar">Foo bar</h2>
30706
30707 <h2 id="foo_Bar_2">foo Bar</h2>
30708
30709 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
30710
30711 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
30712
30713 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
30714
30715 <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>
30716 <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>
30717
30718 <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>
30719
30720 <!-- These two links should produce identical HTML -->
30721 <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>
30722 !! end
30723
30724 # Parsoid doesn't support this mode
30725 !! test
30726 HTML5 ids: legacy with a fallback to modern
30727 !! config
30728 wgFragmentMode=[ 'legacy', 'html5' ]
30729 !! wikitext
30730 ==Foo bar==
30731
30732 ==foo Bar==
30733
30734 ==Тест==
30735
30736 ==Тест==
30737
30738 ==тест==
30739
30740 ==Hey < # " > % : '==
30741 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30742
30743 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30744
30745 <!-- These two links should produce identical HTML -->
30746 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30747
30748 !! html/php
30749 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
30750 <ul>
30751 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30752 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30753 <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>
30754 <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>
30755 <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>
30756 <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>
30757 </ul>
30758 </div>
30759
30760 <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>
30761 <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>
30762 <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>
30763 <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>
30764 <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>
30765 <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>
30766 <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>
30767 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
30768 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
30769 </p>
30770 !! end
30771
30772 # Parsoid doesn't support this mode.
30773 !! test
30774 HTML5 ids: no legacy
30775 !! config
30776 wgFragmentMode=[ 'html5' ]
30777 !! wikitext
30778 ==Foo bar==
30779
30780 ==foo Bar==
30781
30782 ==Тест==
30783
30784 ==Тест==
30785
30786 ==тест==
30787
30788 ==Hey < # " > % : '==
30789 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30790
30791 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30792
30793 <!-- These two links should produce identical HTML -->
30794 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30795
30796 !! html/php
30797 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
30798 <ul>
30799 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30800 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30801 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30802 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30803 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30804 <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>
30805 </ul>
30806 </div>
30807
30808 <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>
30809 <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>
30810 <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>
30811 <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>
30812 <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>
30813 <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>
30814 <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>
30815 </p><p>💩 <span id="💩"></span>
30816 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30817 </p>
30818 !! end
30819
30820 !! test
30821 T90902: Normalize weird characters in section IDs
30822 !! config
30823 wgFragmentMode=[ 'html5', 'legacy' ]
30824 !! wikitext
30825 ==Foo&nbsp;bar==
30826 [[#Foo&nbsp;bar]]
30827
30828 !! html/php
30829 <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>
30830 <p><a href="#Foo_bar">#Foo&#160;bar</a>
30831 </p>
30832 !! html/parsoid
30833 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
30834 <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>
30835 !! end
30836
30837 !! test
30838 T51672: Test for brackets in attributes of elements in external link texts
30839 !! wikitext
30840 [http://example.com/ link <span title="title with [brackets]">span</span>]
30841 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
30842
30843 !! html/php
30844 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
30845 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
30846 </p>
30847 !! html/parsoid
30848 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
30849 <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>
30850 !! end
30851
30852 !! test
30853 T72875: Test for brackets in attributes of elements in internal link texts
30854 !! wikitext
30855 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
30856 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
30857
30858 !! html/php
30859 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30860 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30861 </p>
30862 !! html/parsoid
30863 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
30864 <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>
30865 !! end
30866
30867 !! test
30868 T179544: {{anchorencode:}} output should be always usable in links
30869 !! config
30870 wgFragmentMode=[ 'html5' ]
30871 !! wikitext
30872 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
30873 !! html/php
30874 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
30875 </p>
30876 !! html/parsoid
30877 <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>
30878 !! end
30879
30880 ## ------------------------------
30881 ## Parsoid section-wrapping tests
30882 ## ------------------------------
30883 !! test
30884 Section wrapping for well-nested sections (no leading content)
30885 !! options
30886 parsoid={
30887 "wrapSections": true
30888 }
30889 !! wikitext
30890 =1=
30891 a
30892
30893 =2=
30894 b
30895
30896 ==2.1==
30897 c
30898
30899 ==2.2==
30900 d
30901
30902 ===2.2.1===
30903 e
30904
30905 =3=
30906 f
30907 !! html/parsoid
30908 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30909 <p>a</p>
30910
30911 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30912 <p>b</p>
30913
30914 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30915 <p>c</p>
30916
30917 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
30918 <p>d</p>
30919
30920 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
30921 <p>e</p>
30922
30923 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
30924 <p>f</p>
30925
30926 </section>
30927 !! end
30928
30929 !! test
30930 Section wrapping for well-nested sections (with leading content)
30931 !! options
30932 parsoid={
30933 "wrapSections": true
30934 }
30935 !! wikitext
30936 Para 1.
30937
30938 Para 2 with a <div>nested in it</div>
30939
30940 Para 3.
30941
30942 =1=
30943 a
30944
30945 =2=
30946 b
30947
30948 ==2.1==
30949 c
30950 !! html/parsoid
30951 <section data-mw-section-id="0"><p>Para 1.</p>
30952
30953 <p>Para 2 with a </p><div>nested in it</div>
30954
30955 <p>Para 3.</p>
30956
30957 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30958 <p>a</p>
30959
30960 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30961 <p>b</p>
30962
30963 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30964 <p>c</p>
30965
30966 </section></section>
30967 !! end
30968
30969 !! test
30970 Section wrapping with template-generated sections (good nesting 1)
30971 !! options
30972 parsoid={
30973 "wrapSections": true
30974 }
30975 !! wikitext
30976 =1=
30977 a
30978
30979 {{echo|1=
30980 ==1.1==
30981 b
30982 }}
30983
30984 ==1.2==
30985 c
30986
30987 =2=
30988 d
30989 !! html/parsoid
30990 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30991 <p>a</p>
30992
30993 <section 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">
30994 </span><p about="#mwt1">b</p>
30995 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
30996 <p>c</p>
30997
30998 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
30999 <p>d</p></section>
31000 !! end
31001
31002 # In this example, the template scope is mildly expanded to incorporate the
31003 # trailing newline after the transclusion since that is part of section 1.1.1
31004 !! test
31005 Section wrapping with template-generated sections (good nesting 2)
31006 !! options
31007 parsoid={
31008 "wrapSections": true,
31009 "modes": ["wt2html", "wt2wt"]
31010 }
31011 !! wikitext
31012 =1=
31013 a
31014
31015 {{echo|1=
31016 ==1.1==
31017 b
31018 ===1.1.1===
31019 d
31020 }}
31021 =2=
31022 e
31023 !! html/parsoid
31024 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31025 <p>a</p>
31026
31027 <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">
31028 </span><p about="#mwt1">b</p><span about="#mwt1">
31029 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
31030 </span><p about="#mwt1">d</p><span about="#mwt1">
31031 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
31032 <p>e</p></section>
31033 !! end
31034
31035 # In this example, the template scope is mildly expanded to incorporate the
31036 # trailing newline after the transclusion since that is part of section 1.2.1
31037 !! test
31038 Section wrapping with template-generated sections (good nesting 3)
31039 !! options
31040 parsoid={
31041 "wrapSections": true,
31042 "modes": ["wt2html", "wt2wt"]
31043 }
31044 !! wikitext
31045 =1=
31046 a
31047
31048 {{echo|1=
31049 x
31050 ==1.1==
31051 b
31052 ==1.2==
31053 c
31054 ===1.2.1===
31055 d
31056 }}
31057 =2=
31058 e
31059 !! html/parsoid
31060 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
31061 <p>a</p>
31062
31063 <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">
31064 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
31065 </span><p about="#mwt1">b</p><span about="#mwt1">
31066 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
31067 </span><p about="#mwt1">c</p><span about="#mwt1">
31068 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
31069 </span><p about="#mwt1">d</p><span about="#mwt1">
31070 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
31071 <p>e</p></section>
31072 !! end
31073
31074 # Because of section-wrapping and template-wrapping interactions,
31075 # the scope of the template is expanded so that the template markup
31076 # is valid in the presence of <section> tags.
31077 # This exercises the s1 is null scenario in the wrapSections code
31078 !! test
31079 Section wrapping with template-generated sections (bad nesting 1)
31080 !! options
31081 parsoid={
31082 "wrapSections": true
31083 }
31084 !! wikitext
31085 <div>
31086 a
31087
31088 {{echo|
31089 =1=
31090 b
31091 }}
31092
31093 c
31094 </div>
31095 !! html/parsoid
31096 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
31097 <p>a</p>
31098
31099 <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"]}'>
31100 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
31101 </span><p about="#mwt1">b
31102 </p><span about="#mwt1">
31103
31104 </span><p about="#mwt1">c</p><span about="#mwt1">
31105 </span></section></div></section>
31106 !! end
31107
31108 # Because of section-wrapping and template-wrapping interactions,
31109 # the scope of the template is expanded so that the template markup
31110 # is valid in the presence of <section> tags.
31111 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
31112 !! test
31113 Section wrapping with template-generated sections (bad nesting 2)
31114 !! options
31115 parsoid={
31116 "wrapSections": true
31117 }
31118 !! wikitext
31119 =1=
31120 a
31121
31122 {{echo|1=
31123 =2=
31124 b
31125 ==2.1==
31126 c
31127 }}
31128
31129 d
31130
31131 =3=
31132 e
31133 !! html/parsoid
31134 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31135 <p>a</p>
31136
31137 </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">
31138 </span><p about="#mwt1">b</p><span about="#mwt1">
31139 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
31140 </span><p about="#mwt1">c</p><span about="#mwt1">
31141
31142 </span><p about="#mwt1">d</p><span about="#mwt1">
31143
31144 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
31145 <p>e</p></section>
31146 !! end
31147
31148 # Because of section-wrapping and template-wrapping interactions,
31149 # additional template wrappers are added to <section> tags
31150 # so that template wrapping semantics are valid whether section
31151 # tags are retained or stripped. But, the template scope can expand
31152 # greatly when accounting for section tags.
31153 # This exercises the s1 and s2 are in different subtrees scenario
31154 !! test
31155 Section wrapping with template-generated sections (bad nesting 3)
31156 !! options
31157 parsoid={
31158 "wrapSections": true,
31159 "modes": ["wt2html", "wt2wt"]
31160 }
31161 !! wikitext
31162 =1=
31163 a
31164
31165 {{echo|1=
31166 ==1.2==
31167 b
31168 =2=
31169 c
31170 }}
31171
31172 d
31173
31174 =3=
31175 e
31176 !! html/parsoid
31177 <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>
31178 <p>a</p>
31179
31180 <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">
31181 </span><p about="#mwt1">b</p><span about="#mwt1">
31182 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
31183 </span><p about="#mwt1">c</p>
31184
31185 <p>d</p>
31186 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
31187 <p>e</p></section>
31188 !! end
31189
31190 !! test
31191 Section wrapping with uneditable lead section + div wrapping multiple sections
31192 !! options
31193 parsoid={
31194 "wrapSections": true
31195 }
31196 !! wikitext
31197 foo
31198
31199 <div style="border:1px solid red;">
31200 =1=
31201 a
31202
31203 ==1.1==
31204 b
31205
31206 =2=
31207 c
31208 </div>
31209
31210 =3=
31211 d
31212
31213 ==3.1==
31214 e
31215 !! html/parsoid
31216 <section data-mw-section-id="-1"><p>foo</p>
31217
31218 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31219 <section data-mw-section-id="1"><h1 id="1">1</h1>
31220 <p>a</p>
31221
31222 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31223 <p>b</p>
31224
31225 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31226 <p>c</p>
31227 </section></div>
31228
31229 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31230 <p>d</p>
31231
31232 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31233 <p>e</p>
31234 </section></section>
31235 !! end
31236
31237 !! test
31238 Section wrapping with editable lead section + div overlapping multiple sections
31239 !! options
31240 parsoid={
31241 "wrapSections": true
31242 }
31243 !! wikitext
31244 foo
31245
31246 =1=
31247 a
31248 <div style="border:1px solid red;">
31249 b
31250
31251 ==1.1==
31252 c
31253
31254 =2=
31255 d
31256 </div>
31257 e
31258
31259 =3=
31260 f
31261
31262 ==3.1==
31263 g
31264 !! html/parsoid
31265 <section data-mw-section-id="0"><p>foo</p>
31266
31267 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
31268 <p>a</p>
31269 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31270 <p>b</p>
31271
31272 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31273 <p>c</p>
31274
31275 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31276 <p>d</p>
31277 </section></div>
31278 <p>e</p>
31279
31280 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31281 <p>f</p>
31282
31283 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31284 <p>g</p>
31285 </section></section>
31286 !! end
31287
31288 !! test
31289 HTML header tags should not be wrapped in section tags
31290 !! options
31291 parsoid={
31292 "wrapSections": true
31293 }
31294 !! wikitext
31295 foo
31296
31297 <h1>a</h1>
31298
31299 =b=
31300
31301 <h1>c</h1>
31302
31303 =d=
31304 !! html/parsoid
31305 <section data-mw-section-id="0"><p>foo</p>
31306
31307 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
31308
31309 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
31310
31311 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
31312
31313 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
31314 !! end
31315
31316 !! test
31317 Lead section containing only whitespace and comments.
31318 !! options
31319 parsoid={
31320 "wrapSections": true
31321 }
31322 !! wikitext
31323
31324 <!-- this is a comment, presumably significant to editors -->
31325 =1=
31326 a
31327
31328 =2=
31329 b
31330 !! html/parsoid
31331 <section data-mw-section-id="0" data-parsoid="{}">
31332 <!-- this is a comment, presumably significant to editors -->
31333 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
31334 <p>a</p>
31335
31336 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31337 <p>b</p></section>
31338 !! end
31339
31340 !! test
31341 Pseudo-sections emitted by templates should have id -2
31342 !! options
31343 parsoid={
31344 "wrapSections": true
31345 }
31346 !! wikitext
31347 foo
31348 {{echo|<div>
31349 ==a==
31350 ==b==
31351 </div>
31352 }}
31353 !! html/parsoid
31354 <section data-mw-section-id="-1"><p>foo</p>
31355 </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}}]}'>
31356 <section data-mw-section-id="-1"><h2 id="a">a</h2>
31357 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
31358 </section></div><span about="#mwt1">
31359 </span></section>
31360 !! end
31361
31362 ##########################################################################
31363 Tests demonstrating white-space insensitivity in input wikitext
31364 for wikitext headings, wikitext list items, and wikitext table captions,
31365 headings, and cells. HTML versions of the same should preserve whitespace.
31366 ##########################################################################
31367 !! test
31368 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
31369 !! options
31370 parsoid={
31371 "modes": ["wt2html"],
31372 "preserveIEW": true
31373 }
31374 !! wikitext
31375 __NOTOC__
31376 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
31377 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
31378 == <!--Headings with fallback ids--> Личная жизнь ==
31379 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
31380 ; <!--term to define--> term : <!--term's definition--> definition
31381 {|
31382 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
31383 |-
31384 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
31385 |-
31386 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31387 |-
31388 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
31389 |-
31390 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
31391 |}
31392 : {|
31393 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31394 |} foo <!--c1-->
31395 !! html/php+tidy
31396 <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>
31397 <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>
31398 <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>
31399 <ul><li>List item</li></ul>
31400 <dl><dt>term&#160;</dt>
31401 <dd>definition</dd></dl>
31402 <table>
31403 <caption>Table Caption
31404 </caption>
31405 <tbody><tr>
31406 <th>Table Heading 1</th>
31407 <th>Table Heading 2
31408 </th></tr>
31409 <tr>
31410 <td>Table Cell 1</td>
31411 <td>Table Cell 2
31412 </td></tr>
31413 <tr>
31414 <td>class="foo"</td>
31415 <td>Table Cell 3
31416 </td></tr>
31417 <tr>
31418 <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
31419 </td></tr></tbody></table>
31420 <dl><dd><table>
31421 <tbody><tr>
31422 <td>Table Cell 1</td>
31423 <td>Table Cell 2
31424 </td></tr></tbody></table> foo</dd></dl>
31425 !! html/parsoid
31426 <meta property="mw:PageProp/notoc">
31427 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
31428 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
31429 <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>
31430 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
31431 <dl><dt><!--term to define-->term&nbsp;</dt><dd><!--term's definition-->definition</dd></dl>
31432 <table>
31433 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
31434 <tbody><tr>
31435 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th>Table Heading 2<!--c5--></th></tr>
31436 <tr>
31437 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31438 <tr>
31439 <td>class="foo"</td><td><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
31440 <tr>
31441 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One">two</a> <!--c2--> | <!--c3--> some content</td></tr>
31442 </tbody></table>
31443 <dl><dd><table>
31444 <tbody><tr><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31445 </tbody></table> foo<!--c1--></dd></dl>
31446 !! end
31447
31448 # Looks like <caption> is not accepted in HTML
31449 !! test
31450 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
31451 !! options
31452 parsoid={
31453 "modes": ["wt2html"],
31454 "preserveIEW": true
31455 }
31456 !! wikitext
31457 __NOTOC__
31458 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
31459 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
31460 <table>
31461 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
31462 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
31463 </table>
31464 !! html/php+tidy
31465 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
31466 <ul><li> List item </li></ul>
31467 <table>
31468 <tbody><tr><th> Table Heading </th><th></th></tr>
31469 <tr><td> Table Cell </td><th></th></tr>
31470 </tbody></table>
31471 !! html/parsoid
31472 <meta property="mw:PageProp/notoc"/>
31473 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
31474 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
31475 <table>
31476 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
31477 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
31478 </tbody></table>
31479 !! end
31480
31481 !! test
31482 Do not trim whitespace in links and quotes
31483 !! options
31484 parsoid={
31485 "modes": ["wt2html"],
31486 "preserveIEW": true
31487 }
31488 !! wikitext
31489 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
31490 [[Foo| some text ]]
31491 !! html/php+tidy
31492 <p>foo <i> italic </i> and <b> bold </b>
31493 <a href="/wiki/Foo" title="Foo"> some text </a>
31494 </p>
31495 !! html/parsoid
31496 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
31497 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
31498 !! end
31499
31500 !! test
31501 Remove p tags surrounding a single element in a figcaption
31502 !! options
31503 parsoid=html2wt
31504 !! wikitext
31505 [[File:Foobar.jpg|right|200x200px|Caption]]
31506 !! html/parsoid
31507 <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>
31508 !! end
31509
31510 !! test
31511 Selser preserves lack of newline before list and allows newline after the list
31512 !! options
31513 parsoid={
31514 "modes": ["selser"],
31515 "scrubWikitext": true,
31516 "changes": [
31517 [ "ul", "after", "<p>footer</p>" ]
31518 ]
31519 }
31520 !! wikitext
31521 header
31522 *foo
31523 *bar
31524 !! wikitext/edited
31525 header
31526 *foo
31527 *bar
31528
31529 footer
31530 !! end
31531
31532
31533 !! test
31534 Selser does not introduce newlines between unedited paragraph preceding the list
31535 !! options
31536 parsoid={
31537 "modes": ["selser"],
31538 "changes": [
31539 [ "table tbody tr td p:last-child", "empty" ]
31540 ]
31541 }
31542 !! wikitext
31543 {|
31544 |
31545 header
31546 *foo
31547 *bar
31548 footer
31549 |}
31550 !! wikitext/edited
31551 {|
31552 |
31553 header
31554 *foo
31555 *bar
31556
31557 |}
31558 !! end
31559
31560 !! test
31561 Selser does not introduce newlines between unedited paragraph following the list
31562 !! options
31563 parsoid={
31564 "modes": ["selser"],
31565 "changes": [
31566 [ "table tbody tr td p:first-child", "empty" ]
31567 ]
31568 }
31569 !! wikitext
31570 {|
31571 |
31572 header
31573 *foo
31574 *bar
31575 footer
31576 |}
31577 !! wikitext/edited
31578 {|
31579 |
31580
31581 *foo
31582 *bar
31583 footer
31584 |}
31585 !! end
31586
31587 !! test
31588 Remove a list item but do not insert newline above list
31589 !! options
31590 parsoid={
31591 "modes": ["selser"],
31592 "changes": [
31593 [ "ul li:last-child", "remove" ]
31594 ]
31595 }
31596 !! wikitext
31597 header
31598 *foo
31599 *bar
31600 footer
31601 !! wikitext/edited
31602 header
31603 *foo
31604 footer
31605 !! end